Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
wip
neo7733026ba3c0d9b
diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 42a79c8dc..487cb1f0d 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -36,7 +36,7 @@"@tauri-apps/api": "^2.1.1","@tauri-apps/plugin-deep-link": "^2.2.0","@tauri-apps/plugin-dialog": "2.0.1",- "@tauri-apps/plugin-fs": "2.0.3",+ "@tauri-apps/plugin-fs": "2.2.0","@tauri-apps/plugin-http": "^2.0.1","@tauri-apps/plugin-notification": "2.0.0","@tauri-apps/plugin-os": "2.0.0",diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.jsonindex cfa329c41..1d5ab63a3 100644--- a/apps/desktop/src-tauri/capabilities/default.json+++ b/apps/desktop/src-tauri/capabilities/default.json@@ -4,6 +4,20 @@"description": "Capability for the main window","windows": ["*"],"permissions": [+ "fs:default",+ "fs:write-all",+ "fs:read-all",+ "fs:allow-appdata-read",+ "fs:allow-appdata-write",+ {+ "identifier": "fs:scope",+ "allow": [+ { "path": "$APPDATA/**" },+ { "path": "$HOME/**" }+ ]+ },+ "core:path:allow-resolve-directory",+ "core:path:default","core:event:default","core:window:default","core:window:allow-close",diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 51d2e45de..5212cb0d8 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -2047,6 +2047,7 @@ pub async fn run() {}builder+ .plugin(tauri_plugin_fs::init()).plugin(tauri_plugin_deep_link::init()).plugin(tauri_plugin_shell::init()).plugin(tauri_plugin_dialog::init())diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsxindex 86cbe622a..8206e2767 100644--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx@@ -9,6 +9,9 @@ import { Dynamic } from "solid-js/web";import { createWritableMemo } from "@solid-primitives/memo";import { createEventListenerMap } from "@solid-primitives/event-listener";import { produce } from "solid-js/store";+import { writeFile, BaseDirectory } from '@tauri-apps/plugin-fs';+import { appDataDir } from '@tauri-apps/api/path';+import { convertFileSrc } from '@tauri-apps/api/core';import type {BackgroundSource,@@ -83,6 +86,8 @@ export function ConfigSidebar() {},};+ let fileInput!: HTMLInputElement;+return (<KTabsvalue={selectedTab()}@@ -188,21 +193,16 @@ export function ConfigSidebar() {</div><For each={BACKGROUND_SOURCES_LIST}>{(item) => {- const comingSoon = item === "wallpaper" || item === "image";-const el = (props?: object) => (<KTabs.Triggerclass="flex-1 text-gray-400 py-1 z-10 ui-selected:text-gray-500 peer outline-none transition-colors duration-100"value={item}- disabled={comingSoon}{...props}>{BACKGROUND_SOURCES[item]}</KTabs.Trigger>);- if (comingSoon) return <ComingSoonTooltip as={el} />;-return el({});}}</For>@@ -240,13 +240,70 @@ export function ConfigSidebar() {</KRadioGroup></KTabs.Content><KTabs.Content value="image">- <button- type="button"- class="p-[0.75rem] bg-gray-100 w-full rounded-[0.5rem] border flex flex-col items-center justify-center gap-[0.5rem] text-gray-400"+ <Show+ when={+ project.background.source.type === "image" &&+ project.background.source.path+ }+ fallback={+ <button+ type="button"+ onClick={() => fileInput.click()}+ class="p-[0.75rem] bg-gray-100 w-full rounded-[0.5rem] border flex flex-col items-center justify-center gap-[0.5rem] text-gray-400 hover:bg-gray-200 transition-colors duration-100"+ >+ <IconCapImage class="size-6" />+ <span>Click to select or drag and drop image</span>+ </button>+ }>- <IconCapImage class="size-6" />- <span>Click to select or drag and drop image</span>- </button>+ {(source) => (+ <div class="group relative w-full h-48 rounded-md overflow-hidden border border-gray-200">+ <img+ src={convertFileSrc(source())}+ class="w-full h-full object-cover"+ alt="Selected background"+ />+ <div class="absolute top-2 right-2">+ <button+ type="button"+ onClick={() => setProject("background", "source", { type: "color", value: [255, 255, 255] })}+ class="bg-black/50 text-white p-2 rounded-full hover:bg-black/70 transition-colors"+ >+ <IconCapCircleX class="w-4 h-4" />+ </button>+ </div>+ </div>+ )}+ </Show>+ <input+ type="file"+ ref={fileInput}+ class="hidden"+ accept="image/*"+ onChange={async (e) => {+ const file = e.currentTarget.files?.[0];+ if (!file) return;++ try {+ const fileName = `bg-${Date.now()}-${file.name}`;+ const arrayBuffer = await file.arrayBuffer();+ const uint8Array = new Uint8Array(arrayBuffer);++ const fullPath = `${await appDataDir()}/${fileName}`;++ await writeFile(fileName, uint8Array, {+ baseDir: BaseDirectory.AppData+ });++ setProject("background", "source", {+ type: "image",+ path: fullPath,+ });+ } catch (err) {+ console.error('Failed to save image:', err);+ }+ }}+ /></KTabs.Content><KTabs.Content value="color"><Showdiff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rsindex fcb7d7ca6..8d7aab468 100644--- a/crates/rendering/src/lib.rs+++ b/crates/rendering/src/lib.rs@@ -56,6 +56,9 @@ pub enum Background {end: [f32; 4],angle: f32,},+ // Image {+ // path: String,+ // },}impl From<BackgroundSource> for Background {@@ -82,6 +85,7 @@ impl From<BackgroundSource> for Background {],angle: angle as f32,},+ // BackgroundSource::Image { path } => Background::Image { path: path.clone().unwrap() },_ => unimplemented!(),}}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 500f47bae..99a56748d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -113,8 +113,8 @@ importers:specifier: 2.0.1version: 2.0.1'@tauri-apps/plugin-fs':- specifier: 2.0.3- version: 2.0.3+ specifier: 2.2.0+ version: 2.2.0'@tauri-apps/plugin-http':specifier: ^2.0.1version: 2.0.1@@ -4300,10 +4300,10 @@ packages:react-dom:optional: true- '@storybook/[email protected]':- resolution: {integrity: sha512-31OJfaS6Aj3vFO/0pJE6iz3sDkQU6TB0m6/WfZ+i80Re4OG1pu5GCvP8bqOFuEAQpyc2sFKs6B+wOBvZuuSskg==}+ '@storybook/[email protected]':+ resolution: {integrity: sha512-zaXoEd9jWaRpV1n+eIDUdK9CTvh1Qq2AFCFdS2/pj3kenojVmB/BYS9gjbscKMO2h8d38JjSuUY3U+3kpcvgpQ==}peerDependencies:- storybook: ^8.6.0-alpha.0+ storybook: ^8.6.0-alpha.4vite: ^4.0.0 || ^5.0.0 || ^6.0.0'@storybook/[email protected]':@@ -4314,10 +4314,10 @@ packages:peerDependencies:storybook: ^8.3.3- '@storybook/[email protected]':- resolution: {integrity: sha512-FkI3YW7ObEAFBQokJ04uPIQnBbnsfUKf08jriZ/nB03dcUNVDkl1GjPHONXJK8IwUKfKsiXRVqmrqJPSkK6xvQ==}+ '@storybook/[email protected]':+ resolution: {integrity: sha512-34zcOmaSR0aheFqaHWTBvbA6R3RQ4IAJ21Dks6KM+neJzdfm7vvWr/A2fqk8wppN49NNyF3B5g2rVYh/F4PspA==}peerDependencies:- storybook: ^8.6.0-alpha.0+ storybook: ^8.6.0-alpha.4'@storybook/[email protected]':resolution: {integrity: sha512-dHYFQH3mA+EtnCkHXzicbLgsvzYjcDJ1JWsogbItZogkPHgSJM/Wr71uMkcvw8v9mmCyP4NpXJuu6bPoVsOnzg==}@@ -4550,8 +4550,8 @@ packages:'@tauri-apps/[email protected]':resolution: {integrity: sha512-fnUrNr6EfvTqdls/ufusU7h6UbNFzLKvHk/zTuOiBq01R3dTODqwctZlzakdbfSp/7pNwTKvgKTAgl/NAP/Z0Q==}- '@tauri-apps/[email protected]':- resolution: {integrity: sha512-3Xv9cg5krj/2gSo1HFn9GbKUE0keh+DMx7O+hQeSzg1T4yGY5Fv/+yBISmrPa2j9thi3qcjgPj8PnMH4rbl/Dw==}+ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-+08mApuONKI8/sCNEZ6AR8vf5vI9DXD4YfrQ9NQmhRxYKMLVhRW164vdW5BSLmMpuevftpQ2FVoL9EFkfG9Z+g==}'@tauri-apps/[email protected]':resolution: {integrity: sha512-j6IA3pVBybSCwPpsihpX4z8bs6PluuGtr06ahL/xy4D8HunNBTmRmadJrFOQi0gOAbaig4MkQ15nzNLBLy8R1A==}@@ -15052,9 +15052,9 @@ snapshots:react: 18.3.1react-dom: 18.3.1([email protected])- '@storybook/[email protected]([email protected])([email protected](@types/[email protected])([email protected]))':+ '@storybook/[email protected]([email protected])([email protected](@types/[email protected])([email protected]))':dependencies:- '@storybook/csf-plugin': 8.6.0-alpha.0([email protected])+ '@storybook/csf-plugin': 8.6.0-alpha.4([email protected])browser-assert: 1.2.1storybook: 8.3.3ts-dedent: 2.2.0@@ -15085,7 +15085,7 @@ snapshots:storybook: 8.3.3unplugin: 1.16.0- '@storybook/[email protected]([email protected])':+ '@storybook/[email protected]([email protected])':dependencies:storybook: 8.3.3unplugin: 1.16.0@@ -15285,7 +15285,7 @@ snapshots:dependencies:'@tauri-apps/api': 2.1.1- '@tauri-apps/[email protected]':+ '@tauri-apps/[email protected]':dependencies:'@tauri-apps/api': 2.1.1@@ -17671,7 +17671,7 @@ snapshots:'@typescript-eslint/parser': 5.62.0([email protected])([email protected])eslint: 8.57.1eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])+ eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]([email protected]))([email protected])eslint-plugin-import: 2.30.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])eslint-plugin-jsx-a11y: 6.10.0([email protected])eslint-plugin-react: 7.37.0([email protected])@@ -17720,25 +17720,6 @@ snapshots:- supports-color[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]([email protected]))([email protected]):- dependencies:- '@nolyfill/is-core-module': 1.0.39- debug: 4.3.7([email protected])- enhanced-resolve: 5.17.1- eslint: 8.57.1- eslint-module-utils: 2.12.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]([email protected]))([email protected]))([email protected])- fast-glob: 3.3.2- get-tsconfig: 4.8.1- is-bun-module: 1.2.1- is-glob: 4.0.3- optionalDependencies:- eslint-plugin-import: 2.30.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])- transitivePeerDependencies:- - '@typescript-eslint/parser'- - eslint-import-resolver-node- - eslint-import-resolver-webpack- - supports-color-- [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]):dependencies:'@nolyfill/is-core-module': 1.0.39debug: 4.3.7([email protected])@@ -17776,17 +17757,6 @@ snapshots:- eslint-import-resolver-webpack- supports-color- [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]([email protected]))([email protected]))([email protected]):- dependencies:- debug: 3.2.7- optionalDependencies:- '@typescript-eslint/parser': 5.62.0([email protected])([email protected])- eslint: 8.57.1- eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]([email protected]))([email protected])- transitivePeerDependencies:- - supports-color-[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]):dependencies:debug: 3.2.7@@ -17794,7 +17764,7 @@ snapshots:'@typescript-eslint/parser': 5.62.0([email protected])([email protected])eslint: 8.57.1eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])+ eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]([email protected]))([email protected])transitivePeerDependencies:- supports-color@@ -22627,7 +22597,7 @@ snapshots:[email protected]([email protected])([email protected](@types/[email protected])([email protected])):dependencies:- '@storybook/builder-vite': 8.6.0-alpha.0([email protected])([email protected](@types/[email protected])([email protected]))+ '@storybook/builder-vite': 8.6.0-alpha.4([email protected])([email protected](@types/[email protected])([email protected]))transitivePeerDependencies:- storybook- vite