The VS Code of video editing, built for agents.
TypeScript
Initial open source release.
konstantin-paulusc3c105aa2255
diff --git a/.gitignore b/.gitignorenew file mode 100644index 00000000..76fa9d13--- /dev/null+++ b/.gitignore@@ -0,0 +1,37 @@+# Logs+logs+*.log+npm-debug.log*+yarn-debug.log*+yarn-error.log*+pnpm-debug.log*+lerna-debug.log*++node_modules+dist++# Local env files (copy .env.example to .env)+.env+build+dist-ssr+dist-contract+*.local++# Editor directories and files+.vscode/*+!.vscode/extensions.json+.idea+.DS_Store+*.suo+*.ntvs*+*.njsproj+*.sln+*.sw?+.claude+.claire++# Electron+out/++# Vercel+.verceldiff --git a/LICENSE b/LICENSEnew file mode 100644index 00000000..f4bbcd20--- /dev/null+++ b/LICENSE@@ -0,0 +1,373 @@+Mozilla Public License Version 2.0+==================================++1. Definitions+--------------++1.1. "Contributor"+ means each individual or legal entity that creates, contributes to+ the creation of, or owns Covered Software.++1.2. "Contributor Version"+ means the combination of the Contributions of others (if any) used+ by a Contributor and that particular Contributor's Contribution.++1.3. "Contribution"+ means Covered Software of a particular Contributor.++1.4. "Covered Software"+ means Source Code Form to which the initial Contributor has attached+ the notice in Exhibit A, the Executable Form of such Source Code+ Form, and Modifications of such Source Code Form, in each case+ including portions thereof.++1.5. "Incompatible With Secondary Licenses"+ means++ (a) that the initial Contributor has attached the notice described+ in Exhibit B to the Covered Software; or++ (b) that the Covered Software was made available under the terms of+ version 1.1 or earlier of the License, but not also under the+ terms of a Secondary License.++1.6. "Executable Form"+ means any form of the work other than Source Code Form.++1.7. "Larger Work"+ means a work that combines Covered Software with other material, in+ a separate file or files, that is not Covered Software.++1.8. "License"+ means this document.++1.9. "Licensable"+ means having the right to grant, to the maximum extent possible,+ whether at the time of the initial grant or subsequently, any and+ all of the rights conveyed by this License.++1.10. "Modifications"+ means any of the following:++ (a) any file in Source Code Form that results from an addition to,+ deletion from, or modification of the contents of Covered+ Software; or++ (b) any new file in Source Code Form that contains any Covered+ Software.++1.11. "Patent Claims" of a Contributor+ means any patent claim(s), including without limitation, method,+ process, and apparatus claims, in any patent Licensable by such+ Contributor that would be infringed, but for the grant of the+ License, by the making, using, selling, offering for sale, having+ made, import, or transfer of either its Contributions or its+ Contributor Version.++1.12. "Secondary License"+ means either the GNU General Public License, Version 2.0, the GNU+ Lesser General Public License, Version 2.1, the GNU Affero General+ Public License, Version 3.0, or any later versions of those+ licenses.++1.13. "Source Code Form"+ means the form of the work preferred for making modifications.++1.14. "You" (or "Your")+ means an individual or a legal entity exercising rights under this+ License. For legal entities, "You" includes any entity that+ controls, is controlled by, or is under common control with You. For+ purposes of this definition, "control" means (a) the power, direct+ or indirect, to cause the direction or management of such entity,+ whether by contract or otherwise, or (b) ownership of more than+ fifty percent (50%) of the outstanding shares or beneficial+ ownership of such entity.++2. License Grants and Conditions+--------------------------------++2.1. Grants++Each Contributor hereby grants You a world-wide, royalty-free,+non-exclusive license:++(a) under intellectual property rights (other than patent or trademark)+ Licensable by such Contributor to use, reproduce, make available,+ modify, display, perform, distribute, and otherwise exploit its+ Contributions, either on an unmodified basis, with Modifications, or+ as part of a Larger Work; and++(b) under Patent Claims of such Contributor to make, use, sell, offer+ for sale, have made, import, and otherwise transfer either its+ Contributions or its Contributor Version.++2.2. Effective Date++The licenses granted in Section 2.1 with respect to any Contribution+become effective for each Contribution on the date the Contributor first+distributes such Contribution.++2.3. Limitations on Grant Scope++The licenses granted in this Section 2 are the only rights granted under+this License. No additional rights or licenses will be implied from the+distribution or licensing of Covered Software under this License.+Notwithstanding Section 2.1(b) above, no patent license is granted by a+Contributor:++(a) for any code that a Contributor has removed from Covered Software;+ or++(b) for infringements caused by: (i) Your and any other third party's+ modifications of Covered Software, or (ii) the combination of its+ Contributions with other software (except as part of its Contributor+ Version); or++(c) under Patent Claims infringed by Covered Software in the absence of+ its Contributions.++This License does not grant any rights in the trademarks, service marks,+or logos of any Contributor (except as may be necessary to comply with+the notice requirements in Section 3.4).++2.4. Subsequent Licenses++No Contributor makes additional grants as a result of Your choice to+distribute the Covered Software under a subsequent version of this+License (see Section 10.2) or under the terms of a Secondary License (if+permitted under the terms of Section 3.3).++2.5. Representation++Each Contributor represents that the Contributor believes its+Contributions are its original creation(s) or it has sufficient rights+to grant the rights to its Contributions conveyed by this License.++2.6. Fair Use++This License is not intended to limit any rights You have under+applicable copyright doctrines of fair use, fair dealing, or other+equivalents.++2.7. Conditions++Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted+in Section 2.1.++3. Responsibilities+-------------------++3.1. Distribution of Source Form++All distribution of Covered Software in Source Code Form, including any+Modifications that You create or to which You contribute, must be under+the terms of this License. You must inform recipients that the Source+Code Form of the Covered Software is governed by the terms of this+License, and how they can obtain a copy of this License. You may not+attempt to alter or restrict the recipients' rights in the Source Code+Form.++3.2. Distribution of Executable Form++If You distribute Covered Software in Executable Form then:++(a) such Covered Software must also be made available in Source Code+ Form, as described in Section 3.1, and You must inform recipients of+ the Executable Form how they can obtain a copy of such Source Code+ Form by reasonable means in a timely manner, at a charge no more+ than the cost of distribution to the recipient; and++(b) You may distribute such Executable Form under the terms of this+ License, or sublicense it under different terms, provided that the+ license for the Executable Form does not attempt to limit or alter+ the recipients' rights in the Source Code Form under this License.++3.3. Distribution of a Larger Work++You may create and distribute a Larger Work under terms of Your choice,+provided that You also comply with the requirements of this License for+the Covered Software. If the Larger Work is a combination of Covered+Software with a work governed by one or more Secondary Licenses, and the+Covered Software is not Incompatible With Secondary Licenses, this+License permits You to additionally distribute such Covered Software+under the terms of such Secondary License(s), so that the recipient of+the Larger Work may, at their option, further distribute the Covered+Software under the terms of either this License or such Secondary+License(s).++3.4. Notices++You may not remove or alter the substance of any license notices+(including copyright notices, patent notices, disclaimers of warranty,+or limitations of liability) contained within the Source Code Form of+the Covered Software, except that You may alter any license notices to+the extent required to remedy known factual inaccuracies.++3.5. Application of Additional Terms++You may choose to offer, and to charge a fee for, warranty, support,+indemnity or liability obligations to one or more recipients of Covered+Software. However, You may do so only on Your own behalf, and not on+behalf of any Contributor. You must make it absolutely clear that any+such warranty, support, indemnity, or liability obligation is offered by+You alone, and You hereby agree to indemnify every Contributor for any+liability incurred by such Contributor as a result of warranty, support,+indemnity or liability terms You offer. You may include additional+disclaimers of warranty and limitations of liability specific to any+jurisdiction.++4. Inability to Comply Due to Statute or Regulation+---------------------------------------------------++If it is impossible for You to comply with any of the terms of this+License with respect to some or all of the Covered Software due to+statute, judicial order, or regulation then You must: (a) comply with+the terms of this License to the maximum extent possible; and (b)+describe the limitations and the code they affect. Such description must+be placed in a text file included with all distributions of the Covered+Software under this License. Except to the extent prohibited by statute+or regulation, such description must be sufficiently detailed for a+recipient of ordinary skill to be able to understand it.++5. Termination+--------------++5.1. The rights granted under this License will terminate automatically+if You fail to comply with any of its terms. However, if You become+compliant, then the rights granted under this License from a particular+Contributor are reinstated (a) provisionally, unless and until such+Contributor explicitly and finally terminates Your grants, and (b) on an+ongoing basis, if such Contributor fails to notify You of the+non-compliance by some reasonable means prior to 60 days after You have+come back into compliance. Moreover, Your grants from a particular+Contributor are reinstated on an ongoing basis if such Contributor+notifies You of the non-compliance by some reasonable means, this is the+first time You have received notice of non-compliance with this License+from such Contributor, and You become compliant prior to 30 days after+Your receipt of the notice.++5.2. If You initiate litigation against any entity by asserting a patent+infringement claim (excluding declaratory judgment actions,+counter-claims, and cross-claims) alleging that a Contributor Version+directly or indirectly infringes any patent, then the rights granted to+You by any and all Contributors for the Covered Software under Section+2.1 of this License shall terminate.++5.3. In the event of termination under Sections 5.1 or 5.2 above, all+end user license agreements (excluding distributors and resellers) which+have been validly granted by You or Your distributors under this License+prior to termination shall survive termination.++************************************************************************+* *+* 6. Disclaimer of Warranty *+* ------------------------- *+* *+* Covered Software is provided under this License on an "as is" *+* basis, without warranty of any kind, either expressed, implied, or *+* statutory, including, without limitation, warranties that the *+* Covered Software is free of defects, merchantable, fit for a *+* particular purpose or non-infringing. The entire risk as to the *+* quality and performance of the Covered Software is with You. *+* Should any Covered Software prove defective in any respect, You *+* (not any Contributor) assume the cost of any necessary servicing, *+* repair, or correction. This disclaimer of warranty constitutes an *+* essential part of this License. No use of any Covered Software is *+* authorized under this License except under this disclaimer. *+* *+************************************************************************++************************************************************************+* *+* 7. Limitation of Liability *+* -------------------------- *+* *+* Under no circumstances and under no legal theory, whether tort *+* (including negligence), contract, or otherwise, shall any *+* Contributor, or anyone who distributes Covered Software as *+* permitted above, be liable to You for any direct, indirect, *+* special, incidental, or consequential damages of any character *+* including, without limitation, damages for lost profits, loss of *+* goodwill, work stoppage, computer failure or malfunction, or any *+* and all other commercial damages or losses, even if such party *+* shall have been informed of the possibility of such damages. This *+* limitation of liability shall not apply to liability for death or *+* personal injury resulting from such party's negligence to the *+* extent applicable law prohibits such limitation. Some *+* jurisdictions do not allow the exclusion or limitation of *+* incidental or consequential damages, so this exclusion and *+* limitation may not apply to You. *+* *+************************************************************************++8. Litigation+-------------++Any litigation relating to this License may be brought only in the+courts of a jurisdiction where the defendant maintains its principal+place of business and such litigation shall be governed by laws of that+jurisdiction, without reference to its conflict-of-law provisions.+Nothing in this Section shall prevent a party's ability to bring+cross-claims or counter-claims.++9. Miscellaneous+----------------++This License represents the complete agreement concerning the subject+matter hereof. If any provision of this License is held to be+unenforceable, such provision shall be reformed only to the extent+necessary to make it enforceable. Any law or regulation which provides+that the language of a contract shall be construed against the drafter+shall not be used to construe this License against a Contributor.++10. Versions of the License+---------------------------++10.1. New Versions++Mozilla Foundation is the license steward. Except as provided in Section+10.3, no one other than the license steward has the right to modify or+publish new versions of this License. Each version will be given a+distinguishing version number.++10.2. Effect of New Versions++You may distribute the Covered Software under the terms of the version+of the License under which You originally received the Covered Software,+or under the terms of any subsequent version published by the license+steward.++10.3. Modified Versions++If you create software not governed by this License, and you want to+create a new license for such software, you may create and use a+modified version of this License if you rename the license and remove+any references to the name of the license steward (except to note that+such modified license differs from this License).++10.4. Distributing Source Code Form that is Incompatible With Secondary+Licenses++If You choose to distribute Source Code Form that is Incompatible With+Secondary Licenses under the terms of this version of the License, the+notice described in Exhibit B of this License must be attached.++Exhibit A - Source Code Form License Notice+-------------------------------------------++ This Source Code Form is subject to the terms of the Mozilla Public+ License, v. 2.0. If a copy of the MPL was not distributed with this+ file, You can obtain one at http://mozilla.org/MPL/2.0/.++If it is not possible or desirable to put the notice in a particular+file, then You may include the notice in a location (such as a LICENSE+file in a relevant directory) where a recipient would be likely to look+for such a notice.++You may add additional accurate notices of copyright ownership.++Exhibit B - "Incompatible With Secondary Licenses" Notice+---------------------------------------------------------++ This Source Code Form is "Incompatible With Secondary Licenses", as+ defined by the Mozilla Public License, v. 2.0.\ No newline at end of filediff --git a/README.md b/README.mdnew file mode 100644index 00000000..431bda3f--- /dev/null+++ b/README.md@@ -0,0 +1,74 @@+# Diffusion Studio++Open-source video editor: a SolidJS web app with an ECS-based engine, an+Electron desktop wrapper, and a CLI. Talks to the Diffusion Studio backend+through the published [`@diffusionstudio/api-contract`](https://www.npmjs.com/package/@diffusionstudio/api-contract)+package.++## Structure++```+apps/+ web/ SolidJS + Vite SPA (the editor)+ desktop/ Electron desktop app (wraps the web app)+ cli/ CLI (`dapi`) and IPC protocol shared with desktop+```++## Getting Started++Requires [Node.js](https://nodejs.org) v20+.++```bash+npm install+cp apps/web/.env.example apps/web/.env+npm run dev # web app → http://localhost:5173+```++All values in `.env.example` are public; the defaults point the app at the+production API, so no local backend is needed. To develop against a local+backend instead, set `VITE_API_URL=http://localhost:3000` in `apps/web/.env`+(or leave it empty to use the Vite dev proxy, which forwards `/api` to+`http://localhost:3000`).++### Desktop App++The Electron app loads the web dev server in development:++```bash+npm run dev # terminal 1+npm run dev:desktop # terminal 2+```++### Build++```bash+npm run build:web # static build → apps/web/dist+npm run build:desktop+npm run make # package the desktop app+```++### Type Checking & Linting++```bash+npm run check+npm run lint+```++## Deployment++The web app is a static Vite build deployed on Vercel. Project settings:++- **Root Directory**: `apps/web` (Vercel detects the npm workspace and+ installs from the repo root, which the `@diffusionstudio/cli` workspace+ dependency requires)+- Everything else comes from `apps/web/vercel.json`: SPA rewrites, the+ COOP/COEP headers required for SharedArrayBuffer, and a build command that+ copies `.env.example` to `.env` so the public defaults apply.++To override build-time config (API URL, Supabase, analytics), set the+corresponding `VITE_*` variables in the Vercel dashboard — process env takes+precedence over the copied `.env` defaults.++## License++This project is licensed under the [Mozilla Public License 2.0](LICENSE).diff --git a/apps/cli/CLI_API.md b/apps/cli/CLI_API.mdnew file mode 100644index 00000000..684bd668--- /dev/null+++ b/apps/cli/CLI_API.md@@ -0,0 +1,763 @@+# Dapi CLI Reference++User-facing reference for the `dapi` CLI. All canvas/project commands talk to the running Diffusion Studio app over a local socket. Responses are JSON written to stdout. Errors print to stderr and exit non-zero.++**Top-level:** `open`, `whoami`, `context` (alias `ctx`), `mount`, `models`, `voices`.+**Groups:** `selection` (alias `sel`), `node` (aliases `n`, `entity`), `project` (alias `p`), `asset` (alias `a`), `folder` (alias `fld`), `font` (alias `f`).+Selection reads and mutations live under `selection`. Anything that targets one or more nodes lives under `node` — scenes are nodes too; they are created declaratively via `mount` (`<scene key="...">`). Declarative composition happens through `mount`, which renders a Solid JSX project into the canvas (see [JSX_API.md](./JSX_API.md)); `node insert` runs the same pipeline but inserts the rendered nodes into an existing parent entity instead of mounting document roots. AI asset generation (image / video / speech / audio) is **declared in the project module** and produced on mount (see the JSX API); the `models` and `voices` commands list what's available to reference from those declarations. Inspecting an existing asset (probe / transcript / analyze / visualize / frame) lives under `asset`; writing an asset's original file back out to disk is `asset export`. Organizing the asset library into folders lives under `folder`; moving assets between folders is `asset mv`.++Shared types used below:++```ts+NodeRef = { id: number; name: string; type: string } // node ids are entity ids — integers+Size = { width: number; height: number }+Asset = { id: string; name: string; type: string } // asset ids are opaque strings (sqids)+Folder = { id: string; name: string; type: 'folder' } // folder ids are opaque strings (sqids)+Time = number | `${number}f` | "MM:SS" // seconds, frames at 30 fps ("45f"), or a clock string — see JSX_API.md+```++Time inputs take the `Time` format unless noted otherwise. Times in **outputs** are plain seconds — except the raw records of `node ls`, which use engine units (frames at 30 fps, packed colors, dB).++---++## App++### `dapi open [target]`++Launches Diffusion Studio, or opens a target. Behavior depends on what `[target]` resolves to.++- **Input:** `[target]` — optional. One of:+ - *omitted* — launches the app.+ - **`diffusion://...` URL** — follows the deep link.+ - **file path** — opens the file in the app.+ - **folder path** — see "Folder open" below.+- **Options:**+ - `-b, --background` — launch with the window hidden (`show: false`), so the app runs headlessly and can be driven by other CLI commands without any visible UI.+- **Output:**+ - File / URL / no target: nothing.+ - Folder: one JSON object (see below).+- **Notes:** does not require the app to already be running.++#### Folder open++When `[target]` is a directory, `open` either creates a project from the folder's contents or switches to a previously created one. The decision is driven by a `.dapi` marker file at the folder root.++**First time** (no marker present):++1. Creates a new project named after the folder.+2. Imports every supported asset file under the folder (recursively, excluding the marker itself), mirroring the on-disk directory structure as library folders. Directories without any supported assets beneath them produce no folder.+3. Writes the `.dapi` marker at the folder root with the new project id.+4. Opens the project.++**Subsequent times** (marker present):++1. Reads the project id from the marker.+2. Switches to that project. No re-import.+3. If the referenced project no longer exists, the marker is treated as stale and the first-time flow runs again, overwriting the marker.++**Marker file** — `.dapi` at the folder root. JSON:++```ts+{+ version: 1;+ projectId: string;+ createdAt: string; // ISO 8601+}+```++Add to `.gitignore` to keep project association per-clone, or commit it to share the same project across teammates.++**Output:** one JSON object++```ts+{+ project: { id: string; name: string };+ created: boolean; // true if a new project was created this run (first-time or stale-marker)+ imported: number; // assets imported this run; 0 on switch-only+}+```++---++### `dapi whoami`++Prints the authenticated account, or `null` if signed out.++- **Input:** none+- **Output:** one JSON value+ ```ts+ { id: string; email: string; provider: string } | null+ ```++---++## Document++### `dapi context`++Essential context about the open project. Call this first to understand the canvas situation. Alias: `ctx`.++- **Input:** none+- **Output:** one JSON object+ ```ts+ {+ project: { id: string; name: string };+ entityCount: number;+ scenes: Array<{ id: number; name: string; size: Size }>;+ activeSceneId: number | null; // null if no scene is active+ currentFrame: number; // current timeline playhead position, in frames+ fontFamilies: string[];+ }+ ```+---++## Scripting++### `dapi mount (<path> | --code <str>)`++Compiles a Solid JSX project module and executes it in the app, mounting the rendered roots into the document — like reloading a webpage, re-mounting rebuilds them in place instead of adding copies. Every top-level element declares its identity in the JSX with a `key`: `<scene key="intro">` replaces the node carrying that key (or creates it). With `--code`, the `export default () =>` wrapper is optional — a bare JSX expression (no `export default` in the source) is wrapped into a component module automatically. Full specification: [JSX_API.md](./JSX_API.md).++- **Output:** none.++---++## Selection++All under `dapi selection` (alias `dapi sel`). Mutating commands return the resulting selection state in the same shape as `selection ls`, so callers can chain or assert without a follow-up read.++### `dapi selection ls`++The currently selected nodes. Alias: `get`.++- **Input:** none+- **Output:** JSON Lines, one per selected node (no output if nothing is selected)+ ```ts+ NodeRef+ ```++---++### `dapi selection set [ids...]`++Replaces the current selection with exactly the given node ids. No ids = clear the selection.++- **Input:** `[ids...]` — zero or more node ids+- **Output:** JSON Lines, one per selected node (no output when clearing)+ ```ts+ NodeRef+ ```++---++### `dapi selection focus`++Pans and zooms the canvas to fit the currently selected nodes in view, framing them with padding — the same focus used by `node screenshot` before it captures. No-op if nothing is selected (the canvas is left unchanged).++- **Input:** none+- **Output:** JSON Lines, one per selected node (no output if nothing is selected)+ ```ts+ NodeRef+ ```++---++## Node operations++All under `dapi node` (aliases `dapi n`, `dapi entity`).++### `dapi node ls [ids...]`++The raw entity records, exactly as persisted — every component the entity carries, keyed by component name. The property-level counterpart to `node tree`'s structure. With no ids, returns the root (top-level nodes). Alias: `get`.++- **Input:** `[ids...]` — zero or more entity ids (optional)+- **Output:** JSON Lines, one per entity+ ```ts+ EntityRecord = { id: string; eid: number } & { [component: string]: unknown }+ // e.g. Name, Size, Position, Rotation, Paint, Color, Trim, ChildOf (parent eid), …+ ```+ Records are raw engine data: times are frames at 30 fps, colors are packed `0xRRGGBB` integers, volume is dB.+- **Errors:** if any input id fails to resolve, writes a per-id message to stderr and exits non-zero after emitting all successful records to stdout.+++---++### `dapi node tree [id] [--depth N]`++An entity's subtree as a nested JSON object — structure only, every entity and sub-entity included, and the way to discover their ids. Key characteristics are folded into a compact `description` built from whatever the entity carries; use `node ls` for exact property values. The root is level 0, so `--depth 1` yields the root plus its immediate children.++- **Input:**+ - `[id]` — root entity id (optional; omitted = one tree per top-level node, mirroring `ls`)+ - `--depth <N>` — max depth, non-negative integer (optional; default `3`, `0` = full subtree)+- **Output:** JSON Lines, one nested object per root; category arrays are omitted when empty+ ```ts+ NodeTree = NodeRef & {+ description: string; // e.g. "hidden; size: 200x300; text: Hello World"+ children?: NodeTree[]; // child nodes (masks listed separately)+ masks?: NodeTree[];+ paints?: NodeTree[]; // fills+ strokes?: NodeTree[];+ shadows?: NodeTree[];+ effects?: NodeTree[];+ colorStops?: NodeTree[]; // on gradient paints+ textRanges?: NodeTree[]; // on text nodes+ keyframeTracks?: NodeTree[]; // keyframes nest beneath their track+ keyframes?: NodeTree[];+ animations?: NodeTree[];+ }+ ```++---++### `dapi node grep <pattern> [id]`++Searches entity records for a pattern and prints the matching entities, with the components that matched. The search corpus is the raw records [`node ls`](#dapi-node-ls-ids) would emit — component values stringified — so anything `ls` can show, `grep` can find; the caveat carries over too: values are raw engine units (frames at 30 fps, packed colors, dB). `[id]` scopes the search to a subtree, like giving `grep -r` a path. The structural counterpart of `tree` (find entities by content rather than by position) and the discovery front-end to `ls`, `selection set`, and `patch`: `grep` to find ids, then read, select, or edit them.++The common case — find nodes by name — is `dapi node grep -k Name Title`. Presence queries work with a match-anything pattern: `dapi node grep -k Trim .` lists every entity carrying a `Trim` component.++- **Input:**+ - `<pattern>` — JavaScript regex, unanchored (required). Case-sensitive unless `-i` is given.+ - `[id]` — root entity id (optional; omitted = every top-level node's subtree)+ - `-i, --ignore-case` — case-insensitive matching+ - `-t, --type <types...>` — only match entities of these node types (e.g. `-t text image`; the `type` values of `node tree`)+ - `-k, --component <names...>` — restrict matching to these components (e.g. `-k Name Chars`; the component keys of `node ls`)+ - `-l, --refs-only` — output only the matching entity refs, no match detail+ - `-c, --count` — output only the number of matching entities+- **Output:** JSON Lines, one per matching entity (no output if nothing matches — this is a successful run, exit `0`); the structured analog of grep's `file:line:content`+ ```ts+ NodeRef & { matches: Array<{ component: string; value: string }> }+ // value is the stringified component value the pattern matched+ ```+ With `--refs-only`, plain `NodeRef` lines; with `--count`, a single number.+- **Errors:** exits non-zero if the pattern is not a valid regex, or if `[id]` doesn't resolve to a live entity.++---++### `dapi node screenshot [id] [-t, --time <time>]`++Focuses the node on the canvas and captures a screenshot, written to a PNG file in the system temp directory. If `[id]` is omitted, captures the canvas (the active scene).++- **Input:**+ - `[id]` — node id (optional; defaults to the canvas)+ - `-t, --time <time>` — timeline position at which to record the node, a `Time` value (optional; defaults to the current playhead position)+- **Output:** one JSON object — the absolute path to a freshly written PNG in the system temp directory with a uuid filename+ ```ts+ { path: string } // e.g. "/tmp/3f2c1a8e-....png"+ ```++---++### `dapi node insert <parentId> (<path> | --code <str>) [--index <N>]`++Compiles a Solid JSX project module and executes it in the app — the same pipeline as [`mount`](#dapi-mount-path---code-str), including declared asset generation — but instead of mounting the rendered roots into the document, inserts them as children of an existing entity. Because the result is inserted rather than reconciled, root elements take no `key`: every run inserts fresh entities; there is no replace-or-create matching and nothing is deleted. Full specification: [JSX_API.md](./JSX_API.md).++The rendered roots must be valid as children of the target parent, following the JSX containment rules: a node parent takes any element or paint root except `<scene>` (scenes only exist at the document top level) and `<colorStop>`; a gradient paint parent takes only `<colorStop>` roots — this is how a stop is added to an existing gradient (`node insert <paintId> --code '<colorStop offset={0.5} color="#FF0055" />'`); other sub-entities take no children.++- **Input:**+ - `<parentId>` — entity id of the parent to insert into (required)+ - project module — exactly one of:+ - `<path>` — path to the module file+ - `--code <str>` — inline module source; the `export default () =>` wrapper is optional, a bare JSX expression is wrapped automatically (e.g. `--code '<rect width={100} height={100} />'`)+ - `-i, --index <N>` — the inserted node's 0-based position among the parent's children, a non-negative integer (optional; default = append after the last child; values past the end are clamped). Node roots only: paints stack in insertion order and color stops render sorted by `offset`, so `--index` is rejected for them.+- **Output:** none.+- **Errors:** exits non-zero if `<parentId>` doesn't resolve to a live entity, if compilation or evaluation fails, if a rendered root is invalid as a child of the parent (e.g. a `<scene>`, or a non-`<colorStop>` in a gradient paint), or if `--index` is given for a paint or color stop root. On any of these, **nothing is inserted**.++---++### `dapi node rm <ids...>`++Deletes one or more entities and all their descendants. Alias: `remove`.++- **Input:** `<ids...>` — one or more entity ids (required)+- **Output:** JSON Lines, one per input id+ ```ts+ | { status: "fulfilled"; id: number }+ | { status: "rejected"; id: number; error: string }+ ```++---++### `dapi node patch ([path] | --json <str>)`++Assigns JSX props on one or more existing entities in a single call. Every patch entry takes the same properties, with the same value requirements, as a JSX element in [`mount`](#dapi-mount-path---code-str) — the full table lives in [JSX_API.md](./JSX_API.md#element-reference) and is not repeated here; the payload type is `PatchProps` from `@diffusionstudio/jsx`. Patches are applied through the same setters as a render, so the two surfaces cannot diverge. Changes are tracked for undo like a UI edit.++Any live entity is addressable — not just nodes: paints and color stops can be patched too (`color`, `offset`, `opacity`, gradient `rotation`). There is no separate rename command: renaming a node is patching its `name`.++- **Input:** exactly one of:+ - `[path]` — path to a `.json` file containing the patch array+ - `--json <str>` — the array inline++ Payload shape:+ ```ts+ Array<{ id: number } & PatchProps>+ ```++ All props are optional; a patch may set any subset. An unsupported property or an out-of-range value rejects that entity; a rejected patch applies none of its props (no half-applied patches). Notes beyond the JSX table:+ - `fill` recolors the entity's existing solid fill(s), or creates one if the entity has none.+ - `src` takes a path, URL, or asset id (`generate.*` declarations are JSX-only). The source resolves asynchronously after the other props land — if resolution fails, the entity is reported rejected even though its other props were applied; patch `src` on its own to avoid ambiguity.+ - Element applicability is not checked: props are applied wherever `mount` would apply them (e.g. `fontSize` only makes sense on a text node).+- **Output:** JSON Lines, one per input id+ ```ts+ | { status: "fulfilled"; id: number }+ | { status: "rejected"; id: number; error: string }+ ```++---++### `dapi node cp <ids...>`++Deep-clones one or more nodes, including all descendants. Alias: `duplicate`.++- **Input:** `<ids...>` — one or more node ids (required)+- **Output:** JSON Lines, one per input id+ ```ts+ | { status: "fulfilled"; sourceId: number; newId: number }+ | { status: "rejected"; sourceId: number; error: string }+ ```++---++### `dapi node export [id] ([config] | --json <str>)`++Renders a scene to a video file. Composes the scene frame-by-frame and muxes the result, writing it to disk. Operates on one scene — scenes are nodes, so this is the node-level render. If `[id]` is omitted, exports the active scene.++Encode settings are passed as a single JSON config — the same object the in-app render method takes (`EncoderConfig`), minus the runtime-only fields the CLI fills in for you (`scene`, `target`, `onProgress`). The whole config is **optional**; omit it to render with the defaults below. The encode window follows the scene's timeline workarea (its `Trim`): export starts at the workarea start and runs to the scene's end, unless capped earlier with `trim.end`. Renders locally; **no credits** and no authenticated account required.++Like the generators, this is **long-running** — the CLI blocks until the render finishes (or fails) before printing. While waiting, a progress spinner with elapsed time is shown on **stderr** (a single static line when stderr isn't a TTY), so stdout stays clean JSON for piping.++- **Input:**+ - `[id]` — scene node id (optional; defaults to the active scene).+ - `-o, --output <path>` — write the video here (optional; default a uuid-named file in the system temp directory). The container extension is derived from the config's `format`.+ - Encode config (optional) — at most one of:+ - `[config]` — path to a `.json` file containing the config object. Node ids are integers, so a lone non-numeric positional is read as the config path (`dapi node export encode.json` works without an id).+ - `--json <str>` — the object inline++ Config shape (every field optional; all defaults shown):+ ```ts+ {+ format?: "mp4" | "webm" | "ogg" | "mov"; // default "mp4"; sets the output extension+ video?: {+ codec?: "avc" | "hevc" | "vp9" | "av1" | "vp8"; // default "avc" (H.264); valid codecs depend on format+ enabled?: boolean; // default true+ bitrate?: number; // bits/sec, default 10_000_000 (10 Mbps)+ fps?: number; // default the scene's frame rate+ resolution?: number; // target height in px (e.g. 720, 1080, 1440, 2160); default 1080. Width follows the scene's aspect ratio+ };+ audio?: {+ enabled?: boolean; // default true; set false to render video only+ codec?: "aac" | "opus"; // default "aac"; valid codecs depend on format+ bitrate?: number; // bits/sec, default 128_000 (128 kbps)+ sampleRate?: number; // Hz, e.g. 44100, 48000, 96000; default 48000+ numberOfChannels?: number; // default 2+ };+ trim?: {+ end?: number; // seconds; cap the encode here. Default the scene's full duration. Caps the workarea end; cannot extend past the scene+ };+ }+ ```+- **Output:** one JSON object — the absolute path to the written video file+ ```ts+ { path: string } // e.g. "/tmp/3f2c1a8e-....mp4", or the --output path+ ```+- **Errors:** exits non-zero if the id is unknown or the node is not a scene (`Not a scene`), if no scene is active and `[id]` is omitted, if the config is malformed or holds a value out of range or incompatible with the chosen `format` (e.g. an unsupported codec), if `--output` can't be written, or if the render fails or is canceled.++---++## Projects++All under `dapi project` (alias `dapi p`).++### `dapi project active`++Prints the currently active project, or `null` if none is open.++- **Input:** none+- **Output:** one JSON value+ ```ts+ { id: string; name: string } | null+ ```++---++### `dapi project ls`++Lists all projects, most recently accessed first. Alias: `list`.++- **Input:** none+- **Output:** one JSON object per line (newline-delimited)+ ```ts+ { id: string; name: string; createdAt: string; lastAccessedAt: string }+ ```++---++### `dapi project create [name]`++Creates a new project and opens it.++- **Input:** `[name]` — optional project name+- **Output:** one JSON object+ ```ts+ { id: string; name: string }+ ```++---++### `dapi project set <id>`++Sets the active project by id, opening it. Returns `null` if no project has that id.++- **Input:** `<id>` — project id (required)+- **Output:** one JSON value+ ```ts+ { id: string; name: string } | null+ ```++---++### `dapi project rm <id>`++Deletes a project by id. Alias: `remove`.++- **Input:** `<id>` — project id (required)+- **Output:** one JSON object+ ```ts+ { id: string; name: string }+ ```++---++## Assets++All under `dapi asset` (alias `dapi a`). Operate on the open project.++### `dapi asset add <paths...>`++Adds one or more local files as assets in the open project.++- **Input:**+ - `<paths...>` — absolute or relative file paths (resolved against CWD)+ - `--folder <id>` — folder to place the new assets in (optional; default the library root)+- **Output:** JSON Lines, one per input path+ ```ts+ | ({ status: "fulfilled"; path: string } & Asset)+ | { status: "rejected"; path: string; error: string }+ ```+- **Errors:** exits non-zero before importing anything if `--folder` doesn't resolve to a folder.++---++### `dapi asset ls`++Lists the asset library of the open project as its folder tree — folders and assets interleaved in one array, each folder carrying its contents in `children`. Aliases: `list`, `get`.++- **Input:**+ - `--folder <id>` — folder whose contents to list (optional; default the library root)+ - `--depth <N>` — max depth, positive integer (optional; default = full tree). `--depth 1` yields just the direct entries of the listing root; a folder at the cutoff is listed with an empty `children` array (indistinguishable from a genuinely empty folder — raise the depth to tell them apart).+- **Output:** JSON Lines, one per entry of the listing root (no output if the listing root is empty); each entry carries its own subtree in `children`+ ```ts+ AssetTree = Array<(Asset | Folder) & { children: AssetTree }> // one root entry per line+ ```+ Folders are the entries with type `folder`. An asset's `children` is always empty.+- **Errors:** exits non-zero if `--folder` doesn't resolve to a folder.++---++### `dapi asset rm <ids...>`++Deletes one or more assets from the open project by id. Alias: `remove`.++- **Input:** `<ids...>` — asset ids (required)+- **Output:** JSON Lines, one per input id+ ```ts+ | { status: "fulfilled"; id: string; name: string }+ | { status: "rejected"; id: string; error: string }+ ```++---++### `dapi asset mv <ids...> [--to <folderId>]`++Moves one or more assets into a folder. Alias: `move`.++- **Input:**+ - `<ids...>` — asset ids (required)+ - `--to <folderId>` — destination folder (optional; omitted = the library root)+- **Output:** JSON Lines, one per input id+ ```ts+ | { status: "fulfilled"; id: string; folderId: string | null }+ | { status: "rejected"; id: string; error: string }+ ```+- **Errors:** exits non-zero before moving anything if `--to` doesn't resolve to a folder; an unknown asset id rejects that id only.++---++### `dapi asset export <ids...>`++Writes one or more assets' original file bytes to a location on the file system — the exact bytes stored in the library, streamed to disk in chunks (never buffered whole). No re-encode, no processing, no credits. Any asset type is accepted except image sequences. The counterpart of `asset add`.++- **Input:**+ - `<ids...>` — asset ids (required)+ - `-o, --output <path>` — where to write (optional; default the system temp directory). Interpreted as:+ - **a directory** — when the path is an existing directory, ends with a path separator, or multiple ids are given. Created if missing. Each asset is written into it named after the asset, with an extension derived from its media type when the name lacks one. A name that collides with an existing file is uniquified with a ` (N)` suffix — never overwritten.+ - **a file path** — otherwise (single id only). Written exactly there, overwriting an existing file.+- **Output:** JSON Lines, one per input id, in the requested order+ ```ts+ | { status: "fulfilled"; id: string; path: string } // path = the file actually written+ | { status: "rejected"; id: string; error: string }+ ```+- **Errors:** exits non-zero before writing anything if `--output` must be a directory (multiple ids, or a trailing path separator) but resolves to an existing file, or if the output directory can't be created. An unknown id — or an image-sequence asset — rejects that id only; a rejected asset leaves no partial file behind.++---++### `dapi asset probe <id|path>`++Reads the container and per-track technical metadata of an asset — like `ffprobe`, but demuxed locally with mediabunny. Reports the container format, duration, metadata tags, and every track's codec parameters without decoding any media. Reads locally; no credits.++- **Input:**+ - `<id|path>` — an asset id, or a local file to add and probe (required). Any asset type is accepted.+- **Output:** one JSON object. The shape is **not yet stable** — it reports whatever mediabunny surfaces about the container and its tracks. Packet stats (frame rate, bitrate, packet count) are estimated from a leading sample of packets, so they are fast but approximate. Assets mediabunny can't demux (images, transcripts) don't error; they report file-level info only, with `format: null` and no tracks.+- **Errors:** exits non-zero if the id is unknown.++---++### `dapi asset transcript <id|path>`++Transcribes the speech in a video or audio asset and returns the timed transcript. Word-level start/end times are in **seconds** (source/content time).++- **Input:**+ - `<id|path>` — a video or audio asset id, or a local file to add and transcribe (required).+- **Output:** one JSON object — the transcript:+ ```ts+ {+ id: string; // the asset id+ segments: Array<{+ text: string; // spoken words only (no silence markers)+ words: Array<{ text: string; start: number; end: number }>; // seconds;+ }>;+ }+ ```+- **Errors:** exits non-zero if the id is unknown or the asset is not a video/audio asset, or if no speech is detected in the audio (`No speech detected`).++---++### `dapi asset analyze <id|path>`++Analyzes an image, video, or audio asset with a multimodal model. With no prompt it returns a general description of the asset; with `--prompt` it answers that question about the asset (e.g. "what's the dominant color?", "summarize what happens").++- **Input:**+ - `<id|path>` — an image, video, or audio asset id, or a local file to add and analyze (required).+ - `-p, --prompt <str>` — question or instruction about the asset (optional; defaults to a general description).+ - `-s, --start <time>` — start of the segment to analyze, a `Time` value (optional; default `0`). Timestamps in the analysis are relative to this point. Ignored for images.+ - `-e, --end <time>` — end of the segment to analyze, a `Time` value (optional; default the asset's duration). Ignored for images.+- **Output:** one JSON object — the model's answer+ ```ts+ { id: string; analysis: string } // id = the analyzed asset id+ ```+- **Errors:** exits non-zero if the id is unknown, or the asset's media type isn't supported by the chosen model.++---++### `dapi asset visualize <id|path>`++Renders a visual preview of an asset to a PNG, written to a file in the system temp directory. The visualization is chosen by the asset's media type, so a single command covers the whole library. Renders locally; no credits. Alias: `viz`.++- **By media type:**+ - **audio** — an amplitude waveform with a time axis (tick labels along the bottom in `mm:ss`), drawn from decoded audio peaks.+ - **video** — a composite: a **filmstrip** of frames sampled at even intervals across the window, with the **waveform** of the video's audio track drawn beneath it, sharing one `mm:ss` (or milliseconds) time axis. Videos with no audio track render the filmstrip alone.+ - **image** — a thumbnail of the image, auto-scaled.+- **Input:**+ - `<id|path>` — an image, audio, or video asset id, or a local file to add and visualize (required).+ - `-s, --start <time>` — start of the window to visualize, a `Time` value in source/content time (optional; default `0`). Ignored for images.+ - `-e, --end <time>` — end of the window to visualize, a `Time` value (optional; default the asset's duration). Ignored for images.+ - `-x, --scale <factor>` — scale factor for the thumbnails (optional; default `1`, clamped to `0.25`–`4`). The overall canvas size stays fixed, so smaller thumbnails fit **more rows and columns** (a denser grid sampling more moments) and larger thumbnails fit fewer but show more detail each. For images, scales the output resolution instead (never above the source size).+ - `-o, --output <path>` — write the PNG here instead of a temp file (optional).+- **Output:** one JSON object — the absolute path to the written PNG+ ```ts+ { path: string } // e.g. "/tmp/3f2c1a8e-....png", or the --output path+ ```+- **Errors:** exits non-zero if the id is unknown, the media type isn't visualizable (e.g. a transcript asset, or an audio asset with no decodable audio), `--start`/`--end` fall outside the asset or cross (`--start` ≥ `--end`), `--scale` isn't a positive number, or `--output` can't be written.++---++### `dapi asset frame <id|path>`++Decodes one or more frames of a video asset at the given times and writes each to a PNG file — like `node screenshot`, but grabs the asset's own pixels at full resolution (unlike `node screenshot`, which captures the composited canvas). Renders locally; no credits.++- **Input:**+ - `<id|path>` — a video asset id, or a local video file to add and grab frames from (required).+ - `-t, --time <time...>` — one or more timestamps to grab, `Time` values in source/content time (optional; default `0`). Order is preserved in the output regardless of the order given.+ - `-o, --output <dir>` — directory to write the PNGs into (optional; default the system temp directory). Each frame is written as a uuid-named `.png`.+- **Output:** JSON Lines, one object per requested timestamp, in the requested order+ ```ts+ { time: number; path: string } // time = the requested timestamp in seconds; path = the written PNG+ ```+- **Errors:** exits non-zero if the id is unknown, the asset is not a video, any `--time` is past the asset's duration, or a PNG can't be written.++---++### `dapi asset sync <audioId|path>`++Measures the time offset between a standalone audio recording and the camera audio embedded in a video — for aligning a separate voice/lav recording to the in-camera sound of the same take. Cross-correlates the two audio signals and returns the offset plus a confidence score. **Read-only** — it reports the offset and leaves it to the caller to act on (position the clip with `node` commands, trim, mute the camera track). Renders locally; no credits. Alias: `align`.++- **Input:**+ - `<audioId|path>` — the audio (or video) asset to align: an id or a local file to add (required). Its audio track is the signal being measured.+ - `-v, --video <id|path>` — the reference video asset whose camera audio to align against: an id or a local file to add (required).+- **Output:** one JSON object — the measured alignment:+ ```ts+ {+ audioId: string; // the aligned asset+ videoId: string; // the reference video+ offsetSeconds: number; // sign convention: place the audio at+ // audioStart = videoStart + offsetSeconds+ // positive = recording started AFTER the camera rolled+ confidence: number; // 0..1, normalized cross-correlation peak (clear match ≳ 0.9)+ }+ ```+- **Errors:** exits non-zero if either id is unknown, either asset has no decodable audio track, or the two clips share too little common audio to align (`No reliable alignment found`).++---++## Folders++All under `dapi folder` (alias `dapi fld`). Operate on the open project. Folders organize the asset library and nest arbitrarily; assets reference their containing folder via `folderId` (`null` = library root). Everywhere a folder id is optional, omitting it means the library root — there is no sentinel value for the root. Read the full hierarchy (folders and assets together) with [`asset ls`](#dapi-asset-ls); move assets between folders with [`asset mv`](#dapi-asset-mv-ids---to-folderid).++### `dapi folder ls [parentId]`++Lists the direct child folders of a parent folder, sorted by name. With no id, lists the root-level folders. Aliases: `list`, `get`.++- **Input:** `[parentId]` — parent folder id (optional; omitted = the library root)+- **Output:** JSON Lines, one per child folder (no output if the parent has no subfolders)+ ```ts+ Folder+ ```+- **Errors:** exits non-zero if `[parentId]` doesn't resolve to a folder.++---++### `dapi folder create <name> [-p, --parent <id>]`++Creates a folder.++- **Input:**+ - `<name>` — folder name (required)+ - `-p, --parent <id>` — parent folder (optional; omitted = the library root)+- **Output:** one JSON object+ ```ts+ Folder+ ```+- **Errors:** exits non-zero if `--parent` doesn't resolve to a folder.++---++### `dapi folder rename <id> <name>`++Renames a folder.++- **Input:**+ - `<id>` — folder id (required)+ - `<name>` — new name (required)+- **Output:** one JSON object+ ```ts+ Folder+ ```++---++### `dapi folder mv <ids...> [--to <folderId>]`++Moves one or more folders under a new parent. A folder cannot be moved into itself or any of its descendants — such a move rejects that id and leaves it where it was. Alias: `move`.++- **Input:**+ - `<ids...>` — folder ids (required)+ - `--to <folderId>` — destination parent folder (optional; omitted = the library root)+- **Output:** JSON Lines, one per input id+ ```ts+ | { status: "fulfilled"; id: string; parentId: string | null }+ | { status: "rejected"; id: string; error: string } // unknown id, or a cycle+ ```+- **Errors:** exits non-zero before moving anything if `--to` doesn't resolve to a folder.++---++### `dapi folder rm <ids...>`++Deletes one or more folders. **Deletion cascades:** every descendant folder and every asset inside the subtree is deleted with it. The fulfilled record reports what the cascade removed, so callers can detect when a delete swept more than intended. Alias: `remove`.++- **Input:** `<ids...>` — folder ids (required)+- **Output:** JSON Lines, one per input id+ ```ts+ | { status: "fulfilled"; id: string; deletedFolders: number; deletedAssets: number }+ // deletedFolders counts the folder itself plus all descendants+ | { status: "rejected"; id: string; error: string }+ ```++---++## Generation reference++**Asset generation (image / video / speech / audio) is declared in the project module** (`generate.*` declarations, see the JSX API) and produced by the editor on mount. There are no CLI commands that generate; the two commands below only list what you can reference from those declarations. (Captioning is also declarative — a `<captions>` element in a mounted or inserted project, see [Captions](./JSX_API.md#captions).) Both require the app to be running.++### `dapi models [type]`++Lists the generation models available for a media type, including each model's capabilities — use it to discover valid model ids and the per-model constraints (durations, aspect ratios, features) to set on an asset declaration (see the JSX API).++- **Input:** `[type]` — optional; one of `image`, `video`, `audio`. Omit to list all three groups.+- **Output:** JSON Lines, one per model+ ```ts+ {+ type: "image" | "video" | "audio";+ id: string; // the model id to set on <asset model="…">+ name: string;+ durations?: string[]; // video only, e.g. ["5s","10s"]+ aspectRatios?: string[]; // video only+ features?: Array<"start-frame" | "end-frame" | "audio">; // video only+ }+ ```++---++### `dapi voices`++Lists the speech voices available for declared voice assets (see the JSX API).++- **Input:** none+- **Output:** JSON Lines, one per voice+ ```ts+ { id: string; label: string; description: string }+ ```++---++## Fonts++### `dapi fonts`++Lists local fonts available on this machine. macOS only.++- **Input:**+ - `-f, --family <pattern>` — filter to families whose name contains `<pattern>` (case-insensitive)+ - `-w, --weight <weights...>` — filter to variants with the given CSS weight(s), e.g. `-w 400 700`+ - `-s, --style <style>` — `"normal"` or `"italic"`+ - `-l, --limit <n>` — output at most `<n>` families+ - `-n, --names-only` — output only family names, one per line, plain text (no JSON)+- **Output:** JSON Lines, one per family — or plain family names when `--names-only` is set+ ```ts+ {+ family: string;+ variants: Array<{+ weight: string; // CSS weight, e.g. "400"+ style: "normal" | "italic";+ source: string; // CSS local() source+ }>;+ }+ ```++---++## Conventions++- **Stdout:** JSON. Commands that return a single record emit one JSON value. Commands that return a collection emit JSON Lines (one JSON object per line, no surrounding array) so per-item results stay streamable — this covers list reads (`selection ls`, `selection focus`, `node ls`, `node grep`, `asset ls`, `folder ls`, `models`, `voices`, `fonts`), selection mutations that return the new state, and batch operations (`node rm`, `node patch`, `node cp`, `asset add`, `asset rm`, `asset mv`, `asset export`, `folder mv`, `folder rm`). `node tree` emits one nested JSON object per root, and `asset ls` emits one nested object per root entry. Exceptions: `open` for file / URL / no-target writes nothing; `fonts --names-only` writes plain family names; `mount` and `node insert` write nothing.+- **Unix-style names are canonical:** list/read → `ls`, delete/remove → `rm`, duplicate → `cp`, move/reparent → `mv`, search → `grep`. The longer English forms (`list`, `remove`, `duplicate`, `move`) are aliases of the Unix forms, not the other way around. `get` is a universal alias for `ls` on every command that has one. Applied wherever the semantics match; commands without a natural Unix equivalent (`tree`, `rename`, `patch`, `add`, `create`, `active`, `context`, `whoami`, `open`, `focus`, `set`) keep their descriptive names.+- **Stderr:** human-readable error messages.+- **Exit codes:** `0` on success, `1` on any error (missing file, app not running, invalid input, IPC error).+- **App must be running:** every command except `open` and `fonts` talks to the open Diffusion Studio instance. If the app isn't running, the CLI prints an instruction to launch it and exits `1`.diff --git a/apps/cli/JSX_API.md b/apps/cli/JSX_API.mdnew file mode 100644index 00000000..c35a830f--- /dev/null+++ b/apps/cli/JSX_API.md@@ -0,0 +1,590 @@+# JSX API Specification++The JSX API defines the code contract for injecting content into the editor via the+CLI. Compositions are authored as **Solid components** that a custom renderer (built+on `solid-js/universal`, Solid's equivalent of React's reconciler) mounts **directly+into the editor's ECS**. Every JSX element becomes an entity; every prop is a+component write. There is no hidden DOM, no CSS resolution, and no measuring pass.++A project is structured like a SolidJS app: a **root** is established on the canvas —+typically a Scene, identified by its key and created if absent — and the project's+component tree renders into it.++**All positioning is explicit** (`x`, `y`, `width`, `height` in pixels).++## Pipeline++1. **Compile** — the CLI bundles the entry file with esbuild + `babel-preset-solid`+ in `universal` mode, so JSX compiles against the editor's renderer runtime+ (`@diffusionstudio/jsx`) instead of the DOM. Compile errors fail here, before the+ app is contacted.+2. **Ship** — the resulting single-file ESM bundle is sent to the running app over+ the local socket.+3. **Evaluate** — the app imports the module. Top-level code (including top-level+ `await`) runs to completion. The module's **default export** is the project+ component.+4. **Mount** — the component tree is rendered into a **staging root**. The universal+ renderer materializes each element as an ECS entity with the appropriate+ components (see [Element reference](#element-reference)). Mounting is synchronous;+ an error here aborts the import with nothing inserted.+5. **Commit** — the rendered roots are reconciled against the document (see+ [Roots](#roots)) as a **single undoable operation** that also covers the+ generated assets below.+6. **Generate** — declared assets generate in dependency order, **blocking the+ command** until every one has landed. Each placeholder renders a generating+ state until its asset lands, then the node's paint is attached.++## Project module contract++The entry file is a standard Solid component module:++```tsx+export default function Project() {+ return (+ <scene key="intro" name="Intro" fill="black" width={1920} height={1080}>+ {/* ... */}+ </scene>+ );+}+```++The component receives no props — which document node each rendered root+maps onto is declared in the JSX itself via `key` (see [Roots](#roots)).++### Module environment++- **Provided by the host** (marked external at compile time, resolved in-app so the+ project shares the editor's reactive runtime): `solid-js`, `solid-js/store`,+ `@diffusionstudio/jsx`.+- **Everything else is bundled** by the CLI at compile time — npm dependencies,+ local imports, JSON, etc. A project folder is an ordinary npm package: install+ any helper library (`date-fns`, `zod`, `d3-scale`, …) and import it; it is+ resolved from the project's `node_modules` and baked into the shipped bundle.+ Libraries must be browser-compatible (no Node builtins) — violations surface as+ compile errors, before the app is contacted.+- The module executes **inside the editor process**, unsandboxed. This is local+ tooling with a local trust model — the same trust as running the CLI itself. Only+ effects made through the JSX runtime are part of the document (and its undo+ history); anything else the module does is unsupported.+- Solid's control flow (`<For>`, `<Show>`, `<Index>`, `<Switch>`) and primitives+ (`createSignal`, `createMemo`, …) are fully available during mount. See+ [Lifecycle](#lifecycle) for what happens after mount.++## Roots++A mount renders one or more root elements (a fragment of roots is allowed) and+**refreshes the document** — like reloading a webpage, re-running a mount+rebuilds its roots in place instead of accumulating copies; a rendered root+with no existing node to replace is created. Roots are typically `<scene>`+elements, but any element can be a root (e.g. a bare `<rect>`). Every+top-level element must declare its identity with a `key`:++| Identity | Contract |+| -------- | -------- |+| `<scene key="intro">` | Rebuilds the existing node carrying the same key, or creates it (storing the key) if none does. Keyed nodes in the document that the render no longer produces are **deleted** — the mount owns its keyed roots. |++Keys must be unique within a render, and rebuilding keeps the node's+entity id and canvas position. Nodes without a key (e.g. hand-made scratch+scenes) are never touched. The **first** rendered root becomes the active+scene. Assigning a `name` alongside the key (e.g.+`<scene key="intro" name="Intro">`) is recommended — the key identifies the+node across mounts, the name labels it in the editor.++`<scene>` is valid **only** at the document root — scenes do not nest.++### Canvas placement++The canvas holds many roots, but a root's position on the canvas is an **editor+concern, not part of the composition** — `<scene>` has no `x`/`y`, and a project+describes content, not canvas arrangement.++- **Rebuilt roots** (matched by `key`) keep their existing canvas+ position.+- **New roots** are placed automatically: in the nearest empty space around the+ current viewport center, gapped so they never overlap existing content — the+ same auto-placement the editor uses when generating onto the canvas. A mount+ that creates multiple roots places them side by side in render order.++The camera is not moved; because placement anchors to the viewport center, new+roots typically land in view. Use `dapi selection focus` to frame them explicitly.++## Element reference++Lowercase intrinsic elements map 1:1 onto internal node types:++| Element | Internal node | Notes |+| ------------ | ------------- | ----- |+| `<scene>` | **Geometry with Scene tag** | Clips its children to `width`×`height`. Document root only. |+| `<group>` | **Geometry with Group tag** | Container with a transform; give it `fill` to draw a rectangle. |+| `<rect>` | **Geometry with Solid paint** | A filled rectangle; takes only paint children. |+| `<video>` | **Geometry with Video paint** | `src` resolves to a video asset. |+| `<image>` | **Geometry with Image paint** | `src` resolves to an image asset. |+| `<audio>` | **Geometry with Audio component and a hidden Waveform paint** | No visual output; carries volume. |+| `<text>` | **Geometry with Text component** | Children become editable glyphs. |+| `<sequence>` | **Sequential group** | See [Sequences](#sequences). |+| `<captions>` | **Caption node** | Transcribes the enclosing scene's audio. See [Captions](#captions). |+| `<solidPaint>` | **Solid paint** | Paint child — see [Paints](#paints). |+| `<linearGradientPaint>` / `<radialGradientPaint>` | **Gradient paint** | Paint child; takes `<colorStop>` children — see [Paints](#paints). |+| `<colorStop>` | **Gradient color stop** | Valid only inside gradient paints. |++User-defined components are ordinary Solid components — they compose intrinsics and+carry no runtime cost; only intrinsic elements produce entities.++### Coordinates and sizing++- Coordinates are **pixels relative to the parent's box**, origin top-left. No+ percentages, no layout keywords — explicit numbers until the layout engine lands.+- **Every element's box defaults to its parent's box**: `x` and `y` default to `0`,+ `width` and `height` default to the parent's size (the JSX analog of+ `position: absolute; inset: 0`). The scene's box is its required+ `width`×`height`.+- How media pixels map into the box is controlled by `objectFit`, never by the box itself.+ A generated asset's placeholder therefore always has a definite size, even before+ the asset exists.++### Common props++All visual elements accept:++| Prop | Type | Default | Meaning |+| ---- | ---- | ------- | ------- |+| `key` | `string` | — | Stable identity across mounts; **required** on document roots (see [Roots](#roots)). |+| `name` | `string` | — | Human-readable node name. |+| `x`, `y` | `number` | `0` | Position relative to the parent, px. |+| `width`, `height` | `number` | parent size | Box size, px. |+| `rotation` | `number` | `0` | Rotation in degrees. |+| `opacity` | `number` | `1` | `0`–`1`. |+| `cornerRadius` | `number` | `0` | Uniform corner radius, px. |+| `inPoint`, `outPoint`, `startTime` | `Time` | see [Timing](#timing) | Temporal placement. |++Common and per-element props share one property table, exported as+`PatchProps`. `dapi node patch` accepts exactly these keys with the same value+requirements as patch entries on existing nodes (see+[CLI_API.md](./CLI_API.md#dapi-node-patch-path---json-str)).++### Per-element props++**`<scene>`** — `key` (**required** — see [Roots](#roots)), `width`+(**required**), `height` (**required**), `name` (recommended), `fill`. No+timing or transform props.++**`<group>`** — common props plus `fill` (any CSS color, applied to the node's+fill; alpha is ignored — use `opacity`).++**`<rect>`** — common props plus `fill` (any CSS color, default light gray;+alpha is ignored — use `opacity`). Takes only [paint children](#paints); use+`cornerRadius` for rounded corners.++**`<video>`** — common props plus:++| Prop | Type | Default | Meaning |+| ---- | ---- | ------- | ------- |+| `src` | `string \| AssetRef` | **required** | See [Media source resolution](#media-source-resolution). |+| `objectFit` | `"cover" \| "contain" \| "fill"` | `"cover"` | How the source maps into the box. |+| `volume` | `number` | `1` | `0`–`1`; `1` = unity gain. |++**`<image>`** — common props plus `src` (**required**) and `objectFit` (default+`"contain"`).++**`<audio>`** — `name`, timing props, `src` (**required**), `volume`. No spatial+props; no visual output.++**`<text>`** — common props plus:++| Prop | Type | Default | Meaning |+| ---- | ---- | ------- | ------- |+| children | `string` (or expressions resolving to strings) | **required** | The text content. |+| `fontFamily` | `string` | editor default | A family available on the machine (`dapi fonts`). |+| `fontSize` | `number` | editor default | Px. |+| `fontWeight` | `number \| "normal" \| "bold"` | `"normal"` | CSS weights `100`–`900`. |+| `fontStyle` | `"normal" \| "italic"` | `"normal"` | |+| `fill` | `string` | none | Any CSS color. |+| `textAlign` | `"left" \| "center" \| "right"` | `"left"` | Horizontal alignment of glyphs within the box. |+| `textBaseline` | `"top" \| "middle" \| "bottom"` | `"top"` | Vertical alignment within the box. |++Because the box defaults to the parent's box, a centered full-frame title is simply+`<text textAlign="center" textBaseline="middle">…</text>`.++**`<sequence>`** — `name` only. Purely structural (see [Sequences](#sequences)).++**`<captions>`** —++| Prop | Type | Default | Meaning |+| ---- | ---- | ------- | ------- |+| `preset` | `"classic" \| "cascade" \| "spotlight" \| "whisper" \| "paper" \| "guinea" \| "stark"` | `"classic"` | Caption style preset (see [Captions](#captions)). |+| `colors` | `string[]` | preset defaults | Fills the preset's color slots in order; any CSS color, alpha ignored — use per-preset defaults by omitting. Ignored by presets without slots. |++## Paints++Internally a node's fill is not a property but a **paint child** — a sub-entity+appended to the geometry, exactly like the editor's fill list. The `fill` prop is+shorthand for a solid paint; declaring paints as JSX children exposes the full+model, including gradients:++```tsx+<rect width={640} height={360} cornerRadius={24}>+ <linearGradientPaint rotation={90}>+ <colorStop offset={0} color="#FF0055" />+ <colorStop offset={1} color="#0055FF" />+ </linearGradientPaint>+</rect>+```++Paint elements are valid inside any visual element (`<rect>`, `<group>`,+`<scene>`, `<text>`, `<video>`, `<image>`). Multiple paints stack in document+order — later paints render on top; a paint child on a `<video>`/`<image>`+draws over the media paint created by `src`.++| Element | Props | Meaning |+| ------- | ----- | ------- |+| `<solidPaint>` | `color` (**required**), `opacity` | Solid fill; equivalent to the `fill` prop. |+| `<linearGradientPaint>` | `rotation`, `opacity` | Linear gradient across the parent's box; `rotation` in degrees, `0` = left → right. |+| `<radialGradientPaint>` | `rotation`, `opacity` | Radial gradient centered in the parent's box. |+| `<colorStop>` | `offset` (**required**, `0`–`1`), `color` (**required**), `opacity` | Gradient color stop. Valid only inside gradient paints, which take no other children. |++Colors accept any CSS color; alpha is ignored — use `opacity`. Paints have no+spatial or timing props and cannot be document roots.++## Media source resolution++`src` accepts:++- **Global path** — e.g. `"/Movies/video.mp4"`, resolved against the user's OS.+- **Remote URL** — e.g. `"https://my.videoarchive.com/audio/clip.wav"`, registered+ as a remote asset.+- **Asset id** — e.g. `"gbHJ"`, an imported asset.+- **`AssetRef`** — the value returned by an `generate.*` declaration (see+ [Generated assets](#generated-assets)). The node is inserted immediately as a+ placeholder and its paint is attached once the asset has generated.++## Timing++Timing props follow Lottie-inspired semantics. All values are+**composition-relative** (measured against the parent's timeline), in any supported+[time format](#time-formats).++| Prop | Lottie | Meaning |+| ---- | ------ | ------- |+| `inPoint` | `ip` | Composition time at which the node becomes visible/audible. |+| `outPoint` | `op` | Composition time at which the node stops. |+| `startTime` | `st` | Composition time at which the node's *source* time 0 is placed. Shifts the source content within the in/out window. Defaults to the in point. |++### Semantics++- `inPoint` / `outPoint` define the **visible/audible window** on the parent+ timeline. They are a pair; if omitted, a media node fits its natural duration and+ a group auto-fits its children.+- `startTime` controls **which part of the source plays inside that window**. It is+ the composition time where source frame 0 sits, so it may be negative to skip into+ the source.++> Example: `inPoint={0} outPoint={16} startTime="-30f"` shows the clip from+> composition second 0 to 16, but because source-time-0 is placed 30 frames *before*+> the in point, the first 30 frames (1s @ 30fps) of the source are trimmed —+> playback begins 1s into the source.++### Time formats++```ts+type Time = number | `${number}f` | `${string}:${string}`;+```++The canonical internal unit is frames at **30 fps**; all formats are converted on+import. All values may be negative.++| Format | Example | Meaning |+| ------ | ------- | ------- |+| `number` | `2.2` | Seconds (may be fractional). |+| `"${number}f"` | `"-30f"` | Frames. |+| `"MM:SS"` | `"02:30"` | Minutes and seconds. |+| `"HH:MM:SS"` | `"01:02:30"` | Hours, minutes, seconds. |++## Sequences++`<sequence>` enforces **sequential, non-overlapping** placement of its children —+the editor's track-like behavior. It has no spatial or temporal properties of its+own; it lays its children out back-to-back in document order.++```tsx+<sequence>+ <video src="/Movies/intro.mp4" inPoint={0} outPoint={12} />+ <video src="/Movies/main.mp4" inPoint={12} outPoint="02:30" />+ <video src="/Movies/outro.mp4" inPoint="02:30" outPoint="02:45" />+</sequence>+```++## Captions++`<captions />` inside a scene transcribes that scene's audio into a caption node — a+styled, timed transcript, produced on import. To caption an already-open scene,+insert one with `dapi node insert.++Transcription is **asynchronous and non-blocking**: the caption node is inserted at+commit and its transcript attaches once ready. Because it reads the scene's audio,+it runs **after** any generated assets in the scene have landed — so captioning a+generated `voice`/`audio` track transcribes the finished audio. The scene must+contain an unmuted audio or video source; otherwise the caption node is left empty.++Transcripts are **cached**: every transcript asset records a fingerprint of the+scene's audible mix (source content, placement, source offset, playback rate,+gain). When a scene's fingerprint matches an existing transcript, that asset is+reused instead of transcribing again — re-mounting a project with unchanged+audio consumes no credits. Any change to the scene's audio invalidates the+fingerprint.++### Presets++`preset` selects the caption style — the same presets as the editor's caption+inspector. Some presets expose **color slots**, filled in order by the `colors`+prop; a missing or omitted entry falls back to the slot's default.++| Preset | Style | Color slots (defaults) |+| ------ | ----- | ---------------------- |+| `"classic"` (default) | Centered lowercase text with a soft drop shadow, a few words at a time. | — |+| `"cascade"` | Light text in the lower left; words appear progressively as they are spoken. | — |+| `"spotlight"` | Bold italic centered line; the spoken word lights up in the highlight color. | 1: highlight (`#24D5FF`) |+| `"whisper"` | Small, wide, understated line shown in ~2 s phrases. | — |+| `"paper"` | Centered two-line block; the line being spoken is emphasized with a heavier weight. | — |+| `"guinea"` | Uppercase display text; the spoken word enlarges and cycles through the three colors. | 3: `#F55353`, `#FEB139`, `#F6F54D` |+| `"stark"` | Heavy uppercase text blended into the footage with a difference blend. | — |++```tsx+<captions preset="spotlight" colors={["#FF0055"]} />+```++## Generated assets++Assets that don't exist yet are **declared as values** with the `generate` namespace+from `@diffusionstudio/jsx`. A declaration returns an **`AssetRef`** that is passed+wherever a source is expected — `src`, `startFrame`, `endFrame`, `refs`. This makes+generative content declarative: the project describes the asset it wants and the+editor produces it on mount.++```tsx+import { generate } from "@diffusionstudio/jsx";++const hero = generate.image({+ prompt: "A neon city at night, cinematic",+ model: "flux-2-turbo",+ aspectRatio: "16:9",+ seed: 42,+});++// one generated asset can feed another+const heroMotion = generate.video({+ prompt: "slow camera push-in",+ model: "kling-3-pro",+ startFrame: hero,+ duration: 5,+});++export default function Project() {+ return (+ <scene key="intro" name="Intro" width={1920} height={1080}>+ <video src={heroMotion} inPoint={0} outPoint={5} />+ <image src={hero} x={40} y={40} width={200} height={112} />+ </scene>+ );+}+```++Declarations are **pure**: calling `generate.*` registers a spec and returns a ref; no+generation starts until [commit](#pipeline). A ref that is never used by a mounted+element (directly or as an input to another asset) is dropped. Declarations may live+at module scope or inside components.++### Declaration options++Run `dapi models <type>` to discover valid `model` ids and per-model constraints;+`dapi voices` lists voices.++```ts+type AssetInput = string | AssetRef; // path, URL, asset id, or another declaration++generate.image(opts: {+ prompt: string; // required+ model?: string; // default: first model from `dapi models image`+ aspectRatio?: "1:1" | "4:3" | "3:4" | "16:9" | "9:16"; // default "16:9"+ refs?: AssetInput[]; // image references+ seed?: number; // reproducible generation+}): AssetRef;++generate.video(opts: {+ prompt: string; // required+ model?: string; // default: first model from `dapi models video`+ aspectRatio?: "1:1" | "4:3" | "3:4" | "16:9" | "9:16"; // default "16:9"+ duration?: number; // whole seconds; default 5+ audio?: boolean; // generate audio alongside; models with the `audio` feature only+ startFrame?: AssetInput; // image used as the first frame+ endFrame?: AssetInput; // image used as the last frame; `end-frame` feature only+ seed?: number;+}): AssetRef;++generate.voice(opts: {+ prompt: string; // required — the text to speak+ voice?: string; // default: first voice from `dapi voices`+}): AssetRef;++generate.audio(opts: {+ prompt: string; // required+ model?: string; // default: first model from `dapi models audio`+}): AssetRef;+```++### Dependency order++`startFrame`, `endFrame`, and `refs` accept other `AssetRef`s. The dependency graph+is built from these values and generated in topological order, so referenced assets+exist before the assets that consume them. Because dependencies are **values, not+string ids**, a declaration can only reference refs that already exist — reference+cycles are impossible by construction. Assets referenced only as inputs generate+too, but produce no node of their own.++### Caching and idempotency++Generation is long-running and consumes credits, so results are **cached by+content** — a key derived from the fully-resolved spec (`type`, `model`, `prompt`,+resolved references, `seed`, …). Within a session, re-running an unchanged project+reuses cached assets instead of regenerating, and two declarations with identical+specs collapse to a single asset; changing any option produces a new asset. Set+`seed` to make a spec reproducible. The cache is per-session and is not persisted+across app restarts.++## Lifecycle++Mounting is a **one-shot render**: the reactive graph exists to *compose* the+document (loops, conditionals, derived values, component props), not to drive it+afterward.++1. The component tree renders synchronously into the staging root; `onMount`+ callbacks flush once.+2. The subtree commits and the reactive root is **disposed**. Signal changes after+ commit do not affect the document.+3. Ownership transfers to the document: every materialized node is a fully editable+ composition node. Asset generation is owned by the engine, not the+ reactive graph, so it proceeds normally after disposal.++The update path is **re-running the project**, which rebuilds the mount root in+place — like refreshing a webpage; unchanged asset specs hit the generation cache. A future *live+mode* may keep the reactive root mounted so signals animate the document — the+one-shot contract above is deliberately forward-compatible with it.++## Errors++| Stage | Where it surfaces | Effect |+| ----- | ----------------- | ------ |+| Compile (syntax/type-stripping/bundling) | CLI stderr, exit 1 | App never contacted. |+| Evaluate / mount (thrown errors, invalid props, invalid root — e.g. nested `<scene>`, a root element without `key`, missing `src`, malformed `Time`) | CLI stderr, exit 1 | Staging root discarded; **nothing inserted**. |+| Generation (per-model constraints: `aspectRatio`, `duration`, feature flags) | CLI stderr, exit 1, after every generation settled | No rollback — the mounted tree stays committed; the affected placeholder stops showing its generating state and is left without a paint. |++Runtime errors are mapped back to the source via inline sourcemaps produced at+compile time.++## CLI surface++The JSX pipeline is a single command, `dapi mount`; `dapi node insert` runs the+same pipeline into an existing parent, and `dapi node patch` assigns the same+props on existing nodes. `dapi models` and `dapi voices`+(see [CLI_API.md](./CLI_API.md)) describe what can be referenced from `generate.*`+declarations.++### `dapi mount (<path> | --code <str>)`++Compiles a project module, executes it in the app, and mounts the rendered roots+into the document (see [Pipeline](#pipeline)). Which nodes are replaced is+declared in the JSX via the root elements' `key` (see [Roots](#roots)).++- **Input:**+ - `<path>` — path to a `.tsx` / `.jsx` / `.ts` / `.js` entry module. Exactly one+ of `<path>` or:+ - `--code <str>` — inline module source, compiled identically.+- **Output:** none. The command exits `0` once the tree is committed and every+ declared asset has generated; inspect the result with `dapi context`,+ `dapi node ls`, or `dapi node tree`.+- **Notes:** a newly added top-level scene becomes the active scene. The command+ is long-running when assets are declared — it blocks until generation+ finishes.++## Types and tooling++`@diffusionstudio/jsx` ships the JSX namespace (intrinsic elements and props),+`Time`, `AssetRef`, and the `generate` namespace. For editor IntelliSense and+typechecking in a project folder:++```json+{+ "compilerOptions": {+ "jsx": "preserve",+ "jsxImportSource": "@diffusionstudio/jsx"+ }+}+```++The CLI does not typecheck — types are stripped at compile time. Run `tsc --noEmit`+in the project folder for type safety.++## Full example++```tsx+import { For } from "solid-js";+import { generate, type Time } from "@diffusionstudio/jsx";++const hero = generate.image({+ prompt: "A neon city at night, cinematic",+ aspectRatio: "16:9",+ seed: 42,+});++const heroMotion = generate.video({+ prompt: "slow camera push-in",+ startFrame: hero,+ duration: 5,+});++const TITLES = [+ { text: "Hello World", inPoint: 3, outPoint: 6 },+ { text: "Chapter One", inPoint: 6, outPoint: 9 },+];++function Title(props: { text: string; inPoint: Time; outPoint: Time }) {+ return (+ <text+ textAlign="center"+ textBaseline="middle"+ fill="#FFFFFF"+ fontSize={128}+ fontWeight="bold"+ height={1080}+ width={1920}+ inPoint={props.inPoint}+ outPoint={props.outPoint}+ >+ {props.text}+ </text>+ );+}++export default function Project() {+ return (+ <scene key="my-first-scene" name="MyFirstScene" fill="black" width={1920} height={1080}>+ <sequence>+ <video src={heroMotion} inPoint={0} outPoint={5} />+ <video src="/Movies/video.mp4" inPoint={5} outPoint={16} startTime="-30f" />+ </sequence>++ <image src={hero} x={40} y={40} width={200} height={112} />++ <For each={TITLES}>{(t) => <Title {...t} />}</For>++ <audio+ src="https://my.videoarchive.com/audio/video-xyz.wav"+ inPoint={2.2}+ outPoint={16}+ volume={0.5}+ />++ <captions />+ </scene>+ );+}+```diff --git a/apps/cli/package.json b/apps/cli/package.jsonnew file mode 100644index 00000000..dd29472d--- /dev/null+++ b/apps/cli/package.json@@ -0,0 +1,31 @@+{+ "name": "@diffusionstudio/cli",+ "private": true,+ "version": "0.0.0",+ "license": "MPL-2.0",+ "bin": {+ "dapi": "./dist/index.js"+ },+ "exports": {+ "./protocol": "./src/protocol.ts",+ "./channels": "./src/cli-channels.ts"+ },+ "scripts": {+ "build": "esbuild src/index.ts --bundle --platform=node --format=cjs --external:esbuild --external:@babel/core --external:@babel/preset-typescript --external:babel-preset-solid --outfile=dist/index.js && chmod +x dist/index.js",+ "check": "tsc --noEmit",+ "symlink:remove": "rm -f /opt/homebrew/bin/dapi",+ "symlink:create": "npm run build && ln -sf \"$PWD/dist/index.js\" /opt/homebrew/bin/dapi"+ },+ "dependencies": {+ "@babel/core": "^7.29.7",+ "@babel/preset-typescript": "^7.27.1",+ "babel-preset-solid": "^1.9.12",+ "commander": "^14.0.3",+ "esbuild": "^0.28.1"+ },+ "devDependencies": {+ "@types/babel__core": "^7.20.5",+ "@types/node": "^24.10.1",+ "typescript": "~5.9.3"+ }+}diff --git a/apps/cli/src/cli-channels.ts b/apps/cli/src/cli-channels.tsnew file mode 100644index 00000000..12763118--- /dev/null+++ b/apps/cli/src/cli-channels.ts@@ -0,0 +1,369 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { PatchProps } from "@diffusionstudio/jsx";++// Wire-level channels for the CLI-forwarding path. Main only knows these two —+// it does not inspect logical channel names. The renderer mirrors requests+// back onto FORWARD_REPLY, correlated by envelope id.+export const CLI_WIRE = {+ FORWARD_REQ: "cli:fwd:req",+ FORWARD_REPLY: "cli:fwd:reply",+} as const;++// Logical channels — known only to the CLI and renderer. `cli:ping` is a+// built-in: the renderer's bridge auto-registers it so `waitForCliSocket`+// can probe end-to-end without depending on an app-level handler.+export const CLI_CHANNELS = {+ PING: "cli:ping",+ CONTEXT: "cli:context",+ ASSETS_ADD: "cli:assets:add",+ ASSETS_LIST: "cli:assets:list",+ ASSETS_DELETE: "cli:assets:delete",+ ASSETS_MOVE: "cli:assets:move",+ ASSETS_EXPORT: "cli:assets:export",+ FOLDERS_LIST: "cli:folders:list",+ FOLDER_CREATE: "cli:folder:create",+ FOLDER_RENAME: "cli:folder:rename",+ FOLDERS_MOVE: "cli:folders:move",+ FOLDERS_DELETE: "cli:folders:delete",+ ASSET_PROBE: "cli:asset:probe",+ ASSET_FRAME: "cli:asset:frame",+ ASSET_TRANSCRIPT: "cli:asset:transcript",+ ASSET_VISUALIZE: "cli:asset:visualize",+ ASSET_ANALYZE: "cli:asset:analyze",+ ASSET_SYNC: "cli:asset:sync",+ SELECTION_LIST: "cli:selection:list",+ SELECTION_SET: "cli:selection:set",+ SELECTION_FOCUS: "cli:selection:focus",+ NODE_LIST: "cli:node:list",+ NODE_TREE: "cli:node:tree",+ NODE_GREP: "cli:node:grep",+ NODE_SCREENSHOT: "cli:node:screenshot",+ MOUNT: "cli:mount",+ NODE_INSERT: "cli:node:insert",+ NODE_DELETE: "cli:node:delete",+ NODE_PATCH: "cli:node:patch",+ NODE_DUPLICATE: "cli:node:duplicate",+ NODE_EXPORT: "cli:node:export",+ PROJECT_ACTIVE: "cli:project:active",+ PROJECT_LIST: "cli:project:list",+ PROJECT_CREATE: "cli:project:create",+ PROJECT_DELETE: "cli:project:delete",+ PROJECT_OPEN: "cli:project:open",+ MODELS: "cli:models",+ VOICES: "cli:voices",+ WHOAMI: "cli:whoami",+} as const;++export type CliChannel = (typeof CLI_CHANNELS)[keyof typeof CLI_CHANNELS];++export type NodeRef = { id: number; name: string; type: string };++export type EntityRecord = { id: string; eid: number } & Record<string, unknown>;++export type NodeListResult =+ | { status: "fulfilled"; node: EntityRecord }+ | { status: "rejected"; id: number; error: string };++export type NodeTree = NodeRef & {+ description: string;+ children?: NodeTree[]; // child nodes (masks listed separately)+ masks?: NodeTree[];+ paints?: NodeTree[]; // fills+ strokes?: NodeTree[];+ shadows?: NodeTree[];+ effects?: NodeTree[];+ colorStops?: NodeTree[]; // on gradient paints+ textRanges?: NodeTree[]; // on text nodes+ keyframeTracks?: NodeTree[]; // keyframes nest beneath their track+ keyframes?: NodeTree[];+ animations?: NodeTree[];+};++export type NodeGrepRequest = {+ pattern: string;+ ignoreCase?: boolean;+ id?: number; // scope to this entity's subtree; omitted = the whole document+ types?: string[]; // only match entities of these node types+ components?: string[]; // restrict matching to these components+};++export type NodeGrepMatch = { component: string; value: string };++export type NodeGrepResult = NodeRef & { matches: NodeGrepMatch[] };++export type NodeDeleteResult =+ | { status: "fulfilled"; id: number }+ | { status: "rejected"; id: number; error: string };++export type MountRequest = {+ code: string;+};++export type NodeInsertRequest = {+ code: string;+ parentId: number;+ index?: number;+};++export type NodePatch = { id: number } & PatchProps;++export type NodePatchResult =+ | { status: "fulfilled"; id: number }+ | { status: "rejected"; id: number; error: string };++export type NodeDuplicateResult =+ | { status: "fulfilled"; sourceId: number; newId: number }+ | { status: "rejected"; sourceId: number; error: string };++export type EncoderConfigInput = {+ format?: "mp4" | "webm" | "ogg" | "mov";+ video?: {+ codec?: "avc" | "hevc" | "vp9" | "av1" | "vp8";+ enabled?: boolean;+ bitrate?: number;+ fps?: number;+ resolution?: number;+ };+ audio?: {+ enabled?: boolean;+ codec?: "aac" | "opus";+ bitrate?: number;+ sampleRate?: number;+ numberOfChannels?: number;+ };+ trim?: { end?: number }; // seconds; caps the encode end+};++export type NodeExportRequest = { id?: number; output: string; config?: EncoderConfigInput };+export type NodeExportResult = { path: string };++export type AssetProbeRequest = { id: string };++export type AssetFrameRequest = { id: string; times?: number[] };+export type AssetFrameResult = Array<{ time: number; base64: string }>;++export type AssetTranscriptRequest = { id: string };+export type TranscriptWord = { text: string; start: number; end: number };+export type TranscriptSegment = { text: string; words: TranscriptWord[] };+export type AssetTranscriptResult = { id: string; segments: TranscriptSegment[] };++export type AssetVisualizeRequest = { id: string; start?: number; end?: number; scale?: number };+export type AssetVisualizeResult = {+ base64: string;+} & Record<string, unknown>;++export type AssetAnalyzeRequest = { id: string; prompt?: string; start?: number; end?: number };+export type AssetAnalyzeResult = { id: string; analysis?: string; start?: number; end?: number };++export type AssetSyncRequest = { audioId: string; videoId: string };+export type AssetSyncResult = {+ audioId: string;+ videoId: string;+ // Place the audio at: audioStart = videoStart + offsetSeconds.+ // Positive = the recording started after the camera rolled.+ offsetSeconds: number;+ confidence: number; // 0..1 normalized cross-correlation peak; clear match ≳ 0.9+};++export type GeneratedAsset = { id: string; name: string; type: string };++export type FolderInfo = { id: string; name: string; type: "folder" };++export type AssetTreeEntry = { id: string; name: string; type: string; children: AssetTreeEntry[] };++export type AssetMoveResult =+ | { status: "fulfilled"; id: string; folderId: string | null }+ | { status: "rejected"; id: string; error: string };++export type AssetsExportRequest = { ids: string[]; output: string; isDir: boolean };++export type AssetExportResult =+ | { status: "fulfilled"; id: string; path: string }+ | { status: "rejected"; id: string; error: string };++export type FolderMoveResult =+ | { status: "fulfilled"; id: string; parentId: string | null }+ | { status: "rejected"; id: string; error: string };++export type FolderDeleteResult =+ | { status: "fulfilled"; id: string; deletedFolders: number; deletedAssets: number }+ | { status: "rejected"; id: string; error: string };++export type ModelsRequest = { type?: "image" | "video" | "audio" };++export type ModelInfo = {+ type: "image" | "video" | "audio";+ id: string;+ name: string;+ durations?: string[];+ aspectRatios?: string[];+ features?: Array<"start-frame" | "end-frame" | "audio">;+};++export type VoiceInfo = { id: string; label: string; description: string };++export type ProjectSummary = {+ id: string;+ name: string;+ createdAt: string;+ lastAccessedAt: string;+};++export type CliRequestMap = {+ [CLI_CHANNELS.PING]: { request: void; response: void };+ [CLI_CHANNELS.CONTEXT]: { request: void; response: any };+ [CLI_CHANNELS.ASSETS_ADD]: {+ request: { paths: string[]; folderId?: string };+ response: any;+ };+ [CLI_CHANNELS.ASSETS_LIST]: {+ request: { folderId?: string; depth?: number };+ response: AssetTreeEntry[];+ };+ [CLI_CHANNELS.ASSETS_DELETE]: { request: { ids: string[] }; response: any };+ [CLI_CHANNELS.ASSETS_MOVE]: {+ request: { ids: string[]; to?: string };+ response: AssetMoveResult[];+ };+ [CLI_CHANNELS.ASSETS_EXPORT]: {+ request: AssetsExportRequest;+ response: AssetExportResult[];+ };+ [CLI_CHANNELS.FOLDERS_LIST]: {+ request: { parentId?: string };+ response: FolderInfo[];+ };+ [CLI_CHANNELS.FOLDER_CREATE]: {+ request: { name: string; parentId?: string };+ response: FolderInfo;+ };+ [CLI_CHANNELS.FOLDER_RENAME]: {+ request: { id: string; name: string };+ response: FolderInfo;+ };+ [CLI_CHANNELS.FOLDERS_MOVE]: {+ request: { ids: string[]; to?: string };+ response: FolderMoveResult[];+ };+ [CLI_CHANNELS.FOLDERS_DELETE]: {+ request: { ids: string[] };+ response: FolderDeleteResult[];+ };+ [CLI_CHANNELS.ASSET_PROBE]: {+ request: AssetProbeRequest;+ response: unknown;+ };+ [CLI_CHANNELS.ASSET_FRAME]: {+ request: AssetFrameRequest;+ response: AssetFrameResult;+ };+ [CLI_CHANNELS.ASSET_TRANSCRIPT]: {+ request: AssetTranscriptRequest;+ response: AssetTranscriptResult;+ };+ [CLI_CHANNELS.ASSET_VISUALIZE]: {+ request: AssetVisualizeRequest;+ response: AssetVisualizeResult;+ };+ [CLI_CHANNELS.ASSET_ANALYZE]: {+ request: AssetAnalyzeRequest;+ response: AssetAnalyzeResult;+ };+ [CLI_CHANNELS.ASSET_SYNC]: {+ request: AssetSyncRequest;+ response: AssetSyncResult;+ };+ [CLI_CHANNELS.SELECTION_LIST]: { request: void; response: NodeRef[] };+ [CLI_CHANNELS.SELECTION_SET]: {+ request: { ids: number[] };+ response: NodeRef[];+ };+ [CLI_CHANNELS.SELECTION_FOCUS]: { request: void; response: NodeRef[] };+ [CLI_CHANNELS.NODE_LIST]: {+ request: { ids?: number[] };+ response: NodeListResult[];+ };+ [CLI_CHANNELS.NODE_TREE]: {+ request: { id?: number; depth?: number };+ response: NodeTree[];+ };+ [CLI_CHANNELS.NODE_GREP]: {+ request: NodeGrepRequest;+ response: NodeGrepResult[];+ };+ [CLI_CHANNELS.NODE_SCREENSHOT]: {+ request: { id?: number; frame?: number };+ response: { base64: string };+ };+ [CLI_CHANNELS.MOUNT]: {+ request: MountRequest;+ response: void;+ };+ [CLI_CHANNELS.NODE_INSERT]: {+ request: NodeInsertRequest;+ response: void;+ };+ [CLI_CHANNELS.NODE_DELETE]: {+ request: { ids: number[] };+ response: NodeDeleteResult[];+ };+ [CLI_CHANNELS.NODE_PATCH]: {+ request: { patches: NodePatch[] };+ response: NodePatchResult[];+ };+ [CLI_CHANNELS.NODE_DUPLICATE]: {+ request: { ids: number[] };+ response: NodeDuplicateResult[];+ };+ [CLI_CHANNELS.NODE_EXPORT]: {+ request: NodeExportRequest;+ response: NodeExportResult;+ };+ [CLI_CHANNELS.PROJECT_ACTIVE]: {+ request: void;+ response: { id: string; name: string } | null;+ };+ [CLI_CHANNELS.PROJECT_LIST]: {+ request: void;+ response: ProjectSummary[];+ };+ [CLI_CHANNELS.PROJECT_CREATE]: {+ request: { name?: string };+ response: { id: string; name: string };+ };+ [CLI_CHANNELS.PROJECT_DELETE]: {+ request: { id: string };+ response: { id: string; name: string };+ };+ [CLI_CHANNELS.PROJECT_OPEN]: {+ request: { id: string };+ response: { id: string; name: string } | null;+ };+ [CLI_CHANNELS.MODELS]: {+ request: ModelsRequest;+ response: ModelInfo[];+ };+ [CLI_CHANNELS.VOICES]: {+ request: void;+ response: VoiceInfo[];+ };+ [CLI_CHANNELS.WHOAMI]: {+ request: void;+ response: { id: string; email: string; provider: string } | null;+ };+};++export type CliRequestChannel = keyof CliRequestMap;++export type CliRequest = {+ id: string;+ channel: CliRequestChannel;+ data: unknown;+};++export type CliReply =+ | { id: string; ok: true; data: unknown }+ | { id: string; ok: false; error: string };diff --git a/apps/cli/src/cli-client.ts b/apps/cli/src/cli-client.tsnew file mode 100644index 00000000..2043621b--- /dev/null+++ b/apps/cli/src/cli-client.ts@@ -0,0 +1,149 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { connect } from "node:net";+import { randomUUID } from "node:crypto";+import { CLI_CHANNELS, SOCKET_PATH } from "./protocol";+import type {+ CliReply,+ CliRequest,+ CliRequestChannel,+ CliRequestMap,+ ModelsRequest,+ EncoderConfigInput,+ MountRequest,+ NodeGrepRequest,+ NodeInsertRequest,+ NodePatch,+} from "./protocol";++const DEFAULT_TIMEOUT_MS = 60000;+const GENERATE_TIMEOUT_MS = 600000;++export function cliRequest<C extends CliRequestChannel>(+ channel: C,+ data: CliRequestMap[C]["request"],+ timeoutMs: number = DEFAULT_TIMEOUT_MS,+): Promise<CliRequestMap[C]["response"]> {+ return new Promise((resolve, reject) => {+ const sock = connect(SOCKET_PATH);+ let buf = "";+ let settled = false;+ const envelope: CliRequest = {+ id: randomUUID(),+ channel,+ data,+ };++ // Destroy the socket explicitly on completion. Without this, lingering+ // socket handles (idle timer, half-closed state) can keep the Node event+ // loop alive past `console.log(result)`, preventing the CLI from exiting.+ const settle = (fn: () => void) => {+ if (settled) return;+ settled = true;+ sock.destroy();+ fn();+ };++ sock.setEncoding("utf8");+ sock.setTimeout(timeoutMs, () =>+ settle(() => reject(new Error("Timed out waiting for response"))),+ );+ sock.on("connect", () => sock.end(JSON.stringify(envelope)));+ sock.on("data", (chunk) => {+ buf += chunk;+ });+ sock.on("end", () => {+ let reply: CliReply;+ try {+ reply = JSON.parse(buf) as CliReply;+ } catch (e) {+ settle(() => reject(e instanceof Error ? e : new Error(String(e))));+ return;+ }+ if (reply.ok) {+ settle(() => resolve(reply.data as CliRequestMap[C]["response"]));+ } else {+ settle(() => reject(new Error(reply.error)));+ }+ });+ sock.on("error", (err) => settle(() => reject(err)));+ });+}++export const cliAPI = {+ context: () => cliRequest(CLI_CHANNELS.CONTEXT, undefined),+ addAssets: (paths: string[], folderId?: string) =>+ cliRequest(CLI_CHANNELS.ASSETS_ADD, { paths, folderId }),+ listAssets: (folderId?: string, depth?: number) =>+ cliRequest(CLI_CHANNELS.ASSETS_LIST, { folderId, depth }),+ deleteAssets: (ids: string[]) => cliRequest(CLI_CHANNELS.ASSETS_DELETE, { ids }),+ moveAssets: (ids: string[], to?: string) => cliRequest(CLI_CHANNELS.ASSETS_MOVE, { ids, to }),+ exportAssets: (ids: string[], output: string, isDir: boolean) =>+ cliRequest(CLI_CHANNELS.ASSETS_EXPORT, { ids, output, isDir }, GENERATE_TIMEOUT_MS),+ listFolders: (parentId?: string) => cliRequest(CLI_CHANNELS.FOLDERS_LIST, { parentId }),+ createFolder: (name: string, parentId?: string) =>+ cliRequest(CLI_CHANNELS.FOLDER_CREATE, { name, parentId }),+ renameFolder: (id: string, name: string) => cliRequest(CLI_CHANNELS.FOLDER_RENAME, { id, name }),+ moveFolders: (ids: string[], to?: string) => cliRequest(CLI_CHANNELS.FOLDERS_MOVE, { ids, to }),+ deleteFolders: (ids: string[]) => cliRequest(CLI_CHANNELS.FOLDERS_DELETE, { ids }),+ assetProbe: (id: string) => cliRequest(CLI_CHANNELS.ASSET_PROBE, { id }),+ assetFrame: (id: string, times?: number[]) => cliRequest(CLI_CHANNELS.ASSET_FRAME, { id, times }),+ assetTranscript: (id: string) =>+ cliRequest(CLI_CHANNELS.ASSET_TRANSCRIPT, { id }, GENERATE_TIMEOUT_MS),+ assetVisualize: (id: string, start?: number, end?: number, scale?: number) =>+ cliRequest(CLI_CHANNELS.ASSET_VISUALIZE, { id, start, end, scale }),+ assetAnalyze: (id: string, prompt?: string, start?: number, end?: number) =>+ cliRequest(CLI_CHANNELS.ASSET_ANALYZE, { id, prompt, start, end }, GENERATE_TIMEOUT_MS),+ assetSync: (audioId: string, videoId: string) =>+ cliRequest(CLI_CHANNELS.ASSET_SYNC, { audioId, videoId }, GENERATE_TIMEOUT_MS),+ listSelection: () => cliRequest(CLI_CHANNELS.SELECTION_LIST, undefined),+ setSelection: (ids: number[]) => cliRequest(CLI_CHANNELS.SELECTION_SET, { ids }),+ focusSelection: () => cliRequest(CLI_CHANNELS.SELECTION_FOCUS, undefined),+ listNodes: (ids?: number[]) => cliRequest(CLI_CHANNELS.NODE_LIST, { ids }),+ nodeTree: (id?: number, depth?: number) => cliRequest(CLI_CHANNELS.NODE_TREE, { id, depth }),+ grepNodes: (req: NodeGrepRequest) => cliRequest(CLI_CHANNELS.NODE_GREP, req),+ nodeScreenshot: (id?: number, frame?: number) => cliRequest(CLI_CHANNELS.NODE_SCREENSHOT, { id, frame }),+ mount: (req: MountRequest) => cliRequest(CLI_CHANNELS.MOUNT, req, GENERATE_TIMEOUT_MS),+ insertNode: (req: NodeInsertRequest) =>+ cliRequest(CLI_CHANNELS.NODE_INSERT, req, GENERATE_TIMEOUT_MS),+ deleteNodes: (ids: number[]) => cliRequest(CLI_CHANNELS.NODE_DELETE, { ids }),+ patchNodes: (patches: NodePatch[]) => cliRequest(CLI_CHANNELS.NODE_PATCH, { patches }),+ duplicateNodes: (ids: number[]) => cliRequest(CLI_CHANNELS.NODE_DUPLICATE, { ids }),+ exportNode: (output: string, id?: number, config?: EncoderConfigInput) =>+ cliRequest(CLI_CHANNELS.NODE_EXPORT, { id, output, config }, GENERATE_TIMEOUT_MS),+ activeProject: () => cliRequest(CLI_CHANNELS.PROJECT_ACTIVE, undefined),+ listProjects: () => cliRequest(CLI_CHANNELS.PROJECT_LIST, undefined),+ createProject: (name?: string) => cliRequest(CLI_CHANNELS.PROJECT_CREATE, { name }),+ deleteProject: (id: string) => cliRequest(CLI_CHANNELS.PROJECT_DELETE, { id }),+ openProject: (id: string) => cliRequest(CLI_CHANNELS.PROJECT_OPEN, { id }),+ models: (req: ModelsRequest) => cliRequest(CLI_CHANNELS.MODELS, req),+ voices: () => cliRequest(CLI_CHANNELS.VOICES, undefined),+ ping: () => cliRequest(CLI_CHANNELS.PING, undefined),+ whoami: () => cliRequest(CLI_CHANNELS.WHOAMI, undefined),+};++// Bridges the cold-start gap after launching the app. The `cli:ping` channel+// is handled by the renderer-side bridge and only completes once main has+// forwarded the request to a ready renderer — so a single round-trip is+// enough once the socket is up. The retry loop only handles the brief window+// before the socket itself binds (ENOENT/ECONNREFUSED).+export async function waitForCliSocket(timeoutMs = 30000): Promise<void> {+ const start = Date.now();+ let lastError: unknown = null;+ while (Date.now() - start < timeoutMs) {+ try {+ await cliAPI.ping();+ return;+ } catch (e) {+ lastError = e;+ const code = (e as NodeJS.ErrnoException).code;+ if (code !== "ENOENT" && code !== "ECONNREFUSED") throw e;+ await new Promise((r) => setTimeout(r, 200));+ }+ }+ throw lastError instanceof Error+ ? lastError+ : new Error("Timed out waiting for the app to start");+}diff --git a/apps/cli/src/cli-socket-path.ts b/apps/cli/src/cli-socket-path.tsnew file mode 100644index 00000000..c0e535e6--- /dev/null+++ b/apps/cli/src/cli-socket-path.ts@@ -0,0 +1,16 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { platform, tmpdir } from "node:os";+import { join } from "node:path";++// One socket / named pipe per host. On macOS tmpdir is per-user; on Linux /tmp+// is global but the socket file's owner-only mode 0600 keeps it isolated.+//+// Kept separate from cli-channels so the renderer can import the channel+// registry and envelope types without pulling in node:os / node:path.+export const SOCKET_PATH =+ platform() === "win32"+ ? "\\\\.\\pipe\\diffusion-studio"+ : join(tmpdir(), "diffusion-studio.sock");diff --git a/apps/cli/src/compile-project.ts b/apps/cli/src/compile-project.tsnew file mode 100644index 00000000..81f5cb3f--- /dev/null+++ b/apps/cli/src/compile-project.ts@@ -0,0 +1,99 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { readFile } from "node:fs/promises";+import { transformAsync } from "@babel/core";+import { build } from "esbuild";+import type { Plugin } from "esbuild";+import presetSolid from "babel-preset-solid";+import presetTypescript from "@babel/preset-typescript";++/**+ * Compiles a Solid JSX project module into a single-file ESM bundle for+ * `dapi mount` (see JSX_API.md). JSX compiles against the editor's universal+ * renderer runtime (`@diffusionstudio/jsx`); npm dependencies and local+ * imports are bundled; the host-provided modules are left external under the+ * "dapi-host:" prefix so the app can rewrite them to its own module instances.+ */++// Prefix shared with the app's module loader — a specifier no user code would+// contain by accident, so the app-side rewrite is unambiguous.+export const HOST_MODULE_PREFIX = "dapi-host:";++const HOST_MODULES_RE = /^(?:solid-js(?:\/store)?|@diffusionstudio\/jsx)$/;++async function transformSolidJsx(source: string, filename: string): Promise<string> {+ const result = await transformAsync(source, {+ filename,+ babelrc: false,+ configFile: false,+ presets: [+ [presetSolid, { generate: "universal", moduleName: "@diffusionstudio/jsx" }],+ [presetTypescript, {}],+ ],+ sourceMaps: "inline",+ });+ if (!result?.code) {+ throw new Error(`Failed to compile ${filename}`);+ }+ return result.code;+}++const solidUniversalPlugin: Plugin = {+ name: "solid-universal",+ setup(pluginBuild) {+ pluginBuild.onResolve({ filter: HOST_MODULES_RE }, (args) => ({+ path: `${HOST_MODULE_PREFIX}${args.path}`,+ external: true,+ }));++ // esbuild strips types from .ts natively; only JSX files go through babel+ // so the Solid transform sees the untouched JSX.+ pluginBuild.onLoad({ filter: /\.[jt]sx$/ }, async (args) => ({+ contents: await transformSolidJsx(await readFile(args.path, "utf8"), args.path),+ loader: "js",+ }));+ },+};++export type CompileInput = { path: string } | { code: string };++// `--code` ergonomics: a bare JSX expression (no `export default`) is wrapped+// into a component module, so one-liners like `--code '<rect width={10} />'`+function wrapBareJsx(code: string): string {+ if (/\bexport\s+default\b/.test(code)) return code;+ return `export default () => (\n${code.trim().replace(/;+\s*$/, "")}\n);`;+}++export async function compileProject(input: CompileInput): Promise<string> {+ const common = {+ bundle: true as const,+ write: false as const,+ format: "esm" as const,+ platform: "browser" as const,+ target: "es2022",+ sourcemap: "inline" as const,+ logLevel: "silent" as const,+ plugins: [solidUniversalPlugin],+ };++ // Inline --code bypasses esbuild's loader pipeline (stdin skips onLoad), so+ // it is babel-transformed up front and fed in as plain JS.+ const result =+ "path" in input+ ? await build({ ...common, entryPoints: [input.path] })+ : await build({+ ...common,+ stdin: {+ contents: await transformSolidJsx(wrapBareJsx(input.code), "project.tsx"),+ loader: "js",+ resolveDir: process.cwd(),+ sourcefile: "project.tsx",+ },+ });++ const out = result.outputFiles?.[0];+ if (!out) throw new Error("Compilation produced no output");+ return out.text;+}diff --git a/apps/cli/src/fonts.ts b/apps/cli/src/fonts.tsnew file mode 100644index 00000000..d2de7964--- /dev/null+++ b/apps/cli/src/fonts.ts@@ -0,0 +1,103 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { spawnSync } from "node:child_process";+import { platform } from "node:os";++export type FontVariant = {+ weight: string;+ style: "normal" | "italic";+ source: string;+};++export type FontFamily = {+ family: string;+ variants: FontVariant[];+};++// JXA script that walks every registered font family via NSFontManager and+// emits each variant's CSS-style weight, italic flag, and CSS `local()` source.+// Embedded inline so the CLI binary is self-contained — runs via `osascript`.+const LIST_FONTS_JXA = `+ObjC.import("AppKit");++function nsfmWeightToCss(w) {+ if (w <= 1) return "100";+ if (w <= 2) return "200";+ if (w <= 3) return "300";+ if (w <= 5) return "400";+ if (w <= 6) return "500";+ if (w <= 8) return "600";+ if (w <= 9) return "700";+ if (w <= 11) return "800";+ return "900";+}++function run() {+ var fm = $.NSFontManager.sharedFontManager;+ var families = fm.availableFontFamilies;+ var out = [];+ for (var i = 0; i < families.count; i++) {+ var family = ObjC.unwrap(families.objectAtIndex(i));+ if (family.charAt(0) === ".") continue;+ var members = fm.availableMembersOfFontFamily(family);+ if (!members || members.isNil()) continue;+ var variants = [];+ for (var j = 0; j < members.count; j++) {+ var m = members.objectAtIndex(j);+ var fontName = ObjC.unwrap(m.objectAtIndex(0));+ var styleName = ObjC.unwrap(m.objectAtIndex(1));+ var weight = ObjC.unwrap(m.objectAtIndex(2));+ var traits = ObjC.unwrap(m.objectAtIndex(3));+ var fullName = styleName === "Regular" ? family : family + " " + styleName;+ variants.push({+ weight: nsfmWeightToCss(weight),+ style: (traits & 1) !== 0 ? "italic" : "normal",+ source: "local('" + fullName + "'), local('" + fontName + "')",+ });+ }+ if (variants.length > 0) out.push({ family: family, variants: variants });+ }+ return JSON.stringify(out);+}+`;++export type ListLocalFontsOptions = {+ familyPattern?: string;+ weights?: string[];+ style?: "normal" | "italic";+ limit?: number;+};++export function listLocalFonts(options: ListLocalFontsOptions = {}): FontFamily[] {+ if (platform() !== "darwin") {+ throw new Error("fonts is only supported on macOS.");+ }+ const result = spawnSync("osascript", ["-l", "JavaScript", "-e", LIST_FONTS_JXA], {+ encoding: "utf8",+ maxBuffer: 16 * 1024 * 1024,+ });+ if (result.status !== 0) {+ throw new Error(result.stderr.trim() || "Failed to enumerate fonts.");+ }++ const all = JSON.parse(result.stdout.trim()) as FontFamily[];+ const pattern = options.familyPattern?.toLowerCase();+ const weights = options.weights && options.weights.length > 0 ? new Set(options.weights) : null;+ const { style, limit } = options;++ const out: FontFamily[] = [];+ for (const family of all) {+ if (pattern && !family.family.toLowerCase().includes(pattern)) continue;+ const variants = family.variants.filter((v) => {+ if (weights && !weights.has(v.weight)) return false;+ if (style && v.style !== style) return false;+ return true;+ });+ if (variants.length === 0) continue;+ out.push({ family: family.family, variants });+ if (limit !== undefined && out.length >= limit) break;+ }+ return out;+}diff --git a/apps/cli/src/index.ts b/apps/cli/src/index.tsnew file mode 100644index 00000000..9604eb12--- /dev/null+++ b/apps/cli/src/index.ts@@ -0,0 +1,1264 @@+#!/usr/bin/env node+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { spawn } from "node:child_process";+import { randomUUID } from "node:crypto";+import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";+import { platform, tmpdir } from "node:os";+import { extname, isAbsolute, join, resolve } from "node:path";+import { Command } from "commander";+import { parseTime, TIME_FPS } from "@diffusionstudio/jsx/time";+import { cliAPI, waitForCliSocket } from "./cli-client";+import { compileProject } from "./compile-project";+import { listLocalFonts } from "./fonts";+import { openFolder } from "./open-folder";+import type { EncoderConfigInput } from "./protocol";++const APP_NAME = "Diffusion Studio";+const PROTOCOL = "diffusion";++// Forwarded to the app's process.argv;+const HIDDEN_FLAG = "--hidden";++function openApp(target?: string, background = false): void {+ const isUrl = !!target && target.startsWith(`${PROTOCOL}://`);+ const os = platform();++ if (os === "darwin") {+ const args: string[] = [];+ if (background) args.push("-g");+ if (isUrl) {+ args.push(target!);+ } else {+ args.push("-a", APP_NAME);+ if (target) args.push(target);+ }++ if (background) {+ args.push("--args", HIDDEN_FLAG);+ }++ spawn("open", args, { detached: true, stdio: "ignore" }).unref();+ return;+ }++ if (os === "win32") {+ const arg = target ?? APP_NAME;+ const args = ["/c", "start", "", arg];+ if (background) args.push(HIDDEN_FLAG);+ spawn("cmd", args, { detached: true, stdio: "ignore" }).unref();+ return;+ }++ const candidates = [+ "/usr/bin/diffusion-studio",+ "/usr/local/bin/diffusion-studio",+ join(process.env.HOME ?? "", ".local/bin/diffusion-studio"),+ ];+ const bin = candidates.find((p) => existsSync(p));+ if (bin) {+ const args = target ? [target] : [];+ if (background) args.push(HIDDEN_FLAG);+ spawn(bin, args, { detached: true, stdio: "ignore" }).unref();+ return;+ }+ if (isUrl) {+ spawn("xdg-open", [target!], { detached: true, stdio: "ignore" }).unref();+ return;+ }+ console.error(`Could not locate "${APP_NAME}" on this system.`);+ process.exit(1);+}++async function openTarget(target: string | undefined, background: boolean): Promise<void> {+ if (target && !target.startsWith(`${PROTOCOL}://`)) {+ const absPath = isAbsolute(target) ? target : resolve(process.cwd(), target);+ if (!existsSync(absPath)) {+ console.error(`Path not found: ${absPath}`);+ process.exit(1);+ }+ if (statSync(absPath).isDirectory()) {+ openApp(undefined, background);+ try {+ await waitForCliSocket();+ const result = await openFolder(absPath);+ console.log(JSON.stringify(result));+ } catch (e) {+ console.error((e as Error).message);+ process.exit(1);+ }+ return;+ }+ }+ openApp(target, background);+}++function handleSocketError(e: unknown): never {+ const code = (e as NodeJS.ErrnoException).code;+ if (code === "ENOENT" || code === "ECONNREFUSED") {+ console.error(`${APP_NAME} is not running. Launch the app first, then retry.`);+ } else {+ console.error((e as Error).message);+ }+ process.exit(1);+}++// Node ids are entity ids — integers. argv is always string, so the+// conversion belongs here, at the one boundary, with a strict check. Coercing+// app-side with Number() would silently accept "0x1f", "1e3", " 7 ", "" → 0.+function parseNodeIds(ids: string[]): number[] {+ return ids.map((id) => {+ if (!/^\d+$/.test(id)) {+ console.error(`Invalid node id: ${JSON.stringify(id)} (expected a non-negative integer)`);+ process.exit(1);+ }+ return Number(id);+ });+}++type AssetAddOptions = { folder?: string };++async function addAssets(paths: string[], opts: AssetAddOptions): Promise<void> {+ if (paths.length === 0) {+ console.error("No file paths provided.");+ process.exit(1);+ }++ const absolutePaths = paths.map((p) => (isAbsolute(p) ? p : resolve(process.cwd(), p)));+ for (const p of absolutePaths) {+ if (!existsSync(p)) {+ console.error(`File not found: ${p}`);+ process.exit(1);+ }+ if (!statSync(p).isFile()) {+ console.error(`Not a file: ${p}`);+ process.exit(1);+ }+ }++ try {+ const results = await cliAPI.addAssets(absolutePaths, opts.folder);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++type AssetListOptions = { folder?: string; depth?: string };++async function listAssets(opts: AssetListOptions): Promise<void> {+ let depth: number | undefined;+ if (opts.depth !== undefined) {+ const n = Number(opts.depth);+ if (!Number.isInteger(n) || n <= 0) {+ console.error(`--depth must be a positive integer (got "${opts.depth}")`);+ process.exit(1);+ }+ depth = n;+ }++ try {+ const results = await cliAPI.listAssets(opts.folder, depth);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function deleteAssets(ids: string[]): Promise<void> {+ if (ids.length === 0) {+ console.error("No ids provided.");+ process.exit(1);+ }+ try {+ const results = await cliAPI.deleteAssets(ids);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++type MoveOptions = { to?: string };++async function moveAssets(ids: string[], opts: MoveOptions): Promise<void> {+ if (ids.length === 0) {+ console.error("No ids provided.");+ process.exit(1);+ }+ try {+ const results = await cliAPI.moveAssets(ids, opts.to);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++type AssetExportOptions = { output?: string };++async function exportAssets(ids: string[], opts: AssetExportOptions): Promise<void> {+ if (ids.length === 0) {+ console.error("No ids provided.");+ process.exit(1);+ }++ let output: string;+ let isDir: boolean;+ if (opts.output === undefined) {+ output = tmpdir();+ isDir = true;+ } else {+ output = isAbsolute(opts.output) ? opts.output : resolve(process.cwd(), opts.output);+ // A trailing separator always means a directory; so do multiple ids.+ const wantsDir = /[\\/]$/.test(opts.output) || ids.length > 1;+ if (existsSync(output) && statSync(output).isFile()) {+ if (wantsDir) {+ console.error(`--output must be a directory here, but resolves to an existing file: ${output}`);+ process.exit(1);+ }+ isDir = false;+ } else if (existsSync(output)) {+ isDir = true;+ } else {+ isDir = wantsDir;+ if (isDir) mkdirSync(output, { recursive: true });+ }+ }++ const stop = startSpinner(ids.length > 1 ? "Exporting assets" : "Exporting asset");+ try {+ const results = await cliAPI.exportAssets(ids, output, isDir);+ stop();+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++async function listFolders(parentId: string | undefined): Promise<void> {+ try {+ const results = await cliAPI.listFolders(parentId);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++type FolderCreateOptions = { parent?: string };++async function createFolder(name: string, opts: FolderCreateOptions): Promise<void> {+ try {+ const result = await cliAPI.createFolder(name, opts.parent);+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function renameFolder(id: string, name: string): Promise<void> {+ try {+ const result = await cliAPI.renameFolder(id, name);+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function moveFolders(ids: string[], opts: MoveOptions): Promise<void> {+ if (ids.length === 0) {+ console.error("No ids provided.");+ process.exit(1);+ }+ try {+ const results = await cliAPI.moveFolders(ids, opts.to);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function deleteFolders(ids: string[]): Promise<void> {+ if (ids.length === 0) {+ console.error("No ids provided.");+ process.exit(1);+ }+ try {+ const results = await cliAPI.deleteFolders(ids);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function listSelection(): Promise<void> {+ try {+ const results = await cliAPI.listSelection();+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function setSelection(ids: string[]): Promise<void> {+ try {+ const results = await cliAPI.setSelection(parseNodeIds(ids));+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function focusSelection(): Promise<void> {+ try {+ const results = await cliAPI.focusSelection();+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function listNodes(ids: string[]): Promise<void> {+ try {+ // No ids → root scenes; with ids → those specific nodes.+ const results = await cliAPI.listNodes(ids.length ? parseNodeIds(ids) : undefined);+ let failed = false;+ for (const result of results) {+ if (result.status === "fulfilled") {+ console.log(JSON.stringify(result.node));+ } else {+ console.error(result.error);+ failed = true;+ }+ }+ if (failed) process.exit(1);+ } catch (e) {+ handleSocketError(e);+ }+}++type TreeOptions = { depth?: string };++async function nodeTree(id: string | undefined, opts: TreeOptions): Promise<void> {+ const eid = id !== undefined ? parseNodeIds([id])[0] : undefined;++ let depth: number | undefined = 3;+ if (opts.depth !== undefined) {+ const n = Number(opts.depth);+ if (!Number.isInteger(n) || n < 0) {+ console.error(`--depth must be a non-negative integer (got "${opts.depth}")`);+ process.exit(1);+ }+ depth = n === 0 ? undefined : n;+ }++ try {+ const results = await cliAPI.nodeTree(eid, depth);+ for (const result of results) {+ console.log(JSON.stringify(result));+ }+ } catch (e) {+ handleSocketError(e);+ }+}++type NodeGrepOptions = {+ ignoreCase?: boolean;+ type?: string[];+ component?: string[];+ refsOnly?: boolean;+ count?: boolean;+};++async function grepNodes(pattern: string, id: string | undefined, opts: NodeGrepOptions): Promise<void> {+ // Validate the regex here so a bad pattern fails before the app is contacted.+ try {+ new RegExp(pattern);+ } catch (e) {+ console.error(`Invalid pattern: ${(e as Error).message}`);+ process.exit(1);+ }+ const eid = id !== undefined ? parseNodeIds([id])[0] : undefined;++ try {+ const results = await cliAPI.grepNodes({+ pattern,+ ignoreCase: opts.ignoreCase,+ id: eid,+ types: opts.type,+ components: opts.component,+ });+ if (opts.count) {+ console.log(JSON.stringify(results.length));+ return;+ }+ for (const result of results) {+ if (opts.refsOnly) {+ const { matches, ...ref } = result;+ console.log(JSON.stringify(ref));+ } else {+ console.log(JSON.stringify(result));+ }+ }+ } catch (e) {+ handleSocketError(e);+ }+}++type ScreenshotOptions = { time?: string };++async function nodeScreenshot(id: string | undefined, opts: ScreenshotOptions): Promise<void> {+ const eid = id !== undefined ? parseNodeIds([id])[0] : undefined;++ let frame: number | undefined;+ if (opts.time !== undefined) {+ frame = Math.round(parseTimeArg(opts.time, "--time") * TIME_FPS);+ }++ try {+ const { base64 } = await cliAPI.nodeScreenshot(eid, frame);+ const path = join(tmpdir(), `${randomUUID()}.png`);+ writeFileSync(path, Buffer.from(base64, "base64"));+ console.log(JSON.stringify({ path }));+ } catch (e) {+ handleSocketError(e);+ }+}++type AssetFrameOptions = { time?: string[]; output?: string };++async function assetFrame(ref: string, opts: AssetFrameOptions): Promise<void> {+ let times: number[] | undefined;+ if (opts.time !== undefined) {+ times = opts.time.map((t) => parseTimeArg(t, "--time"));+ }++ const assetId = await resolveAssetRef(ref);+ const dir = opts.output ?? tmpdir();+ try {+ const frames = await cliAPI.assetFrame(assetId, times);+ for (const { time, base64 } of frames) {+ const path = join(dir, `${randomUUID()}.png`);+ writeFileSync(path, Buffer.from(base64, "base64"));+ console.log(JSON.stringify({ time, path }));+ }+ } catch (e) {+ handleSocketError(e);+ }+}++async function resolveAssetRef(ref: string): Promise<string> {+ if (/^[A-Za-z0-9]+$/.test(ref)) return ref;++ const absPath = isAbsolute(ref) ? ref : resolve(process.cwd(), ref);+ if (!existsSync(absPath)) {+ console.error(`File not found: ${absPath}`);+ process.exit(1);+ }+ if (!statSync(absPath).isFile()) {+ console.error(`Not a file: ${absPath}`);+ process.exit(1);+ }++ const stop = startSpinner("Adding asset");+ try {+ const [result] = await cliAPI.addAssets([absPath]);+ stop();+ if (!result || result.status !== "fulfilled" || typeof result.id !== "string") {+ console.error(result?.error ?? `Failed to add asset: ${absPath}`);+ process.exit(1);+ }+ return result.id;+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++async function assetProbe(ref: string): Promise<void> {+ const assetId = await resolveAssetRef(ref);+ const stop = startSpinner("Probing asset");+ try {+ const result = await cliAPI.assetProbe(assetId);+ stop();+ console.log(JSON.stringify(result));+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++async function assetTranscript(ref: string): Promise<void> {+ const assetId = await resolveAssetRef(ref);+ const stop = startSpinner("Transcribing asset");+ try {+ const result = await cliAPI.assetTranscript(assetId);+ stop();+ console.log(JSON.stringify(result));+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++type AssetAnalyzeOptions = { prompt?: string; start?: string; end?: string };++async function assetAnalyze(ref: string, opts: AssetAnalyzeOptions): Promise<void> {+ const start = opts.start !== undefined ? parseTimeArg(opts.start, "--start") : undefined;+ const end = opts.end !== undefined ? parseTimeArg(opts.end, "--end") : undefined;+ if (start !== undefined && end !== undefined && start >= end) {+ console.error(`--start (${start}s) must be less than --end (${end}s).`);+ process.exit(1);+ }++ const assetId = await resolveAssetRef(ref);+ const stop = startSpinner("Analyzing asset");+ try {+ const result = await cliAPI.assetAnalyze(assetId, opts.prompt, start, end);+ stop();+ console.log(JSON.stringify(result));+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++type AssetSyncOptions = { video?: string };++async function assetSync(audioRef: string, opts: AssetSyncOptions): Promise<void> {+ const audioId = await resolveAssetRef(audioRef);+ const videoId = await resolveAssetRef(opts.video!);+ const stop = startSpinner("Measuring audio offset");+ try {+ const result = await cliAPI.assetSync(audioId, videoId);+ stop();+ console.log(JSON.stringify(result));+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++type AssetVisualizeOptions = { start?: string; end?: string; scale?: string; output?: string };++function parseTimeArg(value: string, flag: string): number {+ const seconds = parseTime(value);+ if (seconds === undefined || seconds < 0) {+ console.error(+ `${flag} must be a non-negative Time — seconds ("1.5"), frames ("45f"), or "MM:SS" (got "${value}")`,+ );+ process.exit(1);+ }+ return seconds;+}++async function assetVisualize(ref: string, opts: AssetVisualizeOptions): Promise<void> {+ const start = opts.start !== undefined ? parseTimeArg(opts.start, "--start") : undefined;+ const end = opts.end !== undefined ? parseTimeArg(opts.end, "--end") : undefined;+ if (start !== undefined && end !== undefined && start >= end) {+ console.error(`--start (${start}s) must be less than --end (${end}s).`);+ process.exit(1);+ }++ let scale: number | undefined;+ if (opts.scale !== undefined) {+ scale = Number(opts.scale);+ if (!Number.isFinite(scale) || scale <= 0) {+ console.error(`--scale must be a positive number (got "${opts.scale}")`);+ process.exit(1);+ }+ }++ const assetId = await resolveAssetRef(ref);+ const path = opts.output ?? join(tmpdir(), `${randomUUID()}.png`);+ const stop = startSpinner("Rendering visualization");+ try {+ const { base64, ...rest } = await cliAPI.assetVisualize(assetId, start, end, scale);+ stop();+ writeFileSync(path, Buffer.from(base64, "base64"));+ console.log(JSON.stringify({ path, ...rest }));+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++const MOUNT_EXTENSIONS = new Set([".tsx", ".jsx", ".ts", ".js"]);++type MountOptions = { code?: string };++// Validates the (<path> | --code) pair shared by `mount` and `node insert`,+// then compiles the module. Compile errors fail here, before the app is contacted.+async function compileProjectInput(path: string | undefined, code: string | undefined): Promise<string> {+ if ((path === undefined) === (code === undefined)) {+ console.error(`Provide exactly one of <path> or --code <str>.`);+ process.exit(1);+ }++ let input: { path: string } | { code: string };+ if (path !== undefined) {+ const absPath = isAbsolute(path) ? path : resolve(process.cwd(), path);+ if (!existsSync(absPath) || !statSync(absPath).isFile()) {+ console.error(`File not found: ${absPath}`);+ process.exit(1);+ }+ if (!MOUNT_EXTENSIONS.has(extname(absPath).toLowerCase())) {+ console.error(`Entry module must be a .tsx, .jsx, .ts, or .js file (got "${extname(absPath)}")`);+ process.exit(1);+ }+ input = { path: absPath };+ } else {+ input = { code: code! };+ }++ try {+ return await compileProject(input);+ } catch (e) {+ console.error((e as Error).message);+ process.exit(1);+ }+}++async function mountProject(path: string | undefined, opts: MountOptions): Promise<void> {+ const code = await compileProjectInput(path, opts.code);++ const stop = startSpinner("Mounting project");+ try {+ await cliAPI.mount({ code });+ stop();+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++type NodeInsertOptions = MountOptions & { index?: string };++async function nodeInsert(parentId: string, path: string | undefined, opts: NodeInsertOptions): Promise<void> {+ const [eid] = parseNodeIds([parentId]);++ let index: number | undefined;+ if (opts.index !== undefined) {+ const n = Number(opts.index);+ if (!Number.isInteger(n) || n < 0) {+ console.error(`--index must be a non-negative integer (got "${opts.index}")`);+ process.exit(1);+ }+ index = n;+ }++ const code = await compileProjectInput(path, opts.code);++ const stop = startSpinner("Inserting entities");+ try {+ await cliAPI.insertNode({ code, parentId: eid, index });+ stop();+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++async function deleteNodes(ids: string[]): Promise<void> {+ if (ids.length === 0) {+ console.error("No ids provided.");+ process.exit(1);+ }+ try {+ const results = await cliAPI.deleteNodes(parseNodeIds(ids));+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++type JsonPayloadOptions = { json?: string };++/**+ * Unified JSON payload input, mirroring `mount`'s shape: a positional .json+ * file path, or an inline --json string.+ */+function readJsonPayload(+ path: string | undefined,+ json: string | undefined,+ required: boolean,+): unknown {+ if (path !== undefined && json !== undefined) {+ console.error(`Provide only one of <path> or --json <str>.`);+ process.exit(1);+ }+ if (path === undefined && json === undefined) {+ if (!required) return undefined;+ console.error(`Provide exactly one of <path> or --json <str>.`);+ process.exit(1);+ }+ let raw: string;+ if (path !== undefined) {+ const absPath = isAbsolute(path) ? path : resolve(process.cwd(), path);+ if (!existsSync(absPath) || !statSync(absPath).isFile()) {+ console.error(`File not found: ${absPath}`);+ process.exit(1);+ }+ if (extname(absPath).toLowerCase() !== ".json") {+ console.error(`Payload must be a .json file (got "${extname(absPath)}")`);+ process.exit(1);+ }+ raw = readFileSync(absPath, "utf8");+ } else {+ raw = json!;+ }+ try {+ return JSON.parse(raw);+ } catch {+ console.error(`Payload is not valid JSON.`);+ process.exit(1);+ }+}++async function patchNodes(path: string | undefined, opts: JsonPayloadOptions): Promise<void> {+ const payload = readJsonPayload(path, opts.json, true);+ if (+ !Array.isArray(payload) ||+ payload.some(+ (p) =>+ typeof p !== "object" ||+ p === null ||+ !Number.isInteger((p as { id?: unknown }).id),+ )+ ) {+ console.error(`Payload must be an array of { id: number } with JSX props.`);+ process.exit(1);+ }+ try {+ const results = await cliAPI.patchNodes(payload as Parameters<typeof cliAPI.patchNodes>[0]);+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function duplicateNodes(ids: string[]): Promise<void> {+ if (ids.length === 0) {+ console.error("No ids provided.");+ process.exit(1);+ }+ try {+ const results = await cliAPI.duplicateNodes(parseNodeIds(ids));+ for (const result of results) console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++type NodeExportOptions = JsonPayloadOptions & { output?: string };++async function nodeExport(+ idArg: string | undefined,+ configArg: string | undefined,+ opts: NodeExportOptions,+): Promise<void> {+ // Node ids are integers, so a lone non-numeric positional is the config file.+ let id = idArg;+ let configPath = configArg;+ if (id !== undefined && configPath === undefined && !/^\d+$/.test(id)) {+ configPath = id;+ id = undefined;+ }+ const eid = id !== undefined ? parseNodeIds([id])[0] : undefined;++ const config = readJsonPayload(configPath, opts.json, false) as EncoderConfigInput | undefined;+ if (config !== undefined && (typeof config !== "object" || config === null || Array.isArray(config))) {+ console.error(`Encode config must be a JSON object.`);+ process.exit(1);+ }++ const format = config?.format ?? "mp4";+ const output = opts.output !== undefined+ ? (isAbsolute(opts.output) ? opts.output : resolve(process.cwd(), opts.output))+ : join(tmpdir(), `${randomUUID()}.${format}`);++ const stop = startSpinner("Rendering scene");+ try {+ const { path } = await cliAPI.exportNode(output, eid, config);+ stop();+ console.log(JSON.stringify({ path }));+ } catch (e) {+ stop();+ handleSocketError(e);+ }+}++async function activeProject(): Promise<void> {+ try {+ const result = await cliAPI.activeProject();+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function listProjects(): Promise<void> {+ try {+ const result = await cliAPI.listProjects();+ for (const project of result) console.log(JSON.stringify(project));+ } catch (e) {+ handleSocketError(e);+ }+}++async function createProject(name?: string): Promise<void> {+ try {+ const result = await cliAPI.createProject(name);+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function openProject(id: string): Promise<void> {+ try {+ const result = await cliAPI.openProject(id);+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function deleteProject(id: string): Promise<void> {+ try {+ const result = await cliAPI.deleteProject(id);+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function context(): Promise<void> {+ try {+ const result = await cliAPI.context();+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++async function whoami(): Promise<void> {+ try {+ const result = await cliAPI.whoami();+ console.log(JSON.stringify(result));+ } catch (e) {+ handleSocketError(e);+ }+}++function startSpinner(label: string): () => void {+ if (!process.stderr.isTTY) {+ process.stderr.write(`${label}…\n`);+ return () => { };+ }+ const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];+ const start = Date.now();+ let i = 0;+ const render = () => {+ const secs = Math.floor((Date.now() - start) / 1000);+ process.stderr.write(`\r${frames[i]} ${label}… ${secs}s`);+ i = (i + 1) % frames.length;+ };+ render();+ const timer = setInterval(render, 80);+ return () => {+ clearInterval(timer);+ process.stderr.write("\r\x1b[K"); // carriage return + clear to end of line+ };+}++async function listModels(type: string | undefined): Promise<void> {+ if (type !== undefined && type !== "image" && type !== "video" && type !== "audio") {+ console.error(`[type] must be one of "image", "video", "audio" (got "${type}")`);+ process.exit(1);+ }+ try {+ const models = await cliAPI.models({ type: type as "image" | "video" | "audio" | undefined });+ for (const model of models) console.log(JSON.stringify(model));+ } catch (e) {+ handleSocketError(e);+ }+}++async function listVoices(): Promise<void> {+ try {+ const voices = await cliAPI.voices();+ for (const voice of voices) console.log(JSON.stringify(voice));+ } catch (e) {+ handleSocketError(e);+ }+}++type ListFontsOptions = {+ family?: string;+ weight?: string[];+ style?: string;+ limit?: string;+ namesOnly?: boolean;+};++function listFonts(opts: ListFontsOptions): void {+ let style: "normal" | "italic" | undefined;+ if (opts.style !== undefined) {+ if (opts.style !== "normal" && opts.style !== "italic") {+ console.error(`--style must be "normal" or "italic" (got "${opts.style}")`);+ process.exit(1);+ }+ style = opts.style;+ }++ let limit: number | undefined;+ if (opts.limit !== undefined) {+ const n = Number(opts.limit);+ if (!Number.isInteger(n) || n <= 0) {+ console.error(`--limit must be a positive integer (got "${opts.limit}")`);+ process.exit(1);+ }+ limit = n;+ }++ try {+ const families = listLocalFonts({+ familyPattern: opts.family,+ weights: opts.weight,+ style,+ limit,+ });+ if (opts.namesOnly) {+ for (const family of families) console.log(family.family);+ } else {+ for (const family of families) console.log(JSON.stringify(family));+ }+ } catch (e) {+ console.error((e as Error).message);+ process.exit(1);+ }+}++const program = new Command();++program+ .name("dapi")+ .description("CLI for Diffusion Studio")+ .version("0.0.0");++program+ .command("context")+ .alias("ctx")+ .description("Print essential context about the open project")+ .action(() => context());++program+ .command("open")+ .description("Open Diffusion Studio")+ .argument("[target]", `file path, folder path, or "${PROTOCOL}://" URL to open`)+ .option("-b, --background", "launch with the window hidden (headless)")+ .action((target: string | undefined, opts: { background?: boolean }) =>+ openTarget(target, opts.background ?? false));++program+ .command("mount")+ .description("Compile a Solid JSX project module and mount it into the canvas (see JSX_API.md)")+ .argument("[path]", "path to a .tsx / .jsx / .ts / .js entry module")+ .option("--code <str>", "inline module source; export default wrapper optional for bare JSX")+ .action((path: string | undefined, opts: MountOptions) => mountProject(path, opts));++const asset = program+ .command("asset")+ .alias("a")+ .description("Manage assets in the open project");++asset+ .command("add")+ .description("Add one or more local files as assets in the open project")+ .argument("<paths...>", "absolute or relative file paths to add")+ .option("--folder <id>", "folder to place the new assets in (default: the library root)")+ .action((paths: string[], opts: AssetAddOptions) => addAssets(paths, opts));++asset+ .command("ls")+ .aliases(["list", "get"])+ .description("List the asset library of the open project as its folder tree")+ .option("--folder <id>", "folder whose contents to list (default: the library root)")+ .option("--depth <n>", "max depth to descend (positive integer; default = full tree)")+ .action((opts: AssetListOptions) => listAssets(opts));++asset+ .command("rm")+ .alias("remove")+ .description("Delete one or more assets from the open project by id")+ .argument("<ids...>", "asset ids to delete")+ .action((ids: string[]) => deleteAssets(ids));++asset+ .command("mv")+ .alias("move")+ .description("Move one or more assets into a folder")+ .argument("<ids...>", "asset ids to move")+ .option("--to <folderId>", "destination folder (default: the library root)")+ .action((ids: string[], opts: MoveOptions) => moveAssets(ids, opts));++asset+ .command("export")+ .description("Write one or more assets' original file bytes to disk (no re-encode)")+ .argument("<ids...>", "asset ids to export")+ .option("-o, --output <path>", "directory to write into, or an exact file path for a single id (default: system temp dir)")+ .action((ids: string[], opts: AssetExportOptions) => exportAssets(ids, opts));++asset+ .command("probe")+ .description("Read the container and per-track technical metadata of an asset")+ .argument("<id|path>", "asset id, or a local file to add and probe")+ .action((ref: string) => assetProbe(ref));++asset+ .command("transcript")+ .description("Transcribe the speech in a video or audio asset and print the timed transcript")+ .argument("<id|path>", "video or audio asset id, or a local file to add and transcribe")+ .action((ref: string) => assetTranscript(ref));++asset+ .command("frame")+ .description("Decode one or more frames of a video asset and write them as PNGs")+ .argument("<id|path>", "video asset id, or a local file to add and grab frames from")+ .option("-t, --time <time...>", `one or more timestamps to grab — seconds ("1.5"), frames ("45f"), or "MM:SS" (default: 0)`)+ .option("-o, --output <dir>", "directory to write the PNGs into (default: system temp dir)")+ .action((ref: string, opts: AssetFrameOptions) => assetFrame(ref, opts));++asset+ .command("visualize")+ .alias("viz")+ .description("Render a visual preview of an asset (waveform, filmstrip, or thumbnail) to a PNG")+ .argument("<id|path>", "image, audio, or video asset id, or a local file to add and visualize")+ .option("-s, --start <time>", `start of the window to visualize — seconds, "45f" frames, or "MM:SS" (default: 0)`)+ .option("-e, --end <time>", `end of the window to visualize — seconds, "45f" frames, or "MM:SS" (default: asset duration)`)+ .option("-x, --scale <factor>", "scale factor for the thumbnails; smaller thumbnails fit more rows and columns, larger fit fewer (default: 1)")+ .option("-o, --output <path>", "write the PNG here instead of a temp file")+ .action((ref: string, opts: AssetVisualizeOptions) => assetVisualize(ref, opts));++asset+ .command("analyze")+ .description("Analyze an image, audio, or video asset with AI and print a description of its contents")+ .argument("<id|path>", "image, audio, or video asset id, or a local file to add and analyze")+ .option("-p, --prompt <str>", "question or instruction to guide the analysis")+ .option("-s, --start <time>", `start of the segment to analyze — seconds, "45f" frames, or "MM:SS" (default: 0); timestamps in the analysis are relative to this point`)+ .option("-e, --end <time>", `end of the segment to analyze — seconds, "45f" frames, or "MM:SS" (default: asset duration)`)+ .action((ref: string, opts: AssetAnalyzeOptions) => assetAnalyze(ref, opts));++asset+ .command("sync")+ .alias("align")+ .description("Measure the time offset that aligns an audio recording with a video's camera audio")+ .argument("<audioId|path>", "the audio (or video) asset to align: an asset id or a local file to add")+ .requiredOption("-v, --video <id|path>", "the reference video asset to align against: an asset id or a local file to add")+ .action((audioRef: string, opts: AssetSyncOptions) => assetSync(audioRef, opts));++const folder = program+ .command("folder")+ .alias("fld")+ .description("Organize the asset library of the open project into folders");++folder+ .command("ls")+ .aliases(["list", "get"])+ .description("List the direct child folders of a parent folder; with no id, the root-level folders")+ .argument("[parentId]", "parent folder id (optional; omitted = the library root)")+ .action((parentId: string | undefined) => listFolders(parentId));++folder+ .command("create")+ .description("Create a folder")+ .argument("<name>", "folder name")+ .option("-p, --parent <id>", "parent folder (default: the library root)")+ .action((name: string, opts: FolderCreateOptions) => createFolder(name, opts));++folder+ .command("rename")+ .description("Rename a folder")+ .argument("<id>", "folder id")+ .argument("<name>", "new name")+ .action((id: string, name: string) => renameFolder(id, name));++folder+ .command("mv")+ .alias("move")+ .description("Move one or more folders under a new parent")+ .argument("<ids...>", "folder ids to move")+ .option("--to <folderId>", "destination parent folder (default: the library root)")+ .action((ids: string[], opts: MoveOptions) => moveFolders(ids, opts));++folder+ .command("rm")+ .alias("remove")+ .description("Delete one or more folders, including all nested folders and the assets inside")+ .argument("<ids...>", "folder ids to delete")+ .action((ids: string[]) => deleteFolders(ids));++const selection = program+ .command("selection")+ .alias("sel")+ .description("Read and mutate the current node selection");++selection+ .command("ls")+ .alias("get")+ .description("List the currently selected nodes")+ .action(() => listSelection());++selection+ .command("set")+ .description("Replace the current selection with exactly the given node ids; none = clear")+ .argument("[ids...]", "node ids to select")+ .action((ids: string[]) => setSelection(ids));++selection+ .command("focus")+ .description("Pan and zoom the canvas to fit the current selection in view")+ .action(() => focusSelection());++const node = program+ .command("node")+ .aliases(["n", "entity"])+ .description("Operate on one or more nodes in the open project");++node+ .command("ls")+ .alias("get")+ .description("Print raw entity records — every component, as persisted; with no ids, lists the root scenes")+ .argument("[ids...]", "entity ids to list (optional)")+ .action((ids: string[]) => listNodes(ids));++node+ .command("tree")+ .description("Print an entity's subtree as a nested JSON object, sub-entities included; with no id, prints every top-level node's tree")+ .argument("[id]", "root entity id (optional; omitted = every top-level node)")+ .option("--depth <n>", "max depth to descend (default: 3; 0 = full subtree)")+ .action((id: string | undefined, opts: TreeOptions) => nodeTree(id, opts));++node+ .command("grep")+ .description("Search entity records for a regex and print the matching entities with the components that matched — the search corpus is the raw records node ls emits")+ .argument("<pattern>", "regex to match against stringified component values")+ .argument("[id]", "root entity id to scope the search to a subtree (optional; omitted = the whole document)")+ .option("-i, --ignore-case", "case-insensitive matching")+ .option("-t, --type <types...>", "only match entities of these node types, e.g. -t text image")+ .option("-k, --component <names...>", "restrict matching to these components, e.g. -k Name Chars")+ .option("-l, --refs-only", "output only the matching entity refs, no match detail")+ .option("-c, --count", "output only the number of matching entities")+ .action((pattern: string, id: string | undefined, opts: NodeGrepOptions) => grepNodes(pattern, id, opts));++node+ .command("screenshot")+ .description("Focus a node on the canvas and capture a screenshot as a PNG")+ .argument("[id]", "node id to capture (optional; defaults to the canvas)")+ .option("-t, --time <time>", `timeline position to record at — seconds ("1.5"), frames ("45f"), or "MM:SS" (default: the current playhead)`)+ .action((id: string | undefined, opts: ScreenshotOptions) => nodeScreenshot(id, opts));++node+ .command("insert")+ .description("Compile a Solid JSX project module and insert the rendered entities into a parent entity (see JSX_API.md)")+ .argument("<parentId>", "entity id of the parent to insert into — a node, or a gradient paint for <colorStop> roots")+ .argument("[path]", "path to a .tsx / .jsx / .ts / .js entry module")+ .option("--code <str>", "inline module source; export default wrapper optional for bare JSX")+ .option("-i, --index <n>", "0-based position among the parent's existing children (node roots only; default: append at the end)")+ .action((parentId: string, path: string | undefined, opts: NodeInsertOptions) => nodeInsert(parentId, path, opts));++node+ .command("rm")+ .alias("remove")+ .description("Delete one or more entities and all their descendants")+ .argument("<ids...>", "entity ids to delete")+ .action((ids: string[]) => deleteNodes(ids));++node+ .command("cp")+ .alias("duplicate")+ .description("Deep-clone one or more nodes, including all descendants")+ .argument("<ids...>", "node ids to duplicate")+ .action((ids: string[]) => duplicateNodes(ids));++node+ .command("patch")+ .description("Assign JSX props on one or more existing entities in a single call — the same properties, with the same value requirements, as mount. Renaming a node is patching its name")+ .argument("[path]", "path to a .json file containing the patch array")+ .option("--json <str>", "inline JSON array of { id, ...jsx props }")+ .action((path: string | undefined, opts: JsonPayloadOptions) => patchNodes(path, opts));++node+ .command("export")+ .description("Render a scene to a video file")+ .argument("[id]", "scene node id (optional; defaults to the active scene)")+ .argument("[config]", "path to a .json encode config (EncoderConfig)")+ .option("-o, --output <path>", "write the video here (default: a temp file)")+ .option("--json <str>", "inline JSON encode config (EncoderConfig)")+ .action((id: string | undefined, config: string | undefined, opts: NodeExportOptions) =>+ nodeExport(id, config, opts));++const project = program+ .command("project")+ .alias("p")+ .description("Manage projects");++project+ .command("active")+ .description("Print the currently active project, or null if none is open")+ .action(() => activeProject());++project+ .command("ls")+ .alias("list")+ .description("List all projects, most recently accessed first")+ .action(() => listProjects());++project+ .command("create")+ .description("Create a new project and open it")+ .argument("[name]", "optional project name")+ .action((name?: string) => createProject(name));++project+ .command("set")+ .description("Set the active project by id, or null if no project has that id")+ .argument("<id>", "project id to set active")+ .action((id: string) => openProject(id));++project+ .command("rm")+ .alias("remove")+ .description("Delete a project by id")+ .argument("<id>", "project id to delete")+ .action((id: string) => deleteProject(id));++program+ .command("models")+ .description("List available AI generation models and their constraints (for generate.* declarations — see the JSX API)")+ .argument("[type]", `filter to one of "image", "video", "audio"`)+ .action((type: string | undefined) => listModels(type));++program+ .command("voices")+ .description("List the speech voices available for generate.voice declarations (see the JSX API)")+ .action(() => listVoices());++program+ .command("whoami")+ .description("Print the authenticated account, or null if signed out")+ .action(() => whoami());++program+ .command("fonts")+ .description("List the local fonts available on this machine")+ .option("-f, --family <pattern>", "filter to families whose name contains <pattern> (case-insensitive)")+ .option("-w, --weight <weights...>", "filter to variants with the given CSS weight(s), e.g. -w 400 700")+ .option("-s, --style <style>", `filter to variants with the given style: "normal" or "italic"`)+ .option("-l, --limit <n>", "output at most <n> families")+ .option("-n, --names-only", "output only family names (one per line, no variant detail)")+ .action((opts: ListFontsOptions) => listFonts(opts));++program.parse();diff --git a/apps/cli/src/open-folder.ts b/apps/cli/src/open-folder.tsnew file mode 100644index 00000000..7ecbbc4c--- /dev/null+++ b/apps/cli/src/open-folder.ts@@ -0,0 +1,160 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { existsSync, readFileSync, statSync, writeFileSync } from "node:fs";+import { readdir } from "node:fs/promises";+import { basename, extname, join } from "node:path";+import { cliAPI } from "./cli-client";++const MARKER_FILENAME = ".dapi";+const MARKER_VERSION = 1;++// Asset extensions broadly aligned with the engine's media types. Used to+// filter recursive folder scans during `dapi open <folder>`.+const SUPPORTED_ASSET_EXTENSIONS: ReadonlySet<string> = new Set([+ // images+ ".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif", ".heic", ".heif",+ // video+ ".mp4", ".webm", ".mov", ".m4v", ".mkv", ".avi",+ // audio+ ".mp3", ".wav", ".m4a", ".ogg", ".opus", ".flac", ".aac",+]);++type MarkerFile = {+ version: number;+ projectId: string;+ createdAt: string;+};++type OpenFolderResult = {+ project: { id: string; name: string };+ created: boolean;+ imported: number;+};++function readMarker(folderPath: string): MarkerFile | null {+ const markerPath = join(folderPath, MARKER_FILENAME);+ if (!existsSync(markerPath)) return null;+ try {+ const raw = readFileSync(markerPath, "utf8");+ const parsed = JSON.parse(raw) as MarkerFile;+ if (+ typeof parsed !== "object" ||+ parsed === null ||+ typeof parsed.projectId !== "string" ||+ parsed.projectId.length === 0+ ) {+ return null;+ }+ return parsed;+ } catch {+ return null;+ }+}++function writeMarker(folderPath: string, projectId: string): void {+ const marker: MarkerFile = {+ version: MARKER_VERSION,+ projectId,+ createdAt: new Date().toISOString(),+ };+ writeFileSync(+ join(folderPath, MARKER_FILENAME),+ JSON.stringify(marker, null, 2),+ );+}++type AssetDirectory = {+ // Path segments relative to the import root; [] is the root itself.+ segments: string[];+ paths: string[];+};++async function collectSupportedAssets(folderPath: string) {+ const results: AssetDirectory[] = [];++ async function walk(dir: string, segments: string[]): Promise<void> {+ const entries = await readdir(dir, { withFileTypes: true });+ const paths: string[] = [];+ const subdirs: string[] = [];+ for (const entry of entries) {+ if (entry.isDirectory()) {+ subdirs.push(entry.name);+ continue;+ }+ if (!entry.isFile()) continue;+ if (entry.name === MARKER_FILENAME && segments.length === 0) continue;+ if (SUPPORTED_ASSET_EXTENSIONS.has(extname(entry.name).toLowerCase())) {+ paths.push(join(dir, entry.name));+ }+ }+ if (paths.length > 0) results.push({ segments, paths });+ for (const name of subdirs) {+ await walk(join(dir, name), [...segments, name]);+ }+ }++ await walk(folderPath, []);+ return results;+}++async function ensureFolder(segments: string[], cache: Map<string, string>) {+ if (segments.length === 0) return undefined; // the library root+ const key = segments.join("/");+ const cached = cache.get(key);+ if (cached !== undefined) return cached;+ const parentId = await ensureFolder(segments.slice(0, -1), cache);+ const folder = await cliAPI.createFolder(segments[segments.length - 1], parentId);+ cache.set(key, folder.id);+ return folder.id;+}++async function waitForActiveProject(expectedId: string, timeoutMs = 10000): Promise<void> {+ const start = Date.now();+ while (Date.now() - start < timeoutMs) {+ const active = await cliAPI.activeProject().catch(() => null);+ if (active?.id === expectedId) return;+ await new Promise((r) => setTimeout(r, 50));+ }+ throw new Error(`Timed out waiting for project ${expectedId} to become active`);+}++export async function openFolder(folderPath: string): Promise<OpenFolderResult> {+ if (!existsSync(folderPath)) {+ throw new Error(`Folder not found: ${folderPath}`);+ }+ if (!statSync(folderPath).isDirectory()) {+ throw new Error(`Not a directory: ${folderPath}`);+ }++ const marker = readMarker(folderPath);++ if (marker) {+ const opened = await cliAPI.openProject(marker.projectId);+ if (opened) {+ await waitForActiveProject(opened.id);+ return { project: opened, created: false, imported: 0 };+ }+ // Stale marker: fall through and run the first-time flow, overwriting it.+ }++ const assetDirs = await collectSupportedAssets(folderPath);+ const project = await cliAPI.createProject(basename(folderPath));+ await waitForActiveProject(project.id);++ let imported = 0;+ const folderIds = new Map<string, string>();+ for (const { segments, paths } of assetDirs) {+ const folderId = await ensureFolder(segments, folderIds);+ const results = await cliAPI.addAssets(paths, folderId);+ if (Array.isArray(results)) {+ imported += results.filter(+ (r: { status?: string }) => r?.status === "fulfilled",+ ).length;+ }+ }++ writeMarker(folderPath, project.id);+ return { project, created: true, imported };+}diff --git a/apps/cli/src/protocol.ts b/apps/cli/src/protocol.tsnew file mode 100644index 00000000..d4d60007--- /dev/null+++ b/apps/cli/src/protocol.ts@@ -0,0 +1,11 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Public wire protocol consumed by both the CLI binary and any host that+// embeds the CLI socket server (the Diffusion Studio desktop app). Importing+// from `@diffusionstudio/cli/protocol` is the OSS-friendly seam: this module has no+// dependency on proprietary code, so the package stays extractable into its+// own repo.+export * from "./cli-channels";+export * from "./cli-socket-path";diff --git a/apps/cli/src/untyped-modules.d.ts b/apps/cli/src/untyped-modules.d.tsnew file mode 100644index 00000000..736500ea--- /dev/null+++ b/apps/cli/src/untyped-modules.d.ts@@ -0,0 +1,15 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Babel presets ship no type declarations; they are only ever passed opaquely+// into @babel/core's `presets` option.+declare module "babel-preset-solid" {+ const preset: unknown;+ export default preset;+}++declare module "@babel/preset-typescript" {+ const preset: unknown;+ export default preset;+}diff --git a/apps/cli/tsconfig.json b/apps/cli/tsconfig.jsonnew file mode 100644index 00000000..6f6d8c8b--- /dev/null+++ b/apps/cli/tsconfig.json@@ -0,0 +1,9 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",+ "lib": ["es2024"],+ "types": ["node"]+ },+ "include": ["src"]+}diff --git a/apps/desktop/.gitignore b/apps/desktop/.gitignorenew file mode 100644index 00000000..4387ed2e--- /dev/null+++ b/apps/desktop/.gitignore@@ -0,0 +1,3 @@+dist+web+outdiff --git a/apps/desktop/forge.config.ts b/apps/desktop/forge.config.tsnew file mode 100644index 00000000..d233c525--- /dev/null+++ b/apps/desktop/forge.config.ts@@ -0,0 +1,18 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { ForgeConfig } from '@electron-forge/shared-types';+import { MakerDMG } from '@electron-forge/maker-dmg';++const config: ForgeConfig = {+ packagerConfig: {+ name: 'Diffusion Studio',+ prune: false,+ },+ makers: [+ new MakerDMG({})+ ]+};++export default config;diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonnew file mode 100644index 00000000..2ffa4225--- /dev/null+++ b/apps/desktop/package.json@@ -0,0 +1,32 @@+{+ "name": "@diffusionstudio/desktop",+ "private": true,+ "version": "0.0.0",+ "license": "MPL-2.0",+ "main": "dist/main.js",+ "scripts": {+ "build:preload": "esbuild src/preload.ts --bundle --platform=node --format=cjs --external:electron --outfile=dist/preload.js",+ "build:main": "esbuild src/main.ts --bundle --platform=node --format=cjs --external:electron --outfile=dist/main.js",+ "build": "npm run check && npm run build:main && npm run build:preload",+ "build:web": "npm --prefix ../web run build:desktop",+ "check": "tsc --noEmit",+ "dev": "npm run build && electron-forge start",+ "package": "npm run build && npm run build:web && electron-forge package",+ "make": "npm run build && npm run build:web && electron-forge make",+ "publish": "npm run build && npm run build:web && electron-forge publish"+ },+ "devDependencies": {+ "@electron-forge/cli": "^7.11.1",+ "@electron-forge/maker-deb": "^7.11.1",+ "@electron-forge/maker-dmg": "^7.11.1",+ "@electron-forge/maker-squirrel": "^7.11.1",+ "@electron-forge/maker-zip": "^7.11.1",+ "@types/node": "^24.10.1",+ "electron": "^35.1.2",+ "esbuild": "^0.28.1",+ "typescript": "~5.9.3"+ },+ "dependencies": {+ "@diffusionstudio/cli": "*"+ }+}diff --git a/apps/desktop/src/cli-server.ts b/apps/desktop/src/cli-server.tsnew file mode 100644index 00000000..f7834283--- /dev/null+++ b/apps/desktop/src/cli-server.ts@@ -0,0 +1,196 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { existsSync, unlinkSync } from "node:fs";+import { createServer } from "node:net";+import type { Server, Socket } from "node:net";+import { app, BrowserWindow, ipcMain } from "electron";+import { CLI_WIRE, SOCKET_PATH } from "@diffusionstudio/cli/protocol";+import type { CliReply, CliRequest } from "@diffusionstudio/cli/protocol";+import { mainBridge } from "./main-manager";+import { MAIN_CHANNELS } from "./main-channels";++let cliServer: Server | null = null;+let currentWindow: BrowserWindow | null = null;+let headless = false;++export function isHeadless(): boolean {+ return headless;+}++function enableHeadless(): void {+ if (headless) return;+ headless = true;+ if (currentWindow && !currentWindow.isDestroyed()) {+ mainBridge.emit(currentWindow, MAIN_CHANNELS.HEADLESS_MODE, { active: true });+ }+}++const pending = new Map<string, Socket>();+let forwardListenerBound = false;+let windowLifecycleBound = false;++function resetRenderer(reason: string): void {+ for (const [id, sock] of pending) {+ finish(id, { id, ok: false, error: reason }, sock);+ }+ pending.clear();+}++// Resolves once the current window has finished loading.+function waitForRendererReady(timeoutMs = 30000): Promise<void> {+ if (!currentWindow || currentWindow.isDestroyed()) {+ return Promise.reject(new Error("No window"));+ }++ if (currentWindow.webContents.isCrashed()) {+ return Promise.reject(new Error("Renderer crashed"));+ }+ if (!currentWindow.webContents.isLoading()) {+ return Promise.resolve();+ }++ return new Promise((resolve, reject) => {+ const timer = setTimeout(() => {+ console.warn(`[cli-server] renderer not ready after ${timeoutMs}ms`);+ reject(new Error("App did not become ready in time"));+ }, timeoutMs);++ const cleanup = () => {+ clearTimeout(timer);+ currentWindow?.webContents.off("did-finish-load", onLoad);+ currentWindow?.webContents.off("did-fail-load", onFail);+ };++ const onLoad = () => {+ cleanup();+ resolve();+ };++ const onFail = () => {+ cleanup();+ reject(new Error(`Renderer failed to load`));+ };++ currentWindow?.webContents.on("did-finish-load", onLoad);+ currentWindow?.webContents.on("did-fail-load", onFail);+ });+}++function attachWindowLifecycle(window: BrowserWindow): void {+ currentWindow = window;++ window.webContents.on("did-start-loading", () => resetRenderer("Renderer reloading"));+ window.webContents.on("render-process-gone", () => resetRenderer("Renderer crashed"));+ window.on("closed", () => {+ if (currentWindow === window) {+ currentWindow = null;+ }+ resetRenderer("Window closed");+ });+}++function bindWindowLifecycle(): void {+ if (windowLifecycleBound) return;+ windowLifecycleBound = true;+ app.on("browser-window-created", (_event, window) => attachWindowLifecycle(window));+ // Catch any window that was created before the server started.+ for (const window of BrowserWindow.getAllWindows()) {+ attachWindowLifecycle(window);+ }+}++function finish(id: string, reply: CliReply, sock?: Socket): void {+ const target = sock ?? pending.get(id);+ if (!target) return;+ pending.delete(id);+ if (!target.destroyed) target.end(JSON.stringify(reply));+}++function bindForwardListener(): void {+ if (forwardListenerBound) return;+ forwardListenerBound = true;+ ipcMain.on(CLI_WIRE.FORWARD_REPLY, (_event, reply: CliReply) => {+ finish(reply.id, reply);+ });+}++async function forwardToRenderer(req: CliRequest, sock: Socket): Promise<void> {+ pending.set(req.id, sock);+ sock.once("close", () => {+ // CLI hung up before we could reply — drop the entry so a late reply is+ // discarded rather than written to a destroyed socket.+ if (pending.get(req.id) === sock) {+ pending.delete(req.id);+ }+ });++ try {+ await waitForRendererReady();+ if (!currentWindow || currentWindow.isDestroyed()) {+ throw new Error("No window");+ }++ currentWindow.webContents.send(CLI_WIRE.FORWARD_REQ, req);+ } catch (err) {+ finish(req.id, { id: req.id, ok: false, error: (err as Error).message });+ }+}++export function startCliServer() {+ cleanupStaleSocket();+ bindForwardListener();+ bindWindowLifecycle();++ cliServer = createServer({ allowHalfOpen: true }, (sock: Socket) => {+ enableHeadless();+ let buf = "";+ sock.setEncoding("utf8");+ sock.setTimeout(60000, () => sock.destroy());+ sock.on("data", (chunk) => {+ buf += chunk;+ });+ sock.on("end", async () => {+ sock.setTimeout(0);+ let req: CliRequest;+ try {+ req = JSON.parse(buf) as CliRequest;+ } catch {+ sock.end(JSON.stringify({ id: "unknown", ok: false, error: "Invalid JSON request" }));+ return;+ }+ await forwardToRenderer(req, sock);+ });+ sock.on("error", () => {+ // Client hung up; nothing to do.+ });+ });++ cliServer.on("error", (err) => {+ console.error("CLI server error:", err);+ });++ cliServer.listen(SOCKET_PATH);+}++export function stopCliServer() {+ if (!cliServer) return;+ cliServer.close();+ cliServer = null;+ cleanupStaleSocket();+}++/**+ * Clean up a stale socket file (Unix). Safe because the single-instance lock+ * guarantees no other instance of ours is running.+ */+function cleanupStaleSocket() {+ try {+ if (process.platform !== "win32" && existsSync(SOCKET_PATH)) {+ unlinkSync(SOCKET_PATH);+ }+ } catch {+ // Best-effort.+ }+}diff --git a/apps/desktop/src/main-channels.ts b/apps/desktop/src/main-channels.tsnew file mode 100644index 00000000..cd193c6f--- /dev/null+++ b/apps/desktop/src/main-channels.ts@@ -0,0 +1,93 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Wire-level channels — the only raw ipcRenderer/ipcMain channels in play for+// the main↔renderer request/event protocol. Everything else multiplexes+// through these via an envelope carrying the logical MAIN_CHANNELS name and+// (for requests) a UUID for correlation.+//+// CLI traffic uses a separate wire pair (CLI_WIRE in @diffusionstudio/cli/protocol);+// main forwards it opaquely without inspecting channel names.+export const MAIN_WIRE = {+ REQUEST: "main:request",+ RESPONSE: "main:response",+ EVENT: "main:event",+} as const;++export type MainWireChannel = (typeof MAIN_WIRE)[keyof typeof MAIN_WIRE];++// Logical channels. Two categories:+// • Renderer→Main requests (request + response)+// • Main→Renderer events (push, no response)+// Renderer-state queries used to live here; they now answer CLI requests+// directly via the CLI bridge.+export const MAIN_CHANNELS = {+ // Renderer→Main requests+ APP_OPEN_EXTERNAL: "app:open-external",+ AUTH_GET_PENDING_CALLBACK: "auth:get-pending-callback",+ WINDOW_IS_FULLSCREEN: "window:is-fullscreen",+ FILE_TRANSFER: "file:transfer",+ FILE_WRITE_OPEN: "file:write-open",+ FILE_WRITE_CHUNK: "file:write-chunk",+ FILE_WRITE_CLOSE: "file:write-close",+ FILE_WRITE_ABORT: "file:write-abort",+ HEADLESS_GET_MODE: "headless:get-mode",++ // Main→Renderer events+ AUTH_CALLBACK: "auth:callback",+ WINDOW_FULLSCREEN_CHANGE: "window:fullscreen-change",+ HEADLESS_MODE: "headless:mode",+} as const;++export type MainChannel = (typeof MAIN_CHANNELS)[keyof typeof MAIN_CHANNELS];++export type MainRequestMap = {+ [MAIN_CHANNELS.APP_OPEN_EXTERNAL]: { request: { url: string }; response: void };+ [MAIN_CHANNELS.AUTH_GET_PENDING_CALLBACK]: { request: void; response: string | null };+ [MAIN_CHANNELS.WINDOW_IS_FULLSCREEN]: { request: void; response: boolean };+ [MAIN_CHANNELS.FILE_TRANSFER]: {+ request: { selector: string; absolutePath: string };+ response: void;+ };+ [MAIN_CHANNELS.FILE_WRITE_OPEN]: {+ request: { path: string; exclusive?: boolean };+ response: { id: string };+ };+ [MAIN_CHANNELS.FILE_WRITE_CHUNK]: {+ request: { id: string; data: Uint8Array; position: number };+ response: void;+ };+ [MAIN_CHANNELS.FILE_WRITE_CLOSE]: {+ request: { id: string };+ response: void;+ };+ [MAIN_CHANNELS.FILE_WRITE_ABORT]: {+ request: { id: string };+ response: void;+ };+ [MAIN_CHANNELS.HEADLESS_GET_MODE]: { request: void; response: boolean };+};+export type MainRequestChannel = keyof MainRequestMap;++export type MainEventMap = {+ [MAIN_CHANNELS.AUTH_CALLBACK]: { url: string };+ [MAIN_CHANNELS.WINDOW_FULLSCREEN_CHANGE]: { fullscreen: boolean };+ [MAIN_CHANNELS.HEADLESS_MODE]: { active: boolean };+};+export type MainEventChannel = keyof MainEventMap;++export type MainRequest = {+ id: string;+ channel: MainRequestChannel;+ data: unknown;+};++export type MainEvent = {+ channel: MainEventChannel;+ data: unknown;+};++export type MainReply =+ | { id: string; ok: true; data: unknown }+ | { id: string; ok: false; error: string };diff --git a/apps/desktop/src/main-manager.ts b/apps/desktop/src/main-manager.tsnew file mode 100644index 00000000..e034a0fc--- /dev/null+++ b/apps/desktop/src/main-manager.ts@@ -0,0 +1,77 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ipcMain } from "electron";+import type { BrowserWindow, IpcMainEvent } from "electron";+import { MAIN_WIRE } from "./main-channels";+import type {+ MainEvent,+ MainEventChannel,+ MainEventMap,+ MainReply,+ MainRequest,+ MainRequestChannel,+ MainRequestMap,+} from "./main-channels";++type RequestHandler<C extends MainRequestChannel> = (+ data: MainRequestMap[C]["request"],+ event: IpcMainEvent,+) => MainRequestMap[C]["response"] | Promise<MainRequestMap[C]["response"]>;++class MainBridge {+ private requestHandlers = new Map<+ MainRequestChannel,+ RequestHandler<MainRequestChannel>+ >();+ private bound = false;++ private bind(): void {+ if (this.bound) return;+ this.bound = true;++ ipcMain.on(MAIN_WIRE.REQUEST, async (event, raw: MainRequest) => {+ const handler = this.requestHandlers.get(raw.channel);+ let reply: MainReply;+ if (!handler) {+ reply = {+ id: raw.id,+ ok: false,+ error: `No handler for request "${raw.channel}"`,+ };+ } else {+ try {+ const data = await handler(raw.data as never, event);+ reply = { id: raw.id, ok: true, data };+ } catch (err) {+ reply = { id: raw.id, ok: false, error: (err as Error).message };+ }+ }+ if (!event.sender.isDestroyed()) {+ event.sender.send(MAIN_WIRE.RESPONSE, reply);+ }+ });+ }++ handle<C extends MainRequestChannel>(+ channel: C,+ handler: RequestHandler<C>,+ ): void {+ this.bind();+ this.requestHandlers.set(channel, handler as unknown as RequestHandler<MainRequestChannel>);+ }++ emit<C extends MainEventChannel>(+ window: BrowserWindow | null,+ channel: C,+ data: MainEventMap[C],+ ): void {+ if (!window || window.isDestroyed() || window.webContents.isLoading()) return;++ const envelope: MainEvent = { channel, data };+ window.webContents.send(MAIN_WIRE.EVENT, envelope);+ }+}++export const mainBridge = new MainBridge();diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.tsnew file mode 100644index 00000000..ca5ba212--- /dev/null+++ b/apps/desktop/src/main.ts@@ -0,0 +1,203 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { app, BrowserWindow, session, shell } from "electron";+import { join } from "node:path";+import { open, unlink } from "node:fs/promises";+import { randomUUID } from "node:crypto";+import type { FileHandle } from "node:fs/promises";+import { startCliServer, stopCliServer, isHeadless } from "./cli-server";+import { mainBridge } from "./main-manager";+import { MAIN_CHANNELS } from "./main-channels";++const DEV_URL = "http://localhost:5173";+const AUTH_PROTOCOL = "diffusion";++const openWrites = new Map<string, { handle: FileHandle; path: string }>();++let mainWindow: BrowserWindow | null = null;+let pendingAuthUrl: string | null = null;++function findProtocolUrl(argv: string[]): string | null {+ return argv.find((arg) => arg.startsWith(`${AUTH_PROTOCOL}://`)) ?? null;+}++function isHiddenLaunch(argv: string[]): boolean {+ return argv.includes("--hidden");+}++function deliverAuthUrl(url: string) {+ if (!mainWindow || mainWindow.isDestroyed() || mainWindow.webContents.isLoading()) {+ pendingAuthUrl = url;+ return;+ }++ mainBridge.emit(mainWindow, MAIN_CHANNELS.AUTH_CALLBACK, { url });+}++async function setFileInputFiles(selector: string, absolutePath: string) {+ if (!mainWindow) throw new Error("No main window");+ const wc = mainWindow.webContents;+ const wasAttached = wc.debugger.isAttached();+ if (!wasAttached) wc.debugger.attach("1.3");+ try {+ const { root } = await wc.debugger.sendCommand("DOM.getDocument");+ const { nodeId } = await wc.debugger.sendCommand("DOM.querySelector", {+ nodeId: root.nodeId,+ selector,+ });+ if (!nodeId) throw new Error(`Selector not found: ${selector}`);+ await wc.debugger.sendCommand("DOM.setFileInputFiles", {+ files: [absolutePath],+ nodeId,+ });+ } finally {+ if (!wasAttached) {+ try {+ wc.debugger.detach();+ } catch { /** ignore */ }+ }+ }+}++function createWindow(show = true) {+ mainWindow = new BrowserWindow({+ show,+ width: 1200,+ height: 800,+ titleBarStyle: "hiddenInset",+ trafficLightPosition: { x: 14, y: 14 },+ backgroundColor: "#1c1c1c",+ webPreferences: {+ preload: join(app.getAppPath(), "dist", "preload.js"),+ },+ });++ mainWindow.webContents.on("did-finish-load", () => {+ if (pendingAuthUrl) {+ mainBridge.emit(mainWindow, MAIN_CHANNELS.AUTH_CALLBACK, { url: pendingAuthUrl });+ }+ pendingAuthUrl = null;+ });++ mainWindow.on("enter-full-screen", () => {+ mainBridge.emit(mainWindow, MAIN_CHANNELS.WINDOW_FULLSCREEN_CHANGE, { fullscreen: true });+ });+ mainWindow.on("leave-full-screen", () => {+ mainBridge.emit(mainWindow, MAIN_CHANNELS.WINDOW_FULLSCREEN_CHANGE, { fullscreen: false });+ });+ mainWindow.on("closed", () => {+ mainWindow = null;+ });++ if (!app.isPackaged) {+ mainWindow.loadURL(DEV_URL);+ } else {+ mainWindow.loadFile(join(app.getAppPath(), "web", "index.html"));+ }+}++if (process.defaultApp && process.argv.length >= 2) {+ app.setAsDefaultProtocolClient(AUTH_PROTOCOL, process.execPath, [+ join(process.cwd(), process.argv[1]!),+ ]);+} else {+ app.setAsDefaultProtocolClient(AUTH_PROTOCOL);+}++if (app.requestSingleInstanceLock()) {+ app.on("second-instance", (_event, argv) => {+ const url = findProtocolUrl(argv);+ if (url) deliverAuthUrl(url);++ const hidden = isHiddenLaunch(argv);+ if (mainWindow && !mainWindow.isDestroyed()) {+ if (hidden) return;+ if (mainWindow.isMinimized()) mainWindow.restore();+ mainWindow.show();+ mainWindow.focus();+ } else {+ createWindow(!hidden);+ }+ });++ app.on("open-url", (event, url) => {+ event.preventDefault();+ deliverAuthUrl(url);+ });++ mainBridge.handle(MAIN_CHANNELS.APP_OPEN_EXTERNAL, ({ url }) => shell.openExternal(url));+ mainBridge.handle(MAIN_CHANNELS.AUTH_GET_PENDING_CALLBACK, () => {+ const url = pendingAuthUrl;+ pendingAuthUrl = null;+ return url;+ });+ mainBridge.handle(MAIN_CHANNELS.WINDOW_IS_FULLSCREEN, () => mainWindow?.isFullScreen() ?? false);+ mainBridge.handle(MAIN_CHANNELS.HEADLESS_GET_MODE, () => isHeadless());+ mainBridge.handle(MAIN_CHANNELS.FILE_TRANSFER, ({ selector, absolutePath }) =>+ setFileInputFiles(selector, absolutePath),+ );++ mainBridge.handle(MAIN_CHANNELS.FILE_WRITE_OPEN, async ({ path, exclusive }) => {+ const handle = await open(path, exclusive ? "wx" : "w");+ const id = randomUUID();+ openWrites.set(id, { handle, path });+ return { id };+ });++ mainBridge.handle(MAIN_CHANNELS.FILE_WRITE_CHUNK, async ({ id, data, position }) => {+ const entry = openWrites.get(id);+ if (!entry) throw new Error(`No open file for write id ${id}`);+ await entry.handle.write(data, 0, data.byteLength, position);+ });++ mainBridge.handle(MAIN_CHANNELS.FILE_WRITE_CLOSE, async ({ id }) => {+ const entry = openWrites.get(id);+ if (!entry) return;+ openWrites.delete(id);+ await entry.handle.close();+ });++ // Abort: close the fd and delete the partial file (cancel / error cleanup).+ mainBridge.handle(MAIN_CHANNELS.FILE_WRITE_ABORT, async ({ id }) => {+ const entry = openWrites.get(id);+ if (!entry) return;+ openWrites.delete(id);+ try {+ await entry.handle.close();+ } finally {+ await unlink(entry.path).catch(() => {});+ }+ });++ app.whenReady().then(() => {+ session.defaultSession.setPermissionRequestHandler((_wc, _permission, callback) => callback(true));+ session.defaultSession.setPermissionCheckHandler(() => true);+ session.defaultSession.setDevicePermissionHandler(() => true);++ const url = findProtocolUrl(process.argv);+ if (url) pendingAuthUrl = url;++ startCliServer();+ createWindow(!isHiddenLaunch(process.argv));+ });++ app.on("before-quit", () => {+ stopCliServer();+ });++ app.on("window-all-closed", () => {+ if (process.platform !== "darwin") {+ app.quit();+ }+ });++ app.on("activate", () => {+ if (BrowserWindow.getAllWindows().length === 0) {+ createWindow();+ }+ });+} else {+ app.quit();+}diff --git a/apps/desktop/src/preload.ts b/apps/desktop/src/preload.tsnew file mode 100644index 00000000..4b1d4bdd--- /dev/null+++ b/apps/desktop/src/preload.ts@@ -0,0 +1,39 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { contextBridge, ipcRenderer } from "electron";+import type { IpcRendererEvent } from "electron";+import { MAIN_WIRE } from "./main-channels";+import { CLI_WIRE } from "@diffusionstudio/cli/channels";++const ALLOWED_RENDERER_TO_MAIN: ReadonlySet<string> = new Set([+ MAIN_WIRE.REQUEST,+ CLI_WIRE.FORWARD_REPLY,+]);++const ALLOWED_MAIN_TO_RENDERER: ReadonlySet<string> = new Set([+ MAIN_WIRE.RESPONSE,+ MAIN_WIRE.EVENT,+ CLI_WIRE.FORWARD_REQ,+]);++contextBridge.exposeInMainWorld("desktop", {+ platform: process.platform,+ send,+ on,+});++function send(channel: string, payload: unknown): void {+ if (!ALLOWED_RENDERER_TO_MAIN.has(channel)) return;+ ipcRenderer.send(channel, payload);+}++function on(channel: string, cb: (payload: unknown) => void): () => void {+ if (!ALLOWED_MAIN_TO_RENDERER.has(channel)) return () => {};+ const listener = (_event: IpcRendererEvent, payload: unknown) => cb(payload);+ ipcRenderer.on(channel, listener);+ return () => {+ ipcRenderer.removeListener(channel, listener);+ };+}diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.jsonnew file mode 100644index 00000000..ae08c9b5--- /dev/null+++ b/apps/desktop/tsconfig.json@@ -0,0 +1,9 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",+ "lib": ["es2024"],+ "types": ["node"]+ },+ "include": ["src"]+}\ No newline at end of filediff --git a/apps/web/.env.example b/apps/web/.env.examplenew file mode 100644index 00000000..1c7ccd9e--- /dev/null+++ b/apps/web/.env.example@@ -0,0 +1,8 @@+VITE_SUPABASE_URL=https://mpvhvyxuqfcemfnwiaiq.supabase.co+VITE_SUPABASE_ANON_KEY=sb_publishable_V-K9coUWXVy8dsZPGKDw-g_d1JzJf8u++VITE_UMAMI_WEBSITE_ID=e898e381-6ce3-4f5f-a485-8327ec9aa88b+VITE_UMAMI_SCRIPT_URL=https://cloud.umami.is/script.js+VITE_UMAMI_DOMAINS=diffusion.studio,app.diffusion.studio++VITE_API_URL=https://api.diffusion.studiodiff --git a/apps/web/eslint.config.js b/apps/web/eslint.config.jsnew file mode 100644index 00000000..a32e8742--- /dev/null+++ b/apps/web/eslint.config.js@@ -0,0 +1,64 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import js from "@eslint/js";+import tsPlugin from "@typescript-eslint/eslint-plugin";+import tsParser from "@typescript-eslint/parser";+import solidPlugin from "eslint-plugin-solid";+import globals from "globals";++export default [+ js.configs.recommended,+ {+ files: ["**/*.{js,jsx,ts,tsx}"],+ languageOptions: {+ parser: tsParser,+ parserOptions: {+ ecmaVersion: "latest",+ sourceType: "module",+ ecmaFeatures: {+ jsx: true,+ },+ project: "./tsconfig.app.json",+ tsconfigRootDir: import.meta.dirname, // ESM way to get __dirname+ },+ globals: {+ ...globals.browser,+ ...globals.node,+ // Vite `define` (see vite.config.ts); declared in src/vite-env.d.ts+ APP_VERSION: "readonly",+ },+ },+ plugins: {+ "@typescript-eslint": tsPlugin,+ solid: solidPlugin,+ },+ rules: {+ "solid/reactivity": "off",+ // Additional helpful SolidJS rules+ "solid/no-destructure": "warn",+ "solid/jsx-no-undef": "error",+ "solid/jsx-uses-vars": "error",+ // Disable base no-unused-vars in favor of TypeScript version+ "no-unused-vars": "off",+ // Disable no-redeclare to allow TypeScript function overloads+ "no-redeclare": "off",+ // TypeScript rules+ "@typescript-eslint/no-unused-vars": [+ "warn",+ { argsIgnorePattern: "^_" },+ ],+ },+ },+ {+ // Ignore patterns+ ignores: [+ "node_modules/**",+ "dist/**",+ "dist-ssr/**",+ "*.config.js",+ "*.config.ts",+ ],+ },+];diff --git a/apps/web/index.html b/apps/web/index.htmlnew file mode 100644index 00000000..62d42e5a--- /dev/null+++ b/apps/web/index.html@@ -0,0 +1,25 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <link rel="icon" type="image/svg+xml" href="/mark.svg" />+ <link href="/src/index.css" rel="stylesheet">+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Diffusion Studio</title>+ <meta name="description" content="The video editor built on an infinite canvas. Create and edit videos with design-tool freedom and export up to 4K. Multi-track timeline, AI-powered workflows, and full creative control. Built for creators and professionals." />++ <meta property="og:type" content="website" />+ <meta property="og:title" content="Diffusion Studio — The creative platform for video and motion graphics." />+ <meta property="og:description" content="The video editor built on an infinite canvas. Create and edit videos with design-tool freedom and export up to 4K. Multi-track timeline, AI-powered workflows, and full creative control. Built for creators and professionals." />+ <meta property="og:image" content="/og-default.png" />++ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:title" content="Diffusion Studio — The creative platform for video and motion graphics." />+ <meta name="twitter:description" content="The video editor built on an infinite canvas. Create and edit videos with design-tool freedom and export up to 4K. Multi-track timeline, AI-powered workflows, and full creative control. Built for creators and professionals." />+ <meta name="twitter:image" content="/og-default.png" />+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="/src/index.tsx"></script>+ </body>+</html>diff --git a/apps/web/package.json b/apps/web/package.jsonnew file mode 100644index 00000000..4c6a9749--- /dev/null+++ b/apps/web/package.json@@ -0,0 +1,61 @@+{+ "name": "@diffusionstudio/web",+ "private": true,+ "version": "0.0.0",+ "license": "MPL-2.0",+ "type": "module",+ "scripts": {+ "dev": "vite",+ "build": "tsc -b && vite build",+ "build:desktop": "tsc -b && vite build --base=./ --outDir=../desktop/web",+ "preview": "vite preview",+ "check": "tsc -p tsconfig.app.json --noEmit",+ "lint": "eslint ."+ },+ "dependencies": {+ "@diffusionstudio/api-contract": "^0.1.0",+ "@diffusionstudio/cli": "*",+ "@diffusionstudio/jsx": "*",+ "@kobalte/core": "^0.13.11",+ "@sentry/solid": "^10.51.0",+ "@solid-primitives/keyboard": "^1.3.3",+ "@solid-primitives/pointer": "^0.3.3",+ "@solid-primitives/resize-observer": "^2.1.3",+ "@solidjs/router": "^0.15.4",+ "@supabase/supabase-js": "^2.99.2",+ "@tailwindcss/vite": "^4.1.18",+ "@trpc/client": "^11.10.0",+ "animejs": "^4.4.1",+ "bitecs": "^0.4.0",+ "cmdk-solid": "^1.1.2",+ "colord": "^2.9.3",+ "cva": "^1.0.0-beta.4",+ "idb": "^8.0.3",+ "mediabunny": "^1.32.2",+ "solid-js": "^1.9.10",+ "somoto": "^0.0.2",+ "sqids": "^0.3.0",+ "stats.js": "^0.17.0",+ "tailwind-merge": "^3.4.0",+ "tailwindcss": "^4.1.18",+ "tw-animate-css": "^1.4.0",+ "vite-plugin-solid-svg": "^0.8.1",+ "zod": "^4.2.1"+ },+ "devDependencies": {+ "@eslint/js": "^9.39.2",+ "@types/audioworklet": "^0.0.92",+ "@types/chrome": "^0.1.32",+ "@types/node": "^24.10.1",+ "@types/stats.js": "^0.17.4",+ "@types/wicg-file-system-access": "^2023.10.7",+ "@typescript-eslint/eslint-plugin": "^8.51.0",+ "@typescript-eslint/parser": "^8.51.0",+ "eslint": "^9.39.2",+ "eslint-plugin-solid": "^0.14.5",+ "globals": "^17.0.0",+ "typescript": "~5.9.3",+ "vite": "^7.2.4",+ "vite-plugin-solid": "^2.11.10"+ }+}diff --git a/apps/web/public/auth/electron-callback.html b/apps/web/public/auth/electron-callback.htmlnew file mode 100644index 00000000..65fbc614--- /dev/null+++ b/apps/web/public/auth/electron-callback.html@@ -0,0 +1,46 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <meta name="robots" content="noindex" />+ <title>Returning to Diffusion Studio…</title>+ <style>+ :root { color-scheme: dark; }+ body {+ font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;+ background: #0a0a0a;+ color: #fafafa;+ display: grid;+ place-items: center;+ min-height: 100vh;+ margin: 0;+ }+ .card { text-align: center; max-width: 22rem; padding: 2rem; }+ h1 { font-size: 1.125rem; font-weight: 600; margin: 0 0 0.5rem; }+ p { color: #a3a3a3; margin: 0.5rem 0; font-size: 0.875rem; }+ a { color: #5b9dff; text-decoration: none; }+ a:hover { text-decoration: underline; }+ </style>+ </head>+ <body>+ <div class="card">+ <h1>Returning you to Diffusion Studio…</h1>+ <p>You can close this tab.</p>+ <p><small>Nothing happening? <a id="link" href="#">Open the app</a>.</small></p>+ </div>+ <script>+ (function () {+ var params = new URLSearchParams(window.location.search);+ var hash = new URLSearchParams(window.location.hash.replace(/^#/, ""));+ var merged = new URLSearchParams();+ params.forEach(function (v, k) { merged.set(k, v); });+ hash.forEach(function (v, k) { merged.set(k, v); });+ var target = "diffusion://auth/callback?" + merged.toString();+ var link = document.getElementById("link");+ if (link) link.setAttribute("href", target);+ window.location.replace(target);+ })();+ </script>+ </body>+</html>diff --git a/apps/web/public/mark-large.png b/apps/web/public/mark-large.pngnew file mode 100644index 00000000..7f7a6858Binary files /dev/null and b/apps/web/public/mark-large.png differdiff --git a/apps/web/public/mark-macos-small.png b/apps/web/public/mark-macos-small.pngnew file mode 100644index 00000000..da3c9fe4Binary files /dev/null and b/apps/web/public/mark-macos-small.png differdiff --git a/apps/web/public/mark.svg b/apps/web/public/mark.svgnew file mode 100644index 00000000..fb1ca2fc--- /dev/null+++ b/apps/web/public/mark.svg@@ -0,0 +1,4 @@+<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">+<rect width="120" height="120" rx="24" fill="#EC4021"/>+<path d="M49.9226 20.6331C56.1585 17.1223 63.8415 17.1223 70.0774 20.6331L89.9226 31.8061C96.1585 35.3169 100 41.8053 100 48.827V71.1729C100 78.1947 96.1585 84.683 89.9226 88.1939L70.0774 99.3669C63.8415 102.878 56.1585 102.878 49.9226 99.3669L30.0774 88.1939C23.8415 84.683 20 78.1947 20 71.1729V48.827C20 41.8053 23.8415 35.3169 30.0774 31.8061L49.9226 20.6331ZM65.1437 33.151C62.0257 31.3956 58.1842 31.3956 55.0663 33.151L38.6891 42.3715C35.5711 44.1269 33.6504 47.3711 33.6504 50.8819V69.3228C33.6504 72.8336 35.5711 76.0778 38.6891 77.8333L55.0663 87.0537C58.1842 88.8091 62.0257 88.8091 65.1437 87.0537L81.5209 77.8333C84.6388 76.0778 86.5596 72.8336 86.5596 69.3228V50.8819C86.5596 47.3711 84.6388 44.1269 81.5209 42.3715L65.1437 33.151Z" fill="white"/>+</svg>diff --git a/apps/web/public/og-default.png b/apps/web/public/og-default.pngnew file mode 100644index 00000000..83864e41Binary files /dev/null and b/apps/web/public/og-default.png differdiff --git a/apps/web/public/permission-dialog-header.png b/apps/web/public/permission-dialog-header.pngnew file mode 100644index 00000000..745ff595Binary files /dev/null and b/apps/web/public/permission-dialog-header.png differdiff --git a/apps/web/public/vite.svg b/apps/web/public/vite.svgnew file mode 100644index 00000000..e7b8dfb1--- /dev/null+++ b/apps/web/public/vite.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>\ No newline at end of filediff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsxnew file mode 100644index 00000000..d2c2d51e--- /dev/null+++ b/apps/web/src/app.tsx@@ -0,0 +1,64 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Router, HashRouter, Route } from '@solidjs/router';+import { ColorModeProvider } from '@kobalte/core';+import { Show, type JSX } from 'solid-js';+import { Toaster } from "@/components/ui/sonner";+import { AppContextMenu } from "@/components/app-context-menu";++import { AuthProvider, useAuth } from '@/context/auth';+import { PersistRoute } from '@/lib/persist-route';+import { UpgradeDialog } from '@/components/upgrade-dialog';+import { PurchaseSuccess } from '@/components/purchase-success';+import { ScreenTooSmall } from '@/components/screen-too-small';+import { UnsupportedBrowser } from '@/components/unsupported-browser';+import { HomePage } from './pages/home';+import { LoginPage } from './pages/login';+import { AuthCallbackPage } from './pages/auth-callback';+import { NotFoundPage } from './pages/not-found';++function AuthGate(props: { children: JSX.Element }) {+ const auth = useAuth();++ return (+ <Show when={!auth.isLoading()}>+ <Show when={auth.isAuthenticated() || auth.headless()}>+ {props.children}+ </Show>+ <Show when={!auth.isAuthenticated()}>+ <LoginPage />+ </Show>+ </Show>+ );+}++function App() {+ const RouterComponent = window.desktop ? HashRouter : Router;+ return (+ <RouterComponent+ root={(props) => (+ <ColorModeProvider initialColorMode="dark">+ <AppContextMenu>+ <AuthProvider>+ {props.children}+ <UpgradeDialog />+ <PurchaseSuccess />+ </AuthProvider>+ </AppContextMenu>+ <Toaster />+ <ScreenTooSmall />+ <UnsupportedBrowser />+ <PersistRoute />+ </ColorModeProvider>+ )}+ >+ <Route path="/auth/callback" component={AuthCallbackPage} />+ <Route path="/" component={() => <AuthGate><HomePage /></AuthGate>} />+ <Route path="*404" component={NotFoundPage} />+ </RouterComponent>+ );+}++export default App;diff --git a/apps/web/src/assets/fonts/Inter-Italic-VariableFont_opsz,wght.ttf b/apps/web/src/assets/fonts/Inter-Italic-VariableFont_opsz,wght.ttfnew file mode 100644index 00000000..43ed4f5eBinary files /dev/null and b/apps/web/src/assets/fonts/Inter-Italic-VariableFont_opsz,wght.ttf differdiff --git a/apps/web/src/assets/fonts/Inter-VariableFont_opsz,wght.ttf b/apps/web/src/assets/fonts/Inter-VariableFont_opsz,wght.ttfnew file mode 100644index 00000000..e31b51e3Binary files /dev/null and b/apps/web/src/assets/fonts/Inter-VariableFont_opsz,wght.ttf differdiff --git a/apps/web/src/assets/fonts/JetBrainsMono-VariableFont.ttf b/apps/web/src/assets/fonts/JetBrainsMono-VariableFont.ttfnew file mode 100644index 00000000..b60e77f5Binary files /dev/null and b/apps/web/src/assets/fonts/JetBrainsMono-VariableFont.ttf differdiff --git a/apps/web/src/assets/icons/action-bar-spotlight-small.svg b/apps/web/src/assets/icons/action-bar-spotlight-small.svgnew file mode 100644index 00000000..83afc7a7--- /dev/null+++ b/apps/web/src/assets/icons/action-bar-spotlight-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.59091 5.75C7.02192 5.75 5.75 7.02192 5.75 8.59091C5.75 10.1599 7.02192 11.4318 8.59091 11.4318C10.1599 11.4318 11.4318 10.1599 11.4318 8.59091C11.4318 7.02192 10.1599 5.75 8.59091 5.75ZM6.88636 8.59091C6.88636 7.64951 7.64951 6.88636 8.59091 6.88636C9.53231 6.88636 10.2955 7.64951 10.2955 8.59091C10.2955 9.53231 9.53231 10.2955 8.59091 10.2955C7.64951 10.2955 6.88636 9.53231 6.88636 8.59091ZM15.4091 5.75C13.8401 5.75 12.5682 7.02192 12.5682 8.59091C12.5682 10.1599 13.8401 11.4318 15.4091 11.4318C16.9781 11.4318 18.25 10.1599 18.25 8.59091C18.25 7.02192 16.9781 5.75 15.4091 5.75ZM13.7045 8.59091C13.7045 7.64951 14.4677 6.88636 15.4091 6.88636C16.3505 6.88636 17.1136 7.64951 17.1136 8.59091C17.1136 9.53231 16.3505 10.2955 15.4091 10.2955C14.4677 10.2955 13.7045 9.53231 13.7045 8.59091ZM5.75 15.4091C5.75 13.8401 7.02192 12.5682 8.59091 12.5682C10.1599 12.5682 11.4318 13.8401 11.4318 15.4091C11.4318 16.9781 10.1599 18.25 8.59091 18.25C7.02192 18.25 5.75 16.9781 5.75 15.4091ZM8.59091 13.7045C7.64951 13.7045 6.88636 14.4677 6.88636 15.4091C6.88636 16.3505 7.64951 17.1136 8.59091 17.1136C9.53231 17.1136 10.2955 16.3505 10.2955 15.4091C10.2955 14.4677 9.53231 13.7045 8.59091 13.7045ZM15.4091 12.5682C13.8401 12.5682 12.5682 13.8401 12.5682 15.4091C12.5682 16.9781 13.8401 18.25 15.4091 18.25C16.9781 18.25 18.25 16.9781 18.25 15.4091C18.25 13.8401 16.9781 12.5682 15.4091 12.5682ZM13.7045 15.4091C13.7045 14.4677 14.4677 13.7045 15.4091 13.7045C16.3505 13.7045 17.1136 14.4677 17.1136 15.4091C17.1136 16.3505 16.3505 17.1136 15.4091 17.1136C14.4677 17.1136 13.7045 16.3505 13.7045 15.4091Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/action-bar-spotlight.svg b/apps/web/src/assets/icons/action-bar-spotlight.svgnew file mode 100644index 00000000..b40a348a--- /dev/null+++ b/apps/web/src/assets/icons/action-bar-spotlight.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.3069 5.57328C17.3069 5.3671 17.1397 5.19995 16.9335 5.19995C16.7274 5.19995 16.5602 5.3671 16.5602 5.57328V6.13329H16.0002C15.794 6.13329 15.6269 6.30043 15.6269 6.50662C15.6269 6.7128 15.794 6.87996 16.0002 6.87996H16.5602V7.43996C16.5602 7.64614 16.7274 7.81329 16.9335 7.81329C17.1397 7.81329 17.3069 7.64614 17.3069 7.43996V6.87996H17.8669C18.073 6.87996 18.2402 6.7128 18.2402 6.50662C18.2402 6.30043 18.073 6.13329 17.8669 6.13329H17.3069V5.57328ZM15.3969 8.0433C15.5791 8.22554 15.5791 8.52102 15.3969 8.70327L14.4636 9.6366C14.2813 9.81884 13.9858 9.81884 13.8036 9.6366C13.6213 9.45436 13.6213 9.15888 13.8036 8.97663L14.7368 8.04331C14.9191 7.86106 15.2146 7.86106 15.3969 8.0433ZM13.5302 9.90997C13.7124 10.0922 13.7124 10.3877 13.5302 10.5699L6.99684 17.1032C6.8146 17.2855 6.51913 17.2855 6.33688 17.1032C6.15463 16.9211 6.15463 16.6256 6.33688 16.4433L12.8702 9.90997C13.0525 9.72772 13.348 9.72772 13.5302 9.90997ZM16.9335 9.86662C17.1397 9.86662 17.3069 10.0338 17.3069 10.24V10.8H17.8669C18.073 10.8 18.2402 10.9671 18.2402 11.1733C18.2402 11.3795 18.073 11.5466 17.8669 11.5466H17.3069V12.1066C17.3069 12.3128 17.1397 12.48 16.9335 12.48C16.7274 12.48 16.5602 12.3128 16.5602 12.1066V11.5466H16.0002C15.794 11.5466 15.6269 11.3795 15.6269 11.1733C15.6269 10.9671 15.794 10.8 16.0002 10.8H16.5602V10.24C16.5602 10.0338 16.7274 9.86662 16.9335 9.86662ZM12.6402 5.57328C12.6402 5.3671 12.4731 5.19995 12.2669 5.19995C12.0607 5.19995 11.8935 5.3671 11.8935 5.57328V6.13329H11.3335C11.1274 6.13329 10.9602 6.30043 10.9602 6.50662C10.9602 6.7128 11.1274 6.87996 11.3335 6.87996H11.8935V7.43996C11.8935 7.64614 12.0607 7.81329 12.2669 7.81329C12.4731 7.81329 12.6402 7.64614 12.6402 7.43996V6.87996H13.2002C13.4064 6.87996 13.5735 6.7128 13.5735 6.50662C13.5735 6.30043 13.4064 6.13329 13.2002 6.13329H12.6402V5.57328Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/add-marker.svg b/apps/web/src/assets/icons/add-marker.svgnew file mode 100644index 00000000..1105f7bf--- /dev/null+++ b/apps/web/src/assets/icons/add-marker.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.0444 11.6108V8.70752C16.0444 8.21512 15.6452 7.81592 15.1528 7.81592H8.84521C8.35284 7.81598 7.95368 8.21515 7.95361 8.70752V11.6167C7.95361 11.8254 8.02666 12.0281 8.15967 12.188L11.314 15.978C11.6709 16.4068 12.3289 16.4066 12.6851 15.978L15.8384 12.1812C15.9715 12.0209 16.0444 11.8187 16.0444 11.6108ZM16.9653 11.6108C16.9653 12.0339 16.8165 12.4439 16.5464 12.769L13.3921 16.5659C12.6677 17.4376 11.3304 17.4367 10.606 16.5659L7.45264 12.7759C7.18173 12.4502 7.03369 12.0396 7.03369 11.6167V8.70752C7.03375 7.70705 7.84474 6.89606 8.84521 6.896H15.1528C16.1533 6.896 16.9653 7.707 16.9653 8.70752V11.6108Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/adjustment-layer.svg b/apps/web/src/assets/icons/adjustment-layer.svgnew file mode 100644index 00000000..bec87c4f--- /dev/null+++ b/apps/web/src/assets/icons/adjustment-layer.svg@@ -0,0 +1,18 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<mask id="mask0_6512_20130" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="7" y="7" width="10" height="10">+<rect x="7" y="7" width="10" height="10" fill="currentColor"/>+</mask>+<g mask="url(#mask0_6512_20130)">+<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M18.3021 7.51951C13.3663 8.86561 8.86513 13.3668 7.51902 18.3026L6.89307 18.1318C8.29963 12.9745 12.974 8.30012 18.1313 6.89355L18.3021 7.51951Z" fill="currentColor"/>+<path opacity="0.25" fill-rule="evenodd" clip-rule="evenodd" d="M17.9373 6.96847C12.9463 8.36776 8.36727 12.9468 6.96799 17.9378L6.34326 17.7627C7.80369 12.5536 12.5531 7.80418 17.7623 6.34375L17.9373 6.96847Z" fill="currentColor"/>+<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M17.4694 6.44718C12.5006 7.92183 7.92892 12.4911 6.44997 17.4593L5.82812 17.2743C7.3696 12.0959 12.1057 7.36226 17.2847 5.8252L17.4694 6.44718Z" fill="currentColor"/>+<path opacity="0.35" fill-rule="evenodd" clip-rule="evenodd" d="M16.8548 5.97539C12.0074 7.55193 7.55399 12.0044 5.97583 16.8516L5.35889 16.6508C7.00128 11.6063 11.6094 6.99912 16.6541 5.3584L16.8548 5.97539Z" fill="currentColor"/>+<path opacity="0.4" fill-rule="evenodd" clip-rule="evenodd" d="M16.1712 5.53649C11.5009 7.21148 7.22263 11.4862 5.54162 16.1557L4.93115 15.936C6.67772 11.0844 11.0994 6.66618 15.9522 4.92578L16.1712 5.53649Z" fill="currentColor"/>+<path opacity="0.45" fill-rule="evenodd" clip-rule="evenodd" d="M15.3697 5.15694C10.9549 6.92615 6.93187 10.9475 5.15972 15.3618L4.55762 15.1201C6.39573 10.5415 10.5491 6.38982 15.1283 4.55469L15.3697 5.15694Z" fill="currentColor"/>+<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M14.4678 4.8427C10.3857 6.67852 6.68702 10.3748 4.84737 14.4563L4.25586 14.1897C6.16062 9.96381 9.97495 6.15183 14.2017 4.25098L14.4678 4.8427Z" fill="currentColor"/>+<path opacity="0.6" fill-rule="evenodd" clip-rule="evenodd" d="M13.4295 4.62427C9.77812 6.48028 6.48829 9.76834 4.62945 13.419L4.05127 13.1246C5.97238 9.35165 9.3617 5.96413 13.1355 4.0459L13.4295 4.62427Z" fill="currentColor"/>+<path opacity="0.7" fill-rule="evenodd" clip-rule="evenodd" d="M12.2033 4.55519C9.12119 6.34523 6.35302 9.11197 4.56084 12.1934L4 11.8672C5.84878 8.68844 8.69792 5.84075 11.8774 3.99414L12.2033 4.55519Z" fill="currentColor"/>+<path opacity="0.8" fill-rule="evenodd" clip-rule="evenodd" d="M10.7007 4.73387C8.3852 6.29848 6.29628 8.38762 4.73196 10.7032L4.19434 10.3401C5.80509 7.95567 7.95321 5.80735 10.3374 4.19629L10.7007 4.73387Z" fill="currentColor"/>+</g>+<path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 6.50049C17.0523 6.50049 17.5 6.9482 17.5 7.50049V16.5005C17.4997 17.0525 17.0521 17.5005 16.5 17.5005H7.5C6.94788 17.5005 6.50026 17.0525 6.5 16.5005L6.5 7.50049C6.5 6.9482 6.94772 6.50049 7.5 6.50049L16.5 6.50049ZM7.5 16.5005H16.5V7.50049L7.5 7.50049L7.5 16.5005Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/ai-generate.svg b/apps/web/src/assets/icons/ai-generate.svgnew file mode 100644index 00000000..ea24b708--- /dev/null+++ b/apps/web/src/assets/icons/ai-generate.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.2998 15.1279C8.1673 15.1279 8.87081 15.8318 8.87109 16.6992C8.87109 17.5669 8.16747 18.2705 7.2998 18.2705C6.43219 18.2704 5.72852 17.5668 5.72852 16.6992C5.7288 15.8318 6.43237 15.128 7.2998 15.1279ZM12 6.02832C12.2383 6.02832 12.469 6.11239 12.6523 6.26465C12.8353 6.41668 12.96 6.62752 13.0039 6.86133L13.5811 9.91797H13.582C13.6055 10.042 13.6656 10.1559 13.7549 10.2451C13.8441 10.3344 13.958 10.3945 14.082 10.418V10.4189L17.1387 10.9961H17.1377C17.3719 11.0398 17.5831 11.1644 17.7354 11.3477C17.8876 11.531 17.9717 11.7617 17.9717 12C17.9717 12.2383 17.8876 12.469 17.7354 12.6523C17.5832 12.8355 17.3718 12.9591 17.1377 13.0029L14.082 13.5811V13.582C13.958 13.6055 13.8441 13.6656 13.7549 13.7549C13.6656 13.8441 13.6055 13.958 13.582 14.082H13.5811L13.0039 17.1387C12.96 17.3725 12.8353 17.5833 12.6523 17.7354C12.469 17.8876 12.2383 17.9717 12 17.9717C11.7617 17.9717 11.531 17.8876 11.3477 17.7354C11.1647 17.5833 11.04 17.3725 10.9961 17.1387L10.4189 14.082H10.418C10.3945 13.958 10.3344 13.8441 10.2451 13.7549C10.1559 13.6656 10.042 13.6055 9.91797 13.582V13.5811L6.86133 13.0039V13.0029C6.62759 12.959 6.41664 12.8353 6.26465 12.6523C6.11239 12.469 6.02832 12.2383 6.02832 12C6.02832 11.7617 6.11239 11.531 6.26465 11.3477C6.41668 11.1647 6.62752 11.04 6.86133 10.9961L9.91797 10.4189V10.418C10.042 10.3945 10.1559 10.3344 10.2451 10.2451C10.3344 10.1559 10.3945 10.042 10.418 9.91797H10.4189L10.9961 6.86133C11.04 6.62752 11.1647 6.41668 11.3477 6.26465C11.531 6.11239 11.7617 6.02832 12 6.02832ZM7.2998 16.0713C6.95297 16.0714 6.67215 16.3524 6.67188 16.6992C6.67188 17.0462 6.9528 17.3281 7.2998 17.3281C7.64687 17.3281 7.92871 17.0463 7.92871 16.6992C7.92843 16.3524 7.6467 16.0713 7.2998 16.0713ZM12 6.97168C11.9818 6.97168 11.9642 6.97771 11.9502 6.98926C11.9362 7.00091 11.9263 7.01725 11.9229 7.03516V7.03613L11.3447 10.0928C11.2861 10.4031 11.1354 10.6888 10.9121 10.9121C10.6888 11.1354 10.4031 11.2861 10.0928 11.3447L7.03613 11.9229H7.03516C7.01725 11.9263 7.00091 11.9362 6.98926 11.9502C6.97771 11.9642 6.97168 11.9818 6.97168 12C6.97168 12.0182 6.97771 12.0358 6.98926 12.0498C7.00091 12.0638 7.01725 12.0737 7.03516 12.0771H7.03613L10.0928 12.6553C10.4031 12.7139 10.6888 12.8646 10.9121 13.0879C11.1354 13.3112 11.2861 13.5969 11.3447 13.9072L11.9229 16.9639V16.9648C11.9263 16.9827 11.9362 16.9991 11.9502 17.0107C11.9642 17.0223 11.9818 17.0283 12 17.0283C12.0182 17.0283 12.0358 17.0223 12.0498 17.0107C12.0638 16.9991 12.0737 16.9827 12.0771 16.9648V16.9639L12.6553 13.9072C12.7139 13.5969 12.8646 13.3112 13.0879 13.0879C13.3112 12.8646 13.5969 12.7139 13.9072 12.6553L16.9639 12.0771H16.9648C16.9827 12.0737 16.9991 12.0638 17.0107 12.0498C17.0223 12.0358 17.0283 12.0182 17.0283 12C17.0283 11.9818 17.0223 11.9642 17.0107 11.9502C16.9991 11.9362 16.9827 11.9263 16.9648 11.9229H16.9639L13.9072 11.3447C13.5969 11.2861 13.3112 11.1354 13.0879 10.9121C12.8646 10.6888 12.7139 10.4031 12.6553 10.0928L12.0771 7.03613V7.03516C12.0737 7.01725 12.0638 7.00091 12.0498 6.98926C12.0358 6.97771 12.0182 6.97168 12 6.97168ZM16.8496 5.73047C17.1099 5.73047 17.3213 5.94282 17.3213 6.20312V6.97852H18.1025C18.3625 6.97878 18.5741 7.19019 18.5742 7.4502C18.574 7.71012 18.3625 7.92161 18.1025 7.92188H17.3213V8.70312C17.3208 8.96299 17.1096 9.1748 16.8496 9.1748C16.5898 9.17459 16.3784 8.96286 16.3779 8.70312V7.92188H15.6025C15.3424 7.92188 15.1301 7.71028 15.1299 7.4502C15.13 7.19003 15.3423 6.97852 15.6025 6.97852H16.3779V6.20312C16.3779 5.94295 16.5895 5.73068 16.8496 5.73047Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/alert-warning.svg b/apps/web/src/assets/icons/alert-warning.svgnew file mode 100644index 00000000..24419ce1--- /dev/null+++ b/apps/web/src/assets/icons/alert-warning.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.0007 17.9998C8.68737 17.9998 6.00098 15.3134 6.00098 11.9995C6.00098 8.68615 8.68738 5.99976 12.0007 5.99976C15.3146 5.99976 18.001 8.68615 18.001 11.9995C18.001 15.3134 15.3146 17.9998 12.0007 17.9998ZM12.0007 17.0999C12.6751 17.1072 13.3443 16.9807 13.9695 16.7277C14.5946 16.4746 15.1634 16.1001 15.6429 15.6258C16.1224 15.1515 16.5031 14.5868 16.7629 13.9644C17.0227 13.342 17.1564 12.6742 17.1564 11.9998C17.1564 11.3253 17.0227 10.6575 16.7629 10.0351C16.5031 9.41272 16.1224 8.84802 15.6429 8.3737C15.1634 7.89938 14.5946 7.52487 13.9695 7.27185C13.3443 7.01882 12.6751 6.89231 12.0007 6.89962C10.6576 6.91419 9.37451 7.45793 8.42994 8.41281C7.48536 9.36769 6.95556 10.6566 6.95556 11.9998C6.95556 13.3429 7.48536 14.6318 8.42994 15.5867C9.37451 16.5416 10.6576 17.0853 12.0007 17.0999ZM12.0019 12.8999C11.8825 12.8999 11.7681 12.8525 11.6837 12.7681C11.5993 12.6838 11.5519 12.5693 11.5519 12.45L11.5519 9.45044C11.5519 9.33111 11.5993 9.21667 11.6837 9.13229C11.7681 9.04791 11.8825 9.0005 12.0019 9.0005C12.1212 9.0005 12.2356 9.04791 12.32 9.13229C12.4044 9.21667 12.4518 9.33111 12.4518 9.45044L12.4518 12.45C12.4518 12.5693 12.4044 12.6838 12.32 12.7681C12.2356 12.8525 12.1212 12.8999 12.0019 12.8999ZM12.0019 13.7998C11.8428 13.7998 11.6902 13.863 11.5777 13.9755C11.4652 14.088 11.402 14.2406 11.402 14.3997C11.402 14.5588 11.4652 14.7114 11.5777 14.8239C11.6902 14.9364 11.8428 14.9996 12.0019 14.9996C12.161 14.9996 12.3136 14.9364 12.4261 14.8239C12.5386 14.7114 12.6018 14.5588 12.6018 14.3997C12.6018 14.2406 12.5386 14.088 12.4261 13.9755C12.3136 13.863 12.161 13.7998 12.0019 13.7998Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/all-media-types.svg b/apps/web/src/assets/icons/all-media-types.svgnew file mode 100644index 00000000..a6f1627c--- /dev/null+++ b/apps/web/src/assets/icons/all-media-types.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.333 6.83468C12.333 6.75441 12.3136 6.67532 12.2766 6.60411C12.2395 6.5329 12.1859 6.47166 12.1201 6.42556C12.0544 6.37946 11.9786 6.34986 11.899 6.33927C11.8194 6.32867 11.7385 6.33738 11.663 6.36468L7.10301 8.01468C6.87753 8.0962 6.68264 8.24521 6.54486 8.44144C6.40708 8.63767 6.33311 8.87158 6.33301 9.11134V13.166C6.33304 13.2463 6.3524 13.3254 6.38945 13.3966C6.4265 13.4678 6.48015 13.529 6.54587 13.5751C6.61158 13.6212 6.68743 13.6508 6.767 13.6614C6.84657 13.672 6.92752 13.6633 7.00301 13.636L7.33301 13.5167V14.58C7.10683 14.66 6.86477 14.6845 6.62715 14.6516C6.38952 14.6187 6.16326 14.5292 5.96734 14.3908C5.77143 14.2523 5.61157 14.0689 5.5012 13.8559C5.39083 13.6429 5.33315 13.4066 5.33301 13.1667V9.11068C5.33301 8.66536 5.47023 8.23087 5.72598 7.86632C5.98174 7.50177 6.34361 7.22489 6.76234 7.07334L11.3223 5.42334C11.549 5.34129 11.792 5.31506 12.0309 5.34685C12.2698 5.37865 12.4975 5.46754 12.6948 5.606C12.892 5.74447 13.053 5.92842 13.1641 6.1423C13.2752 6.35617 13.3332 6.59367 13.333 6.83468V6.95268L12.333 7.31468V6.83468ZM14.9997 8.83468C14.9996 8.75441 14.9803 8.67532 14.9432 8.60411C14.9062 8.5329 14.8525 8.47166 14.7868 8.42556C14.7211 8.37946 14.6453 8.34986 14.5657 8.33927C14.4861 8.32867 14.4052 8.33738 14.3297 8.36468L9.54967 10.0933C9.38851 10.1516 9.24923 10.2582 9.15081 10.3984C9.05238 10.5387 8.99961 10.706 8.99967 10.8773V15.1653C8.99971 15.2456 9.01907 15.3247 9.05612 15.3959C9.09317 15.4671 9.14682 15.5284 9.21253 15.5745C9.27825 15.6206 9.3541 15.6502 9.43367 15.6608C9.51323 15.6714 9.59419 15.6626 9.66967 15.6353L9.99967 15.5167V16.5807C9.77339 16.6607 9.53122 16.6852 9.29348 16.6522C9.05575 16.6192 8.82941 16.5297 8.63346 16.3911C8.43752 16.2525 8.27769 16.0689 8.16741 15.8557C8.05712 15.6425 7.9996 15.406 7.99967 15.166V10.878C7.99951 10.5011 8.11553 10.1333 8.33193 9.82466C8.54833 9.51605 8.85459 9.28163 9.20901 9.15334L13.989 7.42334C14.2156 7.34129 14.4587 7.31506 14.6976 7.34685C14.9365 7.37865 15.1642 7.46754 15.3615 7.606C15.5587 7.74447 15.7197 7.92842 15.8308 8.1423C15.9419 8.35617 15.9998 8.59367 15.9997 8.83468V8.95268L14.9997 9.31468V8.83468ZM16.9963 10.3647C17.0718 10.3374 17.1528 10.3287 17.2324 10.3393C17.3119 10.3499 17.3878 10.3795 17.4535 10.4256C17.5192 10.4717 17.5728 10.5329 17.6099 10.6041C17.6469 10.6753 17.6663 10.7544 17.6663 10.8347V15.3567C17.6663 15.4594 17.6346 15.5597 17.5755 15.6438C17.5165 15.7279 17.433 15.7917 17.3363 15.8267L12.3363 17.636C12.2609 17.6633 12.1799 17.672 12.1003 17.6614C12.0208 17.6508 11.9449 17.6212 11.8792 17.5751C11.8135 17.529 11.7598 17.4678 11.7228 17.3966C11.6857 17.3254 11.6664 17.2463 11.6663 17.166V12.644C11.6664 12.5413 11.6981 12.441 11.7571 12.3569C11.8162 12.2728 11.8997 12.2089 11.9963 12.174L16.9963 10.3647ZM18.6663 10.8347C18.6664 10.5937 18.6084 10.3563 18.4972 10.1425C18.3861 9.92873 18.2251 9.74487 18.0278 9.60648C17.8306 9.46809 17.6029 9.37926 17.3641 9.3475C17.1252 9.31573 16.8822 9.34198 16.6557 9.42401L11.6557 11.2333C11.3658 11.3383 11.1153 11.53 10.9383 11.7825C10.7612 12.0349 10.6663 12.3357 10.6663 12.644V17.166C10.6663 17.407 10.7243 17.6444 10.8354 17.8582C10.9466 18.072 11.1076 18.2558 11.3048 18.3942C11.5021 18.5326 11.7298 18.6214 11.9686 18.6532C12.2075 18.685 12.4504 18.6587 12.677 18.5767L17.677 16.7673C17.9669 16.6624 18.2174 16.4706 18.3944 16.2182C18.5715 15.9658 18.6664 15.665 18.6663 15.3567V10.8347Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-bottom-center.svg b/apps/web/src/assets/icons/anchor-align-bottom-center.svgnew file mode 100644index 00000000..d50d594d--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-bottom-center.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.83 7.88C14.476 7.88015 14.9999 8.40392 14.9999 9.05V11.1199L18.6249 11.1199C19.108 11.1199 19.4996 11.5119 19.4999 11.9949C19.4997 12.478 19.108 12.8699 18.6249 12.8699L14.9999 12.8699V14.95C14.9999 15.5961 14.476 16.1199 13.83 16.12H10.1708C9.52461 16.12 8.99989 15.5962 8.99988 14.95V12.8699H5.37488C4.89187 12.8698 4.50007 12.4779 4.49988 11.9949C4.50014 11.512 4.89191 11.1201 5.37488 11.1199H8.99988V9.05C8.99988 8.40383 9.5246 7.88 10.1708 7.88H13.83Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-bottom-left.svg b/apps/web/src/assets/icons/anchor-align-bottom-left.svgnew file mode 100644index 00000000..6cfbdd3b--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-bottom-left.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 3.125C12.4832 3.125 12.875 3.51675 12.875 4V8.49023H14.3398C14.986 8.49023 15.5098 9.01398 15.5098 9.66016V11.125H20C20.4832 11.125 20.875 11.5168 20.875 12C20.875 12.4832 20.4832 12.875 20 12.875H15.5098V14.3398C15.5098 14.986 14.986 15.5098 14.3398 15.5098H9.66016C9.01398 15.5098 8.49023 14.986 8.49023 14.3398V9.66016C8.49023 9.01398 9.01398 8.49023 9.66016 8.49023H11.125V4C11.125 3.51675 11.5168 3.125 12 3.125Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-bottom-right.svg b/apps/web/src/assets/icons/anchor-align-bottom-right.svgnew file mode 100644index 00000000..4c1b994f--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-bottom-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 3.125C11.5168 3.125 11.125 3.51675 11.125 4V8.49023H9.66016C9.01398 8.49023 8.49023 9.01398 8.49023 9.66016V11.125H4C3.51675 11.125 3.125 11.5168 3.125 12C3.125 12.4832 3.51675 12.875 4 12.875H8.49023V14.3398C8.49023 14.986 9.01398 15.5098 9.66016 15.5098H14.3398C14.986 15.5098 15.5098 14.986 15.5098 14.3398V9.66016C15.5098 9.01398 14.986 8.49023 14.3398 8.49023H12.875V4C12.875 3.51675 12.4832 3.125 12 3.125Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-center.svg b/apps/web/src/assets/icons/anchor-align-center.svgnew file mode 100644index 00000000..3971aae6--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-center.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 4.5C12.4832 4.5 12.875 4.89175 12.875 5.375V8.22559C14.3122 8.55743 15.4426 9.68776 15.7744 11.125H18.625C19.1082 11.125 19.5 11.5168 19.5 12C19.5 12.4832 19.1082 12.875 18.625 12.875H15.7744C15.4426 14.3122 14.3122 15.4426 12.875 15.7744V18.625C12.875 19.1082 12.4832 19.5 12 19.5C11.5168 19.5 11.125 19.1082 11.125 18.625V15.7744C9.68776 15.4426 8.55743 14.3122 8.22559 12.875H5.375C4.89175 12.875 4.5 12.4832 4.5 12C4.5 11.5168 4.89175 11.125 5.375 11.125H8.22559C8.55743 9.68776 9.68776 8.55743 11.125 8.22559V5.375C11.125 4.89175 11.5168 4.5 12 4.5ZM12 9.875C10.8264 9.875 9.875 10.8264 9.875 12C9.875 13.1736 10.8264 14.125 12 14.125C13.1736 14.125 14.125 13.1736 14.125 12C14.125 10.8264 13.1736 9.875 12 9.875Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-left.svg b/apps/web/src/assets/icons/anchor-align-left.svgnew file mode 100644index 00000000..855dcd22--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-left.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 4.5C12.4832 4.5 12.875 4.89175 12.875 5.375V9H14.9499C15.5958 9.00015 16.1197 9.52402 16.1199 10.1699V13.8301C16.1197 14.476 15.5958 14.9999 14.9499 15H12.875V18.625C12.875 19.1082 12.4832 19.5 12 19.5C11.5167 19.5 11.125 19.1082 11.125 18.625V15H9.05C8.40408 14.9999 7.8901 14.476 7.88989 13.8301V10.1699C7.8901 9.52402 8.40408 9.00015 9.05 9H11.125V5.375C11.125 4.89175 11.5167 4.5 12 4.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-right.svg b/apps/web/src/assets/icons/anchor-align-right.svgnew file mode 100644index 00000000..32220dee--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 4.5C12.4832 4.5 12.875 4.89175 12.875 5.375V9H14.9499C15.5958 9.00015 16.1197 9.52402 16.1199 10.1699V13.8301C16.1197 14.476 15.5958 14.9999 14.9499 15H12.875V18.625C12.875 19.1082 12.4832 19.5 12 19.5C11.5167 19.5 11.125 19.1082 11.125 18.625V15H9.04989C8.40398 14.9999 7.8901 14.476 7.88989 13.8301V10.1699C7.8901 9.52402 8.40398 9.00015 9.04989 9H11.125V5.375C11.125 4.89175 11.5167 4.5 12 4.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-top-center.svg b/apps/web/src/assets/icons/anchor-align-top-center.svgnew file mode 100644index 00000000..01ba677c--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-top-center.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.83 7.88C14.476 7.88015 14.9999 8.40392 14.9999 9.05V11.1199L18.6249 11.1199C19.108 11.1199 19.4996 11.5119 19.4999 11.9949C19.4997 12.478 19.108 12.8699 18.6249 12.8699H14.9999V14.95C14.9999 15.5961 14.476 16.1199 13.83 16.12H10.1708C9.52461 16.12 8.99989 15.5962 8.99988 14.95V12.8699H5.37488C4.89187 12.8698 4.50007 12.4779 4.49988 11.9949C4.50014 11.512 4.89191 11.1201 5.37488 11.1199H8.99988V9.05C8.99988 8.40383 9.5246 7.88 10.1708 7.88H13.83Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-top-left.svg b/apps/web/src/assets/icons/anchor-align-top-left.svgnew file mode 100644index 00000000..3c9c8b91--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-top-left.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 20.875C12.4832 20.875 12.875 20.4832 12.875 20V15.5098H14.3398C14.986 15.5098 15.5098 14.986 15.5098 14.3398V12.875H20C20.4832 12.875 20.875 12.4832 20.875 12C20.875 11.5168 20.4832 11.125 20 11.125H15.5098V9.66016C15.5098 9.01398 14.986 8.49023 14.3398 8.49023H9.66016C9.01398 8.49023 8.49023 9.01398 8.49023 9.66016V14.3398C8.49023 14.986 9.01398 15.5098 9.66016 15.5098H11.125V20C11.125 20.4832 11.5168 20.875 12 20.875Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/anchor-align-top-right.svg b/apps/web/src/assets/icons/anchor-align-top-right.svgnew file mode 100644index 00000000..4577a5ba--- /dev/null+++ b/apps/web/src/assets/icons/anchor-align-top-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 20.875C11.5168 20.875 11.125 20.4832 11.125 20V15.5098H9.66016C9.01398 15.5098 8.49023 14.986 8.49023 14.3398V12.875H4C3.51675 12.875 3.125 12.4832 3.125 12C3.125 11.5168 3.51675 11.125 4 11.125H8.49023V9.66016C8.49023 9.01398 9.01398 8.49023 9.66016 8.49023H14.3398C14.986 8.49023 15.5098 9.01398 15.5098 9.66016V14.3398C15.5098 14.986 14.986 15.5098 14.3398 15.5098H12.875V20C12.875 20.4832 12.4832 20.875 12 20.875Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/apple.svg b/apps/web/src/assets/icons/apple.svgnew file mode 100644index 00000000..c841570c--- /dev/null+++ b/apps/web/src/assets/icons/apple.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 842.32007 1000.0001">+ <path fill="currentColor" d="M824.66636 779.30363c-15.12299 34.93724-33.02368 67.09674-53.7638 96.66374-28.27076 40.3074-51.4182 68.2078-69.25717 83.7012-27.65347 25.4313-57.2822 38.4556-89.00964 39.1963-22.77708 0-50.24539-6.4813-82.21973-19.629-32.07926-13.0861-61.55985-19.5673-88.51583-19.5673-28.27075 0-58.59083 6.4812-91.02193 19.5673-32.48053 13.1477-58.64639 19.9994-78.65196 20.6784-30.42501 1.29623-60.75123-12.0985-91.02193-40.2457-19.32039-16.8514-43.48632-45.7394-72.43607-86.6641-31.060778-43.7024-56.597041-94.37983-76.602609-152.15586C10.740416 658.44309 0 598.01283 0 539.50845c0-67.01648 14.481044-124.8172 43.486336-173.25401C66.28194 327.34823 96.60818 296.6578 134.5638 274.1276c37.95566-22.53016 78.96676-34.01129 123.1321-34.74585 24.16591 0 55.85633 7.47508 95.23784 22.166 39.27042 14.74029 64.48571 22.21538 75.54091 22.21538 8.26518 0 36.27668-8.7405 83.7629-26.16587 44.90607-16.16001 82.80614-22.85118 113.85458-20.21546 84.13326 6.78992 147.34122 39.95559 189.37699 99.70686-75.24463 45.59122-112.46573 109.4473-111.72502 191.36456.67899 63.8067 23.82643 116.90384 69.31888 159.06309 20.61664 19.56727 43.64066 34.69027 69.2571 45.4307-5.55531 16.11062-11.41933 31.54225-17.65372 46.35662zM631.70926 20.0057c0 50.01141-18.27108 96.70693-54.6897 139.92782-43.94932 51.38118-97.10817 81.07162-154.75459 76.38659-.73454-5.99983-1.16045-12.31444-1.16045-18.95003 0-48.01091 20.9006-99.39207 58.01678-141.40314 18.53027-21.27094 42.09746-38.95744 70.67685-53.0663C578.3158 9.00229 605.2903 1.31621 630.65988 0c.74076 6.68575 1.04938 13.37191 1.04938 20.00505z"/>+</svg>\ No newline at end of filediff --git a/apps/web/src/assets/icons/arrow-right-small.svg b/apps/web/src/assets/icons/arrow-right-small.svgnew file mode 100644index 00000000..12f2d26b--- /dev/null+++ b/apps/web/src/assets/icons/arrow-right-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5173 8.51706C12.6735 8.36085 12.9267 8.36085 13.0829 8.51706L16.283 11.7171C16.4391 11.8733 16.4391 12.1265 16.283 12.2827L13.0829 15.4828C12.9267 15.6389 12.6735 15.6389 12.5173 15.4828C12.361 15.3265 12.361 15.0733 12.5173 14.917L15.0344 12.3999H8.0001C7.77919 12.3999 7.6001 12.2208 7.6001 11.9999C7.6001 11.779 7.77919 11.5999 8.0001 11.5999H15.0344L12.5173 9.08274C12.361 8.92654 12.361 8.67327 12.5173 8.51706Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/arrow-right.svg b/apps/web/src/assets/icons/arrow-right.svgnew file mode 100644index 00000000..9bbcf6a0--- /dev/null+++ b/apps/web/src/assets/icons/arrow-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.6465 7.64645C12.8417 7.45118 13.1583 7.45118 13.3535 7.64645L17.3536 11.6465C17.5488 11.8417 17.5488 12.1583 17.3536 12.3536L13.3535 16.3536C13.1583 16.5488 12.8417 16.5488 12.6465 16.3536C12.4512 16.1583 12.4512 15.8417 12.6465 15.6464L15.7929 12.5H7C6.72386 12.5 6.5 12.2761 6.5 12C6.5 11.7239 6.72386 11.5 7 11.5H15.7929L12.6465 8.35355C12.4512 8.15829 12.4512 7.84171 12.6465 7.64645Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/arrow-scale.svg b/apps/web/src/assets/icons/arrow-scale.svgnew file mode 100644index 00000000..9c6573d0--- /dev/null+++ b/apps/web/src/assets/icons/arrow-scale.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.1266 12.2014C17.3474 12.2016 17.5264 12.3804 17.5264 12.6012L17.5264 17.127C17.5262 17.3476 17.3472 17.5266 17.1266 17.5268L12.6008 17.5268C12.3801 17.5268 12.2013 17.3477 12.201 17.127C12.201 16.9061 12.3799 16.7272 12.6008 16.7272L16.1605 16.7265L12.884 13.4499C12.7278 13.2937 12.7278 13.0399 12.884 12.8837C13.0402 12.7277 13.2934 12.7282 13.4495 12.8844L16.7261 16.1609L16.7268 12.6012C16.7268 12.3803 16.9057 12.2014 17.1266 12.2014ZM11.3986 6.47343C11.6195 6.47347 11.7984 6.65238 11.7984 6.87325C11.7984 7.09418 11.6195 7.27306 11.3986 7.27307H7.83961L11.1162 10.5497C11.2724 10.7058 11.2724 10.9597 11.1162 11.1159C10.96 11.2721 10.7062 11.2721 10.55 11.1159L7.27337 7.83931L7.27337 11.3983C7.27338 11.6192 7.09378 11.7988 6.87286 11.7988C6.65221 11.7985 6.47373 11.619 6.47373 11.3983L6.47304 6.87325C6.47308 6.65238 6.65268 6.47278 6.87355 6.47274L11.3986 6.47343Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/ask-chat.svg b/apps/web/src/assets/icons/ask-chat.svgnew file mode 100644index 00000000..41a3fa30--- /dev/null+++ b/apps/web/src/assets/icons/ask-chat.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M16.5498 7.31994L7.7498 7.31996C7.02079 7.31996 6.4298 7.91095 6.4298 8.63996V13.04C6.4298 13.769 7.02079 14.3599 7.7498 14.3599H12.1498C12.2665 14.3599 12.3784 14.4063 12.461 14.4889L14.3498 16.3777V14.7999C14.3498 14.557 14.5468 14.3599 14.7898 14.3599H16.5498C17.2788 14.3599 17.8698 13.769 17.8698 13.04V8.63994C17.8698 7.91092 17.2788 7.31994 16.5498 7.31994ZM7.7498 6.43996L16.5498 6.43994C17.7648 6.43994 18.7498 7.42492 18.7498 8.63994V13.04C18.7498 14.255 17.7648 15.2399 16.5498 15.2399H15.2298V17.4399C15.2298 17.6179 15.1226 17.7783 14.9581 17.8464C14.7938 17.9145 14.6045 17.8769 14.4786 17.7511L11.9676 15.2399H7.7498C6.53478 15.2399 5.5498 14.255 5.5498 13.04V8.63996C5.5498 7.42493 6.53477 6.43997 7.7498 6.43996Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/aspect-ratio-1-1.svg b/apps/web/src/assets/icons/aspect-ratio-1-1.svgnew file mode 100644index 00000000..f7385a0f--- /dev/null+++ b/apps/web/src/assets/icons/aspect-ratio-1-1.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<rect x="7.15625" y="7.15625" width="9.6875" height="9.6875" rx="0.40625" stroke="#9A9CA3" stroke-width="0.8125"/>+</svg>diff --git a/apps/web/src/assets/icons/aspect-ratio-16-9.svg b/apps/web/src/assets/icons/aspect-ratio-16-9.svgnew file mode 100644index 00000000..7cd19e95--- /dev/null+++ b/apps/web/src/assets/icons/aspect-ratio-16-9.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<rect x="5.96429" y="8.00457" width="12.0714" height="7.98571" rx="0.464286" stroke="#9A9CA3" stroke-width="0.928572"/>+</svg>diff --git a/apps/web/src/assets/icons/aspect-ratio-3-4.svg b/apps/web/src/assets/icons/aspect-ratio-3-4.svgnew file mode 100644index 00000000..932504f2--- /dev/null+++ b/apps/web/src/assets/icons/aspect-ratio-3-4.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.7986 6.56348H16.6111V17.4385H15.7986V6.56348ZM8.20117 6.56348V17.4385H16.6111C16.6111 17.8872 16.2473 18.251 15.7986 18.251H8.20117C7.75244 18.251 7.38867 17.8872 7.38867 17.4385V6.56348C7.38867 6.11475 7.75244 5.75098 8.20117 5.75098H15.7986C16.2473 5.75098 16.6111 6.11475 16.6111 6.56348H8.20117Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/aspect-ratio-4-3.svg b/apps/web/src/assets/icons/aspect-ratio-4-3.svgnew file mode 100644index 00000000..ba5f6621--- /dev/null+++ b/apps/web/src/assets/icons/aspect-ratio-4-3.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.4375 15.8V16.6125H6.5625V15.8H17.4375ZM17.4375 8.20264H6.5625V16.6125C6.11377 16.6125 5.75 16.2488 5.75 15.8L5.75 8.20264C5.75 7.75391 6.11377 7.39014 6.5625 7.39014H17.4375C17.8862 7.39014 18.25 7.75391 18.25 8.20264V15.8C18.25 16.2488 17.8862 16.6125 17.4375 16.6125V8.20264Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/aspect-ratio-9-16.svg b/apps/web/src/assets/icons/aspect-ratio-9-16.svgnew file mode 100644index 00000000..c9d0188e--- /dev/null+++ b/apps/web/src/assets/icons/aspect-ratio-9-16.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<rect x="8.00725" y="18.0328" width="12.0714" height="7.98571" rx="0.464286" transform="rotate(-90 8.00725 18.0328)" stroke="#9A9CA3" stroke-width="0.928572"/>+</svg>diff --git a/apps/web/src/assets/icons/assets.svg b/apps/web/src/assets/icons/assets.svgnew file mode 100644index 00000000..721680f4--- /dev/null+++ b/apps/web/src/assets/icons/assets.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2362_268752)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.08819 5.93335C7.73467 5.93335 7.41149 6.13308 7.25339 6.44929L5.98238 8.99131C5.94997 9.05611 5.93311 9.12757 5.93311 9.20002V17.1333C5.93311 17.6488 6.35098 18.0667 6.86644 18.0667H17.1331C17.6486 18.0667 18.0664 17.6488 18.0664 17.1333V9.20002C18.0664 9.12757 18.0495 9.05611 18.0172 8.99131L16.7461 6.44931C16.588 6.13311 16.2649 5.93338 15.9114 5.93338L11.9998 5.93336L8.08819 5.93335ZM8.08819 6.86668L11.5331 6.86669V8.73335H7.15486L8.08819 6.86668ZM12.4664 8.73335V6.8667L15.9114 6.86671L16.8447 8.73335H12.4664ZM11.9998 9.66668H17.1331V17.1333H6.86644V9.66668H11.9998ZM10.1331 11.5333C9.87537 11.5333 9.66644 11.7423 9.66644 12C9.66644 12.2577 9.87537 12.4667 10.1331 12.4667H13.8664C14.1242 12.4667 14.3331 12.2577 14.3331 12C14.3331 11.7423 14.1242 11.5333 13.8664 11.5333H10.1331Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2362_268752">+<rect width="14" height="14" fill="white" transform="translate(5 5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/attachment.svg b/apps/web/src/assets/icons/attachment.svgnew file mode 100644index 00000000..24f7ab3c--- /dev/null+++ b/apps/web/src/assets/icons/attachment.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.9287 5.5C12.6248 5.50015 13.9999 6.87514 14 8.57129V14.3574C13.9998 15.4618 13.1043 16.3573 12 16.3574C10.8957 16.3573 10.0002 15.4618 10 14.3574V9.11719C10 8.84114 10.224 8.61734 10.5 8.61719C10.776 8.61734 11 8.84114 11 9.11719V14.3574C11.0002 14.9095 11.4479 15.3573 12 15.3574C12.5521 15.3573 12.9998 14.9095 13 14.3574V8.57129C12.9999 7.42743 12.0726 6.50015 10.9287 6.5C9.7848 6.50008 8.8575 7.42738 8.85742 8.57129V14.3574C8.85757 16.093 10.2645 17.4998 12 17.5C13.7355 17.4998 15.1434 16.093 15.1436 14.3574V12C15.1436 11.7239 15.3674 11.5 15.6436 11.5C15.9194 11.5004 16.1436 11.7241 16.1436 12V14.3574C16.1434 16.6452 14.2878 18.4998 12 18.5C9.71218 18.4998 7.85757 16.6452 7.85742 14.3574V8.57129C7.8575 6.8751 9.23252 5.50008 10.9287 5.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/audio-off.svg b/apps/web/src/assets/icons/audio-off.svgnew file mode 100644index 00000000..48ff42fc--- /dev/null+++ b/apps/web/src/assets/icons/audio-off.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.1863 6.62918C12.3274 6.69975 12.4166 6.84398 12.4166 7.00174V16.9987C12.4166 17.1565 12.3274 17.3007 12.1863 17.3712C12.0452 17.4418 11.8763 17.4266 11.7501 17.3319L8.52888 14.916H7.00157C6.31143 14.916 5.75195 14.3565 5.75195 13.6664V10.3341C5.75195 9.64392 6.31143 9.08444 7.00157 9.08444H8.52888L11.7501 6.66851C11.8763 6.57385 12.0452 6.55862 12.1863 6.62918ZM11.5835 7.83482L8.91765 9.83421C8.84555 9.88829 8.75786 9.91752 8.66773 9.91752H7.00157C6.77152 9.91752 6.58503 10.104 6.58503 10.3341V13.6664C6.58503 13.8964 6.77152 14.0829 7.00157 14.0829H8.66773C8.75786 14.0829 8.84555 14.1122 8.91765 14.1662L11.5835 16.1656V7.83482ZM18.1262 10.0395C18.2888 10.2022 18.2888 10.4659 18.1262 10.6286L16.7545 12.0002L18.1262 13.3718C18.2888 13.5345 18.2888 13.7982 18.1262 13.9609C17.9635 14.1236 17.6997 14.1236 17.537 13.9609L16.1654 12.5893L14.7939 13.9609C14.6312 14.1236 14.3674 14.1236 14.2047 13.9609C14.0421 13.7982 14.0421 13.5345 14.2047 13.3718L15.5764 12.0002L14.2047 10.6286C14.0421 10.4659 14.0421 10.2022 14.2047 10.0395C14.3674 9.87685 14.6312 9.87685 14.7939 10.0395L16.1654 11.4111L17.537 10.0395C17.6997 9.87685 17.9635 9.87685 18.1262 10.0395Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/audio-on.svg b/apps/web/src/assets/icons/audio-on.svgnew file mode 100644index 00000000..ebd4e394--- /dev/null+++ b/apps/web/src/assets/icons/audio-on.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9694 6.62757C12.1123 6.69746 12.2029 6.84266 12.2029 7.00174V16.9987C12.2029 17.1578 12.1123 17.303 11.9694 17.3729C11.8265 17.4428 11.6562 17.4251 11.5307 17.3275L8.43018 14.916H6.9962C6.30605 14.916 5.74658 14.3565 5.74658 13.6664V10.3341C5.74658 9.64392 6.30605 9.08444 6.9962 9.08444H8.43018L11.5307 6.67295C11.6562 6.57528 11.8265 6.55767 11.9694 6.62757ZM11.3699 7.85342L8.82883 9.82978C8.75571 9.88664 8.66573 9.91752 8.5731 9.91752H6.9962C6.76615 9.91752 6.57966 10.104 6.57966 10.3341V13.6664C6.57966 13.8964 6.76615 14.0829 6.9962 14.0829H8.5731C8.66573 14.0829 8.75571 14.1138 8.82883 14.1706L11.3699 16.147V7.85342ZM14.3093 8.95784C14.4625 8.8559 14.6694 8.89747 14.7713 9.05069C15.9566 10.8322 15.9566 13.1682 14.7713 14.9497C14.6694 15.1029 14.4625 15.1445 14.3093 15.0425C14.156 14.9406 14.1144 14.7338 14.2164 14.5805C15.2529 13.0226 15.2529 10.9778 14.2164 9.41987C14.1144 9.26664 14.156 9.05979 14.3093 8.95784ZM16.3088 6.94379C16.1897 6.80339 15.9795 6.78601 15.8391 6.90499C15.6987 7.02396 15.6813 7.23424 15.8003 7.37465C18.0572 10.0382 18.0572 13.9622 15.8003 16.6258C15.6813 16.7662 15.6987 16.9764 15.8391 17.0954C15.9795 17.2145 16.1897 17.197 16.3088 17.0567C18.7764 14.1445 18.7764 9.85597 16.3088 6.94379Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/audio-small.svg b/apps/web/src/assets/icons/audio-small.svgnew file mode 100644index 00000000..e0f20d4d--- /dev/null+++ b/apps/web/src/assets/icons/audio-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.5 7.5C14.7761 7.5 15 7.72386 15 8L15 16C15 16.2761 14.7761 16.5 14.5 16.5C14.2239 16.5 14 16.2761 14 16L14 8C14 7.72386 14.2239 7.5 14.5 7.5ZM9.5 8.5C9.77614 8.5 10 8.72386 10 9L10 15C10 15.2761 9.77614 15.5 9.5 15.5C9.22386 15.5 9 15.2761 9 15L9 9C9 8.72386 9.22386 8.5 9.5 8.5ZM12 9.5C12.2761 9.5 12.5 9.72386 12.5 10V14C12.5 14.2761 12.2761 14.5 12 14.5C11.7239 14.5 11.5 14.2761 11.5 14V10C11.5 9.72386 11.7239 9.5 12 9.5ZM17 10C17.2761 10 17.5 10.2239 17.5 10.5V13.5C17.5 13.7761 17.2761 14 17 14C16.7239 14 16.5 13.7761 16.5 13.5V10.5C16.5 10.2239 16.7239 10 17 10ZM7 10.5C7.27614 10.5 7.5 10.7239 7.5 11V13C7.5 13.2761 7.27614 13.5 7 13.5C6.72386 13.5 6.5 13.2761 6.5 13V11C6.5 10.7239 6.72386 10.5 7 10.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/audio.svg b/apps/web/src/assets/icons/audio.svgnew file mode 100644index 00000000..c0832213--- /dev/null+++ b/apps/web/src/assets/icons/audio.svg@@ -0,0 +1,8 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.5 6.125C10.7071 6.125 10.875 6.29289 10.875 6.5V17.5C10.875 17.7071 10.7071 17.875 10.5 17.875C10.2929 17.875 10.125 17.7071 10.125 17.5V6.5C10.125 6.29289 10.2929 6.125 10.5 6.125Z" fill="currentColor"/>+<path d="M16.5 7.625C16.7071 7.625 16.875 7.79289 16.875 8V16C16.875 16.2071 16.7071 16.375 16.5 16.375C16.2929 16.375 16.125 16.2071 16.125 16V8C16.125 7.79289 16.2929 7.625 16.5 7.625Z" fill="currentColor"/>+<path d="M7.5 9.125C7.70711 9.125 7.875 9.29289 7.875 9.5V14.5C7.875 14.7071 7.70711 14.875 7.5 14.875C7.29289 14.875 7.125 14.7071 7.125 14.5V9.5C7.125 9.29289 7.29289 9.125 7.5 9.125Z" fill="currentColor"/>+<path d="M13.5 9.125C13.7071 9.125 13.875 9.29289 13.875 9.5V14.5C13.875 14.7071 13.7071 14.875 13.5 14.875C13.2929 14.875 13.125 14.7071 13.125 14.5V9.5C13.125 9.29289 13.2929 9.125 13.5 9.125Z" fill="currentColor"/>+<path d="M4.5 10.375C4.70711 10.375 4.875 10.5429 4.875 10.75V13.25C4.875 13.4571 4.70711 13.625 4.5 13.625C4.29289 13.625 4.125 13.4571 4.125 13.25V10.75C4.125 10.5429 4.29289 10.375 4.5 10.375Z" fill="currentColor"/>+<path d="M19.5 10.375C19.7071 10.375 19.875 10.5429 19.875 10.75V13.25C19.875 13.4571 19.7071 13.625 19.5 13.625C19.2929 13.625 19.125 13.4571 19.125 13.25V10.75C19.125 10.5429 19.2929 10.375 19.5 10.375Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/ban.svg b/apps/web/src/assets/icons/ban.svgnew file mode 100644index 00000000..c8f9079d--- /dev/null+++ b/apps/web/src/assets/icons/ban.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.0567 12.0003C17.0567 9.20776 14.7929 6.94395 12.0003 6.94395C9.20776 6.94395 6.94395 9.20776 6.94395 12.0003C6.94395 14.7929 9.20776 17.0567 12.0003 17.0567C14.7929 17.0567 17.0567 14.7929 17.0567 12.0003ZM18.1803 12.0003C18.1803 15.4134 15.4134 18.1803 12.0003 18.1803C8.58719 18.1803 5.82031 15.4134 5.82031 12.0003C5.82031 8.58719 8.58719 5.82031 12.0003 5.82031C15.4134 5.82031 18.1803 8.58719 18.1803 12.0003Z" fill="currentColor"/>+<path d="M7.63322 7.63321C7.85253 7.41393 8.20802 7.41393 8.42732 7.63321L16.3683 15.5741C16.5876 15.7934 16.5876 16.1494 16.3683 16.3687C16.1489 16.5877 15.7934 16.5873 15.5742 16.3681L7.63322 8.42724C7.41393 8.20795 7.41392 7.85249 7.63322 7.63321Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/bar-bottom-closed.svg b/apps/web/src/assets/icons/bar-bottom-closed.svgnew file mode 100644index 00000000..bc4b03d2--- /dev/null+++ b/apps/web/src/assets/icons/bar-bottom-closed.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.2041 2.01074C12.2128 2.113 13 2.96435 13 4V11L12.9893 11.2041C12.8938 12.1457 12.1457 12.8938 11.2041 12.9893L11 13H4C2.96435 13 2.113 12.2128 2.01074 11.2041L2 11V4C2 2.89543 2.89543 2 4 2H11L11.2041 2.01074ZM3 10V11C3 11.5523 3.44772 12 4 12H11C11.5523 12 12 11.5523 12 11V10H3ZM4 3C3.44772 3 3 3.44772 3 4V9H12V4C12 3.44772 11.5523 3 11 3H4Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/bar-bottom-open.svg b/apps/web/src/assets/icons/bar-bottom-open.svgnew file mode 100644index 00000000..ffe73f18--- /dev/null+++ b/apps/web/src/assets/icons/bar-bottom-open.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.2041 2.01074C12.2128 2.113 13 2.96435 13 4V11L12.9893 11.2041C12.8938 12.1457 12.1457 12.8938 11.2041 12.9893L11 13H4C2.96435 13 2.113 12.2128 2.01074 11.2041L2 11V4C2 2.89543 2.89543 2 4 2H11L11.2041 2.01074ZM4 3C3.44772 3 3 3.44772 3 4V9H12V4C12 3.44772 11.5523 3 11 3H4Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/bar-left-closed.svg b/apps/web/src/assets/icons/bar-left-closed.svgnew file mode 100644index 00000000..7f50e50d--- /dev/null+++ b/apps/web/src/assets/icons/bar-left-closed.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.2041 2.01074C12.2128 2.113 13 2.96435 13 4V11L12.9893 11.2041C12.8938 12.1457 12.1457 12.8938 11.2041 12.9893L11 13H4C2.96435 13 2.113 12.2128 2.01074 11.2041L2 11V4C2 2.89543 2.89543 2 4 2H11L11.2041 2.01074ZM4 3C3.44772 3 3 3.44772 3 4V11C3 11.5523 3.44772 12 4 12H5V3H4ZM11 12C11.5523 12 12 11.5523 12 11V4C12 3.44772 11.5523 3 11 3H6V12H11Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/bar-left-open.svg b/apps/web/src/assets/icons/bar-left-open.svgnew file mode 100644index 00000000..310fbbfb--- /dev/null+++ b/apps/web/src/assets/icons/bar-left-open.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.2041 2.01074C12.2128 2.113 13 2.96435 13 4V11L12.9893 11.2041C12.8938 12.1457 12.1457 12.8938 11.2041 12.9893L11 13H4C2.96435 13 2.113 12.2128 2.01074 11.2041L2 11V4C2 2.89543 2.89543 2 4 2H11L11.2041 2.01074ZM6 12H11C11.5523 12 12 11.5523 12 11V4C12 3.44772 11.5523 3 11 3H6V12Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/bar-right-closed.svg b/apps/web/src/assets/icons/bar-right-closed.svgnew file mode 100644index 00000000..ac8bf0ba--- /dev/null+++ b/apps/web/src/assets/icons/bar-right-closed.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.2041 2.01074C12.2128 2.113 13 2.96435 13 4V11L12.9893 11.2041C12.8938 12.1457 12.1457 12.8938 11.2041 12.9893L11 13H4C2.96435 13 2.113 12.2128 2.01074 11.2041L2 11V4C2 2.89543 2.89543 2 4 2H11L11.2041 2.01074ZM4 3C3.44772 3 3 3.44772 3 4V11C3 11.5523 3.44772 12 4 12H9V3H4ZM11 12C11.5523 12 12 11.5523 12 11V4C12 3.44772 11.5523 3 11 3H10V12H11Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/bar-right-open.svg b/apps/web/src/assets/icons/bar-right-open.svgnew file mode 100644index 00000000..c91df444--- /dev/null+++ b/apps/web/src/assets/icons/bar-right-open.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.2041 2.01074C12.2128 2.113 13 2.96435 13 4V11L12.9893 11.2041C12.8938 12.1457 12.1457 12.8938 11.2041 12.9893L11 13H4C2.96435 13 2.113 12.2128 2.01074 11.2041L2 11V4C2 2.89543 2.89543 2 4 2H11L11.2041 2.01074ZM4 3C3.44772 3 3 3.44772 3 4V11C3 11.5523 3.44772 12 4 12H9V3H4Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/billing.svg b/apps/web/src/assets/icons/billing.svgnew file mode 100644index 00000000..214604db--- /dev/null+++ b/apps/web/src/assets/icons/billing.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.2467 5.57737C12.3274 5.47648 12.4272 5.39258 12.5405 5.33053C12.6537 5.26849 12.7782 5.22952 12.9066 5.2159C13.0351 5.20227 13.1649 5.21426 13.2887 5.25116C13.4125 5.28806 13.5277 5.34915 13.6277 5.43088L16.8135 8.03266C16.9887 8.17571 17.1088 8.37514 17.1534 8.59689C17.1979 8.81865 17.1641 9.04899 17.0577 9.24858C16.7791 9.16346 16.4895 9.12034 16.1982 9.12064H15.9052L16.1963 8.78858L14.5184 7.41835L13.1345 9.12162H11.8756L13.7615 6.80111L13.0095 6.1868L10.6675 9.12064H9.41738L12.2467 5.57737ZM14.7333 14.0039C14.6037 14.0039 14.4795 14.0553 14.388 14.1469C14.2964 14.2385 14.2449 14.3627 14.2449 14.4922C14.2449 14.6217 14.2964 14.7459 14.388 14.8375C14.4795 14.9291 14.6037 14.9805 14.7333 14.9805H15.7099C15.8394 14.9805 15.9636 14.9291 16.0552 14.8375C16.1468 14.7459 16.1982 14.6217 16.1982 14.4922C16.1982 14.3627 16.1468 14.2385 16.0552 14.1469C15.9636 14.0553 15.8394 14.0039 15.7099 14.0039H14.7333ZM6.82654 9.60896C6.82654 9.47945 6.87798 9.35525 6.96956 9.26367C7.06114 9.17209 7.18535 9.12064 7.31486 9.12064H8.44171L9.21814 8.144H7.31486C6.92632 8.144 6.5537 8.29834 6.27897 8.57308C6.00424 8.84781 5.84989 9.22043 5.84989 9.60896V15.4688C5.84989 16.1164 6.10713 16.7374 6.56502 17.1953C7.02291 17.6532 7.64395 17.9104 8.2915 17.9104H16.1982C16.7163 17.9104 17.2131 17.7047 17.5794 17.3383C17.9457 16.972 18.1515 16.4752 18.1515 15.9572V12.0506C18.1515 11.5325 17.9457 11.0357 17.5794 10.6694C17.2131 10.3031 16.7163 10.0973 16.1982 10.0973H7.31486C7.18535 10.0973 7.06114 10.0458 6.96956 9.95426C6.87798 9.86268 6.82654 9.73848 6.82654 9.60896ZM6.82654 15.4688V10.9909C6.98019 11.0456 7.14297 11.0733 7.31486 11.0739H16.1982C16.4572 11.0739 16.7057 11.1768 16.8888 11.36C17.072 11.5431 17.1749 11.7916 17.1749 12.0506V15.9572C17.1749 16.2162 17.072 16.4646 16.8888 16.6478C16.7057 16.8309 16.4572 16.9338 16.1982 16.9338H8.2915C7.90297 16.9338 7.53035 16.7795 7.25562 16.5047C6.98088 16.23 6.82654 15.8574 6.82654 15.4688Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/blending-mode-default.svg b/apps/web/src/assets/icons/blending-mode-default.svgnew file mode 100644index 00000000..08b624ae--- /dev/null+++ b/apps/web/src/assets/icons/blending-mode-default.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12 6C9 8.75 7.5 11 7.5 13.5C7.5 15.9853 9.51472 18 12 18C14.4853 18 16.5 15.9853 16.5 13.5C16.5 11 15 8.75 12 6ZM15.5 13.5C15.5 11.612 14.4732 9.77195 12 7.37357C9.52686 9.77195 8.5 11.612 8.5 13.5C8.5 15.433 10.067 17 12 17C13.933 17 15.5 15.433 15.5 13.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/blending-mode-set.svg b/apps/web/src/assets/icons/blending-mode-set.svgnew file mode 100644index 00000000..a377676b--- /dev/null+++ b/apps/web/src/assets/icons/blending-mode-set.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 13.5C7.5 11 9 8.75 12 6C15 8.75 16.5 11 16.5 13.5C16.5 15.9853 14.4853 18 12 18C9.51472 18 7.5 15.9853 7.5 13.5ZM15.4524 12.8031C14.1735 12.3212 12.7879 12.9621 11.4896 13.5626C10.4327 14.0514 9.43365 14.5135 8.59695 14.3215C8.53357 14.058 8.5 13.7829 8.5 13.5C8.5 11.612 9.52686 9.77195 12 7.37357C14.1684 9.47639 15.225 11.15 15.4524 12.8031Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/captions-small.svg b/apps/web/src/assets/icons/captions-small.svgnew file mode 100644index 00000000..72378f67--- /dev/null+++ b/apps/web/src/assets/icons/captions-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5 7C18.0523 7 18.5 7.44771 18.5 8V16C18.5 16.5523 18.0523 17 17.5 17H6.5C5.94772 17 5.5 16.5523 5.5 16L5.5 8C5.5 7.44772 5.94772 7 6.5 7L17.5 7ZM6.5 16L17.5 16V8L6.5 8L6.5 16ZM14.5 13C14.7761 13 15 13.2239 15 13.5C15 13.7761 14.7761 14 14.5 14L9.5 14C9.22386 14 9 13.7761 9 13.5C9 13.2239 9.22386 13 9.5 13L14.5 13ZM11 11C11.2761 11 11.5 11.2239 11.5 11.5C11.5 11.7761 11.2761 12 11 12H9.5C9.22386 12 9 11.7761 9 11.5C9 11.2239 9.22386 11 9.5 11H11ZM14.5 11C14.7761 11 15 11.2239 15 11.5C15 11.7761 14.7761 12 14.5 12L13 12C12.7239 12 12.5 11.7761 12.5 11.5C12.5 11.2239 12.7239 11 13 11H14.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/captions.svg b/apps/web/src/assets/icons/captions.svgnew file mode 100644index 00000000..7bee4d16--- /dev/null+++ b/apps/web/src/assets/icons/captions.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.6054 7.39478H7.39489C6.6682 7.39478 6.0791 7.98387 6.0791 8.71056V15.2895C6.0791 16.0162 6.6682 16.6053 7.39489 16.6053H16.6054C17.3321 16.6053 17.9212 16.0162 17.9212 15.2895V8.71056C17.9212 7.98387 17.3321 7.39478 16.6054 7.39478Z" stroke="currentColor" stroke-width="0.833333" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M9.396 14.1871H11.4793M13.5627 14.1871H14.6043M9.396 12.1038H10.4377M12.521 12.1038H14.6043" stroke="currentColor" stroke-width="0.833333" stroke-linecap="round" stroke-linejoin="round"/>+</svg>diff --git a/apps/web/src/assets/icons/caret-down.svg b/apps/web/src/assets/icons/caret-down.svgnew file mode 100644index 00000000..b4225a99--- /dev/null+++ b/apps/web/src/assets/icons/caret-down.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.58569 10.3958C8.37967 10.133 8.56843 9.75 8.904 9.75L15.096 9.75C15.4316 9.75 15.6203 10.133 15.4143 10.3958L12.3183 14.3455C12.1569 14.5515 11.8431 14.5515 11.6817 14.3455L8.58569 10.3958Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/caret-left.svg b/apps/web/src/assets/icons/caret-left.svgnew file mode 100644index 00000000..444e7074--- /dev/null+++ b/apps/web/src/assets/icons/caret-left.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.6042 8.58569C13.867 8.37967 14.25 8.56843 14.25 8.904V15.096C14.25 15.4316 13.867 15.6203 13.6042 15.4143L9.65447 12.3183C9.44851 12.1569 9.44851 11.8431 9.65447 11.6817L13.6042 8.58569Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/caret-right.svg b/apps/web/src/assets/icons/caret-right.svgnew file mode 100644index 00000000..df8250e8--- /dev/null+++ b/apps/web/src/assets/icons/caret-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.3958 15.4143C10.133 15.6203 9.75 15.4316 9.75 15.096V8.904C9.75 8.56843 10.133 8.37967 10.3958 8.58569L14.3455 11.6817C14.5515 11.8431 14.5515 12.1569 14.3455 12.3183L10.3958 15.4143Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/change-track-mode.svg b/apps/web/src/assets/icons/change-track-mode.svgnew file mode 100644index 00000000..60af6a66--- /dev/null+++ b/apps/web/src/assets/icons/change-track-mode.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 7C12.2761 7 12.5 7.17235 12.5 7.38477V16.6152C12.5 16.8276 12.2761 17 12 17C11.7239 17 11.5 16.8276 11.5 16.6152V7.38477C11.5 7.17235 11.7239 7 12 7ZM7.96973 9.83594C8.13374 9.67198 8.40046 9.67195 8.56445 9.83594L10.4307 11.7031C10.5946 11.8671 10.5946 12.1329 10.4307 12.2969L8.56445 14.1641C8.40044 14.3281 8.13374 14.3281 7.96973 14.1641C7.8057 14 7.8057 13.7334 7.96973 13.5693L9.12012 12.4199H5.93359C5.70163 12.4199 5.51367 12.232 5.51367 12C5.51369 11.7681 5.70165 11.5801 5.93359 11.5801H9.12012L7.96973 10.4307C7.80572 10.2666 7.80571 9.99995 7.96973 9.83594ZM15.4365 9.83594C15.6004 9.67218 15.8662 9.67241 16.0303 9.83594C16.1943 9.99995 16.1943 10.2666 16.0303 10.4307L14.8809 11.5801H18.0664C18.2984 11.5801 18.4873 11.7681 18.4873 12C18.4873 12.232 18.2984 12.4199 18.0664 12.4199H14.8809L16.0303 13.5693C16.1943 13.7334 16.1943 14 16.0303 14.1641C15.8662 14.3277 15.6004 14.3279 15.4365 14.1641L13.5703 12.2969C13.4062 12.1329 13.4062 11.8671 13.5703 11.7031L15.4365 9.83594Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/chevron-down.svg b/apps/web/src/assets/icons/chevron-down.svgnew file mode 100644index 00000000..b8d49f9d--- /dev/null+++ b/apps/web/src/assets/icons/chevron-down.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.8194 10.3983C15.0118 10.2022 15.3252 10.2002 15.5196 10.3944C15.7139 10.5887 15.715 10.9053 15.5225 11.1014L12.3672 14.3163C12.2672 14.4182 12.1347 14.4661 12.003 14.4628C11.8681 14.4689 11.7314 14.4217 11.6289 14.3173L8.47366 11.1024C8.28115 10.9063 8.28231 10.5897 8.47659 10.3954C8.67095 10.201 8.98523 10.2021 9.17776 10.3983L11.9981 13.2723L14.8194 10.3983Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/chevron-left.svg b/apps/web/src/assets/icons/chevron-left.svgnew file mode 100644index 00000000..98a317c9--- /dev/null+++ b/apps/web/src/assets/icons/chevron-left.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.605 15.3093C13.8011 15.5018 13.8031 15.8151 13.6089 16.0095C13.4146 16.2038 13.0981 16.2049 12.9019 16.0124L9.68705 12.8571C9.5851 12.7571 9.53718 12.6246 9.54056 12.4929C9.53447 12.358 9.58164 12.2214 9.68607 12.1189L12.9009 8.96359C13.097 8.77108 13.4136 8.77224 13.6079 8.96652C13.8023 9.16088 13.8012 9.47516 13.605 9.66769L10.731 12.488L13.605 15.3093Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/chevron-right.svg b/apps/web/src/assets/icons/chevron-right.svgnew file mode 100644index 00000000..3b19e441--- /dev/null+++ b/apps/web/src/assets/icons/chevron-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.3983 9.6668C10.2022 9.47432 10.2002 9.16097 10.3944 8.9666C10.5887 8.77226 10.9053 8.77117 11.1014 8.96367L14.3163 12.1189C14.4182 12.219 14.4661 12.3515 14.4628 12.4832C14.4689 12.6181 14.4217 12.7547 14.3173 12.8572L11.1024 16.0125C10.9063 16.205 10.5897 16.2038 10.3954 16.0096C10.201 15.8152 10.2021 15.5009 10.3983 15.3084L13.2723 12.4881L10.3983 9.6668Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/chrome.svg b/apps/web/src/assets/icons/chrome.svgnew file mode 100644index 00000000..867c0559--- /dev/null+++ b/apps/web/src/assets/icons/chrome.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48"><defs><linearGradient id="a" x1="3.2173" y1="15" x2="44.7812" y2="15" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#d93025"/><stop offset="1" stop-color="#ea4335"/></linearGradient><linearGradient id="b" x1="20.7219" y1="47.6791" x2="41.5039" y2="11.6837" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fcc934"/><stop offset="1" stop-color="#fbbc04"/></linearGradient><linearGradient id="c" x1="26.5981" y1="46.5015" x2="5.8161" y2="10.506" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1e8e3e"/><stop offset="1" stop-color="#34a853"/></linearGradient></defs><circle cx="24" cy="23.9947" r="12" style="fill:#fff"/><path d="M3.2154,36A24,24,0,1,0,12,3.2154,24,24,0,0,0,3.2154,36ZM34.3923,18A12,12,0,1,1,18,13.6077,12,12,0,0,1,34.3923,18Z" style="fill:none"/><path d="M24,12H44.7812a23.9939,23.9939,0,0,0-41.5639.0029L13.6079,30l.0093-.0024A11.9852,11.9852,0,0,1,24,12Z" style="fill:url(#a)"/><circle cx="24" cy="24" r="9.5" style="fill:#1a73e8"/><path d="M34.3913,30.0029,24.0007,48A23.994,23.994,0,0,0,44.78,12.0031H23.9989l-.0025.0093A11.985,11.985,0,0,1,34.3913,30.0029Z" style="fill:url(#b)"/><path d="M13.6086,30.0031,3.218,12.006A23.994,23.994,0,0,0,24.0025,48L34.3931,30.0029l-.0067-.0068a11.9852,11.9852,0,0,1-20.7778.007Z" style="fill:url(#c)"/></svg>\ No newline at end of filediff --git a/apps/web/src/assets/icons/clear-input.svg b/apps/web/src/assets/icons/clear-input.svgnew file mode 100644index 00000000..03c5a086--- /dev/null+++ b/apps/web/src/assets/icons/clear-input.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.5 12C6.5 8.96244 8.96244 6.5 12 6.5C15.0376 6.5 17.5 8.96244 17.5 12C17.5 15.0375 15.0376 17.5 12 17.5C8.96244 17.5 6.5 15.0375 6.5 12ZM13.9546 10.0456C14.1168 10.2077 14.1168 10.4706 13.9546 10.6328L12.5873 12.0001L13.9546 13.3674C14.1168 13.5296 14.1168 13.7925 13.9546 13.9546C13.7925 14.1168 13.5296 14.1168 13.3674 13.9546L12.0001 12.5873L10.6328 13.9546C10.4706 14.1168 10.2077 14.1168 10.0456 13.9546C9.88341 13.7925 9.88341 13.5296 10.0456 13.3674L11.4129 12.0001L10.0456 10.6328C9.88341 10.4706 9.88341 10.2077 10.0456 10.0456C10.2077 9.88341 10.4706 9.88341 10.6328 10.0456L12.0001 11.4129L13.3674 10.0456C13.5296 9.88341 13.7925 9.88341 13.9546 10.0456Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/close-remove-small.svg b/apps/web/src/assets/icons/close-remove-small.svgnew file mode 100644index 00000000..66facb6f--- /dev/null+++ b/apps/web/src/assets/icons/close-remove-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M14.9987 9.57078C15.156 9.41351 15.156 9.15852 14.9987 9.00125C14.8414 8.84398 14.5864 8.84398 14.4292 9.00125L12 11.4304L9.57078 9.00125C9.41351 8.84398 9.15852 8.84398 9.00125 9.00125C8.84398 9.15852 8.84398 9.41351 9.00125 9.57078L11.4304 12L9.00125 14.4292C8.84398 14.5865 8.84398 14.8414 9.00125 14.9987C9.15852 15.1559 9.41351 15.1559 9.57078 14.9987L12 12.5695L14.4292 14.9987C14.5864 15.1559 14.8414 15.1559 14.9987 14.9987C15.156 14.8414 15.156 14.5865 14.9987 14.4292L12.5695 12L14.9987 9.57078Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/close-remove.svg b/apps/web/src/assets/icons/close-remove.svgnew file mode 100644index 00000000..917c0f01--- /dev/null+++ b/apps/web/src/assets/icons/close-remove.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M16.0891 8.68747C16.3036 8.47301 16.3036 8.1253 16.0891 7.91084C15.8747 7.69639 15.527 7.69639 15.3126 7.91084L12 11.2234L8.68748 7.91084C8.47301 7.69639 8.1253 7.69639 7.91084 7.91084C7.69639 8.1253 7.69639 8.47301 7.91084 8.68747L11.2234 12L7.91084 15.3125C7.69639 15.527 7.69639 15.8747 7.91084 16.0892C8.1253 16.3036 8.47301 16.3036 8.68748 16.0892L12 12.7766L15.3126 16.0892C15.527 16.3036 15.8747 16.3036 16.0891 16.0892C16.3036 15.8747 16.3036 15.527 16.0891 15.3125L12.7766 12L16.0891 8.68747Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/color-grade.svg b/apps/web/src/assets/icons/color-grade.svgnew file mode 100644index 00000000..f0e2514d--- /dev/null+++ b/apps/web/src/assets/icons/color-grade.svg@@ -0,0 +1,13 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" d="M16.6619 8.35177C12.8582 9.38913 9.38939 12.858 8.35202 16.6617L7.86963 16.5301C8.95359 12.5556 12.5558 8.95334 16.5303 7.86938L16.6619 8.35177Z" fill="currentColor"/>+<path opacity="0.25" fill-rule="evenodd" clip-rule="evenodd" d="M16.3807 7.927C12.5344 9.00535 9.00559 12.5341 7.92724 16.3804L7.4458 16.2455C8.57127 12.2311 12.2314 8.57103 16.2458 7.44556L16.3807 7.927Z" fill="currentColor"/>+<path opacity="0.3" fill-rule="evenodd" clip-rule="evenodd" d="M16.0201 7.52547C12.1909 8.6619 8.66779 12.1831 7.52805 16.0119L7.04883 15.8693C8.23676 11.8786 11.8866 8.23067 15.8778 7.04614L16.0201 7.52547Z" fill="currentColor"/>+<path opacity="0.35" fill-rule="evenodd" clip-rule="evenodd" d="M15.5468 7.16176C11.8111 8.37671 8.37914 11.808 7.16294 15.5435L6.6875 15.3887C7.9532 11.5012 11.5044 7.95069 15.3921 6.68628L15.5468 7.16176Z" fill="currentColor"/>+<path opacity="0.4" fill-rule="evenodd" clip-rule="evenodd" d="M15.02 6.82367C11.4208 8.11449 8.12382 11.4088 6.82836 15.0073L6.35791 14.838C7.70389 11.0991 11.1115 7.69426 14.8512 6.35303L15.02 6.82367Z" fill="currentColor"/>+<path opacity="0.45" fill-rule="evenodd" clip-rule="evenodd" d="M14.4021 6.53126C10.9999 7.89469 7.89952 10.9937 6.53383 14.3955L6.06982 14.2093C7.48635 10.6808 10.6871 7.48137 14.2161 6.06714L14.4021 6.53126Z" fill="currentColor"/>+<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M13.7072 6.28877C10.5613 7.70353 7.71096 10.5521 6.29324 13.6974L5.8374 13.492C7.30529 10.2353 10.2448 7.29764 13.5021 5.83276L13.7072 6.28877Z" fill="currentColor"/>+<path opacity="0.6" fill-rule="evenodd" clip-rule="evenodd" d="M12.9069 6.12077C10.093 7.55109 7.55776 10.085 6.12526 12.8984L5.67969 12.6715C7.16018 9.76389 9.77214 7.15332 12.6804 5.67505L12.9069 6.12077Z" fill="currentColor"/>+<path opacity="0.7" fill-rule="evenodd" clip-rule="evenodd" d="M11.9619 6.06738C9.58675 7.44686 7.45348 9.57903 6.07235 11.9537L5.64014 11.7023C7.06489 9.25264 9.26056 7.05809 11.7108 5.63501L11.9619 6.06738Z" fill="currentColor"/>+<path opacity="0.8" fill-rule="evenodd" clip-rule="evenodd" d="M10.8041 6.20481C9.0197 7.41057 7.40989 9.02055 6.20436 10.8051L5.79004 10.5252C7.03136 8.68767 8.68679 7.03208 10.5242 5.79053L10.8041 6.20481Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M5.37695 11.9998C5.37695 8.3421 8.3421 5.37695 11.9998 5.37695C15.6575 5.37695 18.6226 8.3421 18.6226 11.9998C18.6226 15.6574 15.6575 18.6226 11.9998 18.6226C8.3421 18.6226 5.37695 15.6574 5.37695 11.9998ZM11.9998 6.32695C8.86677 6.32695 6.32696 8.86677 6.32696 11.9998C6.32696 15.1328 8.86677 17.6726 11.9998 17.6726C15.1328 17.6726 17.6726 15.1328 17.6726 11.9998C17.6726 8.86677 15.1328 6.32695 11.9998 6.32695Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/command-slash.svg b/apps/web/src/assets/icons/command-slash.svgnew file mode 100644index 00000000..557f5081--- /dev/null+++ b/apps/web/src/assets/icons/command-slash.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.46582 18.3131L13.2567 6.68701H14.4658L9.67492 18.3131H8.46582Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/confirm-check.svg b/apps/web/src/assets/icons/confirm-check.svgnew file mode 100644index 00000000..5cd50fa6--- /dev/null+++ b/apps/web/src/assets/icons/confirm-check.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M15.7025 8.47846C15.9721 8.65477 16.0478 9.01629 15.8715 9.28593L11.9048 15.3526C11.8114 15.4956 11.6599 15.5903 11.4905 15.612C11.321 15.6336 11.1506 15.5799 11.0242 15.465L8.45754 13.1317C8.21916 12.915 8.2016 12.546 8.41831 12.3076C8.63502 12.0693 9.00395 12.0517 9.24233 12.2684L11.3028 14.1415L14.8951 8.64747C15.0714 8.37783 15.4328 8.30217 15.7025 8.47846Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/context.svg b/apps/web/src/assets/icons/context.svgnew file mode 100644index 00000000..305e8010--- /dev/null+++ b/apps/web/src/assets/icons/context.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.31592 6.26318C10.6078 5.65876 12.0664 5.50792 13.4546 5.83545C14.843 6.16321 16.0809 6.95123 16.9663 8.06982C17.8514 9.18836 18.3334 10.5731 18.3335 11.9995V12.5835C18.3334 13.1801 18.0962 13.7524 17.6743 14.1743C17.2524 14.5962 16.6801 14.8334 16.0835 14.8335C15.4869 14.8334 14.9136 14.5962 14.4917 14.1743C14.3765 14.059 14.2764 13.9316 14.1899 13.7964C13.6701 14.4292 12.8821 14.8335 11.9995 14.8335C10.435 14.8331 9.1665 13.5641 9.1665 11.9995C9.16676 10.4352 10.4352 9.16691 11.9995 9.1665C12.6993 9.1665 13.339 9.42187 13.8335 9.84229V9.6665C13.8336 9.39055 14.0576 9.16666 14.3335 9.1665C14.6094 9.16668 14.8334 9.39057 14.8335 9.6665V12.5835C14.8336 12.9148 14.9655 13.233 15.1997 13.4673C15.434 13.7014 15.7522 13.8334 16.0835 13.8335C16.4149 13.8334 16.7329 13.7016 16.9673 13.4673C17.2016 13.2329 17.3334 12.9149 17.3335 12.5835V11.9995C17.3334 10.7983 16.9276 9.63189 16.1821 8.68994C15.4366 7.74799 14.3943 7.08509 13.2251 6.80908C12.056 6.53319 10.8278 6.66036 9.73975 7.16943C8.65168 7.67861 7.76726 8.54028 7.22998 9.61475C6.69272 10.6893 6.53333 11.9143 6.77881 13.0903C7.02438 14.2661 7.66043 15.3245 8.58252 16.0942C9.50474 16.8639 10.6601 17.3002 11.8608 17.3315C13.0618 17.3628 14.2386 16.9869 15.1997 16.2661C15.4205 16.1006 15.7342 16.1461 15.8999 16.3667C16.0654 16.5876 16.0211 16.9012 15.8003 17.0669C14.659 17.9228 13.2616 18.3676 11.8354 18.3306C10.4093 18.2934 9.03718 17.7759 7.94189 16.8618C6.8468 15.9477 6.09188 14.6908 5.80029 13.2944C5.50877 11.8979 5.69745 10.4435 6.33545 9.16748C6.97348 7.89153 8.02382 6.86784 9.31592 6.26318ZM11.9995 10.1665C10.9875 10.1669 10.1668 10.9875 10.1665 11.9995C10.1665 13.0118 10.9873 13.8331 11.9995 13.8335C13.012 13.8335 13.8335 13.012 13.8335 11.9995C13.8332 10.9872 13.0119 10.1665 11.9995 10.1665Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/controls-add-marker.svg b/apps/web/src/assets/icons/controls-add-marker.svgnew file mode 100644index 00000000..a28a3917--- /dev/null+++ b/apps/web/src/assets/icons/controls-add-marker.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.0444 11.6111V8.70776C16.0444 8.21536 15.6452 7.81616 15.1528 7.81616H8.84521C8.35284 7.81623 7.95368 8.21539 7.95361 8.70776V11.6169C7.95361 11.8256 8.02666 12.0283 8.15967 12.1882L11.314 15.9783C11.6709 16.407 12.3289 16.4068 12.6851 15.9783L15.8384 12.1814C15.9715 12.0212 16.0444 11.819 16.0444 11.6111ZM16.9653 11.6111C16.9653 12.0342 16.8165 12.4442 16.5464 12.7693L13.3921 16.5662C12.6677 17.4378 11.3304 17.4369 10.606 16.5662L7.45264 12.7761C7.18173 12.4504 7.03369 12.0398 7.03369 11.6169V8.70776C7.03375 7.70729 7.84474 6.8963 8.84521 6.89624H15.1528C16.1533 6.89624 16.9653 7.70725 16.9653 8.70776V11.6111Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/controls-export-current-frame-camera.svg b/apps/web/src/assets/icons/controls-export-current-frame-camera.svgnew file mode 100644index 00000000..998af74c--- /dev/null+++ b/apps/web/src/assets/icons/controls-export-current-frame-camera.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.165 6.7832C13.4746 6.78324 13.779 6.86677 14.0449 7.02539C14.3108 7.18403 14.5287 7.41215 14.6758 7.68457L14.959 8.20898C15.0118 8.30688 15.091 8.38929 15.1865 8.44629C15.2819 8.50306 15.391 8.53318 15.502 8.5332H16.667C17.1222 8.53327 17.559 8.71425 17.8809 9.03613C18.2026 9.358 18.3837 9.79488 18.3838 10.25V15.5C18.3837 15.9551 18.2026 16.392 17.8809 16.7139C17.559 17.0356 17.1221 17.2167 16.667 17.2168H7.33398C6.87885 17.2168 6.44202 17.0356 6.12012 16.7139C5.79826 16.392 5.61727 15.9552 5.61719 15.5V10.25C5.61725 9.7948 5.79824 9.35801 6.12012 9.03613C6.44203 8.71435 6.87881 8.5332 7.33398 8.5332H8.49902C8.60992 8.53309 8.71917 8.50306 8.81445 8.44629C8.90975 8.38943 8.98818 8.30756 9.04102 8.20996L9.32617 7.68262L9.38477 7.58301C9.5287 7.35525 9.72468 7.16391 9.95703 7.02539C10.2227 6.86717 10.5267 6.7832 10.8359 6.7832H13.165ZM10.8359 7.88281C10.725 7.88281 10.6158 7.91305 10.5205 7.96973C10.4491 8.0123 10.3867 8.06908 10.3379 8.13574L10.2939 8.20605L10.0088 8.7334C9.86159 9.00537 9.64259 9.23229 9.37695 9.39062C9.1114 9.54883 8.80812 9.6327 8.49902 9.63281H7.33398C7.17055 9.63281 7.01309 9.69798 6.89746 9.81348C6.78187 9.92907 6.71686 10.0865 6.7168 10.25V15.5C6.71688 15.6634 6.78199 15.82 6.89746 15.9355C7.01311 16.0512 7.17043 16.1162 7.33398 16.1162H16.667C16.8305 16.1161 16.9879 16.0511 17.1035 15.9355C17.2187 15.82 17.2831 15.6632 17.2832 15.5V10.25C17.2831 10.0866 17.219 9.92905 17.1035 9.81348C16.9879 9.69789 16.8305 9.63288 16.667 9.63281H15.502C15.1923 9.63279 14.888 9.54924 14.6221 9.39062C14.3563 9.23197 14.1382 9.00385 13.9912 8.73145L13.708 8.20703C13.6552 8.10921 13.5769 8.0267 13.4814 7.96973C13.386 7.91277 13.2762 7.88285 13.165 7.88281H10.8359ZM12 10.2832C13.2702 10.2832 14.2997 11.3129 14.2998 12.583C14.2998 13.8533 13.2703 14.8828 12 14.8828C10.7297 14.8828 9.7002 13.8533 9.7002 12.583C9.70033 11.3129 10.7298 10.2832 12 10.2832ZM12 11.3828C11.3373 11.3828 10.7999 11.9204 10.7998 12.583C10.7998 13.2457 11.3373 13.7832 12 13.7832C12.6627 13.7832 13.2002 13.2457 13.2002 12.583C13.2001 11.9204 12.6627 11.3828 12 11.3828Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/controls-loop.svg b/apps/web/src/assets/icons/controls-loop.svgnew file mode 100644index 00000000..e72a8ac9--- /dev/null+++ b/apps/web/src/assets/icons/controls-loop.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.17262 6.78789C8.35287 6.60765 8.35287 6.31542 8.17262 6.13518C7.99238 5.95494 7.70015 5.95494 7.51991 6.13518L5.67376 7.98134C5.49351 8.16158 5.49351 8.45381 5.67376 8.63405L7.51991 10.4802C7.70015 10.6604 7.99238 10.6604 8.17262 10.4802C8.35287 10.3 8.35287 10.0077 8.17262 9.82749L7.11437 8.76923H13.8463C15.6306 8.76923 17.077 10.2157 17.077 12C17.077 12.2549 17.2837 12.4615 17.5386 12.4615C17.7934 12.4615 18.0001 12.2549 18.0001 12C18.0001 9.7059 16.1404 7.84615 13.8463 7.84615H7.11437L8.17262 6.78789ZM6.92319 12C6.92319 11.7451 6.71655 11.5385 6.46165 11.5385C6.20675 11.5385 6.00011 11.7451 6.00011 12C6.00011 14.2941 7.85985 16.1538 10.154 16.1538H16.8859L15.8276 17.2121C15.6474 17.3923 15.6474 17.6846 15.8276 17.8649C16.0078 18.045 16.3001 18.045 16.4804 17.8649L18.3265 16.0187C18.5067 15.8384 18.5067 15.5462 18.3265 15.3659L16.4804 13.5198C16.3001 13.3396 16.0078 13.3396 15.8276 13.5198C15.6474 13.7 15.6474 13.9923 15.8276 14.1725L16.8859 15.2308H10.154C8.36965 15.2308 6.92319 13.7843 6.92319 12Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/controls-no-loop.svg b/apps/web/src/assets/icons/controls-no-loop.svgnew file mode 100644index 00000000..3c201cff--- /dev/null+++ b/apps/web/src/assets/icons/controls-no-loop.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2829_29245)">+<path d="M14.9115 6.14793C15.0612 5.91961 15.3678 5.85617 15.5961 6.00593C15.8242 6.15579 15.8877 6.46249 15.738 6.69081L8.42531 17.846C8.27558 18.0744 7.96902 18.1387 7.74068 17.9889C7.51245 17.8391 7.44903 17.5324 7.59873 17.3041L14.9115 6.14793ZM15.8269 13.5193C16.0071 13.3391 16.2994 13.3391 16.4796 13.5193L18.325 15.3653C18.5051 15.5456 18.5051 15.838 18.325 16.0183L16.4796 17.8643C16.2994 18.0445 16.0071 18.0445 15.8269 17.8643C15.6468 17.684 15.6468 17.3916 15.8269 17.2113L16.8852 16.1536H11.8456C11.4786 16.1535 11.2583 15.7458 11.4593 15.4387C11.5446 15.3086 11.69 15.2301 11.8456 15.2301H16.8852L15.8269 14.1714C15.6469 13.9911 15.6469 13.6996 15.8269 13.5193ZM6.46315 11.5371C6.71777 11.5374 6.92375 11.7441 6.92375 11.9989C6.92376 12.8207 7.23297 13.569 7.73875 14.1385C7.89418 14.3139 7.93261 14.5722 7.80441 14.7684C7.65088 15.0028 7.32558 15.0533 7.1333 14.8495C6.43157 14.1055 6.00158 13.1025 6.00158 11.9989C6.00158 11.7439 6.20831 11.5371 6.46315 11.5371ZM15.7844 8.84012C15.921 8.63177 16.2001 8.56817 16.3966 8.7213C17.3714 9.48145 17.9986 10.6666 17.9986 11.9989C17.9986 12.2538 17.7918 12.4606 17.537 12.4606C17.2824 12.4604 17.0764 12.2537 17.0764 11.9989C17.0764 10.9995 16.6224 10.1061 15.9099 9.51341C15.7102 9.34732 15.642 9.05737 15.7844 8.84012ZM7.52051 6.13344C7.70072 5.95321 7.99309 5.95318 8.17328 6.13344C8.35327 6.31364 8.35321 6.60524 8.17328 6.78548L7.11495 7.84419H11.4893C11.8562 7.84434 12.0758 8.25201 11.8745 8.55902C11.7893 8.68902 11.6447 8.76761 11.4893 8.76767H7.11495L8.17328 9.82639C8.35325 10.0066 8.35323 10.2982 8.17328 10.4784C7.99309 10.6587 7.70072 10.6587 7.52051 10.4784L5.67519 8.63243C5.49499 8.45217 5.49499 8.1597 5.67519 7.97943L7.52051 6.13344Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2829_29245">+<rect width="14" height="14" fill="white" transform="translate(5 5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/controls-pause.svg b/apps/web/src/assets/icons/controls-pause.svgnew file mode 100644index 00000000..df35f1e1--- /dev/null+++ b/apps/web/src/assets/icons/controls-pause.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.5502 7.24922C10.5502 6.94547 10.304 6.69922 10.0002 6.69922C9.69644 6.69922 9.4502 6.94547 9.4502 7.24922V16.7492C9.4502 17.0529 9.69644 17.2992 10.0002 17.2992C10.304 17.2992 10.5502 17.0529 10.5502 16.7492V7.24922ZM14.5502 7.24922C14.5502 6.94547 14.304 6.69922 14.0002 6.69922C13.6964 6.69922 13.4502 6.94547 13.4502 7.24922V16.7492C13.4502 17.0529 13.6964 17.2992 14.0002 17.2992C14.304 17.2992 14.5502 17.0529 14.5502 16.7492V7.24922Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/controls-play.svg b/apps/web/src/assets/icons/controls-play.svgnew file mode 100644index 00000000..f57d991b--- /dev/null+++ b/apps/web/src/assets/icons/controls-play.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.25131 6.57463C7.40728 6.48059 7.60109 6.47507 7.76216 6.56008L17.1153 11.4965C17.2857 11.5864 17.3924 11.7633 17.3924 11.956C17.3924 12.1487 17.2857 12.3256 17.1153 12.4155L7.76216 17.3519C7.60109 17.4369 7.40728 17.4314 7.25131 17.3374C7.09535 17.2433 7 17.0744 7 16.8924V7.01962C7 6.8375 7.09535 6.66867 7.25131 6.57463ZM8.03924 7.88141V16.0305L15.7595 11.956L8.03924 7.88141Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/controls-speed.svg b/apps/web/src/assets/icons/controls-speed.svgnew file mode 100644index 00000000..4439033e--- /dev/null+++ b/apps/web/src/assets/icons/controls-speed.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2484_173414)">+<path d="M12 5.75C15.4518 5.75 18.25 8.54822 18.25 12C18.25 15.4518 15.4518 18.25 12 18.25C8.54822 18.25 5.75 15.4518 5.75 12C5.75 8.54822 8.54822 5.75 12 5.75ZM12 6.75C9.10051 6.75 6.75 9.10051 6.75 12C6.75 14.8995 9.10051 17.25 12 17.25C14.8995 17.25 17.25 14.8995 17.25 12C17.25 9.10051 14.8995 6.75 12 6.75ZM14.6914 8.88574C14.812 8.79942 14.9771 8.81307 15.082 8.91797C15.1869 9.02287 15.2006 9.18798 15.1143 9.30859L12.7646 12.583C12.4169 13.067 11.7184 13.1247 11.2969 12.7031C10.8754 12.2816 10.933 11.5831 11.417 11.2354L14.6914 8.88574Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2484_173414">+<rect width="14" height="14" fill="white" transform="translate(5 5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/controls-split.svg b/apps/web/src/assets/icons/controls-split.svgnew file mode 100644index 00000000..bf7b3923--- /dev/null+++ b/apps/web/src/assets/icons/controls-split.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 5.37891C12.2552 5.37891 12.4619 5.58664 12.4619 5.8418V18.1621C12.4615 18.4169 12.2549 18.624 12 18.624C11.7451 18.624 11.5385 18.4169 11.5381 18.1621V5.8418C11.5381 5.58664 11.7448 5.37891 12 5.37891ZM9.68945 6.91992C9.94457 6.91996 10.1514 7.12671 10.1514 7.38184C10.1514 7.63697 9.94457 7.84371 9.68945 7.84375H7.8418C7.69573 7.84384 7.50167 7.92764 7.33203 8.10938C7.16428 8.28916 7.07129 8.51154 7.07129 8.70215V15.3018C7.07129 15.4924 7.16428 15.7147 7.33203 15.8945C7.50164 16.0762 7.69576 16.1601 7.8418 16.1602H9.68945C9.94457 16.1602 10.1514 16.3669 10.1514 16.6221C10.1512 16.8771 9.94449 17.0839 9.68945 17.084H7.8418C7.37201 17.0839 6.94845 16.8375 6.65625 16.5244C6.36226 16.2092 6.14746 15.7709 6.14746 15.3018V8.70215C6.14746 8.23305 6.36232 7.79465 6.65625 7.47949C6.94845 7.16642 7.37201 6.92001 7.8418 6.91992H9.68945ZM16.1562 6.91992C16.6261 6.91992 17.0495 7.16642 17.3418 7.47949C17.6358 7.79465 17.8506 8.23301 17.8506 8.70215V15.3018C17.8506 15.771 17.6358 16.2092 17.3418 16.5244C17.0495 16.8375 16.6261 17.084 16.1562 17.084H14.3086C14.0536 17.0839 13.8468 16.877 13.8467 16.6221C13.8467 16.367 14.0536 16.1603 14.3086 16.1602H16.1562C16.3023 16.1602 16.4963 16.0762 16.666 15.8945C16.8338 15.7147 16.9268 15.4924 16.9268 15.3018V8.70215C16.9268 8.5115 16.8338 8.28918 16.666 8.10938C16.4963 7.9276 16.3023 7.84375 16.1562 7.84375H14.3086C14.0536 7.84362 13.8467 7.63691 13.8467 7.38184C13.8467 7.12676 14.0536 6.92005 14.3086 6.91992H16.1562Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/corner-radius-all-separate.svg b/apps/web/src/assets/icons/corner-radius-all-separate.svgnew file mode 100644index 00000000..70bb0bb0--- /dev/null+++ b/apps/web/src/assets/icons/corner-radius-all-separate.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10 6.5H9.37935C8.97687 6.49999 8.64469 6.49999 8.37409 6.5221C8.09304 6.54506 7.83469 6.59434 7.59202 6.71799C7.2157 6.90973 6.90973 7.2157 6.71799 7.59202C6.59434 7.83469 6.54506 8.09304 6.5221 8.37409C6.49999 8.64468 6.49999 8.97686 6.5 9.37933V10C6.5 10.2761 6.72386 10.5 7 10.5C7.27614 10.5 7.5 10.2761 7.5 10V9.4C7.5 8.97171 7.50039 8.68056 7.51878 8.45552C7.53669 8.23631 7.56915 8.12421 7.60899 8.04601C7.70487 7.85785 7.85785 7.70487 8.04601 7.60899C8.12421 7.56915 8.23631 7.53669 8.45552 7.51878C8.68056 7.50039 8.97171 7.5 9.4 7.5H10C10.2761 7.5 10.5 7.27614 10.5 7C10.5 6.72386 10.2761 6.5 10 6.5ZM17.5 14C17.5 13.7239 17.2761 13.5 17 13.5C16.7239 13.5 16.5 13.7239 16.5 14V14.6C16.5 15.0283 16.4996 15.3194 16.4812 15.5445C16.4633 15.7637 16.4309 15.8758 16.391 15.954C16.2951 16.1422 16.1422 16.2951 15.954 16.391C15.8758 16.4309 15.7637 16.4633 15.5445 16.4812C15.3194 16.4996 15.0283 16.5 14.6 16.5H14C13.7239 16.5 13.5 16.7239 13.5 17C13.5 17.2761 13.7239 17.5 14 17.5H14.6206C15.0231 17.5 15.3553 17.5 15.6259 17.4779C15.907 17.4549 16.1653 17.4057 16.408 17.282C16.7843 17.0903 17.0903 16.7843 17.282 16.408C17.4057 16.1653 17.4549 15.907 17.4779 15.6259C17.5 15.3553 17.5 15.0232 17.5 14.6207V14ZM7 13.5C7.27614 13.5 7.5 13.7239 7.5 14V14.6C7.5 15.0283 7.50039 15.3194 7.51878 15.5445C7.53669 15.7637 7.56915 15.8758 7.60899 15.954C7.70487 16.1422 7.85785 16.2951 8.04601 16.391C8.12421 16.4309 8.23631 16.4633 8.45552 16.4812C8.68056 16.4996 8.97171 16.5 9.4 16.5H10C10.2761 16.5 10.5 16.7239 10.5 17C10.5 17.2761 10.2761 17.5 10 17.5H9.37935C8.97687 17.5 8.64469 17.5 8.37409 17.4779C8.09304 17.4549 7.83469 17.4057 7.59202 17.282C7.2157 17.0903 6.90973 16.7843 6.71799 16.408C6.59434 16.1653 6.54506 15.907 6.5221 15.6259C6.49999 15.3553 6.49999 15.0231 6.5 14.6207V14.6V14C6.5 13.7239 6.72386 13.5 7 13.5ZM14.6 7.5C15.0283 7.5 15.3194 7.50039 15.5445 7.51878C15.7637 7.53669 15.8758 7.56915 15.954 7.60899C16.1422 7.70487 16.2951 7.85785 16.391 8.04601C16.4309 8.12421 16.4633 8.23631 16.4812 8.45552C16.4996 8.68056 16.5 8.97171 16.5 9.4V10C16.5 10.2761 16.7239 10.5 17 10.5C17.2761 10.5 17.5 10.2761 17.5 10V9.37935C17.5 8.97687 17.5 8.64468 17.4779 8.37409C17.4549 8.09304 17.4057 7.83469 17.282 7.59202C17.0903 7.2157 16.7843 6.90973 16.408 6.71799C16.1653 6.59434 15.907 6.54506 15.6259 6.5221C15.3553 6.49999 15.0231 6.49999 14.6206 6.5H14.6H14C13.7239 6.5 13.5 6.72386 13.5 7C13.5 7.27614 13.7239 7.5 14 7.5H14.6Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/corner-radius-all-single.svg b/apps/web/src/assets/icons/corner-radius-all-single.svgnew file mode 100644index 00000000..54afcb1c--- /dev/null+++ b/apps/web/src/assets/icons/corner-radius-all-single.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.5 14.5996C7.5 15.0279 7.50016 15.3198 7.51855 15.5449C7.53647 15.7639 7.56956 15.8759 7.60938 15.9541C7.70522 16.1421 7.85793 16.2948 8.0459 16.3906C8.12405 16.4305 8.23614 16.4635 8.45508 16.4814C8.68012 16.4998 8.9721 16.5 9.40039 16.5H14.5996C15.0279 16.5 15.3198 16.4998 15.5449 16.4814C15.7639 16.4635 15.8759 16.4305 15.9541 16.3906C16.1421 16.2948 16.2948 16.1421 16.3906 15.9541C16.4305 15.8759 16.4635 15.7639 16.4814 15.5449C16.4998 15.3198 16.5 15.0279 16.5 14.5996V9.40039C16.5 8.9721 16.4998 8.68012 16.4814 8.45508C16.4635 8.23614 16.4305 8.12405 16.3906 8.0459C16.2948 7.85793 16.1421 7.70522 15.9541 7.60938C15.8759 7.56956 15.7639 7.53647 15.5449 7.51855C15.3198 7.50016 15.0279 7.5 14.5996 7.5H9.40039C8.9721 7.5 8.68012 7.50016 8.45508 7.51855C8.23615 7.53647 8.12405 7.56956 8.0459 7.60938C7.85793 7.70522 7.70522 7.85793 7.60938 8.0459C7.56956 8.12405 7.53647 8.23615 7.51855 8.45508C7.50016 8.68012 7.5 8.9721 7.5 9.40039V14.5996ZM17.5 14.6211C17.5 15.0234 17.4996 15.3555 17.4775 15.626C17.4545 15.907 17.4059 16.1655 17.2822 16.4082C17.0905 16.7844 16.7844 17.0905 16.4082 17.2822C16.1655 17.4059 15.907 17.4545 15.626 17.4775C15.3554 17.4996 15.0226 17.5 14.6201 17.5H9.37891C8.97663 17.5 8.64452 17.4996 8.37402 17.4775C8.09301 17.4545 7.83444 17.4059 7.5918 17.2822C7.21554 17.0905 6.9095 16.7844 6.71777 16.4082C6.59414 16.1655 6.54542 15.907 6.52246 15.626C6.50036 15.3555 6.49999 15.0233 6.5 14.6211V9.37891C6.49999 8.97663 6.50036 8.64452 6.52246 8.37402C6.54542 8.09301 6.59414 7.83444 6.71777 7.5918C6.9095 7.21555 7.21555 6.9095 7.5918 6.71777C7.83444 6.59414 8.09301 6.54542 8.37402 6.52246C8.64452 6.50036 8.97663 6.49999 9.37891 6.5H14.6201C15.0226 6.49999 15.3554 6.50035 15.626 6.52246C15.907 6.54542 16.1655 6.59414 16.4082 6.71777C16.7844 6.9095 17.0905 7.21554 17.2822 7.5918C17.4059 7.83444 17.4545 8.09301 17.4775 8.37402C17.4996 8.64451 17.5 8.97663 17.5 9.37891V14.6211Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/corner-radius-all.svg b/apps/web/src/assets/icons/corner-radius-all.svgnew file mode 100644index 00000000..cca07b42--- /dev/null+++ b/apps/web/src/assets/icons/corner-radius-all.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.3636 7.5H9.85583C9.52653 7.49999 9.25475 7.49999 9.03335 7.51808C8.8034 7.53687 8.59202 7.57719 8.39347 7.67836C8.08557 7.83523 7.83523 8.08557 7.67836 8.39347C7.57719 8.59202 7.53687 8.8034 7.51808 9.03335C7.49999 9.25474 7.49999 9.52652 7.5 9.85582V10.3636C7.5 10.5896 7.68316 10.7727 7.90909 10.7727C8.13502 10.7727 8.31818 10.5896 8.31818 10.3636V9.87273C8.31818 9.52231 8.3185 9.28409 8.33355 9.09997C8.3482 8.92062 8.37476 8.8289 8.40736 8.76492C8.4858 8.61097 8.61097 8.4858 8.76492 8.40736C8.8289 8.37476 8.92062 8.3482 9.09997 8.33355C9.28409 8.3185 9.52231 8.31818 9.87273 8.31818H10.3636C10.5896 8.31818 10.7727 8.13502 10.7727 7.90909C10.7727 7.68316 10.5896 7.5 10.3636 7.5ZM16.5 13.6364C16.5 13.4104 16.3168 13.2273 16.0909 13.2273C15.865 13.2273 15.6818 13.4104 15.6818 13.6364V14.1273C15.6818 14.4777 15.6815 14.7159 15.6664 14.9C15.6518 15.0794 15.6253 15.1711 15.5926 15.2351C15.5142 15.3891 15.3891 15.5142 15.2351 15.5926C15.1711 15.6253 15.0794 15.6518 14.9 15.6664C14.7159 15.6815 14.4777 15.6818 14.1273 15.6818H13.6364C13.4104 15.6818 13.2273 15.865 13.2273 16.0909C13.2273 16.3168 13.4104 16.5 13.6364 16.5H14.1441C14.4734 16.5 14.7452 16.5 14.9666 16.4819C15.1966 16.4631 15.408 16.4228 15.6065 16.3216C15.9144 16.1648 16.1648 15.9144 16.3216 15.6065C16.4228 15.408 16.4631 15.1966 16.4819 14.9666C16.5 14.7452 16.5 14.4735 16.5 14.1442V13.6364ZM7.90909 13.2273C8.13502 13.2273 8.31818 13.4104 8.31818 13.6364V14.1273C8.31818 14.4777 8.3185 14.7159 8.33355 14.9C8.3482 15.0794 8.37476 15.1711 8.40736 15.2351C8.4858 15.3891 8.61097 15.5142 8.76492 15.5926C8.8289 15.6253 8.92062 15.6518 9.09997 15.6664C9.28409 15.6815 9.52231 15.6818 9.87273 15.6818H10.3636C10.5896 15.6818 10.7727 15.865 10.7727 16.0909C10.7727 16.3168 10.5896 16.5 10.3636 16.5H9.85583C9.52653 16.5 9.25475 16.5 9.03335 16.4819C8.8034 16.4631 8.59202 16.4228 8.39347 16.3216C8.08557 16.1648 7.83523 15.9144 7.67836 15.6065C7.57719 15.408 7.53687 15.1966 7.51808 14.9666C7.49999 14.7452 7.49999 14.4734 7.5 14.1442V14.1273V13.6364C7.5 13.4104 7.68316 13.2273 7.90909 13.2273ZM14.1273 8.31818C14.4777 8.31818 14.7159 8.3185 14.9 8.33355C15.0794 8.3482 15.1711 8.37476 15.2351 8.40736C15.3891 8.4858 15.5142 8.61097 15.5926 8.76492C15.6253 8.8289 15.6518 8.92062 15.6664 9.09997C15.6815 9.28409 15.6818 9.52231 15.6818 9.87273V10.3636C15.6818 10.5896 15.865 10.7727 16.0909 10.7727C16.3168 10.7727 16.5 10.5896 16.5 10.3636V9.85583C16.5 9.52653 16.5 9.25474 16.4819 9.03335C16.4631 8.8034 16.4228 8.59202 16.3216 8.39347C16.1648 8.08557 15.9144 7.83523 15.6065 7.67836C15.408 7.57719 15.1966 7.53687 14.9666 7.51808C14.7452 7.49999 14.4734 7.49999 14.1441 7.5H14.1273H13.6364C13.4104 7.5 13.2273 7.68316 13.2273 7.90909C13.2273 8.13502 13.4104 8.31818 13.6364 8.31818H14.1273Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/corner-radius-bottom-left.svg b/apps/web/src/assets/icons/corner-radius-bottom-left.svgnew file mode 100644index 00000000..484a4ac7--- /dev/null+++ b/apps/web/src/assets/icons/corner-radius-bottom-left.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" fill-rule="evenodd" clip-rule="evenodd" d="M10 6.5H9.37935C8.97687 6.49999 8.64469 6.49999 8.37409 6.5221C8.09304 6.54506 7.83469 6.59434 7.59202 6.71799C7.2157 6.90973 6.90973 7.2157 6.71799 7.59202C6.59434 7.83469 6.54506 8.09304 6.5221 8.37409C6.49999 8.64468 6.49999 8.97686 6.5 9.37933V10C6.5 10.2761 6.72386 10.5 7 10.5C7.27614 10.5 7.5 10.2761 7.5 10V9.4C7.5 8.97171 7.50039 8.68056 7.51878 8.45552C7.53669 8.23631 7.56915 8.12421 7.60899 8.04601C7.70487 7.85785 7.85785 7.70487 8.04601 7.60899C8.12421 7.56915 8.23631 7.53669 8.45552 7.51878C8.68056 7.50039 8.97171 7.5 9.4 7.5H10C10.2761 7.5 10.5 7.27614 10.5 7C10.5 6.72386 10.2761 6.5 10 6.5ZM17.5 14C17.5 13.7239 17.2761 13.5 17 13.5C16.7239 13.5 16.5 13.7239 16.5 14V14.6C16.5 15.0283 16.4996 15.3194 16.4812 15.5445C16.4633 15.7637 16.4309 15.8758 16.391 15.954C16.2951 16.1422 16.1422 16.2951 15.954 16.391C15.8758 16.4309 15.7637 16.4633 15.5445 16.4812C15.3194 16.4996 15.0283 16.5 14.6 16.5H14C13.7239 16.5 13.5 16.7239 13.5 17C13.5 17.2761 13.7239 17.5 14 17.5H14.6206C15.0231 17.5 15.3553 17.5 15.6259 17.4779C15.907 17.4549 16.1653 17.4057 16.408 17.282C16.7843 17.0903 17.0903 16.7843 17.282 16.408C17.4057 16.1653 17.4549 15.907 17.4779 15.6259C17.5 15.3553 17.5 15.0232 17.5 14.6207V14ZM14.6 7.5C15.0283 7.5 15.3194 7.50039 15.5445 7.51878C15.7637 7.53669 15.8758 7.56915 15.954 7.60899C16.1422 7.70487 16.2951 7.85785 16.391 8.04601C16.4309 8.12421 16.4633 8.23631 16.4812 8.45552C16.4996 8.68056 16.5 8.97171 16.5 9.4V10C16.5 10.2761 16.7239 10.5 17 10.5C17.2761 10.5 17.5 10.2761 17.5 10V9.37935C17.5 8.97687 17.5 8.64468 17.4779 8.37409C17.4549 8.09304 17.4057 7.83469 17.282 7.59202C17.0903 7.2157 16.7843 6.90973 16.408 6.71799C16.1653 6.59434 15.907 6.54506 15.6259 6.5221C15.3553 6.49999 15.0231 6.49999 14.6206 6.5H14.6H14C13.7239 6.5 13.5 6.72386 13.5 7C13.5 7.27614 13.7239 7.5 14 7.5H14.6Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M7 13.5C7.27614 13.5 7.5 13.7239 7.5 14V14.6C7.5 15.0283 7.50039 15.3194 7.51878 15.5445C7.53669 15.7637 7.56915 15.8758 7.60899 15.954C7.70487 16.1422 7.85785 16.2951 8.04601 16.391C8.12421 16.4309 8.23631 16.4633 8.45552 16.4812C8.68056 16.4996 8.97171 16.5 9.4 16.5H10C10.2761 16.5 10.5 16.7239 10.5 17C10.5 17.2761 10.2761 17.5 10 17.5H9.37935C8.97687 17.5 8.64469 17.5 8.37409 17.4779C8.09304 17.4549 7.83469 17.4057 7.59202 17.282C7.2157 17.0903 6.90973 16.7843 6.71799 16.408C6.59434 16.1653 6.54506 15.907 6.5221 15.6259C6.49999 15.3553 6.49999 15.0231 6.5 14.6207V14.6V14C6.5 13.7239 6.72386 13.5 7 13.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/corner-radius-bottom-right.svg b/apps/web/src/assets/icons/corner-radius-bottom-right.svgnew file mode 100644index 00000000..6e14a0a8--- /dev/null+++ b/apps/web/src/assets/icons/corner-radius-bottom-right.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" fill-rule="evenodd" clip-rule="evenodd" d="M10 6.5H9.37935C8.97687 6.49999 8.64469 6.49999 8.37409 6.5221C8.09304 6.54506 7.83469 6.59434 7.59202 6.71799C7.2157 6.90973 6.90973 7.2157 6.71799 7.59202C6.59434 7.83469 6.54506 8.09304 6.5221 8.37409C6.49999 8.64468 6.49999 8.97686 6.5 9.37933V10C6.5 10.2761 6.72386 10.5 7 10.5C7.27614 10.5 7.5 10.2761 7.5 10V9.4C7.5 8.97171 7.50039 8.68056 7.51878 8.45552C7.53669 8.23631 7.56915 8.12421 7.60899 8.04601C7.70487 7.85785 7.85785 7.70487 8.04601 7.60899C8.12421 7.56915 8.23631 7.53669 8.45552 7.51878C8.68056 7.50039 8.97171 7.5 9.4 7.5H10C10.2761 7.5 10.5 7.27614 10.5 7C10.5 6.72386 10.2761 6.5 10 6.5ZM7 13.5C7.27614 13.5 7.5 13.7239 7.5 14V14.6C7.5 15.0283 7.50039 15.3194 7.51878 15.5445C7.53669 15.7637 7.56915 15.8758 7.60899 15.954C7.70487 16.1422 7.85785 16.2951 8.04601 16.391C8.12421 16.4309 8.23631 16.4633 8.45552 16.4812C8.68056 16.4996 8.97171 16.5 9.4 16.5H10C10.2761 16.5 10.5 16.7239 10.5 17C10.5 17.2761 10.2761 17.5 10 17.5H9.37935C8.97687 17.5 8.64469 17.5 8.37409 17.4779C8.09304 17.4549 7.83469 17.4057 7.59202 17.282C7.2157 17.0903 6.90973 16.7843 6.71799 16.408C6.59434 16.1653 6.54506 15.907 6.5221 15.6259C6.49999 15.3553 6.49999 15.0231 6.5 14.6207V14.6V14C6.5 13.7239 6.72386 13.5 7 13.5ZM14.6 7.5C15.0283 7.5 15.3194 7.50039 15.5445 7.51878C15.7637 7.53669 15.8758 7.56915 15.954 7.60899C16.1422 7.70487 16.2951 7.85785 16.391 8.04601C16.4309 8.12421 16.4633 8.23631 16.4812 8.45552C16.4996 8.68056 16.5 8.97171 16.5 9.4V10C16.5 10.2761 16.7239 10.5 17 10.5C17.2761 10.5 17.5 10.2761 17.5 10V9.37935C17.5 8.97687 17.5 8.64468 17.4779 8.37409C17.4549 8.09304 17.4057 7.83469 17.282 7.59202C17.0903 7.2157 16.7843 6.90973 16.408 6.71799C16.1653 6.59434 15.907 6.54506 15.6259 6.5221C15.3553 6.49999 15.0231 6.49999 14.6206 6.5H14.6H14C13.7239 6.5 13.5 6.72386 13.5 7C13.5 7.27614 13.7239 7.5 14 7.5H14.6Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5 14C17.5 13.7239 17.2761 13.5 17 13.5C16.7239 13.5 16.5 13.7239 16.5 14V14.6C16.5 15.0283 16.4996 15.3194 16.4812 15.5445C16.4633 15.7637 16.4309 15.8758 16.391 15.954C16.2951 16.1422 16.1422 16.2951 15.954 16.391C15.8758 16.4309 15.7637 16.4633 15.5445 16.4812C15.3194 16.4996 15.0283 16.5 14.6 16.5H14C13.7239 16.5 13.5 16.7239 13.5 17C13.5 17.2761 13.7239 17.5 14 17.5H14.6206C15.0231 17.5 15.3553 17.5 15.6259 17.4779C15.907 17.4549 16.1653 17.4057 16.408 17.282C16.7843 17.0903 17.0903 16.7843 17.282 16.408C17.4057 16.1653 17.4549 15.907 17.4779 15.6259C17.5 15.3553 17.5 15.0232 17.5 14.6207V14Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/corner-radius-top-left.svg b/apps/web/src/assets/icons/corner-radius-top-left.svgnew file mode 100644index 00000000..17973013--- /dev/null+++ b/apps/web/src/assets/icons/corner-radius-top-left.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" fill-rule="evenodd" clip-rule="evenodd" d="M17.5 14C17.5 13.7239 17.2761 13.5 17 13.5C16.7239 13.5 16.5 13.7239 16.5 14V14.6C16.5 15.0283 16.4996 15.3194 16.4812 15.5445C16.4633 15.7637 16.4309 15.8758 16.391 15.954C16.2951 16.1422 16.1422 16.2951 15.954 16.391C15.8758 16.4309 15.7637 16.4633 15.5445 16.4812C15.3194 16.4996 15.0283 16.5 14.6 16.5H14C13.7239 16.5 13.5 16.7239 13.5 17C13.5 17.2761 13.7239 17.5 14 17.5H14.6206C15.0231 17.5 15.3553 17.5 15.6259 17.4779C15.907 17.4549 16.1653 17.4057 16.408 17.282C16.7843 17.0903 17.0903 16.7843 17.282 16.408C17.4057 16.1653 17.4549 15.907 17.4779 15.6259C17.5 15.3553 17.5 15.0232 17.5 14.6207V14ZM7 13.5C7.27614 13.5 7.5 13.7239 7.5 14V14.6C7.5 15.0283 7.50039 15.3194 7.51878 15.5445C7.53669 15.7637 7.56915 15.8758 7.60899 15.954C7.70487 16.1422 7.85785 16.2951 8.04601 16.391C8.12421 16.4309 8.23631 16.4633 8.45552 16.4812C8.68056 16.4996 8.97171 16.5 9.4 16.5H10C10.2761 16.5 10.5 16.7239 10.5 17C10.5 17.2761 10.2761 17.5 10 17.5H9.37935C8.97687 17.5 8.64469 17.5 8.37409 17.4779C8.09304 17.4549 7.83469 17.4057 7.59202 17.282C7.2157 17.0903 6.90973 16.7843 6.71799 16.408C6.59434 16.1653 6.54506 15.907 6.5221 15.6259C6.49999 15.3553 6.49999 15.0231 6.5 14.6207V14.6V14C6.5 13.7239 6.72386 13.5 7 13.5ZM14.6 7.5C15.0283 7.5 15.3194 7.50039 15.5445 7.51878C15.7637 7.53669 15.8758 7.56915 15.954 7.60899C16.1422 7.70487 16.2951 7.85785 16.391 8.04601C16.4309 8.12421 16.4633 8.23631 16.4812 8.45552C16.4996 8.68056 16.5 8.97171 16.5 9.4V10C16.5 10.2761 16.7239 10.5 17 10.5C17.2761 10.5 17.5 10.2761 17.5 10V9.37935C17.5 8.97687 17.5 8.64468 17.4779 8.37409C17.4549 8.09304 17.4057 7.83469 17.282 7.59202C17.0903 7.2157 16.7843 6.90973 16.408 6.71799C16.1653 6.59434 15.907 6.54506 15.6259 6.5221C15.3553 6.49999 15.0231 6.49999 14.6206 6.5H14.6H14C13.7239 6.5 13.5 6.72386 13.5 7C13.5 7.27614 13.7239 7.5 14 7.5H14.6Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M10 6.5H9.37935C8.97687 6.49999 8.64469 6.49999 8.37409 6.5221C8.09304 6.54506 7.83469 6.59434 7.59202 6.71799C7.2157 6.90973 6.90973 7.2157 6.71799 7.59202C6.59434 7.83469 6.54506 8.09304 6.5221 8.37409C6.49999 8.64468 6.49999 8.97686 6.5 9.37933V10C6.5 10.2761 6.72386 10.5 7 10.5C7.27614 10.5 7.5 10.2761 7.5 10V9.4C7.5 8.97171 7.50039 8.68056 7.51878 8.45552C7.53669 8.23631 7.56915 8.12421 7.60899 8.04601C7.70487 7.85785 7.85785 7.70487 8.04601 7.60899C8.12421 7.56915 8.23631 7.53669 8.45552 7.51878C8.68056 7.50039 8.97171 7.5 9.4 7.5H10C10.2761 7.5 10.5 7.27614 10.5 7C10.5 6.72386 10.2761 6.5 10 6.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/corner-radius-top-right.svg b/apps/web/src/assets/icons/corner-radius-top-right.svgnew file mode 100644index 00000000..38fced1c--- /dev/null+++ b/apps/web/src/assets/icons/corner-radius-top-right.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" fill-rule="evenodd" clip-rule="evenodd" d="M10 6.5H9.37935C8.97687 6.49999 8.64469 6.49999 8.37409 6.5221C8.09304 6.54506 7.83469 6.59434 7.59202 6.71799C7.2157 6.90973 6.90973 7.2157 6.71799 7.59202C6.59434 7.83469 6.54506 8.09304 6.5221 8.37409C6.49999 8.64468 6.49999 8.97686 6.5 9.37933V10C6.5 10.2761 6.72386 10.5 7 10.5C7.27614 10.5 7.5 10.2761 7.5 10V9.4C7.5 8.97171 7.50039 8.68056 7.51878 8.45552C7.53669 8.23631 7.56915 8.12421 7.60899 8.04601C7.70487 7.85785 7.85785 7.70487 8.04601 7.60899C8.12421 7.56915 8.23631 7.53669 8.45552 7.51878C8.68056 7.50039 8.97171 7.5 9.4 7.5H10C10.2761 7.5 10.5 7.27614 10.5 7C10.5 6.72386 10.2761 6.5 10 6.5ZM17.5 14C17.5 13.7239 17.2761 13.5 17 13.5C16.7239 13.5 16.5 13.7239 16.5 14V14.6C16.5 15.0283 16.4996 15.3194 16.4812 15.5445C16.4633 15.7637 16.4309 15.8758 16.391 15.954C16.2951 16.1422 16.1422 16.2951 15.954 16.391C15.8758 16.4309 15.7637 16.4633 15.5445 16.4812C15.3194 16.4996 15.0283 16.5 14.6 16.5H14C13.7239 16.5 13.5 16.7239 13.5 17C13.5 17.2761 13.7239 17.5 14 17.5H14.6206C15.0231 17.5 15.3553 17.5 15.6259 17.4779C15.907 17.4549 16.1653 17.4057 16.408 17.282C16.7843 17.0903 17.0903 16.7843 17.282 16.408C17.4057 16.1653 17.4549 15.907 17.4779 15.6259C17.5 15.3553 17.5 15.0232 17.5 14.6207V14ZM7 13.5C7.27614 13.5 7.5 13.7239 7.5 14V14.6C7.5 15.0283 7.50039 15.3194 7.51878 15.5445C7.53669 15.7637 7.56915 15.8758 7.60899 15.954C7.70487 16.1422 7.85785 16.2951 8.04601 16.391C8.12421 16.4309 8.23631 16.4633 8.45552 16.4812C8.68056 16.4996 8.97171 16.5 9.4 16.5H10C10.2761 16.5 10.5 16.7239 10.5 17C10.5 17.2761 10.2761 17.5 10 17.5H9.37935C8.97687 17.5 8.64469 17.5 8.37409 17.4779C8.09304 17.4549 7.83469 17.4057 7.59202 17.282C7.2157 17.0903 6.90973 16.7843 6.71799 16.408C6.59434 16.1653 6.54506 15.907 6.5221 15.6259C6.49999 15.3553 6.49999 15.0231 6.5 14.6207V14.6V14C6.5 13.7239 6.72386 13.5 7 13.5Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M14.6 7.5C15.0283 7.5 15.3194 7.50039 15.5445 7.51878C15.7637 7.53669 15.8758 7.56915 15.954 7.60899C16.1422 7.70487 16.2951 7.85785 16.391 8.04601C16.4309 8.12421 16.4633 8.23631 16.4812 8.45552C16.4996 8.68056 16.5 8.97171 16.5 9.4V10C16.5 10.2761 16.7239 10.5 17 10.5C17.2761 10.5 17.5 10.2761 17.5 10V9.37935C17.5 8.97687 17.5 8.64468 17.4779 8.37409C17.4549 8.09304 17.4057 7.83469 17.282 7.59202C17.0903 7.2157 16.7843 6.90973 16.408 6.71799C16.1653 6.59434 15.907 6.54506 15.6259 6.5221C15.3553 6.49999 15.0231 6.49999 14.6206 6.5H14.6H14C13.7239 6.5 13.5 6.72386 13.5 7C13.5 7.27614 13.7239 7.5 14 7.5H14.6Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/cursor-rotate-bottom-left.svg b/apps/web/src/assets/icons/cursor-rotate-bottom-left.svgnew file mode 100644index 00000000..73fbaae4--- /dev/null+++ b/apps/web/src/assets/icons/cursor-rotate-bottom-left.svg@@ -0,0 +1,22 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_325_78)">+<g filter="url(#filter0_d_325_78)">+<path d="M13 18C12.0807 18 11.1705 17.8189 10.3212 17.4672C9.47194 17.1154 8.70026 16.5998 8.05025 15.9497C7.40024 15.2997 6.88463 14.5281 6.53284 13.6788C6.18106 12.8295 6 11.9193 6 11L6 8L2 8L8 2L14 8L10 8L10 11C10 11.394 10.0776 11.7841 10.2284 12.1481C10.3791 12.512 10.6001 12.8427 10.8787 13.1213C11.1573 13.3999 11.488 13.6209 11.8519 13.7716C12.2159 13.9224 12.606 14 13 14L16 14L16 10L22 16L16 22L16 18L13 18Z" fill="white"/>+<path d="M13 15L17 15L17 12.5L20.5 16L17 19.5L17 17L13 17C12.2121 17 11.4318 16.8448 10.7039 16.5433C9.97594 16.2418 9.31451 15.7998 8.75736 15.2426C8.2002 14.6855 7.75825 14.0241 7.45672 13.2961C7.15519 12.5681 6.99999 11.7879 6.99999 11L6.99999 7L4.49999 7L7.99999 3.5L11.5 7L8.99999 7L8.99999 11C8.99999 11.5253 9.10346 12.0454 9.30448 12.5307C9.5055 13.016 9.80013 13.457 10.1716 13.8284C10.543 14.1999 10.984 14.4945 11.4693 14.6955C11.9546 14.8965 12.4747 15 13 15Z" fill="black"/>+</g>+</g>+<defs>+<filter id="filter0_d_325_78" x="0.2" y="1.2" width="23.6" height="23.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dy="1"/>+<feGaussianBlur stdDeviation="0.9"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_325_78"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_325_78" result="shape"/>+</filter>+<clipPath id="clip0_325_78">+<rect width="24" height="24" fill="white"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/cursor-rotate-bottom-right.svg b/apps/web/src/assets/icons/cursor-rotate-bottom-right.svgnew file mode 100644index 00000000..7e1325a9--- /dev/null+++ b/apps/web/src/assets/icons/cursor-rotate-bottom-right.svg@@ -0,0 +1,22 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_325_77)">+<g filter="url(#filter0_d_325_77)">+<path d="M18 11C18 11.9193 17.8189 12.8295 17.4672 13.6788C17.1154 14.5281 16.5998 15.2997 15.9497 15.9497C15.2997 16.5998 14.5281 17.1154 13.6788 17.4672C12.8295 17.8189 11.9193 18 11 18L8 18L8 22L2 16L8 10L8 14L11 14C11.394 14 11.7841 13.9224 12.148 13.7716C12.512 13.6209 12.8427 13.3999 13.1213 13.1213C13.3999 12.8427 13.6209 12.512 13.7716 12.148C13.9224 11.7841 14 11.394 14 11L14 8L10 8L16 2L22 8L18 8L18 11Z" fill="white"/>+<path d="M15 11L15 7L12.5 7L16 3.5L19.5 7L17 7L17 11C17 11.7879 16.8448 12.5682 16.5433 13.2961C16.2418 14.0241 15.7998 14.6855 15.2426 15.2426C14.6855 15.7998 14.0241 16.2418 13.2961 16.5433C12.5681 16.8448 11.7879 17 11 17L7 17L7 19.5L3.5 16L7 12.5L7 15L11 15C11.5253 15 12.0454 14.8965 12.5307 14.6955C13.016 14.4945 13.457 14.1999 13.8284 13.8284C14.1999 13.457 14.4945 13.016 14.6955 12.5307C14.8965 12.0454 15 11.5253 15 11Z" fill="black"/>+</g>+</g>+<defs>+<filter id="filter0_d_325_77" x="0.2" y="1.2" width="23.6" height="23.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dy="1"/>+<feGaussianBlur stdDeviation="0.9"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_325_77"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_325_77" result="shape"/>+</filter>+<clipPath id="clip0_325_77">+<rect width="24" height="24" fill="white"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/cursor-rotate-top-left.svg b/apps/web/src/assets/icons/cursor-rotate-top-left.svgnew file mode 100644index 00000000..a1e767b7--- /dev/null+++ b/apps/web/src/assets/icons/cursor-rotate-top-left.svg@@ -0,0 +1,22 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_325_79)">+<g filter="url(#filter0_d_325_79)">+<path d="M6 13C6 12.0807 6.18106 11.1705 6.53284 10.3212C6.88463 9.47194 7.40024 8.70026 8.05025 8.05025C8.70026 7.40024 9.47194 6.88463 10.3212 6.53284C11.1705 6.18106 12.0807 6 13 6L16 6L16 2L22 8L16 14L16 10L13 10C12.606 10 12.2159 10.0776 11.8519 10.2284C11.488 10.3791 11.1573 10.6001 10.8787 10.8787C10.6001 11.1573 10.3791 11.488 10.2284 11.8519C10.0776 12.2159 10 12.606 10 13L10 16L14 16L8 22L2 16L6 16L6 13Z" fill="white"/>+<path d="M9 13L9 17L11.5 17L8 20.5L4.5 17L7 17L7 13C7 12.2121 7.15519 11.4318 7.45672 10.7039C7.75825 9.97594 8.20021 9.31451 8.75736 8.75736C9.31451 8.2002 9.97594 7.75825 10.7039 7.45672C11.4319 7.15519 12.2121 6.99999 13 6.99999L17 6.99999L17 4.49999L20.5 7.99999L17 11.5L17 8.99999L13 8.99999C12.4747 8.99999 11.9546 9.10346 11.4693 9.30448C10.984 9.5055 10.543 9.80013 10.1716 10.1716C9.80014 10.543 9.5055 10.984 9.30448 11.4693C9.10346 11.9546 9 12.4747 9 13Z" fill="black"/>+</g>+</g>+<defs>+<filter id="filter0_d_325_79" x="0.2" y="1.2" width="23.6" height="23.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dy="1"/>+<feGaussianBlur stdDeviation="0.9"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_325_79"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_325_79" result="shape"/>+</filter>+<clipPath id="clip0_325_79">+<rect width="24" height="24" fill="white"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/cursor-rotate-top-right.svg b/apps/web/src/assets/icons/cursor-rotate-top-right.svgnew file mode 100644index 00000000..5e96b239--- /dev/null+++ b/apps/web/src/assets/icons/cursor-rotate-top-right.svg@@ -0,0 +1,22 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_325_17)">+<g filter="url(#filter0_d_325_17)">+<path d="M11 6C11.9193 6 12.8295 6.18106 13.6788 6.53284C14.5281 6.88463 15.2997 7.40024 15.9497 8.05025C16.5998 8.70026 17.1154 9.47194 17.4672 10.3212C17.8189 11.1705 18 12.0807 18 13V16H22L16 22L10 16H14V13C14 12.606 13.9224 12.2159 13.7716 11.8519C13.6209 11.488 13.3999 11.1573 13.1213 10.8787C12.8427 10.6001 12.512 10.3791 12.1481 10.2284C11.7841 10.0776 11.394 10 11 10H8V14L2 8L8 2V6H11Z" fill="white"/>+<path d="M11 9H7V11.5L3.5 8L7 4.5L7 7H11C11.7879 7 12.5682 7.15519 13.2961 7.45672C14.0241 7.75825 14.6855 8.20021 15.2426 8.75736C15.7998 9.31451 16.2418 9.97594 16.5433 10.7039C16.8448 11.4319 17 12.2121 17 13V17L19.5 17L16 20.5L12.5 17H15V13C15 12.4747 14.8965 11.9546 14.6955 11.4693C14.4945 10.984 14.1999 10.543 13.8284 10.1716C13.457 9.80014 13.016 9.5055 12.5307 9.30448C12.0454 9.10346 11.5253 9 11 9Z" fill="black"/>+</g>+</g>+<defs>+<filter id="filter0_d_325_17" x="0.2" y="1.2" width="23.6" height="23.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dy="1"/>+<feGaussianBlur stdDeviation="0.9"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_325_17"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_325_17" result="shape"/>+</filter>+<clipPath id="clip0_325_17">+<rect width="24" height="24" fill="white"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/diffusion-logo-large.svg b/apps/web/src/assets/icons/diffusion-logo-large.svgnew file mode 100644index 00000000..b73c4b46--- /dev/null+++ b/apps/web/src/assets/icons/diffusion-logo-large.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.06206 2.24345C10.779 1.25218 12.8945 1.25218 14.6114 2.24345L18.8989 4.71894C20.6158 5.7102 21.6735 7.54213 21.6735 9.52465V14.4753C21.6735 16.4578 20.6158 18.2898 18.8989 19.2811L14.6114 21.7566C12.8945 22.7478 10.779 22.7478 9.06206 21.7566L4.77452 19.2811C3.05767 18.2898 2 16.4578 2 14.4753V9.52465C2 7.54215 3.05763 5.71021 4.77452 4.71894L9.06206 2.24345ZM13.2513 4.67935C12.3929 4.18378 11.3352 4.18376 10.4768 4.67935L6.19297 7.15284C5.33454 7.64848 4.80557 8.56445 4.80557 9.5557V14.5021C4.80558 15.4934 5.33452 16.4094 6.19297 16.905L10.4768 19.3782C11.3353 19.8738 12.3929 19.8738 13.2513 19.3782L17.5352 16.905C18.3936 16.4094 18.9226 15.4934 18.9226 14.5021V9.5557C18.9226 8.56444 18.3936 7.64847 17.5352 7.15284L13.2513 4.67935Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/diffusion-logo.svg b/apps/web/src/assets/icons/diffusion-logo.svgnew file mode 100644index 00000000..d5fefa21--- /dev/null+++ b/apps/web/src/assets/icons/diffusion-logo.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.89171 5.0581C11.1135 4.3527 12.6189 4.3527 13.8407 5.0581L16.8918 6.81971C18.1136 7.52511 18.8662 8.82875 18.8662 10.2395V13.7626C18.8662 15.1733 18.1136 16.477 16.8918 17.1824L13.8407 18.944C12.6189 19.6494 11.1135 19.6494 9.89171 18.944L6.84061 17.1824C5.61887 16.477 4.86621 15.1733 4.86621 13.7626V10.2395C4.86621 8.82876 5.61884 7.52512 6.84061 6.81971L9.89171 5.0581ZM12.8729 6.79153C12.262 6.43888 11.5093 6.43887 10.8985 6.79153L7.85001 8.55172C7.23913 8.90443 6.86271 9.55625 6.86271 10.2616V13.7816C6.86271 14.487 7.23912 15.1388 7.85001 15.4915L10.8985 17.2515C11.5094 17.6042 12.262 17.6042 12.8729 17.2515L15.9213 15.4915C16.5322 15.1388 16.9086 14.487 16.9086 13.7816V10.2616C16.9086 9.55624 16.5322 8.90442 15.9213 8.55172L12.8729 6.79153Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/diffusion-project-file.svg b/apps/web/src/assets/icons/diffusion-project-file.svgnew file mode 100644index 00000000..49714dff--- /dev/null+++ b/apps/web/src/assets/icons/diffusion-project-file.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.01819 12.3123C7.61458 11.968 8.34962 11.9681 8.94606 12.3123L10.4358 13.1723C11.0323 13.5167 11.4002 14.1532 11.4002 14.842V16.5621C11.4002 17.2508 11.0323 17.8873 10.4358 18.2317L8.94606 19.0918C8.34962 19.436 7.61459 19.4361 7.01819 19.0918L5.52933 18.2317C4.93285 17.8873 4.56494 17.2508 4.56494 16.5621V14.842C4.56497 14.1532 4.93285 13.5167 5.52933 13.1723L7.01819 12.3123ZM8.47377 13.1588C8.17559 12.9867 7.80847 12.9867 7.51028 13.1588L6.02142 14.0179C5.72329 14.1902 5.53924 14.5085 5.53922 14.8528V16.5711C5.53923 16.9153 5.72336 17.2337 6.02142 17.4059L7.51028 18.265C7.80852 18.4372 8.17553 18.4372 8.47377 18.265L9.96263 17.4059C10.2606 17.2336 10.4439 16.9153 10.4439 16.5711V14.8528C10.4439 14.5085 10.2607 14.1902 9.96263 14.0179L8.47377 13.1588Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.3619 4.84998C12.7283 4.85005 13.0798 4.99567 13.3389 5.2548L17.3656 9.28148C17.6247 9.54055 17.7703 9.89203 17.7704 10.2585V17.2862C17.7704 17.6527 17.6247 18.0041 17.3656 18.2632C17.1064 18.5224 16.7551 18.6681 16.3886 18.6681H11.8113C12.0791 18.3633 12.2867 18.0112 12.4285 17.6317H16.3886C16.4802 17.6317 16.5685 17.5957 16.6333 17.5309C16.6981 17.4662 16.734 17.3779 16.734 17.2862V10.3772H13.625C13.2585 10.3772 12.9071 10.2315 12.648 9.97238C12.3888 9.71324 12.2432 9.36188 12.2432 8.9954V5.88633H8.09773C8.00611 5.88633 7.91782 5.9223 7.85303 5.98709C7.78825 6.05187 7.75228 6.14016 7.75228 6.23178V10.8459C7.39922 10.8702 7.04906 10.9503 6.71592 11.087V6.23178C6.71592 5.86531 6.86161 5.51394 7.12075 5.2548C7.37989 4.99566 7.73125 4.84998 8.09773 4.84998H12.3619ZM13.2795 8.9954C13.2795 9.08702 13.3155 9.17531 13.3803 9.24009C13.4451 9.30488 13.5333 9.34085 13.625 9.34085H15.9604L13.2795 6.66V8.9954Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/distribute-center-horizontal.svg b/apps/web/src/assets/icons/distribute-center-horizontal.svgnew file mode 100644index 00000000..f0bc3bb4--- /dev/null+++ b/apps/web/src/assets/icons/distribute-center-horizontal.svg@@ -0,0 +1,7 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g opacity="0.35">+<path d="M6.4585 4.677C6.4585 4.51953 6.52105 4.36851 6.6324 4.25716C6.74375 4.14581 6.89477 4.08325 7.05225 4.08325C7.20972 4.08325 7.36074 4.14581 7.47209 4.25716C7.58344 4.36851 7.646 4.51953 7.646 4.677V19.3228C7.646 19.4803 7.58344 19.6313 7.47209 19.7427C7.36074 19.854 7.20972 19.9166 7.05225 19.9166C6.89477 19.9166 6.74375 19.854 6.6324 19.7427C6.52105 19.6313 6.4585 19.4803 6.4585 19.3228V4.677Z" fill="currentColor"/>+<path d="M16.5282 4.25716C16.4169 4.36851 16.3543 4.51953 16.3543 4.677V19.3228C16.3543 19.4803 16.4169 19.6313 16.5282 19.7427C16.6396 19.854 16.7906 19.9166 16.9481 19.9166C17.1056 19.9166 17.2566 19.854 17.3679 19.7427C17.4793 19.6313 17.5418 19.4803 17.5418 19.3228V4.677C17.5418 4.51953 17.4793 4.36851 17.3679 4.25716C17.2566 4.14581 17.1056 4.08325 16.9481 4.08325C16.7906 4.08325 16.6396 4.14581 16.5282 4.25716Z" fill="currentColor"/>+</g>+<path d="M12 7.25C10.6883 7.25 9.625 8.31332 9.625 9.625V14.375C9.625 15.6867 10.6883 16.75 12 16.75C13.3117 16.75 14.375 15.6867 14.375 14.375V9.625C14.375 8.31332 13.3117 7.25 12 7.25Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/distribute-center-vertical.svg b/apps/web/src/assets/icons/distribute-center-vertical.svgnew file mode 100644index 00000000..08d927dc--- /dev/null+++ b/apps/web/src/assets/icons/distribute-center-vertical.svg@@ -0,0 +1,7 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g opacity="0.35">+<path d="M19.3231 6.45825C19.4806 6.45825 19.6316 6.52081 19.7429 6.63216C19.8543 6.74351 19.9168 6.89453 19.9168 7.052C19.9168 7.20947 19.8543 7.3605 19.7429 7.47185C19.6316 7.5832 19.4806 7.64575 19.3231 7.64575L4.67725 7.64575C4.51977 7.64575 4.36875 7.5832 4.2574 7.47185C4.14605 7.3605 4.0835 7.20947 4.0835 7.052C4.0835 6.89453 4.14605 6.74351 4.2574 6.63216C4.36875 6.52081 4.51977 6.45825 4.67725 6.45825L19.3231 6.45825Z" fill="currentColor"/>+<path d="M19.7429 16.528C19.6316 16.4166 19.4806 16.3541 19.3231 16.3541L4.67725 16.3541C4.51977 16.3541 4.36875 16.4166 4.2574 16.528C4.14605 16.6393 4.0835 16.7904 4.0835 16.9478C4.0835 17.1053 4.14605 17.2563 4.2574 17.3677C4.36875 17.479 4.51977 17.5416 4.67725 17.5416L19.3231 17.5416C19.4806 17.5416 19.6316 17.479 19.7429 17.3677C19.8543 17.2563 19.9168 17.1053 19.9168 16.9478C19.9168 16.7904 19.8543 16.6393 19.7429 16.528Z" fill="currentColor"/>+</g>+<path d="M16.75 12C16.75 10.6883 15.6867 9.625 14.375 9.625L9.625 9.625C8.31332 9.625 7.25 10.6883 7.25 12C7.25 13.3117 8.31332 14.375 9.625 14.375H14.375C15.6867 14.375 16.75 13.3117 16.75 12Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/dot.svg b/apps/web/src/assets/icons/dot.svgnew file mode 100644index 00000000..7a4a33fd--- /dev/null+++ b/apps/web/src/assets/icons/dot.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<circle cx="12" cy="12" r="2" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/ds-mark-vector.svg b/apps/web/src/assets/icons/ds-mark-vector.svgnew file mode 100644index 00000000..622113cd--- /dev/null+++ b/apps/web/src/assets/icons/ds-mark-vector.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.22889 0.429604C6.23675 -0.143201 5.01441 -0.143201 4.02227 0.429604L1.60331 1.8262C0.611176 2.39901 0 3.45759 0 4.60321V7.3964C0 8.54202 0.611176 9.6006 1.60331 10.1734L4.02227 11.57C5.01441 12.1428 6.23675 12.1428 7.22889 11.57L9.64786 10.1734C10.64 9.6006 11.2512 8.54202 11.2512 7.3964V4.60321C11.2512 3.45759 10.64 2.39901 9.64786 1.8262L7.22889 0.429604ZM6.56773 1.72429C5.99497 1.3936 5.28928 1.3936 4.71649 1.72429L2.38791 3.0687C1.81514 3.39941 1.46229 4.01055 1.46229 4.67194V7.36073C1.46229 8.02212 1.81514 8.63326 2.38791 8.96397L4.71649 10.3084C5.28928 10.6391 5.99497 10.6391 6.56773 10.3084L8.89632 8.96397C9.46908 8.63326 9.82194 8.02212 9.82194 7.36073V4.67191C9.82194 4.01055 9.46908 3.39938 8.89632 3.0687L6.56773 1.72429Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/duration.svg b/apps/web/src/assets/icons/duration.svgnew file mode 100644index 00000000..2b1898f0--- /dev/null+++ b/apps/web/src/assets/icons/duration.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.1162 8.67969C14.293 8.46781 14.6083 8.43951 14.8203 8.61621C15.0322 8.79304 15.0605 9.10827 14.8838 9.32031L12.3838 12.3203C12.207 12.5322 11.8917 12.5605 11.6797 12.3838C11.4678 12.207 11.4395 11.8917 11.6162 11.6797L14.1162 8.67969Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.25C15.7279 5.25 18.75 8.27208 18.75 12C18.75 15.7279 15.7279 18.75 12 18.75C8.27208 18.75 5.25 15.7279 5.25 12C5.25 8.27208 8.27208 5.25 12 5.25ZM12 6.25C8.82436 6.25 6.25 8.82436 6.25 12C6.25 15.1756 8.82436 17.75 12 17.75C15.1756 17.75 17.75 15.1756 17.75 12C17.75 8.82436 15.1756 6.25 12 6.25Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/edit-video.svg b/apps/web/src/assets/icons/edit-video.svgnew file mode 100644index 00000000..0b639ac5--- /dev/null+++ b/apps/web/src/assets/icons/edit-video.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M5.84 9.18559C5.84 9.98456 6.4877 10.6323 7.28667 10.6323C8.08564 10.6323 8.73334 9.98456 8.73334 9.18559C8.73334 8.38661 8.08564 7.73893 7.28667 7.73893C6.4877 7.73893 5.84 8.38661 5.84 9.18559ZM7.28667 11.4723C6.02378 11.4723 5 10.4485 5 9.18559C5 7.9227 6.02378 6.89893 7.28667 6.89893C8.54956 6.89893 9.57334 7.9227 9.57334 9.18559C9.57334 9.4876 9.51479 9.77594 9.40842 10.0399L10.3075 10.6412C10.3008 10.6621 10.2945 10.6832 10.2886 10.7044L10.1454 11.2177L9.81606 11.4379L8.88785 10.8181C8.47534 11.2227 7.91014 11.4723 7.28667 11.4723ZM5.84 14.8C5.84 14.001 6.4877 13.3533 7.28667 13.3533C8.08564 13.3533 8.73334 14.001 8.73334 14.8C8.73334 15.5989 8.08564 16.2467 7.28667 16.2467C6.4877 16.2467 5.84 15.5989 5.84 14.8ZM7.28667 12.5133C6.02378 12.5133 5 13.5371 5 14.8C5 16.0629 6.02378 17.0867 7.28667 17.0867C8.54956 17.0867 9.57334 16.0629 9.57334 14.8C9.57334 14.5016 9.5162 14.2167 9.41228 13.9553L18.9533 7.57356L18.0654 7.66689C16.8139 7.79843 15.6018 8.1817 14.5023 8.79365L11.6327 10.3906C11.4149 10.5118 11.2546 10.7152 11.1876 10.9553L10.9514 11.8016L8.89609 13.1756C8.48289 12.7662 7.91431 12.5133 7.28667 12.5133ZM11.6214 13.6006L11.6327 13.607L14.5023 15.204C15.6018 15.8159 16.8139 16.1992 18.0654 16.3307L18.9533 16.424L13.1767 12.5603L11.6214 13.6006Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/email.svg b/apps/web/src/assets/icons/email.svgnew file mode 100644index 00000000..a5a3ced9--- /dev/null+++ b/apps/web/src/assets/icons/email.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.78076 7.00024H16.2183C16.7371 7.00021 17.2363 7.19872 17.6134 7.55504C17.9905 7.91136 18.217 8.39849 18.2464 8.91649L18.2495 9.03149V14.969C18.2495 15.4878 18.051 15.987 17.6947 16.3641C17.3384 16.7413 16.8513 16.9677 16.3333 16.9971L16.2183 17.0002H7.78076C7.26193 17.0003 6.76274 16.8018 6.38562 16.4454C6.00849 16.0891 5.78201 15.602 5.75264 15.084L5.74951 14.969V9.03149C5.74948 8.51266 5.94798 8.01348 6.30431 7.63635C6.66063 7.25922 7.14776 7.03274 7.66576 7.00337L7.78076 7.00024ZM17.312 10.3584L12.2183 13.0396C12.1607 13.07 12.0975 13.0881 12.0327 13.0927C11.9678 13.0973 11.9026 13.0884 11.8414 13.0665L11.7814 13.0402L6.68701 10.359V14.969C6.68702 15.2435 6.79024 15.5079 6.97619 15.7099C7.16213 15.9118 7.4172 16.0364 7.69076 16.059L7.78076 16.0627H16.2183C16.4929 16.0627 16.7574 15.9594 16.9593 15.7733C17.1613 15.5873 17.2858 15.332 17.3083 15.0584L17.312 14.969V10.3584ZM16.2183 7.93774H7.78076C7.50627 7.93775 7.24181 8.04098 7.03989 8.22692C6.83797 8.41286 6.71335 8.66793 6.69076 8.94149L6.68701 9.03149V9.29962L11.9995 12.0959L17.312 9.29899V9.03149C17.312 8.7569 17.2087 8.49236 17.0226 8.29043C16.8365 8.08849 16.5813 7.96393 16.3076 7.94149L16.2183 7.93774Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/external-link.svg b/apps/web/src/assets/icons/external-link.svgnew file mode 100644index 00000000..20b9fab7--- /dev/null+++ b/apps/web/src/assets/icons/external-link.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.1594 6.65793C10.4153 6.65793 10.6227 6.86538 10.6227 7.12128C10.6227 7.37718 10.4153 7.58462 10.1594 7.58462H8.07431C7.81841 7.58462 7.61096 7.79207 7.61096 8.04797V15.9249C7.61096 16.1808 7.81841 16.3882 8.07431 16.3882H15.9512C16.2071 16.3882 16.4146 16.1808 16.4146 15.9249V13.8398C16.4146 13.5839 16.622 13.3765 16.8779 13.3765C17.1338 13.3765 17.3413 13.5839 17.3413 13.8398V15.9249C17.3413 16.6926 16.7189 17.3149 15.9512 17.3149H8.07431C7.30661 17.3149 6.68427 16.6926 6.68427 15.9249V8.04797C6.68427 7.28027 7.30661 6.65793 8.07431 6.65793H10.1594Z" fill="currentColor"/>+<path d="M17.2834 6.32399C17.3899 6.34341 17.4863 6.39927 17.5558 6.48236C17.6253 6.56558 17.6633 6.67073 17.6635 6.77919V10.1023L17.6562 10.1855C17.6368 10.2921 17.5801 10.3884 17.4969 10.4579C17.4137 10.5275 17.3085 10.5655 17.2001 10.5656L17.1168 10.5584C17.0101 10.5389 16.913 10.4824 16.8435 10.3991C16.7742 10.3159 16.7368 10.2106 16.7368 10.1023L16.7358 7.89865L12.2852 12.3484L12.2209 12.4027C12.1318 12.4643 12.0238 12.4921 11.9159 12.4824C11.8079 12.4725 11.7066 12.4251 11.63 12.3484L11.5766 12.2851C11.5149 12.1958 11.4862 12.0872 11.496 11.9792C11.5059 11.8713 11.5533 11.7698 11.63 11.6932L16.0806 7.24254H13.877L13.7938 7.2353C13.6798 7.21476 13.5771 7.15187 13.5069 7.05974C13.4369 6.96771 13.4042 6.85273 13.4146 6.73757C13.425 6.6222 13.4783 6.51424 13.5639 6.43621C13.6495 6.35837 13.7613 6.31559 13.877 6.31585L17.2001 6.31494L17.2834 6.32399Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/eye-off.svg b/apps/web/src/assets/icons/eye-off.svgnew file mode 100644index 00000000..0f9e28ea--- /dev/null+++ b/apps/web/src/assets/icons/eye-off.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M18.3062 10.8934C18.5095 11.0205 18.5713 11.2882 18.4442 11.4915C18.0631 12.1012 17.6103 12.6559 17.0956 13.139L18.138 14.1815C18.3075 14.351 18.3075 14.6258 18.138 14.7953C17.9685 14.9647 17.6937 14.9647 17.5243 14.7953L16.428 13.699C15.737 14.2151 14.9592 14.6138 14.1127 14.8646L14.5027 16.3199C14.5647 16.5514 14.4272 16.7893 14.1958 16.8514C13.9642 16.9135 13.7263 16.7761 13.6642 16.5446L13.2668 15.0612C12.8573 15.131 12.4345 15.1674 12.0002 15.1674C11.5659 15.1674 11.1431 15.131 10.7337 15.0612L10.3363 16.5445C10.2742 16.7761 10.0363 16.9135 9.80475 16.8514C9.57322 16.7894 9.43582 16.5514 9.49784 16.3199L9.88774 14.8646C9.04132 14.6138 8.26352 14.2151 7.57248 13.699L6.4762 14.7953C6.30671 14.9647 6.03192 14.9647 5.86243 14.7953C5.69294 14.6258 5.69294 14.351 5.86243 14.1815L6.90492 13.139C6.39019 12.6559 5.93735 12.1012 5.55626 11.4915C5.42923 11.2882 5.49101 11.0205 5.69427 10.8934C5.89753 10.7664 6.16528 10.8282 6.29232 11.0314C6.70851 11.6973 7.21669 12.2862 7.80114 12.7742C7.81053 12.7813 7.81969 12.7889 7.8286 12.797C8.97002 13.7399 10.3991 14.2994 12.0002 14.2994C14.4374 14.2994 16.476 13.003 17.7082 11.0314C17.8352 10.8282 18.103 10.7664 18.3062 10.8934Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/eye-on.svg b/apps/web/src/assets/icons/eye-on.svgnew file mode 100644index 00000000..0b55f950--- /dev/null+++ b/apps/web/src/assets/icons/eye-on.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.0002 15.038C9.65911 15.038 7.68586 13.8418 6.44175 12C7.68586 10.1582 9.65911 8.96199 12.0002 8.96199C14.3413 8.96199 16.3146 10.1582 17.5587 12C16.3146 13.8417 14.3413 15.038 12.0002 15.038ZM12.0002 8.09399C9.22946 8.09399 6.92798 9.57513 5.5562 11.77C5.46824 11.9107 5.46824 12.0893 5.5562 12.23C6.92798 14.4248 9.22946 15.906 12.0002 15.906C14.771 15.906 17.0725 14.4248 18.4443 12.23C18.5322 12.0893 18.5322 11.9107 18.4443 11.77C17.0725 9.57513 14.771 8.09399 12.0002 8.09399ZM12.0002 13.736C12.959 13.736 13.7362 12.9588 13.7362 12C13.7362 11.0412 12.959 10.264 12.0002 10.264C11.0415 10.264 10.2642 11.0412 10.2642 12C10.2642 12.9588 11.0415 13.736 12.0002 13.736Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/favorite.svg b/apps/web/src/assets/icons/favorite.svgnew file mode 100644index 00000000..9ac9f15a--- /dev/null+++ b/apps/web/src/assets/icons/favorite.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M9.56712 7.19578C8.25905 7.19578 7.19554 8.26082 7.19554 9.57844C7.19554 10.9563 7.99546 12.3892 9.08094 13.713C10.0343 14.8757 11.1549 15.8923 11.9999 16.6461C12.8449 15.8923 13.9656 14.8757 14.9189 13.713C16.0044 12.3892 16.8043 10.9563 16.8043 9.57844C16.8043 8.26082 15.7408 7.19578 14.4327 7.19578C13.6524 7.19578 13.2309 7.46715 12.9703 7.76134C12.7267 8.03622 12.603 8.34675 12.4899 8.63074C12.4702 8.68018 12.4508 8.72881 12.4312 8.77632C12.3591 8.95088 12.1888 9.06475 11.9999 9.06475C11.811 9.06475 11.6408 8.95089 11.5686 8.77633C11.549 8.72881 11.5296 8.68017 11.5099 8.63071C11.3968 8.34673 11.2731 8.03621 11.0295 7.76134C10.7689 7.46715 10.3474 7.19578 9.56712 7.19578ZM6.26221 9.57844C6.26221 7.74878 7.74016 6.26245 9.56712 6.26245C10.6077 6.26245 11.2859 6.64326 11.7281 7.14242C11.8325 7.26018 11.9223 7.3837 11.9999 7.50656C12.0775 7.3837 12.1673 7.26018 12.2717 7.14242C12.7139 6.64326 13.3921 6.26245 14.4327 6.26245C16.2596 6.26245 17.7377 7.74878 17.7377 9.57844C17.7377 11.2912 16.7611 12.9382 15.6406 14.3048C14.5793 15.5993 13.327 16.7142 12.4722 17.4754C12.4166 17.5249 12.3627 17.573 12.3106 17.6194C12.1336 17.7774 11.8662 17.7774 11.6892 17.6194C11.6372 17.573 11.5832 17.5249 11.5277 17.4754C10.6728 16.7142 9.42054 15.5993 8.3592 14.3048C7.2387 12.9382 6.26221 11.2912 6.26221 9.57844Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/favorited.svg b/apps/web/src/assets/icons/favorited.svgnew file mode 100644index 00000000..f7e0d1ee--- /dev/null+++ b/apps/web/src/assets/icons/favorited.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.26221 9.57844C6.26221 7.74878 7.74016 6.26245 9.56712 6.26245C10.6077 6.26245 11.2859 6.64326 11.7281 7.14242C11.8325 7.26018 11.9223 7.3837 11.9999 7.50656C12.0775 7.3837 12.1673 7.26018 12.2717 7.14242C12.7139 6.64326 13.3921 6.26245 14.4327 6.26245C16.2596 6.26245 17.7377 7.74878 17.7377 9.57844C17.7377 11.2912 16.7611 12.9382 15.6406 14.3048C14.5793 15.5993 13.327 16.7142 12.4722 17.4754C12.4166 17.5249 12.3627 17.573 12.3106 17.6194C12.1336 17.7774 11.8662 17.7774 11.6892 17.6194C11.6372 17.573 11.5832 17.5249 11.5277 17.4754C10.6728 16.7142 9.42054 15.5993 8.3592 14.3048C7.2387 12.9382 6.26221 11.2912 6.26221 9.57844Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/fill.gradient.svg b/apps/web/src/assets/icons/fill.gradient.svgnew file mode 100644index 00000000..6896c88e--- /dev/null+++ b/apps/web/src/assets/icons/fill.gradient.svg@@ -0,0 +1,25 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g clip-path="url(#clip0_4132_11169)">+ <path d="M18 6H6V18H18V6Z" fill="url(#paint0_linear_4132_11169)" />+ </g>+ <path+ d="M17.0714 17.0714V18H6.92857V17.0714H17.0714ZM17.0714 6.92857H6.92857V18C6.41574 18 6 17.5843 6 17.0714V6.92857C6 6.41574 6.41574 6 6.92857 6H17.0714C17.5843 6 18 6.41574 18 6.92857V17.0714C18 17.5843 17.5843 18 17.0714 18V6.92857Z"+ fill="currentColor"+ />+ <defs>+ <linearGradient+ id="paint0_linear_4132_11169"+ x1="18"+ y1="6"+ x2="6"+ y2="18"+ gradientUnits="userSpaceOnUse"+ >+ <stop offset="0" stop-color="currentColor" />+ <stop offset="1" stop-color="currentColor" stop-opacity="0" />+ </linearGradient>+ <clipPath id="clip0_4132_11169">+ <rect x="6" y="6" width="12" height="12" fill="currentColor" />+ </clipPath>+ </defs>+</svg>diff --git a/apps/web/src/assets/icons/fill.media.svg b/apps/web/src/assets/icons/fill.media.svgnew file mode 100644index 00000000..2d1a3fe7--- /dev/null+++ b/apps/web/src/assets/icons/fill.media.svg@@ -0,0 +1,7 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.4" d="M4.78613 4.78516H16.2147V7.8569H8V16.2137H4.78613V4.78516Z" fill="currentColor"/>+<path d="M5.42857 16.5V15.5714V5.42857H15.5714V8H16.5V5.42857C16.5 4.91574 16.0843 4.5 15.5714 4.5H5.42857C4.91574 4.5 4.5 4.91574 4.5 5.42857V15.5714C4.5 16.0843 4.91574 16.5 5.42857 16.5Z" fill="currentColor"/>+<path d="M5.42857 15.5714V16.5H8V15.5714H5.42857Z" fill="currentColor"/>+<path d="M12.0996 15.8531V11.1469C12.0996 10.9741 12.2897 10.8688 12.4362 10.9604L16.2011 13.3134C16.339 13.3996 16.339 13.6004 16.2011 13.6866L12.4362 16.0396C12.2897 16.1312 12.0996 16.0259 12.0996 15.8531Z" stroke="currentColor" stroke-linejoin="round"/>+<path d="M18.5714 18.5714V19.5H8.42857V18.5714H18.5714ZM18.5714 8.42857H8.42857V19.5C7.91574 19.5 7.5 19.0843 7.5 18.5714V8.42857C7.5 7.91574 7.91574 7.5 8.42857 7.5H18.5714C19.0843 7.5 19.5 7.91574 19.5 8.42857V18.5714C19.5 19.0843 19.0843 19.5 18.5714 19.5V8.42857Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/fill.solid-color.svg b/apps/web/src/assets/icons/fill.solid-color.svgnew file mode 100644index 00000000..52a9a5ea--- /dev/null+++ b/apps/web/src/assets/icons/fill.solid-color.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<rect opacity="0.4" x="6.28613" y="6.28516" width="11.4286" height="11.4286" fill="currentColor"/>+<path d="M17.0714 17.0714V18H6.92857V17.0714H17.0714ZM17.0714 6.92857H6.92857V18C6.41574 18 6 17.5843 6 17.0714V6.92857C6 6.41574 6.41574 6 6.92857 6H17.0714C17.5843 6 18 6.41574 18 6.92857V17.0714C18 17.5843 17.5843 18 17.0714 18V6.92857Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/film-video-export.svg b/apps/web/src/assets/icons/film-video-export.svgnew file mode 100644index 00000000..0ff44f0a--- /dev/null+++ b/apps/web/src/assets/icons/film-video-export.svg@@ -0,0 +1,3 @@+<svg fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.2236 6.00049C17.2043 6.00049 17.9995 6.79566 17.9995 7.7764V9.27349C17.9995 9.27719 18.0005 9.28089 18.0005 9.2846C18.0005 9.28764 17.9995 9.29067 17.9995 9.29369V14.7043C17.9995 14.708 18.0005 14.7116 18.0005 14.7154C18.0005 14.7184 17.9995 14.7214 17.9995 14.7245V16.2236C17.9995 17.2043 17.2043 17.9995 16.2236 17.9995H7.7764C6.79566 17.9995 6.00049 17.2043 6.00049 16.2236V7.7764C6.00049 6.79566 6.79566 6.00049 7.7764 6.00049H16.2236ZM7.13796 16.2236C7.13796 16.5759 7.42409 16.862 7.7764 16.862H8.41382V15.2841H7.13796V16.2236ZM9.55129 14.7043C9.55136 14.708 9.5523 14.7116 9.5523 14.7154C9.5523 14.7187 9.55135 14.7221 9.55129 14.7255V16.862H14.4487V12.5687H9.55129V14.7043ZM15.5861 15.2841V16.862H16.2236C16.5759 16.862 16.862 16.5759 16.862 16.2236V15.2841H15.5861ZM15.5861 14.1466H16.862V12.5687H15.5861V14.1466ZM7.13796 14.1466H8.41382V12.5687H7.13796V14.1466ZM7.13796 11.4312H8.41382V9.85334H7.13796V11.4312ZM9.55129 9.27349C9.55136 9.27719 9.5523 9.28088 9.5523 9.2846C9.5523 9.28798 9.55135 9.29134 9.55129 9.2947V11.4312H14.4487V7.13796H9.55129V9.27349ZM15.5861 11.4312H16.862V9.85334H15.5861V11.4312ZM7.7764 7.13796C7.42409 7.13796 7.13796 7.42409 7.13796 7.7764V8.71587H8.41382V7.13796H7.7764ZM15.5861 8.71587H16.862V7.7764C16.862 7.42409 16.5759 7.13796 16.2236 7.13796H15.5861V8.71587Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/flip-horizontal.svg b/apps/web/src/assets/icons/flip-horizontal.svgnew file mode 100644index 00000000..40350e98--- /dev/null+++ b/apps/web/src/assets/icons/flip-horizontal.svg@@ -0,0 +1,5 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M6.375 8.87476L9.5 11.9998L6.375 15.1248V8.87476Z" stroke="currentColor" stroke-width="1.07143" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M17.625 8.87476L14.5 11.9998L17.625 15.1248V8.87476Z" stroke="currentColor" stroke-width="1.07143" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M12 6.10718V17.8929" stroke="currentColor" stroke-width="1.07143" stroke-linecap="round" stroke-linejoin="round"/>+</svg>diff --git a/apps/web/src/assets/icons/flip-vertical.svg b/apps/web/src/assets/icons/flip-vertical.svgnew file mode 100644index 00000000..f676926e--- /dev/null+++ b/apps/web/src/assets/icons/flip-vertical.svg@@ -0,0 +1,5 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.125 6.375L12 9.5L8.875 6.375L15.125 6.375Z" stroke="currentColor" stroke-width="1.07143" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M15.125 17.6248L12 14.4998L8.875 17.6248L15.125 17.6248Z" stroke="currentColor" stroke-width="1.07143" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M17.8926 12L6.10686 12" stroke="currentColor" stroke-width="1.07143" stroke-linecap="round" stroke-linejoin="round"/>+</svg>diff --git a/apps/web/src/assets/icons/folder-thumbnail.svg b/apps/web/src/assets/icons/folder-thumbnail.svgnew file mode 100644index 00000000..48ea2596--- /dev/null+++ b/apps/web/src/assets/icons/folder-thumbnail.svg@@ -0,0 +1,6 @@+<svg width="32" height="24" viewBox="0 0 32 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g opacity="0.56">+<path d="M0 2C0 0.895431 0.895431 0 2 0H11.8387C12.4463 0 13.0209 0.276179 13.4005 0.75061L16 4H0V2Z" fill="currentColor"/>+<path d="M0 4H30C31.1046 4 32 4.89543 32 6V22C32 23.1046 31.1046 24 30 24H2C0.895431 24 0 23.1046 0 22V4Z" fill="currentColor"/>+</g>+</svg>diff --git a/apps/web/src/assets/icons/folders-icon.svg b/apps/web/src/assets/icons/folders-icon.svgnew file mode 100644index 00000000..80dd76e4--- /dev/null+++ b/apps/web/src/assets/icons/folders-icon.svg@@ -0,0 +1,73 @@+<svg viewBox="0 0 262 203" fill="none" xmlns="http://www.w3.org/2000/svg">+<g filter="url(#filter0_d_180_1200)">+<rect x="128.85" y="6.98482" width="135" height="135" rx="14.5" transform="rotate(26.7988 128.85 6.98482)" fill="white" stroke="url(#paint0_linear_180_1200)" stroke-width="3"/>+<rect x="129.513" y="9" width="132" height="132" rx="13" transform="rotate(26.7988 129.513 9)" fill="url(#paint1_linear_180_1200)"/>+<rect x="128.611" y="10.7852" width="132" height="124" rx="13" transform="rotate(26.7988 128.611 10.7852)" fill="#FCFCFC"/>+<g clip-path="url(#clip0_180_1200)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M152.135 70.4914C150.543 69.6873 148.601 70.3259 147.797 71.9178L131.491 104.2C130.687 105.792 131.325 107.734 132.917 108.538L165.199 124.844C166.791 125.648 168.734 125.01 169.538 123.418L185.844 91.1356C186.648 89.5438 186.009 87.6015 184.417 86.7974L152.135 70.4914ZM144.338 70.1707C146.107 66.6686 150.38 65.2636 153.882 67.0326L186.164 83.3386C189.666 85.1076 191.071 89.3806 189.303 92.8827L172.997 125.165C171.228 128.667 166.955 130.072 163.452 128.303L131.17 111.997C127.668 110.228 126.263 105.955 128.032 102.453L144.338 70.1707Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M158.494 69.3623C159.449 69.8447 159.832 71.0101 159.35 71.9652L138.385 113.471C137.903 114.426 136.737 114.809 135.782 114.327C134.827 113.844 134.444 112.679 134.926 111.724L155.891 70.2182C156.374 69.263 157.539 68.8799 158.494 69.3623Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M141.426 75.9355C141.909 74.9803 143.074 74.5972 144.029 75.0796L153.253 79.7385C154.208 80.2209 154.591 81.3863 154.109 82.3414C153.626 83.2965 152.461 83.6797 151.506 83.1973L142.282 78.5384C141.327 78.056 140.944 76.8906 141.426 75.9355Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M136.185 86.3119C136.667 85.3568 137.833 84.9736 138.788 85.4561L180.294 106.421C181.249 106.903 181.632 108.069 181.15 109.024C180.667 109.979 179.502 110.362 178.547 109.88L137.041 88.9149C136.086 88.4324 135.703 87.267 136.185 86.3119Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M130.944 96.6884C131.426 95.7333 132.592 95.3501 133.547 95.8325L142.77 100.491C143.725 100.974 144.109 102.139 143.626 103.094C143.144 104.049 141.978 104.433 141.023 103.95L131.8 99.2913C130.845 98.8089 130.461 97.6435 130.944 96.6884Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M181.553 81.0093C182.508 81.4917 182.891 82.6571 182.409 83.6122L161.444 125.118C160.961 126.073 159.796 126.456 158.841 125.974C157.886 125.491 157.502 124.326 157.985 123.371L178.95 81.8651C179.432 80.91 180.598 80.5268 181.553 81.0093Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M173.708 92.2416C174.191 91.2865 175.356 90.9033 176.311 91.3857L185.535 96.0446C186.49 96.5271 186.873 97.6924 186.391 98.6476C185.908 99.6027 184.743 99.9859 183.788 99.5034L174.564 94.8446C173.609 94.3621 173.226 93.1967 173.708 92.2416Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M163.226 112.995C163.709 112.039 164.874 111.656 165.829 112.139L175.053 116.798C176.008 117.28 176.391 118.445 175.908 119.4C175.426 120.356 174.261 120.739 173.305 120.256L164.082 115.597C163.127 115.115 162.744 113.95 163.226 112.995Z" fill="#B1B1B1"/>+</g>+</g>+<g filter="url(#filter1_d_180_1200)">+<rect x="61.4995" y="48.5" width="135" height="135" rx="14.5" fill="white" stroke="url(#paint2_linear_180_1200)" stroke-width="3"/>+<rect x="62.9995" y="50" width="132" height="132" rx="13" fill="url(#paint3_linear_180_1200)"/>+<rect x="62.9995" y="52" width="132" height="124" rx="13" fill="#FCFCFC"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M110.916 94.6875C109.133 94.6875 107.687 96.1332 107.687 97.9167V134.083C107.687 135.867 109.133 137.312 110.916 137.312H147.083C148.866 137.312 150.312 135.867 150.312 134.083V97.9167C150.312 96.1332 148.866 94.6875 147.083 94.6875H110.916ZM103.812 97.9167C103.812 93.9931 106.993 90.8125 110.916 90.8125H147.083C151.006 90.8125 154.187 93.9931 154.187 97.9167V134.083C154.187 138.007 151.006 141.187 147.083 141.187H110.916C106.993 141.187 103.812 138.007 103.812 134.083V97.9167Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M116.083 90.8125C117.153 90.8125 118.021 91.6799 118.021 92.75V139.25C118.021 140.32 117.153 141.187 116.083 141.187C115.013 141.187 114.146 140.32 114.146 139.25V92.75C114.146 91.6799 115.013 90.8125 116.083 90.8125Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M103.812 104.375C103.812 103.305 104.679 102.438 105.75 102.438H116.083C117.153 102.438 118.02 103.305 118.02 104.375C118.02 105.445 117.153 106.312 116.083 106.312H105.75C104.679 106.312 103.812 105.445 103.812 104.375Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M103.812 116C103.812 114.93 104.679 114.062 105.75 114.062H152.25C153.32 114.062 154.187 114.93 154.187 116C154.187 117.07 153.32 117.937 152.25 117.937H105.75C104.679 117.937 103.812 117.07 103.812 116Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M103.812 127.625C103.812 126.555 104.679 125.688 105.75 125.688H116.083C117.153 125.688 118.02 126.555 118.02 127.625C118.02 128.695 117.153 129.562 116.083 129.562H105.75C104.679 129.562 103.812 128.695 103.812 127.625Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M141.916 90.8125C142.986 90.8125 143.854 91.6799 143.854 92.75V139.25C143.854 140.32 142.986 141.187 141.916 141.187C140.846 141.187 139.979 140.32 139.979 139.25V92.75C139.979 91.6799 140.846 90.8125 141.916 90.8125Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M139.979 104.375C139.979 103.305 140.846 102.438 141.916 102.438H152.249C153.319 102.438 154.187 103.305 154.187 104.375C154.187 105.445 153.319 106.312 152.249 106.312H141.916C140.846 106.312 139.979 105.445 139.979 104.375Z" fill="#B1B1B1"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M139.979 127.625C139.979 126.555 140.846 125.688 141.916 125.688H152.249C153.319 125.688 154.187 126.555 154.187 127.625C154.187 128.695 153.319 129.562 152.249 129.562H141.916C140.846 129.562 139.979 128.695 139.979 127.625Z" fill="#B1B1B1"/>+</g>+<defs>+<filter id="filter0_d_180_1200" x="59.4609" y="0.461426" width="202.413" height="202.413" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dx="2" dy="4"/>+<feGaussianBlur stdDeviation="7"/>+<feComposite in2="hardAlpha" operator="out"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.11 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_180_1200"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_180_1200" result="shape"/>+</filter>+<filter id="filter1_d_180_1200" x="47.9995" y="37" width="166" height="166" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dx="2" dy="4"/>+<feGaussianBlur stdDeviation="7"/>+<feComposite in2="hardAlpha" operator="out"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.11 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_180_1200"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_180_1200" result="shape"/>+</filter>+<linearGradient id="paint0_linear_180_1200" x1="195.513" y1="5.5" x2="195.513" y2="144.5" gradientUnits="userSpaceOnUse">+<stop stop-color="#D4D4D8"/>+<stop offset="1" stop-color="#B0B0B0"/>+</linearGradient>+<linearGradient id="paint1_linear_180_1200" x1="195.513" y1="9" x2="195.513" y2="141" gradientUnits="userSpaceOnUse">+<stop stop-color="white"/>+<stop offset="0.345" stop-color="#FCFCFC"/>+<stop offset="1" stop-color="#EBEAEA"/>+</linearGradient>+<linearGradient id="paint2_linear_180_1200" x1="129" y1="46.5" x2="129" y2="185.5" gradientUnits="userSpaceOnUse">+<stop stop-color="#D4D4D8"/>+<stop offset="1" stop-color="#B0B0B0"/>+</linearGradient>+<linearGradient id="paint3_linear_180_1200" x1="129" y1="50" x2="129" y2="182" gradientUnits="userSpaceOnUse">+<stop stop-color="white"/>+<stop offset="0.345" stop-color="#FCFCFC"/>+<stop offset="1" stop-color="#EBEAEA"/>+</linearGradient>+<clipPath id="clip0_180_1200">+<rect width="62" height="62" fill="white" transform="translate(144.974 56.021) rotate(26.7988)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/frame-sequence-small.svg b/apps/web/src/assets/icons/frame-sequence-small.svgnew file mode 100644index 00000000..9bb18cb4--- /dev/null+++ b/apps/web/src/assets/icons/frame-sequence-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M14.9615 6.92308C14.9615 6.68942 14.7721 6.5 14.5385 6.5C14.3048 6.5 14.1154 6.68942 14.1154 6.92308V9.03846H9.88462V6.92308C9.88462 6.68942 9.6952 6.5 9.46154 6.5C9.22788 6.5 9.03846 6.68942 9.03846 6.92308V9.03846H6.92308C6.68942 9.03846 6.5 9.22788 6.5 9.46154C6.5 9.6952 6.68942 9.88462 6.92308 9.88462H9.03846V14.1154H6.92308C6.68942 14.1154 6.5 14.3048 6.5 14.5385C6.5 14.7721 6.68942 14.9615 6.92308 14.9615H9.03846V17.0769C9.03846 17.3105 9.22788 17.5 9.46154 17.5C9.6952 17.5 9.88462 17.3105 9.88462 17.0769V14.9615H14.1154V17.0769C14.1154 17.3105 14.3048 17.5 14.5385 17.5C14.7721 17.5 14.9615 17.3105 14.9615 17.0769V14.9615H17.0769C17.3105 14.9615 17.5 14.7721 17.5 14.5385C17.5 14.3048 17.3105 14.1154 17.0769 14.1154H14.9615V9.88462H17.0769C17.3105 9.88462 17.5 9.6952 17.5 9.46154C17.5 9.22788 17.3105 9.03846 17.0769 9.03846H14.9615V6.92308ZM14.1154 14.1154V9.88462H9.88462V14.1154H14.1154Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/frame.svg b/apps/web/src/assets/icons/frame.svgnew file mode 100644index 00000000..1064ffd0--- /dev/null+++ b/apps/web/src/assets/icons/frame.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M14.0385 3.07692C14.0385 2.7583 13.7801 2.5 13.4615 2.5C13.143 2.5 12.8846 2.7583 12.8846 3.07692V5.96154H7.11538V3.07692C7.11538 2.7583 6.85708 2.5 6.53846 2.5C6.21984 2.5 5.96154 2.7583 5.96154 3.07692V5.96154H3.07692C2.7583 5.96154 2.5 6.21984 2.5 6.53846C2.5 6.85708 2.7583 7.11538 3.07692 7.11538H5.96154V12.8846H3.07692C2.7583 12.8846 2.5 13.143 2.5 13.4615C2.5 13.7801 2.7583 14.0385 3.07692 14.0385H5.96154V16.9231C5.96154 17.2417 6.21984 17.5 6.53846 17.5C6.85708 17.5 7.11538 17.2417 7.11538 16.9231V14.0385H12.8846V16.9231C12.8846 17.2417 13.143 17.5 13.4615 17.5C13.7801 17.5 14.0385 17.2417 14.0385 16.9231V14.0385H16.9231C17.2417 14.0385 17.5 13.7801 17.5 13.4615C17.5 13.143 17.2417 12.8846 16.9231 12.8846H14.0385V7.11538H16.9231C17.2417 7.11538 17.5 6.85708 17.5 6.53846C17.5 6.21984 17.2417 5.96154 16.9231 5.96154H14.0385V3.07692ZM12.8846 12.8846V7.11538H7.11538V12.8846H12.8846Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/fx.svg b/apps/web/src/assets/icons/fx.svgnew file mode 100644index 00000000..918b31d3--- /dev/null+++ b/apps/web/src/assets/icons/fx.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12 6.02832C12.2383 6.02832 12.469 6.11239 12.6523 6.26465C12.8353 6.41668 12.96 6.62752 13.0039 6.86133L13.5811 9.91797C13.6046 10.042 13.6656 10.1559 13.7549 10.2451C13.8441 10.3344 13.958 10.3945 14.082 10.418L17.1387 10.9961C17.3729 11.0398 17.5831 11.1644 17.7354 11.3477C17.8876 11.531 17.9717 11.7617 17.9717 12C17.9717 12.2383 17.8876 12.469 17.7354 12.6523C17.5832 12.8355 17.3718 12.9591 17.1377 13.0029L14.082 13.5811C13.958 13.6046 13.8441 13.6656 13.7549 13.7549C13.6656 13.8441 13.6055 13.958 13.582 14.082L13.0039 17.1387C12.96 17.3725 12.8353 17.5833 12.6523 17.7354C12.469 17.8876 12.2383 17.9717 12 17.9717C11.7617 17.9717 11.531 17.8876 11.3477 17.7354C11.1647 17.5833 11.04 17.3725 10.9961 17.1387L10.4189 14.082C10.3954 13.958 10.3344 13.8441 10.2451 13.7549C10.1559 13.6656 10.042 13.6055 9.91797 13.582L6.86133 13.0039C6.62759 12.96 6.41664 12.8353 6.26465 12.6523C6.11239 12.469 6.02832 12.2383 6.02832 12C6.02832 11.7617 6.11239 11.531 6.26465 11.3477C6.41668 11.1647 6.62752 11.04 6.86133 10.9961L9.91797 10.4189C10.042 10.3954 10.1559 10.3344 10.2451 10.2451C10.3344 10.1559 10.3945 10.042 10.418 9.91797L10.9961 6.86133C11.04 6.62752 11.1647 6.41668 11.3477 6.26465C11.531 6.11239 11.7617 6.02832 12 6.02832ZM12 6.97168C11.9818 6.97168 11.9642 6.97771 11.9502 6.98926C11.9362 7.00091 11.9263 7.01725 11.9229 7.03516L11.3447 10.0928C11.2861 10.4031 11.1354 10.6888 10.9121 10.9121C10.6888 11.1354 10.4031 11.2861 10.0928 11.3447L7.03613 11.9229C7.01823 11.9263 7.00091 11.9362 6.98926 11.9502C6.97771 11.9642 6.97168 11.9818 6.97168 12C6.97168 12.0182 6.97771 12.0358 6.98926 12.0498C7.00091 12.0638 7.01725 12.0737 7.03516 12.0771L10.0928 12.6553C10.4031 12.7139 10.6888 12.8646 10.9121 13.0879C11.1354 13.3112 11.2861 13.5969 11.3447 13.9072L11.9229 16.9639C11.9263 16.9818 11.9362 16.9991 11.9502 17.0107C11.9642 17.0223 11.9818 17.0283 12 17.0283C12.0182 17.0283 12.0358 17.0223 12.0498 17.0107C12.0638 16.9991 12.0737 16.9827 12.0771 16.9648L12.6553 13.9072C12.7139 13.5969 12.8646 13.3112 13.0879 13.0879C13.3112 12.8646 13.5969 12.7139 13.9072 12.6553L16.9639 12.0771C16.9818 12.0737 16.9991 12.0638 17.0107 12.0498C17.0223 12.0358 17.0283 12.0182 17.0283 12C17.0283 11.9818 17.0223 11.9642 17.0107 11.9502C16.9991 11.9362 16.9827 11.9263 16.9648 11.9229L13.9072 11.3447C13.5969 11.2861 13.3112 11.1354 13.0879 10.9121C12.8646 10.6888 12.7139 10.4031 12.6553 10.0928L12.0771 7.03613C12.0737 7.01823 12.0638 7.00091 12.0498 6.98926C12.0358 6.97771 12.0182 6.97168 12 6.97168Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/generate-audio.svg b/apps/web/src/assets/icons/generate-audio.svgnew file mode 100644index 00000000..1459b94d--- /dev/null+++ b/apps/web/src/assets/icons/generate-audio.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.5 5.99983C10.7761 5.99983 11 6.22368 11 6.49983V17.4998C10.9999 17.7759 10.7761 17.9998 10.5 17.9998C10.2239 17.9998 10.0001 17.7759 10 17.4998V6.49983C10 6.22368 10.2239 5.99983 10.5 5.99983ZM16.5 10.4998C16.7761 10.4998 17 10.7237 17 10.9998V15.9998C16.9999 16.2759 16.7761 16.4998 16.5 16.4998C16.2239 16.4998 16.0001 16.2759 16 15.9998V10.9998C16 10.7237 16.2239 10.4998 16.5 10.4998ZM13.5 9.24983C13.7761 9.24983 14 9.47368 14 9.74983V14.2498C13.9999 14.5259 13.7761 14.7498 13.5 14.7498C13.2239 14.7498 13.0001 14.5259 13 14.2498V9.74983C13 9.47368 13.2239 9.24983 13.5 9.24983ZM7.5 9.49983C7.77614 9.49983 8 9.72368 8 9.99983V13.9998C7.99991 14.2759 7.77608 14.4998 7.5 14.4998C7.22392 14.4998 7.00009 14.2759 7 13.9998V9.99983C7 9.72368 7.22386 9.49983 7.5 9.49983ZM4.5 10.2498C4.77614 10.2498 5 10.4737 5 10.7498V13.2498C4.99991 13.5259 4.77608 13.7498 4.5 13.7498C4.22392 13.7498 4.00009 13.5259 4 13.2498V10.7498C4 10.4737 4.22386 10.2498 4.5 10.2498ZM19.5 10.4998C19.7761 10.4998 20 10.7237 20 10.9998V12.9998C19.9999 13.2759 19.7761 13.4998 19.5 13.4998C19.2239 13.4998 19.0001 13.2759 19 12.9998V10.9998C19 10.7237 19.2239 10.4998 19.5 10.4998ZM16.0146 4.44026C16.1409 3.93528 16.8591 3.93528 16.9854 4.44026L17.2998 5.70002L18.5596 6.01447C19.0645 6.14072 19.0645 6.85893 18.5596 6.98518L17.2998 7.29963L16.9854 8.5594C16.8591 9.06437 16.1409 9.06437 16.0146 8.5594L15.7002 7.29963L14.4404 6.98518C13.9355 6.85893 13.9355 6.14072 14.4404 6.01447L15.7002 5.70002L16.0146 4.44026Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/generate.svg b/apps/web/src/assets/icons/generate.svgnew file mode 100644index 00000000..3529d528--- /dev/null+++ b/apps/web/src/assets/icons/generate.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.1 14.6C11.35 14.6 12.65 9.40002 15.9 9.40002C16.5896 9.40002 17.2509 9.67395 17.7385 10.1615C18.2261 10.6491 18.5 11.3105 18.5 12C18.5 12.6896 18.2261 13.3509 17.7385 13.8385C17.2509 14.3261 16.5896 14.6 15.9 14.6C12.65 14.6 11.35 9.40002 8.1 9.40002C7.41044 9.40002 6.74912 9.67395 6.26152 10.1615C5.77393 10.6491 5.5 11.3105 5.5 12C5.5 12.6896 5.77393 13.3509 6.26152 13.8385C6.74912 14.3261 7.41044 14.6 8.1 14.6Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+</svg>diff --git a/apps/web/src/assets/icons/github.svg b/apps/web/src/assets/icons/github.svgnew file mode 100644index 00000000..6e8052e8--- /dev/null+++ b/apps/web/src/assets/icons/github.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_3995_3378)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C5.37 0 0 5.37 0 12C0 17.31 3.435 21.795 8.205 23.385C8.805 23.49 9.03 23.13 9.03 22.815C9.03 22.53 9.015 21.585 9.015 20.58C6 21.135 5.22 19.845 4.98 19.17C4.845 18.825 4.26 17.76 3.75 17.475C3.33 17.25 2.73 16.695 3.735 16.68C4.68 16.665 5.355 17.55 5.58 17.91C6.66 19.725 8.385 19.215 9.075 18.9C9.18 18.12 9.495 17.595 9.84 17.295C7.17 16.995 4.38 15.96 4.38 11.37C4.38 10.065 4.845 8.985 5.61 8.145C5.49 7.845 5.07 6.615 5.73 4.965C5.73 4.965 6.735 4.65 9.03 6.195C9.99 5.925 11.01 5.79 12.03 5.79C13.05 5.79 14.07 5.925 15.03 6.195C17.325 4.635 18.33 4.965 18.33 4.965C18.99 6.615 18.57 7.845 18.45 8.145C19.215 8.985 19.68 10.05 19.68 11.37C19.68 15.975 16.875 16.995 14.205 17.295C14.64 17.67 15.015 18.39 15.015 19.515C15.015 21.12 15 22.41 15 22.815C15 23.13 15.225 23.505 15.825 23.385C20.565 21.795 24 17.295 24 12C24 5.37 18.63 0 12 0Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_3995_3378">+<rect width="24" height="24" fill="currentColor"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/google.svg b/apps/web/src/assets/icons/google.svgnew file mode 100644index 00000000..7f4562ee--- /dev/null+++ b/apps/web/src/assets/icons/google.svg@@ -0,0 +1,19 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">+ <path+ d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"+ fill="#4285F4"+ />+ <path+ d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"+ fill="#34A853"+ />+ <path+ d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"+ fill="#FBBC05"+ />+ <path+ d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"+ fill="#EA4335"+ />+ <path d="M1 1h22v22H1z" fill="none" />+</svg>diff --git a/apps/web/src/assets/icons/group.svg b/apps/web/src/assets/icons/group.svgnew file mode 100644index 00000000..3e66257b--- /dev/null+++ b/apps/web/src/assets/icons/group.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7 14.875C7.27614 14.875 7.5 15.0989 7.5 15.375V16.5H8.625C8.90114 16.5 9.125 16.7239 9.125 17C9.125 17.2761 8.90114 17.5 8.625 17.5H7.5C6.94772 17.5 6.5 17.0523 6.5 16.5V15.375C6.5 15.0989 6.72386 14.875 7 14.875ZM13.125 16.5C13.4011 16.5 13.625 16.7239 13.625 17C13.625 17.2761 13.4011 17.5 13.125 17.5H10.875C10.5989 17.5 10.375 17.2761 10.375 17C10.375 16.7239 10.5989 16.5 10.875 16.5H13.125ZM17 14.875C17.2761 14.875 17.5 15.0989 17.5 15.375V16.5C17.5 17.0523 17.0523 17.5 16.5 17.5H15.375C15.0989 17.5 14.875 17.2761 14.875 17C14.875 16.7239 15.0989 16.5 15.375 16.5H16.5V15.375C16.5 15.0989 16.7239 14.875 17 14.875ZM7 10.375C7.27614 10.375 7.5 10.5989 7.5 10.875V13.125C7.5 13.4011 7.27614 13.625 7 13.625C6.72386 13.625 6.5 13.4011 6.5 13.125V10.875C6.5 10.5989 6.72386 10.375 7 10.375ZM17 10.375C17.2761 10.375 17.5 10.5989 17.5 10.875V13.125C17.5 13.4011 17.2761 13.625 17 13.625C16.7239 13.625 16.5 13.4011 16.5 13.125V10.875C16.5 10.5989 16.7239 10.375 17 10.375ZM8.625 6.5C8.90114 6.5 9.125 6.72386 9.125 7C9.125 7.27614 8.90114 7.5 8.625 7.5H7.5V8.625C7.5 8.90114 7.27614 9.125 7 9.125C6.72386 9.125 6.5 8.90114 6.5 8.625V7.5C6.5 6.94772 6.94772 6.5 7.5 6.5H8.625ZM16.5 6.5C17.0523 6.5 17.5 6.94772 17.5 7.5V8.625C17.5 8.90114 17.2761 9.125 17 9.125C16.7239 9.125 16.5 8.90114 16.5 8.625V7.5H15.375C15.0989 7.5 14.875 7.27614 14.875 7C14.875 6.72386 15.0989 6.5 15.375 6.5H16.5ZM13.125 6.5C13.4011 6.5 13.625 6.72386 13.625 7C13.625 7.27614 13.4011 7.5 13.125 7.5H10.875C10.5989 7.5 10.375 7.27614 10.375 7C10.375 6.72386 10.5989 6.5 10.875 6.5H13.125Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/grow-auto-height.svg b/apps/web/src/assets/icons/grow-auto-height.svgnew file mode 100644index 00000000..effd20d8--- /dev/null+++ b/apps/web/src/assets/icons/grow-auto-height.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9 6.25C9.11563 6.24996 9.22758 6.29129 9.31641 6.36621C9.40523 6.44113 9.46552 6.54505 9.48633 6.66016L9.49414 6.75V16.542L11.1553 14.8613C11.237 14.7785 11.3457 14.7264 11.4609 14.7158C11.576 14.7053 11.6911 14.7363 11.7861 14.8027L11.8555 14.8613C11.937 14.9441 11.9878 15.0535 11.998 15.1699C12.0082 15.2864 11.9769 15.4029 11.9111 15.499L11.8545 15.5684L9.34961 18.1035C9.26784 18.1861 9.15996 18.2375 9.04492 18.248C8.92973 18.2585 8.8138 18.2278 8.71875 18.1611L8.65039 18.1035L6.14551 15.5684C6.05798 15.4802 6.00571 15.3612 6 15.2363C5.99438 15.1116 6.0353 14.9894 6.11426 14.8936C6.19336 14.7976 6.30534 14.7345 6.42773 14.7178C6.54999 14.7011 6.67405 14.7316 6.77539 14.8027L6.84375 14.8613L8.50586 16.542V6.75C8.50582 6.63298 8.54707 6.51959 8.62109 6.42969C8.69508 6.33995 8.79753 6.27887 8.91113 6.25781L9 6.25ZM18.5 15.5C18.6325 15.5001 18.7598 15.5528 18.8535 15.6465C18.9472 15.7402 19 15.8674 19 16C19 16.1326 18.9472 16.2598 18.8535 16.3535C18.7598 16.4472 18.6325 16.4999 18.5 16.5H15.5C15.3674 16.5 15.2402 16.4472 15.1465 16.3535C15.0527 16.2597 15 16.1326 15 16C15 15.8674 15.0527 15.7403 15.1465 15.6465C15.2402 15.5528 15.3674 15.5 15.5 15.5H18.5ZM18.5 11.5C18.6325 11.5001 18.7598 11.5528 18.8535 11.6465C18.9472 11.7402 19 11.8674 19 12C19 12.1326 18.9472 12.2598 18.8535 12.3535C18.7598 12.4472 18.6325 12.4999 18.5 12.5H12.5C12.3674 12.5 12.2402 12.4472 12.1465 12.3535C12.0527 12.2597 12 12.1326 12 12C12 11.8674 12.0527 11.7403 12.1465 11.6465C12.2402 11.5528 12.3674 11.5 12.5 11.5H18.5ZM18.5 7.5C18.6325 7.50005 18.7598 7.55276 18.8535 7.64648C18.9472 7.74024 19 7.86744 19 8C19 8.13256 18.9472 8.25976 18.8535 8.35352C18.7598 8.44724 18.6325 8.49995 18.5 8.5H12.5C12.3674 8.5 12.2402 8.44722 12.1465 8.35352C12.0527 8.25975 12 8.13261 12 8C12 7.86739 12.0527 7.74025 12.1465 7.64648C12.2402 7.55278 12.3674 7.5 12.5 7.5H18.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/grow-auto-width.svg b/apps/web/src/assets/icons/grow-auto-width.svgnew file mode 100644index 00000000..b41e96e0--- /dev/null+++ b/apps/web/src/assets/icons/grow-auto-width.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.9863 9.00098C16.1112 9.00669 16.2302 9.05798 16.3184 9.14551L18.8535 11.6504L18.9111 11.7197C18.9777 11.8147 19.0085 11.9298 18.998 12.0449C18.9876 12.1601 18.9362 12.2677 18.8535 12.3496L16.3184 14.8545L16.249 14.9121C16.1529 14.9779 16.0364 15.0083 15.9199 14.998C15.8034 14.9878 15.6942 14.9371 15.6113 14.8555L15.5527 14.7861C15.4864 14.691 15.4562 14.576 15.4668 14.4609C15.4774 14.3458 15.5285 14.238 15.6113 14.1562L17.292 12.4941H6.70801L8.38867 14.1562C8.47148 14.238 8.52259 14.3458 8.5332 14.4609C8.54379 14.576 8.51363 14.691 8.44727 14.7861L8.38867 14.8555C8.30583 14.9371 8.19663 14.9878 8.08008 14.998C7.9636 15.0083 7.84709 14.9779 7.75098 14.9121L7.68164 14.8545L5.14648 12.3496C5.06381 12.2677 5.01237 12.1601 5.00195 12.0449C4.99155 11.9298 5.02231 11.8147 5.08887 11.7197L5.14648 11.6504L7.68164 9.14551C7.76983 9.05798 7.88881 9.00669 8.01367 9.00098C8.13827 8.99537 8.26059 9.03541 8.35645 9.11426C8.4524 9.19333 8.51546 9.3054 8.53223 9.42773C8.54896 9.55013 8.51857 9.67493 8.44727 9.77637L8.38867 9.84375L6.70801 11.5059H17.292L15.6113 9.84375L15.5527 9.77637C15.4814 9.67493 15.451 9.55013 15.4678 9.42773C15.4845 9.3054 15.5476 9.19333 15.6436 9.11426C15.7394 9.0354 15.8617 8.99538 15.9863 9.00098Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/grow-fixed-size.svg b/apps/web/src/assets/icons/grow-fixed-size.svgnew file mode 100644index 00000000..692b9aee--- /dev/null+++ b/apps/web/src/assets/icons/grow-fixed-size.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.875 6.625C9.15114 6.625 9.375 6.84886 9.375 7.125V7.5H14.625V7.125C14.625 6.84886 14.8489 6.625 15.125 6.625H16.875C17.1511 6.625 17.375 6.84886 17.375 7.125V8.875C17.375 9.15114 17.1511 9.375 16.875 9.375H16.5V14.625H16.875C17.1511 14.625 17.375 14.8489 17.375 15.125V16.875C17.375 17.1511 17.1511 17.375 16.875 17.375H15.125C14.8489 17.375 14.625 17.1511 14.625 16.875V16.5H9.375V16.875C9.375 17.1511 9.15114 17.375 8.875 17.375H7.125C6.84886 17.375 6.625 17.1511 6.625 16.875V15.125C6.625 14.8489 6.84886 14.625 7.125 14.625H7.5V9.375H7.125C6.84886 9.375 6.625 9.15114 6.625 8.875V7.125C6.625 6.84886 6.84886 6.625 7.125 6.625H8.875ZM9.375 8.875C9.375 9.15114 9.15114 9.375 8.875 9.375H8.2998V14.625H8.875C9.15114 14.625 9.375 14.8489 9.375 15.125V15.7002H14.625V15.125C14.625 14.8489 14.8489 14.625 15.125 14.625H15.7002V9.375H15.125C14.8489 9.375 14.625 9.15114 14.625 8.875V8.2998H9.375V8.875Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/hand.svg b/apps/web/src/assets/icons/hand.svgnew file mode 100644index 00000000..896516af--- /dev/null+++ b/apps/web/src/assets/icons/hand.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.1615 4.00011C12.9567 4.00864 13.8285 4.47828 14.0395 5.45218C14.1444 5.35056 14.2594 5.26336 14.3836 5.19177C14.7851 4.96047 15.238 4.91713 15.6527 5.01156C16.4722 5.19845 17.1848 5.93155 17.2523 6.94592C17.2541 6.97046 17.2558 6.99526 17.2575 7.01988C17.5884 6.77875 18.0068 6.69468 18.4859 6.78967C18.9167 6.87524 19.4585 7.19162 19.7643 7.87196C20.0658 8.54273 20.1073 9.49672 19.7163 10.8178C19.3625 12.0135 18.9635 13.0122 18.6037 13.9115C18.4273 14.3524 18.2599 14.7702 18.1126 15.175C17.6586 16.4228 17.3357 17.6762 17.3357 19.4667C17.3357 19.7612 17.0967 20 16.8018 20H9.3272C9.03256 19.9997 8.79331 19.7611 8.79331 19.4667C8.79331 18.3607 8.05584 17.3227 7.04354 16.224C6.79889 15.9585 6.54622 15.6964 6.2917 15.4334L6.2844 15.4271C6.02923 15.1634 5.77258 14.8965 5.53048 14.6323C5.05255 14.1107 4.60162 13.5621 4.3146 12.9907C4.05989 12.5028 3.88022 11.8003 4.09667 11.2136L4.09979 11.2042C4.24552 10.831 4.47388 10.4984 4.81931 10.2771C5.16752 10.0541 5.57839 9.98052 6.02058 10.0251C6.67869 10.0886 7.15345 10.3803 7.55345 10.7334C7.39875 10.292 7.21527 9.85437 7.02372 9.39903C7.0004 9.34357 6.97633 9.28735 6.95282 9.23132C6.68361 8.58986 6.40659 7.9125 6.22288 7.19696L6.22079 7.18655C6.06502 6.52523 6.26741 5.85556 6.6963 5.40739C7.13764 4.94622 7.81823 4.72499 8.54304 4.97823C9.24855 5.22578 9.74874 5.78541 10.1082 6.4178C10.1311 6.1493 10.1627 5.87554 10.2063 5.59281L10.2073 5.58969C10.3824 4.49723 11.3183 3.99128 12.1615 4.00011ZM12.15 5.06677C11.7022 5.06216 11.334 5.30955 11.2615 5.75739C11.0594 7.07134 11.1241 8.14436 11.2157 9.6584C11.2324 9.93491 11.2508 10.2264 11.2678 10.5365C11.2833 10.8181 11.0759 11.0634 10.7954 11.0959C10.5152 11.1281 10.2578 10.9369 10.2083 10.6594L10.126 10.1938C10.0154 9.50937 9.84417 8.53824 9.51803 7.67716C9.18099 6.7873 8.73863 6.17729 8.18954 5.98447C7.88594 5.87857 7.63911 5.96603 7.46795 6.14489C7.28531 6.33595 7.18991 6.63552 7.2594 6.93759C7.42156 7.5671 7.66909 8.17751 7.93823 8.81883C7.96222 8.87596 7.98589 8.93402 8.01019 8.99174C8.25488 9.57302 8.51222 10.1836 8.70467 10.8167V10.8188C8.85956 11.3344 8.96101 11.7434 9.04044 12.0657C9.07192 12.1934 9.10021 12.3078 9.127 12.4094C9.18656 12.636 9.09065 12.8746 8.89133 12.998C8.69192 13.1214 8.43496 13.1012 8.25837 12.9469C7.97908 12.7029 7.74172 12.4561 7.53156 12.2323C7.4869 12.1848 7.4438 12.1383 7.40225 12.0938C7.24307 11.9232 7.10385 11.7738 6.96116 11.6375C6.61588 11.308 6.32092 11.1254 5.91734 11.0865H5.91422C5.65586 11.0603 5.49897 11.1091 5.39596 11.1751C5.2907 11.2425 5.18428 11.3645 5.09668 11.5865C5.03131 11.7706 5.07284 12.1383 5.26248 12.5L5.26666 12.5094C5.48402 12.9436 5.85156 13.4037 6.31777 13.9125C6.54839 14.1643 6.79598 14.4199 7.05293 14.6854L7.06335 14.6969C7.31507 14.957 7.57625 15.2259 7.82979 15.501C8.71784 16.4649 9.62324 17.6041 9.82148 18.9333H16.2773C16.336 17.2644 16.6696 16.0193 17.1094 14.8105C17.2779 14.3473 17.456 13.9032 17.6381 13.449C17.9874 12.5777 18.351 11.6687 18.6923 10.5157C19.043 9.33078 18.9478 8.66198 18.7893 8.30945C18.6353 7.96677 18.3946 7.85875 18.2774 7.8355C18.0176 7.78404 17.9105 7.84989 17.8372 7.92404C17.7276 8.03517 17.6241 8.24848 17.5411 8.58966C17.4605 8.92112 17.4162 9.29649 17.3711 9.68028L17.368 9.70944C17.3281 10.0502 17.2836 10.4321 17.1939 10.7209C17.1639 10.8339 17.1031 10.9375 17.0135 11.0136C16.9497 11.0677 16.8131 11.1557 16.6214 11.1396C16.3135 11.1137 16.1307 10.8491 16.124 10.5574C16.1145 10.138 16.1496 9.71554 16.1698 9.29695C16.2077 8.51879 16.2436 7.76905 16.1876 7.02301V7.0178C16.1528 6.4853 15.787 6.13591 15.4149 6.05114C15.2333 6.00978 15.0609 6.03318 14.9175 6.11572C14.7769 6.19674 14.6185 6.36062 14.514 6.68134L14.5129 6.6855C14.4691 6.81696 14.424 7.07034 14.3846 7.42717C14.3467 7.77152 14.3183 8.17377 14.295 8.58029C14.2751 8.9281 14.2583 9.28885 14.2439 9.61257C14.2257 10.0215 14.2102 10.372 14.1928 10.5636C14.1858 10.6396 14.1637 10.7143 14.1271 10.7813C14.1042 10.8232 13.9843 11.0499 13.6745 11.0594C13.3631 11.0689 13.214 10.8277 13.1896 10.7834C13.1249 10.6659 13.1189 10.5263 13.1156 10.3928C13.1126 10.2731 13.1106 10.0994 13.1093 9.91777C13.1068 9.55363 13.1073 9.14165 13.1073 9.02403C13.1073 7.91065 13.1056 6.83054 13.0082 5.75323C12.949 5.32407 12.5975 5.07157 12.15 5.06677Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/help.svg b/apps/web/src/assets/icons/help.svgnew file mode 100644index 00000000..5fb4e4f1--- /dev/null+++ b/apps/web/src/assets/icons/help.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 5.25C15.7279 5.25 18.75 8.27208 18.75 12C18.75 15.7279 15.7279 18.75 12 18.75C8.27208 18.75 5.25 15.7279 5.25 12C5.25 8.27208 8.27208 5.25 12 5.25ZM12 6.25C8.82436 6.25 6.25 8.82436 6.25 12C6.25 15.1756 8.82436 17.75 12 17.75C15.1756 17.75 17.75 15.1756 17.75 12C17.75 8.82436 15.1756 6.25 12 6.25ZM11.833 13.667C12.0098 13.667 12.1797 13.7374 12.3047 13.8623C12.4297 13.9873 12.5 14.1572 12.5 14.334C12.5 14.5108 12.4297 14.6807 12.3047 14.8057C12.1797 14.9306 12.0097 15.001 11.833 15.001C11.6565 15.0009 11.4872 14.9304 11.3623 14.8057C11.2373 14.6807 11.167 14.5108 11.167 14.334C11.167 14.1572 11.2373 13.9873 11.3623 13.8623C11.4872 13.7375 11.6564 13.6671 11.833 13.667ZM12.0088 8.50098C12.642 8.51234 13.2037 8.77734 13.5557 9.21387C13.9137 9.65853 14.0342 10.2608 13.7969 10.8535C13.5555 11.4564 13.0102 11.6967 12.6963 11.834L12.6631 11.8496C12.4764 11.9316 12.3873 11.9739 12.334 12.0166L12.333 12.5C12.3331 12.6325 12.2811 12.7597 12.1875 12.8535C12.0939 12.9473 11.9665 12.9998 11.834 13C11.7016 13.0001 11.5743 12.9479 11.4805 12.8545C11.3867 12.7609 11.3332 12.6334 11.333 12.501V12.001C11.333 11.6523 11.5017 11.403 11.709 11.2363C11.8756 11.1031 12.0851 11.0106 12.2324 10.9453L12.2578 10.9336C12.619 10.7743 12.7911 10.6759 12.8691 10.4814C12.9149 10.3769 12.9303 10.2614 12.9141 10.1484C12.8978 10.0354 12.8508 9.92835 12.7773 9.84082C12.6293 9.6576 12.3577 9.50697 11.9912 9.50098C11.3681 9.49034 11.1609 9.69006 11.0889 9.78809C11.0406 9.85249 11.0103 9.92898 11 10.0088V10.0127C10.9968 10.1431 10.9429 10.2673 10.8496 10.3584C10.7562 10.4496 10.6306 10.501 10.5 10.501C10.0042 10.501 10 10.0082 10 10V9.99414C9.99977 9.96428 10.0011 9.93392 10.0049 9.9043C10.0337 9.64675 10.1307 9.40146 10.2852 9.19336C10.5878 8.78469 11.1321 8.48564 12.0088 8.50098Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/horizontal-align-center.svg b/apps/web/src/assets/icons/horizontal-align-center.svgnew file mode 100644index 00000000..f6df1e03--- /dev/null+++ b/apps/web/src/assets/icons/horizontal-align-center.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" d="M11.4062 19.3228C11.4062 19.4803 11.4688 19.6313 11.5802 19.7427C11.6915 19.854 11.8425 19.9166 12 19.9166C12.1575 19.9166 12.3085 19.854 12.4198 19.7427C12.5312 19.6313 12.5938 19.4803 12.5938 19.3228C12.5938 14.4409 12.5938 9.55895 12.5938 4.677C12.5938 4.51953 12.5312 4.36851 12.4198 4.25716C12.3085 4.14581 12.1575 4.08325 12 4.08325C11.8425 4.08325 11.6915 4.14581 11.5802 4.25716C11.4688 4.36851 11.4063 4.51953 11.4063 4.677C11.4063 13.4762 11.4063 10.6117 11.4062 19.3228Z" fill="currentColor"/>+<path d="M15.5625 14.375C16.8742 14.375 17.9375 13.3117 17.9375 12C17.9375 10.6883 16.8742 9.625 15.5625 9.625L8.4375 9.625C7.12582 9.625 6.0625 10.6883 6.0625 12C6.0625 13.3117 7.12582 14.375 8.4375 14.375L15.5625 14.375Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/horizontal-align-left.svg b/apps/web/src/assets/icons/horizontal-align-left.svgnew file mode 100644index 00000000..a65746c3--- /dev/null+++ b/apps/web/src/assets/icons/horizontal-align-left.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" d="M4.875 4.677C4.875 4.51953 4.93756 4.36851 5.04891 4.25716C5.16025 4.14581 5.31128 4.08325 5.46875 4.08325C5.62622 4.08325 5.77724 4.14581 5.88859 4.25716C5.99994 4.36851 6.0625 4.51953 6.0625 4.677V19.3228C6.0625 19.4803 5.99994 19.6313 5.88859 19.7427C5.77724 19.854 5.62622 19.9166 5.46875 19.9166C5.31128 19.9166 5.16025 19.854 5.04891 19.7427C4.93756 19.6313 4.875 19.4803 4.875 19.3228V4.677Z" fill="currentColor"/>+<path d="M9.625 9.625C8.31332 9.625 7.25 10.6883 7.25 12C7.25 13.3117 8.31332 14.375 9.625 14.375H16.75C18.0617 14.375 19.125 13.3117 19.125 12C19.125 10.6883 18.0617 9.625 16.75 9.625H9.625Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/horizontal-align-right.svg b/apps/web/src/assets/icons/horizontal-align-right.svgnew file mode 100644index 00000000..554f424f--- /dev/null+++ b/apps/web/src/assets/icons/horizontal-align-right.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" d="M19.125 4.677C19.125 4.51953 19.0624 4.36851 18.9511 4.25716C18.8397 4.14581 18.6887 4.08325 18.5312 4.08325C18.3738 4.08325 18.2228 4.14581 18.1114 4.25716C18.0001 4.36851 17.9375 4.51953 17.9375 4.677V19.3228C17.9375 19.4803 18.0001 19.6313 18.1114 19.7427C18.2228 19.854 18.3738 19.9166 18.5312 19.9166C18.6887 19.9166 18.8397 19.854 18.9511 19.7427C19.0624 19.6313 19.125 19.4803 19.125 19.3228V4.677Z" fill="currentColor"/>+<path d="M14.375 9.625C15.6867 9.625 16.75 10.6883 16.75 12C16.75 13.3117 15.6867 14.375 14.375 14.375H7.25C5.93832 14.375 4.875 13.3117 4.875 12C4.875 10.6883 5.93832 9.625 7.25 9.625H14.375Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/icon.24.tool.blade-small.svg b/apps/web/src/assets/icons/icon.24.tool.blade-small.svgnew file mode 100644index 00000000..ecbe074d--- /dev/null+++ b/apps/web/src/assets/icons/icon.24.tool.blade-small.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.5205 12.0034C10.5205 11.7994 10.6867 11.6335 10.8906 11.6333H11.6289L11.6289 9.31104L10.7734 9.02686C10.5802 8.96215 10.4758 8.7525 10.54 8.55908C10.6046 8.36564 10.8143 8.26042 11.0078 8.32471L11.999 8.65674L12.9922 8.32471C13.1856 8.26061 13.3944 8.36572 13.459 8.55908C13.5235 8.75268 13.4191 8.96224 13.2256 9.02686L12.3691 9.31201V11.6333H13.1084C13.3125 11.6334 13.4785 11.7993 13.4785 12.0034C13.4782 12.2073 13.3123 12.3735 13.1084 12.3735H12.3691L12.3691 14.6929L13.2256 14.979C13.4191 15.0435 13.5232 15.2532 13.459 15.4468C13.3942 15.64 13.1856 15.7444 12.9922 15.6802L11.999 15.3491L11.0078 15.6802C10.8143 15.7444 10.6047 15.6401 10.54 15.4468C10.4759 15.2534 10.5803 15.0438 10.7734 14.979L11.6289 14.6938V12.3735H10.8906C10.6868 12.3733 10.5208 12.2072 10.5205 12.0034Z" fill="#9E9E9E"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.7002 6.5C7.70037 5.53957 8.47899 4.76079 9.43945 4.76074L10.3525 4.76074C10.6328 4.76082 10.9088 4.82924 11.1572 4.95898L12 5.39941L12.8428 4.95898C13.0913 4.82917 13.368 4.76074 13.6484 4.76074L14.5605 4.76074C15.5211 4.76074 16.2996 5.53953 16.2998 6.5V17.5C16.2995 18.4005 15.6154 19.1416 14.7383 19.2305L14.5605 19.2393H13.6484C13.3681 19.2393 13.0913 19.1717 12.8428 19.042L12 18.6016L11.1572 19.042C10.9089 19.1716 10.6326 19.2392 10.3525 19.2393H9.43945C8.47907 19.2392 7.70051 18.4603 7.7002 17.5L7.7002 6.5ZM8.7002 17.5C8.70051 17.908 9.03136 18.2392 9.43945 18.2393H10.3525C10.4715 18.2392 10.5889 18.2103 10.6943 18.1553L11.9658 17.4912C11.9872 17.48 12.0128 17.4801 12.0342 17.4912L13.3057 18.1553C13.4113 18.2104 13.5293 18.2393 13.6484 18.2393H14.5605C14.9687 18.2393 15.2995 17.9081 15.2998 17.5L15.2998 6.5L15.2959 6.4248C15.2606 6.07693 14.9845 5.80012 14.6367 5.76465L14.5605 5.76074H13.6484C13.5592 5.76074 13.4708 5.77729 13.3877 5.80859L13.3057 5.84473L12.0342 6.50879C12.0129 6.51982 11.9871 6.51984 11.9658 6.50879L10.6943 5.84473C10.6153 5.80346 10.5295 5.77733 10.4414 5.7666L10.3525 5.76074H9.43945C9.05666 5.76079 8.74193 6.05198 8.7041 6.4248L8.7002 6.5L8.7002 17.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/icon.24.tool.blade.svg b/apps/web/src/assets/icons/icon.24.tool.blade.svgnew file mode 100644index 00000000..ce043eb8--- /dev/null+++ b/apps/web/src/assets/icons/icon.24.tool.blade.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10 12C10.0002 11.7242 10.2242 11.5002 10.5 11.5H11.5L11.5 8.36035L10.3418 7.97461C10.0801 7.88725 9.93841 7.60356 10.0254 7.3418C10.1129 7.08021 10.3965 6.93828 10.6582 7.02539L12 7.47266L13.3418 7.02539C13.6036 6.93847 13.8873 7.08013 13.9746 7.3418C14.0617 7.60352 13.9197 7.8871 13.6582 7.97461L12.5 8.36035L12.5 11.5H13.5C13.7758 11.5003 13.9998 11.7242 14 12C13.9998 12.2758 13.7758 12.4997 13.5 12.5H12.5V15.6396L13.6582 16.0254C13.9198 16.1128 14.0616 16.3965 13.9746 16.6582C13.8871 16.9198 13.6035 17.0617 13.3418 16.9746L12 16.5273L10.6582 16.9746C10.3964 17.0616 10.1128 16.9199 10.0254 16.6582C9.93825 16.3964 10.0802 16.1129 10.3418 16.0254L11.5 15.6396V12.5H10.5C10.2242 12.4998 10.0002 12.2758 10 12Z" fill="#9E9E9E"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.58984 5.5C6.58984 4.30707 7.55707 3.33984 8.75 3.33984L9.8623 3.33984C10.2145 3.33984 10.5618 3.4261 10.873 3.59082L12 4.18848L13.127 3.59082C13.4382 3.4261 13.7855 3.33984 14.1377 3.33984L15.25 3.33984C16.4429 3.33984 17.4102 4.30707 17.4102 5.5L17.4102 18.5C17.4102 19.6929 16.4429 20.6602 15.25 20.6602H14.1377C13.7855 20.6602 13.4382 20.5739 13.127 20.4092L12 19.8115L10.873 20.4092C10.5618 20.5739 10.2145 20.6602 9.86231 20.6602H8.75C7.55706 20.6602 6.58984 19.6929 6.58984 18.5L6.58984 5.5ZM7.75 18.5C7.75 19.0523 8.19772 19.5 8.75 19.5H9.86231C10.0254 19.5 10.1869 19.4601 10.3311 19.3838L11.9531 18.5244C11.9824 18.509 12.0177 18.509 12.0469 18.5244L13.6689 19.3838C13.8131 19.4601 13.9746 19.5 14.1377 19.5H15.25L15.3525 19.4951C15.823 19.4472 16.1972 19.073 16.2451 18.6025L16.25 18.5L16.25 5.5L16.2451 5.39746C16.1938 4.89333 15.7677 4.5 15.25 4.5H14.1377C14.0154 4.5 13.8939 4.52203 13.7803 4.56543L13.6689 4.61621L12.0469 5.47559C12.0176 5.49102 11.9824 5.49102 11.9531 5.47559L10.3311 4.61621C10.1869 4.5399 10.0254 4.5 9.8623 4.5H8.75C8.19772 4.5 7.75 4.94772 7.75 5.5L7.75 18.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/image-small.svg b/apps/web/src/assets/icons/image-small.svgnew file mode 100644index 00000000..261b2e36--- /dev/null+++ b/apps/web/src/assets/icons/image-small.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.57223 11.2207C8.78406 11.0089 9.11328 10.9892 9.34664 11.1572L9.44039 11.2412L12.3632 14.4561L14.4101 12.6865L14.5088 12.6172C14.7166 12.5002 14.9763 12.5185 15.166 12.6631L15.2539 12.7451L17.3759 15.1709C17.5578 15.3787 17.5368 15.6941 17.3291 15.876C17.1213 16.0578 16.8058 16.0369 16.624 15.8291L14.7636 13.7031L13.0361 15.1963L14.3701 16.6641C14.5555 16.8684 14.5401 17.1845 14.3359 17.3701C14.1316 17.5556 13.8155 17.5401 13.6298 17.3359L8.98238 12.2236L7.35348 13.8535C7.15823 14.0488 6.84171 14.0487 6.64645 13.8535C6.45118 13.6583 6.45118 13.3417 6.64645 13.1465L8.57223 11.2207ZM12.5 9C13.3284 9 14 9.67157 14 10.5C14 11.3284 13.3284 12 12.5 12C11.6715 12 11 11.3284 11 10.5C11 9.67157 11.6715 9 12.5 9ZM12.5 10C12.2238 10 12 10.2239 12 10.5C12 10.7761 12.2238 11 12.5 11C12.7761 11 13 10.7761 13 10.5C13 10.2239 12.7761 10 12.5 10Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 6.50049C17.0523 6.50049 17.5 6.9482 17.5 7.50049V16.5005C17.4997 17.0525 17.0521 17.5005 16.5 17.5005H7.5C6.94788 17.5005 6.50026 17.0525 6.5 16.5005V7.50049C6.5 6.9482 6.94772 6.50049 7.5 6.50049H16.5ZM7.5 16.5005H16.5V7.50049H7.5V16.5005Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/image.svg b/apps/web/src/assets/icons/image.svgnew file mode 100644index 00000000..37b69ef5--- /dev/null+++ b/apps/web/src/assets/icons/image.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.38462 6H16.6154C17.3801 6 18 6.61991 18 7.38462V16.6154C18 17.3801 17.3801 18 16.6154 18H7.38462C6.61991 18 6 17.3801 6 16.6154V7.38462C6 6.61991 6.61991 6 7.38462 6ZM7.38462 6.92308C7.12972 6.92308 6.92308 7.12972 6.92308 7.38462V12.7972L8.47551 11.2447C8.55516 11.1651 8.66374 11.1212 8.77638 11.1231C8.889 11.1251 8.99601 11.1727 9.07288 11.255L12.3448 14.7601L14.937 12.1678C15.0992 12.0056 15.3623 12.0056 15.5245 12.1678L17.0769 13.7202V7.38462C17.0769 7.12972 16.8702 6.92308 16.6154 6.92308H7.38462ZM6.92308 16.6154V13.9721L8.75896 12.1362L12.0287 15.6389L13.3303 17.0769H7.38462C7.12972 17.0769 6.92308 16.8702 6.92308 16.6154ZM16.6154 17.0769H14.4508L12.9077 15.372L15.2308 13.049L17.0769 14.8951V16.6154C17.0769 16.8702 16.8702 17.0769 16.6154 17.0769ZM11.2147 10.1538C11.2147 9.72012 11.5663 9.36851 12 9.36851C12.4337 9.36851 12.7853 9.72012 12.7853 10.1538C12.7853 10.5876 12.4337 10.9392 12 10.9392C11.5663 10.9392 11.2147 10.5876 11.2147 10.1538ZM12 8.53774C11.1074 8.53774 10.3839 9.2613 10.3839 10.1538C10.3839 11.0464 11.1074 11.77 12 11.77C12.8926 11.77 13.6161 11.0464 13.6161 10.1538C13.6161 9.2613 12.8926 8.53774 12 8.53774Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/info.svg b/apps/web/src/assets/icons/info.svgnew file mode 100644index 00000000..9a80cb0f--- /dev/null+++ b/apps/web/src/assets/icons/info.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.0001 5.81934C15.4131 5.81951 18.1796 8.58674 18.1796 11.9998C18.1794 15.4128 15.413 18.1792 12.0001 18.1793C8.58697 18.1793 5.81976 15.4129 5.81958 11.9998C5.81958 8.58663 8.58686 5.81934 12.0001 5.81934ZM12.0001 6.70589C9.07646 6.70589 6.70613 9.07623 6.70613 11.9998C6.70631 14.9232 9.07657 17.2928 12.0001 17.2928C14.9234 17.2926 17.2928 14.9231 17.293 11.9998C17.293 9.07634 14.9235 6.70607 12.0001 6.70589ZM12.0997 10.5997C12.3573 10.5997 12.5662 10.8088 12.5664 11.0664V14.3324H13.4998V15.2658H10.7005V14.3324H11.6339V11.5331H10.7005V10.5997H12.0997ZM12.0997 8.50048C12.4862 8.50048 12.7997 8.81401 12.7997 9.20054C12.7996 9.58698 12.4861 9.90061 12.0997 9.90061C11.7133 9.90045 11.3997 9.58688 11.3996 9.20054C11.3996 8.8141 11.7133 8.50063 12.0997 8.50048Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyboard-shortcut.svg b/apps/web/src/assets/icons/keyboard-shortcut.svgnew file mode 100644index 00000000..af1aaf6f--- /dev/null+++ b/apps/web/src/assets/icons/keyboard-shortcut.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M18.6 7.73338H5.4C5.14227 7.73338 4.93333 7.94232 4.93333 8.20005V15.8C4.93333 16.0577 5.14227 16.2667 5.4 16.2667H18.6C18.8577 16.2667 19.0667 16.0577 19.0667 15.8V8.20005C19.0667 7.94232 18.8577 7.73338 18.6 7.73338ZM5.4 6.80005C4.6268 6.80005 4 7.42685 4 8.20005V15.8C4 16.5732 4.6268 17.2 5.4 17.2H18.6C19.3732 17.2 20 16.5732 20 15.8V8.20005C20 7.42685 19.3732 6.80005 18.6 6.80005H5.4ZM6.86667 9.66672H7.8V10.6H6.86667V9.66672ZM9.66667 9.66672H8.73333V10.6H9.66667V9.66672ZM10.6 9.66672H11.5333V10.6H10.6V9.66672ZM13.4 9.66672H12.4667V10.6H13.4V9.66672ZM14.3333 9.66672H15.2667V10.6H14.3333V9.66672ZM17.1333 9.66672H16.2V10.6H17.1333V9.66672ZM15.2667 11.5334H16.2V12.4667H15.2667V11.5334ZM17.1333 13.4H16.2V14.3334H17.1333V13.4ZM13.4 11.5334H14.3333V12.4667H13.4V11.5334ZM12.4667 11.5334H11.5333V12.4667H12.4667V11.5334ZM9.66667 11.5334H10.6V12.4667H9.66667V11.5334ZM8.73333 11.5334H7.8V12.4667H8.73333V11.5334ZM6.86667 13.4H7.8V14.3334H6.86667V13.4ZM15.2667 13.4H8.73333V14.3334H15.2667V13.4Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyframe-default.svg b/apps/web/src/assets/icons/keyframe-default.svgnew file mode 100644index 00000000..db20fd96--- /dev/null+++ b/apps/web/src/assets/icons/keyframe-default.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M11.7578 7.87552C11.8918 7.74152 12.109 7.74152 12.243 7.87552L16.1249 11.7574C16.2588 11.8914 16.2588 12.1086 16.1249 12.2426L12.243 16.1245C12.109 16.2585 11.8918 16.2585 11.7578 16.1245L7.87588 12.2426C7.74189 12.1086 7.74189 11.8914 7.87588 11.7574L11.7578 7.87552ZM12.0004 8.60338L8.60374 12L12.0004 15.3966L15.397 12L12.0004 8.60338Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyframe-go-to-next.svg b/apps/web/src/assets/icons/keyframe-go-to-next.svgnew file mode 100644index 00000000..d651089c--- /dev/null+++ b/apps/web/src/assets/icons/keyframe-go-to-next.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.1299 16.0755V7.92444L15.3699 12L10.1299 16.0755Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyframe-go-to-previous.svg b/apps/web/src/assets/icons/keyframe-go-to-previous.svgnew file mode 100644index 00000000..252a8efa--- /dev/null+++ b/apps/web/src/assets/icons/keyframe-go-to-previous.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.8699 7.92444V16.0755L8.62988 12L13.8699 7.92444Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyframe-indicator-default.svg b/apps/web/src/assets/icons/keyframe-indicator-default.svgnew file mode 100644index 00000000..5c962e8f--- /dev/null+++ b/apps/web/src/assets/icons/keyframe-indicator-default.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 6C13.7761 6 14 6.22386 14 6.5C14 6.77614 13.7761 7 13.5 7H12.5V8.02441C13.3804 8.11183 14.1929 8.42898 14.8789 8.91309L15.6465 8.14648C15.8417 7.95122 16.1583 7.95122 16.3535 8.14648C16.5488 8.34175 16.5488 8.65825 16.3535 8.85352L15.6357 9.57031C16.4807 10.4657 17 11.6717 17 13C17 15.7614 14.7614 18 12 18C9.23858 18 7 15.7614 7 13C7 10.4073 8.97333 8.27526 11.5 8.02441V7H10.5C10.2239 7 10 6.77614 10 6.5C10 6.22386 10.2239 6 10.5 6H13.5ZM12 9C9.79086 9 8 10.7909 8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13C16 10.7909 14.2091 9 12 9Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyframe-set-end.svg b/apps/web/src/assets/icons/keyframe-set-end.svgnew file mode 100644index 00000000..ac94a252--- /dev/null+++ b/apps/web/src/assets/icons/keyframe-set-end.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M11.7573 16.1245C11.8913 16.2585 12.1085 16.2585 12.2425 16.1245L16.1244 12.2426C16.2584 12.1086 16.2584 11.8914 16.1244 11.7574L12.2425 7.87549C12.1085 7.74154 11.8913 7.74154 11.7573 7.87549L7.87542 11.7574C7.7414 11.8914 7.7414 12.1086 7.87542 12.2426L11.7573 16.1245ZM12 15.3966L15.3966 12L12 8.60344L12 15.3966Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyframe-set-start.svg b/apps/web/src/assets/icons/keyframe-set-start.svgnew file mode 100644index 00000000..62578733--- /dev/null+++ b/apps/web/src/assets/icons/keyframe-set-start.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.2425 7.87552C12.1085 7.74152 11.8913 7.74152 11.7573 7.87552L7.8754 11.7574C7.7414 11.8914 7.7414 12.1087 7.8754 12.2427L11.7573 16.1246C11.8913 16.2585 12.1085 16.2585 12.2425 16.1246L16.1244 12.2427C16.2584 12.1087 16.2584 11.8914 16.1244 11.7574L12.2425 7.87552ZM11.9998 8.60345L8.60325 12L11.9998 15.3966V8.60345Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/keyframe-set.svg b/apps/web/src/assets/icons/keyframe-set.svgnew file mode 100644index 00000000..c769e70e--- /dev/null+++ b/apps/web/src/assets/icons/keyframe-set.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M11.7578 7.87552C11.8918 7.74152 12.109 7.74152 12.243 7.87552L16.1249 11.7574C16.2588 11.8914 16.2588 12.1086 16.1249 12.2426L12.243 16.1245C12.109 16.2585 11.8918 16.2585 11.7578 16.1245L7.87588 12.2426C7.74189 12.1086 7.74189 11.8914 7.87588 11.7574L11.7578 7.87552Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/language.svg b/apps/web/src/assets/icons/language.svgnew file mode 100644index 00000000..d80a324d--- /dev/null+++ b/apps/web/src/assets/icons/language.svg@@ -0,0 +1,15 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2266_45738)">+<path d="M7.9165 9.66675L11.4165 13.1667" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M7.3335 13.1667L10.8335 9.66675L12.0002 7.91675" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M6.1665 7.91675H13.1665" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M9.0835 6.16675H9.66683" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M17.8333 17.8333L14.9167 12L12 17.8333" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M13.1665 15.5H16.6665" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+</g>+<defs>+<clipPath id="clip0_2266_45738">+<rect width="14" height="14" fill="white" transform="translate(5 5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/large-bfl.svg b/apps/web/src/assets/icons/large-bfl.svgnew file mode 100644index 00000000..37e91949--- /dev/null+++ b/apps/web/src/assets/icons/large-bfl.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M19.8343 14.7718H17.9194L16.0045 12.0598L10.0332 20.5118H11.9515L16.0045 14.7718H17.9194L13.8664 20.5111H15.7901L19.8343 14.7718ZM19.8343 14.7718L25.0005 22.0856H21.9779V20.5172L19.835 17.4845L17.7036 20.5118V22.0856H7.00049L16.0066 9.33569L19.8343 14.7718Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-bytedance.svg b/apps/web/src/assets/icons/large-bytedance.svgnew file mode 100644index 00000000..da36bf7e--- /dev/null+++ b/apps/web/src/assets/icons/large-bytedance.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M18.1409 20.3485L16.9016 20.0245V14.1108L18.2282 13.7749C18.955 13.5899 19.5659 13.4398 19.5953 13.4454C19.6183 13.4454 19.6357 15.0708 19.6357 17.0614V20.6781L19.508 20.6725C19.4326 20.6725 18.8154 20.5224 18.1409 20.3485ZM12.3633 18.8613C12.3633 16.8715 12.3807 15.2391 12.4094 15.2391C12.4331 15.2335 13.044 15.385 13.7771 15.5693L15.0974 15.9045L15.0863 18.8509L15.0688 21.7952L13.8819 22.1024C13.2297 22.2693 12.6188 22.4257 12.5315 22.4431L12.3633 22.4836V18.8613ZM21.2654 15.9052C21.2654 9.33787 21.2709 8.98458 21.3701 9.0139C21.4217 9.03136 21.9398 9.16471 22.5158 9.30924C23.0918 9.46005 23.6623 9.60388 23.7845 9.63251L23.9995 9.69116L23.9702 22.1478L22.7895 22.4487C22.1437 22.6163 21.5328 22.7664 21.4392 22.7908L21.2647 22.8306L21.2654 15.9052ZM7.99951 15.9282C7.99951 12.5259 8.01697 9.74213 8.04629 9.74213C8.06933 9.74213 8.68026 9.89294 9.40779 10.0731L10.7344 10.4082V15.9226C10.7344 18.9479 10.7225 21.4307 10.7106 21.4307C10.6932 21.4307 10.0767 21.5871 9.34355 21.7728L7.99951 22.1129V15.9282Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-elevenlabs.svg b/apps/web/src/assets/icons/large-elevenlabs.svgnew file mode 100644index 00000000..69542698--- /dev/null+++ b/apps/web/src/assets/icons/large-elevenlabs.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.5 9H20.5V23H17.5V9Z" fill="currentColor"/>+<path d="M11.5 9H14.5V23H11.5V9Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-google.svg b/apps/web/src/assets/icons/large-google.svgnew file mode 100644index 00000000..a0a54ba1--- /dev/null+++ b/apps/web/src/assets/icons/large-google.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M16.1634 24C18.3673 24 20.2161 23.2884 21.5681 22.0614C23.1115 20.6665 24 18.6132 24 16.1779C24 15.5202 23.9447 15.04 23.828 14.5419H16.1627V17.5113H20.6617C20.5719 18.2485 20.0814 19.3601 18.9932 20.1069C18.3037 20.5781 17.3786 20.9069 16.1634 20.9069C15.1389 20.9072 14.1401 20.5866 13.307 19.9902C12.474 19.3939 11.8486 18.5516 11.5186 17.5818C11.3404 17.0732 11.2484 16.5385 11.2464 15.9997C11.2464 15.4483 11.3473 14.9143 11.509 14.4169C11.5701 14.239 11.6417 14.0648 11.7231 13.8952C12.1244 13.0574 12.7541 12.3499 13.5398 11.8541C14.3254 11.3584 15.2351 11.0946 16.1641 11.0931C17.6971 11.0931 18.7307 11.7418 19.3207 12.2841L21.6234 10.0802C20.2092 8.79105 18.368 8 16.1641 8C12.9709 8 10.2122 9.79559 8.86912 12.4085C8.29875 13.5197 8.00085 14.7506 8 15.9997C8.00128 17.2488 8.29966 18.4797 8.8705 19.5908C10.2129 22.2044 12.9709 24 16.1634 24Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-hailuo.svg b/apps/web/src/assets/icons/large-hailuo.svgnew file mode 100644index 00000000..0628ffe9--- /dev/null+++ b/apps/web/src/assets/icons/large-hailuo.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9291 15.9642C24.9291 11.0136 20.9156 7 15.9649 7C11.0143 7 7 11.0136 7 15.9642C7 20.9149 11.0135 24.9291 15.9649 24.9291C16.0366 24.9291 16.1075 24.9284 16.1791 24.9262C16.1908 24.9276 16.2018 24.9291 16.2142 24.9291H22.0938C23.6602 24.9291 24.9298 23.6595 24.9298 22.0931V16.2134C24.9298 16.2017 24.9284 16.19 24.9269 16.1783C24.9284 16.1074 24.9298 16.0359 24.9298 15.9642H24.9291ZM23.2239 18.7154C22.8898 20.1276 21.8278 19.6606 21.8278 19.6606C21.1056 19.3631 21.3073 18.4172 21.3073 18.4172C21.4023 17.494 21.1348 16.6549 21.1348 16.6549C20.0172 12.2049 16.0424 12.5814 16.0424 12.5814C11.4894 12.8022 11.6276 16.8376 11.6276 16.8376C11.6736 20.4243 15.1726 20.4163 15.1726 20.4163C16.8574 20.3827 17.5511 19.2739 17.5511 19.2739C18.684 17.8332 17.8273 16.386 17.8273 16.386C17.323 15.37 16.3201 15.1894 15.8479 15.1623C15.75 15.147 15.6499 15.139 15.5476 15.139C14.4797 15.139 13.6143 16.0044 13.6143 17.0723C13.6143 18.1402 14.4797 19.0056 15.5476 19.0056C15.8802 19.0056 16.1929 18.9216 16.4663 18.7739C16.5869 18.7177 16.6637 18.6599 16.7083 18.6183C16.7104 18.6168 16.7119 18.6153 16.7141 18.6138C16.0606 19.3287 15.0264 19.2344 15.0264 19.2344C12.6084 19.0231 12.8446 16.6242 12.8446 16.6242C13.3307 12.99 16.9941 13.8467 16.9941 13.8467C18.9384 14.1792 19.7307 16.079 19.7307 16.079C21.0632 20.0428 17.486 22.3102 17.486 22.3102C12.9483 24.5037 10.094 20.9265 10.094 20.9265C6.4752 16.6265 9.2235 12.0566 9.2235 12.0566C13.2743 5.89702 19.4698 9.02833 19.4698 9.02833C25.2697 12.1831 23.2239 18.7154 23.2239 18.7154ZM17.0262 18.3178C17.0262 18.3178 17.0299 18.3141 17.0314 18.3119C17.0299 18.3141 17.0277 18.3156 17.0262 18.3178ZM17.2638 17.9626C17.2689 17.9531 17.2733 17.9443 17.2776 17.9348C17.2733 17.9443 17.2681 17.9531 17.2638 17.9626ZM17.3566 17.7542C17.3581 17.7499 17.3595 17.7463 17.3617 17.7419C17.3602 17.7463 17.3588 17.7499 17.3566 17.7542ZM17.4458 17.4371C17.448 17.4239 17.4509 17.4107 17.4531 17.3975C17.4509 17.4107 17.4487 17.4239 17.4458 17.4371ZM17.4634 17.3296C17.4648 17.3164 17.467 17.3033 17.4684 17.2901C17.467 17.3033 17.4655 17.3164 17.4634 17.3296ZM17.4743 17.217C17.4751 17.2053 17.4765 17.1943 17.4772 17.1827C17.4772 17.1943 17.4758 17.206 17.4743 17.217ZM17.4757 16.9466C17.4743 16.9254 17.4728 16.9049 17.4706 16.8837C17.4728 16.9042 17.4743 16.9254 17.4757 16.9466ZM17.467 16.8472C17.4648 16.8281 17.4626 16.8099 17.4597 16.7909C17.4626 16.8091 17.4648 16.8281 17.467 16.8472ZM17.4538 16.7529C17.4509 16.7353 17.448 16.717 17.4444 16.6995C17.448 16.717 17.4509 16.7346 17.4538 16.7529ZM17.4143 16.5716C17.4099 16.5548 17.4048 16.538 17.4004 16.5212C17.4056 16.538 17.4099 16.5548 17.4143 16.5716ZM17.3888 16.4839C17.3836 16.4671 17.3778 16.4503 17.372 16.4342C17.3778 16.451 17.3836 16.4671 17.3888 16.4839ZM17.3596 16.3984C17.353 16.3808 17.3464 16.364 17.3391 16.3472C17.3457 16.364 17.353 16.3815 17.3596 16.3984ZM17.3259 16.3143C17.3179 16.2946 17.3083 16.2756 17.2996 16.2566C17.3083 16.2756 17.3172 16.2953 17.3259 16.3143ZM17.1841 16.0446C17.1754 16.0307 17.1666 16.0161 17.1571 16.0022C17.1666 16.0161 17.1754 16.03 17.1841 16.0446ZM17.1337 15.9686C17.1249 15.9554 17.1154 15.9423 17.1059 15.9298C17.1154 15.9423 17.1242 15.9554 17.1337 15.9686ZM17.0803 15.8962C17.0708 15.8838 17.0613 15.8721 17.0518 15.8597C17.0613 15.8714 17.0708 15.8838 17.0803 15.8962ZM17.0247 15.8268C17.0152 15.8151 17.005 15.8042 16.9948 15.7925C17.005 15.8034 17.0145 15.8151 17.0247 15.8268ZM16.9656 15.7596C16.9554 15.7486 16.9451 15.7376 16.9348 15.7274C16.9451 15.7384 16.9554 15.7486 16.9656 15.7596ZM16.9042 15.6959C16.894 15.6857 16.8829 15.6755 16.872 15.6653C16.8829 15.6755 16.8932 15.6857 16.9042 15.6959ZM16.8391 15.6353C16.8281 15.6258 16.8172 15.6163 16.8062 15.6068C16.8172 15.6163 16.8289 15.6258 16.8391 15.6353ZM16.5935 15.4481C16.5826 15.4408 16.5709 15.4335 16.5599 15.4262C16.5716 15.4335 16.5826 15.4408 16.5935 15.4481ZM16.4408 15.3582C16.4291 15.3524 16.4174 15.3458 16.405 15.34C16.4167 15.3458 16.4291 15.3524 16.4408 15.3582ZM16.3603 15.3195C16.3479 15.3137 16.3363 15.3086 16.3238 15.3027C16.3363 15.3079 16.3479 15.3137 16.3603 15.3195ZM16.2785 15.283C16.266 15.2779 16.2537 15.2735 16.242 15.2683C16.2544 15.2727 16.2668 15.2779 16.2785 15.283ZM16.1945 15.2515C16.182 15.2471 16.1696 15.2428 16.1572 15.2391C16.1696 15.2435 16.182 15.2471 16.1945 15.2515ZM16.1089 15.2231C16.0972 15.2194 16.0848 15.2165 16.0723 15.2128C16.0848 15.2165 16.0965 15.2194 16.1089 15.2231ZM16.0212 15.1989C16.0103 15.196 16 15.1938 15.989 15.1916C16 15.1938 16.011 15.196 16.0212 15.1989ZM16.5796 18.7074C16.5869 18.703 16.5935 18.6986 16.6009 18.6935C16.5935 18.6979 16.5869 18.7023 16.5796 18.7074Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-kling.svg b/apps/web/src/assets/icons/large-kling.svgnew file mode 100644index 00000000..9b8c7fbe--- /dev/null+++ b/apps/web/src/assets/icons/large-kling.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M22.5059 9.69248L22.5686 9.75296L22.57 9.75152C23.7702 10.9388 23.4268 13.3235 21.6858 16.0271L25.1095 19.4003L24.9619 19.6825C24.3851 20.7911 23.6058 21.7819 22.6643 22.6036C21.4164 23.6978 19.9177 24.467 18.3011 24.8428L18.2428 24.8572L18.1585 24.8766L18.0981 24.8903L17.9641 24.9191L17.854 24.9407L17.7712 24.9565C17.6826 24.9738 17.5905 24.9897 17.5005 25.0048L17.4249 25.0163L17.3673 25.0235L17.1253 25.053C15.7761 25.2028 14.4095 25.053 13.1264 24.616C11.8464 24.1806 10.6788 23.4667 9.70787 22.5258L9.65171 22.4718C8.4493 21.2845 8.78986 18.8977 10.5323 16.1919L7.10938 12.8187L7.25626 12.5365C7.83252 11.4278 8.61272 10.4378 9.55595 9.61832C10.944 8.40319 12.6368 7.58923 14.4527 7.26391C14.5348 7.24807 14.6284 7.23151 14.7184 7.21639C16.1224 7.00055 17.5572 7.11218 18.9109 7.54255C20.2599 7.9704 21.4907 8.70648 22.5059 9.69248ZM21.3482 9.8372H21.3453L21.3489 9.83864C20.1854 9.48439 18.3393 10.0575 16.3881 11.324C17.8727 10.9165 19.3084 11.1274 20.2365 12.0418C21.1149 12.9095 21.3561 14.2263 21.0234 15.6102C21.0071 15.6841 20.9874 15.7587 20.9644 15.8341C22.557 13.461 23.0668 11.2405 22.0588 10.249C22.0419 10.2313 22.0241 10.2145 22.0055 10.1986L21.9976 10.1914L21.9861 10.1814L21.953 10.1562C21.9386 10.1446 21.9234 10.1334 21.9076 10.1223L21.8831 10.105C21.7219 9.98541 21.5404 9.89477 21.3482 9.8372ZM20.5511 15.1724C20.3452 16.3791 19.6684 17.5988 18.6417 18.609C17.6178 19.6192 16.3773 20.2866 15.1496 20.4911C14.002 20.6826 13.0112 20.4335 12.3632 19.7956C11.7152 19.1576 11.4611 18.1864 11.6555 17.0487C11.8607 15.8435 12.536 14.6238 13.5584 13.6143C13.5584 13.6153 13.5604 13.6134 13.5642 13.6086L13.5678 13.6028C14.5931 12.5991 15.8286 11.9324 17.0526 11.7308C18.201 11.54 19.1889 11.7884 19.8405 12.427C20.4878 13.0643 20.7405 14.0384 20.5461 15.1731L20.5511 15.1724ZM10.1471 10.2692C9.36586 10.9503 8.70706 11.7567 8.2009 12.656L8.19442 12.6574L11.1652 15.5763C11.4071 15.2408 11.666 14.9089 11.942 14.5806C12.0385 14.4668 12.1376 14.3514 12.2394 14.2343L12.2783 14.1911L12.4194 14.0355C12.4237 14.0319 12.428 14.024 12.428 14.024L12.454 13.9952L12.4676 13.9794L12.5396 13.9002C12.5776 13.8579 12.6162 13.8167 12.6556 13.7763C12.6556 13.772 12.6613 13.7663 12.6613 13.7663L12.7254 13.6979L12.7708 13.6518C12.7727 13.6489 12.7736 13.6477 12.7736 13.6482C12.777 13.6453 12.7784 13.6434 12.778 13.6424L12.7866 13.6316L12.7945 13.6223C12.8021 13.6173 12.8087 13.6109 12.814 13.6035L12.8248 13.592C12.8492 13.5683 12.878 13.5402 12.904 13.5128C12.9179 13.496 12.9335 13.4792 12.9508 13.4624L12.9752 13.4379L12.9904 13.4214L13.0357 13.3775L13.1243 13.2911L13.1531 13.2608L13.1862 13.227C13.8234 12.5978 14.5032 12.0135 15.2209 11.4781L15.3145 11.4104H15.3153V11.4097H15.3167L15.4103 11.3406C15.5159 11.2628 15.622 11.187 15.7285 11.113C15.8428 11.0362 15.9565 10.9609 16.0698 10.887C17.6128 9.87392 19.1233 9.26551 20.3567 9.14455C18.6273 8.12034 16.5855 7.75715 14.6089 8.12215C14.5556 8.13079 14.5096 8.14015 14.462 8.14951L14.4332 8.15527C14.0012 8.24359 13.5769 8.36095 13.1603 8.50735C12.0526 8.89725 11.0303 9.49526 10.1471 10.2692ZM10.3105 22.0974C10.4751 22.2203 10.6628 22.3141 10.8736 22.3789H10.8692C12.04 22.7317 13.8788 22.1557 15.8229 20.8936C14.3396 21.2989 12.9068 21.088 11.9795 20.1736C11.1047 19.3096 10.8635 17.9891 11.1947 16.6059C11.2115 16.5315 11.2312 16.4567 11.2537 16.3813C9.66107 18.7552 9.15274 20.9749 10.16 21.9678C10.2071 22.0144 10.2574 22.0577 10.3105 22.0974ZM24.0158 19.5644V19.5659C23.5071 20.4649 22.8498 21.2711 22.0718 21.9505C20.8993 22.9744 19.4883 23.6872 17.9685 24.0234L17.9497 24.0277L17.8993 24.0393C17.8417 24.0541 17.7839 24.0666 17.7258 24.0767C17.6871 24.085 17.6483 24.0922 17.6092 24.0983C17.5266 24.1137 17.4443 24.1271 17.3622 24.1386L17.2931 24.1501L17.2146 24.1602C17.1522 24.1684 17.0879 24.1761 17.0217 24.1833C15.2273 24.3829 13.4167 23.9938 11.8628 23.0745C13.0508 22.9593 14.4966 22.3883 15.9791 21.4444L16.0641 21.3896L16.1483 21.3342L16.2635 21.2579L16.4874 21.1088C16.5954 21.0344 16.7013 20.9584 16.8049 20.8806C16.8702 20.835 16.9343 20.7894 16.9972 20.7438C17.7135 20.2064 18.3933 19.6219 19.0319 18.9942L19.0751 18.9488L19.0924 18.9294C19.1231 18.9006 19.1526 18.872 19.1809 18.8437L19.2256 18.8005C19.2256 18.8005 19.2371 18.7883 19.2393 18.7825C19.2481 18.7755 19.2561 18.7676 19.263 18.7588L19.3141 18.7084L19.3537 18.6688C19.3714 18.6526 19.3882 18.6355 19.4041 18.6176C19.4092 18.6105 19.4156 18.6045 19.4229 18.5996L19.4322 18.5888L19.4401 18.5795C19.4401 18.5795 19.4459 18.573 19.4495 18.5723L19.4653 18.555L19.4812 18.5377L19.497 18.5233C19.4802 18.5406 19.4644 18.5584 19.4495 18.5766L19.4855 18.5392L19.4869 18.5377L19.5625 18.46C19.5625 18.46 19.5625 18.4542 19.5683 18.4542L19.6691 18.3448L19.7353 18.2713C19.7438 18.2655 19.7509 18.2578 19.7562 18.249L19.7937 18.2044L19.803 18.1936C19.8498 18.1453 19.893 18.0956 19.9384 18.0467L19.9838 17.9941C20.0577 17.9101 20.1311 17.8249 20.2041 17.7385L20.2926 17.6348L20.32 17.6017C20.355 17.5585 20.3898 17.516 20.4244 17.4743C20.4542 17.4388 20.483 17.403 20.5108 17.367C20.6994 17.1318 20.8818 16.893 21.058 16.6506L24.0158 19.5644ZM24.0158 19.5644C24.0158 19.5625 24.017 19.5611 24.0194 19.5601V19.5695L24.0158 19.5659H24.0172L24.0158 19.5644Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-openai.svg b/apps/web/src/assets/icons/large-openai.svgnew file mode 100644index 00000000..a0a95c2c--- /dev/null+++ b/apps/web/src/assets/icons/large-openai.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.9034 13.5731V11.8782C13.9034 11.7353 13.957 11.6281 14.082 11.5567L17.4897 9.59455C17.9534 9.32731 18.5065 9.20226 19.0774 9.20226C21.2182 9.20226 22.5736 10.8614 22.5736 12.6278C22.5736 12.7528 22.5736 12.895 22.5558 13.0379L19.0238 10.9693C18.9277 10.9085 18.8163 10.8762 18.7026 10.8762C18.5889 10.8762 18.4775 10.9085 18.3814 10.9693L13.9034 13.5731ZM21.8605 20.174V16.124C21.8605 15.8739 21.7534 15.696 21.539 15.571L17.061 12.9665L18.5243 12.1283C18.6487 12.0569 18.7559 12.0569 18.8816 12.1283L22.2885 14.0904C23.2696 14.6614 23.9298 15.8746 23.9298 17.0515C23.9298 18.4077 23.1267 19.6567 21.8605 20.174ZM12.8509 16.6063L11.3882 15.7496C11.2632 15.6781 11.2096 15.571 11.2096 15.4281V11.5045C11.2096 9.59598 12.673 8.15046 14.653 8.15046C15.4025 8.15046 16.0978 8.40055 16.6865 8.84642L13.1724 10.88C12.9581 11.0051 12.8509 11.1837 12.8509 11.4331V16.6063ZM15.9999 18.4256L13.9034 17.248V14.7507L15.9999 13.5731L18.0956 14.7507V17.248L15.9999 18.4256ZM17.3468 23.8489C16.6108 23.8478 15.8958 23.6033 15.3132 23.1537L18.8273 21.1194C19.0417 20.995 19.1489 20.8164 19.1489 20.5663V15.393L20.6294 16.2491C20.7544 16.3205 20.808 16.4277 20.808 16.5706V20.4949C20.808 22.4041 19.3268 23.8489 17.3468 23.8489ZM13.1188 19.8711L9.71048 17.9082C8.73013 17.3373 8.06989 16.1247 8.06989 14.9472C8.06757 14.2781 8.26495 13.6235 8.63677 13.0673C9.00859 12.511 9.53794 12.0783 10.1571 11.8246V15.8925C10.1571 16.1426 10.2642 16.3212 10.4786 16.4456L14.9381 19.0322L13.4754 19.8711C13.3504 19.9425 13.2432 19.9425 13.1181 19.8711M12.9216 22.7964C10.9059 22.7964 9.42538 21.2801 9.42538 19.4066C9.42538 19.2637 9.44324 19.1208 9.46111 18.9786L12.9752 21.0122C13.1896 21.137 13.4037 21.137 13.6176 21.0122L18.0949 18.4256V20.1204C18.0949 20.2634 18.0413 20.3705 17.9163 20.442L14.5093 22.4041C14.0449 22.6714 13.4925 22.7971 12.9216 22.7971M17.3461 24.92C18.3743 24.9205 19.371 24.5656 20.1676 23.9154C20.9641 23.2653 21.5114 22.3598 21.7169 21.3523C23.7148 20.835 24.9995 18.9615 24.9995 17.0529C24.9995 15.8039 24.4643 14.5906 23.5011 13.716C23.5904 13.3416 23.644 12.9672 23.644 12.5928C23.644 10.0419 21.574 8.1326 19.1839 8.1326C18.7023 8.1326 18.2385 8.20405 17.7741 8.36482C16.9412 7.54526 15.8207 7.08413 14.6522 7.08008C13.6242 7.07977 12.6276 7.43474 11.8312 8.0849C11.0348 8.73506 10.4876 9.64045 10.2821 10.6478C8.28426 11.1658 6.99951 13.0386 6.99951 14.9479C6.99951 16.1962 7.5347 17.4095 8.4979 18.2834C8.4066 18.6512 8.35864 19.0284 8.355 19.4073C8.355 21.9582 10.425 23.8675 12.8152 23.8675C13.2968 23.8675 13.7612 23.796 14.2249 23.6353C15.0578 24.4548 16.1776 24.916 17.3461 24.92Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-timeline.svg b/apps/web/src/assets/icons/large-timeline.svgnew file mode 100644index 00000000..32b7fe0b--- /dev/null+++ b/apps/web/src/assets/icons/large-timeline.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.375 2C9.67337 2 9.95952 2.11853 10.1705 2.3295C10.3815 2.54048 10.5 2.82663 10.5 3.125V3.875C10.5 4.17337 10.3815 4.45952 10.1705 4.6705C9.95952 4.88147 9.67337 5 9.375 5H2.625C2.32663 5 2.04048 4.88147 1.8295 4.6705C1.61853 4.45952 1.5 4.17337 1.5 3.875V3.125C1.5 2.82663 1.61853 2.54048 1.8295 2.3295C2.04048 2.11853 2.32663 2 2.625 2H9.375ZM9.375 7C9.67337 7 9.95952 7.11853 10.1705 7.3295C10.3815 7.54048 10.5 7.82663 10.5 8.125V8.875C10.5 9.02274 10.4709 9.16903 10.4144 9.30552C10.3578 9.44201 10.275 9.56603 10.1705 9.6705C10.066 9.77496 9.94201 9.85783 9.80552 9.91436C9.66903 9.9709 9.52274 10 9.375 10H2.625C2.47726 10 2.33097 9.9709 2.19448 9.91436C2.05799 9.85783 1.93397 9.77496 1.8295 9.6705C1.72504 9.56603 1.64217 9.44201 1.58564 9.30552C1.5291 9.16903 1.5 9.02274 1.5 8.875V8.125C1.5 7.82663 1.61853 7.54048 1.8295 7.3295C2.04048 7.11853 2.32663 7 2.625 7H9.375Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/large-wan.svg b/apps/web/src/assets/icons/large-wan.svgnew file mode 100644index 00000000..fe3bb517--- /dev/null+++ b/apps/web/src/assets/icons/large-wan.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.5005 7.17233C16.8259 7.74373 17.1497 8.31678 17.4727 8.89067C17.4857 8.91361 17.5046 8.93269 17.5275 8.94592C17.5503 8.95918 17.5763 8.9661 17.6027 8.96602H22.2004C22.3444 8.96602 22.467 9.05711 22.5697 9.23682L23.7737 11.3651C23.9312 11.6442 23.9726 11.7609 23.7937 12.0582C23.5783 12.4143 23.3688 12.7737 23.1643 13.1348L22.8604 13.6797C22.7726 13.842 22.6758 13.9115 22.8272 14.1037L25.0234 17.9436C25.1659 18.1929 25.1154 18.3527 24.9879 18.5813C24.6259 19.2314 24.2574 19.8765 23.8824 20.5191C23.7505 20.7443 23.5909 20.8296 23.3191 20.8255C22.6758 20.8122 22.0339 20.8172 21.3921 20.8387C21.3784 20.8395 21.365 20.8436 21.3533 20.8508C21.3416 20.8581 21.3319 20.8682 21.3251 20.8802C20.5846 22.1921 19.8379 23.5006 19.085 24.8055C18.9451 25.048 18.7703 25.1061 18.4846 25.1068C17.659 25.1094 16.8268 25.1102 15.9862 25.1085C15.908 25.1083 15.8312 25.0874 15.7635 25.048C15.6959 25.0087 15.6399 24.9521 15.6011 24.884L14.4956 22.9604C14.4892 22.9479 14.4793 22.9372 14.4671 22.9302C14.455 22.923 14.441 22.9193 14.4269 22.9199H10.1886C9.95256 22.9446 9.73064 22.919 9.52195 22.8435L8.19449 20.5497C8.15523 20.4818 8.13442 20.4048 8.13412 20.3264C8.13383 20.2479 8.15408 20.1708 8.19282 20.1025L9.19236 18.3469C9.20659 18.3221 9.21408 18.294 9.21408 18.2654C9.21408 18.2367 9.20659 18.2086 9.19236 18.1838C8.6717 17.2824 8.15413 16.3792 7.63964 15.4742L6.98543 14.319C6.85293 14.0623 6.84217 13.9082 7.0641 13.5198C7.44919 12.8466 7.83176 12.1741 8.21271 11.5025C8.32202 11.3088 8.46445 11.2259 8.69633 11.2251C9.41098 11.2221 10.1256 11.2218 10.8403 11.2243C10.8584 11.2242 10.8761 11.2193 10.8916 11.2101C10.9072 11.2009 10.92 11.1878 10.9289 11.1721L13.2526 7.1185C13.2878 7.05683 13.3387 7.00552 13.4 6.96976C13.4614 6.93401 13.5311 6.91503 13.6021 6.91477C14.036 6.91395 14.4741 6.91477 14.913 6.90981L15.7552 6.89076C16.0376 6.88827 16.3547 6.91727 16.5005 7.17233ZM13.6584 7.50606C13.6497 7.50604 13.6411 7.50834 13.6335 7.51271C13.626 7.51706 13.6197 7.52333 13.6153 7.53089L11.242 11.6839C11.2306 11.7035 11.2142 11.7197 11.1946 11.7311C11.175 11.7424 11.1528 11.7484 11.1301 11.7485H8.75678C8.7104 11.7485 8.6988 11.7692 8.72281 11.8098L13.5342 20.2201C13.5549 20.2549 13.5449 20.2715 13.506 20.2723L11.1914 20.2847C11.1576 20.2836 11.1241 20.292 11.0948 20.309C11.0655 20.326 11.0416 20.3509 11.0258 20.3808L9.93269 22.2937C9.89626 22.3583 9.9153 22.3915 9.989 22.3915L14.7225 22.398C14.7606 22.398 14.7888 22.4147 14.8086 22.4486L15.9705 24.4808C16.0086 24.5479 16.0467 24.5487 16.0856 24.4808L20.2311 17.2265L20.8795 16.082C20.8835 16.075 20.8893 16.0691 20.8963 16.065C20.9032 16.0609 20.9112 16.0587 20.9193 16.0587C20.9274 16.0587 20.9353 16.0609 20.9423 16.065C20.9493 16.0691 20.9551 16.075 20.959 16.082L22.1383 18.1772C22.1471 18.1929 22.16 18.2059 22.1756 18.2149C22.1911 18.2239 22.2088 18.2286 22.2269 18.2285L24.515 18.2119C24.5209 18.212 24.5265 18.2105 24.5317 18.2076C24.5369 18.2047 24.541 18.2005 24.5439 18.1954C24.5468 18.1903 24.5482 18.1846 24.5482 18.1788C24.5482 18.173 24.5468 18.1673 24.5439 18.1623L22.1424 13.9505C22.1338 13.9364 22.1292 13.9202 22.1292 13.9037C22.1292 13.8872 22.1338 13.871 22.1424 13.8569L22.385 13.437L23.3126 11.7998C23.3324 11.7659 23.3224 11.7485 23.2835 11.7485H13.6816C13.6327 11.7485 13.6211 11.727 13.646 11.6847L14.8335 9.61031C14.8424 9.59616 14.8471 9.5798 14.8471 9.56309C14.8471 9.54639 14.8424 9.53002 14.8335 9.5159L13.7023 7.53172C13.6979 7.52388 13.6916 7.51737 13.6839 7.51285C13.6761 7.50833 13.6673 7.50599 13.6584 7.50606ZM18.8672 14.1475C18.9053 14.1475 18.9153 14.1641 18.8954 14.1972L18.2064 15.4104L16.0425 19.2073C16.0384 19.2147 16.0325 19.2209 16.0252 19.2251C16.0179 19.2293 16.0096 19.2315 16.0011 19.2314C15.9927 19.2313 15.9845 19.2291 15.9772 19.2249C15.9699 19.2207 15.9639 19.2146 15.9597 19.2073L13.1002 14.2121C13.0837 14.184 13.0919 14.1691 13.1234 14.1674L13.3023 14.1575L18.8689 14.1475H18.8672Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/line-join-bevel.svg b/apps/web/src/assets/icons/line-join-bevel.svgnew file mode 100644index 00000000..864e8ddf--- /dev/null+++ b/apps/web/src/assets/icons/line-join-bevel.svg@@ -0,0 +1,12 @@+<svg+ viewBox="0 0 15 15"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M2 2H7.70711L13 7.29289V13H7.5V7.5H2V2ZM3 3V6.5H8.5V12H12V7.70711L7.29289 3H3Z"+ fill="currentColor"+ />+</svg>\ No newline at end of filediff --git a/apps/web/src/assets/icons/line-join-miter.svg b/apps/web/src/assets/icons/line-join-miter.svgnew file mode 100644index 00000000..f6ac2cc1--- /dev/null+++ b/apps/web/src/assets/icons/line-join-miter.svg@@ -0,0 +1,12 @@+<svg+ viewBox="0 0 15 15"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M2 2H13V13H7.5V7.5H2V2ZM3 3V6.5H8.5V12H12V3H3Z"+ fill="currentColor"+ />+ </svg>\ No newline at end of filediff --git a/apps/web/src/assets/icons/line-join-round.svg b/apps/web/src/assets/icons/line-join-round.svgnew file mode 100644index 00000000..3f43beb3--- /dev/null+++ b/apps/web/src/assets/icons/line-join-round.svg@@ -0,0 +1,12 @@+<svg+ viewBox="0 0 15 15"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M2 2H7.5C8.54944 2 9.38877 2.15453 10.0981 2.44566C10.8096 2.73772 11.3633 3.1562 11.8536 3.64645C12.4047 4.19754 12.6844 4.9282 12.8307 5.61219C12.9779 6.30012 13 6.98893 13 7.5V13H7.5V7.5H2V2ZM3 3V6.5H8.5V12H12V7.5C12 7.01107 11.9778 6.40559 11.8528 5.82138C11.727 5.23323 11.5068 4.71389 11.1464 4.35355C10.7253 3.93237 10.2789 3.60085 9.71836 3.37077C9.15551 3.13975 8.45056 3 7.5 3H3Z"+ fill="currentColor"+ />+ </svg>\ No newline at end of filediff --git a/apps/web/src/assets/icons/lock-closed-small.svg b/apps/web/src/assets/icons/lock-closed-small.svgnew file mode 100644index 00000000..b375ad68--- /dev/null+++ b/apps/web/src/assets/icons/lock-closed-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1818 9.9143C10.1818 9.27743 10.358 8.80113 10.6496 8.48707C10.9377 8.17688 11.3788 7.98142 12.001 7.98142C12.6236 7.98142 13.064 8.17649 13.3514 8.48599C13.6425 8.79938 13.8182 9.27508 13.8182 9.91229V10.9063H10.1818V9.9143ZM9.45455 10.9063V9.9143C9.45455 9.14737 9.66792 8.47541 10.1167 7.99216C10.5691 7.50505 11.2195 7.25415 12.001 7.25415C12.7824 7.25415 13.4324 7.50435 13.8844 7.99111C14.3328 8.47398 14.5455 9.14554 14.5455 9.91229V10.9063H15.2727C15.6744 10.9063 16 11.2319 16 11.6336V15.9972C16 16.3989 15.6744 16.7245 15.2727 16.7245H8.72727C8.32561 16.7245 8 16.3989 8 15.9972V11.6336C8 11.2319 8.32561 10.9063 8.72727 10.9063H9.45455Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/lock-closed.svg b/apps/web/src/assets/icons/lock-closed.svgnew file mode 100644index 00000000..41a7b695--- /dev/null+++ b/apps/web/src/assets/icons/lock-closed.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M9.97331 9.67599C9.97331 8.966 10.1697 8.43502 10.4948 8.08491C10.816 7.7391 11.3077 7.52121 12.0014 7.52121C12.6954 7.52121 13.1864 7.73867 13.5068 8.0837C13.8312 8.43307 14.0271 8.96338 14.0271 9.67375V10.7819H9.97331V9.67599ZM9.16254 10.7819V9.67599C9.16254 8.82101 9.40041 8.07191 9.90073 7.53319C10.4051 6.99015 11.1301 6.71045 12.0014 6.71045C12.8725 6.71045 13.597 6.98937 14.1009 7.53201C14.6008 8.07032 14.8379 8.81897 14.8379 9.67375V10.7819H15.6487C16.0964 10.7819 16.4594 11.1448 16.4594 11.5926V16.4572C16.4594 16.905 16.0964 17.268 15.6487 17.268H8.35178C7.90401 17.268 7.54102 16.905 7.54102 16.4572V11.5926C7.54102 11.1448 7.90401 10.7819 8.35178 10.7819H9.16254Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/lock-open.svg b/apps/web/src/assets/icons/lock-open.svgnew file mode 100644index 00000000..1248f9a8--- /dev/null+++ b/apps/web/src/assets/icons/lock-open.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9991 5.82471C11.0481 5.82471 10.266 6.14044 9.76051 6.79244C9.35506 7.31534 9.16254 7.99952 9.16254 8.77041H9.97331C9.97331 8.12981 10.133 7.63524 10.4012 7.28924C10.7161 6.88318 11.2312 6.63547 11.9991 6.63547C12.6949 6.63547 13.1867 6.85034 13.507 7.19184C13.8309 7.53713 14.0271 8.06277 14.0271 8.77265V10.6893H8.35178C7.90401 10.6893 7.54102 11.0523 7.54102 11.5001V16.3646C7.54102 16.8124 7.90401 17.1754 8.35178 17.1754H15.6487C16.0964 17.1754 16.4594 16.8124 16.4594 16.3646V11.5001C16.4594 11.0523 16.0964 10.6893 15.6487 10.6893H14.8379V8.77265C14.8379 7.91757 14.5999 7.17193 14.0983 6.63717C13.5932 6.09864 12.8682 5.82471 11.9991 5.82471ZM8.35178 11.5001H15.6487V16.3646H8.35178V11.5001Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/logo-black.svg b/apps/web/src/assets/icons/logo-black.svgnew file mode 100644index 00000000..10596f92--- /dev/null+++ b/apps/web/src/assets/icons/logo-black.svg@@ -0,0 +1,29 @@+<svg viewBox="0 0 714 714" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M590.396 290.698C590.396 195.081 539.764 111.413 463.498 63.0391C583.691 106.594 669.568 221.767 669.568 356.998C669.568 357.597 669.567 358.196 669.563 358.795C668.536 482.506 561.597 584.237 431.492 584.237C394.867 584.237 360.282 576.159 329.48 561.773C474.61 552.562 590.396 435.293 590.396 290.698Z" fill="url(#paint0_angular_1451_12)" fill-opacity="0.8"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M431.495 628.665C473.045 628.665 512.828 619.798 548.749 603.863C495.807 645.045 429.267 669.57 356.999 669.57C284.985 669.57 218.66 645.217 165.808 604.297C114.748 561.776 76.1621 494.259 76.1621 426.472C76.1621 347.955 117.494 278.335 180.593 237.469C162.403 273.516 152.162 314.089 152.162 357.006C152.162 507.669 277.863 628.665 431.495 628.665Z" fill="url(#paint1_angular_1451_12)" fill-opacity="0.8"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M311.068 154.814C186.622 154.814 80.5024 234.204 44.6738 344.444C48.0904 257.949 86.6549 180.487 146.48 125.948L146.533 126.007C188.415 88.3952 249.27 63.4668 311.064 63.4668C437.316 63.4668 539.341 159.467 545.66 278.936C495.798 204.088 409.193 154.814 311.068 154.814Z" fill="url(#paint2_angular_1451_12)" fill-opacity="0.7"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M311.068 199.24C180.693 199.24 76.1608 301.605 76.1608 426.471C76.1608 494.553 115.083 562.362 166.474 604.85L138.167 639.09C78.8743 590.07 31.7344 510.527 31.7344 426.471C31.7344 275.809 157.435 154.813 311.068 154.813C438.559 154.813 546.605 237.994 579.878 352.373L537.22 364.783C509.538 269.624 419.065 199.24 311.068 199.24Z" fill="#272727"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M260.811 200.888C220.912 241.691 196.589 296.628 196.589 357.005C196.589 481.872 301.12 584.237 431.495 584.237C562.229 584.237 669.574 481.519 669.574 356.998H714C714 508.006 584.768 628.663 431.495 628.663C277.863 628.663 152.162 507.668 152.162 357.005C152.162 284.374 181.492 218.46 229.047 169.827L260.811 200.888Z" fill="#272727"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M311.063 63.4655C249.268 63.4655 188.413 88.3939 146.532 126.006L116.848 92.9516C166.676 48.2029 238.036 19.0391 311.063 19.0391C464.689 19.0391 590.396 140.034 590.396 290.697C590.396 441.36 464.689 562.355 311.063 562.355C287.96 562.355 265.472 559.622 243.951 554.457L254.318 511.257C272.463 515.612 291.472 517.929 311.063 517.929C441.432 517.929 545.969 415.563 545.969 290.697C545.969 165.831 441.432 63.4655 311.063 63.4655Z" fill="#272727"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M356.998 44.4264C184.37 44.4264 44.4264 184.37 44.4264 356.998C44.4264 529.627 184.37 669.57 356.998 669.57C529.627 669.57 669.57 529.627 669.57 356.998C669.57 184.37 529.627 44.4264 356.998 44.4264ZM0 356.998C0 159.833 159.833 0 356.998 0C554.163 0 713.996 159.833 713.996 356.998C713.996 554.163 554.163 713.996 356.998 713.996C159.833 713.996 0 554.163 0 356.998Z" fill="#272727"/>+<defs>+<radialGradient id="paint0_angular_1451_12" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(458.817 337.024) rotate(178.919) scale(239.117 284.663)">+<stop stop-opacity="0"/>+<stop offset="0.496749" stop-opacity="0.05"/>+<stop offset="0.847721" stop-opacity="0.6"/>+<stop offset="1"/>+</radialGradient>+<radialGradient id="paint1_angular_1451_12" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(329.293 440.774) rotate(-68.0139) scale(259.91 274.573)">+<stop stop-opacity="0"/>+<stop offset="0.545491" stop-opacity="0.05"/>+<stop offset="0.864156" stop-opacity="0.6"/>+<stop offset="1"/>+</radialGradient>+<radialGradient id="paint2_angular_1451_12" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(295.139 296.427) rotate(68.4516) scale(243.876 266.119)">+<stop stop-opacity="0"/>+<stop offset="0.46532" stop-opacity="0.05"/>+<stop offset="0.805" stop-opacity="0.6"/>+<stop offset="1"/>+</radialGradient>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/loop.svg b/apps/web/src/assets/icons/loop.svgnew file mode 100644index 00000000..e72a8ac9--- /dev/null+++ b/apps/web/src/assets/icons/loop.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.17262 6.78789C8.35287 6.60765 8.35287 6.31542 8.17262 6.13518C7.99238 5.95494 7.70015 5.95494 7.51991 6.13518L5.67376 7.98134C5.49351 8.16158 5.49351 8.45381 5.67376 8.63405L7.51991 10.4802C7.70015 10.6604 7.99238 10.6604 8.17262 10.4802C8.35287 10.3 8.35287 10.0077 8.17262 9.82749L7.11437 8.76923H13.8463C15.6306 8.76923 17.077 10.2157 17.077 12C17.077 12.2549 17.2837 12.4615 17.5386 12.4615C17.7934 12.4615 18.0001 12.2549 18.0001 12C18.0001 9.7059 16.1404 7.84615 13.8463 7.84615H7.11437L8.17262 6.78789ZM6.92319 12C6.92319 11.7451 6.71655 11.5385 6.46165 11.5385C6.20675 11.5385 6.00011 11.7451 6.00011 12C6.00011 14.2941 7.85985 16.1538 10.154 16.1538H16.8859L15.8276 17.2121C15.6474 17.3923 15.6474 17.6846 15.8276 17.8649C16.0078 18.045 16.3001 18.045 16.4804 17.8649L18.3265 16.0187C18.5067 15.8384 18.5067 15.5462 18.3265 15.3659L16.4804 13.5198C16.3001 13.3396 16.0078 13.3396 15.8276 13.5198C15.6474 13.7 15.6474 13.9923 15.8276 14.1725L16.8859 15.2308H10.154C8.36965 15.2308 6.92319 13.7843 6.92319 12Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/mac-device.svg b/apps/web/src/assets/icons/mac-device.svgnew file mode 100644index 00000000..6e499455--- /dev/null+++ b/apps/web/src/assets/icons/mac-device.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.99928 6.4834C7.58405 6.4834 7.18583 6.64835 6.89222 6.94196C6.59861 7.23557 6.43366 7.63379 6.43366 8.04902V13.2678C6.43366 13.683 6.59861 14.0812 6.89222 14.3748C7.18583 14.6684 7.58405 14.8334 7.99928 14.8334H16.0014C16.207 14.8334 16.4106 14.7929 16.6005 14.7142C16.7905 14.6355 16.963 14.5202 17.1084 14.3748C17.2538 14.2295 17.3691 14.0569 17.4478 13.8669C17.5265 13.677 17.567 13.4734 17.567 13.2678V8.04902C17.567 7.84342 17.5265 7.63984 17.4478 7.44988C17.3691 7.25993 17.2538 7.08734 17.1084 6.94196C16.963 6.79658 16.7905 6.68125 16.6005 6.60257C16.4106 6.52389 16.207 6.4834 16.0014 6.4834H7.99928ZM7.47741 8.04902C7.47741 7.91061 7.53239 7.77787 7.63026 7.68C7.72813 7.58213 7.86087 7.52715 7.99928 7.52715H16.0014C16.1398 7.52715 16.2725 7.58213 16.3704 7.68C16.4683 7.77787 16.5232 7.91061 16.5232 8.04902V13.2678C16.5232 13.4062 16.4683 13.5389 16.3704 13.6368C16.2725 13.7347 16.1398 13.7896 16.0014 13.7896H7.99928C7.86087 13.7896 7.72813 13.7347 7.63026 13.6368C7.53239 13.5389 7.47741 13.4062 7.47741 13.2678V8.04902ZM5.56387 15.8771C5.42546 15.8771 5.29272 15.9321 5.19485 16.03C5.09698 16.1279 5.04199 16.2606 5.04199 16.399C5.04199 16.5374 5.09698 16.6702 5.19485 16.768C5.29272 16.8659 5.42546 16.9209 5.56387 16.9209H18.4368C18.5752 16.9209 18.7079 16.8659 18.8058 16.768C18.9037 16.6702 18.9587 16.5374 18.9587 16.399C18.9587 16.2606 18.9037 16.1279 18.8058 16.03C18.7079 15.9321 18.5752 15.8771 18.4368 15.8771H5.56387Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/mark.svg b/apps/web/src/assets/icons/mark.svgnew file mode 100644index 00000000..d2823230--- /dev/null+++ b/apps/web/src/assets/icons/mark.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.55324 3.63724C11.0249 2.78759 12.838 2.78759 14.3097 3.63724L17.9847 5.75902C19.4564 6.60867 20.3629 8.1789 20.3629 9.87821V14.1218C20.3629 15.8211 19.4564 17.3913 17.9847 18.241L14.3097 20.3628C12.838 21.2124 11.0249 21.2124 9.55324 20.3628L5.8782 18.241C4.40657 17.3913 3.5 15.8211 3.5 14.1218V9.87821C3.5 8.1789 4.40656 6.60867 5.8782 5.75902L9.55324 3.63724ZM13.1454 5.72532C12.4096 5.30049 11.503 5.30049 10.7672 5.72532L7.09534 7.84524C6.35952 8.27007 5.90623 9.0552 5.90623 9.90485V14.1447C5.90623 14.9944 6.35952 15.7795 7.09534 16.2043L10.7672 18.3243C11.503 18.7491 12.4096 18.7491 13.1454 18.3243L16.8172 16.2043C17.5531 15.7795 18.0064 14.9944 18.0064 14.1447V9.90485C18.0064 9.0552 17.5531 8.27007 16.8172 7.84524L13.1454 5.72532Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/marker.svg b/apps/web/src/assets/icons/marker.svgnew file mode 100644index 00000000..9a727323--- /dev/null+++ b/apps/web/src/assets/icons/marker.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.65332 12.3945C8.05376 13.116 6.94664 13.1157 6.34668 12.3945L2.84668 8.18848C2.62255 7.91905 2.5 7.57897 2.5 7.22851L2.5 4C2.5 3.17157 3.17157 2.5 4 2.5L11 2.5C11.8284 2.5 12.5 3.17157 12.5 4L12.5 7.22168C12.5 7.5718 12.3771 7.91135 12.1533 8.18066L8.65332 12.3945Z" stroke="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/mask-small.svg b/apps/web/src/assets/icons/mask-small.svgnew file mode 100644index 00000000..e45a21a7--- /dev/null+++ b/apps/web/src/assets/icons/mask-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.8 7.76923H17.2V16.2308H6.8V7.76923ZM6 7.76923C6 7.3444 6.35817 7 6.8 7H17.2C17.6418 7 18 7.3444 18 7.76923V16.2308C18 16.6556 17.6418 17 17.2 17H6.8C6.35817 17 6 16.6556 6 16.2308V7.76923ZM9.9 12C9.9 10.8848 10.8402 9.98077 12 9.98077C13.1598 9.98077 14.1 10.8848 14.1 12C14.1 13.1152 13.1598 14.0192 12 14.0192C10.8402 14.0192 9.9 13.1152 9.9 12ZM12 9.21154C10.3984 9.21154 9.1 10.46 9.1 12C9.1 13.54 10.3984 14.7885 12 14.7885C13.6016 14.7885 14.9 13.54 14.9 12C14.9 10.46 13.6016 9.21154 12 9.21154Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/media-audio.svg b/apps/web/src/assets/icons/media-audio.svgnew file mode 100644index 00000000..ebd4e394--- /dev/null+++ b/apps/web/src/assets/icons/media-audio.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9694 6.62757C12.1123 6.69746 12.2029 6.84266 12.2029 7.00174V16.9987C12.2029 17.1578 12.1123 17.303 11.9694 17.3729C11.8265 17.4428 11.6562 17.4251 11.5307 17.3275L8.43018 14.916H6.9962C6.30605 14.916 5.74658 14.3565 5.74658 13.6664V10.3341C5.74658 9.64392 6.30605 9.08444 6.9962 9.08444H8.43018L11.5307 6.67295C11.6562 6.57528 11.8265 6.55767 11.9694 6.62757ZM11.3699 7.85342L8.82883 9.82978C8.75571 9.88664 8.66573 9.91752 8.5731 9.91752H6.9962C6.76615 9.91752 6.57966 10.104 6.57966 10.3341V13.6664C6.57966 13.8964 6.76615 14.0829 6.9962 14.0829H8.5731C8.66573 14.0829 8.75571 14.1138 8.82883 14.1706L11.3699 16.147V7.85342ZM14.3093 8.95784C14.4625 8.8559 14.6694 8.89747 14.7713 9.05069C15.9566 10.8322 15.9566 13.1682 14.7713 14.9497C14.6694 15.1029 14.4625 15.1445 14.3093 15.0425C14.156 14.9406 14.1144 14.7338 14.2164 14.5805C15.2529 13.0226 15.2529 10.9778 14.2164 9.41987C14.1144 9.26664 14.156 9.05979 14.3093 8.95784ZM16.3088 6.94379C16.1897 6.80339 15.9795 6.78601 15.8391 6.90499C15.6987 7.02396 15.6813 7.23424 15.8003 7.37465C18.0572 10.0382 18.0572 13.9622 15.8003 16.6258C15.6813 16.7662 15.6987 16.9764 15.8391 17.0954C15.9795 17.2145 16.1897 17.197 16.3088 17.0567C18.7764 14.1445 18.7764 9.85597 16.3088 6.94379Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/media-fit-type.svg b/apps/web/src/assets/icons/media-fit-type.svgnew file mode 100644index 00000000..32b11cbf--- /dev/null+++ b/apps/web/src/assets/icons/media-fit-type.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17 6C17.5523 6 18 6.44772 18 7V17C18 17.5177 17.6067 17.9438 17.1025 17.9951L17 18H7L6.89746 17.9951C6.42703 17.9472 6.05278 17.573 6.00488 17.1025L6 17V7C6 6.44772 6.44772 6 7 6H17ZM7 6.87988C6.93373 6.87988 6.87988 6.93373 6.87988 7V17C6.87988 17.0663 6.93373 17.1201 7 17.1201H17C17.0663 17.1201 17.1201 17.0663 17.1201 17V7C17.1201 6.93373 17.0663 6.87988 17 6.87988H7ZM9 13C9.27611 13 9.49994 13.2239 9.5 13.5V14.5H10.5C10.7761 14.5 10.9999 14.7239 11 15C11 15.2761 10.7761 15.5 10.5 15.5H9C8.72395 15.4999 8.5 15.2761 8.5 15V13.5C8.50006 13.224 8.72398 13.0001 9 13ZM15 13C15.2761 13 15.4999 13.2239 15.5 13.5V15C15.5 15.2761 15.2761 15.5 15 15.5H13.5C13.2239 15.4999 13 15.2761 13 15C13.0001 14.724 13.224 14.5001 13.5 14.5H14.5V13.5C14.5001 13.224 14.724 13.0001 15 13ZM10.5 8.5C10.7761 8.5 10.9999 8.72391 11 9C11 9.27614 10.7761 9.5 10.5 9.5H9.5V10.5C9.5 10.7761 9.27614 11 9 11C8.72395 10.9999 8.5 10.7761 8.5 10.5V9C8.50006 8.72397 8.72398 8.50011 9 8.5H10.5ZM15 8.5C15.2761 8.5 15.4999 8.72391 15.5 9V10.5C15.5 10.7761 15.2761 11 15 11C14.7239 10.9999 14.5 10.7761 14.5 10.5V9.5H13.5C13.2239 9.49989 13 9.27608 13 9C13.0001 8.72397 13.224 8.50011 13.5 8.5H15Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/media-image.svg b/apps/web/src/assets/icons/media-image.svgnew file mode 100644index 00000000..37b69ef5--- /dev/null+++ b/apps/web/src/assets/icons/media-image.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.38462 6H16.6154C17.3801 6 18 6.61991 18 7.38462V16.6154C18 17.3801 17.3801 18 16.6154 18H7.38462C6.61991 18 6 17.3801 6 16.6154V7.38462C6 6.61991 6.61991 6 7.38462 6ZM7.38462 6.92308C7.12972 6.92308 6.92308 7.12972 6.92308 7.38462V12.7972L8.47551 11.2447C8.55516 11.1651 8.66374 11.1212 8.77638 11.1231C8.889 11.1251 8.99601 11.1727 9.07288 11.255L12.3448 14.7601L14.937 12.1678C15.0992 12.0056 15.3623 12.0056 15.5245 12.1678L17.0769 13.7202V7.38462C17.0769 7.12972 16.8702 6.92308 16.6154 6.92308H7.38462ZM6.92308 16.6154V13.9721L8.75896 12.1362L12.0287 15.6389L13.3303 17.0769H7.38462C7.12972 17.0769 6.92308 16.8702 6.92308 16.6154ZM16.6154 17.0769H14.4508L12.9077 15.372L15.2308 13.049L17.0769 14.8951V16.6154C17.0769 16.8702 16.8702 17.0769 16.6154 17.0769ZM11.2147 10.1538C11.2147 9.72012 11.5663 9.36851 12 9.36851C12.4337 9.36851 12.7853 9.72012 12.7853 10.1538C12.7853 10.5876 12.4337 10.9392 12 10.9392C11.5663 10.9392 11.2147 10.5876 11.2147 10.1538ZM12 8.53774C11.1074 8.53774 10.3839 9.2613 10.3839 10.1538C10.3839 11.0464 11.1074 11.77 12 11.77C12.8926 11.77 13.6161 11.0464 13.6161 10.1538C13.6161 9.2613 12.8926 8.53774 12 8.53774Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/minus.svg b/apps/web/src/assets/icons/minus.svgnew file mode 100644index 00000000..a9bfb4eb--- /dev/null+++ b/apps/web/src/assets/icons/minus.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.75 12C6.75 11.7239 6.97386 11.5 7.25 11.5H16.75C17.0261 11.5 17.25 11.7239 17.25 12C17.25 12.2761 17.0261 12.5 16.75 12.5H7.25C6.97386 12.5 6.75 12.2761 6.75 12Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/mixer-vertical.svg b/apps/web/src/assets/icons/mixer-vertical.svgnew file mode 100644index 00000000..44376aea--- /dev/null+++ b/apps/web/src/assets/icons/mixer-vertical.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 1.5C7.77614 1.5 8 1.72386 8 2V13C8 13.2761 7.77614 13.5 7.5 13.5C7.22386 13.5 7 13.2761 7 13V2C7 1.72386 7.22386 1.5 7.5 1.5ZM2.5 6C2.77614 6 3 6.22386 3 6.5V8.5C3 8.77614 2.77614 9 2.5 9C2.22386 9 2 8.77614 2 8.5V6.5C2 6.22386 2.22386 6 2.5 6ZM12.5 6C12.7761 6 13 6.22386 13 6.5V8.5C13 8.77614 12.7761 9 12.5 9C12.2239 9 12 8.77614 12 8.5V6.5C12 6.22386 12.2239 6 12.5 6ZM4.5 4.5C4.77614 4.5 5 4.72386 5 5V10C5 10.2761 4.77614 10.5 4.5 10.5C4.22386 10.5 4 10.2761 4 10V5C4 4.72386 4.22386 4.5 4.5 4.5ZM10.5 4.5C10.7761 4.5 11 4.72386 11 5V10C11 10.2761 10.7761 10.5 10.5 10.5C10.2239 10.5 10 10.2761 10 10V5C10 4.72386 10.2239 4.5 10.5 4.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/more-three-dots-small-horizontal.svg b/apps/web/src/assets/icons/more-three-dots-small-horizontal.svgnew file mode 100644index 00000000..d6681680--- /dev/null+++ b/apps/web/src/assets/icons/more-three-dots-small-horizontal.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.08984 12.0049C9.08984 12.5572 8.64209 13.0049 8.08984 13.0049C7.53758 13.0049 7.08984 12.5572 7.08984 12.0049C7.08984 11.4526 7.53758 11.0049 8.08984 11.0049C8.64209 11.0049 9.08984 11.4526 9.08984 12.0049ZM13.0498 12.0049C13.0498 12.5572 12.6021 13.0049 12.0498 13.0049C11.4975 13.0049 11.0498 12.5572 11.0498 12.0049C11.0498 11.4526 11.4975 11.0049 12.0498 11.0049C12.6021 11.0049 13.0498 11.4526 13.0498 12.0049ZM17 12.0049C17 12.5571 16.5522 13.0048 16 13.0049C15.4477 13.0049 15 12.5572 15 12.0049C15 11.4526 15.4477 11.0049 16 11.0049C16.5522 11.005 17 11.4527 17 12.0049Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/more-three-dots-small.svg b/apps/web/src/assets/icons/more-three-dots-small.svgnew file mode 100644index 00000000..44a67371--- /dev/null+++ b/apps/web/src/assets/icons/more-three-dots-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 14.96C12.5523 14.96 13 15.4077 13 15.96C13 16.5122 12.5523 16.96 12 16.96C11.4477 16.96 11 16.5122 11 15.96C11 15.4077 11.4477 14.96 12 14.96ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM12 7.0498C12.5522 7.0498 12.9999 7.49761 13 8.0498C13 8.60209 12.5523 9.0498 12 9.0498C11.4477 9.0498 11 8.60209 11 8.0498C11.0001 7.49761 11.4478 7.0498 12 7.0498Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/more-three-dots.svg b/apps/web/src/assets/icons/more-three-dots.svgnew file mode 100644index 00000000..d15253ee--- /dev/null+++ b/apps/web/src/assets/icons/more-three-dots.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5102 7.5102C12.5102 8.06812 12.0579 8.52041 11.5 8.52041C10.942 8.52041 10.4897 8.06812 10.4897 7.5102C10.4897 6.95228 10.942 6.5 11.5 6.5C12.0579 6.5 12.5102 6.95228 12.5102 7.5102ZM12.5102 12C12.5102 12.5579 12.0579 13.0102 11.5 13.0102C10.942 13.0102 10.4897 12.5579 10.4897 12C10.4897 11.4421 10.942 10.9898 11.5 10.9898C12.0579 10.9898 12.5102 11.4421 12.5102 12ZM11.5 17.5C12.0579 17.5 12.5102 17.0477 12.5102 16.4898C12.5102 15.9319 12.0579 15.4796 11.5 15.4796C10.942 15.4796 10.4897 15.9319 10.4897 16.4898C10.4897 17.0477 10.942 17.5 11.5 17.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/motion.svg b/apps/web/src/assets/icons/motion.svgnew file mode 100644index 00000000..716db51a--- /dev/null+++ b/apps/web/src/assets/icons/motion.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.25 6.25C17.9404 6.25 18.5 6.80964 18.5 7.5C18.5 8.19036 17.9404 8.75 17.25 8.75C16.7445 8.75 16.3102 8.44935 16.1133 8.01758C15.1086 8.10907 14.44 8.56174 13.9199 9.2168C13.3074 9.98837 12.9033 11.035 12.4668 12.1787C12.0447 13.2847 11.5901 14.4886 10.8633 15.4043C10.6918 15.6203 10.5041 15.8197 10.2998 16H12.6055C12.7985 15.5588 13.2376 15.25 13.75 15.25C14.4404 15.25 15 15.8096 15 16.5C15 17.1904 14.4404 17.75 13.75 17.75C13.2376 17.75 12.7985 17.4412 12.6055 17H7.89453C7.70152 17.4412 7.26237 17.75 6.75 17.75C6.05964 17.75 5.5 17.1904 5.5 16.5C5.5 15.8096 6.05964 15.25 6.75 15.25C7.25508 15.25 7.68857 15.5503 7.88574 15.9814C8.89093 15.8901 9.55984 15.4385 10.0801 14.7832C10.6926 14.0116 11.0967 12.965 11.5332 11.8213C11.9553 10.7153 12.4098 9.51144 13.1367 8.5957C13.3082 8.37973 13.4959 8.18032 13.7002 8H11.3945C11.2015 8.44119 10.7624 8.75 10.25 8.75C9.55964 8.75 9 8.19036 9 7.5C9 6.80964 9.55964 6.25 10.25 6.25C10.7624 6.25 11.2015 6.55881 11.3945 7H16.1055C16.2985 6.55881 16.7376 6.25 17.25 6.25Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/move-small.svg b/apps/web/src/assets/icons/move-small.svgnew file mode 100644index 00000000..3e067bb5--- /dev/null+++ b/apps/web/src/assets/icons/move-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M6.7002 6.67558C6.7002 5.84446 7.65651 5.37696 8.31248 5.88708L17.3123 12.8883C18.0635 13.4724 17.6506 14.6758 16.6996 14.6758H12.1358C11.7994 14.6758 11.4825 14.8289 11.274 15.0926L8.48297 18.6222C7.89559 19.3654 6.7002 18.9499 6.7002 18.0029V6.67558ZM16.6989 13.6768L7.69913 6.67558V18.0029L10.4902 14.4733C10.6865 14.225 10.9365 14.0244 11.2213 13.8865C11.5062 13.7486 11.8186 13.6769 12.1351 13.6768H16.6989Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/move.svg b/apps/web/src/assets/icons/move.svgnew file mode 100644index 00000000..1db6c8b6--- /dev/null+++ b/apps/web/src/assets/icons/move.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M6.75 5.96547C6.75 5.03014 7.82622 4.50402 8.56444 5.07811L18.6926 12.9572C19.538 13.6145 19.0734 14.9687 18.0031 14.9687H12.8671C12.4886 14.9687 12.1319 15.1411 11.8973 15.4379L8.7563 19.41C8.09528 20.2464 6.75 19.7788 6.75 18.713V5.96547ZM18.0024 13.8445L7.87419 5.96547V18.713L11.0152 14.7409C11.2361 14.4615 11.5174 14.2358 11.838 14.0805C12.1586 13.9253 12.5102 13.8446 12.8663 13.8445H18.0024Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/mute.svg b/apps/web/src/assets/icons/mute.svgnew file mode 100644index 00000000..1aff7ed7--- /dev/null+++ b/apps/web/src/assets/icons/mute.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.43244 8.72727H9.48358L11.9552 14.7642H12.0404L14.512 8.72727H15.5631V16H14.7393V10.4744H14.6682L12.3955 16H11.6001L9.32733 10.4744H9.2563V16H8.43244V8.72727Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/navigation.folder-open.svg b/apps/web/src/assets/icons/navigation.folder-open.svgnew file mode 100644index 00000000..659ac36f--- /dev/null+++ b/apps/web/src/assets/icons/navigation.folder-open.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M6.50616 7.96429V13.1531L7.68473 11.1103C7.89167 10.7518 8.18935 10.4542 8.54782 10.2473C8.90629 10.0404 9.31291 9.93159 9.7268 9.93171H15.9347V9.53571C15.9347 9.22314 15.8106 8.92336 15.5895 8.70234C15.3685 8.48131 15.0687 8.35714 14.7562 8.35714H11.6133C11.5093 8.35712 11.4096 8.31587 11.3359 8.24243L9.99473 6.90043C9.95818 6.86397 9.9148 6.83507 9.86708 6.81539C9.81935 6.79571 9.76821 6.78562 9.71659 6.78571H7.68473C7.37215 6.78571 7.07238 6.90988 6.85135 7.13091C6.63033 7.35193 6.50616 7.65171 6.50616 7.96429ZM7.51502 16.2025C7.57054 16.2104 7.62816 16.2143 7.68787 16.2143H15.0704C15.3463 16.2143 15.6173 16.1417 15.8561 16.0037C16.095 15.8658 16.2934 15.6675 16.4313 15.4286L18.1308 12.4861C18.2343 12.3069 18.2887 12.1035 18.2887 11.8966C18.2887 11.6897 18.2341 11.4864 18.1306 11.3072C18.0271 11.128 17.8782 10.9792 17.6989 10.8758C17.5197 10.7724 17.3163 10.7181 17.1094 10.7182H9.72759C9.45175 10.7182 9.18078 10.7908 8.9419 10.9288C8.70302 11.0667 8.50465 11.265 8.36673 11.5039L6.66723 14.4464C6.57092 14.6129 6.51682 14.8004 6.50964 14.9926C6.50246 15.1848 6.54242 15.3758 6.62603 15.549C6.70964 15.7222 6.83437 15.8723 6.98933 15.9862C7.14428 16.1001 7.32476 16.1744 7.51502 16.2025ZM5.72044 15.0043V7.96429C5.72044 7.44332 5.9274 6.9437 6.29577 6.57533C6.66415 6.20695 7.16377 6 7.68473 6H9.71659C10.0291 6.00028 10.3286 6.12463 10.5494 6.34571L11.7767 7.57143H14.7562C15.2771 7.57143 15.7767 7.77838 16.1451 8.14675C16.5135 8.51513 16.7204 9.01475 16.7204 9.53571V9.9325H17.1102C18.6227 9.9325 19.5679 11.5691 18.812 12.8789L17.1125 15.8214C16.9056 16.1798 16.6081 16.4773 16.2498 16.6842C15.8914 16.8911 15.485 17 15.0712 17H7.68552C7.63575 17 7.58704 16.9982 7.53937 16.9945C7.12237 16.9657 6.72593 16.8025 6.40952 16.5294C6.18954 16.3417 6.01372 16.1077 5.89461 15.8442C5.7755 15.5807 5.71603 15.2942 5.72044 15.0051" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/navigation.folder.svg b/apps/web/src/assets/icons/navigation.folder.svgnew file mode 100644index 00000000..f9763e49--- /dev/null+++ b/apps/web/src/assets/icons/navigation.folder.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.61663 6C7.09567 6 6.59604 6.20695 6.22767 6.57533C5.85929 6.9437 5.65234 7.44332 5.65234 7.96429V15.0357C5.65234 15.5567 5.85929 16.0563 6.22767 16.4247C6.59604 16.793 7.09567 17 7.61663 17H16.2595C16.7804 17 17.2801 16.793 17.6484 16.4247C18.0168 16.0563 18.2238 15.5567 18.2238 15.0357V9.53571C18.2238 9.01475 18.0168 8.51513 17.6484 8.14675C17.2801 7.77838 16.7804 7.57143 16.2595 7.57143H11.7078L10.5395 6.40307C10.4118 6.27528 10.2601 6.1739 10.0932 6.10474C9.92634 6.03558 9.74744 5.99999 9.56677 6H7.61663ZM6.43806 7.96429C6.43806 7.65171 6.56223 7.35193 6.78325 7.13091C7.00428 6.90988 7.30405 6.78571 7.61663 6.78571H9.56677C9.72301 6.78585 9.87279 6.84803 9.9832 6.95857L10.9889 7.96429L9.92663 9.02814C9.89008 9.0646 9.8467 9.0935 9.79897 9.11318C9.75125 9.13287 9.70011 9.14295 9.64849 9.14286H6.43806V7.96429ZM6.43806 9.92857H9.64849C9.96096 9.9283 10.2605 9.80395 10.4813 9.58286L11.7078 8.35714H16.2595C16.5721 8.35714 16.8718 8.48131 17.0929 8.70234C17.3139 8.92336 17.4381 9.22314 17.4381 9.53571V15.0357C17.4381 15.3483 17.3139 15.6481 17.0929 15.8691C16.8718 16.0901 16.5721 16.2143 16.2595 16.2143H7.61663C7.30405 16.2143 7.00428 16.0901 6.78325 15.8691C6.56223 15.6481 6.43806 15.3483 6.43806 15.0357V9.92857Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/no-loop.svg b/apps/web/src/assets/icons/no-loop.svgnew file mode 100644index 00000000..3c201cff--- /dev/null+++ b/apps/web/src/assets/icons/no-loop.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2829_29245)">+<path d="M14.9115 6.14793C15.0612 5.91961 15.3678 5.85617 15.5961 6.00593C15.8242 6.15579 15.8877 6.46249 15.738 6.69081L8.42531 17.846C8.27558 18.0744 7.96902 18.1387 7.74068 17.9889C7.51245 17.8391 7.44903 17.5324 7.59873 17.3041L14.9115 6.14793ZM15.8269 13.5193C16.0071 13.3391 16.2994 13.3391 16.4796 13.5193L18.325 15.3653C18.5051 15.5456 18.5051 15.838 18.325 16.0183L16.4796 17.8643C16.2994 18.0445 16.0071 18.0445 15.8269 17.8643C15.6468 17.684 15.6468 17.3916 15.8269 17.2113L16.8852 16.1536H11.8456C11.4786 16.1535 11.2583 15.7458 11.4593 15.4387C11.5446 15.3086 11.69 15.2301 11.8456 15.2301H16.8852L15.8269 14.1714C15.6469 13.9911 15.6469 13.6996 15.8269 13.5193ZM6.46315 11.5371C6.71777 11.5374 6.92375 11.7441 6.92375 11.9989C6.92376 12.8207 7.23297 13.569 7.73875 14.1385C7.89418 14.3139 7.93261 14.5722 7.80441 14.7684C7.65088 15.0028 7.32558 15.0533 7.1333 14.8495C6.43157 14.1055 6.00158 13.1025 6.00158 11.9989C6.00158 11.7439 6.20831 11.5371 6.46315 11.5371ZM15.7844 8.84012C15.921 8.63177 16.2001 8.56817 16.3966 8.7213C17.3714 9.48145 17.9986 10.6666 17.9986 11.9989C17.9986 12.2538 17.7918 12.4606 17.537 12.4606C17.2824 12.4604 17.0764 12.2537 17.0764 11.9989C17.0764 10.9995 16.6224 10.1061 15.9099 9.51341C15.7102 9.34732 15.642 9.05737 15.7844 8.84012ZM7.52051 6.13344C7.70072 5.95321 7.99309 5.95318 8.17328 6.13344C8.35327 6.31364 8.35321 6.60524 8.17328 6.78548L7.11495 7.84419H11.4893C11.8562 7.84434 12.0758 8.25201 11.8745 8.55902C11.7893 8.68902 11.6447 8.76761 11.4893 8.76767H7.11495L8.17328 9.82639C8.35325 10.0066 8.35323 10.2982 8.17328 10.4784C7.99309 10.6587 7.70072 10.6587 7.52051 10.4784L5.67519 8.63243C5.49499 8.45217 5.49499 8.1597 5.67519 7.97943L7.52051 6.13344Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2829_29245">+<rect width="14" height="14" fill="white" transform="translate(5 5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/password-lock.svg b/apps/web/src/assets/icons/password-lock.svgnew file mode 100644index 00000000..daf5947c--- /dev/null+++ b/apps/web/src/assets/icons/password-lock.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.0003 13C13.0003 13.2652 12.895 13.5196 12.7074 13.7071C12.5199 13.8946 12.2655 14 12.0003 14C11.7351 14 11.4808 13.8946 11.2932 13.7071C11.1057 13.5196 11.0003 13.2652 11.0003 13C11.0003 12.7348 11.1057 12.4804 11.2932 12.2929C11.4808 12.1054 11.7351 12 12.0003 12C12.2655 12 12.5199 12.1054 12.7074 12.2929C12.895 12.4804 13.0003 12.7348 13.0003 13ZM12.0003 5C11.2931 5 10.6148 5.28095 10.1147 5.78105C9.61461 6.28115 9.33366 6.95942 9.33366 7.66667V8.33333H8.83366C8.25902 8.33333 7.70792 8.56161 7.30159 8.96794C6.89527 9.37426 6.66699 9.92536 6.66699 10.5V15.5C6.66699 16.0746 6.89527 16.6257 7.30159 17.0321C7.70792 17.4384 8.25902 17.6667 8.83366 17.6667H11.3337V17.6093C11.3337 17.2557 11.4743 16.9167 11.7243 16.6667H8.83366C8.52424 16.6667 8.22749 16.5438 8.0087 16.325C7.78991 16.1062 7.66699 15.8094 7.66699 15.5V10.5C7.66699 9.856 8.18966 9.33333 8.83366 9.33333H15.167C15.811 9.33333 16.3337 9.856 16.3337 10.5V11.074C16.6615 10.9994 16.9995 10.9805 17.3337 11.018V10.5C17.3337 10.2155 17.2776 9.93372 17.1687 9.67085C17.0598 9.40798 16.9003 9.16913 16.6991 8.96794C16.4979 8.76674 16.259 8.60715 15.9961 8.49826C15.7333 8.38938 15.4515 8.33333 15.167 8.33333H14.667V7.66667C14.667 6.95942 14.386 6.28115 13.8859 5.78105C13.3858 5.28095 12.7076 5 12.0003 5ZM10.3337 7.66667C10.3337 7.22464 10.5093 6.80072 10.8218 6.48816C11.1344 6.17559 11.5583 6 12.0003 6C12.4424 6 12.8663 6.17559 13.1788 6.48816C13.4914 6.80072 13.667 7.22464 13.667 7.66667V8.33333H10.3337V7.66667ZM17.0003 16.3333C17.4873 16.3332 17.962 16.1806 18.3579 15.8972C18.7538 15.6137 19.0511 15.2134 19.2081 14.7525C19.3652 14.2916 19.3741 13.7931 19.2336 13.3268C19.0931 12.8606 18.8103 12.45 18.4248 12.1526C18.0392 11.8551 17.5703 11.6857 17.0836 11.6682C16.597 11.6506 16.1171 11.7857 15.7111 12.0546C15.3051 12.3235 14.9934 12.7126 14.8197 13.1675C14.646 13.6224 14.6189 14.1203 14.7423 14.5913L12.1957 17.138C12.0706 17.263 12.0004 17.4325 12.0003 17.6093V18.6667C12.0003 18.7551 12.0354 18.8399 12.098 18.9024C12.1605 18.9649 12.2453 19 12.3337 19H13.667C13.7554 19 13.8402 18.9649 13.9027 18.9024C13.9652 18.8399 14.0003 18.7551 14.0003 18.6667V18.3333H14.667C14.7554 18.3333 14.8402 18.2982 14.9027 18.2357C14.9652 18.1732 15.0003 18.0884 15.0003 18V17.3333H15.667C15.7554 17.3333 15.8402 17.2982 15.9027 17.2357C15.9652 17.1732 16.0003 17.0884 16.0003 17V16.3333H17.0003ZM17.3337 13C17.5105 13 17.68 13.0702 17.8051 13.1953C17.9301 13.3203 18.0003 13.4899 18.0003 13.6667C18.0003 13.8435 17.9301 14.013 17.8051 14.1381C17.68 14.2631 17.5105 14.3333 17.3337 14.3333C17.1568 14.3333 16.9873 14.2631 16.8623 14.1381C16.7372 14.013 16.667 13.8435 16.667 13.6667C16.667 13.4899 16.7372 13.3203 16.8623 13.1953C16.9873 13.0702 17.1568 13 17.3337 13Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/pause.svg b/apps/web/src/assets/icons/pause.svgnew file mode 100644index 00000000..7abcb966--- /dev/null+++ b/apps/web/src/assets/icons/pause.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.5502 7.2502C10.5502 6.94645 10.304 6.7002 10.0002 6.7002C9.69644 6.7002 9.4502 6.94645 9.4502 7.2502V16.7502C9.4502 17.0539 9.69644 17.3002 10.0002 17.3002C10.304 17.3002 10.5502 17.0539 10.5502 16.7502V7.2502ZM14.5502 7.2502C14.5502 6.94645 14.304 6.7002 14.0002 6.7002C13.6964 6.7002 13.4502 6.94645 13.4502 7.2502V16.7502C13.4502 17.0539 13.6964 17.3002 14.0002 17.3002C14.304 17.3002 14.5502 17.0539 14.5502 16.7502V7.2502Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/pin-left-right.svg b/apps/web/src/assets/icons/pin-left-right.svgnew file mode 100644index 00000000..397bfd49--- /dev/null+++ b/apps/web/src/assets/icons/pin-left-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.5996 9.5C16.8205 9.5 17 9.67948 17 9.90039V14.0996C17 14.3205 16.8205 14.5 16.5996 14.5C16.3789 14.4998 16.2002 14.3204 16.2002 14.0996V12.4004H7.7998V14.0996C7.7998 14.3204 7.62112 14.4998 7.40039 14.5C7.17948 14.5 7 14.3205 7 14.0996V9.90039C7 9.67948 7.17948 9.5 7.40039 9.5C7.62112 9.50021 7.7998 9.67961 7.7998 9.90039V11.5996H16.2002V9.90039C16.2002 9.67961 16.3789 9.50021 16.5996 9.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/pin-top-bottom.svg b/apps/web/src/assets/icons/pin-top-bottom.svgnew file mode 100644index 00000000..f007ac7f--- /dev/null+++ b/apps/web/src/assets/icons/pin-top-bottom.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.5 16.5996C14.5 16.8205 14.3205 17 14.0996 17L9.90039 17C9.67948 17 9.5 16.8205 9.5 16.5996C9.50021 16.3789 9.67961 16.2002 9.90039 16.2002L11.5996 16.2002L11.5996 7.7998L9.90039 7.7998C9.67961 7.7998 9.50021 7.62112 9.5 7.40039C9.5 7.17948 9.67948 7 9.90039 7L14.0996 7C14.3205 7 14.5 7.17948 14.5 7.40039C14.4998 7.62112 14.3204 7.7998 14.0996 7.7998L12.4004 7.7998L12.4004 16.2002L14.0996 16.2002C14.3204 16.2002 14.4998 16.3789 14.5 16.5996Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/play.svg b/apps/web/src/assets/icons/play.svgnew file mode 100644index 00000000..8025da57--- /dev/null+++ b/apps/web/src/assets/icons/play.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.25131 6.57463C8.40728 6.48059 8.60109 6.47507 8.76216 6.56008L18.1153 11.4965C18.2857 11.5864 18.3924 11.7633 18.3924 11.956C18.3924 12.1487 18.2857 12.3256 18.1153 12.4155L8.76216 17.3519C8.60109 17.4369 8.40728 17.4314 8.25131 17.3374C8.09535 17.2433 8 17.0744 8 16.8924V7.01962C8 6.8375 8.09535 6.66867 8.25131 6.57463ZM9.03924 7.88141V16.0305L16.7595 11.956L9.03924 7.88141Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/plus-add-small.svg b/apps/web/src/assets/icons/plus-add-small.svgnew file mode 100644index 00000000..db202f5d--- /dev/null+++ b/apps/web/src/assets/icons/plus-add-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.3666 8.51657C12.3666 8.31407 12.2024 8.1499 11.9999 8.1499C11.7974 8.1499 11.6332 8.31407 11.6332 8.51657V11.6332H8.51657C8.31407 11.6332 8.1499 11.7974 8.1499 11.9999C8.1499 12.2024 8.31407 12.3666 8.51657 12.3666H11.6332V15.4832C11.6332 15.6857 11.7974 15.8499 11.9999 15.8499C12.2024 15.8499 12.3666 15.6857 12.3666 15.4832V12.3666H15.4832C15.6857 12.3666 15.8499 12.2024 15.8499 11.9999C15.8499 11.7974 15.6857 11.6332 15.4832 11.6332H12.3666V8.51657Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/plus-add.svg b/apps/web/src/assets/icons/plus-add.svgnew file mode 100644index 00000000..2c9e62ac--- /dev/null+++ b/apps/web/src/assets/icons/plus-add.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5 7.25C12.5 6.97386 12.2761 6.75 12 6.75C11.7239 6.75 11.5 6.97386 11.5 7.25V11.5H7.25C6.97386 11.5 6.75 11.7239 6.75 12C6.75 12.2761 6.97386 12.5 7.25 12.5H11.5V16.75C11.5 17.0261 11.7239 17.25 12 17.25C12.2761 17.25 12.5 17.0261 12.5 16.75V12.5H16.75C17.0261 12.5 17.25 12.2761 17.25 12C17.25 11.7239 17.0261 11.5 16.75 11.5H12.5V7.25Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/preferences-adjust.svg b/apps/web/src/assets/icons/preferences-adjust.svgnew file mode 100644index 00000000..97dfdd41--- /dev/null+++ b/apps/web/src/assets/icons/preferences-adjust.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1331 7.80003C9.3599 7.80003 8.73311 8.42683 8.73311 9.20003C8.73311 9.97323 9.3599 10.6 10.1331 10.6C10.9063 10.6 11.5331 9.97323 11.5331 9.20003C11.5331 8.42683 10.9063 7.80003 10.1331 7.80003ZM7.79977 9.6667C7.81537 9.6667 7.83079 9.66593 7.84599 9.66444C8.06131 10.7306 9.00346 11.5334 10.1331 11.5334C11.2627 11.5334 12.2049 10.7306 12.4202 9.66444C12.4354 9.66593 12.4508 9.6667 12.4664 9.6667H17.5998C17.8575 9.6667 18.0664 9.45776 18.0664 9.20003C18.0664 8.9423 17.8575 8.73337 17.5998 8.73337H12.4664C12.4508 8.73337 12.4354 8.73413 12.4202 8.73562C12.2049 7.66945 11.2627 6.8667 10.1331 6.8667C9.00346 6.8667 8.06131 7.66945 7.84599 8.73562C7.83079 8.73413 7.81537 8.73337 7.79977 8.73337H6.39977C6.14204 8.73337 5.93311 8.9423 5.93311 9.20003C5.93311 9.45776 6.14204 9.6667 6.39977 9.6667H7.79977ZM16.1536 15.2645C15.9383 16.3306 14.9961 17.1334 13.8664 17.1334C12.7368 17.1334 11.7946 16.3306 11.5793 15.2645C11.5641 15.266 11.5487 15.2667 11.5331 15.2667H6.39977C6.14204 15.2667 5.93311 15.0577 5.93311 14.8C5.93311 14.5423 6.14204 14.3334 6.39977 14.3334H11.5331C11.5487 14.3334 11.5641 14.3341 11.5793 14.3356C11.7946 13.2695 12.7368 12.4667 13.8664 12.4667C14.9961 12.4667 15.9383 13.2695 16.1536 14.3356C16.1688 14.3341 16.1842 14.3334 16.1998 14.3334H17.5998C17.8575 14.3334 18.0664 14.5423 18.0664 14.8C18.0664 15.0577 17.8575 15.2667 17.5998 15.2667H16.1998C16.1842 15.2667 16.1688 15.266 16.1536 15.2645ZM12.4664 14.8C12.4664 14.0268 13.0932 13.4 13.8664 13.4C14.6396 13.4 15.2664 14.0268 15.2664 14.8C15.2664 15.5732 14.6396 16.2 13.8664 16.2C13.0932 16.2 12.4664 15.5732 12.4664 14.8Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/presets-small.svg b/apps/web/src/assets/icons/presets-small.svgnew file mode 100644index 00000000..757460a7--- /dev/null+++ b/apps/web/src/assets/icons/presets-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.72727 6C7.22104 6 6 7.22104 6 8.72727C6 10.2335 7.22104 11.4545 8.72727 11.4545C10.2335 11.4545 11.4545 10.2335 11.4545 8.72727C11.4545 7.22104 10.2335 6 8.72727 6ZM7.09091 8.72727C7.09091 7.82353 7.82353 7.09091 8.72727 7.09091C9.63101 7.09091 10.3636 7.82353 10.3636 8.72727C10.3636 9.63101 9.63101 10.3636 8.72727 10.3636C7.82353 10.3636 7.09091 9.63101 7.09091 8.72727ZM15.2727 6C13.7665 6 12.5455 7.22104 12.5455 8.72727C12.5455 10.2335 13.7665 11.4545 15.2727 11.4545C16.7789 11.4545 18 10.2335 18 8.72727C18 7.22104 16.7789 6 15.2727 6ZM13.6364 8.72727C13.6364 7.82353 14.369 7.09091 15.2727 7.09091C16.1764 7.09091 16.9091 7.82353 16.9091 8.72727C16.9091 9.63101 16.1764 10.3636 15.2727 10.3636C14.369 10.3636 13.6364 9.63101 13.6364 8.72727ZM6 15.2727C6 13.7665 7.22104 12.5455 8.72727 12.5455C10.2335 12.5455 11.4545 13.7665 11.4545 15.2727C11.4545 16.7789 10.2335 18 8.72727 18C7.22104 18 6 16.7789 6 15.2727ZM8.72727 13.6364C7.82353 13.6364 7.09091 14.369 7.09091 15.2727C7.09091 16.1764 7.82353 16.9091 8.72727 16.9091C9.63101 16.9091 10.3636 16.1764 10.3636 15.2727C10.3636 14.369 9.63101 13.6364 8.72727 13.6364ZM15.2727 12.5455C13.7665 12.5455 12.5455 13.7665 12.5455 15.2727C12.5455 16.7789 13.7665 18 15.2727 18C16.7789 18 18 16.7789 18 15.2727C18 13.7665 16.7789 12.5455 15.2727 12.5455ZM13.6364 15.2727C13.6364 14.369 14.369 13.6364 15.2727 13.6364C16.1764 13.6364 16.9091 14.369 16.9091 15.2727C16.9091 16.1764 16.1764 16.9091 15.2727 16.9091C14.369 16.9091 13.6364 16.1764 13.6364 15.2727Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-dB.svg b/apps/web/src/assets/icons/prop-dB.svgnew file mode 100644index 00000000..d9c8c471--- /dev/null+++ b/apps/web/src/assets/icons/prop-dB.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.28928 16.1136C7.83474 16.1136 7.43346 15.9988 7.08545 15.7692C6.73744 15.5372 6.46518 15.2105 6.26869 14.7891C6.07219 14.3653 5.97394 13.8646 5.97394 13.2869C5.97394 12.714 6.07219 12.2169 6.26869 11.7955C6.46518 11.3741 6.73862 11.0485 7.089 10.8189C7.43938 10.5893 7.84421 10.4744 8.30349 10.4744C8.6586 10.4744 8.93914 10.5336 9.14511 10.652C9.35344 10.768 9.51206 10.9006 9.62096 11.0497C9.73223 11.1965 9.81864 11.3172 9.88019 11.4119H9.95121V8.72727H10.7893V16H9.97962V15.1619H9.88019C9.81864 15.2614 9.73104 15.3868 9.61741 15.5384C9.50377 15.6875 9.3416 15.8213 9.1309 15.9396C8.9202 16.0556 8.63966 16.1136 8.28928 16.1136ZM8.40292 15.3608C8.73909 15.3608 9.02318 15.2732 9.25519 15.098C9.4872 14.9205 9.66357 14.6754 9.78431 14.3629C9.90505 14.0481 9.96542 13.6847 9.96542 13.2727C9.96542 12.8655 9.90623 12.5092 9.78786 12.2038C9.66949 11.8961 9.4943 11.657 9.26229 11.4865C9.03029 11.3137 8.74383 11.2273 8.40292 11.2273C8.04781 11.2273 7.75188 11.3184 7.51514 11.5007C7.28076 11.6806 7.10439 11.9257 6.98602 12.2358C6.87001 12.5436 6.81201 12.8892 6.81201 13.2727C6.81201 13.661 6.8712 14.0137 6.98957 14.331C7.11031 14.6458 7.28786 14.8968 7.52224 15.0838C7.75898 15.2685 8.05254 15.3608 8.40292 15.3608ZM12.9142 16V8.72727H15.4568C15.9634 8.72727 16.3813 8.81487 16.7104 8.99006C17.0394 9.16288 17.2845 9.39607 17.4454 9.68963C17.6064 9.98082 17.6869 10.304 17.6869 10.6591C17.6869 10.9716 17.6313 11.2296 17.52 11.4332C17.4111 11.6368 17.2667 11.7978 17.0868 11.9162C16.9092 12.0346 16.7163 12.1222 16.5079 12.179V12.25C16.7305 12.2642 16.9542 12.3423 17.1791 12.4844C17.404 12.6264 17.5922 12.83 17.7437 13.0952C17.8953 13.3603 17.971 13.6847 17.971 14.0682C17.971 14.4328 17.8882 14.7607 17.7224 15.0518C17.5567 15.343 17.2951 15.5739 16.9376 15.7443C16.5802 15.9148 16.115 16 15.542 16H12.9142ZM13.7949 15.2188H15.542C16.1173 15.2188 16.5257 15.1075 16.7672 14.8849C17.011 14.66 17.1329 14.3878 17.1329 14.0682C17.1329 13.822 17.0702 13.5947 16.9447 13.3864C16.8193 13.1757 16.6405 13.0076 16.4085 12.8821C16.1765 12.7543 15.9019 12.6903 15.5847 12.6903H13.7949V15.2188ZM13.7949 11.9233H15.4284C15.6936 11.9233 15.9327 11.8712 16.1457 11.767C16.3612 11.6629 16.5316 11.5161 16.6571 11.3267C16.7849 11.1373 16.8489 10.9148 16.8489 10.6591C16.8489 10.3395 16.7376 10.0684 16.5151 9.84588C16.2925 9.62098 15.9398 9.50852 15.4568 9.50852H13.7949V11.9233Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-height.svg b/apps/web/src/assets/icons/prop-height.svgnew file mode 100644index 00000000..544a474a--- /dev/null+++ b/apps/web/src/assets/icons/prop-height.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.17951 16V8.72727H10.0602V11.9659H13.938V8.72727H14.8187V16H13.938V12.7472H10.0602V16H9.17951Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-mute.svg b/apps/web/src/assets/icons/prop-mute.svgnew file mode 100644index 00000000..1aff7ed7--- /dev/null+++ b/apps/web/src/assets/icons/prop-mute.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.43244 8.72727H9.48358L11.9552 14.7642H12.0404L14.512 8.72727H15.5631V16H14.7393V10.4744H14.6682L12.3955 16H11.6001L9.32733 10.4744H9.2563V16H8.43244V8.72727Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-percentage.svg b/apps/web/src/assets/icons/prop-percentage.svgnew file mode 100644index 00000000..0c5d9b8e--- /dev/null+++ b/apps/web/src/assets/icons/prop-percentage.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.3977 14.6364V14.2528C12.3977 13.9877 12.4522 13.745 12.5611 13.5249C12.6723 13.3023 12.8333 13.1248 13.044 12.9922C13.2571 12.8572 13.5152 12.7898 13.8182 12.7898C14.1259 12.7898 14.384 12.8572 14.5923 12.9922C14.8007 13.1248 14.9581 13.3023 15.0646 13.5249C15.1712 13.745 15.2244 13.9877 15.2244 14.2528V14.6364C15.2244 14.9015 15.17 15.1454 15.0611 15.3679C14.9545 15.5881 14.7959 15.7656 14.5852 15.9006C14.3769 16.0331 14.1212 16.0994 13.8182 16.0994C13.5104 16.0994 13.2512 16.0331 13.0405 15.9006C12.8298 15.7656 12.67 15.5881 12.5611 15.3679C12.4522 15.1454 12.3977 14.9015 12.3977 14.6364ZM13.1222 14.2528V14.6364C13.1222 14.8565 13.1742 15.0542 13.2784 15.2294C13.3826 15.4022 13.5625 15.4886 13.8182 15.4886C14.0668 15.4886 14.242 15.4022 14.3438 15.2294C14.4479 15.0542 14.5 14.8565 14.5 14.6364V14.2528C14.5 14.0327 14.4503 13.8362 14.3509 13.6634C14.2514 13.4882 14.0739 13.4006 13.8182 13.4006C13.5696 13.4006 13.3909 13.4882 13.282 13.6634C13.1754 13.8362 13.1222 14.0327 13.1222 14.2528ZM8.77557 10.4744V10.0909C8.77557 9.82576 8.83002 9.5831 8.93892 9.36293C9.05019 9.14039 9.21117 8.96283 9.42188 8.83026C9.63494 8.69531 9.89299 8.62784 10.196 8.62784C10.5038 8.62784 10.7618 8.69531 10.9702 8.83026C11.1785 8.96283 11.3359 9.14039 11.4425 9.36293C11.549 9.5831 11.6023 9.82576 11.6023 10.0909V10.4744C11.6023 10.7396 11.5478 10.9834 11.4389 11.206C11.3324 11.4261 11.1738 11.6037 10.9631 11.7386C10.7547 11.8712 10.4991 11.9375 10.196 11.9375C9.88826 11.9375 9.62902 11.8712 9.41832 11.7386C9.20762 11.6037 9.04782 11.4261 8.93892 11.206C8.83002 10.9834 8.77557 10.7396 8.77557 10.4744ZM9.5 10.0909V10.4744C9.5 10.6946 9.55208 10.8923 9.65625 11.0675C9.76042 11.2403 9.94034 11.3267 10.196 11.3267C10.4446 11.3267 10.6198 11.2403 10.7216 11.0675C10.8258 10.8923 10.8778 10.6946 10.8778 10.4744V10.0909C10.8778 9.87074 10.8281 9.67424 10.7287 9.50142C10.6293 9.32623 10.4517 9.23864 10.196 9.23864C9.94744 9.23864 9.7687 9.32623 9.6598 9.50142C9.55327 9.67424 9.5 9.87074 9.5 10.0909ZM9.04545 16L14.0455 8.72727H14.8551L9.85511 16H9.04545Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-solo.svg b/apps/web/src/assets/icons/prop-solo.svgnew file mode 100644index 00000000..7d3f4301--- /dev/null+++ b/apps/web/src/assets/icons/prop-solo.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.6695 10.5455C13.6269 10.1856 13.454 9.90625 13.151 9.70739C12.848 9.50852 12.4763 9.40909 12.036 9.40909C11.714 9.40909 11.4323 9.46117 11.1908 9.56534C10.9517 9.66951 10.7646 9.81274 10.6297 9.99503C10.4971 10.1773 10.4308 10.3845 10.4308 10.6165C10.4308 10.8106 10.477 10.9775 10.5693 11.1172C10.664 11.2545 10.7848 11.3693 10.9316 11.4616C11.0783 11.5516 11.2322 11.6262 11.3932 11.6854C11.5542 11.7422 11.7021 11.7884 11.8371 11.8239L12.5757 12.0227C12.7651 12.0724 12.9758 12.1411 13.2078 12.2287C13.4422 12.3163 13.6659 12.4358 13.879 12.5874C14.0944 12.7365 14.272 12.9283 14.4117 13.1626C14.5513 13.397 14.6212 13.6847 14.6212 14.0256C14.6212 14.4186 14.5182 14.7737 14.3122 15.0909C14.1086 15.4081 13.8103 15.6603 13.4173 15.8473C13.0267 16.0343 12.5521 16.1278 11.9933 16.1278C11.4725 16.1278 11.0215 16.0438 10.6404 15.8757C10.2616 15.7076 9.96328 15.4732 9.74547 15.1726C9.53004 14.8719 9.40811 14.5227 9.37971 14.125H10.2888C10.3125 14.3996 10.4048 14.6269 10.5658 14.8068C10.7291 14.9844 10.9351 15.117 11.1837 15.2045C11.4346 15.2898 11.7045 15.3324 11.9933 15.3324C12.3295 15.3324 12.6314 15.2779 12.8989 15.169C13.1664 15.0578 13.3783 14.9039 13.5345 14.7074C13.6908 14.5085 13.7689 14.2765 13.7689 14.0114C13.7689 13.7699 13.7014 13.5734 13.5665 13.4219C13.4316 13.2704 13.254 13.1473 13.0338 13.0526C12.8137 12.9579 12.5757 12.875 12.32 12.804L11.4252 12.5483C10.857 12.3849 10.4072 12.1518 10.0757 11.8487C9.74429 11.5457 9.57857 11.1491 9.57857 10.6591C9.57857 10.2519 9.68865 9.89678 9.90882 9.59375C10.1314 9.28835 10.4297 9.05161 10.8037 8.88352C11.1801 8.71307 11.6003 8.62784 12.0644 8.62784C12.5331 8.62784 12.9498 8.71188 13.3144 8.87997C13.6789 9.04569 13.9678 9.27296 14.1808 9.56179C14.3963 9.85062 14.5099 10.1785 14.5218 10.5455H13.6695Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-width.svg b/apps/web/src/assets/icons/prop-width.svgnew file mode 100644index 00000000..5b7dfb56--- /dev/null+++ b/apps/web/src/assets/icons/prop-width.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M9.45561 16L7.46697 8.72727H8.36186L9.88175 14.6506H9.95277L11.5011 8.72727H12.4954L14.0437 14.6506H14.1147L15.6346 8.72727H16.5295L14.5408 16H13.6317L12.0266 10.2045H11.9698L10.3647 16H9.45561Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-x-position.svg b/apps/web/src/assets/icons/prop-x-position.svgnew file mode 100644index 00000000..d6d1b60c--- /dev/null+++ b/apps/web/src/assets/icons/prop-x-position.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.0988 8.72727L11.9738 11.7528H12.0306L13.9056 8.72727H14.9426L12.6556 12.3636L14.9426 16H13.9056L12.0306 13.0312H11.9738L10.0988 16H9.06188L11.4056 12.3636L9.06188 8.72727H10.0988Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/prop-y-position.svg b/apps/web/src/assets/icons/prop-y-position.svgnew file mode 100644index 00000000..28abd44c--- /dev/null+++ b/apps/web/src/assets/icons/prop-y-position.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.93049 8.72727H9.93901L11.9561 12.1222H12.0413L14.0583 8.72727H15.0669L12.439 13.0028V16H11.5583V13.0028L8.93049 8.72727Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/quick-actions-spotlight.svg b/apps/web/src/assets/icons/quick-actions-spotlight.svgnew file mode 100644index 00000000..18d1eb9f--- /dev/null+++ b/apps/web/src/assets/icons/quick-actions-spotlight.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2330_6270)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.04545 4.75C6.22543 4.75 4.75 6.22543 4.75 8.04545C4.75 9.86549 6.22543 11.3409 8.04545 11.3409C9.86549 11.3409 11.3409 9.86549 11.3409 8.04545C11.3409 6.22543 9.86549 4.75 8.04545 4.75ZM6.06818 8.04545C6.06818 6.95343 6.95343 6.06818 8.04545 6.06818C9.13748 6.06818 10.0227 6.95343 10.0227 8.04545C10.0227 9.13748 9.13748 10.0227 8.04545 10.0227C6.95343 10.0227 6.06818 9.13748 6.06818 8.04545ZM15.9545 4.75C14.1345 4.75 12.6591 6.22543 12.6591 8.04545C12.6591 9.86549 14.1345 11.3409 15.9545 11.3409C17.7746 11.3409 19.25 9.86549 19.25 8.04545C19.25 6.22543 17.7746 4.75 15.9545 4.75ZM13.9773 8.04545C13.9773 6.95343 14.8625 6.06818 15.9545 6.06818C17.0465 6.06818 17.9318 6.95343 17.9318 8.04545C17.9318 9.13748 17.0465 10.0227 15.9545 10.0227C14.8625 10.0227 13.9773 9.13748 13.9773 8.04545ZM4.75 15.9545C4.75 14.1345 6.22543 12.6591 8.04545 12.6591C9.86549 12.6591 11.3409 14.1345 11.3409 15.9545C11.3409 17.7746 9.86549 19.25 8.04545 19.25C6.22543 19.25 4.75 17.7746 4.75 15.9545ZM8.04545 13.9773C6.95343 13.9773 6.06818 14.8625 6.06818 15.9545C6.06818 17.0465 6.95343 17.9318 8.04545 17.9318C9.13748 17.9318 10.0227 17.0465 10.0227 15.9545C10.0227 14.8625 9.13748 13.9773 8.04545 13.9773ZM15.9545 12.6591C14.1345 12.6591 12.6591 14.1345 12.6591 15.9545C12.6591 17.7746 14.1345 19.25 15.9545 19.25C17.7746 19.25 19.25 17.7746 19.25 15.9545C19.25 14.1345 17.7746 12.6591 15.9545 12.6591ZM13.9773 15.9545C13.9773 14.8625 14.8625 13.9773 15.9545 13.9773C17.0465 13.9773 17.9318 14.8625 17.9318 15.9545C17.9318 17.0465 17.0465 17.9318 15.9545 17.9318C14.8625 17.9318 13.9773 17.0465 13.9773 15.9545Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2330_6270">+<rect width="15" height="15" fill="white" transform="translate(4.5 4.5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/razor-small.svg b/apps/web/src/assets/icons/razor-small.svgnew file mode 100644index 00000000..0345d688--- /dev/null+++ b/apps/web/src/assets/icons/razor-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.1557 7.47986C18.1667 7.47993 18.9996 8.28799 19 9.30015V14.6983C19 15.7108 18.1669 16.5193 17.1557 16.5194H6.84431C5.83307 16.5193 5 15.7108 5 14.6983V9.30015C5.00038 8.288 5.8333 7.47995 6.84431 7.47986H17.1557ZM6.84431 8.36909C6.31009 8.36918 5.88961 8.79317 5.88923 9.30015V14.6983C5.88923 15.2056 6.30984 15.63 6.84431 15.6301H17.1557C17.6902 15.6301 18.1108 15.2056 18.1108 14.6983V9.30015C18.1104 8.79316 17.6899 8.36916 17.1557 8.36909H6.84431ZM15.8644 10.4543C16.0351 10.4543 16.1741 10.5928 16.1743 10.7634V13.2366C16.1741 13.4072 16.0351 13.5457 15.8644 13.5457C15.6939 13.5457 15.5556 13.4072 15.5554 13.2366V12.3094H14.1642V12.3706C14.1641 12.5413 14.025 12.6797 13.8544 12.6797C13.684 12.6794 13.5462 12.5411 13.5461 12.3706V12.3094H12.8737C12.7462 12.6693 12.4035 12.9275 12 12.9276C11.5965 12.9275 11.2546 12.6692 11.127 12.3094H10.4547V12.3706C10.4545 12.5413 10.3155 12.6797 10.1448 12.6797C9.97433 12.6795 9.83671 12.5412 9.83656 12.3706V12.3094H8.44539V13.2366C8.4452 13.4072 8.30617 13.5457 8.13555 13.5457C7.96502 13.5456 7.82669 13.4071 7.82649 13.2366V10.7634C7.82666 10.5928 7.965 10.4544 8.13555 10.4543C8.30619 10.4543 8.44523 10.5928 8.44539 10.7634V11.6913H9.83656V11.6294C9.83661 11.4588 9.97428 11.3205 10.1448 11.3203C10.3156 11.3203 10.4546 11.4587 10.4547 11.6294V11.6913H11.1263C11.2535 11.3311 11.5962 11.0725 12 11.0724C12.4038 11.0725 12.7464 11.3311 12.8737 11.6913H13.5461V11.6294C13.5461 11.4589 13.6839 11.3206 13.8544 11.3203C14.0251 11.3203 14.1642 11.4587 14.1642 11.6294V11.6913H15.5554V10.7634C15.5555 10.5928 15.6938 10.4543 15.8644 10.4543Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/razor.svg b/apps/web/src/assets/icons/razor.svgnew file mode 100644index 00000000..3073e2d5--- /dev/null+++ b/apps/web/src/assets/icons/razor.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M18.5 6.30139C19.7746 6.30148 20.8247 7.32024 20.8252 8.59631V15.402C20.8252 16.6785 19.7749 17.6978 18.5 17.6979H5.5C4.22509 17.6978 3.1748 16.6784 3.1748 15.402V8.59631C3.17528 7.32025 4.22538 6.3015 5.5 6.30139H18.5ZM5.5 7.42249C4.82648 7.4226 4.29638 7.95713 4.2959 8.59631V15.402C4.2959 16.0415 4.82618 16.5767 5.5 16.5768H18.5C19.1738 16.5767 19.7041 16.0416 19.7041 15.402V8.59631C19.7036 7.95712 19.1735 7.42258 18.5 7.42249H5.5ZM16.8721 10.0514C17.0872 10.0514 17.2625 10.226 17.2627 10.441V13.5592C17.2624 13.7743 17.0872 13.9489 16.8721 13.9489C16.657 13.9488 16.4827 13.7742 16.4824 13.5592V12.3903H14.7285V12.4674C14.7283 12.6825 14.553 12.8571 14.3379 12.8571C14.1231 12.8567 13.9494 12.6823 13.9492 12.4674V12.3903H13.1016C12.9408 12.8439 12.5087 13.1695 12 13.1696C11.4913 13.1695 11.0602 12.8438 10.8994 12.3903H10.0518V12.4674C10.0516 12.6825 9.87628 12.8571 9.66113 12.8571C9.44616 12.8569 9.27264 12.6824 9.27246 12.4674V12.3903H7.51855V13.5592C7.51831 13.7743 7.34304 13.9489 7.12793 13.9489C6.91293 13.9487 6.73853 13.7742 6.73828 13.5592V10.441C6.73849 10.226 6.9129 10.0515 7.12793 10.0514C7.34306 10.0514 7.51835 10.226 7.51855 10.441V11.611H9.27246V11.5328C9.27253 11.3178 9.44609 11.1434 9.66113 11.1432C9.87635 11.1432 10.0517 11.3176 10.0518 11.5328V11.611H10.8984C11.0589 11.1568 11.4909 10.8308 12 10.8307C12.5091 10.8307 12.941 11.1569 13.1016 11.611H13.9492V11.5328C13.9493 11.3179 14.123 11.1436 14.3379 11.1432C14.5531 11.1432 14.7284 11.3176 14.7285 11.5328V11.611H16.4824V10.441C16.4826 10.226 16.657 10.0514 16.8721 10.0514Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/record.svg b/apps/web/src/assets/icons/record.svgnew file mode 100644index 00000000..31e01165--- /dev/null+++ b/apps/web/src/assets/icons/record.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2484_171754)">+<path d="M12 5.71875C15.4688 5.71893 18.2811 8.53115 18.2812 12C18.2811 15.4687 15.4688 18.2811 12 18.2812C8.53104 18.2812 5.71893 15.4689 5.71875 12C5.71888 8.53104 8.53101 5.71875 12 5.71875ZM12 6.80469C9.13116 6.80469 6.80482 9.13119 6.80469 12C6.80486 14.8688 9.13119 17.1943 12 17.1943C14.8686 17.1942 17.1942 14.8687 17.1943 12C17.1942 9.1313 14.8686 6.80486 12 6.80469ZM12 10.0332C13.086 10.0333 13.9667 10.914 13.9668 12C13.9667 13.086 13.086 13.9667 12 13.9668C10.9139 13.9668 10.0333 13.0861 10.0332 12C10.0333 10.914 10.9139 10.0332 12 10.0332Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2484_171754">+<rect width="14" height="14" fill="white" transform="translate(5 5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/rectangle-small.svg b/apps/web/src/assets/icons/rectangle-small.svgnew file mode 100644index 00000000..007e478b--- /dev/null+++ b/apps/web/src/assets/icons/rectangle-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.5 6.5C17.0523 6.5 17.5 6.94772 17.5 7.5V16.5C17.5 17.0523 17.0523 17.5 16.5 17.5H7.5C6.94772 17.5 6.5 17.0523 6.5 16.5V7.5C6.5 6.94772 6.94772 6.5 7.5 6.5H16.5ZM7.5 16.5H16.5V7.5H7.5V16.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/replace.svg b/apps/web/src/assets/icons/replace.svgnew file mode 100644index 00000000..e0f870da--- /dev/null+++ b/apps/web/src/assets/icons/replace.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.36914 11.8306C7.36914 14.3689 9.20954 16.098 11.2762 16.4559C11.5127 16.4968 11.6712 16.7217 11.6302 16.9582C11.5893 17.1947 11.3644 17.3532 11.1279 17.3123C8.70009 16.8919 6.5 14.8456 6.5 11.8306C6.5 10.5493 7.08294 9.54232 7.76369 8.77631C8.25135 8.22759 8.80925 7.78206 9.25795 7.44075H7.89348C7.66323 7.44075 7.47657 7.25409 7.47657 7.02384C7.47657 6.79359 7.66323 6.60693 7.89348 6.60693H10.3949C10.6252 6.60693 10.8118 6.79359 10.8118 7.02384V9.52529C10.8118 9.75554 10.6252 9.9422 10.3949 9.9422C10.1647 9.9422 9.97802 9.75554 9.97802 9.52529V7.98642L9.97676 7.98737C9.50026 8.34676 8.91786 8.78599 8.41336 9.35367C7.81758 10.0241 7.36914 10.834 7.36914 11.8306ZM16.6309 12.1695C16.6309 9.65797 14.8295 7.93902 12.7895 7.55604C12.5536 7.51176 12.3983 7.28463 12.4425 7.04874C12.4868 6.81285 12.7139 6.65753 12.9498 6.70181C15.3464 7.15174 17.5 9.18678 17.5 12.1695C17.5 13.4508 16.9171 14.4577 16.2364 15.2237C15.7487 15.7725 15.1907 16.218 14.7421 16.5593H16.1066C16.3368 16.5593 16.5235 16.746 16.5235 16.9763C16.5235 17.2065 16.3368 17.3932 16.1066 17.3932H13.6051C13.3749 17.3932 13.1882 17.2065 13.1882 16.9763V14.4748C13.1882 14.2445 13.3749 14.0579 13.6051 14.0579C13.8354 14.0579 14.022 14.2445 14.022 14.4748V16.0136L14.0233 16.0126C14.4998 15.6532 15.0822 15.2141 15.5866 14.6464C16.1825 13.976 16.6309 13.1661 16.6309 12.1695Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/rerun.svg b/apps/web/src/assets/icons/rerun.svgnew file mode 100644index 00000000..9f473bf3--- /dev/null+++ b/apps/web/src/assets/icons/rerun.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.21833 7.96204C9.13313 5.6957 12.4513 5.05351 15.1112 6.58913C18.1001 8.31485 19.1243 12.1362 17.3987 15.1252C15.6729 18.114 11.8506 19.1384 8.8617 17.4128C7.33178 16.5293 6.31619 15.0955 5.92148 13.5072C5.85747 13.2496 6.0151 12.9891 6.27269 12.925C6.5303 12.8612 6.79091 13.0177 6.85491 13.2753C7.18929 14.6208 8.04773 15.8332 9.3425 16.5808C11.8715 18.0409 15.1055 17.1733 16.5658 14.6444C18.0259 12.1153 17.1594 8.88134 14.6304 7.42114C12.3134 6.08375 9.40518 6.69928 7.81088 8.75649L9.41387 8.61751C9.6784 8.59437 9.91285 8.79059 9.93599 9.05512C9.9589 9.31938 9.76262 9.553 9.49838 9.5763L6.9892 9.7951C6.67401 9.82255 6.39609 9.58912 6.36848 9.27392L6.14873 6.76567C6.12559 6.50115 6.32181 6.26764 6.58634 6.24449C6.85079 6.22146 7.08344 6.41763 7.10658 6.6821L7.21833 7.96204Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/resize-ew-cursor.svg b/apps/web/src/assets/icons/resize-ew-cursor.svgnew file mode 100644index 00000000..8f0efd1d--- /dev/null+++ b/apps/web/src/assets/icons/resize-ew-cursor.svg@@ -0,0 +1,17 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g filter="url(#filter0_d_2_289)">+<path d="M5.41 12L9 8.41V11H15V8.42L18.58 12L15 15.59V13H9V15.59L5.41 12ZM4 12L10 18V14H14V18L20 12L14 6V10H10V6L4 12Z" fill="white"/>+<path d="M12.5 13H15.02V15.59L18.58 12L15.02 8.42001V11.02H12.5H9V8.42001L5.41 12L9 15.59V13H12.5Z" fill="black"/>+</g>+<defs>+<filter id="filter0_d_2_289" x="2.2" y="5.2" width="19.6" height="15.6" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dy="1"/>+<feGaussianBlur stdDeviation="0.9"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2_289"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2_289" result="shape"/>+</filter>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/resize-nesw-cursor.svg b/apps/web/src/assets/icons/resize-nesw-cursor.svgnew file mode 100644index 00000000..7951dd8b--- /dev/null+++ b/apps/web/src/assets/icons/resize-nesw-cursor.svg@@ -0,0 +1,17 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g filter="url(#filter0_d_2_292)">+<path d="M14.73 12.07L10.66 16.14L13.49 18.97L5.01 18.95L5 10.48L7.84 13.32L11.92 9.26L13.33 7.84L10.49 5H18.97V13.48L16.14 10.66L14.73 12.07Z" fill="white"/>+<path d="M13.67 11.72L9.24 16.14L11.07 17.97L6.01 17.95L6 12.9L7.84 14.74L12.27 10.32L14.74 7.84L12.9 6H17.97V11.07L16.14 9.24L13.67 11.72Z" fill="black"/>+</g>+<defs>+<filter id="filter0_d_2_292" x="3.2" y="4.2" width="17.57" height="17.57" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dy="1"/>+<feGaussianBlur stdDeviation="0.9"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2_292"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2_292" result="shape"/>+</filter>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/resolution.svg b/apps/web/src/assets/icons/resolution.svgnew file mode 100644index 00000000..bf81118b--- /dev/null+++ b/apps/web/src/assets/icons/resolution.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5535 6C15.9265 6.00015 16.2682 6.20807 16.4402 6.53906L18.4431 10.3945C18.5379 10.577 18.5119 10.7992 18.3767 10.9541L12.3767 17.8291C12.2818 17.9378 12.1441 18 11.9998 18C11.8554 18 11.7178 17.9378 11.6228 17.8291L5.62282 10.9541C5.48763 10.7992 5.46163 10.577 5.55642 10.3945L7.55935 6.53906C7.73138 6.20806 8.07303 6.0001 8.44607 6H15.5535ZM11.9998 16.0371L13.7859 11.125H10.2136L11.9998 16.0371ZM10.6131 15.1504L9.15017 11.125H7.10036L10.6131 15.1504ZM13.3855 15.1504L16.8992 11.125H14.8494L13.3855 15.1504ZM6.82302 10.125H9.12575L10.0457 7H8.44607L6.82302 10.125ZM10.1677 10.125H13.8318L12.9109 7H11.0886L10.1677 10.125ZM14.8738 10.125H17.1765L15.5535 7H13.9539L14.8738 10.125Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/reuse-settings.svg b/apps/web/src/assets/icons/reuse-settings.svgnew file mode 100644index 00000000..8f60edf1--- /dev/null+++ b/apps/web/src/assets/icons/reuse-settings.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 5.25C15.7279 5.25 18.75 8.27208 18.75 12C18.75 15.7279 15.7279 18.75 12 18.75C8.27208 18.75 5.25 15.7279 5.25 12C5.25 8.27208 8.27208 5.25 12 5.25ZM12 6.25C8.82436 6.25 6.25 8.82436 6.25 12C6.25 15.1756 8.82436 17.75 12 17.75C15.1756 17.75 17.75 15.1756 17.75 12C17.75 8.82436 15.1756 6.25 12 6.25ZM12.0029 9C12.1346 9 12.2614 9.05272 12.3545 9.14648C12.4476 9.24025 12.5 9.3674 12.5 9.5L12.4971 11.5039L14.501 11.5068C14.6334 11.507 14.7608 11.5593 14.8545 11.6523C14.948 11.7454 15.0009 11.8715 15.001 12.0029C15.001 12.1346 14.9482 12.2614 14.8545 12.3545C14.7608 12.4475 14.6334 12.4999 14.501 12.5L12.4951 12.4971L12.4932 14.5C12.4932 14.6326 12.4408 14.7598 12.3477 14.8535C12.2545 14.9473 12.1278 15 11.9961 15C11.8646 14.9999 11.7385 14.9472 11.6455 14.8535C11.5524 14.7597 11.5 14.6326 11.5 14.5L11.502 12.4951L9.50098 12.4932C9.36851 12.4932 9.2412 12.4406 9.14746 12.3477C9.05369 12.2545 9.00098 12.1278 9.00098 11.9961C9.00106 11.8645 9.05377 11.7386 9.14746 11.6455C9.24122 11.5525 9.36843 11.5 9.50098 11.5L11.5039 11.502L11.5068 9.5C11.5068 9.36739 11.5592 9.24025 11.6523 9.14648C11.7454 9.05285 11.8714 9.00011 12.0029 9Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/rotate-90.svg b/apps/web/src/assets/icons/rotate-90.svgnew file mode 100644index 00000000..1b31ad7c--- /dev/null+++ b/apps/web/src/assets/icons/rotate-90.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2202_171165)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.0966 7.43622C12.2608 7.56395 12.5001 7.44692 12.5001 7.23889V6.49992C14.4814 6.49994 15.6848 6.86364 16.4105 7.58939C17.1363 8.31516 17.5 9.51854 17.5 11.4999C17.5 11.7761 17.7239 11.9999 18 11.9999C18.2761 11.9999 18.5 11.7761 18.5 11.4999C18.5 9.44374 18.1325 7.89713 17.1176 6.88228C16.1028 5.86746 14.5562 5.49994 12.5001 5.49992V4.7612C12.5001 4.55317 12.2608 4.43614 12.0966 4.56387L10.5038 5.80271C10.3752 5.9028 10.3752 6.09729 10.5038 6.19738L12.0966 7.43622ZM14 9.49994H7C6.72386 9.49994 6.5 9.7238 6.5 9.99994V16.9999C6.5 17.276 6.72386 17.4999 7 17.4999H14C14.2761 17.4999 14.5 17.276 14.5 16.9999V9.99994C14.5 9.7238 14.2761 9.49994 14 9.49994ZM7 8.49994C6.17157 8.49994 5.5 9.17151 5.5 9.99994V16.9999C5.5 17.8283 6.17157 18.4999 7 18.4999H14C14.8284 18.4999 15.5 17.8283 15.5 16.9999V9.99994C15.5 9.17151 14.8284 8.49994 14 8.49994H7Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2202_171165">+<rect width="15" height="15" fill="white" transform="translate(4.5 4.5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/rotate-angle.svg b/apps/web/src/assets/icons/rotate-angle.svgnew file mode 100644index 00000000..b6b22d39--- /dev/null+++ b/apps/web/src/assets/icons/rotate-angle.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.9274 8.46239C13.077 8.56968 13.1113 8.77793 13.004 8.92753L8.64909 14.9999H15.9998C16.1839 14.9999 16.3332 15.1492 16.3332 15.3333C16.3332 15.5174 16.1839 15.6666 15.9998 15.6666H7.99984C7.87486 15.6666 7.76038 15.5967 7.7033 15.4855C7.64622 15.3743 7.65613 15.2406 7.72896 15.139L12.4623 8.539C12.5696 8.3894 12.7778 8.3551 12.9274 8.46239ZM14.3998 11.3333C14.3998 11.1492 14.549 10.9999 14.7332 10.9999C14.9172 10.9999 15.0665 11.1492 15.0665 11.3333C15.0665 11.5174 14.9172 11.6666 14.7332 11.6666C14.549 11.6666 14.3998 11.5174 14.3998 11.3333ZM13.9332 9.66659C13.7491 9.66659 13.5999 9.81583 13.5999 9.99993C13.5999 10.184 13.7491 10.3333 13.9332 10.3333C14.1173 10.3333 14.2665 10.184 14.2665 9.99993C14.2665 9.81583 14.1173 9.66659 13.9332 9.66659ZM15.0665 12.6666C15.0665 12.4825 15.2157 12.3333 15.3998 12.3333C15.5839 12.3333 15.7332 12.4825 15.7332 12.6666C15.7332 12.8507 15.5839 12.9999 15.3998 12.9999C15.2157 12.9999 15.0665 12.8507 15.0665 12.6666ZM15.9332 13.6666C15.7491 13.6666 15.5998 13.8159 15.5998 13.9999C15.5998 14.184 15.7491 14.3333 15.9332 14.3333C16.1173 14.3333 16.2665 14.184 16.2665 13.9999C16.2665 13.8159 16.1173 13.6666 15.9332 13.6666Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/rotation-cursor.svg b/apps/web/src/assets/icons/rotation-cursor.svgnew file mode 100644index 00000000..2eba5bc9--- /dev/null+++ b/apps/web/src/assets/icons/rotation-cursor.svg@@ -0,0 +1,23 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_434_6)">+<g filter="url(#filter0_d_434_6)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M3.55 7.99999L7 4.53589L7 6.99999C8.31323 6.99999 9.61359 7.25866 10.8268 7.76119C12.0401 8.26375 13.1425 9.00033 14.0711 9.92892C14.9997 10.8575 15.7362 11.9599 16.2388 13.1731C16.7413 14.3864 17 15.6868 17 17H15C15 15.9494 14.7931 14.9091 14.391 13.9385C13.989 12.9679 13.3997 12.086 12.6569 11.3431C11.914 10.6003 11.0321 10.011 10.0615 9.60897C9.09085 9.20693 8.05057 8.99999 7 8.99999L7 11.4641L3.55 7.99999ZM12.5359 17L16 20.45L19.4641 17H12.5359Z" fill="black"/>+<path d="M3.1603 7.61188L2.77377 7.99999L3.1603 8.38811L6.6103 11.8522L7.55 12.7958L7.55 11.4641L7.55 9.57032C8.34004 9.62881 9.11691 9.81304 9.85099 10.1171L9.851 10.1171C10.7549 10.4915 11.5761 11.0402 12.2679 11.732C12.9597 12.4239 13.5085 13.2451 13.8829 14.149L13.8829 14.149C14.187 14.8831 14.3712 15.66 14.4297 16.45H12.5359H11.2042L12.1478 17.3897L15.6119 20.8397L16 21.2262L16.3881 20.8397L19.8522 17.3897L20.7958 16.45H19.4641H17.5357C17.4731 15.2525 17.2068 14.073 16.7469 12.9627L16.7469 12.9627C16.2167 11.6827 15.4396 10.5197 14.46 9.54001C13.4803 8.56034 12.3173 7.78326 11.0373 7.25306L11.0373 7.25305C9.92699 6.79315 8.74751 6.52685 7.55 6.46434L7.55 4.53589L7.55 3.20423L6.6103 4.14777L3.1603 7.61188Z" stroke="white" stroke-width="1.1"/>+</g>+</g>+<defs>+<filter id="filter0_d_434_6" x="0.197528" y="1.07256" width="23.7299" height="23.7299" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>+<feOffset dy="1"/>+<feGaussianBlur stdDeviation="0.9"/>+<feComposite in2="hardAlpha" operator="out"/>+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"/>+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_434_6"/>+<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_434_6" result="shape"/>+</filter>+<clipPath id="clip0_434_6">+<rect width="24" height="24" fill="white"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/scale-individual-axes.svg b/apps/web/src/assets/icons/scale-individual-axes.svgnew file mode 100644index 00000000..00b31f77--- /dev/null+++ b/apps/web/src/assets/icons/scale-individual-axes.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.0469 13.4219C10.1933 13.2754 10.4317 13.2754 10.5781 13.4219C10.7246 13.5683 10.7246 13.8067 10.5781 13.9531L8.40625 16.125H10.3125C10.5196 16.125 10.6875 16.2929 10.6875 16.5C10.6875 16.7071 10.5196 16.875 10.3125 16.875H7.5C7.29289 16.875 7.125 16.7071 7.125 16.5V13.6875C7.125 13.4804 7.29289 13.3125 7.5 13.3125C7.70711 13.3125 7.875 13.4804 7.875 13.6875V15.5938L10.0469 13.4219ZM16.5 13.3125C16.7071 13.3125 16.875 13.4804 16.875 13.6875V16.5C16.875 16.7071 16.7071 16.875 16.5 16.875H13.6875C13.4804 16.875 13.3125 16.7071 13.3125 16.5C13.3125 16.2929 13.4804 16.125 13.6875 16.125H15.5938L13.4219 13.9531C13.2754 13.8067 13.2754 13.5683 13.4219 13.4219C13.5683 13.2754 13.8067 13.2754 13.9531 13.4219L16.125 15.5938V13.6875C16.125 13.4804 16.2929 13.3125 16.5 13.3125ZM10.3125 7.125C10.5196 7.125 10.6875 7.29289 10.6875 7.5C10.6875 7.70711 10.5196 7.875 10.3125 7.875H8.40625L10.5781 10.0469C10.7246 10.1933 10.7246 10.4317 10.5781 10.5781C10.4317 10.7246 10.1933 10.7246 10.0469 10.5781L7.875 8.40625V10.3125C7.875 10.5196 7.70711 10.6875 7.5 10.6875C7.29289 10.6875 7.125 10.5196 7.125 10.3125V7.5C7.125 7.29289 7.29289 7.125 7.5 7.125H10.3125ZM16.5 7.125C16.7071 7.125 16.875 7.29289 16.875 7.5V10.3125C16.875 10.5196 16.7071 10.6875 16.5 10.6875C16.2929 10.6875 16.125 10.5196 16.125 10.3125V8.40625L13.9531 10.5781C13.8067 10.7246 13.5683 10.7246 13.4219 10.5781C13.2754 10.4317 13.2754 10.1933 13.4219 10.0469L15.5938 7.875H13.6875C13.4804 7.875 13.3125 7.70711 13.3125 7.5C13.3125 7.29289 13.4804 7.125 13.6875 7.125H16.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/scale-size.svg b/apps/web/src/assets/icons/scale-size.svgnew file mode 100644index 00000000..033985ed--- /dev/null+++ b/apps/web/src/assets/icons/scale-size.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.5 10.0996C13.7209 10.0996 13.9004 10.2791 13.9004 10.5V12.6875C13.9004 12.9084 13.7209 13.0879 13.5 13.0879C13.2791 13.0879 13.0996 12.9084 13.0996 12.6875V11.4668L11.3525 13.2129C11.383 13.3032 11.4004 13.3995 11.4004 13.5V16.5C11.4004 16.9971 10.9971 17.4004 10.5 17.4004H7.5C7.00294 17.4004 6.59961 16.9971 6.59961 16.5V13.5C6.59961 13.0029 7.00294 12.5996 7.5 12.5996H10.5C10.6001 12.5996 10.6962 12.6163 10.7861 12.6465L12.5332 10.9004H11.3125C11.0916 10.9004 10.9121 10.7209 10.9121 10.5C10.9121 10.2791 11.0916 10.0996 11.3125 10.0996H13.5ZM14.25 16.5996C14.4709 16.5996 14.6504 16.7791 14.6504 17C14.6504 17.2209 14.4709 17.4004 14.25 17.4004H13.5C13.2791 17.4004 13.0996 17.2209 13.0996 17C13.0996 16.7791 13.2791 16.5996 13.5 16.5996H14.25ZM17 14.9746C17.2209 14.9746 17.4004 15.1541 17.4004 15.375V16.5C17.4004 16.9971 16.9971 17.4004 16.5 17.4004H15.75C15.5291 17.4004 15.3496 17.2209 15.3496 17C15.3496 16.7791 15.5291 16.5996 15.75 16.5996H16.5C16.5552 16.5996 16.5996 16.5552 16.5996 16.5V15.375C16.5996 15.1541 16.7791 14.9746 17 14.9746ZM7.5 13.4004C7.44477 13.4004 7.40039 13.4448 7.40039 13.5V16.5C7.40039 16.5552 7.44477 16.5996 7.5 16.5996H10.5C10.5552 16.5996 10.5996 16.5552 10.5996 16.5V13.5C10.5996 13.4448 10.5552 13.4004 10.5 13.4004H7.5ZM17 10.4746C17.2209 10.4746 17.4004 10.6541 17.4004 10.875V13.125C17.4004 13.3459 17.2209 13.5254 17 13.5254C16.7791 13.5254 16.5996 13.3459 16.5996 13.125V10.875C16.5996 10.6541 16.7791 10.4746 17 10.4746ZM7 9.34961C7.22091 9.34961 7.40039 9.52909 7.40039 9.75V10.5C7.40039 10.7209 7.22091 10.9004 7 10.9004C6.77909 10.9004 6.59961 10.7209 6.59961 10.5V9.75C6.59961 9.52909 6.77909 9.34961 7 9.34961ZM16.5 6.59961C16.9971 6.59961 17.4004 7.00294 17.4004 7.5V8.625C17.4004 8.84591 17.2209 9.02539 17 9.02539C16.7791 9.02539 16.5996 8.84591 16.5996 8.625V7.5C16.5996 7.44477 16.5552 7.40039 16.5 7.40039H15.375C15.1541 7.40039 14.9746 7.22091 14.9746 7C14.9746 6.77909 15.1541 6.59961 15.375 6.59961H16.5ZM8.625 6.59961C8.84591 6.59961 9.02539 6.77909 9.02539 7C9.02539 7.22091 8.84591 7.40039 8.625 7.40039H7.5C7.44477 7.40039 7.40039 7.44477 7.40039 7.5V8.25C7.40039 8.47091 7.22091 8.65039 7 8.65039C6.77909 8.65039 6.59961 8.47091 6.59961 8.25V7.5C6.59961 7.00294 7.00294 6.59961 7.5 6.59961H8.625ZM13.125 6.59961C13.3459 6.59961 13.5254 6.77909 13.5254 7C13.5254 7.22091 13.3459 7.40039 13.125 7.40039H10.875C10.6541 7.40039 10.4746 7.22091 10.4746 7C10.4746 6.77909 10.6541 6.59961 10.875 6.59961H13.125Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/scene-frame-small.svg b/apps/web/src/assets/icons/scene-frame-small.svgnew file mode 100644index 00000000..de629bf4--- /dev/null+++ b/apps/web/src/assets/icons/scene-frame-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.5 6.5C14.7761 6.5 15 6.72386 15 7V9H17C17.2761 9 17.5 9.22386 17.5 9.5C17.5 9.77614 17.2761 10 17 10H15V14H17C17.2761 14 17.5 14.2239 17.5 14.5C17.5 14.7761 17.2761 15 17 15H15V17C15 17.2761 14.7761 17.5 14.5 17.5C14.2239 17.5 14 17.2761 14 17V15H10V17C10 17.2761 9.77614 17.5 9.5 17.5C9.22386 17.5 9 17.2761 9 17V15H7C6.72386 15 6.5 14.7761 6.5 14.5C6.5 14.2239 6.72386 14 7 14H9V10H7C6.72386 10 6.5 9.77614 6.5 9.5C6.5 9.22386 6.72386 9 7 9H9V7C9 6.72386 9.22386 6.5 9.5 6.5C9.77614 6.5 10 6.72386 10 7V9H14V7C14 6.72386 14.2239 6.5 14.5 6.5ZM10 10V14H14V10H10Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/search.svg b/apps/web/src/assets/icons/search.svgnew file mode 100644index 00000000..acdaebf0--- /dev/null+++ b/apps/web/src/assets/icons/search.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M14.6735 10.9399C14.6735 13.0018 13.002 14.6732 10.9401 14.6732C8.87827 14.6732 7.2068 13.0018 7.2068 10.9399C7.2068 8.87803 8.87827 7.20656 10.9401 7.20656C13.002 7.20656 14.6735 8.87803 14.6735 10.9399ZM13.9362 14.6902C13.1151 15.3471 12.0735 15.7399 10.9401 15.7399C8.28917 15.7399 6.14014 13.5909 6.14014 10.9399C6.14014 8.28893 8.28917 6.13989 10.9401 6.13989C13.5911 6.13989 15.7401 8.28893 15.7401 10.9399C15.7401 12.0732 15.3474 13.1148 14.6904 13.936L17.7173 16.9627C17.9255 17.171 17.9255 17.5087 17.7173 17.7171C17.509 17.9253 17.1713 17.9253 16.963 17.7171L13.9362 14.6902Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/sequence.svg b/apps/web/src/assets/icons/sequence.svgnew file mode 100644index 00000000..d0418160--- /dev/null+++ b/apps/web/src/assets/icons/sequence.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7 14.875C7.27614 14.875 7.5 15.0989 7.5 15.375V16.5H8.25C8.52614 16.5 8.75 16.7239 8.75 17C8.75 17.2761 8.52614 17.5 8.25 17.5H7.5C6.94772 17.5 6.5 17.0523 6.5 16.5V15.375C6.5 15.0989 6.72386 14.875 7 14.875ZM11 14.875C11.2761 14.875 11.5 15.0989 11.5 15.375V16.5C11.5 17.0523 11.0523 17.5 10.5 17.5H9.75C9.47386 17.5 9.25 17.2761 9.25 17C9.25 16.7239 9.47386 16.5 9.75 16.5H10.5V15.375C10.5 15.0989 10.7239 14.875 11 14.875ZM13 14.875C13.2761 14.875 13.5 15.0989 13.5 15.375V16.5H14.25C14.5261 16.5 14.75 16.7239 14.75 17C14.75 17.2761 14.5261 17.5 14.25 17.5H13.5C12.9477 17.5 12.5 17.0523 12.5 16.5V15.375C12.5 15.0989 12.7239 14.875 13 14.875ZM17 14.875C17.2761 14.875 17.5 15.0989 17.5 15.375V16.5C17.5 17.0523 17.0523 17.5 16.5 17.5H15.75C15.4739 17.5 15.25 17.2761 15.25 17C15.25 16.7239 15.4739 16.5 15.75 16.5H16.5V15.375C16.5 15.0989 16.7239 14.875 17 14.875ZM7 10.375C7.27614 10.375 7.5 10.5989 7.5 10.875V13.125C7.5 13.4011 7.27614 13.625 7 13.625C6.72386 13.625 6.5 13.4011 6.5 13.125V10.875C6.5 10.5989 6.72386 10.375 7 10.375ZM11 10.375C11.2761 10.375 11.5 10.5989 11.5 10.875V13.125C11.5 13.4011 11.2761 13.625 11 13.625C10.7239 13.625 10.5 13.4011 10.5 13.125V10.875C10.5 10.5989 10.7239 10.375 11 10.375ZM13 10.375C13.2761 10.375 13.5 10.5989 13.5 10.875V13.125C13.5 13.4011 13.2761 13.625 13 13.625C12.7239 13.625 12.5 13.4011 12.5 13.125V10.875C12.5 10.5989 12.7239 10.375 13 10.375ZM17 10.375C17.2761 10.375 17.5 10.5989 17.5 10.875V13.125C17.5 13.4011 17.2761 13.625 17 13.625C16.7239 13.625 16.5 13.4011 16.5 13.125V10.875C16.5 10.5989 16.7239 10.375 17 10.375ZM8.25 6.5C8.52614 6.5 8.75 6.72386 8.75 7C8.75 7.27614 8.52614 7.5 8.25 7.5H7.5V8.625C7.5 8.90114 7.27614 9.125 7 9.125C6.72386 9.125 6.5 8.90114 6.5 8.625V7.5C6.5 6.94772 6.94772 6.5 7.5 6.5H8.25ZM10.5 6.5C11.0523 6.5 11.5 6.94772 11.5 7.5V8.625C11.5 8.90114 11.2761 9.125 11 9.125C10.7239 9.125 10.5 8.90114 10.5 8.625V7.5H9.75C9.47386 7.5 9.25 7.27614 9.25 7C9.25 6.72386 9.47386 6.5 9.75 6.5H10.5ZM14.25 6.5C14.5261 6.5 14.75 6.72386 14.75 7C14.75 7.27614 14.5261 7.5 14.25 7.5H13.5V8.625C13.5 8.90114 13.2761 9.125 13 9.125C12.7239 9.125 12.5 8.90114 12.5 8.625V7.5C12.5 6.94772 12.9477 6.5 13.5 6.5H14.25ZM16.5 6.5C17.0523 6.5 17.5 6.94772 17.5 7.5V8.625C17.5 8.90114 17.2761 9.125 17 9.125C16.7239 9.125 16.5 8.90114 16.5 8.625V7.5H15.75C15.4739 7.5 15.25 7.27614 15.25 7C15.25 6.72386 15.4739 6.5 15.75 6.5H16.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/settings.svg b/apps/web/src/assets/icons/settings.svgnew file mode 100644index 00000000..73069662--- /dev/null+++ b/apps/web/src/assets/icons/settings.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2362_268505)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5993 5.60669C11.2287 5.60669 10.9075 5.86322 10.8256 6.22462L10.6034 7.20477C10.2497 7.30764 9.91222 7.44852 9.59583 7.62259L8.74555 7.08659C8.43207 6.88899 8.02355 6.93471 7.76152 7.19674L7.19583 7.76243C6.93381 8.02445 6.88808 8.43297 7.08569 8.74645L7.62188 9.59704C7.44796 9.91333 7.30721 10.2507 7.20444 10.6043L6.22437 10.8265C5.86298 10.9084 5.60645 11.2296 5.60645 11.6002V12.4002C5.60645 12.7707 5.86298 13.0919 6.22437 13.1739L7.20455 13.3961C7.30739 13.7498 7.44822 14.0872 7.62223 14.4036L7.08613 15.2541C6.88851 15.5675 6.93425 15.976 7.19627 16.2381L7.76197 16.8038C8.02399 17.0657 8.43251 17.1115 8.74599 16.9139L9.59648 16.3778C9.91267 16.5517 10.2499 16.6924 10.6034 16.7952L10.8256 17.7754C10.9075 18.1367 11.2287 18.3933 11.5993 18.3933H12.3993C12.7699 18.3933 13.0911 18.1367 13.173 17.7754L13.3951 16.7955C13.7489 16.6928 14.0864 16.5519 14.4029 16.378L15.2534 16.9141C15.5668 17.1117 15.9753 17.0659 16.2374 16.8039L16.8031 16.2383C17.0651 15.9762 17.1108 15.5677 16.9132 15.2542L16.3773 14.4041C16.5514 14.0876 16.6924 13.7499 16.7952 13.396L17.7751 13.1739C18.1365 13.0919 18.3931 12.7707 18.3931 12.4002V11.6002C18.3931 11.2296 18.1365 10.9084 17.7751 10.8265L16.7953 10.6044C16.6926 10.2505 16.5517 9.913 16.3776 9.59653L16.9136 8.74627C17.1112 8.43279 17.0655 8.02427 16.8034 7.76223L16.2377 7.19655C15.9758 6.93453 15.5672 6.88879 15.2537 7.08641L14.4036 7.62236C14.0869 7.4482 13.7492 7.30727 13.3951 7.20442L13.173 6.22462C13.0911 5.86322 12.7699 5.60669 12.3993 5.60669H11.5993ZM9.59225 8.55814C10.0838 8.21363 10.6526 7.97176 11.2675 7.86363L11.5993 6.40002H12.3993L12.7311 7.86342C13.3462 7.97141 13.9153 8.21329 14.4072 8.55789L15.6768 7.75752L16.2425 8.3232L15.4421 9.59289C15.7866 10.0846 16.0284 10.6535 16.1364 11.2684L17.5998 11.6002V12.4002L16.1363 12.7319C16.0282 13.347 15.7863 13.9159 15.4417 14.4076L16.242 15.6773L15.6763 16.2429L14.4065 15.4425C13.9149 15.7869 13.346 16.0286 12.7311 16.1366L12.3993 17.6H11.5993L11.2675 16.1363C10.6529 16.0283 10.0843 15.7865 9.59284 15.4422L8.32294 16.2427L7.75724 15.677L8.55774 14.4072C8.21332 13.9156 7.97152 13.3468 7.86346 12.732L6.39977 12.4002V11.6002L7.86339 11.2684C7.97138 10.6536 8.21306 10.0849 8.55735 9.59334L7.7568 8.3234L8.3225 7.75772L9.59225 8.55814ZM13.4231 11.9999C13.4231 12.7859 12.7858 13.4231 11.9998 13.4231C11.2138 13.4231 10.5765 12.7859 10.5765 11.9999C10.5765 11.2138 11.2138 10.5766 11.9998 10.5766C12.7858 10.5766 13.4231 11.2138 13.4231 11.9999ZM14.2631 11.9999C14.2631 13.2498 13.2498 14.2631 11.9998 14.2631C10.7498 14.2631 9.73654 13.2498 9.73654 11.9999C9.73654 10.7499 10.7498 9.73662 11.9998 9.73662C13.2498 9.73662 14.2631 10.7499 14.2631 11.9999Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2362_268505">+<rect width="14" height="14" fill="white" transform="translate(5 5)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/shapes.svg b/apps/web/src/assets/icons/shapes.svgnew file mode 100644index 00000000..865e3ac0--- /dev/null+++ b/apps/web/src/assets/icons/shapes.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.56263 3.62523C6.56644 3.62411 5.60686 4.00065 4.87728 4.67896C4.1477 5.35727 3.70237 6.28692 3.63104 7.28055C3.5597 8.27418 3.86767 9.25792 4.49288 10.0335C5.11808 10.8091 6.01403 11.3188 7.00016 11.46V12.5939C6.05264 12.488 5.15428 12.1168 4.40846 11.5228C3.66265 10.9289 3.09969 10.1364 2.78439 9.23667C2.46909 8.3369 2.41425 7.36639 2.62619 6.43683C2.83814 5.50727 3.30825 4.65644 3.98241 3.98227C4.65658 3.30811 5.5074 2.838 6.43696 2.62606C7.36652 2.41411 8.33704 2.46895 9.23681 2.78425C10.1366 3.09955 10.929 3.66251 11.523 4.40833C12.1169 5.15414 12.4882 6.05251 12.5941 7.00002H11.4601C11.3247 6.06292 10.8562 5.20597 10.1404 4.58618C9.42461 3.96638 8.50947 3.62524 7.56263 3.62523ZM10.1875 7.74998C9.86739 7.74998 9.55044 7.81302 9.25473 7.93551C8.95902 8.058 8.69033 8.23753 8.464 8.46386C8.23767 8.69019 8.05814 8.95888 7.93565 9.25459C7.81316 9.55031 7.75011 9.86725 7.75011 10.1873V15.062C7.75011 15.3821 7.81316 15.699 7.93565 15.9948C8.05814 16.2905 8.23767 16.5592 8.464 16.7855C8.69033 17.0118 8.95902 17.1914 9.25473 17.3138C9.55044 17.4363 9.86739 17.4994 10.1875 17.4994H15.0622C15.3822 17.4994 15.6992 17.4363 15.9949 17.3138C16.2906 17.1914 16.5593 17.0118 16.7856 16.7855C17.012 16.5592 17.1915 16.2905 17.314 15.9948C17.4365 15.699 17.4995 15.3821 17.4995 15.062V10.1873C17.4995 9.86725 17.4365 9.55031 17.314 9.25459C17.1915 8.95888 17.012 8.69019 16.7856 8.46386C16.5593 8.23753 16.2906 8.058 15.9949 7.93551C15.6992 7.81302 15.3822 7.74998 15.0622 7.74998H10.1875ZM8.87505 10.1873C8.87505 9.46287 9.46301 8.87491 10.1875 8.87491H15.0622C15.7866 8.87491 16.3746 9.46287 16.3746 10.1873V15.062C16.3746 15.4101 16.2363 15.7439 15.9902 15.99C15.7441 16.2362 15.4102 16.3744 15.0622 16.3744H10.1875C9.83939 16.3744 9.50557 16.2362 9.25944 15.99C9.01332 15.7439 8.87505 15.4101 8.87505 15.062V10.1873Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/sidebar-right.svg b/apps/web/src/assets/icons/sidebar-right.svgnew file mode 100644index 00000000..e0e94900--- /dev/null+++ b/apps/web/src/assets/icons/sidebar-right.svg@@ -0,0 +1,3 @@+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M18.0713 6.54004C18.584 6.54004 18.9999 6.95602 19 7.46875V16.5254C19 17.0382 18.5841 17.4541 18.0713 17.4541H5.92871L5.83398 17.4492C5.36562 17.4018 5 17.0063 5 16.5254V7.46875C5.00014 6.98796 5.36567 6.59231 5.83398 6.54492L5.92871 6.54004H18.0713ZM15 16.5254H18.0713V7.46875H15V16.5254ZM5.92871 16.5254H14V7.46875H5.92871V16.5254Z" fill="#9E9E9E"/>+</svg>diff --git a/apps/web/src/assets/icons/sidebar-timeline.svg b/apps/web/src/assets/icons/sidebar-timeline.svgnew file mode 100644index 00000000..3009ceb0--- /dev/null+++ b/apps/web/src/assets/icons/sidebar-timeline.svg@@ -0,0 +1,3 @@+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M18.0713 6.54004C18.584 6.54004 18.9999 6.95602 19 7.46875V16.5254C19 17.0382 18.5841 17.4541 18.0713 17.4541H5.92871L5.83398 17.4492C5.36562 17.4018 5 17.0063 5 16.5254V7.46875C5.00014 6.98796 5.36567 6.59231 5.83398 6.54492L5.92871 6.54004H18.0713ZM5.92871 13.5V16.5254H18.0713V13.5H5.92871ZM5.92871 12.5H18.0713V7.46875H5.92871V12.5Z" fill="#9E9E9E"/>+</svg>diff --git a/apps/web/src/assets/icons/sidebar.svg b/apps/web/src/assets/icons/sidebar.svgnew file mode 100644index 00000000..16310312--- /dev/null+++ b/apps/web/src/assets/icons/sidebar.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M18.0713 6.54004C18.584 6.54004 18.9999 6.95602 19 7.46875V16.5254C19 17.0382 18.5841 17.4541 18.0713 17.4541H5.92871L5.83398 17.4492C5.36562 17.4018 5 17.0063 5 16.5254V7.46875C5.00014 6.98796 5.36567 6.59231 5.83398 6.54492L5.92871 6.54004H18.0713ZM10 16.5254H18.0713V7.46875H10V16.5254ZM5.92871 16.5254H9V7.46875H5.92871V16.5254Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/small-timeline.svg b/apps/web/src/assets/icons/small-timeline.svgnew file mode 100644index 00000000..0565b1bb--- /dev/null+++ b/apps/web/src/assets/icons/small-timeline.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M2.625 2C2.32663 2 2.04048 2.11853 1.8295 2.3295C1.61853 2.54048 1.5 2.82663 1.5 3.125V3.875C1.5 4.17337 1.61853 4.45952 1.8295 4.6705C2.04048 4.88147 2.32663 5 2.625 5H9.375C9.67337 5 9.95952 4.88147 10.1705 4.6705C10.3815 4.45952 10.5 4.17337 10.5 3.875V3.125C10.5 2.82663 10.3815 2.54048 10.1705 2.3295C9.95952 2.11853 9.67337 2 9.375 2H2.625ZM2.625 7C2.32663 7 2.04048 7.11853 1.8295 7.3295C1.61853 7.54048 1.5 7.82663 1.5 8.125V8.875C1.5 9.02274 1.5291 9.16903 1.58564 9.30552C1.64217 9.44201 1.72504 9.56603 1.8295 9.6705C1.93397 9.77496 2.05799 9.85783 2.19448 9.91436C2.33097 9.9709 2.47726 10 2.625 10H5.375C5.52274 10 5.66903 9.9709 5.80552 9.91436C5.94201 9.85783 6.06603 9.77496 6.1705 9.6705C6.27496 9.56603 6.35783 9.44201 6.41436 9.30552C6.4709 9.16903 6.5 9.02274 6.5 8.875V8.125C6.5 7.82663 6.38147 7.54048 6.1705 7.3295C5.95952 7.11853 5.67337 7 5.375 7H2.625Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/social.apple.svg b/apps/web/src/assets/icons/social.apple.svgnew file mode 100644index 00000000..f74d41b8--- /dev/null+++ b/apps/web/src/assets/icons/social.apple.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.9319 4.00801C14.8979 3.97001 13.6729 4.02301 12.6069 5.18001C11.5409 6.33601 11.7049 7.66201 11.7289 7.69601C11.7529 7.73001 13.2489 7.78301 14.2039 6.43801C15.1589 5.09301 14.9659 4.04701 14.9319 4.00801ZM18.2459 15.741C18.1979 15.645 15.9209 14.507 16.1329 12.319C16.3449 10.131 17.8079 9.53001 17.8309 9.46501C17.8539 9.40001 17.2339 8.67501 16.5769 8.30801C16.0944 8.04951 15.5606 7.90128 15.0139 7.87401C14.9059 7.87101 14.5309 7.77901 13.7599 7.99001C13.2519 8.12901 12.1069 8.57901 11.7919 8.59701C11.4759 8.61501 10.5359 8.07501 9.52493 7.93201C8.87793 7.80701 8.19193 8.06301 7.70093 8.26001C7.21093 8.45601 6.27893 9.01401 5.62693 10.497C4.97493 11.979 5.31593 14.327 5.55993 15.057C5.80393 15.787 6.18493 16.981 6.83293 17.853C7.40893 18.837 8.17293 19.52 8.49193 19.752C8.81093 19.984 9.71093 20.138 10.3349 19.819C10.8369 19.511 11.7429 19.334 12.1009 19.347C12.4579 19.36 13.1619 19.501 13.8829 19.886C14.4539 20.083 14.9939 20.001 15.5349 19.781C16.0759 19.56 16.8589 18.722 17.7729 17.023C18.1196 16.233 18.2773 15.8057 18.2459 15.741Z" fill="currentColor"/>+<path d="M14.9319 4.00801C14.8979 3.97001 13.6729 4.02301 12.6069 5.18001C11.5409 6.33601 11.7049 7.66201 11.7289 7.69601C11.7529 7.73001 13.2489 7.78301 14.2039 6.43801C15.1589 5.09301 14.9659 4.04701 14.9319 4.00801ZM18.2459 15.741C18.1979 15.645 15.9209 14.507 16.1329 12.319C16.3449 10.131 17.8079 9.53001 17.8309 9.46501C17.8539 9.40001 17.2339 8.67501 16.5769 8.30801C16.0944 8.04951 15.5606 7.90128 15.0139 7.87401C14.9059 7.87101 14.5309 7.77901 13.7599 7.99001C13.2519 8.12901 12.1069 8.57901 11.7919 8.59701C11.4759 8.61501 10.5359 8.07501 9.52493 7.93201C8.87793 7.80701 8.19193 8.06301 7.70093 8.26001C7.21093 8.45601 6.27893 9.01401 5.62693 10.497C4.97493 11.979 5.31593 14.327 5.55993 15.057C5.80393 15.787 6.18493 16.981 6.83293 17.853C7.40893 18.837 8.17293 19.52 8.49193 19.752C8.81093 19.984 9.71093 20.138 10.3349 19.819C10.8369 19.511 11.7429 19.334 12.1009 19.347C12.4579 19.36 13.1619 19.501 13.8829 19.886C14.4539 20.083 14.9939 20.001 15.5349 19.781C16.0759 19.56 16.8589 18.722 17.7729 17.023C18.1196 16.233 18.2773 15.8057 18.2459 15.741Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/social.github.svg b/apps/web/src/assets/icons/social.github.svgnew file mode 100644index 00000000..ca702547--- /dev/null+++ b/apps/web/src/assets/icons/social.github.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 4C7.58 4 4 7.58 4 12C4 15.54 6.29 18.53 9.47 19.59C9.87 19.66 10.02 19.42 10.02 19.21C10.02 19.02 10.01 18.39 10.01 17.72C8 18.09 7.48 17.23 7.32 16.78C7.23 16.55 6.84 15.84 6.5 15.65C6.22 15.5 5.82 15.13 6.49 15.12C7.12 15.11 7.57 15.7 7.72 15.94C8.44 17.15 9.59 16.81 10.05 16.6C10.12 16.08 10.33 15.73 10.56 15.53C8.78 15.33 6.92 14.64 6.92 11.58C6.92 10.71 7.23 9.99 7.74 9.43C7.66 9.23 7.38 8.41 7.82 7.31C7.82 7.31 8.49 7.1 10.02 8.13C10.66 7.95 11.34 7.86 12.02 7.86C12.7 7.86 13.38 7.95 14.02 8.13C15.55 7.09 16.22 7.31 16.22 7.31C16.66 8.41 16.38 9.23 16.3 9.43C16.81 9.99 17.12 10.7 17.12 11.58C17.12 14.65 15.25 15.33 13.47 15.53C13.76 15.78 14.01 16.26 14.01 17.01C14.01 18.08 14 18.94 14 19.21C14 19.42 14.15 19.67 14.55 19.59C16.1384 19.0543 17.5187 18.0337 18.4964 16.672C19.4741 15.3104 20 13.6763 20 12C20 7.58 16.42 4 12 4Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/social.google.svg b/apps/web/src/assets/icons/social.google.svgnew file mode 100644index 00000000..a3180524--- /dev/null+++ b/apps/web/src/assets/icons/social.google.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M19.357 10.593C19.4481 11.1168 19.4935 11.6476 19.4927 12.1793C19.4927 14.5539 18.6439 16.5617 17.1668 17.9207H17.1688C15.8771 19.1139 14.1015 19.8046 11.9962 19.8046C9.92622 19.8046 7.94105 18.9823 6.47737 17.5186C5.01369 16.0549 4.19141 14.0698 4.19141 11.9998C4.19141 9.92986 5.01369 7.94469 6.47737 6.48101C7.94105 5.01733 9.92622 4.19505 11.9962 4.19505C13.9334 4.17347 15.8041 4.9012 17.2176 6.22624L14.9893 8.4545C14.1837 7.68695 13.1088 7.26653 11.9962 7.28378C9.9601 7.28378 8.23037 8.65742 7.6138 10.5072C7.28745 11.4765 7.28745 12.526 7.6138 13.4954H7.61672C8.23623 15.3422 9.96303 16.7158 11.9991 16.7158C13.0508 16.7158 13.9542 16.4466 14.6547 15.9705H14.6517C15.0586 15.7011 15.4065 15.3521 15.6747 14.9444C15.9428 14.5368 16.1255 14.079 16.2117 13.5988H11.9962V10.594L19.357 10.593Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/solo.svg b/apps/web/src/assets/icons/solo.svgnew file mode 100644index 00000000..7d3f4301--- /dev/null+++ b/apps/web/src/assets/icons/solo.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M13.6695 10.5455C13.6269 10.1856 13.454 9.90625 13.151 9.70739C12.848 9.50852 12.4763 9.40909 12.036 9.40909C11.714 9.40909 11.4323 9.46117 11.1908 9.56534C10.9517 9.66951 10.7646 9.81274 10.6297 9.99503C10.4971 10.1773 10.4308 10.3845 10.4308 10.6165C10.4308 10.8106 10.477 10.9775 10.5693 11.1172C10.664 11.2545 10.7848 11.3693 10.9316 11.4616C11.0783 11.5516 11.2322 11.6262 11.3932 11.6854C11.5542 11.7422 11.7021 11.7884 11.8371 11.8239L12.5757 12.0227C12.7651 12.0724 12.9758 12.1411 13.2078 12.2287C13.4422 12.3163 13.6659 12.4358 13.879 12.5874C14.0944 12.7365 14.272 12.9283 14.4117 13.1626C14.5513 13.397 14.6212 13.6847 14.6212 14.0256C14.6212 14.4186 14.5182 14.7737 14.3122 15.0909C14.1086 15.4081 13.8103 15.6603 13.4173 15.8473C13.0267 16.0343 12.5521 16.1278 11.9933 16.1278C11.4725 16.1278 11.0215 16.0438 10.6404 15.8757C10.2616 15.7076 9.96328 15.4732 9.74547 15.1726C9.53004 14.8719 9.40811 14.5227 9.37971 14.125H10.2888C10.3125 14.3996 10.4048 14.6269 10.5658 14.8068C10.7291 14.9844 10.9351 15.117 11.1837 15.2045C11.4346 15.2898 11.7045 15.3324 11.9933 15.3324C12.3295 15.3324 12.6314 15.2779 12.8989 15.169C13.1664 15.0578 13.3783 14.9039 13.5345 14.7074C13.6908 14.5085 13.7689 14.2765 13.7689 14.0114C13.7689 13.7699 13.7014 13.5734 13.5665 13.4219C13.4316 13.2704 13.254 13.1473 13.0338 13.0526C12.8137 12.9579 12.5757 12.875 12.32 12.804L11.4252 12.5483C10.857 12.3849 10.4072 12.1518 10.0757 11.8487C9.74429 11.5457 9.57857 11.1491 9.57857 10.6591C9.57857 10.2519 9.68865 9.89678 9.90882 9.59375C10.1314 9.28835 10.4297 9.05161 10.8037 8.88352C11.1801 8.71307 11.6003 8.62784 12.0644 8.62784C12.5331 8.62784 12.9498 8.71188 13.3144 8.87997C13.6789 9.04569 13.9678 9.27296 14.1808 9.56179C14.3963 9.85062 14.5099 10.1785 14.5218 10.5455H13.6695Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/spinner-loader.svg b/apps/web/src/assets/icons/spinner-loader.svgnew file mode 100644index 00000000..38072560--- /dev/null+++ b/apps/web/src/assets/icons/spinner-loader.svg@@ -0,0 +1,3 @@+<svg fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.25 12C17.2499 13.1087 16.8989 14.1889 16.2472 15.0858C15.5955 15.9827 14.6766 16.6503 13.6222 16.9929C12.5678 17.3354 11.4319 17.3354 10.3775 16.9928C9.32314 16.6501 8.40426 15.9825 7.75261 15.0856C7.10096 14.1886 6.74999 13.1084 6.75 11.9997C6.75001 10.891 7.10099 9.81083 7.75266 8.91389C8.40432 8.01695 9.3232 7.34933 10.3776 7.00672C11.432 6.66411 12.5678 6.6641 13.6222 7.00668" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>+</svg>diff --git a/apps/web/src/assets/icons/split.svg b/apps/web/src/assets/icons/split.svgnew file mode 100644index 00000000..bf7b3923--- /dev/null+++ b/apps/web/src/assets/icons/split.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12 5.37891C12.2552 5.37891 12.4619 5.58664 12.4619 5.8418V18.1621C12.4615 18.4169 12.2549 18.624 12 18.624C11.7451 18.624 11.5385 18.4169 11.5381 18.1621V5.8418C11.5381 5.58664 11.7448 5.37891 12 5.37891ZM9.68945 6.91992C9.94457 6.91996 10.1514 7.12671 10.1514 7.38184C10.1514 7.63697 9.94457 7.84371 9.68945 7.84375H7.8418C7.69573 7.84384 7.50167 7.92764 7.33203 8.10938C7.16428 8.28916 7.07129 8.51154 7.07129 8.70215V15.3018C7.07129 15.4924 7.16428 15.7147 7.33203 15.8945C7.50164 16.0762 7.69576 16.1601 7.8418 16.1602H9.68945C9.94457 16.1602 10.1514 16.3669 10.1514 16.6221C10.1512 16.8771 9.94449 17.0839 9.68945 17.084H7.8418C7.37201 17.0839 6.94845 16.8375 6.65625 16.5244C6.36226 16.2092 6.14746 15.7709 6.14746 15.3018V8.70215C6.14746 8.23305 6.36232 7.79465 6.65625 7.47949C6.94845 7.16642 7.37201 6.92001 7.8418 6.91992H9.68945ZM16.1562 6.91992C16.6261 6.91992 17.0495 7.16642 17.3418 7.47949C17.6358 7.79465 17.8506 8.23301 17.8506 8.70215V15.3018C17.8506 15.771 17.6358 16.2092 17.3418 16.5244C17.0495 16.8375 16.6261 17.084 16.1562 17.084H14.3086C14.0536 17.0839 13.8468 16.877 13.8467 16.6221C13.8467 16.367 14.0536 16.1603 14.3086 16.1602H16.1562C16.3023 16.1602 16.4963 16.0762 16.666 15.8945C16.8338 15.7147 16.9268 15.4924 16.9268 15.3018V8.70215C16.9268 8.5115 16.8338 8.28918 16.666 8.10938C16.4963 7.9276 16.3023 7.84375 16.1562 7.84375H14.3086C14.0536 7.84362 13.8467 7.63691 13.8467 7.38184C13.8467 7.12676 14.0536 6.92005 14.3086 6.91992H16.1562Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/switch-flip.svg b/apps/web/src/assets/icons/switch-flip.svgnew file mode 100644index 00000000..f01b5161--- /dev/null+++ b/apps/web/src/assets/icons/switch-flip.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.92 12.0015C15.0364 11.9913 15.1529 12.0216 15.2491 12.0874L15.3184 12.1451L17.8535 14.6499C17.9362 14.7318 17.9876 14.8395 17.9981 14.9546C18.0085 15.0697 17.9777 15.1848 17.9112 15.2798L17.8535 15.3492L15.3184 17.854C15.2302 17.9416 15.1112 17.9938 14.9864 17.9995C14.8618 18.0051 14.7394 17.9642 14.6436 17.8853C14.5476 17.8062 14.4846 17.6942 14.4678 17.5718C14.4511 17.4496 14.4817 17.3255 14.5528 17.2242L14.6114 17.1558L16.292 15.4937H6.50003C6.38307 15.4937 6.26959 15.4534 6.17972 15.3794C6.08982 15.3054 6.02891 15.2022 6.00784 15.0884L6.00003 14.9995C5.99999 14.8839 6.04132 14.772 6.11624 14.6831C6.19115 14.5944 6.29512 14.534 6.41019 14.5132L6.50003 14.5054H16.292L14.6114 12.8433C14.5285 12.7615 14.4774 12.6538 14.4668 12.5386C14.4562 12.4236 14.4864 12.3085 14.5528 12.2134L14.6114 12.1441C14.6942 12.0624 14.8034 12.0118 14.92 12.0015ZM9.0137 6.00052C9.1383 5.99491 9.26062 6.03495 9.35648 6.1138C9.45243 6.19287 9.51549 6.30495 9.53226 6.42728C9.54899 6.54967 9.5186 6.67447 9.4473 6.77591L9.3887 6.84329L7.70804 8.5054H17.5C17.617 8.50536 17.7305 8.54575 17.8203 8.61966C17.9102 8.69368 17.9711 8.79695 17.9922 8.91068L18 8.99954C18.0001 9.11517 17.9587 9.22712 17.8838 9.31595C17.8089 9.40474 17.705 9.46506 17.5899 9.48587L17.5 9.49368H7.70804L9.3887 11.1558C9.47151 11.2375 9.52262 11.3453 9.53323 11.4605C9.54382 11.5755 9.51366 11.6906 9.4473 11.7857L9.3887 11.855C9.30586 11.9367 9.19666 11.9873 9.08011 11.9976C8.96363 12.0078 8.84712 11.9775 8.75101 11.9117L8.68167 11.854L6.14651 9.34915C6.06384 9.26728 6.0124 9.15966 6.00198 9.04446C5.99158 8.92937 6.02234 8.81427 6.0889 8.71927L6.14651 8.64993L8.68167 6.14505C8.76986 6.05752 8.88884 6.00623 9.0137 6.00052Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/test-keyframe-default.svg b/apps/web/src/assets/icons/test-keyframe-default.svgnew file mode 100644index 00000000..bc886e19--- /dev/null+++ b/apps/web/src/assets/icons/test-keyframe-default.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2203_182593)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.3999 6.4C10.3999 6.17909 10.579 6 10.7999 6H11.9999H13.1999C13.4208 6 13.5999 6.17909 13.5999 6.4C13.5999 6.62091 13.4208 6.8 13.1999 6.8H12.3999V7.69538C13.2786 7.76327 14.0951 8.05298 14.7935 8.50858C14.8092 8.48681 14.8268 8.46602 14.8463 8.44645L15.4863 7.80645C15.6816 7.61118 15.9981 7.61118 16.1934 7.80645C16.3887 8.00171 16.3887 8.31829 16.1934 8.51355L15.5735 9.13346C16.5275 10.0634 17.1199 11.3625 17.1199 12.8C17.1199 15.6277 14.8276 17.92 11.9999 17.92C9.17218 17.92 6.87988 15.6277 6.87988 12.8C6.87988 10.1069 8.95913 7.89944 11.5999 7.69538V6.8H10.7999C10.579 6.8 10.3999 6.62091 10.3999 6.4ZM7.67988 12.8C7.67988 10.4141 9.61401 8.47998 11.9999 8.47998C14.3857 8.47998 16.3199 10.4141 16.3199 12.8C16.3199 15.1858 14.3857 17.12 11.9999 17.12C9.61401 17.12 7.67988 15.1858 7.67988 12.8Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2203_182593">+<rect width="12" height="12" fill="white" transform="translate(6 6)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/test-keyframe-set.svg b/apps/web/src/assets/icons/test-keyframe-set.svgnew file mode 100644index 00000000..5faf025b--- /dev/null+++ b/apps/web/src/assets/icons/test-keyframe-set.svg@@ -0,0 +1,10 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_2203_182607)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.3999 6.4C10.3999 6.17909 10.579 6 10.7999 6H11.9999H13.1999C13.4208 6 13.5999 6.17909 13.5999 6.4C13.5999 6.62091 13.4208 6.8 13.1999 6.8H12.3999V7.69538C13.2786 7.76327 14.0951 8.05298 14.7935 8.50858C14.8092 8.48681 14.8268 8.46602 14.8463 8.44645L15.4863 7.80645C15.6816 7.61118 15.9981 7.61118 16.1934 7.80645C16.3887 8.00171 16.3887 8.31829 16.1934 8.51355L15.5735 9.13346C16.5275 10.0634 17.1199 11.3625 17.1199 12.8C17.1199 15.6277 14.8276 17.92 11.9999 17.92C9.17218 17.92 6.87988 15.6277 6.87988 12.8C6.87988 10.1069 8.95913 7.89944 11.5999 7.69538V6.8H10.7999C10.579 6.8 10.3999 6.62091 10.3999 6.4ZM7.67988 12.8C7.67988 10.4141 9.61401 8.47998 11.9999 8.47998C14.3857 8.47998 16.3199 10.4141 16.3199 12.8C16.3199 15.1858 14.3857 17.12 11.9999 17.12C9.61401 17.12 7.67988 15.1858 7.67988 12.8ZM12.3999 9.6C12.3999 9.37909 12.2208 9.2 11.9999 9.2C11.779 9.2 11.5999 9.37909 11.5999 9.6V13.6C11.5999 13.8209 11.779 14 11.9999 14C12.2208 14 12.3999 13.8209 12.3999 13.6V9.6Z" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2203_182607">+<rect width="12" height="12" fill="white" transform="translate(6 6)"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/text-small.svg b/apps/web/src/assets/icons/text-small.svgnew file mode 100644index 00000000..61dbc518--- /dev/null+++ b/apps/web/src/assets/icons/text-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.5 7C16.7761 7 17 7.22386 17 7.5V9C17 9.27614 16.7761 9.5 16.5 9.5C16.2239 9.5 16 9.27614 16 9V8H12.5V16H14C14.2761 16 14.5 16.2239 14.5 16.5C14.5 16.7761 14.2761 17 14 17H10C9.72386 17 9.5 16.7761 9.5 16.5C9.5 16.2239 9.72386 16 10 16H11.5V8H8V9C8 9.27614 7.77614 9.5 7.5 9.5C7.22386 9.5 7 9.27614 7 9V7.5C7 7.22386 7.22386 7 7.5 7H16.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.align-bottom.svg b/apps/web/src/assets/icons/text.align-bottom.svgnew file mode 100644index 00000000..8c17fd1a--- /dev/null+++ b/apps/web/src/assets/icons/text.align-bottom.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.50092 17H16.5009C16.6259 16.9998 16.7464 17.0463 16.8387 17.1305C16.931 17.2147 16.9885 17.3304 16.9998 17.4548C17.0111 17.5793 16.9754 17.7034 16.8997 17.8028C16.824 17.9023 16.7139 17.9697 16.5909 17.992L16.5009 18H7.50092C7.37598 18.0002 7.25547 17.9537 7.16314 17.8695C7.07081 17.7853 7.01334 17.6696 7.00205 17.5452C6.99076 17.4207 7.02647 17.2966 7.10214 17.1972C7.17782 17.0977 7.28797 17.0303 7.41092 17.008L7.50092 17ZM11.9109 7.008L12.0009 7C12.1179 6.99996 12.2313 7.04097 12.3212 7.11589C12.4111 7.19081 12.4719 7.29489 12.4929 7.41L12.5009 7.5V14.292L14.1829 12.611C14.2657 12.5282 14.3748 12.477 14.4914 12.4664C14.608 12.4558 14.7246 12.4864 14.8209 12.553L14.8909 12.611C14.9736 12.6939 15.0246 12.8031 15.035 12.9197C15.0454 13.0363 15.0146 13.1528 14.9479 13.249L14.8899 13.318L12.3549 15.854C12.2721 15.9367 12.1628 15.9877 12.0462 15.9981C11.9297 16.0085 11.8131 15.9777 11.7169 15.911L11.6469 15.854L9.11192 13.318C9.02334 13.2298 8.971 13.1116 8.96522 12.9868C8.95944 12.8619 9.00064 12.7394 9.0807 12.6434C9.16076 12.5474 9.27387 12.4849 9.39774 12.4682C9.52161 12.4514 9.64726 12.4817 9.74992 12.553L9.81892 12.611L11.5009 14.292V7.5C11.5009 7.38297 11.5419 7.26964 11.6168 7.17974C11.6917 7.08984 11.7958 7.02906 11.9109 7.008Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.align-center.svg b/apps/web/src/assets/icons/text.align-center.svgnew file mode 100644index 00000000..6da5f49f--- /dev/null+++ b/apps/web/src/assets/icons/text.align-center.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.5 15.5C15.6326 15.5 15.7597 15.5527 15.8535 15.6465C15.9473 15.7403 16 15.8674 16 16C16 16.1326 15.9473 16.2597 15.8535 16.3535C15.7597 16.4473 15.6326 16.5 15.5 16.5H8.5C8.36739 16.5 8.24025 16.4473 8.14648 16.3535C8.05272 16.2597 8 16.1326 8 16C8 15.8674 8.05272 15.7403 8.14648 15.6465C8.24025 15.5527 8.36739 15.5 8.5 15.5H15.5ZM14.5 11.5C14.6326 11.5 14.7597 11.5527 14.8535 11.6465C14.9473 11.7403 15 11.8674 15 12C15 12.1326 14.9473 12.2597 14.8535 12.3535C14.7597 12.4473 14.6326 12.5 14.5 12.5H9.5C9.36739 12.5 9.24025 12.4473 9.14648 12.3535C9.05272 12.2597 9 12.1326 9 12C9 11.8674 9.05272 11.7403 9.14648 11.6465C9.24025 11.5527 9.36739 11.5 9.5 11.5H14.5ZM16.9502 7.5C17.096 7.50005 17.2358 7.55276 17.3389 7.64648C17.442 7.74025 17.5 7.86739 17.5 8C17.5 8.13261 17.442 8.25975 17.3389 8.35352C17.2358 8.44724 17.096 8.49995 16.9502 8.5H7.0498C6.90401 8.49995 6.76423 8.44724 6.66113 8.35352C6.55799 8.25975 6.5 8.13261 6.5 8C6.5 7.86739 6.55799 7.74025 6.66113 7.64648C6.76423 7.55276 6.90401 7.50005 7.0498 7.5H16.9502Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.align-left.svg b/apps/web/src/assets/icons/text.align-left.svgnew file mode 100644index 00000000..9307686e--- /dev/null+++ b/apps/web/src/assets/icons/text.align-left.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M14.5 15.5C14.6326 15.5 14.7597 15.5527 14.8535 15.6465C14.9473 15.7403 15 15.8674 15 16C15 16.1326 14.9473 16.2597 14.8535 16.3535C14.7597 16.4473 14.6326 16.5 14.5 16.5H7.5C7.36739 16.5 7.24025 16.4473 7.14648 16.3535C7.05272 16.2597 7 16.1326 7 16C7 15.8674 7.05272 15.7403 7.14648 15.6465C7.24025 15.5527 7.36739 15.5 7.5 15.5H14.5ZM12.5 11.5C12.6326 11.5 12.7597 11.5527 12.8535 11.6465C12.9473 11.7403 13 11.8674 13 12C13 12.1326 12.9473 12.2597 12.8535 12.3535C12.7597 12.4473 12.6326 12.5 12.5 12.5H7.5C7.36739 12.5 7.24025 12.4473 7.14648 12.3535C7.05272 12.2597 7 12.1326 7 12C7 11.8674 7.05272 11.7403 7.14648 11.6465C7.24025 11.5527 7.36739 11.5 7.5 11.5H12.5ZM17.5 7.5C17.6326 7.5 17.7597 7.55272 17.8535 7.64648C17.9473 7.74025 18 7.86739 18 8C18 8.13261 17.9473 8.25975 17.8535 8.35352C17.7597 8.44728 17.6326 8.5 17.5 8.5H7.5C7.36739 8.5 7.24025 8.44728 7.14648 8.35352C7.05272 8.25975 7 8.13261 7 8C7 7.86739 7.05272 7.74025 7.14648 7.64648C7.24025 7.55272 7.36739 7.5 7.5 7.5H17.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.align-middle.svg b/apps/web/src/assets/icons/text.align-middle.svgnew file mode 100644index 00000000..c2eeb0f9--- /dev/null+++ b/apps/web/src/assets/icons/text.align-middle.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.0439 13.502C12.1605 13.5124 12.2697 13.5638 12.3525 13.6465L14.2061 15.293L14.2637 15.3623C14.3303 15.4585 14.362 15.5748 14.3516 15.6914C14.3411 15.808 14.2897 15.9172 14.207 16L14.1367 16.0576C14.0404 16.1241 13.9242 16.1551 13.8076 16.1445C13.691 16.1339 13.5818 16.0828 13.499 16L12.499 15.208V18.5L12.4912 18.5898C12.4702 18.7049 12.4091 18.8089 12.3193 18.8838C12.2294 18.9587 12.116 19 11.999 19L11.9092 18.9922C11.7942 18.9711 11.6901 18.9101 11.6152 18.8203C11.5403 18.7304 11.499 18.617 11.499 18.5V15.208L10.499 16L10.4297 16.0576C10.3271 16.1289 10.2019 16.1592 10.0781 16.1426C9.95429 16.1258 9.8408 16.0637 9.76074 15.9678C9.68068 15.8718 9.63973 15.7489 9.64551 15.624C9.65134 15.4992 9.70346 15.3811 9.79199 15.293L11.6445 13.6465L11.7148 13.5889C11.8109 13.5223 11.9275 13.4916 12.0439 13.502ZM16.499 11.5L16.5889 11.5078C16.6001 11.5099 16.611 11.5138 16.6221 11.5166C16.6865 11.5329 16.7464 11.5622 16.7998 11.6025C16.8122 11.6119 16.8254 11.6203 16.8369 11.6309C16.8722 11.6631 16.9004 11.7011 16.9248 11.7412C16.9642 11.8059 16.9908 11.8771 16.998 11.9521V12.0479C16.9909 12.1226 16.9639 12.1933 16.9248 12.2578C16.9156 12.273 16.9073 12.2886 16.8965 12.3027H16.8975C16.8696 12.3394 16.836 12.3702 16.7998 12.3975C16.7464 12.4377 16.6864 12.4661 16.6221 12.4824C16.611 12.4852 16.6002 12.4901 16.5889 12.4922L16.499 12.5H7.49902L7.40918 12.4922C7.39756 12.4901 7.38637 12.4853 7.375 12.4824C7.31101 12.4661 7.25137 12.4375 7.19824 12.3975C7.18655 12.3886 7.17399 12.3809 7.16309 12.3711L7.10059 12.3027C7.08981 12.2886 7.08144 12.273 7.07227 12.2578C7.03329 12.1934 7.00717 12.1224 7 12.0479V11.9521C7.00136 11.9379 7.00525 11.9241 7.00781 11.9102C7.02743 11.8031 7.08014 11.7048 7.16113 11.6309V11.6299C7.17252 11.6195 7.18599 11.6118 7.19824 11.6025C7.25468 11.56 7.31828 11.5293 7.38672 11.5137C7.39418 11.512 7.40162 11.5092 7.40918 11.5078L7.49902 11.5H16.499ZM11.999 5C12.116 4.99996 12.2294 5.04129 12.3193 5.11621C12.4091 5.19112 12.4702 5.29512 12.4912 5.41016L12.499 5.5V8.79199L13.499 8C13.5818 7.91717 13.691 7.86607 13.8076 7.85547C13.9242 7.84488 14.0404 7.87587 14.1367 7.94238L14.207 8C14.2897 8.08285 14.3411 8.19203 14.3516 8.30859C14.362 8.42517 14.3303 8.5415 14.2637 8.6377L14.2061 8.70703L12.3525 10.3535C12.2697 10.4362 12.1605 10.4876 12.0439 10.498C11.9275 10.5084 11.8109 10.4777 11.7148 10.4111L11.6445 10.3535L9.79199 8.70703C9.70347 8.61889 9.65134 8.50075 9.64551 8.37598C9.63973 8.25111 9.68068 8.12822 9.76074 8.03223C9.8408 7.93627 9.95428 7.87415 10.0781 7.85742C10.2019 7.84075 10.3271 7.87115 10.4297 7.94238L10.499 8L11.499 8.79199V5.5C11.499 5.38297 11.5403 5.26959 11.6152 5.17969C11.6901 5.08989 11.7941 5.02886 11.9092 5.00781L11.999 5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.align-right.svg b/apps/web/src/assets/icons/text.align-right.svgnew file mode 100644index 00000000..87187509--- /dev/null+++ b/apps/web/src/assets/icons/text.align-right.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.5 15.5C16.6326 15.5 16.7597 15.5527 16.8535 15.6465C16.9473 15.7403 17 15.8674 17 16C17 16.1326 16.9473 16.2597 16.8535 16.3535C16.7597 16.4473 16.6326 16.5 16.5 16.5H9.5C9.36739 16.5 9.24025 16.4473 9.14648 16.3535C9.05272 16.2597 9 16.1326 9 16C9 15.8674 9.05272 15.7403 9.14648 15.6465C9.24025 15.5527 9.36739 15.5 9.5 15.5H16.5ZM16.5 11.5C16.6326 11.5 16.7597 11.5527 16.8535 11.6465C16.9473 11.7403 17 11.8674 17 12C17 12.1326 16.9473 12.2597 16.8535 12.3535C16.7597 12.4473 16.6326 12.5 16.5 12.5H11.5C11.3674 12.5 11.2403 12.4473 11.1465 12.3535C11.0527 12.2597 11 12.1326 11 12C11 11.8674 11.0527 11.7403 11.1465 11.6465C11.2403 11.5527 11.3674 11.5 11.5 11.5H16.5ZM16.5 7.5C16.6326 7.5 16.7597 7.55272 16.8535 7.64648C16.9473 7.74025 17 7.86739 17 8C17 8.13261 16.9473 8.25975 16.8535 8.35352C16.7597 8.44728 16.6326 8.5 16.5 8.5H6.5C6.36739 8.5 6.24025 8.44728 6.14648 8.35352C6.05272 8.25975 6 8.13261 6 8C6 7.86739 6.05272 7.74025 6.14648 7.64648C6.24025 7.55272 6.36739 7.5 6.5 7.5H16.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.align-top.svg b/apps/web/src/assets/icons/text.align-top.svgnew file mode 100644index 00000000..4d9cefd3--- /dev/null+++ b/apps/web/src/assets/icons/text.align-top.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.49897 7H16.499C16.6239 7.00023 16.7444 6.95367 16.8368 6.86949C16.9291 6.78531 16.9866 6.66961 16.9978 6.54518C17.0091 6.42074 16.9734 6.29659 16.8977 6.19717C16.8221 6.09775 16.7119 6.03026 16.589 6.008L16.499 6H7.49897C7.37402 5.99977 7.25352 6.04633 7.16119 6.13051C7.06885 6.21469 7.01138 6.33039 7.00009 6.45482C6.9888 6.57926 7.02451 6.70341 7.10019 6.80283C7.17586 6.90225 7.28602 6.96974 7.40897 6.992L7.49897 7ZM11.909 16.992L11.999 17C12.116 17 12.2293 16.959 12.3192 16.8841C12.4091 16.8092 12.4699 16.7051 12.491 16.59L12.499 16.5V9.708L14.181 11.389C14.2637 11.4718 14.3729 11.523 14.4895 11.5336C14.606 11.5442 14.7227 11.5136 14.819 11.447L14.889 11.389C14.9716 11.3061 15.0226 11.1969 15.033 11.0803C15.0435 10.9637 15.0126 10.8472 14.946 10.751L14.888 10.682L12.353 8.146C12.2701 8.06332 12.1609 8.01234 12.0443 8.00192C11.9277 7.99151 11.8112 8.02232 11.715 8.089L11.645 8.146L9.10997 10.682C9.02138 10.7702 8.96905 10.8884 8.96327 11.0132C8.95749 11.1381 8.99869 11.2606 9.07874 11.3566C9.1588 11.4526 9.27191 11.5151 9.39579 11.5318C9.51966 11.5486 9.64531 11.5183 9.74797 11.447L9.81697 11.389L11.499 9.708V16.5C11.4989 16.617 11.5399 16.7304 11.6149 16.8203C11.6898 16.9102 11.7939 16.9709 11.909 16.992Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.letter-spacing.svg b/apps/web/src/assets/icons/text.letter-spacing.svgnew file mode 100644index 00000000..e7184ecf--- /dev/null+++ b/apps/web/src/assets/icons/text.letter-spacing.svg@@ -0,0 +1,5 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.127 15.5H14.2031L13.4717 13.4404H10.5312L9.7998 15.5H8.87695L11.5469 8.22754H12.4561L15.127 15.5ZM10.8086 12.6592H13.1953L12.0303 9.37793H11.9736L10.8086 12.6592Z" fill="currentColor"/>+<rect opacity="0.5" x="5.75" y="6.5" width="1" height="11" rx="0.5" fill="currentColor"/>+<rect opacity="0.5" x="17.25" y="6.5" width="1" height="11" rx="0.5" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.line-height.svg b/apps/web/src/assets/icons/text.line-height.svgnew file mode 100644index 00000000..b799a7fc--- /dev/null+++ b/apps/web/src/assets/icons/text.line-height.svg@@ -0,0 +1,5 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.127 15.5H14.2031L13.4717 13.4404H10.5312L9.7998 15.5H8.87695L11.5469 8.22754H12.4561L15.127 15.5ZM10.8086 12.6592H13.1953L12.0303 9.37793H11.9736L10.8086 12.6592Z" fill="currentColor"/>+<rect opacity="0.5" x="6.5" y="5.5" width="11" height="1" rx="0.5" fill="currentColor"/>+<rect opacity="0.5" x="6.5" y="17.5" width="11" height="1" rx="0.5" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/text.svg b/apps/web/src/assets/icons/text.svgnew file mode 100644index 00000000..e1a71575--- /dev/null+++ b/apps/web/src/assets/icons/text.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M5.70026 4.48979V6.36681C5.70026 6.66778 5.45627 6.91176 5.15531 6.91176C4.85433 6.91176 4.61035 6.66778 4.61035 6.36681V3.94486C4.61035 3.88724 4.61929 3.83171 4.63586 3.77959C4.70584 3.55941 4.91194 3.39988 5.15531 3.39988H14.8434C15.0316 3.39988 15.1973 3.49519 15.2953 3.64014C15.354 3.72712 15.3883 3.83197 15.3883 3.94483V6.36681C15.3883 6.66778 15.1444 6.91176 14.8434 6.91176C14.5424 6.91176 14.2984 6.66778 14.2984 6.36681V4.48979H10.6654V15.51H12.1239C12.4249 15.51 12.6688 15.754 12.6688 16.0549C12.6688 16.356 12.4249 16.5999 12.1239 16.5999H7.88535C7.58438 16.5999 7.34039 16.356 7.34039 16.0549C7.34039 15.754 7.58438 15.51 7.88535 15.51H9.3333V4.48979H5.70026Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/theme.svg b/apps/web/src/assets/icons/theme.svgnew file mode 100644index 00000000..d94f0ae5--- /dev/null+++ b/apps/web/src/assets/icons/theme.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.9995 18.2498C15.4514 18.2498 18.2495 15.4516 18.2495 11.9998C18.2495 8.54788 15.4514 5.74976 11.9995 5.74976C8.54764 5.74976 5.74951 8.54788 5.74951 11.9998C5.74951 15.4516 8.54764 18.2498 11.9995 18.2498ZM11.9995 17.3123V6.68726C13.4085 6.68726 14.7597 7.24696 15.756 8.24325C16.7523 9.23954 17.312 10.5908 17.312 11.9998C17.312 13.4087 16.7523 14.76 15.756 15.7563C14.7597 16.7525 13.4085 17.3123 11.9995 17.3123Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/timeline-sequence-small.svg b/apps/web/src/assets/icons/timeline-sequence-small.svgnew file mode 100644index 00000000..0b0b3a7c--- /dev/null+++ b/apps/web/src/assets/icons/timeline-sequence-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.5 9C18.0523 9 18.5 9.44771 18.5 10V14C18.5 14.5523 18.0523 15 17.5 15H6.5C5.94772 15 5.5 14.5523 5.5 14V10C5.5 9.44772 5.94772 9 6.5 9H17.5ZM6.5 14H17.5V10H6.5V14Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.actions-spotlight.svg b/apps/web/src/assets/icons/tool.actions-spotlight.svgnew file mode 100644index 00000000..66d06465--- /dev/null+++ b/apps/web/src/assets/icons/tool.actions-spotlight.svg@@ -0,0 +1,6 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9234 12.8037C17.8893 12.8039 19.4829 14.3983 19.483 16.3642C19.4827 18.33 17.8892 19.9236 15.9234 19.9238C13.9576 19.9235 12.3631 18.33 12.3628 16.3642C12.3629 14.3983 13.9575 12.8039 15.9234 12.8037ZM15.9234 13.9638C14.5982 13.9641 13.5231 15.039 13.523 16.3642L13.5357 16.6093C13.6504 17.7385 14.5482 18.6369 15.6773 18.7519L15.9234 18.7636C17.1658 18.7634 18.1882 17.8194 18.3111 16.6093L18.3228 16.3642C18.3228 15.1217 17.3786 14.0995 16.1685 13.9765L15.9234 13.9638Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M9.29839 13.0439C10.4162 13.0439 11.3228 13.9505 11.3228 15.0683V17.6601C11.3226 18.7777 10.416 19.6845 9.29839 19.6845H6.7066C5.58892 19.6845 4.68242 18.7777 4.68218 17.6601V15.0683C4.68218 13.9505 5.58877 13.0439 6.7066 13.0439H9.29839ZM6.61773 14.2089C6.18221 14.2533 5.84234 14.6211 5.84234 15.0683V17.6601L5.84722 17.748C5.88852 18.1545 6.21124 18.4781 6.61773 18.5195L6.7066 18.5244H9.29839L9.38628 18.5195C9.79309 18.4784 10.1165 18.1548 10.1578 17.748L10.1626 17.6601V15.0683C10.1626 14.6209 9.8221 14.2531 9.38628 14.2089L9.29839 14.2041H6.7066L6.61773 14.2089Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.66167 4.77633C7.49665 4.09563 8.72817 4.14467 9.5064 4.92282L11.0845 6.50094C11.9144 7.33112 11.9144 8.67663 11.0845 9.5068L9.5064 11.0849C8.67624 11.915 7.33078 11.9149 6.50054 11.0849L4.92242 9.5068C4.09228 8.67657 4.09225 7.33115 4.92242 6.50094L6.50054 4.92282L6.66167 4.77633ZM8.68609 5.74313C8.30893 5.36607 7.69807 5.36616 7.32085 5.74313L5.74273 7.32125C5.36557 7.69845 5.3656 8.30927 5.74273 8.68649L7.32085 10.2646C7.69809 10.6416 8.30894 10.6417 8.68609 10.2646L10.2642 8.68649C10.6176 8.33291 10.6398 7.77381 10.3306 7.3945L10.2642 7.32125L8.68609 5.74313Z" fill="currentColor"/>+<path d="M15.9224 4.78414C16.2427 4.78414 16.5025 5.0439 16.5025 5.36422V7.42379H18.563C18.8832 7.42395 19.1431 7.68364 19.1431 8.00387C19.1431 8.32409 18.8832 8.58379 18.563 8.58395H16.5025V10.6445C16.5022 10.9646 16.2426 11.2246 15.9224 11.2246C15.6025 11.2243 15.3426 10.9644 15.3423 10.6445V8.58395H13.2828C12.9627 8.58369 12.7027 8.32403 12.7027 8.00387C12.7027 7.6837 12.9627 7.42405 13.2828 7.42379H15.3423V5.36422C15.3423 5.04406 15.6023 4.7844 15.9224 4.78414Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.color-picker.svg b/apps/web/src/assets/icons/tool.color-picker.svgnew file mode 100644index 00000000..993b58fd--- /dev/null+++ b/apps/web/src/assets/icons/tool.color-picker.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.0302 6.96984C16.4037 6.34339 15.464 6.34339 14.8376 6.96984L12.645 9.16244L12.0185 8.61429C11.7053 8.30106 11.2354 8.30106 10.9222 8.61429C10.609 8.92752 10.609 9.39736 10.9222 9.71059L11.4703 10.2587L6.92854 14.8006C6.61531 15.1138 6.14547 16.2884 6.92854 17.0715C7.71161 17.8545 8.88621 17.3847 9.19944 17.0715L13.7413 12.5296L14.2894 13.0778C14.6027 13.391 15.0725 13.391 15.3857 13.0778C15.699 12.7646 15.699 12.2947 15.3857 11.9815L14.8376 11.4333L17.0302 9.24075C17.6566 8.53598 17.6566 7.5963 17.0302 6.96984ZM8.49468 16.2884H7.71161V15.5053L12.2534 10.9635L13.0365 11.7466C12.9582 11.7466 8.49468 16.2884 8.49468 16.2884Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.ellipse-small.svg b/apps/web/src/assets/icons/tool.ellipse-small.svgnew file mode 100644index 00000000..4d5bd083--- /dev/null+++ b/apps/web/src/assets/icons/tool.ellipse-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.25 12C17.25 9.10051 14.8995 6.75 12 6.75C9.10051 6.75 6.75 9.10051 6.75 12C6.75 14.8995 9.10051 17.25 12 17.25V18.25L11.6787 18.2422C8.48265 18.0804 5.91964 15.5174 5.75781 12.3213L5.75 12C5.75 8.54822 8.54822 5.75 12 5.75L12.3213 5.75781C15.6238 5.92503 18.25 8.65597 18.25 12L18.2422 12.3213C18.075 15.6238 15.344 18.25 12 18.25V17.25C14.8995 17.25 17.25 14.8995 17.25 12Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.ellipse.svg b/apps/web/src/assets/icons/tool.ellipse.svgnew file mode 100644index 00000000..244b9588--- /dev/null+++ b/apps/web/src/assets/icons/tool.ellipse.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M18.8398 12C18.8398 8.22237 15.7776 5.16016 12 5.16016C8.22237 5.16016 5.16016 8.22237 5.16016 12C5.16016 15.7776 8.22237 18.8398 12 18.8398V20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20V18.8398C15.7776 18.8398 18.8398 15.7776 18.8398 12Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.polygon.svg b/apps/web/src/assets/icons/tool.polygon.svgnew file mode 100644index 00000000..9bb7dd81--- /dev/null+++ b/apps/web/src/assets/icons/tool.polygon.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.995 5.74028C11.4415 4.96694 12.5583 4.96694 13.0048 5.74028L19.2226 16.5098C19.6691 17.2831 19.1107 18.25 18.2177 18.25V17.0899L11.9999 6.32036L5.78215 17.0899V18.25L5.61809 18.2393C4.82286 18.13 4.35875 17.2347 4.77727 16.5098L10.995 5.74028ZM18.2177 17.0899V18.25H5.78215V17.0899H18.2177Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.rectangle-small.svg b/apps/web/src/assets/icons/tool.rectangle-small.svgnew file mode 100644index 00000000..b0ec7784--- /dev/null+++ b/apps/web/src/assets/icons/tool.rectangle-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.5996 6C16.9251 6 18 7.07491 18 8.40039V15.5996C18 16.9251 16.9251 18 15.5996 18H8.40039L8.1543 17.9873C6.94425 17.8642 6 16.8421 6 15.5996V8.40039C6 7.15787 6.94425 6.13576 8.1543 6.0127L8.40039 6H15.5996ZM8.40039 7C7.67551 7 7.07852 7.55087 7.00684 8.25684L7 8.40039V15.5996C7 16.3728 7.62719 17 8.40039 17H15.5996C16.3728 17 17 16.3728 17 15.5996V8.40039C17 7.67551 16.4491 7.07852 15.7432 7.00684L15.5996 7H8.40039Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.rectangle.svg b/apps/web/src/assets/icons/tool.rectangle.svgnew file mode 100644index 00000000..f8e3d388--- /dev/null+++ b/apps/web/src/assets/icons/tool.rectangle.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M6.93735 4.5C6.61727 4.5 6.30033 4.56304 6.00462 4.68553C5.7089 4.80802 5.44021 4.98755 5.21388 5.21388C4.98755 5.44021 4.80802 5.7089 4.68553 6.00462C4.56304 6.30033 4.5 6.61727 4.5 6.93735V17.0627C4.5 17.3827 4.56304 17.6997 4.68553 17.9954C4.80802 18.2911 4.98755 18.5598 5.21388 18.7861C5.44021 19.0124 5.7089 19.192 6.00462 19.3145C6.30033 19.437 6.61727 19.5 6.93735 19.5H17.0627C17.3827 19.5 17.6997 19.437 17.9954 19.3145C18.2911 19.192 18.5598 19.0124 18.7861 18.7861C19.0124 18.5598 19.192 18.2911 19.3145 17.9954C19.437 17.6997 19.5 17.3827 19.5 17.0627V6.93735C19.5 6.61727 19.437 6.30033 19.3145 6.00462C19.192 5.7089 19.0124 5.44021 18.7861 5.21388C18.5598 4.98755 18.2911 4.80802 17.9954 4.68553C17.6997 4.56304 17.3827 4.5 17.0627 4.5H6.93735ZM5.62493 6.93735C5.62493 6.21289 6.21289 5.62493 6.93735 5.62493H17.0627C17.7871 5.62493 18.3751 6.21289 18.3751 6.93735V17.0627C18.3751 17.4107 18.2368 17.7445 17.9907 17.9907C17.7445 18.2368 17.4107 18.3751 17.0627 18.3751H6.93735C6.58927 18.3751 6.25546 18.2368 6.00933 17.9907C5.7632 17.7445 5.62493 17.4107 5.62493 17.0627V6.93735Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.scene-frame.svg b/apps/web/src/assets/icons/tool.scene-frame.svgnew file mode 100644index 00000000..970aaf26--- /dev/null+++ b/apps/web/src/assets/icons/tool.scene-frame.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M16.0385 5.07692C16.0385 4.7583 15.7801 4.5 15.4615 4.5C15.143 4.5 14.8846 4.7583 14.8846 5.07692V7.96154H9.11538V5.07692C9.11538 4.7583 8.85708 4.5 8.53846 4.5C8.21984 4.5 7.96154 4.7583 7.96154 5.07692V7.96154H5.07692C4.7583 7.96154 4.5 8.21984 4.5 8.53846C4.5 8.85708 4.7583 9.11538 5.07692 9.11538H7.96154V14.8846H5.07692C4.7583 14.8846 4.5 15.143 4.5 15.4615C4.5 15.7801 4.7583 16.0385 5.07692 16.0385H7.96154V18.9231C7.96154 19.2417 8.21984 19.5 8.53846 19.5C8.85708 19.5 9.11538 19.2417 9.11538 18.9231V16.0385H14.8846V18.9231C14.8846 19.2417 15.143 19.5 15.4615 19.5C15.7801 19.5 16.0385 19.2417 16.0385 18.9231V16.0385H18.9231C19.2417 16.0385 19.5 15.7801 19.5 15.4615C19.5 15.143 19.2417 14.8846 18.9231 14.8846H16.0385V9.11538H18.9231C19.2417 9.11538 19.5 8.85708 19.5 8.53846C19.5 8.21984 19.2417 7.96154 18.9231 7.96154H16.0385V5.07692ZM14.8846 14.8846V9.11538H9.11538V14.8846H14.8846Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/tool.text.svg b/apps/web/src/assets/icons/tool.text.svgnew file mode 100644index 00000000..dfdf74d2--- /dev/null+++ b/apps/web/src/assets/icons/tool.text.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.70026 6.48981V8.36683C7.70026 8.6678 7.45627 8.91179 7.15531 8.91179C6.85433 8.91179 6.61035 8.6678 6.61035 8.36683V5.94488C6.61035 5.88726 6.61929 5.83174 6.63586 5.77961C6.70584 5.55943 6.91194 5.3999 7.15531 5.3999H16.8434C17.0316 5.3999 17.1973 5.49521 17.2953 5.64017C17.354 5.72714 17.3883 5.83199 17.3883 5.94486V8.36683C17.3883 8.6678 17.1444 8.91179 16.8434 8.91179C16.5424 8.91179 16.2984 8.6678 16.2984 8.36683V6.48981H12.6654V17.51H14.1239C14.4249 17.51 14.6688 17.754 14.6688 18.0549C14.6688 18.356 14.4249 18.5999 14.1239 18.5999H9.88535C9.58438 18.5999 9.34039 18.356 9.34039 18.0549C9.34039 17.754 9.58438 17.51 9.88535 17.51H11.3333V6.48981H7.70026Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/trash.svg b/apps/web/src/assets/icons/trash.svgnew file mode 100644index 00000000..e2587673--- /dev/null+++ b/apps/web/src/assets/icons/trash.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1331 5.93335C9.87541 5.93335 9.66647 6.14229 9.66647 6.40002C9.66647 6.65775 9.87541 6.86668 10.1331 6.86668H13.8665C14.1242 6.86668 14.3331 6.65775 14.3331 6.40002C14.3331 6.14229 14.1242 5.93335 13.8665 5.93335H10.1331ZM7.7998 8.26668C7.7998 8.00895 8.00874 7.80002 8.26647 7.80002H9.66647H14.3331H15.7331C15.9908 7.80002 16.1998 8.00895 16.1998 8.26668C16.1998 8.52441 15.9908 8.73335 15.7331 8.73335H15.2665V16.2C15.2665 16.7155 14.8486 17.1333 14.3331 17.1333H9.66647C9.15101 17.1333 8.73314 16.7155 8.73314 16.2V8.73335H8.26647C8.00874 8.73335 7.7998 8.52441 7.7998 8.26668ZM9.66647 8.73335H14.3331V16.2H9.66647V8.73335Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/unified-values.svg b/apps/web/src/assets/icons/unified-values.svgnew file mode 100644index 00000000..91b97f6d--- /dev/null+++ b/apps/web/src/assets/icons/unified-values.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.31818 14.127C8.31818 14.4774 8.31832 14.7162 8.33336 14.9004C8.34802 15.0795 8.37509 15.1712 8.40767 15.2352C8.48609 15.389 8.61103 15.5139 8.76483 15.5923C8.82877 15.625 8.92048 15.652 9.09961 15.6666C9.28373 15.6817 9.52263 15.6818 9.87305 15.6818H14.127C14.4774 15.6818 14.7162 15.6817 14.9004 15.6666C15.0795 15.652 15.1712 15.625 15.2352 15.5923C15.389 15.5139 15.5139 15.389 15.5923 15.2352C15.625 15.1712 15.652 15.0795 15.6666 14.9004C15.6817 14.7162 15.6818 14.4774 15.6818 14.127V9.87305C15.6818 9.52263 15.6817 9.28373 15.6666 9.09961C15.652 8.92048 15.625 8.82877 15.5923 8.76483C15.5139 8.61103 15.389 8.48609 15.2352 8.40767C15.1712 8.37509 15.0795 8.34802 14.9004 8.33336C14.7162 8.31832 14.4774 8.31818 14.127 8.31818H9.87305C9.52263 8.31818 9.28373 8.31832 9.09961 8.33336C8.92048 8.34802 8.82877 8.3751 8.76483 8.40767C8.61104 8.48609 8.48609 8.61104 8.40767 8.76483C8.3751 8.82877 8.34802 8.92048 8.33336 9.09961C8.31832 9.28373 8.31818 9.52263 8.31818 9.87305V14.127ZM16.5 14.1445C16.5 14.4737 16.4997 14.7454 16.4816 14.9667C16.4628 15.1967 16.423 15.4082 16.3218 15.6067C16.165 15.9145 15.9145 16.165 15.6067 16.3218C15.4082 16.423 15.1967 16.4628 14.9667 16.4816C14.7453 16.4997 14.4731 16.5 14.1437 16.5H9.85547C9.52633 16.5 9.25461 16.4997 9.03329 16.4816C8.80337 16.4628 8.59181 16.423 8.39329 16.3218C8.08544 16.165 7.83505 15.9145 7.67818 15.6067C7.57702 15.4082 7.53717 15.1967 7.51838 14.9667C7.50029 14.7454 7.49999 14.4736 7.5 14.1445V9.85547C7.49999 9.52633 7.50029 9.25461 7.51838 9.03329C7.53717 8.80337 7.57702 8.59181 7.67818 8.39329C7.83505 8.08545 8.08545 7.83505 8.39329 7.67818C8.59181 7.57702 8.80337 7.53717 9.03329 7.51838C9.25461 7.50029 9.52633 7.49999 9.85547 7.5H14.1437C14.4731 7.49999 14.7453 7.50029 14.9667 7.51838C15.1967 7.53717 15.4082 7.57702 15.6067 7.67818C15.9145 7.83505 16.165 8.08544 16.3218 8.39329C16.423 8.59181 16.4628 8.80337 16.4816 9.03329C16.4997 9.2546 16.5 9.52633 16.5 9.85547V14.1445Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/upgrade-pro-plan.svg b/apps/web/src/assets/icons/upgrade-pro-plan.svgnew file mode 100644index 00000000..9bfb7418--- /dev/null+++ b/apps/web/src/assets/icons/upgrade-pro-plan.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12.7384 6.09968C12.8268 6.09844 12.9146 6.11295 12.9971 6.14265L13.1163 6.19832L13.2237 6.27351C13.2893 6.32862 13.3447 6.39405 13.3878 6.46589L13.4434 6.5782L13.4796 6.69734C13.5065 6.81799 13.5052 6.94432 13.4747 7.06453C13.4732 7.07049 13.4706 7.07716 13.4688 7.08308L12.5098 10.3331C12.5078 10.3401 12.5054 10.3476 12.503 10.3546C12.4995 10.3647 12.4977 10.3773 12.4991 10.3897C12.5006 10.4021 12.5041 10.4121 12.5079 10.418L12.5098 10.42H15.9981C16.1457 10.4197 16.2896 10.4531 16.42 10.5157L16.547 10.5889L16.6602 10.6788C16.7663 10.7757 16.8505 10.8942 16.9083 11.0245C16.9851 11.1981 17.0137 11.3896 16.9932 11.5772C16.9727 11.7651 16.9031 11.9475 16.7882 12.1007C16.7795 12.1122 16.7695 12.1232 16.7598 12.1339L11.8126 17.6407L11.8106 17.6387C11.7048 17.7613 11.5613 17.8525 11.3946 17.8858C11.2179 17.921 11.0371 17.8893 10.8839 17.8009C10.7315 17.7128 10.6184 17.5762 10.5567 17.421C10.4953 17.2661 10.4846 17.0951 10.5255 16.9346C10.527 16.9287 10.5296 16.922 10.5313 16.9161L11.4903 13.6671L11.4971 13.6446C11.5006 13.6345 11.5025 13.6219 11.5011 13.6094C11.4996 13.5976 11.4959 13.588 11.4923 13.5821C11.4917 13.5812 11.4908 13.5798 11.4903 13.5792H8.00203V13.5782C7.80482 13.5786 7.61419 13.5194 7.4532 13.4102C7.29259 13.3012 7.16888 13.1485 7.09188 12.9747C7.01509 12.801 6.9864 12.6096 7.00691 12.4219C7.02753 12.2342 7.09709 12.0525 7.21199 11.8995L7.24031 11.8653L12.1876 6.35847L12.1886 6.36042C12.2945 6.23774 12.4387 6.14766 12.6055 6.11433L12.7384 6.09968ZM8.00984 12.503C8.00626 12.5088 8.00152 12.5181 8.00008 12.5303C7.99846 12.5452 8.00137 12.5599 8.00594 12.5704C8.00774 12.5744 8.01027 12.5772 8.0118 12.5792H11.5001C11.6262 12.579 11.7501 12.6038 11.8653 12.6505L11.9776 12.7042L12.0821 12.7716C12.1815 12.8451 12.2656 12.9371 12.3321 13.0401C12.4206 13.1774 12.4754 13.3337 12.4942 13.4942C12.512 13.6471 12.4955 13.8025 12.4483 13.9493L12.4493 13.9503L11.796 16.1622L15.9893 11.4952C15.9929 11.4893 15.9988 11.4808 16.0001 11.4688C16.0016 11.4542 15.9987 11.4401 15.9942 11.4298C15.9923 11.4255 15.9899 11.422 15.9884 11.42H12.5001V11.419C12.3318 11.4193 12.1677 11.3766 12.0225 11.295C11.8773 11.2133 11.7567 11.0965 11.668 10.9591C11.5797 10.8219 11.5247 10.6663 11.5059 10.5059C11.4873 10.3453 11.5047 10.1807 11.5577 10.0274L12.2032 7.83699L8.00984 12.503Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/upgrade.svg b/apps/web/src/assets/icons/upgrade.svgnew file mode 100644index 00000000..7e06301b--- /dev/null+++ b/apps/web/src/assets/icons/upgrade.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M11.6465 8.89648C11.8417 8.70126 12.1583 8.70124 12.3535 8.89648L14.8535 11.3965C15.0487 11.5917 15.0487 11.9083 14.8535 12.1035C14.6583 12.2988 14.3418 12.2987 14.1465 12.1035L12.5 10.457V14.75C12.5 15.0261 12.2761 15.2499 12 15.25C11.7239 15.25 11.5 15.0261 11.5 14.75V10.457L9.85352 12.1035C9.65828 12.2988 9.34175 12.2987 9.14648 12.1035C8.95122 11.9083 8.95122 11.5917 9.14648 11.3965L11.6465 8.89648Z" fill="currentColor"/>+<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.75C15.4518 5.75 18.25 8.54822 18.25 12C18.25 15.4518 15.4518 18.25 12 18.25C8.54822 18.25 5.75 15.4518 5.75 12C5.75 8.54822 8.54822 5.75 12 5.75ZM12 6.75C9.1005 6.75 6.75 9.1005 6.75 12C6.75 14.8995 9.1005 17.25 12 17.25C14.8995 17.25 17.25 14.8995 17.25 12C17.25 9.1005 14.8995 6.75 12 6.75Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/user.svg b/apps/web/src/assets/icons/user.svgnew file mode 100644index 00000000..3be11842--- /dev/null+++ b/apps/web/src/assets/icons/user.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.24951C15.7276 5.24977 18.7493 8.27241 18.7495 12C18.7492 15.7276 15.7276 18.7492 12 18.7495C8.27241 18.7493 5.24977 15.7276 5.24951 12C5.24971 8.27238 8.27238 5.24971 12 5.24951ZM11.999 13.7593C11.142 13.7594 10.3196 14.0998 9.71357 14.7058C9.1684 15.2512 8.83868 15.9714 8.77802 16.7346C9.69613 17.3606 10.8051 17.727 12 17.7271C13.1941 17.727 14.3024 17.3608 15.22 16.7356C15.1595 15.9719 14.8301 15.2515 14.2845 14.7058C13.6783 14.0997 12.8562 13.7593 11.999 13.7593ZM12 6.27192C8.83704 6.27212 6.27212 8.83704 6.27192 12C6.27205 13.5398 6.88168 14.9366 7.87043 15.9658C8.05521 15.2215 8.43944 14.5343 8.99069 13.9829C9.34013 13.6335 9.74434 13.3502 10.1828 13.1432C9.46112 12.5939 8.99269 11.7279 8.99269 10.751C8.99314 9.09105 10.3391 7.74509 11.999 7.74463C13.6593 7.74463 15.0059 9.09077 15.0063 10.751C15.0063 11.728 14.5383 12.5939 13.8162 13.1432C14.2546 13.3503 14.6579 13.6335 15.0073 13.9829C15.5591 14.5347 15.9439 15.2219 16.1286 15.9668C17.1178 14.9376 17.727 13.5403 17.7271 12C17.7269 8.83707 15.1629 6.27218 12 6.27192ZM11.999 8.76704C10.9038 8.7675 10.0156 9.65572 10.0151 10.751C10.0151 11.8466 10.9035 12.7354 11.999 12.7359C13.0949 12.7359 13.9839 11.8469 13.9839 10.751C13.9835 9.65543 13.0946 8.76704 11.999 8.76704Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/variants.svg b/apps/web/src/assets/icons/variants.svgnew file mode 100644index 00000000..391c1786--- /dev/null+++ b/apps/web/src/assets/icons/variants.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M17.7173 12.2945C17.6116 12.4638 17.4715 12.6089 17.3062 12.7205L12.9964 15.6298C12.702 15.8286 12.355 15.9348 11.9998 15.9348C11.6446 15.9348 11.2975 15.8286 11.0032 15.6298L6.69337 12.7205C6.43543 12.5465 6.24154 12.2929 6.14134 11.9983C6.04113 11.7037 6.04011 11.3844 6.13844 11.0892L11.0117 14.3376C11.2853 14.5199 11.6041 14.623 11.9326 14.6353C12.2611 14.6476 12.5867 14.5687 12.8732 14.4074L12.9871 14.3376L17.8604 11.0892C17.9268 11.2883 17.9484 11.4995 17.9236 11.7079C17.8989 11.9163 17.8284 12.1166 17.7173 12.2945ZM17.8604 13.4044C17.9593 13.6995 17.9587 14.0189 17.8585 14.3136C17.7584 14.6083 17.5644 14.8619 17.3062 15.0357L12.9964 17.945C12.702 18.1438 12.355 18.25 11.9998 18.25C11.6446 18.25 11.2975 18.1438 11.0032 17.945L6.69337 15.0357C6.43543 14.8617 6.24154 14.608 6.14134 14.3135C6.04113 14.0189 6.04011 13.6996 6.13844 13.4044L11.0117 16.6528C11.2853 16.8351 11.6041 16.9382 11.9326 16.9505C12.2611 16.9628 12.5867 16.8839 12.8732 16.7226L12.9871 16.6528L17.8604 13.4044ZM12.9878 6.04922L17.5221 9.0718C17.6196 9.13685 17.6996 9.22499 17.755 9.32838C17.8103 9.43177 17.8392 9.54722 17.8392 9.66449C17.8392 9.78175 17.8103 9.8972 17.755 10.0006C17.6996 10.104 17.6196 10.1921 17.5221 10.2572L12.9878 13.2805C12.6953 13.4756 12.3515 13.5797 11.9998 13.5797C11.6481 13.5797 11.3043 13.4756 11.0117 13.2805L6.47752 10.2572C6.37996 10.1921 6.29996 10.104 6.24464 10.0006C6.18931 9.8972 6.16036 9.78175 6.16036 9.66449C6.16036 9.54722 6.18931 9.43177 6.24464 9.32838C6.29996 9.22499 6.37996 9.13685 6.47752 9.0718L11.0117 6.04922C11.3043 5.85412 11.6481 5.75 11.9998 5.75C12.3515 5.75 12.6953 5.85412 12.9878 6.04922ZM11.6864 6.89053L11.6037 6.93826L7.51544 9.66449L11.6044 12.3914C11.7081 12.4605 11.828 12.5011 11.9522 12.5094C12.0764 12.5176 12.2007 12.4932 12.3125 12.4384L12.3952 12.3914L16.4834 9.66449L12.3944 6.93826C12.291 6.86924 12.1712 6.82851 12.0471 6.82014C11.923 6.81177 11.7982 6.83603 11.6864 6.89053Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/vary.svg b/apps/web/src/assets/icons/vary.svgnew file mode 100644index 00000000..78772991--- /dev/null+++ b/apps/web/src/assets/icons/vary.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M12.333 6.83492C12.333 6.75465 12.3136 6.67557 12.2766 6.60436C12.2395 6.53315 12.1859 6.4719 12.1201 6.42581C12.0544 6.37971 11.9786 6.35011 11.899 6.33951C11.8194 6.32891 11.7385 6.33763 11.663 6.36492L7.10301 8.01492C6.87753 8.09644 6.68264 8.24545 6.54486 8.44168C6.40708 8.63791 6.33311 8.87182 6.33301 9.11159V13.1663C6.33304 13.2465 6.3524 13.3256 6.38945 13.3968C6.4265 13.468 6.48015 13.5293 6.54587 13.5754C6.61158 13.6215 6.68743 13.6511 6.767 13.6617C6.84657 13.6723 6.92752 13.6635 7.00301 13.6363L7.33301 13.5169V14.5803C7.10683 14.6602 6.86477 14.6848 6.62715 14.6518C6.38952 14.6189 6.16326 14.5295 5.96734 14.391C5.77143 14.2526 5.61157 14.0692 5.5012 13.8562C5.39083 13.6432 5.33315 13.4068 5.33301 13.1669V9.11092C5.33301 8.66561 5.47023 8.23111 5.72598 7.86656C5.98174 7.50202 6.34361 7.22513 6.76234 7.07359L11.3223 5.42359C11.549 5.34154 11.792 5.3153 12.0309 5.3471C12.2698 5.37889 12.4975 5.46778 12.6948 5.60625C12.892 5.74471 13.053 5.92867 13.1641 6.14254C13.2752 6.35642 13.3332 6.59391 13.333 6.83492V6.95292L12.333 7.31492V6.83492ZM14.9997 8.83492C14.9996 8.75465 14.9803 8.67557 14.9432 8.60436C14.9062 8.53315 14.8525 8.4719 14.7868 8.42581C14.7211 8.37971 14.6453 8.35011 14.5657 8.33951C14.4861 8.32891 14.4052 8.33763 14.3297 8.36492L9.54967 10.0936C9.38851 10.1519 9.24923 10.2584 9.15081 10.3987C9.05238 10.539 8.99961 10.7062 8.99967 10.8776V15.1656C8.99971 15.2459 9.01907 15.3249 9.05612 15.3962C9.09317 15.4674 9.14682 15.5286 9.21253 15.5747C9.27825 15.6208 9.3541 15.6504 9.43367 15.661C9.51323 15.6716 9.59419 15.6629 9.66967 15.6356L9.99967 15.5169V16.5809C9.77339 16.6609 9.53122 16.6855 9.29348 16.6525C9.05575 16.6195 8.82941 16.5299 8.63346 16.3913C8.43752 16.2527 8.27769 16.0691 8.16741 15.856C8.05712 15.6428 7.9996 15.4063 7.99967 15.1663V10.8783C7.99951 10.5013 8.11553 10.1335 8.33193 9.82491C8.54833 9.51629 8.85459 9.28188 9.20901 9.15359L13.989 7.42359C14.2156 7.34154 14.4587 7.3153 14.6976 7.3471C14.9365 7.37889 15.1642 7.46778 15.3615 7.60625C15.5587 7.74471 15.7197 7.92867 15.8308 8.14254C15.9419 8.35642 15.9998 8.59391 15.9997 8.83492V8.95292L14.9997 9.31492V8.83492ZM16.9963 10.3649C17.0718 10.3376 17.1528 10.3289 17.2324 10.3395C17.3119 10.3501 17.3878 10.3797 17.4535 10.4258C17.5192 10.4719 17.5728 10.5331 17.6099 10.6044C17.6469 10.6756 17.6663 10.7546 17.6663 10.8349V15.3569C17.6663 15.4597 17.6346 15.5599 17.5755 15.644C17.5165 15.7281 17.433 15.792 17.3363 15.8269L12.3363 17.6363C12.2609 17.6635 12.1799 17.6723 12.1003 17.6617C12.0208 17.6511 11.9449 17.6215 11.8792 17.5754C11.8135 17.5293 11.7598 17.468 11.7228 17.3968C11.6857 17.3256 11.6664 17.2465 11.6663 17.1663V12.6443C11.6664 12.5415 11.6981 12.4412 11.7571 12.3572C11.8162 12.2731 11.8997 12.2092 11.9963 12.1743L16.9963 10.3649ZM18.6663 10.8349C18.6664 10.594 18.6084 10.3566 18.4972 10.1428C18.3861 9.92898 18.2251 9.74511 18.0278 9.60672C17.8306 9.46834 17.6029 9.3795 17.3641 9.34774C17.1252 9.31598 16.8822 9.34222 16.6557 9.42425L11.6557 11.2336C11.3658 11.3385 11.1153 11.5303 10.9383 11.7827C10.7612 12.0351 10.6663 12.3359 10.6663 12.6443V17.1663C10.6663 17.4072 10.7243 17.6446 10.8354 17.8584C10.9466 18.0722 11.1076 18.2561 11.3048 18.3945C11.5021 18.5328 11.7298 18.6217 11.9686 18.6534C12.2075 18.6852 12.4504 18.659 12.677 18.5769L17.677 16.7676C17.9669 16.6626 18.2174 16.4709 18.3944 16.2185C18.5715 15.9661 18.6664 15.6652 18.6663 15.3569V10.8349Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/vertical-align-bottom.svg b/apps/web/src/assets/icons/vertical-align-bottom.svgnew file mode 100644index 00000000..fdceef88--- /dev/null+++ b/apps/web/src/assets/icons/vertical-align-bottom.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" d="M19.3231 19.125C19.4806 19.125 19.6316 19.0624 19.7429 18.9511C19.8543 18.8397 19.9168 18.6887 19.9168 18.5313C19.9168 18.3738 19.8543 18.2228 19.7429 18.1114C19.6316 18.0001 19.4806 17.9375 19.3231 17.9375L4.67725 17.9375C4.51977 17.9375 4.36875 18.0001 4.2574 18.1114C4.14605 18.2228 4.0835 18.3738 4.0835 18.5312C4.0835 18.6887 4.14605 18.8397 4.2574 18.9511C4.36875 19.0624 4.51977 19.125 4.67725 19.125L19.3231 19.125Z" fill="currentColor"/>+<path d="M14.375 14.375C14.375 15.6867 13.3117 16.75 12 16.75C10.6883 16.75 9.625 15.6867 9.625 14.375L9.625 7.25C9.625 5.93832 10.6883 4.875 12 4.875C13.3117 4.875 14.375 5.93832 14.375 7.25L14.375 14.375Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/vertical-align-center.svg b/apps/web/src/assets/icons/vertical-align-center.svgnew file mode 100644index 00000000..1a496a67--- /dev/null+++ b/apps/web/src/assets/icons/vertical-align-center.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" d="M19.3231 12.5938C19.4806 12.5938 19.6316 12.5312 19.7429 12.4198C19.8543 12.3085 19.9168 12.1575 19.9168 12C19.9168 11.8425 19.8543 11.6915 19.7429 11.5802C19.6316 11.4688 19.4806 11.4062 19.3231 11.4062C14.4411 11.4062 9.55919 11.4062 4.67725 11.4062C4.51977 11.4062 4.36875 11.4688 4.2574 11.5802C4.14605 11.6915 4.0835 11.8425 4.0835 12C4.0835 12.1575 4.14605 12.3085 4.2574 12.4198C4.36875 12.5312 4.51977 12.5938 4.67725 12.5938C13.4764 12.5938 10.6119 12.5938 19.3231 12.5938Z" fill="currentColor"/>+<path d="M14.375 8.4375C14.375 7.12582 13.3117 6.0625 12 6.0625C10.6883 6.0625 9.625 7.12582 9.625 8.4375V15.5625C9.625 16.8742 10.6883 17.9375 12 17.9375C13.3117 17.9375 14.375 16.8742 14.375 15.5625V8.4375Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/vertical-align-top.svg b/apps/web/src/assets/icons/vertical-align-top.svgnew file mode 100644index 00000000..b78e4af5--- /dev/null+++ b/apps/web/src/assets/icons/vertical-align-top.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path opacity="0.35" d="M4.67725 4.875C4.51977 4.875 4.36875 4.93756 4.2574 5.04891C4.14605 5.16025 4.0835 5.31128 4.0835 5.46875C4.0835 5.62622 4.14605 5.77724 4.2574 5.88859C4.36875 5.99994 4.51977 6.0625 4.67725 6.0625H19.3231C19.4806 6.0625 19.6316 5.99994 19.7429 5.88859C19.8543 5.77724 19.9168 5.62622 19.9168 5.46875C19.9168 5.31128 19.8543 5.16025 19.7429 5.04891C19.6316 4.93756 19.4806 4.875 19.3231 4.875H4.67725Z" fill="currentColor"/>+<path d="M9.625 9.625C9.625 8.31332 10.6883 7.25 12 7.25C13.3117 7.25 14.375 8.31332 14.375 9.625V16.75C14.375 18.0617 13.3117 19.125 12 19.125C10.6883 19.125 9.625 18.0617 9.625 16.75V9.625Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/vertical-knob-line.svg b/apps/web/src/assets/icons/vertical-knob-line.svgnew file mode 100644index 00000000..ff5f5aae--- /dev/null+++ b/apps/web/src/assets/icons/vertical-knob-line.svg@@ -0,0 +1,5 @@+<svg preserveAspectRatio="none" overflow="visible" style="display: block;" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">+<g id="Knob">+<path id="Vector" fill-rule="evenodd" clip-rule="evenodd" d="M17 10.0002C17 9.44796 17.4477 9.00024 18 9.00024C18.5523 9.00024 19 9.44796 19 10.0002V19.0002C19 19.5525 18.5523 20.0002 18 20.0002C17.4477 20.0002 17 19.5525 17 19.0002V10.0002Z" fill="currentColor"/>+</g>+</svg>diff --git a/apps/web/src/assets/icons/video-small.svg b/apps/web/src/assets/icons/video-small.svgnew file mode 100644index 00000000..6cdad73f--- /dev/null+++ b/apps/web/src/assets/icons/video-small.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M16.5 6.50049C17.0523 6.50049 17.5 6.9482 17.5 7.50049V16.5005C17.4997 17.0525 17.0521 17.5005 16.5 17.5005H7.5C6.94788 17.5005 6.50026 17.0525 6.5 16.5005V7.50049C6.5 6.9482 6.94772 6.50049 7.5 6.50049H16.5ZM7.5 16.5005H16.5V7.50049H7.5V16.5005ZM10.25 10.1724C10.2503 9.74087 10.6873 9.46026 11.0713 9.61475L11.1475 9.65186L14.3457 11.48C14.7488 11.7103 14.7488 12.2907 14.3457 12.521L11.1475 14.3491C10.7476 14.5774 10.2503 14.289 10.25 13.8286V10.1724ZM11.25 13.1382L13.2412 12.0005L11.25 10.8618V13.1382Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/video-transition.svg b/apps/web/src/assets/icons/video-transition.svgnew file mode 100644index 00000000..05ec631a--- /dev/null+++ b/apps/web/src/assets/icons/video-transition.svg@@ -0,0 +1,18 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.5 14.5996C7.5 15.0279 7.50016 15.3198 7.51855 15.5449C7.53647 15.7639 7.56956 15.8759 7.60938 15.9541C7.70522 16.1421 7.85793 16.2948 8.0459 16.3906C8.12405 16.4305 8.23614 16.4635 8.45508 16.4814C8.68012 16.4998 8.9721 16.5 9.40039 16.5H14.5996C15.0279 16.5 15.3198 16.4998 15.5449 16.4814C15.7639 16.4635 15.8759 16.4305 15.9541 16.3906C16.1421 16.2948 16.2948 16.1421 16.3906 15.9541C16.4305 15.8759 16.4635 15.7639 16.4814 15.5449C16.4998 15.3198 16.5 15.0279 16.5 14.5996V9.40039C16.5 8.9721 16.4998 8.68012 16.4814 8.45508C16.4635 8.23614 16.4305 8.12405 16.3906 8.0459C16.2948 7.85793 16.1421 7.70522 15.9541 7.60938C15.8759 7.56956 15.7639 7.53647 15.5449 7.51855C15.3198 7.50016 15.0279 7.5 14.5996 7.5H9.40039C8.9721 7.5 8.68012 7.50016 8.45508 7.51855C8.23615 7.53647 8.12405 7.56956 8.0459 7.60938C7.85793 7.70522 7.70522 7.85793 7.60938 8.0459C7.56956 8.12405 7.53647 8.23615 7.51855 8.45508C7.50016 8.68012 7.5 8.9721 7.5 9.40039V14.5996ZM17.5 14.6211C17.5 15.0234 17.4996 15.3555 17.4775 15.626C17.4545 15.907 17.4059 16.1655 17.2822 16.4082C17.0905 16.7844 16.7844 17.0905 16.4082 17.2822C16.1655 17.4059 15.907 17.4545 15.626 17.4775C15.3554 17.4996 15.0226 17.5 14.6201 17.5H9.37891C8.97663 17.5 8.64452 17.4996 8.37402 17.4775C8.09301 17.4545 7.83444 17.4059 7.5918 17.2822C7.21554 17.0905 6.9095 16.7844 6.71777 16.4082C6.59414 16.1655 6.54542 15.907 6.52246 15.626C6.50036 15.3555 6.49999 15.0233 6.5 14.6211V9.37891C6.49999 8.97663 6.50036 8.64452 6.52246 8.37402C6.54542 8.09301 6.59414 7.83444 6.71777 7.5918C6.9095 7.21555 7.21555 6.9095 7.5918 6.71777C7.83444 6.59414 8.09301 6.54542 8.37402 6.52246C8.64452 6.50036 8.97663 6.49999 9.37891 6.5H14.6201C15.0226 6.49999 15.3554 6.50035 15.626 6.52246C15.907 6.54542 16.1655 6.59414 16.4082 6.71777C16.7844 6.9095 17.0905 7.21554 17.2822 7.5918C17.4059 7.83444 17.4545 8.09301 17.4775 8.37402C17.4996 8.64451 17.5 8.97663 17.5 9.37891V14.6211Z" fill="currentColor"/>+<g clip-path="url(#clip0_2219_256885)">+<rect opacity="0.8" x="7.5" y="17" width="10" height="0.6" transform="rotate(-90 7.5 17)" fill="currentColor"/>+<rect opacity="0.7" x="8.1001" y="17" width="10" height="0.6" transform="rotate(-90 8.1001 17)" fill="currentColor"/>+<rect opacity="0.6" x="8.7002" y="17" width="10" height="0.6" transform="rotate(-90 8.7002 17)" fill="currentColor"/>+<rect opacity="0.5" x="9.2998" y="17" width="10" height="0.6" transform="rotate(-90 9.2998 17)" fill="currentColor"/>+<rect opacity="0.4" x="9.8999" y="17" width="10" height="0.6" transform="rotate(-90 9.8999 17)" fill="currentColor"/>+<rect opacity="0.3" x="10.5" y="17" width="10" height="0.6" transform="rotate(-90 10.5 17)" fill="currentColor"/>+<rect opacity="0.2" x="11.1001" y="17" width="10" height="0.6" transform="rotate(-90 11.1001 17)" fill="currentColor"/>+<rect opacity="0.1" x="11.7002" y="17" width="10" height="0.6" transform="rotate(-90 11.7002 17)" fill="currentColor"/>+</g>+<defs>+<clipPath id="clip0_2219_256885">+<path d="M8.5 17C7.94771 17 7.5 16.5523 7.5 16L7.5 8C7.5 7.44772 7.94771 7 8.5 7L12.3 7L12.3 17L8.5 17Z" fill="white"/>+</clipPath>+</defs>+</svg>diff --git a/apps/web/src/assets/icons/video.svg b/apps/web/src/assets/icons/video.svgnew file mode 100644index 00000000..37da5b6c--- /dev/null+++ b/apps/web/src/assets/icons/video.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.0713 6.00049C17.584 6.00049 17.9998 6.41555 18 6.92822V17.0718C17.9998 17.5845 17.584 18.0005 17.0713 18.0005H6.92871C6.41599 18.0005 6.00019 17.5845 6 17.0718V6.92822C6.00019 6.41555 6.41599 6.00049 6.92871 6.00049H17.0713ZM6.92871 17.0718H17.0713V6.92822H6.92871V17.0718ZM10 9.67041C10.0002 9.27724 10.4023 9.02483 10.749 9.17236L10.8174 9.20752L14.7002 11.5366C15.0498 11.7464 15.0498 12.2536 14.7002 12.4634L10.8174 14.7925C10.4575 15.0081 10.0001 14.7491 10 14.3296V9.67041ZM11 13.5171L13.5273 11.9995L11 10.4819V13.5171Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/view.grid.svg b/apps/web/src/assets/icons/view.grid.svgnew file mode 100644index 00000000..8e36865d--- /dev/null+++ b/apps/web/src/assets/icons/view.grid.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.6025 12.5049C11.1067 12.5562 11.5 12.9823 11.5 13.5V17L11.4951 17.1025C11.4472 17.573 11.073 17.9472 10.6025 17.9951L10.5 18H7C6.48232 18 6.05621 17.6067 6.00488 17.1025L6 17V13.5C6 12.9477 6.44772 12.5 7 12.5H10.5L10.6025 12.5049ZM17.1025 12.5049C17.6067 12.5562 18 12.9823 18 13.5V17L17.9951 17.1025C17.9472 17.573 17.573 17.9472 17.1025 17.9951L17 18H13.5C12.9823 18 12.5562 17.6067 12.5049 17.1025L12.5 17V13.5C12.5 12.9477 12.9477 12.5 13.5 12.5H17L17.1025 12.5049ZM13.5 17H17V13.5H13.5V17ZM7 17H10.5V13.5H7V17ZM10.6025 6.00488C11.1067 6.05621 11.5 6.48232 11.5 7V10.5L11.4951 10.6025C11.4472 11.073 11.073 11.4472 10.6025 11.4951L10.5 11.5H7C6.48232 11.5 6.05621 11.1067 6.00488 10.6025L6 10.5V7C6 6.44772 6.44772 6 7 6H10.5L10.6025 6.00488ZM17.1025 6.00488C17.6067 6.05621 18 6.48232 18 7V10.5L17.9951 10.6025C17.9472 11.073 17.573 11.4472 17.1025 11.4951L17 11.5H13.5C12.9823 11.5 12.5562 11.1067 12.5049 10.6025L12.5 10.5V7C12.5 6.44772 12.9477 6 13.5 6H17L17.1025 6.00488ZM7 10.5H10.5V7H7V10.5ZM13.5 10.5H17V7H13.5V10.5Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/icons/voice.svg b/apps/web/src/assets/icons/voice.svgnew file mode 100644index 00000000..c41d5873--- /dev/null+++ b/apps/web/src/assets/icons/voice.svg@@ -0,0 +1,5 @@+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.63282 5.43474C10.6074 5.24243 12.4013 6.59103 12.7656 8.54118C12.8089 8.77266 12.831 9.00786 12.8311 9.24333V10.7092C12.8311 10.7161 12.834 10.7228 12.8389 10.7277L14.0967 11.9318C14.597 12.4108 14.3689 13.253 13.6953 13.4142L12.8311 13.6213V14.5695C12.8311 16.3092 11.0157 17.4532 9.4463 16.7023L9.38868 16.675C8.81749 16.4019 8.13617 16.5107 7.67872 16.9484C7.37868 17.2356 7.20903 17.6337 7.20899 18.049V18.5011C7.20899 18.7083 7.0411 18.8761 6.83399 18.8761C6.62707 18.8759 6.45899 18.7081 6.45899 18.5011V18.049C6.45903 17.429 6.71225 16.8351 7.16016 16.4064C7.843 15.753 8.85932 15.5915 9.71192 15.9992L9.76954 16.0265C10.8411 16.5392 12.0811 15.7574 12.0811 14.5695V13.3713C12.0811 13.1716 12.218 12.9971 12.4121 12.9504L13.5205 12.6847C13.6167 12.6617 13.6494 12.5423 13.5781 12.4738L12.3203 11.2697C12.1676 11.1233 12.0811 10.9207 12.0811 10.7092V9.24333C12.081 9.05404 12.0631 8.86496 12.0283 8.67888C11.7354 7.11086 10.2928 6.02611 8.70509 6.18083L8.33594 6.21697C7.00818 6.34668 5.96758 7.41639 5.87403 8.74724C5.85932 8.95365 5.68011 9.1094 5.47364 9.0949C5.26726 9.08023 5.11159 8.90092 5.12598 8.6945C5.24519 6.99838 6.57141 5.6359 8.26368 5.47087L8.63282 5.43474Z" fill="currentColor"/>+<path d="M17.792 7.68865C17.9643 7.57405 18.1977 7.62093 18.3125 7.79314C20.2126 10.6439 20.2128 14.3585 18.3125 17.2092C18.1977 17.381 17.9642 17.4279 17.792 17.3136C17.6199 17.1989 17.5731 16.9654 17.6875 16.7931C19.4201 14.1943 19.4199 10.8081 17.6875 8.20915C17.5729 8.03694 17.62 7.80354 17.792 7.68865Z" fill="currentColor"/>+<path d="M15.7656 9.7072C15.9273 9.57789 16.1636 9.60426 16.293 9.76579C17.5717 11.3643 17.5717 13.636 16.293 15.2345C16.1636 15.396 15.9273 15.4224 15.7656 15.2931C15.6042 15.1638 15.578 14.9274 15.707 14.7658C16.7667 13.4412 16.7666 11.5591 15.707 10.2345C15.5779 10.0729 15.6042 9.83657 15.7656 9.7072Z" fill="currentColor"/>+</svg>diff --git a/apps/web/src/assets/images/placeholder112x63.png b/apps/web/src/assets/images/placeholder112x63.pngnew file mode 100644index 00000000..d4ecabf1Binary files /dev/null and b/apps/web/src/assets/images/placeholder112x63.png differdiff --git a/apps/web/src/assets/images/placeholder232x130.png b/apps/web/src/assets/images/placeholder232x130.pngnew file mode 100644index 00000000..45365f6cBinary files /dev/null and b/apps/web/src/assets/images/placeholder232x130.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/0.png b/apps/web/src/assets/images/voice-thumbnails/0.pngnew file mode 100644index 00000000..ae28d04cBinary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/0.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/1.png b/apps/web/src/assets/images/voice-thumbnails/1.pngnew file mode 100644index 00000000..ce28acf8Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/1.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/10.png b/apps/web/src/assets/images/voice-thumbnails/10.pngnew file mode 100644index 00000000..b6dc1854Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/10.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/11.png b/apps/web/src/assets/images/voice-thumbnails/11.pngnew file mode 100644index 00000000..f01d8698Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/11.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/12.png b/apps/web/src/assets/images/voice-thumbnails/12.pngnew file mode 100644index 00000000..a33ee45bBinary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/12.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/13.png b/apps/web/src/assets/images/voice-thumbnails/13.pngnew file mode 100644index 00000000..56a39ec1Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/13.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/14.png b/apps/web/src/assets/images/voice-thumbnails/14.pngnew file mode 100644index 00000000..a77a30a5Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/14.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/15.png b/apps/web/src/assets/images/voice-thumbnails/15.pngnew file mode 100644index 00000000..89a0d513Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/15.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/16.png b/apps/web/src/assets/images/voice-thumbnails/16.pngnew file mode 100644index 00000000..bfc0c893Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/16.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/17.png b/apps/web/src/assets/images/voice-thumbnails/17.pngnew file mode 100644index 00000000..b087c9fdBinary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/17.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/2.png b/apps/web/src/assets/images/voice-thumbnails/2.pngnew file mode 100644index 00000000..1d98023fBinary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/2.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/3.png b/apps/web/src/assets/images/voice-thumbnails/3.pngnew file mode 100644index 00000000..b1e1703eBinary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/3.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/4.png b/apps/web/src/assets/images/voice-thumbnails/4.pngnew file mode 100644index 00000000..7784cd75Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/4.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/5.png b/apps/web/src/assets/images/voice-thumbnails/5.pngnew file mode 100644index 00000000..3bea639eBinary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/5.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/6.png b/apps/web/src/assets/images/voice-thumbnails/6.pngnew file mode 100644index 00000000..f45cf2e2Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/6.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/7.png b/apps/web/src/assets/images/voice-thumbnails/7.pngnew file mode 100644index 00000000..87621241Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/7.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/8.png b/apps/web/src/assets/images/voice-thumbnails/8.pngnew file mode 100644index 00000000..c49b4b11Binary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/8.png differdiff --git a/apps/web/src/assets/images/voice-thumbnails/9.png b/apps/web/src/assets/images/voice-thumbnails/9.pngnew file mode 100644index 00000000..b024b21fBinary files /dev/null and b/apps/web/src/assets/images/voice-thumbnails/9.png differdiff --git a/apps/web/src/components/app-context-menu.tsx b/apps/web/src/components/app-context-menu.tsxnew file mode 100644index 00000000..dbee4b44--- /dev/null+++ b/apps/web/src/components/app-context-menu.tsx@@ -0,0 +1,105 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { JSX } from "solid-js"+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuPortal,+ ContextMenuSeparator,+ ContextMenuShortcut,+ ContextMenuTrigger,+} from "@/components/ui/context-menu"++export function AppContextMenu(props: { children: JSX.Element }) {+ const handleUndo = () => {+ document.execCommand("undo")+ }++ const handleRedo = () => {+ document.execCommand("redo")+ }++ const handleCut = () => {+ document.execCommand("cut")+ }++ const handleCopy = () => {+ document.execCommand("copy")+ }++ const handlePaste = async () => {+ try {+ const text = await navigator.clipboard.readText()+ document.execCommand("insertText", false, text)+ } catch {+ document.execCommand("paste")+ }+ }++ const handleSelectAll = () => {+ document.execCommand("selectAll")+ }++ const handleFullscreen = () => {+ if (document.fullscreenElement) {+ void document.exitFullscreen()+ } else {+ void document.documentElement.requestFullscreen()+ }+ }++ const handleReload = () => {+ window.location.reload()+ }+++ return (+ <ContextMenu>+ <ContextMenuTrigger class="contents">+ {props.children}+ </ContextMenuTrigger>+ <ContextMenuPortal>+ <ContextMenuContent class="w-[200px]">+ <ContextMenuItem onSelect={handleUndo}>+ Undo+ <ContextMenuShortcut>⌘Z</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuItem onSelect={handleRedo}>+ Redo+ <ContextMenuShortcut>⇧⌘Z</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleCut}>+ Cut+ <ContextMenuShortcut>⌘X</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuItem onSelect={handleCopy}>+ Copy+ <ContextMenuShortcut>⌘C</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuItem onSelect={handlePaste}>+ Paste+ <ContextMenuShortcut>⌘V</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuItem onSelect={handleSelectAll}>+ Select All+ <ContextMenuShortcut>⌘A</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleFullscreen}>+ {document.fullscreenElement ? "Exit Fullscreen" : "Fullscreen"}+ <ContextMenuShortcut>F11</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleReload}>+ Reload+ <ContextMenuShortcut>⌘R</ContextMenuShortcut>+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ )+}diff --git a/apps/web/src/components/assets/actions.ts b/apps/web/src/components/assets/actions.tsnew file mode 100644index 00000000..d25a0297--- /dev/null+++ b/apps/web/src/components/assets/actions.ts@@ -0,0 +1,29 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { toast } from "somoto";++import type { Asset } from "@/components/engine/db";++/**+ * Download an asset file and handle user-facing failure feedback.+ */+export async function downloadAsset(asset: Asset): Promise<void> {+ let url: string | null = null;++ try {+ const file = await asset.handle.getFile();+ url = URL.createObjectURL(file);++ const anchor = document.createElement("a");+ anchor.href = url;+ anchor.download = asset.name;+ anchor.click();+ } catch (error) {+ const message = error instanceof Error ? error.message : "Unknown download error";+ toast("Failed to download", { description: message });+ } finally {+ if (url) URL.revokeObjectURL(url);+ }+}diff --git a/apps/web/src/components/assets/file-name.ts b/apps/web/src/components/assets/file-name.tsnew file mode 100644index 00000000..79ed58b3--- /dev/null+++ b/apps/web/src/components/assets/file-name.ts@@ -0,0 +1,79 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createMemo, createSignal, onCleanup, type Accessor } from "solid-js";++type TruncatedName = {+ shouldTruncate: boolean;+ start: string;+ end: string;+};++type ExpandableFileName = {+ showFullName: Accessor<boolean>;+ truncatedName: Accessor<TruncatedName>;+ closeFullName: () => void;+ toggleFullName: () => void;+ showCompleteName: () => void;+ setContainerRef: (node: HTMLDivElement | undefined) => void;+};++export function createExpandableFileName(name: Accessor<string>): ExpandableFileName {+ const [showFullName, setShowFullName] = createSignal(false);+ let containerRef: HTMLDivElement | undefined;++ const truncatedName = createMemo<TruncatedName>(() => {+ const value = name();+ const startLength = 24;+ const endLength = 9;+ const dotIndex = value.lastIndexOf(".");+ const hasExt = dotIndex > 0 && dotIndex < value.length - 1;+ const base = hasExt ? value.slice(0, dotIndex) : value;+ const ext = hasExt ? value.slice(dotIndex) : "";+ const endBaseLength = Math.max(0, endLength - ext.length);+ const shouldTruncate = base.length > startLength + endBaseLength;+ const start = base.slice(0, startLength);+ const endBase = endBaseLength > 0 ? base.slice(-endBaseLength) : "";+ const end = ext ? `${endBase}${ext}` : endBase;++ return { shouldTruncate, start, end };+ });++ const closeFullName = () => setShowFullName(false);+ const showCompleteName = () => setShowFullName(true);++ const toggleFullName = () => {+ if (!truncatedName().shouldTruncate) return;+ setShowFullName((prev) => !prev);+ };++ const setContainerRef = (node: HTMLDivElement | undefined) => {+ containerRef = node;+ };++ createEffect(() => {+ if (!showFullName()) return;+ if (typeof document === "undefined") return;++ const handlePointerDown = (event: PointerEvent) => {+ const target = event.target as Node | null;+ if (target && containerRef?.contains(target)) return;+ closeFullName();+ };++ document.addEventListener("pointerdown", handlePointerDown);+ onCleanup(() => {+ document.removeEventListener("pointerdown", handlePointerDown);+ });+ });++ return {+ showFullName,+ truncatedName,+ closeFullName,+ toggleFullName,+ showCompleteName,+ setContainerRef,+ };+}diff --git a/apps/web/src/components/canvas/canvas.tsx b/apps/web/src/components/canvas/canvas.tsxnew file mode 100644index 00000000..69be03f1--- /dev/null+++ b/apps/web/src/components/canvas/canvas.tsx@@ -0,0 +1,165 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useEngine } from "@/context/engine";+import { loadAsset } from "@/components/engine";+import { Toolbar } from "./toolbar";+import { DrawOverlay } from "./draw-overlay";+import { toast } from "somoto"+import { findSceneAt, screenToWorld, worldToLocal, secondsToFrames, GeometryType, PaintType, createEntity, addComponent, appendChild, setComponent, resizeEntity } from "../engine";+import { SceneInitOverlay } from "./scene-init-overlay";++import { CLASSIC_PRESET_HEIGHT, CLASSIC_PRESET_WIDTH } from "../engine/decoders/caption/classic";++import type { Asset } from "../engine/db";+import type { Transcript } from "@diffusionstudio/api-contract";++export const MAIN_CANVAS_ID = 'engine-canvas';++export function Canvas() {+ const engine = useEngine();+ const world = engine.world;+ const c = world.components;++ const handleDropEvent = async (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();++ const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();+ const worldPt = screenToWorld(world, event.clientX - rect.left, event.clientY - rect.top);+ const sceneEid = findSceneAt(world, worldPt.x, worldPt.y);++ const getTargetPosition = (size: { width: number, height: number }, eid: number | null) => {+ const localPt = eid === null+ ? worldPt+ : worldToLocal(world, eid, worldPt.x, worldPt.y);++ return {+ x: Math.round(localPt.x - size.width / 2),+ y: Math.round(localPt.y - size.height / 2),+ };+ };++ const placeAsset = async (asset: Asset) => {+ const parentEid: number | null = sceneEid;++ const size = { width: 400, height: 100 };++ if (asset.type === 'VIDEO' || asset.type === 'IMAGE' || asset.type === 'SEQUENCE') {+ size.width = Math.round(asset.width);+ size.height = Math.round(asset.height);+ }++ if (asset.type === 'TRANSCRIPT') {+ size.width = CLASSIC_PRESET_WIDTH;+ size.height = CLASSIC_PRESET_HEIGHT;+ }++ const position = getTargetPosition(size, parentEid);++ // Resolve async transcript data up front so all entity mutations run in+ // one synchronous, undoable transaction.+ let transcriptTrim: { start: number; end: number } | null = null;+ if (asset.type === 'TRANSCRIPT') {+ const file = await asset.handle.getFile();+ const transcript = JSON.parse(await file.text()) as Transcript;+ const lastWord = transcript.at(-1)?.words.at(-1);+ const firstWord = transcript.at(0)?.words.at(0);+ transcriptTrim = {+ start: secondsToFrames(firstWord?.start),+ end: secondsToFrames(lastWord?.end),+ };+ }++ world.history.transaction('Place asset', () => {+ const eid = createEntity(world);+ setComponent(world, eid, c.Position, { x: position.x, y: position.y });+ setComponent(world, eid, c.KeepAspectRatio, { width: size.width, height: size.height });+ setComponent(world, eid, c.Name, asset.name);++ if (asset.type === 'TRANSCRIPT') {+ setComponent(world, eid, c.Geometry, GeometryType.TEXT);+ setComponent(world, eid, c.Caption, {});+ if (transcriptTrim) setComponent(world, eid, c.Trim, transcriptTrim);+ } else {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);++ // Other assets need a paint component+ let paint = PaintType.IMAGE;+ if (asset.type === 'SEQUENCE') paint = PaintType.SEQUENCE;+ if (asset.type === 'VIDEO') paint = PaintType.VIDEO;+ if (asset.type === 'AUDIO') paint = PaintType.WAVEFORM;+ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, paint);+ setComponent(world, fillEid, c.AssetId, asset.id);+ appendChild(world, fillEid, eid);+ }++ if (asset.type === 'AUDIO') {+ addComponent(world, eid, c.Audio);+ }++ if (asset.type === 'AUDIO' || asset.type === 'TRANSCRIPT') {+ setComponent(world, eid, c.AssetId, asset.id);+ }++ if (asset.type === 'VIDEO' || asset.type === 'AUDIO' || asset.type === 'SEQUENCE') {+ setComponent(world, eid, c.Playback, {});+ }++ if (parentEid) {+ appendChild(world, eid, parentEid);+ }++ resizeEntity(world, eid, { width: size.width, height: size.height });+ });+ };++ const assetIds = event.dataTransfer?.getData('application/x-asset-id')?.split(',').filter(Boolean);+ if (assetIds && assetIds.length > 0) {+ for (const id of assetIds) {+ const asset = world.assets.get(id);+ if (asset) {+ await placeAsset(asset);+ }+ }+ }+++ for (let i = 0; i < (event.dataTransfer?.items.length ?? 0); i++) {+ if (event.dataTransfer?.items[i]?.kind !== 'file') continue;++ try {+ const asset = await loadAsset(world, event.dataTransfer.items[i]);+ await placeAsset(asset);+ } catch (e) {+ toast("Failed to import assets", { description: (e as Error).message });+ }+ }+ }++ const handleDragOver = (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ }++ return (+ <div class="relative size-full">+ <div class="absolute inset-0">+ <Toolbar />+ <DrawOverlay />+ <SceneInitOverlay+ onDrop={handleDropEvent}+ onDragOver={handleDragOver}+ />+ <canvas+ id={MAIN_CANVAS_ID}+ class="absolute inset-0 z-1"+ on:drop={handleDropEvent}+ on:dragover={handleDragOver}+ />+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/canvas/draw-overlay.tsx b/apps/web/src/components/canvas/draw-overlay.tsxnew file mode 100644index 00000000..fbcf8bd7--- /dev/null+++ b/apps/web/src/components/canvas/draw-overlay.tsx@@ -0,0 +1,268 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useEngine } from "@/context/engine";+import { Show } from "solid-js";+import { screenToWorld, worldToLocal, findSceneAt, ToolType, getNextName, GeometryType, PaintType, type Point, createEntity, switchActiveScene, addComponent, appendChild, setComponent, resizeEntity, clearComponent } from "@/components/engine";+import { useECS } from "@/context/ecs";+++type ToolConfig = {+ geometry: GeometryType;+ isScene?: boolean;+ fillColor: number;+ previewColor: string;+ namePrefix: string;+ label: string;+ defaultWidth: number;+ defaultHeight: number;+};++const TOOL_CONFIG: Partial<Record<ToolType, ToolConfig>> = {+ [ToolType.RECT]: {+ geometry: GeometryType.RECT,+ fillColor: 0xE0E0E0,+ previewColor: '#E0E0E0',+ namePrefix: 'Rect',+ label: 'Create shape',+ defaultWidth: 300,+ defaultHeight: 300,+ },+ [ToolType.SCENE]: {+ geometry: GeometryType.RECT,+ isScene: true,+ fillColor: 0x000000,+ previewColor: '#000000',+ namePrefix: 'Scene',+ label: 'Create scene',+ defaultWidth: 1920,+ defaultHeight: 1080,+ },+ [ToolType.TEXT]: {+ geometry: GeometryType.TEXT,+ fillColor: 0xFFFFFF,+ previewColor: 'transparent',+ namePrefix: 'Text',+ label: 'Create text',+ // Width/height for click insertions are derived from the font size below.+ defaultWidth: 0,+ defaultHeight: 0,+ },+};++const CLICK_THRESHOLD = 10;++export function DrawOverlay() {+ const { world } = useEngine();+ const { selectedTool } = useECS();++ const c = world.components;++ let overlayRef!: HTMLDivElement;+ let previewRef!: HTMLDivElement;+ let dimensionsRef!: HTMLDivElement;++ let isDrawing = false;+ let startPoint: Point | null = null;+ let currentPoint: Point | null = null;+ let targetSceneEid: number | null = null;++ const config = () => TOOL_CONFIG[selectedTool()];+ const isActiveTool = () => !!config();++ const getRect = () => {+ if (!startPoint || !currentPoint) return null;+ return {+ x: Math.min(startPoint.x, currentPoint.x),+ y: Math.min(startPoint.y, currentPoint.y),+ width: Math.abs(currentPoint.x - startPoint.x),+ height: Math.abs(currentPoint.y - startPoint.y),+ };+ };++ const updatePreview = () => {+ const cfg = config();+ const rect = getRect();+ if (!previewRef || !rect || !cfg) {+ if (previewRef) previewRef.style.display = 'none';+ if (dimensionsRef) dimensionsRef.style.display = 'none';+ return;+ }++ previewRef.style.display = 'block';+ previewRef.style.left = `${rect.x}px`;+ previewRef.style.top = `${rect.y}px`;+ previewRef.style.width = `${rect.width}px`;+ previewRef.style.height = `${rect.height}px`;+ previewRef.style.backgroundColor = cfg.previewColor;+ previewRef.style.outline = '2px solid #008CFF';+ previewRef.style.outlineOffset = '0px';++ const worldTopLeft = screenToWorld(world, rect.x, rect.y);+ const worldBottomRight = screenToWorld(world, rect.x + rect.width, rect.y + rect.height);+ const worldWidth = Math.round(worldBottomRight.x - worldTopLeft.x);+ const worldHeight = Math.round(worldBottomRight.y - worldTopLeft.y);++ dimensionsRef.style.display = 'block';+ dimensionsRef.style.left = `${rect.x + rect.width / 2}px`;+ dimensionsRef.style.top = `${rect.y + rect.height + 8}px`;+ dimensionsRef.textContent = `${worldWidth}x${worldHeight}`;+ };++ const getLocalPoint = (e: PointerEvent): Point => {+ const rect = overlayRef.getBoundingClientRect();+ return { x: e.clientX - rect.left, y: e.clientY - rect.top };+ };++ const handlePointerDown = (e: PointerEvent) => {+ if (!isActiveTool()) return;++ const point = getLocalPoint(e);+ const worldPt = screenToWorld(world, point.x, point.y);+ targetSceneEid = findSceneAt(world, worldPt.x, worldPt.y);++ overlayRef.setPointerCapture(e.pointerId);+ isDrawing = true;+ startPoint = point;+ currentPoint = point;+ };++ const handlePointerMove = (e: PointerEvent) => {+ if (!isDrawing) return;+ currentPoint = getLocalPoint(e);+ updatePreview();+ };++ const reset = () => {+ isDrawing = false;+ startPoint = null;+ currentPoint = null;+ targetSceneEid = null;+ updatePreview();+ };++ const handlePointerUp = () => {+ if (!isDrawing) return;++ const cfg = config();+ const rect = getRect();+ if (!cfg || !rect) {+ reset();+ return;+ }++ const tool = selectedTool();+ const isClick = rect.width < CLICK_THRESHOLD || rect.height < CLICK_THRESHOLD;++ const worldTopLeft = screenToWorld(world, rect.x, rect.y);+ const worldBottomRight = screenToWorld(world, rect.x + rect.width, rect.y + rect.height);++ // Approximate text size from the parent scene's height.+ let fontSize = 16;+ if (tool === ToolType.TEXT && targetSceneEid !== null) {+ const sceneHeight = c.Computed.height[targetSceneEid];+ fontSize = Math.max(8, Math.round(sceneHeight / 22.5));+ }++ let width: number;+ let height: number;+ if (!isClick) {+ width = Math.round(worldBottomRight.x - worldTopLeft.x);+ height = Math.round(worldBottomRight.y - worldTopLeft.y);+ } else if (tool === ToolType.TEXT) {+ // Rough text bounds based on "Text" (4 chars) at the chosen font size.+ width = Math.round(fontSize * 0.6 * 4);+ height = Math.round(fontSize * 1.2);+ } else {+ width = cfg.defaultWidth;+ height = cfg.defaultHeight;+ }++ let posX = isClick ? worldTopLeft.x - width / 2 : worldTopLeft.x;+ let posY = isClick ? worldTopLeft.y - height / 2 : worldTopLeft.y;++ // Scenes always live at the root; rect/text may parent into a hovered scene.+ const parentScene = tool === ToolType.SCENE ? null : targetSceneEid;+ if (parentScene !== null) {+ const local = worldToLocal(world, parentScene, posX, posY);+ posX = local.x;+ posY = local.y;+ }++ const eid = world.history.transaction(cfg.isScene ? 'Add scene' : 'Draw shape', () => {+ const newEid = createEntity(world);+ setComponent(world, newEid, c.Geometry, cfg.geometry);+ if (cfg.isScene) {+ addComponent(world, newEid, c.Scene);+ addComponent(world, newEid, c.ClipsContent);+ setComponent(world, newEid, c.Playback, {});+ }+ setComponent(world, newEid, c.Name, getNextName(world, cfg.namePrefix));+ setComponent(world, newEid, c.Position, { x: Math.round(posX), y: Math.round(posY) });++ if (tool === ToolType.TEXT) {+ setComponent(world, newEid, c.Chars, 'Text');+ setComponent(world, newEid, c.TextStyle, { fontSize: fontSize });+ }++ if (tool !== ToolType.TEXT || !isClick) {+ resizeEntity(world, newEid, { width, height });+ }++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, cfg.fillColor);+ appendChild(world, fillEid, newEid);++ if (parentScene !== null) {+ appendChild(world, newEid, parentScene);+ }+ return newEid;+ });++ if (tool === ToolType.SCENE) {+ switchActiveScene(world, eid);+ }++ clearComponent(world, c.Selected, false);+ addComponent(world, eid, c.Selected, false);++ world.selection.tool = tool === ToolType.TEXT ? ToolType.TEXT_EDIT : ToolType.MOVE;+ reset();+ };++ return (+ <Show when={isActiveTool()}>+ <div+ ref={overlayRef}+ class="absolute inset-0 z-5 cursor-crosshair"+ on:pointerdown={handlePointerDown}+ on:pointermove={handlePointerMove}+ on:pointerup={handlePointerUp}+ >+ <div+ ref={previewRef}+ class="absolute pointer-events-none"+ style={{ display: 'none' }}+ />+ <div+ ref={dimensionsRef}+ class="absolute pointer-events-none"+ style={{+ display: 'none',+ transform: 'translateX(-50%)',+ 'background-color': '#008CFF',+ color: '#FFFFFF',+ 'font-family': 'Inter, sans-serif',+ 'font-size': '11px',+ 'line-height': '1',+ padding: '3px 4px',+ 'border-radius': '3px',+ 'white-space': 'nowrap',+ }}+ />+ </div>+ </Show>+ );+}diff --git a/apps/web/src/components/canvas/index.ts b/apps/web/src/components/canvas/index.tsnew file mode 100644index 00000000..89f8bfeb--- /dev/null+++ b/apps/web/src/components/canvas/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from "./canvas";diff --git a/apps/web/src/components/canvas/scene-init-overlay.tsx b/apps/web/src/components/canvas/scene-init-overlay.tsxnew file mode 100644index 00000000..9ea3b08d--- /dev/null+++ b/apps/web/src/components/canvas/scene-init-overlay.tsx@@ -0,0 +1,233 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, createSignal, For, Show } from "solid-js";+import { Icon } from "@/components/ui/icon";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuGroupLabel,+ DropdownMenuItem,+ DropdownMenuItemDetail,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import {+ PRESET_CATEGORIES,+} from "@/lib/layout-presets";+import { getNextName, persistWorldState, GeometryType, PaintType, createEntity, switchActiveScene, addComponent, appendChild, setComponent, resizeEntity, clearComponent } from "../engine";+import { useEngine } from "@/context/engine";+import { MAIN_CANVAS_ID } from "./canvas";+import { assert } from "@/utils";+import { getAllEntities } from "bitecs";++import type { LayoutPreset } from "@/lib/layout-presets";+++const DEFAULT_NAME = "New Scene";+const DEFAULT_PRESET: LayoutPreset = { label: "Long-form 16:9", width: 1920, height: 1080 };++type DropOverlayProps = {+ onDrop(event: DragEvent): void;+ onDragOver(event: DragEvent): void;+};++export function SceneInitOverlay(props: DropOverlayProps) {+ const { world, initialized } = useEngine();+ const c = world.components;++ const [editing, setEditing] = createSignal(false);+ const [selectedPreset, setSelectedPreset] = createSignal<LayoutPreset>(DEFAULT_PRESET);+ const [sceneName, setSceneName] = createSignal(DEFAULT_NAME);++ let buttonRef: HTMLButtonElement | undefined;++ const showOverlay = createMemo(() => {+ return initialized() && world.timelineIndex().root === null && getAllEntities(world).length === 0;+ });++ const aspectRatio = () => {+ const p = selectedPreset();+ return `${p.width} / ${p.height}`;+ };++ const isVertical = () => {+ const p = selectedPreset();+ return p.width <= p.height;+ };++ const handleFocus = (e: FocusEvent) => {+ setEditing(true);+ const el = e.currentTarget as HTMLElement;+ const range = document.createRange();+ range.selectNodeContents(el);+ const sel = window.getSelection();+ sel?.removeAllRanges();+ sel?.addRange(range);+ };++ const handleBlur = (e: FocusEvent) => {+ const el = e.currentTarget as HTMLElement;+ const text = el.textContent?.trim() || DEFAULT_NAME;+ setSceneName(text);+ el.textContent = text;+ setEditing(false);+ };++ const handleKeyDown = (e: KeyboardEvent) => {+ e.stopPropagation();+ if (e.key === 'Enter' || e.key === 'Escape') {+ e.preventDefault();+ (e.currentTarget as HTMLElement).blur();+ }+ };++ const handleInitializeScene = () => {+ const buttonRect = buttonRef?.getBoundingClientRect();+ if (!buttonRect) return;++ const template = selectedPreset();+ const worldX = Math.round(-template.width / 2);+ const worldY = Math.round(-template.height / 2);++ const name = sceneName() != DEFAULT_NAME+ ? sceneName()+ : getNextName(world, 'Scene');++ let sceneEntity!: number;+ world.history.untrack(() => {+ const canvas = document.getElementById(MAIN_CANVAS_ID);+ const canvasRect = canvas?.parentElement?.getBoundingClientRect();+ assert(canvasRect, 'Canvas rect not found');++ // Screen position of the button relative to the canvas container+ const screenX = buttonRect.left - canvasRect.left;+ const screenY = buttonRect.top - canvasRect.top;+ const scale = buttonRect.width / template.width;++ world.camera.a = scale;+ world.camera.b = 0;+ world.camera.c = 0;+ world.camera.d = scale;+ world.camera.e = screenX - worldX * scale;+ world.camera.f = screenY - worldY * scale;++ persistWorldState(world);++ sceneEntity = createEntity(world);+ setComponent(world, sceneEntity, c.Geometry, GeometryType.RECT);+ addComponent(world, sceneEntity, c.Scene);+ addComponent(world, sceneEntity, c.ClipsContent);+ setComponent(world, sceneEntity, c.Playback, {});+ setComponent(world, sceneEntity, c.Name, name);+ setComponent(world, sceneEntity, c.Position, { x: worldX, y: worldY });+ resizeEntity(world, sceneEntity, {+ width: template.width,+ height: template.height,+ });++ // append a solid fill to the scene+ const fillEntity = createEntity(world);+ setComponent(world, fillEntity, c.Paint, PaintType.SOLID);+ setComponent(world, fillEntity, c.Color, 0x000000);+ appendChild(world, fillEntity, sceneEntity);++ switchActiveScene(world, sceneEntity);+ clearComponent(world, c.Selected);+ addComponent(world, sceneEntity, c.Selected);+ });++ return sceneEntity;+ };++ const handleDrop = (e: DragEvent) => {+ e.preventDefault();+ e.stopPropagation();+ props.onDrop(e);+ }++ const handleDragOver = (e: DragEvent) => {+ props.onDragOver(e);+ }++ return (+ <Show when={showOverlay()}>+ <div+ class="absolute inset-0 z-2 flex items-center justify-center"+ on:drop={handleDrop}+ on:dragover={handleDragOver}+ >+ <div+ class="relative"+ style={{+ "aspect-ratio": aspectRatio(),+ [isVertical() ? "height" : "width"]: "clamp(0px, 70%, 560px)",+ }}+ >+ <div class="absolute left-0 right-0 bottom-full mb-0.5 flex items-center justify-between">+ <div+ contentEditable+ onFocus={handleFocus}+ onBlur={handleBlur}+ onKeyDown={handleKeyDown}+ class="whitespace-nowrap text-xs h-4.5 font-450 flex items-center text-muted-foreground justify-center leading-none focus-ring outline-none px-0.5 rounded-sm box-content"+ classList={{ 'text-foreground': editing() }}+ >+ {sceneName() ?? DEFAULT_NAME}+ </div>+ <DropdownMenu placement="right">+ <DropdownMenuTrigger+ as="button"+ type="button"+ class="flex items-center ursor-pointer bg-transparent border-none p-0 text-xs font-450 text-muted-foreground outline-none"+ >+ <span>{selectedPreset().label}</span>+ <Icon name="chevron-down" class="size-6" />+ </DropdownMenuTrigger>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-60">+ <For each={PRESET_CATEGORIES}>+ {(category, index) => (+ <>+ <Show when={index() > 0}>+ <DropdownMenuSeparator />+ </Show>+ <DropdownMenuGroup>+ <DropdownMenuGroupLabel>{category.label}</DropdownMenuGroupLabel>+ <For each={category.items}>+ {(item) => (+ <DropdownMenuItem onSelect={() => setSelectedPreset(item)}>+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {item.label}+ </span>+ <DropdownMenuItemDetail>+ {item.width}x{item.height}+ </DropdownMenuItemDetail>+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuGroup>+ </>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </div>+ <button+ type="button"+ class="w-full h-full bg-background border border-border overflow-hidden flex items-center justify-center hover:bg-accent hover:border-input active:bg-muted active:border-input"+ onClick={handleInitializeScene}+ ref={buttonRef}+ >+ <Icon name="plus-add" class="size-6 text-muted-foreground" />+ </button>+ </div>++ </div>+ </Show>+ );+}diff --git a/apps/web/src/components/canvas/toolbar.tsx b/apps/web/src/components/canvas/toolbar.tsxnew file mode 100644index 00000000..21b7669e--- /dev/null+++ b/apps/web/src/components/canvas/toolbar.tsx@@ -0,0 +1,154 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Separator } from "@/components/ui/separator";+import { Icon } from "@/components/ui/icon";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuShortcut,+} from "@/components/ui/dropdown-menu";+import { useEngine } from "@/context/engine";+import { PromptInput } from "../genai/prompt-input";+import { ActionBar } from "../genai/action-bar";+import { Show } from "solid-js";+import { ToolType } from "../engine/components";+import { useECS } from "@/context/ecs";+import { usePromptInput } from "@/context/prompt-input";++export function Toolbar() {+ const { world } = useEngine();+ const { promptInputOpen, promptInputConfig, openPromptInput, setPromptInputOpen } = usePromptInput();+ const { selectedTool } = useECS();++ const handleToolChange = (tool: ToolType) => {+ world.selection.tool = tool;+ }++ return (+ <>+ <Show when={promptInputOpen()}>+ <PromptInput initialConfig={promptInputConfig()} />+ </Show>+ <Show when={!promptInputOpen()}>+ <ActionBar openPromptInput={openPromptInput} />+ </Show>+ <div class="absolute bottom-4 left-1/2 -translate-x-1/2 rounded-xl p-1.5 bg-background border border-border flex gap-2 items-center z-10">+ <div class="flex gap-1">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon-square"+ class={[ToolType.MOVE, ToolType.HAND].includes(selectedTool()) ? 'text-foreground' : 'text-muted-foreground'}+ variant={[ToolType.MOVE, ToolType.HAND].includes(selectedTool()) ? 'default' : 'ghost'}+ onClick={() => handleToolChange(+ selectedTool() === ToolType.HAND ? ToolType.HAND : ToolType.MOVE+ )}+ >+ <Icon name={selectedTool() === ToolType.HAND ? 'hand' : 'move'} />+ </TooltipTrigger>+ <TooltipContent shortcut={selectedTool() === ToolType.HAND ? 'H' : 'V'}>+ {selectedTool() === ToolType.HAND ? 'Hand' : 'Move'}+ </TooltipContent>+ </Tooltip>+ <DropdownMenu placement="top-start">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button {...buttonProps} size="icon-select" variant="ghost" class="text-muted-foreground">+ <Icon name="chevron-down" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Select tool</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent>+ <DropdownMenuItem class="px-0 pr-2 gap-0.5" onSelect={() => handleToolChange(ToolType.MOVE)}>+ <div classList={{ "visible": selectedTool() === ToolType.MOVE }} class="invisible">+ <Icon name="confirm-check" class="text-foreground" />+ </div>+ <Icon name="move-small" class="text-foreground" />+ <span class="min-w-12 mx-1">Move</span>+ <DropdownMenuShortcut>V</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem class="px-0 pr-2 gap-0.5" onSelect={() => handleToolChange(ToolType.HAND)}>+ <div classList={{ "visible": selectedTool() === ToolType.HAND }} class="invisible">+ <Icon name="confirm-check" class="text-foreground" />+ </div>+ <Icon name="hand" class="text-foreground" />+ <span class="min-w-12 mx-1">Hand</span>+ <DropdownMenuShortcut>H</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </div>+ <Separator orientation="vertical" class="min-h-5" />+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon-square"+ variant={selectedTool() === ToolType.SCENE ? 'default' : 'ghost'}+ onClick={() => handleToolChange(ToolType.SCENE)}+ class={selectedTool() === ToolType.SCENE ? 'text-foreground' : 'text-muted-foreground'}+ >+ <Icon name="frame" class="size-5" />+ </TooltipTrigger>+ <TooltipContent shortcut="F">Frame</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon-square"+ variant={selectedTool() === ToolType.RECT ? 'default' : 'ghost'}+ onClick={() => handleToolChange(ToolType.RECT)}+ class={selectedTool() === ToolType.RECT ? 'text-foreground' : 'text-muted-foreground'}+ >+ <Icon name="tool.rectangle" />+ </TooltipTrigger>+ <TooltipContent shortcut="R">Rectangle</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon-square"+ variant={selectedTool() === ToolType.TEXT ? 'default' : 'ghost'}+ onClick={() => handleToolChange(ToolType.TEXT)}+ class={selectedTool() === ToolType.TEXT ? 'text-foreground' : 'text-muted-foreground'}+ >+ <Icon name="tool.text" />+ </TooltipTrigger>+ <TooltipContent shortcut="T">Text</TooltipContent>+ </Tooltip>+ <Separator+ orientation="vertical"+ class="data-[orientation=vertical]:h-5 rounded-md"+ />+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon-square"+ class={promptInputOpen() ? 'text-foreground' : 'text-muted-foreground'}+ variant={promptInputOpen() ? 'default' : 'ghost'}+ onClick={() => setPromptInputOpen(!promptInputOpen())}+ >+ <Icon name="ai-generate" class="size-7" />+ </TooltipTrigger>+ <TooltipContent>AI generate</TooltipContent>+ </Tooltip>+ </div>+ </>+ );+}diff --git a/apps/web/src/components/dashboard/account-view.tsx b/apps/web/src/components/dashboard/account-view.tsxnew file mode 100644index 00000000..cce1a549--- /dev/null+++ b/apps/web/src/components/dashboard/account-view.tsx@@ -0,0 +1,701 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useSearchParams } from "@solidjs/router";+import { Show, createEffect, createSignal } from "solid-js";+import { toast } from "somoto";++import { useAvatar } from "@/hooks/use-avatar";+import {+ AlertDialog,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from "@/components/ui/alert-dialog";+import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import {+ Switch,+ SwitchControl,+ SwitchInput,+ SwitchLabel,+ SwitchThumb,+} from "@/components/ui/switch";+import { TextField, TextFieldInput, TextFieldLabel } from "@/components/ui/text-field";+import { useAuth } from "@/context/auth";+import { supabase } from "@/lib/supabase";+import { trpc } from "@/lib/trpc";++import {+ DashboardDividedStack,+ DashboardFormModal,+ DashboardFreePlanDetails,+ DashboardInfoActionRow,+ DashboardProPlanDetails,+ DashboardPlanSummaryCard,+ DashboardScrollView,+ DashboardSurfaceSection,+ DashboardTitledSection,+ DashboardSurfaceCard,+} from "./shared";+import { cropAndResizeAvatar } from "./utils";+import { Separator } from "@/components/ui/separator";++type AccountRowStatusTone = "muted" | "primary";++type AccountPreferenceRow = {+ title: string;+ description: string;+ checked: boolean;+ onChange(checked: boolean): void;+};++type DashboardAccountStatusProps = {+ value: string;+ tone?: AccountRowStatusTone;+};++function DashboardAccountStatus(props: DashboardAccountStatusProps) {+ return (+ <span+ class="truncate text-xs"+ classList={{+ "text-primary": props.tone === "primary",+ "text-muted-foreground": props.tone !== "primary",+ }}+ >+ {props.value}+ </span>+ );+}++function DashboardAccountInfoRow(props: {+ icon: string;+ label: string;+ description?: string;+ status?: string;+ statusTone?: AccountRowStatusTone;+ actionLabel: string;+ onClick?(): void;+}) {+ const statusText = () => props.status;++ return (+ <DashboardInfoActionRow+ leading={+ <Icon+ name={props.icon}+ class="size-6 text-foreground"+ />+ }+ title={props.label}+ titleContent={+ <Show+ when={props.status}+ fallback={+ <p class="truncate text-foreground text-xs">+ {props.label}+ </p>+ }+ >+ <div class="flex min-w-0 items-center gap-1">+ <p class="truncate text-foreground text-xs">+ {props.label}+ </p>+ <span class="text-muted-foreground text-xs">+ {"\u00B7"}+ </span>+ <DashboardAccountStatus+ value={statusText() ?? ""}+ tone={props.statusTone}+ />+ </div>+ </Show>+ }+ description={props.description ? <p>{props.description}</p> : undefined}+ action={+ <Button variant="secondary" onClick={props.onClick}>+ {props.actionLabel}+ </Button>+ }+ />+ );+}++function DashboardAccountPreferenceRow(props: AccountPreferenceRow) {+ return (+ <Switch+ checked={props.checked}+ onChange={props.onChange}+ class="flex items-center gap-4"+ >+ <SwitchLabel class="min-w-0 flex-1 cursor-pointer pr-4 text-xs font-normal">+ <span class="block text-foreground">+ {props.title}+ </span>+ <span class="mt-1 block text-muted-foreground">+ {props.description}+ </span>+ </SwitchLabel>+ <SwitchInput aria-label={`Email preference: ${props.title}`} />+ <SwitchControl variant="compact">+ <SwitchThumb variant="compact" />+ </SwitchControl>+ </Switch>+ );+}++function DashboardAccountPersonalDetailsSection() {+ const auth = useAuth();+ const [firstName, setFirstName] = createSignal(+ (auth.user()?.user_metadata?.first_name as string) ?? ""+ );+ const [lastName, setLastName] = createSignal(+ (auth.user()?.user_metadata?.last_name as string) ?? ""+ );+ const [saving, setSaving] = createSignal(false);+ const [uploading, setUploading] = createSignal(false);+ const [localPreview, setLocalPreview] = createSignal<string | null>(null);++ let fileInputRef!: HTMLInputElement;++ const avatarUrl = useAvatar();+ const displayUrl = () => localPreview() ?? avatarUrl();++ const initial = () => {+ const name = auth.user()?.user_metadata?.full_name || auth.user()?.email || "U";+ return (name as string).charAt(0).toUpperCase();+ };++ const handleAvatarUpload = async (event: Event) => {+ const input = event.target as HTMLInputElement;+ if (!input.files || input.files.length === 0 || !supabase) return;++ const file = input.files[0]!;+ setUploading(true);++ try {+ const blob = await cropAndResizeAvatar(file);++ // Optimistic preview+ const prev = localPreview();+ if (prev) URL.revokeObjectURL(prev);+ setLocalPreview(URL.createObjectURL(blob));++ const userId = auth.user()?.id;+ if (!userId) throw new Error("Not authenticated");++ const filePath = `${userId}/${Date.now()}.webp`;++ const { error: uploadError } = await supabase.storage+ .from("avatars")+ .upload(filePath, blob, { contentType: "image/webp", upsert: false });++ if (uploadError) throw uploadError;++ const { error: updateError } = await supabase.auth.updateUser({+ data: { avatar_url: filePath },+ });++ if (updateError) throw updateError;++ await auth.refreshSession();+ toast.success("Profile photo updated");+ } catch (err) {+ toast.error(err instanceof Error ? err.message : "Upload failed");+ } finally {+ setUploading(false);+ input.value = "";+ }+ };++ const handleSave = async () => {+ if (!supabase) return;+ setSaving(true);++ const { error } = await supabase.auth.updateUser({+ data: {+ first_name: firstName(),+ last_name: lastName(),+ full_name: [firstName(), lastName()].filter(Boolean).join(" "),+ },+ });++ setSaving(false);++ if (error) {+ toast.error(error.message);+ } else {+ await auth.refreshSession();+ toast.success("Profile updated");+ }+ };++ return (+ <DashboardSurfaceSection title="Personal details">+ <div class="flex flex-col gap-2">+ <p class="text-muted-foreground text-xs">+ Profile photo+ </p>++ <div class="flex items-center gap-4">+ <Show+ when={displayUrl()}+ fallback={+ <div class="grid size-16 place-items-center rounded-md bg-input text-lg text-foreground">+ {initial()}+ </div>+ }+ >+ {(url) => (+ <img+ src={url()}+ alt=""+ class="size-16 rounded-md object-cover"+ />+ )}+ </Show>+ <input+ ref={fileInputRef}+ type="file"+ accept="image/*"+ class="hidden"+ onChange={handleAvatarUpload}+ />+ <Button+ variant="secondary"+ disabled={uploading()}+ onClick={() => fileInputRef.click()}+ class="gap-1"+ >+ Change image+ <Show when={uploading()}>+ <Icon name="spinner-loader" class="size-6 animate-spin" />+ </Show>+ </Button>+ </div>+ </div>++ <Separator />++ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2">+ <TextField>+ <TextFieldLabel uiSize="compact" class="text-muted-foreground">+ First name+ </TextFieldLabel>+ <TextFieldInput+ uiSize="compact"+ value={firstName()}+ onInput={(event) => setFirstName(event.currentTarget.value)}+ onKeyDown={(event) => event.stopPropagation()}+ onKeyUp={(event) => event.stopPropagation()}+ />+ </TextField>++ <TextField>+ <TextFieldLabel uiSize="compact" class="text-muted-foreground">+ Last name+ </TextFieldLabel>+ <TextFieldInput+ uiSize="compact"+ value={lastName()}+ onInput={(event) => setLastName(event.currentTarget.value)}+ onKeyDown={(event) => event.stopPropagation()}+ onKeyUp={(event) => event.stopPropagation()}+ />+ </TextField>+ </div>++ <Button+ variant="secondary"+ class="self-start gap-1"+ disabled={saving()}+ onClick={handleSave}+ >+ Save changes+ <Show when={saving()}>+ <Icon name="spinner-loader" class="size-6 animate-spin" />+ </Show>+ </Button>+ </DashboardSurfaceSection>+ );+}++function DashboardAccountLoginSecuritySection() {+ const auth = useAuth();+ const email = () => auth.user()?.email ?? "";+ const emailConfirmed = () => !!auth.user()?.email_confirmed_at;++ const [modalOpen, setModalOpen] = createSignal(false);+ const [newEmail, setNewEmail] = createSignal("");+ const [submitting, setSubmitting] = createSignal(false);++ const handleChangeEmail = async () => {+ if (!supabase) return;++ const trimmed = newEmail().trim();+ if (!trimmed) return;++ setSubmitting(true);++ const { error } = await supabase.auth.updateUser({ email: trimmed });++ setSubmitting(false);++ if (error) {+ toast.error(error.message);+ } else {+ toast.success("Confirmation link sent to your new email address");+ setModalOpen(false);+ setNewEmail("");+ }+ };++ return (+ <DashboardSurfaceSection title="Login & security">+ <DashboardDividedStack>+ <DashboardAccountInfoRow+ icon="email"+ label="Email address"+ status={emailConfirmed() ? "Verified" : "Unverified"}+ statusTone={emailConfirmed() ? "muted" : "primary"}+ description={email()}+ actionLabel="Change email"+ onClick={() => setModalOpen(true)}+ />+ </DashboardDividedStack>++ <DashboardFormModal+ open={modalOpen()}+ title="Change email"+ onClose={() => setModalOpen(false)}+ footer={+ <Button+ disabled={submitting() || !newEmail().trim()}+ onClick={() => void handleChangeEmail()}+ >+ {submitting() ? "Sending..." : "Send confirmation"}+ </Button>+ }+ >+ <div class="flex flex-col gap-3 px-2">+ <p class="text-muted-foreground text-xs">+ We'll send a confirmation link to your new email address.+ </p>+ <TextField>+ <TextFieldLabel uiSize="compact" class="text-muted-foreground">+ New email address+ </TextFieldLabel>+ <TextFieldInput+ uiSize="compact"+ type="email"+ value={newEmail()}+ onInput={(e) => setNewEmail(e.currentTarget.value)}+ onKeyDown={(e) => {+ e.stopPropagation();+ if (e.key === "Enter") void handleChangeEmail();+ }}+ onKeyUp={(e) => e.stopPropagation()}+ />+ </TextField>+ </div>+ </DashboardFormModal>+ </DashboardSurfaceSection>+ );+}++function DashboardAccountActiveSessionsSection() {+ const auth = useAuth();++ return (+ <DashboardSurfaceSection title="Active sessions">+ <DashboardAccountInfoRow+ icon="mac-device"+ label="Current session"+ status="Active"+ statusTone="primary"+ actionLabel="Log out"+ onClick={auth.signOut}+ />+ </DashboardSurfaceSection>+ );+}++function DashboardAccountLinkedAccountsSection() {+ const auth = useAuth();++ const identityCount = () => auth.user()?.identities?.length ?? 0;++ const isProviderLinked = (provider: string) => {+ return auth.user()?.identities?.some((i) => i.provider === provider) ?? false;+ };++ const isLastIdentity = (provider: string) => {+ return isProviderLinked(provider) && identityCount() <= 1;+ };++ const handleLink = async (provider: "google" | "apple" | "github") => {+ if (!supabase) return;++ const { error } = await supabase.auth.linkIdentity({+ provider,+ options: {+ redirectTo: window.location.origin,+ },+ });++ if (error) {+ toast.error(error.message);+ }+ };++ const handleUnlink = async (provider: string) => {+ if (!supabase) return;++ if (isLastIdentity(provider)) {+ toast.error("You can't disconnect your only login method. Link another account first.");+ return;+ }++ const identity = auth.user()?.identities?.find((i) => i.provider === provider);+ if (!identity) return;++ const { error } = await supabase.auth.unlinkIdentity(identity);++ if (error) {+ toast.error(error.message);+ } else {+ toast.success(`${provider.charAt(0).toUpperCase() + provider.slice(1)} disconnected`);+ }+ };++ const handleGoogleLink = async () => {+ if (isProviderLinked("google")) {+ handleUnlink("google");+ } else {+ handleLink("google");+ }+ };++ const handleGitHubLink = async () => {+ if (isProviderLinked("github")) {+ handleUnlink("github");+ } else {+ handleLink("github");+ }+ };++ return (+ <DashboardSurfaceSection title="Linked accounts">+ <DashboardDividedStack>+ <DashboardAccountInfoRow+ icon="social.google"+ label="Google"+ status={isProviderLinked("google") ? "Connected" : undefined}+ actionLabel={isProviderLinked("google") ? "Disconnect" : "Connect"}+ onClick={handleGoogleLink}+ />+ <DashboardAccountInfoRow+ icon="social.github"+ label="GitHub"+ status={isProviderLinked("github") ? "Connected" : undefined}+ actionLabel={isProviderLinked("github") ? "Disconnect" : "Connect"}+ onClick={handleGitHubLink}+ />+ </DashboardDividedStack>+ </DashboardSurfaceSection>+ );+}++function DashboardAccountFreePlanCard() {+ const [, setParams] = useSearchParams();++ return (+ <DashboardSurfaceCard class="flex flex-col gap-4 md:flex-row md:items-center">+ <DashboardFreePlanDetails />++ <Button+ class="gap-0 pl-0 pr-2"+ onClick={() => setParams({ dashboard: "billing" }, { replace: true })}+ >+ <span class="grid h-7 w-6 place-items-center overflow-clip">+ <Icon name="upgrade" class="size-6" />+ </span>+ Upgrade to Pro+ </Button>+ </DashboardSurfaceCard>+ );+}++function DashboardAccountPlanSection() {+ const auth = useAuth();+ const [, setParams] = useSearchParams();++ return (+ <DashboardTitledSection title="Plan">+ <Show+ when={auth.isPro()}+ fallback={<DashboardAccountFreePlanCard />}+ >+ <DashboardPlanSummaryCard+ action={+ <Button+ variant="secondary"+ onClick={() => setParams({ dashboard: "billing" }, { replace: true })}+ >+ View details+ </Button>+ }+ >+ <DashboardProPlanDetails />+ </DashboardPlanSummaryCard>+ </Show>+ </DashboardTitledSection>+ );+}++type EmailPreferenceColumn =+ | "product_updates_enabled"+ | "marketing_announcements_enabled";++function DashboardAccountEmailPreferencesSection() {+ const auth = useAuth();+ const [optimistic, setOptimistic] =+ createSignal<Partial<Record<EmailPreferenceColumn, boolean>>>({});++ const serverValue = (column: EmailPreferenceColumn) =>+ column === "product_updates_enabled"+ ? auth.productUpdatesEnabled()+ : auth.marketingAnnouncementsEnabled();++ const value = (column: EmailPreferenceColumn) =>+ optimistic()[column] ?? serverValue(column);++ // Clear optimistic overrides once the server state catches up via realtime.+ createEffect(() => {+ const current = optimistic();+ let next = current;+ for (const column of [+ "product_updates_enabled",+ "marketing_announcements_enabled",+ ] as const) {+ if (column in current && current[column] === serverValue(column)) {+ if (next === current) next = { ...current };+ delete next[column];+ }+ }+ if (next !== current) setOptimistic(next);+ });++ const handleChange = (column: EmailPreferenceColumn) => async (v: boolean) => {+ setOptimistic({ ...optimistic(), [column]: v });+ try {+ await trpc.updateEmailPreference.mutate({ column, value: v });+ } catch (err) {+ const next = { ...optimistic() };+ delete next[column];+ setOptimistic(next);+ const message = err instanceof Error ? err.message : "Failed to update preference";+ toast.error("Action failed", { description: message });+ }+ };++ return (+ <DashboardSurfaceSection title="Email preferences">+ <DashboardDividedStack>+ <DashboardAccountPreferenceRow+ title="Product updates"+ description="Feature updates and important changes."+ checked={value("product_updates_enabled")}+ onChange={handleChange("product_updates_enabled")}+ />+ <DashboardAccountPreferenceRow+ title="Marketing & announcements"+ description="Product news and announcements."+ checked={value("marketing_announcements_enabled")}+ onChange={handleChange("marketing_announcements_enabled")}+ />+ </DashboardDividedStack>+ </DashboardSurfaceSection>+ );+}++function DashboardAccountDangerZoneSection() {+ const auth = useAuth();+ const [confirmOpen, setConfirmOpen] = createSignal(false);+ const [deleting, setDeleting] = createSignal(false);++ const handleDelete = async () => {+ setDeleting(true);+ const { error } = await auth.deleteAccount();+ setDeleting(false);++ if (error) {+ toast.error(error);+ } else {+ setConfirmOpen(false);+ toast.success("Your account has been deleted.");+ }+ };++ return (+ <DashboardSurfaceSection title="Danger zone">+ <DashboardInfoActionRow+ title="Permanently delete your account and all associated data."+ action={+ <Button+ variant="destructive"+ onClick={() => setConfirmOpen(true)}+ >+ Delete account+ </Button>+ }+ />++ <AlertDialog open={confirmOpen()} onOpenChange={setConfirmOpen}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete account</AlertDialogTitle>+ <AlertDialogDescription>+ This action is permanent and cannot be undone. All your projects,+ data, and settings will be permanently removed.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <Button+ variant="secondary"+ onClick={() => setConfirmOpen(false)}+ disabled={deleting()}+ >+ Cancel+ </Button>+ <Button+ variant="destructive"+ disabled={deleting()}+ onClick={handleDelete}+ >+ {deleting() ? "Deleting..." : "Yes, delete my account"}+ </Button>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </DashboardSurfaceSection>+ );+}++export function DashboardAccountView() {+ return (+ <DashboardScrollView>+ <DashboardAccountPersonalDetailsSection />+ <DashboardAccountLoginSecuritySection />+ <DashboardAccountActiveSessionsSection />+ <DashboardAccountLinkedAccountsSection />+ <DashboardAccountPlanSection />+ <DashboardAccountEmailPreferencesSection />+ <DashboardAccountDangerZoneSection />+ </DashboardScrollView>+ );+}diff --git a/apps/web/src/components/dashboard/ai-credits-view.tsx b/apps/web/src/components/dashboard/ai-credits-view.tsxnew file mode 100644index 00000000..e23b3e36--- /dev/null+++ b/apps/web/src/components/dashboard/ai-credits-view.tsx@@ -0,0 +1,236 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createSignal } from "solid-js";+import { useSearchParams } from "@solidjs/router";+import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { Separator } from "@/components/ui/separator";+import { cx } from "@/lib/cva";+import { useAuth } from "@/context/auth";+import {+ TOPUP_CREDIT_TIERS,+ getTopupPrice,+ startTopupCheckout,+} from "@/lib/checkout";++import {+ DashboardLabelValue,+ DashboardScrollView,+ DashboardSurfaceSection,+} from "./shared";+import { DashboardProPlanFeatures } from "./plans-view";++import type { TopupCredits } from "@diffusionstudio/api-contract";++function formatCredits(value: number): string {+ return value.toLocaleString();+}++function parseTierCredits(tier: TopupCredits): number {+ return parseInt(tier.replace("_", ""), 10);+}++function formatPercent(used: number, total: number): string {+ if (total <= 0) return "0% used";+ const percent = Math.min(100, Math.max(0, (used / total) * 100));+ return `${Number(percent.toFixed(1))}% used`;+}++function progressWidth(used: number, total: number): string {+ if (total <= 0) return "0%";+ const percent = Math.min(100, Math.max(0, (used / total) * 100));+ return `${percent}%`;+}++type DashboardProgressSectionProps = {+ label: string;+ valueLabel: string;+ used: number;+ total: number;+ footerLabel: string;+};++function DashboardProgressSection(props: DashboardProgressSectionProps) {+ return (+ <div class="flex flex-col gap-1">+ <div class="flex items-center gap-2 text-xs">+ <p class="min-w-0 flex-1 text-foreground">{props.label}</p>+ <p class="shrink-0 text-right text-muted-foreground">{props.valueLabel}</p>+ </div>++ <div class="py-2">+ <div class="h-3 w-full overflow-hidden rounded-full bg-input">+ <div+ class="h-full rounded-full bg-primary"+ style={{ width: progressWidth(props.used, props.total) }}+ />+ </div>+ </div>++ <div class="flex items-center gap-2 text-xs text-muted-foreground">+ <p class="min-w-0 flex-1">{props.footerLabel}</p>+ <p class="shrink-0 text-right">{formatPercent(props.used, props.total)}</p>+ </div>+ </div>+ );+}++function DashboardAiCreditsTopUpSection() {+ const [selected, setSelected] = createSignal<TopupCredits>();+ const [loading, setLoading] = createSignal(false);++ const handleCheckout = async () => {+ const tier = selected();+ if (!tier || loading()) return;+ setLoading(true);+ try {+ await startTopupCheckout(tier);+ } finally {+ setLoading(false);+ }+ };++ return (+ <DashboardSurfaceSection title="Top up">+ <div class="flex flex-col gap-4 sm:flex-row">+ <p class="min-w-0 flex-1 text-muted-foreground text-xs">+ Add credits to your account at any time when your balance runs out.+ </p>+ <Button+ onClick={handleCheckout}+ disabled={loading() || !selected()}+ variant="secondary"+ >+ Checkout+ </Button>+ </div>++ <Separator />++ <div role="radiogroup" class="grid grid-cols-2 gap-2 sm:grid-cols-5">+ <For each={TOPUP_CREDIT_TIERS}>+ {(tier) => {+ const isSelected = () => selected() === tier;+ return (+ <div+ role="radio"+ tabIndex={0}+ aria-checked={isSelected()}+ onClick={() => setSelected(tier)}+ onKeyDown={(event) => {+ if (event.key === "Enter" || event.key === " ") {+ event.preventDefault();+ setSelected(tier);+ }+ }}+ class={cx(+ "flex flex-col gap-0.5 rounded-md border p-3 outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",+ isSelected() ? "border-primary" : "border-input",+ )}+ >+ <span class="text-xs text-foreground">+ {formatCredits(parseTierCredits(tier))} credits+ </span>+ <span class="text-xs text-muted-foreground">+ ${getTopupPrice(tier)}+ </span>+ </div>+ );+ }}+ </For>+ </div>+ </DashboardSurfaceSection>+ );+}++function DashboardAiCreditsNeedMoreSection() {+ const [, setParams] = useSearchParams();+ const goToBilling = () =>+ setParams({ dashboard: "billing" }, { replace: true });++ return (+ <DashboardSurfaceSection title="Need more?">+ <div class="flex flex-col gap-4 sm:flex-row sm:items-center">+ <DashboardLabelValue+ label="Keep creating without interruptions"+ value="Flexible credit tiers, top ups on demand, and the full Pro experience."+ />+ <Button class="gap-0 pl-0 pr-2" onClick={goToBilling}>+ <span class="grid h-7 w-6 place-items-center overflow-clip">+ <Icon name="upgrade" class="size-6" />+ </span>+ Go Pro+ </Button>+ </div>++ <Separator />++ <div class="flex flex-col gap-2">+ <p class="text-muted-foreground text-xs">+ Everything in Free, plus:+ </p>+ <DashboardProPlanFeatures />+ </div>+ </DashboardSurfaceSection>+ );+}++export function DashboardAiCreditsView() {+ const auth = useAuth();+ const [, setParams] = useSearchParams();+ const goToBilling = () =>+ setParams({ dashboard: "billing" }, { replace: true });++ const isPro = () => auth.isPro();+ const total = () => auth.creditLimit();+ const remaining = () => auth.remainingCredits();+ const used = () => Math.max(0, total() - remaining());++ const resetLabel = () => {+ const reset = auth.nextCreditReset();+ if (!reset) return "Resets monthly";+ const days = Math.max(0, Math.ceil((reset.getTime() - Date.now()) / 86_400_000));+ const date = reset.toLocaleDateString(undefined, { month: "long", day: "numeric" });+ return `Resets in ${days} ${days === 1 ? "day" : "days"} - ${date}`;+ };+ const creditLimitLabel = () =>+ isPro()+ ? `${formatCredits(total())} credits/mo`+ : `${formatCredits(total())} trial credits`;+ const creditUsageLabel = () =>+ `${formatCredits(used())} / ${formatCredits(total())}`;++ return (+ <DashboardScrollView>+ <DashboardSurfaceSection title="AI credits">+ <div class="flex flex-col gap-4 sm:flex-row sm:items-center">+ <DashboardLabelValue label="Credit subscription" value={creditLimitLabel()} />+ <Show when={!isPro()}>+ <Button variant="secondary" onClick={goToBilling}>+ Upgrade plan+ </Button>+ </Show>+ </div>++ <Separator />++ <DashboardProgressSection+ label="Usage"+ valueLabel={creditUsageLabel()}+ used={used()}+ total={total()}+ footerLabel={isPro() ? resetLabel() : "One time only"}+ />+ </DashboardSurfaceSection>++ <Show when={isPro()}>+ <DashboardAiCreditsTopUpSection />+ </Show>+ <Show when={!isPro()}>+ <DashboardAiCreditsNeedMoreSection />+ </Show>+ </DashboardScrollView>+ );+}diff --git a/apps/web/src/components/dashboard/billing-info-view.tsx b/apps/web/src/components/dashboard/billing-info-view.tsxnew file mode 100644index 00000000..0edf1560--- /dev/null+++ b/apps/web/src/components/dashboard/billing-info-view.tsx@@ -0,0 +1,235 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createResource, type Accessor, type JSX } from "solid-js";++import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { openBillingPortal } from "@/lib/checkout";+import { useAuth } from "@/context/auth";+import { trpc } from "@/lib/trpc";++import {+ DashboardDividedStack,+ DashboardFreePlanDetails,+ DashboardInfoActionRow,+ DashboardProPlanDetails,+ DashboardPlanSummaryCard,+ DashboardSurfaceCard,+ DashboardSurfaceSection,+} from "./shared";++type BillingAddress = {+ legalName: string;+ line1: string;+ line2: string;+ city: string;+ state: string;+ postalCode: string;+ country: string;+};++type PaymentMethod = {+ brand: string;+ last4: string;+ expMonth: number;+ expYear: number;+};++type BillingInfo = {+ email: string;+ address: BillingAddress | null;+ taxId: string | null;+ paymentMethod: PaymentMethod | null;+ billingPeriod: "month" | "year" | null;+};++function capitalizeBrand(brand: string): string {+ if (!brand) return "Card";+ return brand+ .split("_")+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))+ .join(" ");+}++type DashboardBillingFreePlanCardProps = {+ onUpgrade?: () => void;+};++function DashboardBillingFreePlanCard(props: DashboardBillingFreePlanCardProps) {+ return (+ <DashboardSurfaceCard class="flex flex-col gap-4 md:flex-row md:items-center">+ <DashboardFreePlanDetails />++ <Button+ class="gap-0 pl-0 pr-2"+ onClick={props.onUpgrade}+ >+ <span class="grid h-7 w-6 place-items-center overflow-clip">+ <Icon name="upgrade" class="size-6" />+ </span>+ Upgrade to Pro+ </Button>+ </DashboardSurfaceCard>+ );+}++type DashboardBillingCurrentPlanProps = {+ onUpgrade?(): void;+};++function DashboardBillingCurrentPlan(props: DashboardBillingCurrentPlanProps) {+ const auth = useAuth();++ return (+ <section class="flex flex-col">+ <div class="flex h-9 items-center px-2">+ <h2 class="text-sm leading-5 font-450 text-foreground">+ Current plan+ </h2>+ </div>++ <Show+ when={auth.isPro()}+ fallback={<DashboardBillingFreePlanCard onUpgrade={props.onUpgrade} />}+ >+ <DashboardPlanSummaryCard+ action={+ <Button variant="secondary" onClick={openBillingPortal}>+ Manage plan+ </Button>+ }+ >+ <DashboardProPlanDetails />+ </DashboardPlanSummaryCard>+ </Show>++ <div class="flex h-11 items-center px-2 text-xs text-muted-foreground">+ <span>Looking for enterprise features? </span>+ <a href="https://cal.com/konstantinpaulus" target="_blank" class="cursor-pointer text-primary hover:underline ml-0.5">+ Contact sales+ </a>+ </div>+ </section>+ );+}++type DashboardBillingInfoRowProps = {+ title: string;+ actionLabel: string;+ children: JSX.Element;+};++function DashboardBillingInfoRow(props: DashboardBillingInfoRowProps) {+ return (+ <DashboardInfoActionRow+ title={props.title}+ description={props.children}+ action={+ <Button variant="secondary" onClick={openBillingPortal}>+ {props.actionLabel}+ </Button>+ }+ layout="responsive-md"+ />+ );+}++function addressLines(address: BillingAddress): string[] {+ const locality = [address.city, address.state, address.postalCode, address.country]+ .map((value) => value.trim())+ .filter(Boolean)+ .join(" ");++ return [address.legalName, address.line1, address.line2, locality].filter(Boolean);+}++type DashboardBillingInformationProps = {+ info: Accessor<BillingInfo | undefined>;+};++function DashboardBillingInformation(props: DashboardBillingInformationProps) {+ const taxIdActionLabel = () => (props.info()?.taxId ? "Update" : "Add");+ const paymentMethodText = () => {+ const pm = props.info()?.paymentMethod;+ if (!pm) return null;+ const exp = `${String(pm.expMonth).padStart(2, "0")}/${pm.expYear}`;+ return {+ summary: `${capitalizeBrand(pm.brand)} ending in ${pm.last4}`,+ expires: `Expires ${exp}`,+ };+ };+ const billingPeriodLabel = () => {+ const period = props.info()?.billingPeriod;+ if (period === "month") return "Monthly";+ if (period === "year") return "Yearly";+ return null;+ };++ return (+ <DashboardSurfaceSection title="Billing information">+ <DashboardDividedStack>+ <DashboardBillingInfoRow title="Payment method" actionLabel="Update">+ <Show+ when={paymentMethodText()}+ fallback={<p>No payment method on file</p>}+ >+ {(info) => (+ <>+ <p>{info().summary}</p>+ <p>{info().expires}</p>+ </>+ )}+ </Show>+ </DashboardBillingInfoRow>+ <DashboardBillingInfoRow title="Billing period" actionLabel="Update">+ <p>{billingPeriodLabel() ?? "No active subscription"}</p>+ </DashboardBillingInfoRow>+ <DashboardBillingInfoRow title="Billing email" actionLabel="Update">+ <p>{props.info()?.email || "Not provided"}</p>+ </DashboardBillingInfoRow>+ <DashboardBillingInfoRow title="Tax ID" actionLabel={taxIdActionLabel()}>+ <p>{props.info()?.taxId ?? "Not provided"}</p>+ </DashboardBillingInfoRow>+ <DashboardBillingInfoRow title="Billing address" actionLabel="Update">+ <Show+ when={props.info()?.address}+ fallback={<p>No billing address on file</p>}+ >+ {(address) => (+ <For each={addressLines(address())}>+ {(line) => <p>{line}</p>}+ </For>+ )}+ </Show>+ </DashboardBillingInfoRow>+ </DashboardDividedStack>+ </DashboardSurfaceSection>+ );+}++type DashboardBillingInfoViewProps = {+ onUpgrade?(): void;+};++export function DashboardBillingInfoView(props: DashboardBillingInfoViewProps) {+ const auth = useAuth();++ const [info] = createResource<BillingInfo | undefined, boolean>(+ () => auth.isPro(),+ async (isPro) => {+ if (!isPro) return undefined;+ return (await trpc.getBillingInfo.query()) as BillingInfo;+ },+ );++ return (+ <div class="flex flex-col gap-6">+ <DashboardBillingCurrentPlan onUpgrade={props.onUpgrade} />+ <Show when={auth.isPro()}>+ <DashboardBillingInformation info={info} />+ </Show>+ </div>+ );+}diff --git a/apps/web/src/components/dashboard/billing-view.tsx b/apps/web/src/components/dashboard/billing-view.tsxnew file mode 100644index 00000000..6f5d9d10--- /dev/null+++ b/apps/web/src/components/dashboard/billing-view.tsx@@ -0,0 +1,83 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Match, Show, Switch, createSignal } from "solid-js";++import { useAuth } from "@/context/auth";++import { DashboardBillingInfoView } from "./billing-info-view";+import { DashboardInvoicesView } from "./invoices-view";+import { DashboardPlansView } from "./plans-view";++type BillingTab = "plans" | "billing" | "invoices";++type DashboardBillingTabButtonProps = {+ label: string;+ active: boolean;+ onClick: () => void;+};++function DashboardBillingTabButton(props: DashboardBillingTabButtonProps) {+ return (+ <button+ type="button"+ onClick={props.onClick}+ class="text-sm leading-5 font-450 transition-colors"+ classList={{+ "text-foreground": props.active,+ "text-muted-foreground hover:text-foreground": !props.active,+ }}+ >+ {props.label}+ </button>+ );+}++export function DashboardBillingView() {+ const auth = useAuth();+ const [tab, setTab] = createSignal<BillingTab>("plans");+ const activeTab = (): BillingTab => (auth.hasStripeCustomer() ? tab() : "plans");++ return (+ <div class="min-h-0 flex-1 overflow-y-auto">+ <div class="flex min-h-full flex-col">+ <div class="sticky top-0 z-10 flex h-12 items-center border-b border-border bg-background px-4">+ <div class="flex items-center gap-6">+ <DashboardBillingTabButton+ label="Plans"+ active={activeTab() === "plans"}+ onClick={() => setTab("plans")}+ />+ <Show when={auth.hasStripeCustomer()}>+ <DashboardBillingTabButton+ label="Billing"+ active={activeTab() === "billing"}+ onClick={() => setTab("billing")}+ />+ <DashboardBillingTabButton+ label="Invoices"+ active={activeTab() === "invoices"}+ onClick={() => setTab("invoices")}+ />+ </Show>+ </div>+ </div>++ <div class="flex flex-col gap-6 px-6 pb-6 pt-4">+ <Switch>+ <Match when={activeTab() === "plans"}>+ <DashboardPlansView />+ </Match>+ <Match when={activeTab() === "billing"}>+ <DashboardBillingInfoView onUpgrade={() => setTab("plans")} />+ </Match>+ <Match when={activeTab() === "invoices"}>+ <DashboardInvoicesView />+ </Match>+ </Switch>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/dashboard/dashboard.tsx b/apps/web/src/components/dashboard/dashboard.tsxnew file mode 100644index 00000000..95a81286--- /dev/null+++ b/apps/web/src/components/dashboard/dashboard.tsx@@ -0,0 +1,102 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useSearchParams } from "@solidjs/router";+import { Match, Switch } from "solid-js";++import { Dialog, DialogContent, DialogPortal } from "@/components/ui/dialog";++import { DashboardAccountView } from "./account-view";+import { DashboardAiCreditsView } from "./ai-credits-view";+import { DashboardBillingView } from "./billing-view";+import { DashboardHelpView } from "./help-view";+import { DashboardProjectsView } from "./projects-view";+import { DashboardSettingsView } from "./settings-view";+import { DashboardSidebarHeader, DashboardSidebarNav, DashboardSidebarUser, DashboardSidebarItem } from "./sidebar";+import { Separator } from "@/components/ui/separator";++import type { DashboardView } from "./types";++const DASHBOARD_VIEWS: readonly DashboardView[] = [+ "projects",+ "templates",+ "ai-credits",+ "billing",+ "account",+ "settings",+ "preferences",+ "help",+];++function parseView(value: string | string[] | undefined): DashboardView {+ const raw = Array.isArray(value) ? value[0] : value;+ return DASHBOARD_VIEWS.find((v) => v === raw) ?? "projects";+}++export function Dashboard() {+ const [params, setParams] = useSearchParams();++ const view = (): DashboardView => parseView(params.dashboard);+ const setView = (next: DashboardView) => {+ setParams({ dashboard: next }, { replace: true });+ };++ const close = () => {+ setParams({ dashboard: undefined }, { replace: true });+ };++ const handleOpenChange = (open: boolean) => {+ if (!open) close();+ };++ return (+ <Dialog open preventScroll={false} onOpenChange={handleOpenChange}>+ <DialogPortal>+ <DialogContent+ showCloseButton={false}+ class="h-150 min-w-251 overflow-hidden rounded-xl p-0 gap-0"+ >+ <div class="flex h-full min-h-0 flex-row">+ <aside class="flex min-h-0 w-56 shrink-0 flex-col bg-card">+ <DashboardSidebarHeader />+ <DashboardSidebarNav>+ <DashboardSidebarItem active={view() === "projects"} onClick={() => setView("projects")} icon="diffusion-project-file" label="Projects" />+ <DashboardSidebarItem active={view() === "ai-credits"} onClick={() => setView("ai-credits")} icon="ai-generate" label="AI credits" class="mt-auto" />+ <DashboardSidebarItem active={view() === "billing"} onClick={() => setView("billing")} icon="billing" label="Billing" />+ <DashboardSidebarItem active={view() === "settings"} onClick={() => setView("settings")} icon="settings" label="Settings" />+ <DashboardSidebarItem active={view() === "help"} onClick={() => setView("help")} icon="help" label="Help" />+ </DashboardSidebarNav>+ <DashboardSidebarUser active={view() === "account"} onClick={() => setView("account")} />+ </aside>++ <Separator orientation="vertical" />++ <section class="flex min-h-0 flex-1 flex-col">+ <Switch>+ <Match when={view() === "projects"}>+ <DashboardProjectsView />+ </Match>+ <Match when={view() === "ai-credits"}>+ <DashboardAiCreditsView />+ </Match>+ <Match when={view() === "billing"}>+ <DashboardBillingView />+ </Match>+ <Match when={view() === "account"}>+ <DashboardAccountView />+ </Match>+ <Match when={view() === "settings"}>+ <DashboardSettingsView />+ </Match>+ <Match when={view() === "help"}>+ <DashboardHelpView />+ </Match>+ </Switch>+ </section>+ </div>+ </DialogContent>+ </DialogPortal>+ </Dialog>+ );+}diff --git a/apps/web/src/components/dashboard/help-view.tsx b/apps/web/src/components/dashboard/help-view.tsxnew file mode 100644index 00000000..4df2df99--- /dev/null+++ b/apps/web/src/components/dashboard/help-view.tsx@@ -0,0 +1,121 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show } from "solid-js";+import { toast } from "somoto";++import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { useAuth } from "@/context/auth";++import {+ DashboardLabelValue,+ DashboardDividedStack,+ DashboardScrollView,+ DashboardSurfaceSection,+} from "./shared";++type DashboardHelpExternalRowProps = {+ label: string;+ href: string;+};++function DashboardHelpExternalRow(props: DashboardHelpExternalRowProps) {+ return (+ <div class="flex h-4 w-full items-center gap-4 rounded-md text-xs text-foreground outline-none focus-ring">+ <span class="min-w-0 flex-1 truncate text-left">+ {props.label}+ </span>+ <a href={props.href} target="_blank">+ <Icon name="external-link" class="text-foreground" />+ </a>+ </div>+ );+}++type DashboardHelpUserIdRowProps = {+ value: string;+ onCopy: () => void;+};++function DashboardHelpUserIdRow(props: DashboardHelpUserIdRowProps) {+ return (+ <div class="flex flex-col gap-4 sm:flex-row sm:items-center">+ <DashboardLabelValue+ label="User id"+ value={props.value}+ valueClass="truncate text-xxs"+ />+ <Button variant="secondary" onClick={props.onCopy}>+ Copy+ </Button>+ </div>+ );+}++export function DashboardHelpView() {+ const auth = useAuth();+ const userId = () => auth.user()?.id ?? "";++ const copyUserId = async () => {+ const id = userId();+ if (!id) return;++ try {+ await navigator.clipboard.writeText(id);+ toast("Copied!", { description: "The user id has been copied to your clipboard." });+ } catch (error) {+ toast("Failed to copy", { description: error instanceof Error ? error.message : "Unknown error" });+ }+ };++ return (+ <DashboardScrollView>+ <DashboardSurfaceSection title="Resources">+ <DashboardDividedStack>+ <DashboardHelpExternalRow+ label="What's new"+ href="https://www.diffusion.studio/updates"+ />+ <DashboardHelpExternalRow+ label="Discord community"+ href="https://discord.gg/AYySWDhgNK"+ />+ </DashboardDividedStack>+ </DashboardSurfaceSection>++ <DashboardSurfaceSection title="Support">+ <DashboardDividedStack>+ <Show when={userId()}>+ <DashboardHelpUserIdRow value={userId()} onCopy={copyUserId} />+ </Show>+ <DashboardHelpExternalRow+ label="Report issue"+ href="mailto:[email protected]"+ />+ <DashboardHelpExternalRow+ label="Contact support"+ href="https://discord.gg/AYySWDhgNK"+ />+ </DashboardDividedStack>+ </DashboardSurfaceSection>++ {/*+ <DashboardSurfaceSection title="Keyboard shortcuts">+ <DashboardInfoActionRow+ leading={<Icon name="keyboard-shortcut" class="size-6 text-foreground" />}+ title="View, search, and customize shortcuts."+ action={+ <Button variant="secondary">+ Open keyboard shortcuts...+ </Button>+ }+ layout="inline"+ />+ </DashboardSurfaceSection>+ */}+ </DashboardScrollView>+ );+}+diff --git a/apps/web/src/components/dashboard/index.ts b/apps/web/src/components/dashboard/index.tsnew file mode 100644index 00000000..c0d66686--- /dev/null+++ b/apps/web/src/components/dashboard/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from "./dashboard";diff --git a/apps/web/src/components/dashboard/invoices-view.tsx b/apps/web/src/components/dashboard/invoices-view.tsxnew file mode 100644index 00000000..8a240f40--- /dev/null+++ b/apps/web/src/components/dashboard/invoices-view.tsx@@ -0,0 +1,168 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createResource } from "solid-js";++import { Badge } from "@/components/ui/badge";+import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { trpc } from "@/lib/trpc";++import { DashboardDividedStack, DashboardSurfaceCard } from "./shared";++type InvoiceStatus = "Upcoming" | "Open" | "Overdue" | "Paid";+type InvoiceBadgeVariant = "base" | "destructive" | "success";++export type InvoiceItem = {+ id: string;+ dueDate: string;+ amount: string;+ status: InvoiceStatus;+ url: string | null;+};++type RawInvoice = {+ id: string;+ status: string | null;+ total: number;+ currency: string;+ dueDate: number;+ hostedUrl: string | null;+};++function formatInvoiceDate(timestampMs: number): string {+ return new Date(timestampMs).toLocaleDateString("en-US", {+ year: "numeric",+ month: "long",+ day: "numeric",+ });+}++function formatInvoiceAmount(totalMinor: number, currency: string): string {+ return new Intl.NumberFormat("en-US", {+ style: "currency",+ currency: currency.toUpperCase(),+ }).format(totalMinor / 100);+}++function mapInvoiceStatus(+ status: string | null,+ dueDateMs: number,+): InvoiceStatus {+ if (status === "paid") return "Paid";+ if (status === "draft") return "Upcoming";+ if (status === "uncollectible") return "Overdue";+ if (status === "open") return dueDateMs < Date.now() ? "Overdue" : "Open";+ return "Open";+}++function toInvoiceItem(invoice: RawInvoice): InvoiceItem {+ return {+ id: invoice.id,+ dueDate: formatInvoiceDate(invoice.dueDate),+ amount: formatInvoiceAmount(invoice.total, invoice.currency),+ status: mapInvoiceStatus(invoice.status, invoice.dueDate),+ url: invoice.hostedUrl,+ };+}++function DashboardInvoicesEmptyState() {+ return (+ <DashboardSurfaceCard class="grid min-h-62 w-full place-items-center">+ <div class="flex flex-col items-center gap-1 text-center">+ <Icon name="info" class="text-muted-foreground" />+ <p class="text-muted-foreground text-xs">+ No invoices yet<br />+ our invoices will show up here once available.+ </p>+ </div>+ </DashboardSurfaceCard>+ );+}++function DashboardInvoicesList(props: { invoices: InvoiceItem[] }) {+ const badgeVariant = (status: InvoiceStatus): InvoiceBadgeVariant => {+ if (status === "Overdue") return "destructive";+ if (status === "Paid") return "success";+ return "base";+ };++ const openInvoice = (url: string | null) => {+ if (!url) return;+ window.open(url, "_blank", "noopener,noreferrer");+ };++ return (+ <div class="flex flex-col">+ <div class="px-4 pb-3 pt-2">+ <div class="flex items-center gap-4 text-xs text-muted-foreground">+ <p class="min-w-0 flex-1">Due date</p>+ <p class="w-24">Amount</p>+ <p class="w-24">Status</p>+ <span class="size-4 shrink-0" />+ </div>+ </div>++ <DashboardSurfaceCard>+ <DashboardDividedStack spacing="loose">+ <For each={props.invoices}>+ {(invoice) => (+ <div class="flex items-center gap-4">+ <p class="min-w-0 flex-1 truncate text-xs text-foreground">+ {invoice.dueDate}+ </p>+ <p class="w-24 text-xs text-foreground">+ {invoice.amount}+ </p>+ <div class="w-24">+ <Badge variant={badgeVariant(invoice.status)}>+ {invoice.status}+ </Badge>+ </div>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ variant="ghost"+ size="icon-square"+ disabled={!invoice.url}+ onClick={() => openInvoice(invoice.url)}+ >+ <Icon name="external-link" />+ </TooltipTrigger>+ <TooltipContent>Open invoice</TooltipContent>+ </Tooltip>+ </div>+ )}+ </For>+ </DashboardDividedStack>+ </DashboardSurfaceCard>+ </div>+ );+}++export function DashboardInvoicesView() {+ const [invoices] = createResource<InvoiceItem[]>(async () => {+ try {+ const raw = await trpc.listInvoices.query();+ return raw.map(toInvoiceItem);+ } catch (err) {+ console.error("Failed to load invoices", err);+ return [];+ }+ });++ return (+ <Show+ when={!invoices.loading && (invoices() ?? []).length > 0}+ fallback={+ <Show when={!invoices.loading}>+ <DashboardInvoicesEmptyState />+ </Show>+ }+ >+ <DashboardInvoicesList invoices={invoices()!} />+ </Show>+ );+}diff --git a/apps/web/src/components/dashboard/plans-view.tsx b/apps/web/src/components/dashboard/plans-view.tsxnew file mode 100644index 00000000..b217cd31--- /dev/null+++ b/apps/web/src/components/dashboard/plans-view.tsx@@ -0,0 +1,285 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show, createSignal } from "solid-js";+import type { SubscriptionCredits } from "@diffusionstudio/api-contract";++import { Button } from "@/components/ui/button";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import {+ SwitchControl,+ SwitchInput,+ SwitchThumb,+ Switch as Toggle,+} from "@/components/ui/switch";+import {+ SUBSCRIPTION_CREDIT_TIERS,+ SUBSCRIPTION_VOLUME_DISCOUNT,+ getSubscriptionPrice,+ openBillingPortal,+ startSubscriptionCheckout,+} from "@/lib/checkout";+import { useAuth } from "@/context/auth";++import { DashboardFeatureRow, DashboardSurfaceCard } from "./shared";++function formatCreditTierLabel(tier: SubscriptionCredits): string {+ const credits = parseInt(tier.replace("_", ""), 10).toLocaleString();+ const discount = SUBSCRIPTION_VOLUME_DISCOUNT[tier];+ return discount > 0+ ? `${credits} credits (${Math.round(discount * 100)}% off)`+ : `${credits} credits`;+}++function DashboardBillingFreePlanFeatures() {+ return (+ <>+ <DashboardFeatureRow label="Unlimited 4K exports" />+ <DashboardFeatureRow label="Unlimited projects" />+ <DashboardFeatureRow label="Unlimited file imports" />+ <DashboardFeatureRow label="No watermark" />+ <DashboardFeatureRow label="Commercial use allowed" />+ </>+ );+}++export function DashboardProPlanFeatures() {+ return (+ <>+ <DashboardFeatureRow label="Top up credits anytime" />+ <DashboardFeatureRow label="Monthly credit refill" />+ <DashboardFeatureRow label="Access to pro models" />+ <DashboardFeatureRow label="Priority feedback channel" />+ </>+ );+}++function DashboardBillingEnterprisePlanFeatures() {+ return (+ <>+ <DashboardFeatureRow label="SSO & SAML" />+ <DashboardFeatureRow label="Cloud backup" />+ <DashboardFeatureRow label="Train your own model" />+ <DashboardFeatureRow label="Dedicated account manager" />+ </>+ );+}++export function DashboardPlansView() {+ const auth = useAuth();+ const [annualBilling, setAnnualBilling] = createSignal(true);+ const [creditTier, setCreditTier] = createSignal<SubscriptionCredits>("2_500");+ const [checkoutLoading, setCheckoutLoading] = createSignal(false);++ const billingPeriod = (): "month" | "year" => (annualBilling() ? "year" : "month");+ const proPrice = () => getSubscriptionPrice(creditTier(), billingPeriod());++ const handleUpgrade = async () => {+ if (checkoutLoading()) return;+ setCheckoutLoading(true);+ try {+ await startSubscriptionCheckout({+ creditQuantity: creditTier(),+ billingPeriod: billingPeriod(),+ });+ } finally {+ setCheckoutLoading(false);+ }+ };++ const handleLearnMoreClick = (event: MouseEvent) => {+ event.preventDefault();+ };++ return (+ <div class="flex flex-col gap-6">+ <div class="flex flex-col">+ <div class="flex items-end gap-4 px-2 pb-4 pt-2">+ <div class="flex min-w-0 flex-1 flex-col gap-1">+ <h2 class="text-sm leading-5 font-450 text-foreground">+ Plans+ </h2>+ <div class="text-muted-foreground text-xs">+ <p>You are currently on a {auth.isPro() ? "Pro" : "Free"} plan.</p>+ <Show when={!auth.isPro()}>+ <p>Select AI credits that fit your usage, then upgrade.</p>+ </Show>+ </div>+ </div>++ <div class="flex shrink-0 items-center gap-2 text-xs ">+ <button+ type="button"+ class="transition-colors text-muted-foreground hover:text-foreground"+ classList={{ "text-foreground": !annualBilling() }}+ onClick={() => setAnnualBilling(false)}+ >+ Monthly+ </button>++ <Toggle checked={annualBilling()} onChange={setAnnualBilling} class="relative">+ <SwitchInput aria-label="Toggle annual billing" />+ <SwitchControl variant="compact">+ <SwitchThumb variant="compact" />+ </SwitchControl>+ </Toggle>++ <button+ type="button"+ class="transition-colors text-muted-foreground hover:text-foreground"+ classList={{ "text-foreground": annualBilling() }}+ onClick={() => setAnnualBilling(true)}+ >+ Annually (Save 25%)+ </button>+ </div>+ </div>++ <div class="grid gap-4 md:grid-cols-3">+ <DashboardSurfaceCard class="flex min-h-99 flex-col gap-3">+ <div class="flex flex-1 flex-col gap-4">+ <div class="flex flex-col gap-1">+ <h2 class="text-sm leading-5 font-450 text-foreground">+ Free+ </h2>+ <p class="text-lg leading-6 font-450 text-foreground">+ $0+ </p>+ <p class="text-muted-foreground text-xs">+ For getting started with video editing+ </p>+ </div>++ <div class="flex flex-col gap-3">+ <div class="h-px w-full bg-border" />+ <div class="flex h-7 items-center">+ <p class="min-w-0 flex-1 truncate text-xs text-muted-foreground">+ 50 free trial AI credits+ </p>+ </div>+ <div class="h-px w-full bg-border" />+ </div>++ <div class="flex flex-col gap-2">+ <DashboardBillingFreePlanFeatures />+ </div>+ </div>++ <Button variant="secondary" class="w-full" disabled={!auth.isPro()} onClick={openBillingPortal}>+ {auth.isPro() ? "Downgrade to Free" : "Current plan"}+ </Button>+ </DashboardSurfaceCard>++ <DashboardSurfaceCard class="flex min-h-99 flex-col gap-3">+ <div class="flex flex-1 flex-col gap-4">+ <div class="flex flex-col gap-1">+ <h2 class="text-sm leading-5 font-450 text-foreground">+ Pro+ </h2>+ <div class="flex items-center gap-1">+ <p class="text-lg leading-6 font-450 text-foreground">+ ${proPrice()}+ </p>+ <p class="text-muted-foreground text-xs translate-y-0.5 leading-none">+ {annualBilling() ? "/month, billed annually" : "/month"}+ </p>+ </div>+ <p class="text-muted-foreground text-xs">+ For creators and professionals+ </p>+ </div>++ <div class="flex flex-col gap-3">+ <div class="h-px w-full bg-border" />+ <Select<SubscriptionCredits>+ options={SUBSCRIPTION_CREDIT_TIERS}+ value={creditTier()}+ onChange={(value) => value && setCreditTier(value)}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {formatCreditTierLabel(itemProps.item.rawValue)}+ </SelectItem>+ )}+ >+ <SelectTrigger aria-label="Select AI credits per month">+ <SelectValue<SubscriptionCredits>>+ {formatCreditTierLabel(creditTier())}+ <span class="text-muted-foreground text-xs">/mo*</span>+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ <div class="h-px w-full bg-border" />+ </div>++ <div class="flex flex-col gap-2">+ <p class="text-muted-foreground text-xs">+ Everything in Free, plus:+ </p>+ <DashboardProPlanFeatures />+ </div>+ </div>++ <Button class="w-full" disabled={auth.isPro() || checkoutLoading()} onClick={handleUpgrade}>+ {auth.isPro() ? "Current plan" : "Continue with Pro"}+ </Button>+ </DashboardSurfaceCard>++ <DashboardSurfaceCard class="flex min-h-99 flex-col gap-3">+ <div class="flex flex-1 flex-col gap-4">+ <div class="flex flex-col gap-1">+ <h2 class="text-sm leading-5 font-450 text-foreground">+ Enterprise+ </h2>+ <p class="text-lg leading-6 font-450 text-foreground">+ Custom+ </p>+ <p class="text-muted-foreground text-xs">+ For teams and organizations+ </p>+ </div>++ <div class="flex flex-col gap-3">+ <div class="h-px w-full bg-border" />+ <div class="flex h-7 items-center">+ <p class="min-w-0 flex-1 truncate text-xs text-muted-foreground">+ Custom AI credit limits+ </p>+ </div>+ <div class="h-px w-full bg-border" />+ </div>++ <div class="flex flex-col gap-2">+ <p class="text-muted-foreground text-xs">+ Everything in Pro, plus:+ </p>+ <DashboardBillingEnterprisePlanFeatures />+ </div>+ </div>++ <Button as="a" class="w-full" href="https://cal.com/konstantinpaulus" target="_blank" variant="secondary">+ Contact sales+ </Button>+ </DashboardSurfaceCard>+ </div>+ </div>++ <div class="px-2 pt-1 text-xs text-muted-foreground">+ <span>*AI credits reset monthly. Volume discount applies for higher credits. </span>+ <a href="#" class="text-primary hover:underline" onClick={handleLearnMoreClick}>+ Learn more+ </a>+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/dashboard/projects-view.tsx b/apps/web/src/components/dashboard/projects-view.tsxnew file mode 100644index 00000000..a1f44320--- /dev/null+++ b/apps/web/src/components/dashboard/projects-view.tsx@@ -0,0 +1,366 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ deleteProject,+ duplicateProject,+ listRecentProjects,+ setProjectName,+ setProjectThumbnail,+ DEFAULT_PROJECT_ID,+ type ProjectEntry,+} from "@/components/engine/db";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuPortal,+ ContextMenuSeparator,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import { TextField, TextFieldInput } from "@/components/ui/text-field";+import { toast } from "somoto";+import { For, Show, batch, createMemo, createResource, createSignal, onCleanup, onMount } from "solid-js";+import { useSearchParams } from "@solidjs/router";++import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import {+ DashboardCardMeta,+ DashboardCardButton,+ DashboardCardPreview,+ DashboardViewSection,+} from "./shared";+import { DashboardSearchPanel } from "./search-bar";+import { useProjectId } from "@/hooks/use-project-id";+import { captureCanvasThumbnail } from "../engine/thumbnail";+import { MAIN_CANVAS_ID } from "../canvas";+import { Icon } from "../ui/icon";+import { nanoid } from "nanoid";+import { track } from "@/lib/analytics";++import type { ProjectSortOption } from "./types";++export function DashboardProjectsView() {+ const projectId = useProjectId();+ const [, setParams] = useSearchParams();+ const [search, setSearch] = createSignal("");+ const [sort, setSort] = createSignal<ProjectSortOption>("last-viewed");+ const [projects, { refetch: refetchProjects }] = createResource(() => listRecentProjects(32));+ const [contextMenuProjectId, setContextMenuProjectId] = createSignal<string | null>(null);+ const [renamingProjectId, setRenamingProjectId] = createSignal<string | null>(null);+ const [renameDraft, setRenameDraft] = createSignal("");++ const selectedSortOption = () =>+ SORT_OPTIONS.find((option) => option.id === sort()) ?? SORT_OPTIONS[0];++ const normalizedSearch = createMemo(() => search().trim().toLowerCase());++ onMount(async () => {+ if (projectId() == DEFAULT_PROJECT_ID) return;++ const canvas = document.getElementById(MAIN_CANVAS_ID) as HTMLCanvasElement;+ const blob = await captureCanvasThumbnail(canvas);+ if (blob) {+ setProjectThumbnail(projectId(), blob);+ refetchProjects();+ };+ })++ const filteredProjects = createMemo(() => {+ const query = normalizedSearch();+ const entries = projects() ?? [];+ if (!query) return entries;++ return entries.filter((project) => project.name.toLowerCase().includes(query));+ });++ const sortedProjects = createMemo(() => {+ const sortMode = sort();+ const entries = [...filteredProjects()];++ if (sortMode === "alphabetical") {+ entries.sort((a, b) => a.name.localeCompare(b.name));+ return entries;+ }++ if (sortMode === "date-created") {+ entries.sort((a, b) => parseTimestamp(b.createdAt) - parseTimestamp(a.createdAt));+ return entries;+ }++ entries.sort((a, b) => parseTimestamp(b.lastAccessedAt) - parseTimestamp(a.lastAccessedAt));+ return entries;+ });++ const openProject = (projectId: string) => {+ if (renamingProjectId() === projectId) return;++ track('project_opened');+ setParams({ project: projectId, dashboard: undefined }, { replace: true });+ };++ const startRenaming = (project: ProjectEntry) => {+ batch(() => {+ setRenameDraft(project.name);+ setRenamingProjectId(project.id);+ });+ };++ const handleDelete = async (project: ProjectEntry) => {+ try {+ await deleteProject(project.id);+ track('project_deleted');+ refetchProjects();+ } catch {+ toast.error("Failed to delete project");+ }+ };++ const handleDuplicate = async (project: ProjectEntry) => {+ try {+ await duplicateProject(project.id);+ track('project_duplicated');+ refetchProjects();+ } catch {+ toast.error("Failed to duplicate project");+ }+ };++ const handleRenameInput = (event: InputEvent & { currentTarget: HTMLInputElement }) => {+ setRenameDraft(event.currentTarget.value);+ };++ const handleFocusRenameInput = (event: FocusEvent & { currentTarget: HTMLInputElement }) => {+ event.currentTarget.select();+ };++ const handleBlurRenameInput = () => {+ batch(() => {+ setRenamingProjectId(null);+ setRenameDraft("");+ });+ refetchProjects();+ };++ const handleKeyDownRenameInput = async (event: KeyboardEvent, projectId: string) => {+ const input = event.currentTarget as HTMLInputElement;+ const trimmedName = renameDraft()?.trim() ?? "";++ if (event.key === "Escape") {+ refetchProjects();+ setRenamingProjectId(null);+ setRenameDraft("");++ event.preventDefault();+ event.stopPropagation();+ input.blur();+ }++ if (event.key == "Enter") {+ event.preventDefault();+ event.stopPropagation();++ if (trimmedName.length > 0 && projectId === renamingProjectId()) {+ await setProjectName(projectId, trimmedName);+ }++ refetchProjects();+ setRenamingProjectId(null);+ setRenameDraft("");++ input.blur();+ };+ };++ const handleCreateProject = () => {+ track('project_created');+ setParams({+ project: nanoid(),+ dashboard: undefined+ }, { replace: true });+ };++ return (+ <DashboardSearchPanel+ value={search}+ onChange={setSearch}+ placeholder="Search in projects"+ >+ <DashboardViewSection+ title="Recent projects"+ controls={+ <Select<(typeof SORT_OPTIONS)[number]>+ options={SORT_OPTIONS}+ value={selectedSortOption()}+ onChange={(option) => option && setSort(option.id)}+ optionValue="id"+ optionTextValue="label"+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {itemProps.item.rawValue.label}+ </SelectItem>+ )}+ >+ <SelectTrigger aria-label="Sort projects">+ <SelectValue<(typeof SORT_OPTIONS)[number]>>+ {(state) => state.selectedOption()?.label}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ }+ >+ <DashboardCardButton onClick={handleCreateProject} class="hover:bg-background">+ <DashboardCardPreview class="bg-background group-hover:bg-accent group-hover:border-input">+ <Icon+ name="plus-add"+ class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-muted-foreground"+ />+ </DashboardCardPreview>+ <DashboardCardMeta title="New project" />+ </DashboardCardButton>+ <For each={sortedProjects().filter(project => project.id !== DEFAULT_PROJECT_ID).slice(0, MAX_VISIBLE_PROJECTS)}>+ {(project) => (+ <ContextMenu+ modal={false}+ onOpenChange={(open) => {+ setContextMenuProjectId((current) => {+ if (open) return project.id;+ return current === project.id ? null : current;+ });+ }}+ >+ <ContextMenuTrigger as="div" class="contents">+ <DashboardCardButton+ active={contextMenuProjectId() === project.id}+ onClick={() => openProject(project.id)}+ >+ <DashboardCardPreview>+ <ProjectThumbnail thumbnail={project.thumbnail} />+ </DashboardCardPreview>+ <div class="flex flex-col gap-1 px-2">+ <div class="relative h-4 w-full">+ <Show+ when={renamingProjectId() === project.id}+ fallback={+ <p class="min-w-0 truncate text-xs text-foreground">+ {project.name}+ </p>+ }+ >+ <TextField class="contents">+ <TextFieldInput+ uiSize="compact"+ type="text"+ value={renameDraft()}+ onInput={handleRenameInput}+ onFocus={handleFocusRenameInput}+ onBlur={handleBlurRenameInput}+ onKeyDown={(e: KeyboardEvent) => handleKeyDownRenameInput(e, project.id)}+ placeholder="Project name"+ aria-label="Project name"+ class="absolute left-1/2 top-1/2 h-5 w-56 -translate-x-1/2 -translate-y-1/2 border border-ring bg-input px-1 py-0 ring-1 ring-inset ring-ring"+ />+ </TextField>+ </Show>+ </div>+ <p class="min-w-0 truncate text-xs text-muted-foreground">+ {formatEditedAt(project.lastAccessedAt)}+ </p>+ </div>+ </DashboardCardButton>+ </ContextMenuTrigger>+ <ContextMenuPortal>+ <ContextMenuContent class="w-45 gap-0">+ <ContextMenuItem onSelect={() => openProject(project.id)}>+ Open+ </ContextMenuItem>+ <ContextMenuSeparator class="my-2" />+ <ContextMenuItem onSelect={() => startRenaming(project)}>+ Rename+ </ContextMenuItem>+ <ContextMenuItem onSelect={() => handleDuplicate(project)}>+ Duplicate+ </ContextMenuItem>+ <ContextMenuSeparator class="my-2" />+ <ContextMenuItem onSelect={() => handleDelete(project)}>+ Delete+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ )}+ </For>+ </DashboardViewSection>+ </DashboardSearchPanel>+ );+}++function ProjectThumbnail(props: { thumbnail?: Blob }) {+ const url = createMemo(() => {+ if (!props.thumbnail) return null;+ return URL.createObjectURL(props.thumbnail);+ });++ onCleanup(() => {+ const u = url();+ if (u) URL.revokeObjectURL(u);+ });++ return (+ <Show when={url()}>+ <img+ src={url()!}+ alt=""+ class="h-full w-full object-cover"+ draggable={false}+ />+ </Show>+ );+}++const SORT_OPTIONS: Array<{ id: ProjectSortOption; label: string }> = [+ { id: "last-viewed", label: "Last viewed" },+ { id: "alphabetical", label: "Alphabetical" },+ { id: "date-created", label: "Date created" },+];++const MAX_VISIBLE_PROJECTS = 11;++function parseTimestamp(value: string): number {+ const parsed = Date.parse(value);+ return Number.isNaN(parsed) ? 0 : parsed;+}++function formatEditedAt(lastAccessedAt: string): string {+ const timestamp = parseTimestamp(lastAccessedAt);+ if (!timestamp) return "Edited just now";++ const elapsedMs = Date.now() - timestamp;+ if (elapsedMs < 60_000) return "Edited just now";++ const minutes = Math.floor(elapsedMs / 60_000);+ if (minutes < 60) return `Edited ${minutes} minute${minutes === 1 ? "" : "s"} ago`;++ const hours = Math.floor(minutes / 60);+ if (hours < 24) return `Edited ${hours} hour${hours === 1 ? "" : "s"} ago`;++ const days = Math.floor(hours / 24);+ if (days < 30) return `Edited ${days} day${days === 1 ? "" : "s"} ago`;++ const months = Math.floor(days / 30);+ if (months < 12) return `Edited ${months} month${months === 1 ? "" : "s"} ago`;++ const years = Math.floor(days / 365);+ return `Edited ${years} year${years === 1 ? "" : "s"} ago`;+}diff --git a/apps/web/src/components/dashboard/search-bar.tsx b/apps/web/src/components/dashboard/search-bar.tsxnew file mode 100644index 00000000..a03bda9d--- /dev/null+++ b/apps/web/src/components/dashboard/search-bar.tsx@@ -0,0 +1,60 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { type Accessor, type JSX } from "solid-js";++import { Icon } from "@/components/ui/icon";+import { TextField } from "@/components/ui/text-field";++type DashboardSearchBarProps = {+ value: Accessor<string>;+ onChange: (value: string) => void;+ placeholder: string;+};++type DashboardSearchPanelProps = {+ value: Accessor<string>;+ onChange: (value: string) => void;+ placeholder: string;+ children: JSX.Element;+};++export function DashboardSearchBar(props: DashboardSearchBarProps) {+ return (+ <div class="flex h-11 items-center border-b border-border px-4">+ <TextField class="relative flex h-7 w-full items-center gap-0">+ <div class="grid size-7 place-items-center overflow-clip text-muted-foreground">+ <Icon name="search" class="size-6" />+ </div>+ <input+ value={props.value()}+ onInput={(event) => props.onChange(event.currentTarget.value)}+ onKeyDown={(event) => event.stopPropagation()}+ onKeyUp={(event) => event.stopPropagation()}+ type="text"+ placeholder={props.placeholder}+ aria-label={props.placeholder}+ class="peer min-w-0 h-7 flex-1 bg-transparent px-0 rounded-none focus-visible:shadow-none focus-within:outline-none py-1 text-base"+ />+ <div+ class="pointer-events-none absolute left-7 top-1/2 h-4 w-px -translate-y-1/2 bg-foreground opacity-0 transition-opacity peer-focus:opacity-100"+ classList={{ hidden: props.value().length > 0 }}+ />+ </TextField>+ </div>+ );+}++export function DashboardSearchPanel(props: DashboardSearchPanelProps) {+ return (+ <div class="flex min-h-0 flex-1 flex-col">+ <DashboardSearchBar+ value={props.value}+ onChange={props.onChange}+ placeholder={props.placeholder}+ />+ {props.children}+ </div>+ );+}diff --git a/apps/web/src/components/dashboard/settings-view.tsx b/apps/web/src/components/dashboard/settings-view.tsxnew file mode 100644index 00000000..cbcf3132--- /dev/null+++ b/apps/web/src/components/dashboard/settings-view.tsx@@ -0,0 +1,203 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Match, Switch, createResource } from "solid-js";+import { toast } from "somoto";++import { retrieveLastAccessedDirectory } from "@/components/engine/db";+import { changeAssetDirectory } from "@/components/engine";+import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { useEngine } from "@/context/engine";+import { usePermissionState, type PermissionState } from "@/hooks/use-permission";++import {+ DashboardDividedStack,+ DashboardInfoActionRow,+ DashboardScrollView,+ DashboardSurfaceSection,+} from "./shared";++function DashboardProjectsFolderSection() {+ const engine = useEngine();+ const [directory, { refetch }] = createResource(() => retrieveLastAccessedDirectory());++ const handleChange = async () => {+ await changeAssetDirectory(engine.world);+ refetch();+ };++ return (+ <DashboardSurfaceSection title="Projects folder">+ <DashboardInfoActionRow+ title="Save projects to"+ leading={<Icon name="navigation.folder" class="text-foreground" />}+ description={directory()?.name ?? "Origin private file system (OPFS)"}+ action={+ <Button variant="secondary" onClick={handleChange}>+ Change...+ </Button>+ }+ />+ </DashboardSurfaceSection>+ );+}++type PermissionActionButtonProps = {+ state: PermissionState;+ pendingLabel: string;+ unavailableLabel?: string;+ onRequest(): void | Promise<void>;+};++function PermissionActionButton(props: PermissionActionButtonProps) {+ return (+ <Switch>+ <Match when={props.state === "granted"}>+ <Button variant="on">Granted</Button>+ </Match>+ <Match when={props.state === "denied"}>+ <Button variant="secondary" disabled>+ Denied+ </Button>+ </Match>+ <Match when={props.state === "unsupported"}>+ <Button variant="secondary" disabled>+ {props.unavailableLabel ?? "Unavailable"}+ </Button>+ </Match>+ <Match when={props.state === "prompt"}>+ <Button variant="secondary" onClick={props.onRequest}>+ {props.pendingLabel}+ </Button>+ </Match>+ </Switch>+ );+}++function DashboardPermissionsSection() {+ const clipboardState = usePermissionState("clipboard-read");+ const microphoneState = usePermissionState("microphone");+ const fontState = usePermissionState("local-fonts");+ const storageState = usePermissionState("persistent-storage");+ const notificationsState = usePermissionState("notifications");++ const handleClipboardRequest = async () => {+ try {+ await navigator.clipboard.readText();+ } catch {+ toast.error("Clipboard access denied");+ }+ };++ const handleFontsRequest = async () => {+ if (typeof window.queryLocalFonts !== "function") {+ toast.error("Local fonts are not supported in this browser");+ return;+ }+ try {+ await window.queryLocalFonts();+ } catch {+ toast.error("Local network access denied");+ }+ };++ const handleMicrophoneRequest = async () => {+ try {+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });+ stream.getTracks().forEach((track) => track.stop());+ } catch {+ toast.error("Microphone access denied");+ }+ };++ const handleStorageRequest = async () => {+ if (!navigator.storage?.persist) {+ toast.error("Persistent storage is not supported in this browser");+ return;+ }+ const granted = await navigator.storage.persist();+ if (!granted) toast.error("Persistent storage was not granted");+ };++ const handleNotificationsRequest = async () => {+ if (typeof Notification === "undefined") {+ toast.error("Notifications are not supported in this browser");+ return;+ }+ const result = await Notification.requestPermission();+ if (result !== "granted") toast.error("Notifications denied");+ };++ return (+ <DashboardSurfaceSection title="Permissions">+ <DashboardDividedStack>+ <DashboardInfoActionRow+ title="Clipboard access"+ description="Copy/paste text, timecodes, assets metadata."+ action={+ <PermissionActionButton+ state={clipboardState()}+ pendingLabel="Allow clipboard access..."+ onRequest={handleClipboardRequest}+ />+ }+ />+ <DashboardInfoActionRow+ title="Fonts access"+ description="Required to use installed fonts."+ action={+ <PermissionActionButton+ state={fontState()}+ pendingLabel="Allow fonts access..."+ onRequest={handleFontsRequest}+ />+ }+ />+ <DashboardInfoActionRow+ title="Microphone"+ description="Voiceover recording, live audio capture, speech-to-text."+ action={+ <PermissionActionButton+ state={microphoneState()}+ pendingLabel="Allow microphone..."+ onRequest={handleMicrophoneRequest}+ />+ }+ />+ <DashboardInfoActionRow+ title="Persistent storage"+ description="Prevents the browser from evicting your projects and imported assets under disk pressure."+ action={+ <PermissionActionButton+ state={window.chrome ? "granted" : storageState()}+ pendingLabel="Enable persistent storage..."+ onRequest={handleStorageRequest}+ />+ }+ />+ <DashboardInfoActionRow+ title="Notifications"+ description="Alerts when long-running exports and renders finish in the background."+ action={+ <PermissionActionButton+ state={notificationsState()}+ pendingLabel="Allow notifications..."+ onRequest={handleNotificationsRequest}+ />+ }+ />+ </DashboardDividedStack>+ </DashboardSurfaceSection>+ );+}++export function DashboardSettingsView() {+ return (+ <DashboardScrollView>+ <DashboardProjectsFolderSection />+ <DashboardPermissionsSection />+ </DashboardScrollView>+ );+}diff --git a/apps/web/src/components/dashboard/shared.tsx b/apps/web/src/components/dashboard/shared.tsxnew file mode 100644index 00000000..982b8287--- /dev/null+++ b/apps/web/src/components/dashboard/shared.tsx@@ -0,0 +1,496 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Dialog, DialogContent, DialogPortal } from "@/components/ui/dialog";+import { Icon } from "@/components/ui/icon";+import { useAuth } from "@/context/auth";+import { cx } from "@/lib/cva";+import { trpc } from "@/lib/trpc";+import { For, Show, children, createResource, type JSX } from "solid-js";+import { Separator } from "../ui/separator";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+++type DashboardLabelValueProps = {+ label: JSX.Element;+ value: JSX.Element;+ labelClass?: string;+ valueClass?: string;+};++export function DashboardLabelValue(props: DashboardLabelValueProps) {+ return (+ <div class="flex min-w-0 flex-1 flex-col gap-1">+ <p class={cx("text-foreground text-xs", props.labelClass)}>+ {props.label}+ </p>+ <p class={cx("text-muted-foreground text-xs", props.valueClass)}>+ {props.value}+ </p>+ </div>+ );+}++type DashboardSurfaceCardProps = {+ class?: string;+ children: JSX.Element;+};++export function DashboardSurfaceCard(props: DashboardSurfaceCardProps) {+ return (+ <div class={cx("rounded-xl bg-input/40 p-4", props.class)}>+ {props.children}+ </div>+ );+}++type DashboardTitledSectionProps = {+ title: string;+ class?: string;+ children: JSX.Element;+};+++export function DashboardTitledSection(props: DashboardTitledSectionProps) {+ return (+ <section class={cx("flex flex-col", props.class)}>+ <div class={cx("flex h-9 items-center px-2 text-sm leading-5 font-450 text-foreground", props.class)}>+ {props.title}+ </div>+ {props.children}+ </section>+ );+}++type DashboardSurfaceSectionProps = {+ title: string;+ class?: string;+ children: JSX.Element;+};++export function DashboardSurfaceSection(props: DashboardSurfaceSectionProps) {+ return (+ <DashboardTitledSection title={props.title} class={props.class}>+ <DashboardSurfaceCard class="flex flex-col gap-3">+ {props.children}+ </DashboardSurfaceCard>+ </DashboardTitledSection>+ );+}++type DashboardScrollViewProps = {+ class?: string;+ children: JSX.Element;+};+++export function DashboardScrollView(props: DashboardScrollViewProps) {+ return (+ <div class={cx("min-h-0 flex-1 overflow-y-auto px-6 pb-6 pt-4", props.class)}>+ <div class="flex flex-col gap-6">{props.children}</div>+ </div>+ );+}++type DashboardFormModalProps = {+ open: boolean;+ title: string;+ onClose: () => void;+ footer: JSX.Element;+ children: JSX.Element;+};++export function DashboardFormModal(props: DashboardFormModalProps) {+ const handleOpenAutoFocus = (event: Event) => {+ event.preventDefault();+ const container = event.currentTarget as HTMLElement;++ queueMicrotask(() => {+ container.querySelector<HTMLInputElement>(+ '[data-slot="text-field-input"]:not([disabled])',+ )?.focus();+ });+ };++ const handleOpenChange = (open: boolean) => {+ if (!open) props.onClose();+ };++ return (+ <Dialog open={props.open} preventScroll={false} onOpenChange={handleOpenChange}>+ <DialogPortal>+ <DialogContent+ onOpenAutoFocus={handleOpenAutoFocus}+ showCloseButton={false}+ class="w-77 max-w-11/12 max-h-11/12 overflow-hidden rounded-xl border-border p-0 gap-0"+ >+ <div class="flex max-h-full flex-col gap-4 px-2 py-0">+ <div class="flex w-full items-center gap-2 border-b border-border pl-2 pr-0 py-2">+ <div class="min-w-0 flex-1">+ <p class="truncate text-foreground text-xs">+ {props.title}+ </p>+ </div>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={props.onClose}+ >+ <Icon name="close-remove" class="text-foreground" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </div>++ <div class="flex min-h-0 w-full flex-col gap-6 overflow-y-auto px-2 py-0">+ {props.children}+ </div>++ <div class="flex w-full items-center justify-end border-t border-border px-1 py-3">+ <div class="flex items-center gap-2">+ {props.footer}+ </div>+ </div>+ </div>+ </DialogContent>+ </DialogPortal>+ </Dialog>+ );+}++type DashboardPlanDetailsProps = {+ details: readonly {+ label: string;+ value: JSX.Element;+ }[];+};++export function DashboardPlanDetails(props: DashboardPlanDetailsProps) {+ return (+ <div class="flex min-w-0 flex-1 flex-col gap-4 md:flex-row md:items-center md:gap-4">+ <For each={props.details}>+ {(detail, index) => (+ <>+ <DashboardLabelValue+ label={detail.label}+ value={detail.value}+ labelClass="truncate"+ valueClass="truncate"+ />+ <Show when={index() < props.details.length - 1}>+ <div class="hidden h-8 w-px shrink-0 bg-border md:block" />+ </Show>+ </>+ )}+ </For>+ </div>+ );+}++export function DashboardFreePlanDetails() {+ return (+ <DashboardPlanDetails+ details={[+ { label: "Free", value: "$0.00" },+ { label: "AI credits", value: "50 trial credits \u00B7 One time only" },+ ]}+ />+ );+}++const RENEWAL_DATE_FORMAT = new Intl.DateTimeFormat(undefined, {+ month: "long",+ day: "numeric",+ year: "numeric",+});++function formatCurrency(amountCents: number, currency: string) {+ return new Intl.NumberFormat(undefined, {+ style: "currency",+ currency: currency.toUpperCase(),+ }).format(amountCents / 100);+}++export function DashboardProPlanDetails() {+ const auth = useAuth();+ const [summary] = createResource(() => trpc.getSubscriptionSummary.query());++ const priceLabel = () => {+ const s = summary();+ if (!s) return "\u2014";+ const suffix = s.billingPeriod === "year" ? "/yr" : "/mo";+ return `${formatCurrency(s.amount, s.currency)}${suffix}`;+ };++ const creditsLabel = () =>+ `${auth.creditLimit().toLocaleString()} credits/mo`;++ const renewsLabel = () => {+ const s = summary();+ if (!s) return "\u2014";+ return RENEWAL_DATE_FORMAT.format(new Date(s.currentPeriodEnd));+ };++ return (+ <DashboardPlanDetails+ details={[+ { label: "Pro", value: priceLabel() },+ { label: "AI credits", value: creditsLabel() },+ { label: "Renews", value: renewsLabel() },+ ]}+ />+ );+}++type DashboardDividedStackProps = {+ class?: string;+ spacing?: "tight" | "loose";+ children: JSX.Element;+};++export function DashboardDividedStack(props: DashboardDividedStackProps) {+ const resolved = children(() => props.children);+ const items = () =>+ resolved.toArray().filter((item) => item != null && typeof item !== "boolean");+ const isLoose = () => props.spacing === "loose";++ return (+ <div+ class={cx("flex flex-col", props.class)}+ classList={{+ "gap-0": isLoose(),+ "gap-3": !isLoose(),+ }}+ >+ <For each={items()}>+ {(item, index) => (+ <>+ {item}+ <Show when={index() < items().length - 1}>+ <Show when={isLoose()} fallback={<Separator />}>+ <Separator class="my-3" />+ </Show>+ </Show>+ </>+ )}+ </For>+ </div>+ );+}++type DashboardPlanSummaryCardProps = {+ action: JSX.Element;+ children: JSX.Element;+ class?: string;+};++export function DashboardPlanSummaryCard(props: DashboardPlanSummaryCardProps) {+ return (+ <DashboardSurfaceCard class={cx("flex flex-col gap-4", props.class)}>+ <div class="flex flex-col gap-4 md:flex-row md:items-center">+ {props.children}+ {props.action}+ </div>+ </DashboardSurfaceCard>+ );+}++type DashboardFeatureRowProps = {+ label: string;+};++export function DashboardFeatureRow(props: DashboardFeatureRowProps) {+ return (+ <div class="flex items-center gap-2">+ <span class="size-4 flex items-center justify-center text-primary overflow-clip">+ <Icon name="confirm-check" />+ </span>+ <p class="text-muted-foreground text-xs">+ {props.label}+ </p>+ </div>+ );+}++type DashboardInfoActionRowProps = {+ title: string;+ titleContent?: JSX.Element | string;+ description?: JSX.Element;+ action: JSX.Element;+ leading?: JSX.Element;+ layout?: "responsive" | "responsive-md" | "inline";+};++export function DashboardInfoActionRow(props: DashboardInfoActionRowProps) {+ const layoutClass = () => {+ if (props.layout === "inline") return "flex-row items-center gap-4";+ if (props.layout === "responsive-md") return "flex-col gap-4 md:flex-row md:items-center";+ return "flex-col gap-4 sm:flex-row sm:items-center";+ };++ const hasDescription = () => props.description !== undefined;+ const leadingAlignClass = () => {+ if (hasDescription()) return "items-start";+ return "items-center";+ };++ const renderTitleText = (value: string) => (+ <p+ class={cx(+ "text-xs text-foreground",+ props.layout === "inline" ? "min-w-0 flex-1 truncate" : undefined,+ )}+ >+ {value}+ </p>+ );++ const titleContent = () => {+ const content = props.titleContent;++ if (content === undefined) return renderTitleText(props.title);+ if (typeof content === "string" || typeof content === "number") {+ return renderTitleText(String(content));+ }++ return content;+ };++ const textContent = () => (+ <div class="flex min-w-0 flex-1 flex-col gap-1">+ {titleContent()}+ <Show when={props.description}>+ <p class="text-muted-foreground text-xs">+ {props.description}+ </p>+ </Show>+ </div>+ );++ return (+ <div class={cx("flex", layoutClass())}>+ <Show+ when={props.leading}+ fallback={+ textContent()+ }+ >+ <div class={cx("flex min-w-0 flex-1 gap-2", leadingAlignClass())}>+ <span class="grid size-6 shrink-0 place-items-center text-muted-foreground">+ {props.leading}+ </span>+ {textContent()}+ </div>+ </Show>++ {props.action}+ </div>+ );+}++type DashboardCardButtonProps = {+ active?: boolean;+ onClick?(): void;+ children: JSX.Element;+ class?: string;+};++export function DashboardCardButton(props: DashboardCardButtonProps) {+ const handleKeyDown: JSX.EventHandlerUnion<HTMLDivElement, KeyboardEvent> = (event) => {+ if (!props.onClick) return;+ if (event.target !== event.currentTarget) return;+ if (event.key !== "Enter" && event.key !== " ") return;++ event.preventDefault();+ props.onClick();+ };++ return (+ <div+ role="button"+ tabIndex={0}+ onClick={props.onClick}+ onKeyDown={handleKeyDown}+ class={cx(+ "flex w-62 shrink-0 flex-col gap-3 rounded-xl p-2 text-left outline-none transition-colors hover:bg-accent focus-ring group",+ props.active && "bg-muted hover:bg-muted ring-1 ring-inset ring-ring",+ props.class,+ )}+ >+ {props.children}+ </div>+ );+}++type DashboardCardPreviewProps = {+ children?: JSX.Element;+ class?: string;+};++export function DashboardCardPreview(props: DashboardCardPreviewProps) {+ return (+ <div+ class={cx(+ "bg-canvas relative aspect-video w-full overflow-hidden rounded-md border border-border",+ props.class,+ )}+ >+ {props.children}+ </div>+ );+}++type DashboardCardMetaProps = {+ title: string;+ subtitle?: string;+};++export function DashboardCardMeta(props: DashboardCardMetaProps) {+ const hasSubtitle = () => props.subtitle !== undefined;++ return (+ <div class="flex flex-col gap-1 px-2">+ <p class="min-w-0 truncate text-xs text-foreground">+ {props.title}+ </p>+ <p+ class="min-w-0 truncate text-xs text-muted-foreground"+ classList={{ "opacity-0": !hasSubtitle() }}+ aria-hidden={hasSubtitle() ? undefined : "true"}+ >+ {props.subtitle ?? "\u00A0"}+ </p>+ </div>+ );+}++type DashboardViewSectionProps = {+ title: string;+ controls: JSX.Element;+ children: JSX.Element;+};++export function DashboardViewSection(props: DashboardViewSectionProps) {+ return (+ <div class="flex min-h-0 flex-1 flex-col gap-4 pt-4">+ <div class="flex h-10 items-end gap-6 px-6">+ <h1 class="min-w-0 flex-1 text-lg leading-7 font-450 text-foreground">+ {props.title}+ </h1>+ {props.controls}+ </div>++ <div class="min-h-0 flex-1 overflow-y-auto px-4">+ <div class="flex flex-wrap content-start items-start gap-y-3">+ {props.children}+ </div>+ </div>+ </div>+ );+}+diff --git a/apps/web/src/components/dashboard/sidebar.tsx b/apps/web/src/components/dashboard/sidebar.tsxnew file mode 100644index 00000000..4206027d--- /dev/null+++ b/apps/web/src/components/dashboard/sidebar.tsx@@ -0,0 +1,138 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show, type JSX } from "solid-js";+import { Icon } from "@/components/ui/icon";+import { useAuth } from "@/context/auth";+import { useAvatar } from "@/hooks/use-avatar";+import { Separator } from "@/components/ui/separator";+import { cx } from "@/lib/cva";++type DashboardSidebarItemProps = {+ icon: string;+ label: string;+ active?: boolean;+ onClick?(): void;+ class?: string;+};++export function DashboardSidebarItem(props: DashboardSidebarItemProps) {+ return (+ <button+ type="button"+ onClick={props.onClick}+ class={cx("flex h-8 w-full items-center rounded-md px-0 hover:bg-accent focus-ring", props.class)}+ classList={{ "bg-muted": props.active }}+ >+ <span class="grid size-7 place-items-center overflow-clip">+ <Show+ when={props.active}+ fallback={<Icon name={props.icon} class="size-6 text-muted-foreground" />}+ >+ <Icon name={props.icon} class="size-6 text-foreground" />+ </Show>+ </span>+ <span+ class="min-w-0 flex-1 truncate text-left text-xs text-muted-foreground"+ classList={{ "text-foreground": props.active }}+ >+ {props.label}+ </span>+ </button>+ );+}++export function DashboardSidebarHeader() {+ const auth = useAuth();++ return (+ <div class="flex flex-col items-start gap-3 p-4">+ <Icon name="diffusion-logo-large" class="size-6 text-muted-foreground" />+ <div class="flex h-10 w-full flex-col items-start gap-1 text-muted-foreground">+ <p class="w-full text-base leading-5 font-450 text-muted-foreground">+ {auth.isPro() ? "Diffusion Studio Pro" : "Diffusion Studio"}+ </p>+ <p class="w-full overflow-hidden text-xxs whitespace-nowrap text-ellipsis text-muted-foreground">+ v{APP_VERSION}+ </p>+ </div>+ </div>+ );+}++type DashboardSidebarNavProps = {+ children: JSX.Element;+};++export function DashboardSidebarNav(props: DashboardSidebarNavProps) {+ return (+ <div class="flex min-h-0 flex-1 flex-col gap-2 px-4">+ <Separator />+ <div class="flex min-h-0 flex-1 flex-col gap-1">+ <div class="flex h-8 items-center px-1">+ <p class="text-xs font-450 text-muted-foreground">+ Get Started+ </p>+ </div>+ {props.children}+ </div>+ <Separator />+ </div>+ );+}++type DashboardSidebarUserProps = {+ active: boolean;+ onClick: () => void;+};++export function DashboardSidebarUser(props: DashboardSidebarUserProps) {+ const auth = useAuth();++ const displayName = () => {+ const user = auth.user();+ return user?.user_metadata?.full_name || user?.email || "User";+ };++ const planLabel = () => (auth.isPro() ? "Pro Plan" : "Free Plan");++ const initial = () => displayName().charAt(0).toUpperCase();+ const avatarUrl = useAvatar();++ return (+ <div class="p-2">+ <button+ type="button"+ onClick={props.onClick}+ class="flex w-full items-center gap-2 rounded-md p-2 text-left hover:bg-accent focus-ring"+ classList={{ "bg-muted": props.active }}+ >+ <Show+ when={avatarUrl()}+ fallback={+ <div class="grid size-8 shrink-0 place-items-center rounded-full bg-input text-xs text-foreground">+ {initial()}+ </div>+ }+ >+ {(url) => (+ <img+ src={url()}+ alt=""+ class="size-8 shrink-0 rounded-full object-cover"+ />+ )}+ </Show>+ <div class="flex min-w-0 flex-1 flex-col justify-center">+ <span class="truncate text-xs font-450 text-foreground">+ {displayName()}+ </span>+ <span class="truncate text-xxs text-muted-foreground">+ {planLabel()}+ </span>+ </div>+ </button>+ </div>+ );+}diff --git a/apps/web/src/components/dashboard/types.ts b/apps/web/src/components/dashboard/types.tsnew file mode 100644index 00000000..e2d5f362--- /dev/null+++ b/apps/web/src/components/dashboard/types.ts@@ -0,0 +1,15 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export type DashboardView = | "projects" | "templates" | "ai-credits" | "billing" | "account" | "settings" | "preferences" | "help";+export type ProjectSortOption = | "last-viewed" | "alphabetical" | "date-created";+export type TemplateSourceOption = "official" | "custom";+export type TemplatePreviewKind = "landscape" | "portrait" | "square";++export type TemplateCard = {+ name: string;+ resolution: string;+ badge: string;+ previewKind: TemplatePreviewKind;+};diff --git a/apps/web/src/components/dashboard/utils.ts b/apps/web/src/components/dashboard/utils.tsnew file mode 100644index 00000000..eaab72b2--- /dev/null+++ b/apps/web/src/components/dashboard/utils.ts@@ -0,0 +1,23 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++const AVATAR_MAX_SIZE = 256;++export async function cropAndResizeAvatar(file: File): Promise<Blob> {+ const bitmap = await createImageBitmap(file);+ const size = Math.min(bitmap.width, bitmap.height, AVATAR_MAX_SIZE);++ const canvas = new OffscreenCanvas(size, size);+ const ctx = canvas.getContext("2d")!;++ // Center-crop to square+ const sx = (bitmap.width - Math.min(bitmap.width, bitmap.height)) / 2;+ const sy = (bitmap.height - Math.min(bitmap.width, bitmap.height)) / 2;+ const sSize = Math.min(bitmap.width, bitmap.height);++ ctx.drawImage(bitmap, sx, sy, sSize, sSize, 0, 0, size, size);+ bitmap.close();++ return await canvas.convertToBlob({ type: "image/webp", quality: 0.8 });+}diff --git a/apps/web/src/components/dev-auth-code-input.tsx b/apps/web/src/components/dev-auth-code-input.tsxnew file mode 100644index 00000000..b2c45796--- /dev/null+++ b/apps/web/src/components/dev-auth-code-input.tsx@@ -0,0 +1,85 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal } from 'solid-js';+import { toast } from 'somoto';++import { Button } from '@/components/ui/button';+import { TextField, TextFieldInput, TextFieldLabel } from '@/components/ui/text-field';+import { supabase } from '@/lib/supabase';++function extractAuthCode(input: string): string | null {+ const trimmed = input.trim();+ if (!trimmed) return null;+ try {+ const url = new URL(trimmed);+ return (+ url.searchParams.get('code') ??+ new URLSearchParams(url.hash.replace(/^#/, '')).get('code')+ );+ } catch {+ return trimmed;+ }+}++export function DevAuthCodeInput() {+ if (!import.meta.env.DEV || !window.desktop) return null;++ const [code, setCode] = createSignal('');+ const [exchanging, setExchanging] = createSignal(false);++ const handleSubmit = async (e: SubmitEvent) => {+ e.preventDefault();+ if (!supabase) {+ toast.error('Auth is not configured');+ return;+ }+ const extracted = extractAuthCode(code());+ if (!extracted) {+ toast.error('Paste the callback URL or auth code');+ return;+ }+ setExchanging(true);+ const { error } = await supabase.auth.exchangeCodeForSession(extracted);+ setExchanging(false);+ if (error) {+ toast.error(error.message);+ } else {+ setCode('');+ }+ };++ return (+ <form+ class="flex flex-col gap-2 rounded-xl border border-dashed border-border p-4"+ onSubmit={handleSubmit}+ >+ <TextField>+ <TextFieldLabel+ uiSize="compact"+ class="text-xs text-muted-foreground"+ >+ Dev: paste callback URL or code+ </TextFieldLabel>+ <TextFieldInput+ uiSize="compact"+ type="text"+ placeholder="diffusion://... or raw code"+ value={code()}+ onInput={(e) => setCode(e.currentTarget.value)}+ onKeyDown={(e) => e.stopPropagation()}+ onKeyUp={(e) => e.stopPropagation()}+ />+ </TextField>+ <Button+ type="submit"+ variant="secondary"+ class="w-full"+ disabled={exchanging() || !code().trim()}+ >+ {exchanging() ? 'Exchanging...' : 'Exchange code'}+ </Button>+ </form>+ );+}diff --git a/apps/web/src/components/engine/api/assets.ts b/apps/web/src/components/engine/api/assets.tsnew file mode 100644index 00000000..426c554e--- /dev/null+++ b/apps/web/src/components/engine/api/assets.ts@@ -0,0 +1,887 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal } from "solid-js";+import type { Accessor, Setter } from "solid-js";+import { assert } from "@/utils";+import { ALL_FORMATS, InputTrack, UrlSource } from 'mediabunny';+import { BlobSource } from 'mediabunny';+import { Input } from 'mediabunny';+import { nanoid } from "nanoid";+import Sqids from "sqids";+import { saveDirectoryHandle, retrieveDirectoryHandle, getProjectDB } from "../db";+import { GeometryType, PaintType } from "../components";+import { secondsToFrames } from "../utils/time";+import { toast } from "somoto";+import { createEntity } from "./entities";+import { appendChild } from "./hierarchy";+import { addComponent, setComponent } from "./events";+import { resizeEntity } from "./resize";+import { mimeTypeToExtension } from "@/utils";+import { trpc } from "@/lib/trpc";+import {+ ElectronFileHandle,+ isSerializedElectronFileHandle,+ rehydrateElectronFileHandle,+} from "@/lib/electron-file-handle";++import type { EngineWorld } from "./world";+import type { Asset } from "../db";+import type { Transcript } from "@diffusionstudio/api-contract";++const URL_REGEX = /\b(?:https?|ftp|blob):\/\/[^\s]+/;+const DEFAULT_SEQUENCE_FPS = 30;+const sqids = new Sqids({ minLength: 4 });++type MediaInput =+ | string+ | File+ | FileSystemFileHandle+ | FileSystemDirectoryHandle+ | ElectronFileHandle;++type AssetState = {+ projectId: string;+ counter: number;+ directoryHandle: Promise<FileSystemDirectoryHandle>;+ db: ReturnType<typeof getProjectDB>;+ version: Accessor<number>;+ setVersion: Setter<number>;+ selected: Accessor<Map<string, Asset>>;+ setSelected: Setter<Map<string, Asset>>;+};++const assetStates = new WeakMap<object, AssetState>();++/**+ * Initializes the asset subsystem for a world. Call once, right after the+ * world is created. `world.assets` must already be an (empty) Map.+ */+export function initAssets(world: EngineWorld, projectId: string): void {+ const [version, setVersion] = createSignal(0);+ const [selected, setSelected] = createSignal<Map<string, Asset>>(new Map());++ assetStates.set(world, {+ projectId,+ counter: 0,+ directoryHandle: retrieveDirectoryHandle(),+ db: getProjectDB(projectId),+ version,+ setVersion,+ selected,+ setSelected,+ });+}++function assetState(world: EngineWorld): AssetState {+ const state = assetStates.get(world);+ assert(state, 'Assets not initialized for this world; call initAssets() first');+ return state;+}++/**+ * Reactive version counter. Read inside a tracking scope (memo/effect) to+ * re-run whenever the asset set changes — e.g. after re-granting filesystem+ * permission so previously-failed getFile() calls retry.+ */+export function assetsVersion(world: EngineWorld): number {+ return assetState(world).version();+}++/** Bumps the version signal so reactive consumers (thumbnails, previews) re-run. */+export function invalidateAssets(world: EngineWorld): void {+ assetState(world).setVersion((v) => v + 1);+}++/**+ * Allocates the next id in the project's shared asset/folder id space, so an+ * id never refers to both an asset and a folder.+ */+export function allocateId(world: EngineWorld): string {+ const state = assetState(world);+ state.counter += 1;+ return sqids.encode([state.counter]);+}++/**+ * Raises the id counter past every sqid in `ids`. Non-sqid ids (e.g. legacy+ * "fld-…" folder ids) are ignored. Restores may run in parallel, so this only+ * ever raises the counter.+ */+export function raiseIdCounter(world: EngineWorld, ids: Iterable<string>): void {+ const state = assetState(world);+ for (const id of ids) {+ const decoded = sqids.decode(id);+ const num = decoded[0];+ if (decoded.length === 1 && Number.isFinite(num) && num > state.counter) {+ state.counter = num;+ }+ }+}++type LoadAssetOptions = {+ name?: string;+ generationId?: string | null;+ folderId?: string | null;+};++/**+ * Loads an asset from a handle, URL, File, or DataTransferItem. Detects the+ * MIME type, writes to OPFS when needed, persists the metadata, and returns the+ * created (or pre-existing) Asset.+ */+export async function loadAsset(+ world: EngineWorld,+ handle: MediaInput | DataTransferItem,+ options?: LoadAssetOptions,+): Promise<Asset> {+ const state = assetState(world);++ // If the handle is a data transfer item, get the file from it+ if (handle instanceof DataTransferItem) {+ const file = await getFileFromDataTransferItem(handle);+ assert(file, 'Failed to get file from data transfer item');+ handle = file;+ }++ // Step 1: Generate a hash for the asset+ let hash = '';+ if (typeof handle === 'string') {+ assert(URL_REGEX.test(handle), 'Invalid URL');+ hash = handle;+ } else if (handle instanceof File) {+ hash = `${handle.name}-${handle.size}-${handle.lastModified}`;+ } else if (handle instanceof FileSystemFileHandle) {+ const file = await handle.getFile();+ hash = `${file.name}-${file.size}-${file.lastModified}`;+ } else if (handle instanceof ElectronFileHandle) {+ const file = await handle.getFile();+ hash = `${file.name}-${file.size}-${file.lastModified}`;+ } else if (handle instanceof FileSystemDirectoryHandle) {+ let size = 0;+ let count = 0;+ let modified = 0;+ for await (const [, entry] of handle.entries()) {+ if (entry.kind !== 'file') continue;+ const file = await entry.getFile();+ size += file.size;+ modified += file.lastModified;+ count++;+ }+ hash = `seq:${handle.name}-${size}-${modified}-${count}`;+ } else {+ assert(false, 'Could not generate hash for handle');+ }++ const existingAsset = Array.from(world.assets.values()).find(asset => asset.hash === hash);+ if (existingAsset) {+ return existingAsset;+ };++ // Step 2: Generate a unique ID for the asset+ const id = allocateId(world);+ const createdAt = new Date().toISOString();+ const mimeType = await detectMimeType(handle);+ assert(mimeType, 'Could not detect MIME type');++ let name = '';+ if (options?.name) {+ name = options.name;+ } else if (typeof handle === 'string') {+ name = (handle.split('/').pop() ?? `Unnamed_${nanoid(8)}`).slice(0, 24);+ } else if (handle instanceof File) {+ name = handle.name;+ } else if (handle instanceof FileSystemFileHandle) {+ const file = await handle.getFile();+ name = file.name;+ } else if (handle instanceof ElectronFileHandle) {+ name = handle.name;+ } else if (handle instanceof FileSystemDirectoryHandle) {+ name = handle.name;+ }++ // Step 3: Write the asset to the file system if necessary+ let writable: FileSystemWritableFileStream | null = null;+ let fileHandle: FileSystemFileHandle | ElectronFileHandle | null = null;++ try {+ const uniqueName = id + mimeTypeToExtension(mimeType);+ const directory = await state.directoryHandle;++ // Get or create the backups folder+ const assetsFolder = await directory.getDirectoryHandle('assets', { create: true });++ if (handle instanceof Blob) {+ fileHandle = await assetsFolder.getFileHandle(uniqueName, { create: true });+ writable = await fileHandle.createWritable();++ // write blob to file handle+ await writable.write(handle);+ } else if (typeof handle === 'string') {+ fileHandle = await assetsFolder.getFileHandle(uniqueName, { create: true });+ writable = await fileHandle.createWritable();++ // stream file to file handle+ const response = await fetch(handle);+ const reader = response.body?.getReader();+ if (!reader) throw new Error('Failed to stream file');++ while (true) {+ const { done, value } = await reader.read();+ if (done) break;+ await writable.write(value);+ }+ } else if (handle instanceof FileSystemFileHandle) {+ fileHandle = handle;+ } else if (handle instanceof ElectronFileHandle) {+ fileHandle = handle; // Electron files live on the user's disk; don't copy into OPFS.+ } else if (handle instanceof FileSystemDirectoryHandle) {+ const entry = await handle.entries().next();+ const firstFile = entry.value[1];+ assert(firstFile instanceof FileSystemFileHandle, 'First entry is not a file handle');+ fileHandle = entry.value[1];+ } else {+ assert(false, 'Invalid handle');+ }+ } catch (error) {+ console.error('Failed to write asset to file system:', error);+ } finally {+ await writable?.close();+ }++ assert(fileHandle, 'File handle not found');++ const file = await fileHandle.getFile();++ const baseAsset = {+ id,+ hash,+ createdAt,+ lastModified: file.lastModified,+ name,+ mimeType,+ size: file.size,+ handle: fileHandle,+ generationId: options?.generationId ?? null,+ folderId: options?.folderId ?? null,+ }++ if (handle instanceof FileSystemDirectoryHandle) {+ const entry = await handle.entries().next();+ const firstFile = entry.value[1];+ assert(firstFile instanceof FileSystemFileHandle, 'First entry is not a file handle');+ const { width, height } = await getRasterDimensions(+ await firstFile.getFile()+ );++ let count = 0;+ for await (const [, entry] of handle.entries()) {+ if (entry.kind !== 'file') continue;+ count++;+ }+ const duration = count / DEFAULT_SEQUENCE_FPS;++ return saveAsset(world, {+ ...baseAsset,+ type: 'SEQUENCE',+ width,+ height,+ frameRate: DEFAULT_SEQUENCE_FPS,+ duration,+ directoryHandle: handle,+ });+ } else if (mimeType.match(/^image\//)) {+ const { width, height } = mimeType === 'image/svg+xml'+ ? await getSvgDimensions(file)+ : await getRasterDimensions(file);++ return saveAsset(world, {+ ...baseAsset,+ type: 'IMAGE',+ width,+ height,+ });+ } else if (mimeType === 'application/json') {+ return saveAsset(world, {+ ...baseAsset,+ type: 'TRANSCRIPT',+ });+ } else if (mimeType.match(/^(audio\/|video\/)/)) {+ const input = new Input({+ formats: ALL_FORMATS,+ source: new BlobSource(file),+ });++ const audioTrack = await input.getPrimaryAudioTrack();+ const channels = audioTrack?.numberOfChannels;+ const sampleRate = audioTrack?.sampleRate;++ if (mimeType.startsWith('audio/')) {+ assert(sampleRate, 'Sample rate not found');+ assert(channels, 'Channels not found');++ const duration = await trackContentDuration(audioTrack);++ return saveAsset(world, {+ ...baseAsset,+ type: 'AUDIO',+ duration,+ sampleRate,+ channels,+ });+ }++ const videoTrack = await input.getPrimaryVideoTrack();+ assert(videoTrack, 'Video track not found');+ const stats = await videoTrack.computePacketStats();+ const duration = await trackContentDuration(videoTrack);++ return saveAsset(world, {+ ...baseAsset,+ type: 'VIDEO',+ width: videoTrack.displayWidth,+ height: videoTrack.displayHeight,+ frameRate: stats.averagePacketRate,+ bitRate: stats.averageBitrate,+ sampleRate,+ duration,+ channels,+ });+ }++ assert(false, 'Unsupported file type');+}++/**+ * Reactive view over the asset set, for use *inside* Solid tracking scopes+ * (memos, effects, JSX). Each accessor reads the version signal so the scope+ * re-runs when assets are added, saved, or removed.+ *+ * Outside a reactive scope (decoders, render, async handlers, …) don't use+ * this — read `world.assets` (a plain `Map<string, Asset>`) directly, e.g.+ * `world.assets.get(id)`. These accessors exist only to establish the+ * dependency; the data is the Map.+ */+export function useAssets(world: EngineWorld) {+ const state = assetState(world);+ return {+ /** All assets, in insertion order. */+ all: (): Asset[] => {+ state.version();+ return Array.from(world.assets.values());+ },+ /** A single asset by id. */+ get: (id: string): Asset | undefined => {+ state.version();+ return world.assets.get(id);+ },+ /** The current selection set. */+ selected: (): Map<string, Asset> => state.selected(),+ };+}++/**+ * Appends one or more assets to the in-memory store without persisting.+ * New assets are ordered first; existing records win on id conflict.+ */+export function appendAssets(world: EngineWorld, ...incoming: Asset[]): void {+ const map = world.assets;+ const existing = Array.from(map.values());+ map.clear();+ for (const asset of incoming) map.set(asset.id, asset);+ for (const asset of existing) map.set(asset.id, asset);+ invalidateAssets(world);+}++/**+ * Saves an asset to the database and the in-memory store.+ */+export async function saveAsset(world: EngineWorld, asset: Asset): Promise<Asset> {+ const state = assetState(world);+ const map = world.assets;++ // Re-insert at the front to preserve the prior signal-replacement ordering.+ const existing = Array.from(map.values()).filter((a) => a.id !== asset.id);+ map.clear();+ map.set(asset.id, asset);+ existing.forEach(a => map.set(a.id, a));++ const sel = state.selected();+ if (sel.has(asset.id)) {+ const next = new Map(sel);+ next.set(asset.id, asset);+ state.setSelected(next);+ }++ const db = await state.db;+ await db.put('assets', serializeAssetForPersist(asset));++ invalidateAssets(world);++ return asset;+}++/**+ * Removes one or more assets from the in-memory store and the database.+ */+export async function removeAsset(world: EngineWorld, ...ids: string[]): Promise<void> {+ const map = world.assets;+ for (const id of ids) map.delete(id);+ invalidateAssets(world);++ const db = await assetState(world).db;+ for (const id of ids) {+ db.delete('assets', id);+ }+}++/**+ * Restores assets from IndexedDB into the in-memory store.+ * Call once during engine init.+ */+export async function restoreAssets(world: EngineWorld): Promise<void> {+ const state = assetState(world);+ const db = await state.db;+ const records = await db.getAll('assets');+ if (records.length === 0) return;++ const map = world.assets;+ map.clear();+ for (const record of records) {+ map.set(record.id, rehydrateAsset(record));+ }++ raiseIdCounter(world, records.map((record) => record.id));++ invalidateAssets(world);+}++/** Returns the File/Blob backing an asset, or null if the asset is missing. */+export async function getAssetBlob(world: EngineWorld, id: string): Promise<Blob | null> {+ const asset = world.assets.get(id);+ if (!asset) return null;++ return await asset.handle.getFile();+}++/**+ * Upload a single local asset to the cloud bucket. The bucket key is prefixed+ * with the project id to make it globally unique.+ */+export async function uploadAsset(world: EngineWorld, id: string) {+ const blob = await getAssetBlob(world, id);+ if (!blob) {+ console.error(`Asset ${id} not found`);+ return null;+ }+ return uploadBlob(blob, `${assetState(world).projectId}-${id}`);+}++/**+ * Upload multiple local assets in parallel, filtering out any failures.+ */+export async function uploadAssets(world: EngineWorld, ids?: string[]) {+ if (!ids || ids.length === 0) return undefined;+ const results = await Promise.all(ids.map((id) => uploadAsset(world, id)));+ return results.filter((ref) => ref !== null);+}++/** Prompts the user for a new OPFS root directory and persists the handle. */+export async function changeAssetDirectory(world: EngineWorld): Promise<void> {+ try {+ const directory = await window.showDirectoryPicker({+ mode: 'readwrite',+ startIn: 'videos',+ });+ await saveDirectoryHandle(directory);+ assetState(world).directoryHandle = Promise.resolve(directory);+ } catch (error) {+ console.error('Failed to change directory:', error);+ }+}++/** Selects a single asset by id (replacing any prior selection). */+export function selectAsset(world: EngineWorld, id: string): void {+ const asset = world.assets.get(id);+ if (!asset) return;+ assetState(world).setSelected(new Map([[id, asset]]));+}++/** Clears the selected-asset set. */+export function clearSelectedAssets(world: EngineWorld): void {+ assetState(world).setSelected(new Map());+}++/**+ * Upload a Blob to the cloud bucket via a signed URL under the asset id.+ * Returns the FileRef the API can resolve.+ */+export async function uploadBlob(blob: Blob, id: string) {+ const contentType = blob.type || "application/octet-stream";+ const { uploadUrl, fileRef } = await trpc.getUploadUrl.mutate({ id, contentType });++ if (uploadUrl) {+ const res = await fetch(uploadUrl, {+ method: "PUT",+ headers: { "Content-Type": contentType },+ body: blob,+ });++ if (!res.ok) {+ console.error(`Failed to upload asset ${id}: ${res.status}`);+ return null;+ }+ }++ return fileRef;+}++/** GCS requires every resumable chunk except the last to be a multiple of 256 KiB. */+const RESUMABLE_CHUNK_SIZE = 8 * 1024 * 1024;++/**+ * Open a GCS resumable upload session against a signed "resumable" URL and+ * return the session URI that the bytes are streamed to.+ */+export async function startResumableSession(uploadUrl: string, mimeType: string): Promise<string> {+ const res = await fetch(uploadUrl, {+ method: "POST",+ headers: { "x-goog-resumable": "start", "Content-Type": mimeType },+ });+ if (!res.ok) {+ throw new Error(`Failed to start resumable upload session: ${res.status}`);+ }+ const sessionUrl = res.headers.get("Location");+ if (!sessionUrl) {+ throw new Error("Resumable upload session response is missing the Location header.");+ }+ return sessionUrl;+}++/**+ * Stream a ReadableStream into an open GCS resumable session, PUTting+ * fixed-size chunks as bytes arrive so the full payload is never buffered.+ */+export async function uploadResumableStream(+ readable: ReadableStream<Uint8Array<ArrayBuffer>>,+ sessionUrl: string,+): Promise<void> {+ const reader = readable.getReader();+ let pending: Uint8Array<ArrayBuffer> = new Uint8Array(0);+ let uploaded = 0;+ let done = false;++ while (!done) {+ const { value, done: streamDone } = await reader.read();+ if (streamDone) {+ done = true;+ } else if (value) {+ pending = concatBytes(pending, value);+ }++ while (pending.length >= RESUMABLE_CHUNK_SIZE) {+ await putResumableChunk(sessionUrl, pending.subarray(0, RESUMABLE_CHUNK_SIZE), uploaded, null);+ uploaded += RESUMABLE_CHUNK_SIZE;+ pending = pending.subarray(RESUMABLE_CHUNK_SIZE);+ }+ }++ await putResumableChunk(sessionUrl, pending, uploaded, uploaded + pending.length);+}++async function putResumableChunk(+ sessionUrl: string,+ chunk: Uint8Array<ArrayBuffer>,+ offset: number,+ total: number | null,+): Promise<void> {+ const last = offset + chunk.length - 1;+ const contentRange =+ total === null+ ? `bytes ${offset}-${last}/*`+ : chunk.length === 0+ ? `bytes */${total}`+ : `bytes ${offset}-${last}/${total}`;++ const res = await fetch(sessionUrl, {+ method: "PUT",+ headers: { "Content-Range": contentRange },+ body: chunk,+ });++ // 308 "Resume Incomplete" is expected while more chunks remain; the final+ // chunk finalizes the object and returns 200/201.+ if (total === null) {+ if (res.status !== 308) {+ throw new Error(`Unexpected status during resumable upload: ${res.status}`);+ }+ } else if (!res.ok) {+ throw new Error(`Failed to finalize resumable upload: ${res.status}`);+ }+}++function concatBytes(a: Uint8Array<ArrayBuffer>, b: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer> {+ const out = new Uint8Array(a.length + b.length);+ out.set(a);+ out.set(b, a.length);+ return out;+}++function serializeAssetForPersist(asset: Asset): Asset {+ // IndexedDB structured-clones records. ElectronFileHandle is a custom class+ // whose methods don't survive cloning — serialize to the persisted shape.+ if (asset.handle instanceof ElectronFileHandle) {+ return { ...asset, handle: asset.handle.toJSON() } as unknown as Asset;+ }+ return asset;+}++function rehydrateAsset(asset: Asset): Asset {+ if (isSerializedElectronFileHandle(asset.handle)) {+ return { ...asset, handle: rehydrateElectronFileHandle(asset.handle) };+ }+ return asset;+}++export async function insertAssetInTimeline(world: EngineWorld, asset: Asset, mode: 'playhead' | 'start') {+ const sceneEid = world.selection.scene;+ if (sceneEid === null) {+ toast("Create a scene first to insert assets");+ return;+ }+ const c = world.components;+ const delay = mode === 'playhead' ? c.Computed.localTime[sceneEid] : 0;++ // Resolve any async asset data up front so all the entity mutations below+ // run in a single synchronous, undoable transaction.+ let transcriptTrim: { start: number; end: number } | null = null;+ if (asset.type === "TRANSCRIPT") {+ // Transcript should be trimmed to the span of recognized words+ const file = await asset.handle.getFile();+ const transcript = JSON.parse(await file.text()) as Transcript;+ const lastWord = transcript.at(-1)?.words.at(-1);+ const firstWord = transcript.at(0)?.words.at(0);+ transcriptTrim = {+ start: secondsToFrames(firstWord?.start),+ end: secondsToFrames(lastWord?.end),+ };+ }++ world.history.transaction('Insert asset', () => {+ const eid = createEntity(world);+ setComponent(world, eid, c.Name, asset.name);+ setComponent(world, eid, c.Delay, delay);++ if (asset.type === 'IMAGE' || asset.type === 'VIDEO' || asset.type === 'SEQUENCE') {+ const width = Math.round(asset.width);+ const height = Math.round(asset.height);+ resizeEntity(world, eid, { width, height });+ setComponent(world, eid, c.KeepAspectRatio, { width, height });+ }++ if (asset.type === "TRANSCRIPT") {+ setComponent(world, eid, c.Geometry, GeometryType.TEXT);+ setComponent(world, eid, c.Caption, {});+ if (transcriptTrim) setComponent(world, eid, c.Trim, transcriptTrim);+ } else {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);++ // Other assets need a paint component+ let paint = PaintType.IMAGE;+ if (asset.type === 'SEQUENCE') paint = PaintType.SEQUENCE;+ if (asset.type === 'VIDEO') paint = PaintType.VIDEO;+ if (asset.type === 'AUDIO') paint = PaintType.WAVEFORM;+ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, paint);+ setComponent(world, fillEid, c.AssetId, asset.id);+ if (asset.type === 'AUDIO') {+ addComponent(world, fillEid, c.Hidden);+ }+ appendChild(world, fillEid, eid);+ }++ if (asset.type === "AUDIO") {+ addComponent(world, eid, c.Audio);+ resizeEntity(world, eid, { width: 500, height: 150 });+ }++ if (asset.type === "AUDIO" || asset.type === "TRANSCRIPT") {+ setComponent(world, eid, c.AssetId, asset.id);+ }++ appendChild(world, eid, sceneEid);+ });+};++export async function replaceAssetHandle(world: EngineWorld, asset: Asset) {+ const { mimeType } = asset;+ let handle: FileSystemFileHandle | undefined;+ try {+ [handle] = await window.showOpenFilePicker({+ multiple: false,+ types: [+ {+ description: `${mimeType} files`,+ accept: { [mimeType]: [mimeTypeToExtension(mimeType)] },+ },+ ],+ });+ } catch {+ return;+ }+ if (!handle) return;++ const detected = await detectMimeType(handle);+ if (detected !== mimeType) {+ toast.error("Mime type mismatch", {+ description: `Expected ${mimeType}, got ${detected ?? "unknown"}`,+ });+ return;+ }++ try {+ await saveAsset(world, { ...asset, handle });+ } catch (e) {+ toast.error("Failed to replace media", { description: (e as Error).message });+ }+};++type FileOrHandle = File | FileSystemFileHandle | FileSystemDirectoryHandle++export async function getFileFromDataTransferItem(item?: DataTransferItem): Promise<FileOrHandle | null> {+ if (!item) return null;++ if (typeof item.getAsFileSystemHandle === 'function') {+ const handle = await item.getAsFileSystemHandle();+ if (handle && (handle.kind === 'file' || handle.kind === 'directory')) {+ return handle as FileOrHandle;+ }+ return null;+ }+ return item.getAsFile();+}+++export async function detectMimeType(handle: MediaInput): Promise<string | null> {+ let mimeType: string | null = null;++ if (typeof handle === 'string') {+ mimeType = await fetchMimeType(handle);+ } else if (handle instanceof Blob) {+ mimeType = handle.type;+ } else if (handle instanceof FileSystemDirectoryHandle) {+ const entry = await handle.entries().next();+ mimeType = await detectMimeType(entry.value[1]);+ } else {+ handle = await handle.getFile();+ mimeType = handle.type;+ }++ if (mimeType?.startsWith('image/')) {+ return mimeType;+ } else if (mimeType?.startsWith('text/html')) {+ return mimeType;+ } else if (mimeType?.startsWith('application/json')) {+ return mimeType;+ } else if (handle instanceof FileSystemDirectoryHandle) {+ return mimeType?.startsWith('image/') ? mimeType : null;+ }++ // For audio and video, we will do a more thorough detection using mediabunny+ try {+ const input = new Input({+ formats: ALL_FORMATS,+ source: typeof handle === 'string'+ ? new UrlSource(handle)+ : new BlobSource(handle),+ });++ mimeType = await input.getMimeType();+ } catch {+ return null;+ }++ if (mimeType?.startsWith('audio/')) {+ return mimeType;+ } else if (mimeType?.startsWith('video/')) {+ return mimeType;+ } else {+ return null;+ }+}++async function getRasterDimensions(file: Blob): Promise<{ width: number; height: number }> {+ const bitmap = await createImageBitmap(file);+ const { width, height } = bitmap;+ bitmap.close();+ return { width, height };+}++async function getSvgDimensions(file: Blob): Promise<{ width: number; height: number }> {+ const text = await file.text();+ const root = new DOMParser().parseFromString(text, 'image/svg+xml').documentElement;++ const parseLength = (v: string | null) => {+ if (!v) return 0;+ const n = parseFloat(v);+ return Number.isFinite(n) ? n : 0;+ };++ let width = parseLength(root.getAttribute('width'));+ let height = parseLength(root.getAttribute('height'));++ if ((!width || !height) && root.getAttribute('viewBox')) {+ const parts = root.getAttribute('viewBox')!.split(/[\s,]+/).map(Number);+ if (parts.length === 4 && Number.isFinite(parts[2]) && Number.isFinite(parts[3])) {+ width = width || parts[2]!;+ height = height || parts[3]!;+ }+ }++ // SVG spec default when neither width/height nor viewBox is declared.+ return { width: width || 300, height: height || 150 };+}++export async function fetchMimeType(handle: string): Promise<string | null> {+ if (handle.startsWith('<html>')) {+ return 'text/html';+ }++ let response: Response;+ try {+ response = await fetch(handle, { method: 'HEAD' });+ } catch {+ const controller = new AbortController();+ response = await fetch(handle, { signal: controller.signal });+ controller.abort();+ }++ if (!response.ok) {+ return null;+ }++ const contentType = response.headers.get('Content-Type');++ if (!contentType) {+ return null;+ }++ return contentType;+}++/**+ * Playable content length of a media track, in seconds: the end timestamp+ * minus the track's first timestamp. A track may carry a global time offset+ * (a non-zero first timestamp); using the raw end timestamp as the duration+ * would over-report the length by that offset. Clamped to >= 0.+ */+async function trackContentDuration(track?: InputTrack | null): Promise<number> {+ if (!track) return 0;++ const [start, end] = await Promise.all([+ track.getFirstTimestamp(),+ track.computeDuration(),+ ]);+ return Math.max(0, end - start);+}diff --git a/apps/web/src/components/engine/api/base.ts b/apps/web/src/components/engine/api/base.tsnew file mode 100644index 00000000..328e4073--- /dev/null+++ b/apps/web/src/components/engine/api/base.ts@@ -0,0 +1,139 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query, getRelationTargets, Not, getAllEntities } from "bitecs";+import { getCssVar } from "@/utils/browser";+import { rgbToColor } from "@/utils/color";+import { deserializeEntity } from "./serialize";+import { ChildOf } from "../components/relations";+import { restoreFonts } from "../font/utils";+import { WORLD_STATE_KEY } from "../db";+import * as tl from '../timeline';+import { createEntity, deleteEntity } from "./entities";+import { assert } from "@/utils";+import { syncInteractiveState } from "./utils";+import { isScene } from "./query";+import { restoreAssets } from "./assets";+import { restoreFolders } from "./folders";++import type { EngineWorld } from "./world";++export function getParentEntity(world: EngineWorld, eid: number | null | undefined): number | null {+ if (!eid) return null;++ const targets = getRelationTargets(world, eid, ChildOf);+ if (targets.length === 0) return null;+ return targets[0];+}++export function getSiblingEntities(world: EngineWorld, eid: number, component: unknown): number[] {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return [];+ const children = [...query(world, [ChildOf(parentEid), Not(c.Deleted), component])];++ return children;+}++/** Persist the current camera + background to IndexedDB. */+export function persistWorldState(world: EngineWorld): void {+ world.store.worldState.schedule(world);+}++export async function restoreWorld(world: EngineWorld) {+ assert(getAllEntities(world).length === 0, 'World is not empty');++ const store = world.store;++ const db = await store.db;++ // Load entity records, world state, and previously loaded fonts in parallel.+ const [records, worldRecord] = await Promise.all([+ db.getAll('entities'),+ db.get('world', WORLD_STATE_KEY),+ restoreAssets(world),+ restoreFolders(world),+ restoreFonts(world),+ ]);++ if (worldRecord) {+ world.camera.a = worldRecord.camera.a;+ world.camera.b = worldRecord.camera.b;+ world.camera.c = worldRecord.camera.c;+ world.camera.d = worldRecord.camera.d;+ world.camera.e = worldRecord.camera.e;+ world.camera.f = worldRecord.camera.f;+ world.background = worldRecord.background;+ } else {+ world.camera.a = 1;+ world.camera.b = 0;+ world.camera.c = 0;+ world.camera.d = 1;+ world.camera.e = 0;+ world.camera.f = 0;+ const { r, g, b } = getCssVar('--color-canvas').toRgb();+ world.background = rgbToColor(r, g, b);+ }++ // Bitecs hands out fresh sequential eids after resetWorld, but the DB key+ // is the entity's eid — so to keep records stable across reloads we+ // restore each entity at the exact eid it was saved under. Fill the gap+ // eids with placeholder entities up to the max stored eid, then remove+ // them once the real ones are deserialized.+ const liveEids = new Set(records.map(r => r.eid));+ const maxEid = Math.max(...records.map(r => r.eid));++ // Loading a project must never populate the undo stack: deserialize+ // untracked, then clear so the first undo can't unwind the boot.+ world.history.untrack(() => {+ const placeholders: number[] = [];+ for (let i = 1; i <= maxEid; i++) {+ const eid = createEntity(world);+ if (!liveEids.has(eid)) placeholders.push(eid);+ }++ for (const record of records) {+ try {+ const copy = { ...record };+ if (copy.ChildOf !== undefined && !liveEids.has(copy.ChildOf)) {+ // Parent entity is missing from the records — make this entity+ // top-level rather than letting the ChildOf dangle into a+ // placeholder slot that's about to be removed.+ delete copy.ChildOf;+ }+ deserializeEntity(world, record.eid, copy);+ } catch (error) {+ deleteEntity(world, record.eid);+ console.error(error);+ }+ }++ for (const eid of placeholders) {+ deleteEntity(world, eid);+ }+ });++ world.history.clear();++ syncInteractiveState(world);+}++export function switchActiveScene(world: EngineWorld, eid: number | null): void {+ if (eid !== null) {+ assert(isScene(world, eid), "Entity is not a scene");+ }++ if (eid === world.selection.scene) {+ return;+ }++ world.selection.scene = eid;++ tl.clearAudioBuffers();+ tl.clearVideoBuffers();+ tl.clearImageThumbnailCache();+ tl.updateTimelineTransform(world);+ world.rebuildTimelineIndex();+}diff --git a/apps/web/src/components/engine/api/clipboard.ts b/apps/web/src/components/engine/api/clipboard.tsnew file mode 100644index 00000000..de6aeced--- /dev/null+++ b/apps/web/src/components/engine/api/clipboard.ts@@ -0,0 +1,97 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, query, Or } from 'bitecs';+import { cloneFromRecords, cloneSubtree, serializeEntity } from './serialize';+import { getEntityTree } from './query';+import { getParentEntity } from './base';+import { addComponent, clearComponent, setComponent } from './events';+import { appendChild, removeChild } from './hierarchy';++import type { DBEntity } from '../types';+import type { EngineWorld } from './world';++type ClipboardEntry = {+ root: number;+ records: DBEntity[];+};++let clipboard: ClipboardEntry[] = [];++export function copySelection(world: EngineWorld) {+ const c = world.components;+ const selection = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];+ if (selection.length === 0) return;++ clipboard = selection.map(eid => ({+ root: eid,+ records: getEntityTree(world, eid).map(e => serializeEntity(world, e)),+ }));+}++export function pasteClipboard(world: EngineWorld) {+ if (clipboard.length === 0) return;++ const c = world.components;+ const selection = [...query(world, [c.Selected, Or(c.Scene, c.Group)])];+ const targetParentEid = selection[0] ?? null;++ world.history.transaction('Paste', () => {+ const copyRootEids: number[] = [];++ for (const snapshot of clipboard) {+ const result = cloneFromRecords(world, snapshot.records);+ const rootCopyEid = result.get(snapshot.root);+ if (!rootCopyEid || (!hasComponent(world, rootCopyEid, c.Geometry) && !hasComponent(world, rootCopyEid, c.Group))) continue;++ copyRootEids.push(rootCopyEid);++ const currentParentEid = getParentEntity(world, rootCopyEid);++ if (currentParentEid !== null) {+ removeChild(world, rootCopyEid, currentParentEid);+ }+ if (targetParentEid !== null) {+ appendChild(world, rootCopyEid, targetParentEid);+ }+ }++ clearComponent(world, c.Selected, false);++ copyRootEids.forEach(eid => addComponent(world, eid, c.Selected, false));+ });+}++export function duplicateSelection(world: EngineWorld, { offset = true }: { offset?: boolean } = {}) {+ const c = world.components;+ const selection = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];+ if (selection.length === 0) return;++ const snapshots = selection.map(eid => ({+ root: eid,+ tree: getEntityTree(world, eid),+ }));++ world.history.transaction('Duplicate', () => {+ const copyRootEids: number[] = [];+ for (const snapshot of snapshots) {+ const result = cloneSubtree(world, snapshot.tree);+ const rootCopyEid = result.get(snapshot.root);+ if (!rootCopyEid || (!hasComponent(world, rootCopyEid, c.Geometry) && !hasComponent(world, rootCopyEid, c.Group))) continue;++ copyRootEids.push(rootCopyEid);++ const currentParentEid = getParentEntity(world, rootCopyEid);+ if (offset && currentParentEid === null) {+ // Source's Computed is populated; the copy's isn't refreshed until the next caching pass.+ const nextX = c.Position.x[rootCopyEid] + c.Computed.width[snapshot.root];+ setComponent(world, rootCopyEid, c.Position, { x: nextX });+ }+ }++ clearComponent(world, c.Selected, false);++ copyRootEids.forEach(eid => addComponent(world, eid, c.Selected, false));+ });+}diff --git a/apps/web/src/components/engine/api/components.ts b/apps/web/src/components/engine/api/components.tsnew file mode 100644index 00000000..9377c452--- /dev/null+++ b/apps/web/src/components/engine/api/components.ts@@ -0,0 +1,17 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import * as ComponentRegistry from "../components/components";++export function createComponents(): Components {+ return Object.fromEntries(+ Object.entries(ComponentRegistry)+ .map(([name, definition]) => [name, structuredClone(definition)]),+ ) as Components;+}++export type Components = {+ [K in keyof typeof ComponentRegistry]: typeof ComponentRegistry[K];+}+export type ComponentName = keyof Components;diff --git a/apps/web/src/components/engine/api/engine.ts b/apps/web/src/components/engine/api/engine.tsnew file mode 100644index 00000000..f83fe198--- /dev/null+++ b/apps/web/src/components/engine/api/engine.ts@@ -0,0 +1,166 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ChildOf } from '../components';+import { Not, query } from 'bitecs';+import { createEngineWorld, restoreWorld, switchActiveScene } from '../api';++import { transformSystem } from '../systems/transform';+import { renderSystem } from '../systems/render';+import { playbackSystem } from '../systems/playback';+import { motionSystem } from '../systems/motion';+import { syncDomSystem } from '../systems/dom';+import { inputSystem } from '../systems/input-system';+import { createCameraController } from '../systems';+import { hudSystem } from '../systems/hud';+import { createKeyboardSystem } from '../systems/keyboard';+import { createSignal } from 'solid-js';++import type Stats from 'stats.js';++export type Engine = ReturnType<typeof createEngine>;+++export function createEngine(id: string) {+ const audio = new AudioContext({ latencyHint: 'playback' });+ const world = createEngineWorld(id, audio);+ const camera = createCameraController(world);+ const keyboard = createKeyboardSystem(world, camera);+ const [initialized, setInitialized] = createSignal(false);++ let running = false;+ let rafId: number | null = null;+ let stats: Stats | null = null;++ async function init(el: HTMLCanvasElement) {+ if (world.canvas) return;++ world.canvas = el;+ world.ctx = el.getContext('2d');+ camera.init(el);+ keyboard.init();++ await restoreWorld(world);++ const c = world.components;+ // Auto-select the first scene as the active timeline+ for (const eid of query(world, [c.Geometry, c.Scene, Not(ChildOf('*')), Not(c.Deleted)])) {+ switchActiveScene(world, eid);+ break;+ }++ // Mount FPS stats panel if in development mode+ if (import.meta.env.DEV) {+ const { default: Stats } = await import('stats.js');+ stats = new Stats();+ stats.showPanel(0); // 0 = FPS+ stats.dom.style.position = 'absolute';+ stats.dom.style.top = '12px';+ stats.dom.style.left = '12px';+ stats.dom.style.zIndex = '100';+ world.canvas.parentElement!.appendChild(stats.dom);+ }++ applyResize();+ start();+ setInitialized(true);+ }++ function tick(timestamp: number): void {+ if (!running || !world.ctx || !world.canvas) return;++ stats?.begin();++ world.timestamp.delta = timestamp - world.timestamp.now+ world.timestamp.now = timestamp++ inputSystem(world);+ playbackSystem(world);+ motionSystem(world);+ transformSystem(world);+ renderSystem(world);+ hudSystem(world);+ syncDomSystem(world);++ stats?.end();++ rafId = requestAnimationFrame(tick);+ }++ function start(): void {+ if (running) return;+ running = true;+ rafId = requestAnimationFrame(tick);+ }++ function stop(): void {+ running = false;+ if (rafId !== null) {+ cancelAnimationFrame(rafId);+ rafId = null;+ }+ }++ function dispose(): void {+ stop();+ keyboard.dispose();+ camera.dispose();+ }++ function applyResize(): void {+ const canvas = world.canvas;+ if (!(canvas instanceof HTMLCanvasElement)) return;+ const parent = canvas.parentElement;+ if (!parent) return;++ const rect = parent.getBoundingClientRect();+ const dpr = window.devicePixelRatio;+ const nextWidth = Math.round(rect.width * dpr);+ const nextHeight = Math.round(rect.height * dpr);++ canvas.style.width = `${rect.width}px`;+ canvas.style.height = `${rect.height}px`;++ // Always update world.canvas — the renderer reads it for the clear+ // rect and the transform system uses it as the top-level parent rect+ // for size/constraint/culling, regardless of bitmap reassignment.+ canvas.width = nextWidth;+ canvas.height = nextHeight;+ world.resolution = dpr;++ // Skip the bitmap reassignment when nothing changed — assigning+ // canvas.width/height resets the 2d context and clears the bitmap.+ if (canvas.width === nextWidth && canvas.height === nextHeight) return;++ canvas.width = nextWidth;+ canvas.height = nextHeight;+ }++ function resize(): void {+ applyResize();++ // ResizeObserver fires after layout, before paint. Without a synchronous+ // redraw, the just-cleared canvas (assigning width/height clears the+ // bitmap) paints empty until the next requestAnimationFrame — visible+ // as a flash during continuous resize. Re-run the render pipeline now+ // so the new canvas size paints with fresh content in the same frame.+ if (running) {+ transformSystem(world);+ renderSystem(world);+ syncDomSystem(world);+ }+ }++ return {+ init,+ start,+ stop,+ dispose,+ resize,+ initialized,+ get running() { return running; },+ get world() { return world; },+ get camera() { return camera; },+ };+}diff --git a/apps/web/src/components/engine/api/entities.ts b/apps/web/src/components/engine/api/entities.tsnew file mode 100644index 00000000..b272dac9--- /dev/null+++ b/apps/web/src/components/engine/api/entities.ts@@ -0,0 +1,83 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { addEntity, removeEntity } from "bitecs";+import { DEFAULT_DURATION_FRAMES } from "../constants";+import { addComponent } from "./events";+import { getEntityTree } from "./query";++import type { EngineWorld } from "./world";+++export function createEntity(world: EngineWorld) {+ const c = world.components;+ let eid!: number;++ world.history.push({+ label: 'creating new entity',+ execute: () => (eid = addEntity(world)),+ reverse: () => (removeEntity(world, eid)),+ })++ addComponent(world, eid, c.Computed, false);++ c.Computed.positionX[eid] = 0;+ c.Computed.positionY[eid] = 0;+ c.Computed.offsetX[eid] = 0;+ c.Computed.offsetY[eid] = 0;+ c.Computed.originX[eid] = 0;+ c.Computed.originY[eid] = 0;+ c.Computed.rotation[eid] = 0;+ c.Computed.scaleX[eid] = 1;+ c.Computed.scaleY[eid] = 1;+ c.Computed.skewX[eid] = 0;+ c.Computed.skewY[eid] = 0;+ c.Computed.opacity[eid] = 1;+ c.Computed.color[eid] = 0;+ c.Computed.blur[eid] = 0;+ c.Computed.volume[eid] = 0;+ c.Computed.value[eid] = 0;+ c.Computed.strokeWidth[eid] = 1;+ c.Computed.cornerRadius[eid] = 0;+ c.Computed.cornerRadiusTopLeft[eid] = 0;+ c.Computed.cornerRadiusTopRight[eid] = 0;+ c.Computed.cornerRadiusBottomRight[eid] = 0;+ c.Computed.cornerRadiusBottomLeft[eid] = 0;+ c.Computed.stopOffset[eid] = 0;+ c.Computed.stopColor[eid] = 0;+ c.Computed.stopOpacity[eid] = 1;+ c.Computed.width[eid] = 300;+ c.Computed.height[eid] = 300;+ c.Computed.start[eid] = 0;+ c.Computed.localTime[eid] = 0;+ c.Computed.localTimeInSeconds[eid] = 0;+ c.Computed.visibility[eid] = 1;+ c.Computed.end[eid] = DEFAULT_DURATION_FRAMES;+ c.Computed.duration[eid] = DEFAULT_DURATION_FRAMES;+ c.Computed.delay[eid] = 0;++ addComponent(world, eid, c.Cache, false);+ c.Cache.children[eid] = [];+ c.Cache.fills[eid] = [];+ c.Cache.shadows[eid] = [];+ c.Cache.strokes[eid] = [];+ c.Cache.effects[eid] = [];+ c.Cache.textRanges[eid] = [];+ c.Cache.masks[eid] = [];+ c.Cache.animations[eid] = [];+ c.Cache.keyframeTracks[eid] = [];++ return eid;+}++export function deleteEntity(world: EngineWorld, eid: number) {+ const c = world.components;+ // Tagging the whole subtree Deleted is one logical step. Nests under any+ // outer transaction (keyboard delete, ungroup, keyframe toggle, …).+ world.history.transaction('deleting entity', () => {+ for (const e of getEntityTree(world, eid)) {+ addComponent(world, e, c.Deleted);+ }+ });+}diff --git a/apps/web/src/components/engine/api/events.ts b/apps/web/src/components/engine/api/events.tsnew file mode 100644index 00000000..15a794e2--- /dev/null+++ b/apps/web/src/components/engine/api/events.ts@@ -0,0 +1,184 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { addComponent as bitecsAddComponent, removeComponent as bitecsRemoveComponent, hasComponent, query } from "bitecs";++import type { EngineWorld } from "./world";+import type { HistoryEntry } from "../utils/history";++// bitecs tags pair components (e.g. ChildOf(parent)) with this symbol pointing+// back to the relation factory. We use it so observers registered against the+// factory (ChildOf) fire for any target.+const $relation = Symbol.for("bitecs-relation");++export type ComponentData<C> =+ C extends readonly (infer V)[]+ ? V+ : Partial<{ [K in keyof C]: C[K] extends readonly (infer V)[] ? V : never }>;++type EventName = "add" | "remove" | "set";++type Callback<E extends EventName, C> =+ E extends "set"+ ? (eid: number, data: ComponentData<C>) => void+ : (eid: number) => void;++type Registry = {+ observers: Map<unknown, Map<EventName, Set<Function>>>;+};++const REGISTRIES = new WeakMap<object, Registry>();++function getRegistry(world: EngineWorld): Registry {+ let reg = REGISTRIES.get(world as object);+ if (!reg) {+ reg = { observers: new Map() };+ REGISTRIES.set(world as object, reg);+ }+ return reg;+}++/**+ * Push a history entry, or replay it untracked when `track` is false so it+ * never reaches the undo stack. Callers pass `track: false` for ephemeral or+ * derived runtime state (selection, hovering, drag snapshots, decoders, …)+ * that must not be undoable.+ */+function record(world: EngineWorld, track: boolean, entry: HistoryEntry): void {+ if (track) {+ world.history.push(entry);+ } else {+ world.history.untrack(() => world.history.push(entry));+ }+}++function getKey(component: unknown): unknown {+ if (component && typeof component === "object" && $relation in (component as object)) {+ return (component as Record<symbol, unknown>)[$relation];+ }+ return component;+}++function notify(world: EngineWorld, event: EventName, component: unknown, eid: number, data: unknown): void {+ const perComponent = getRegistry(world).observers.get(getKey(component));+ const observers = perComponent?.get(event);+ if (!observers) return;+ for (const cb of observers) {+ (cb as (eid: number, data: unknown) => void)(eid, data);+ }+}++export function observe<E extends EventName, C>(+ world: EngineWorld,+ event: E,+ component: C,+ callback: Callback<E, C>,+): () => void {+ const reg = getRegistry(world);+ const key = getKey(component);++ let perComponent = reg.observers.get(key);+ if (!perComponent) {+ perComponent = new Map();+ reg.observers.set(key, perComponent);+ }++ let observers = perComponent.get(event);+ if (!observers) {+ observers = new Set();+ perComponent.set(event, observers);+ }++ observers.add(callback as Function);+ return () => { observers!.delete(callback as Function); };+}++export function addComponent<C>(world: EngineWorld, eid: number, component: C, track = true): void {+ if (hasComponent(world, eid, component)) return;++ record(world, track, {+ label: `adding component ${componentName(world, component)} to entity ${eid}`,+ execute: () => {+ bitecsAddComponent(world, eid, component);+ notify(world, "add", component, eid, undefined);+ },+ reverse: () => {+ bitecsRemoveComponent(world, eid, component);+ notify(world, "remove", component, eid, undefined);+ },+ });+}++export function removeComponent<C>(world: EngineWorld, eid: number, component: C, track = true): void {+ if (!hasComponent(world, eid, component)) return;++ record(world, track, {+ label: `removing component ${componentName(world, component)} from entity ${eid}`,+ execute: () => {+ bitecsRemoveComponent(world, eid, component);+ notify(world, "remove", component, eid, undefined);+ },+ reverse: () => {+ bitecsAddComponent(world, eid, component);+ notify(world, "add", component, eid, undefined);+ },+ });+}++function hasSetObserver(world: EngineWorld, component: unknown): boolean {+ const observers = getRegistry(world).observers.get(getKey(component))?.get("set");+ return observers !== undefined && observers.size > 0;+}++function componentName(world: EngineWorld, component: unknown): string {+ for (const [name, value] of Object.entries(world.components)) {+ if (value === component) return name;+ }+ return "<unknown>";+}++function snapshotComponentData<C>(component: C, eid: number): ComponentData<C> {+ if (Array.isArray(component)) {+ return (component as unknown as unknown[])[eid] as ComponentData<C>;+ }+ const snapshot: Record<string, unknown> = {};+ for (const key in (component as object)) {+ snapshot[key] = (component as Record<string, unknown[]>)[key]?.[eid];+ }+ return snapshot as ComponentData<C>;+}++export function setComponent<C>(world: EngineWorld, eid: number, component: C, data: ComponentData<C>, track = true): void {+ if (!hasSetObserver(world, component) && typeof component === "object" && component !== null) {+ console.error(`setComponent: no 'set' observer registered for component '${componentName(world, component)}' — data passed to setComponent will be dropped.`);+ }++ const wasPresent = hasComponent(world, eid, component);+ const previous = wasPresent ? snapshotComponentData(component, eid) : undefined;++ record(world, track, {+ label: `setting component ${componentName(world, component)} on entity ${eid}`,+ execute: () => {+ bitecsAddComponent(world, eid, component);+ if (!wasPresent) notify(world, "add", component, eid, undefined);+ notify(world, "set", component, eid, data);+ },+ reverse: () => {+ if (!wasPresent) {+ bitecsRemoveComponent(world, eid, component);+ notify(world, "remove", component, eid, undefined);+ } else {+ notify(world, "set", component, eid, previous);+ }+ },+ });+}++export function clearComponent(world: EngineWorld, component: unknown, track = true): void {+ world.history.transaction(`Clearing component ${componentName(world, component)}`, () => {+ for (const eid of query(world, [component])) {+ removeComponent(world, eid, component, track);+ }+ })+}diff --git a/apps/web/src/components/engine/api/folders.ts b/apps/web/src/components/engine/api/folders.tsnew file mode 100644index 00000000..259521f2--- /dev/null+++ b/apps/web/src/components/engine/api/folders.ts@@ -0,0 +1,341 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal } from "solid-js";+import { assert } from "@/utils";+import { getProjectDB } from "../db";+import { allocateId, assetsVersion, invalidateAssets, raiseIdCounter, saveAsset, removeAsset } from "./assets";++import type { Accessor, Setter } from "solid-js";+import type { EngineWorld } from "./world";+import type { Asset, Folder } from "../db";++type FolderState = {+ db: ReturnType<typeof getProjectDB>;+ currentId: Accessor<string | null>;+ setCurrentId: Setter<string | null>;+};++const folderStates = new WeakMap<object, FolderState>();++/**+ * Initializes the folder subsystem for a world. Call once, right after the+ * world is created. `world.folders` must already be an (empty) Map.+ */+export function initFolders(world: EngineWorld, projectId: string): void {+ const [currentId, setCurrentId] = createSignal<string | null>(null);++ folderStates.set(world, {+ db: getProjectDB(projectId),+ currentId,+ setCurrentId,+ });+}++function folderState(world: EngineWorld): FolderState {+ const state = folderStates.get(world);+ assert(state, 'Folders not initialized for this world; call initFolders() first');+ return state;+}++/**+ * A folder's effective parent: its stored parentId, or root when the parent+ * record no longer exists (dangling references degrade to root instead of+ * hiding the folder).+ */+function effectiveParentId(world: EngineWorld, folder: Folder): string | null {+ return folder.parentId !== null && world.folders.has(folder.parentId)+ ? folder.parentId+ : null;+}++/**+ * The folder an asset effectively lives in: its stored folderId, or root when+ * that folder no longer exists.+ */+export function assetFolderId(world: EngineWorld, asset: Asset): string | null {+ const folderId = asset.folderId ?? null;+ return folderId !== null && world.folders.has(folderId) ? folderId : null;+}++/**+ * True when `id` is a descendant of `ancestorId` in the folder tree.+ */+export function isDescendantFolder(world: EngineWorld, id: string, ancestorId: string): boolean {+ const visited = new Set<string>();+ let current = world.folders.get(id);+ while (current && current.parentId !== null && !visited.has(current.id)) {+ if (current.parentId === ancestorId) return true;+ visited.add(current.id);+ current = world.folders.get(current.parentId);+ }+ return false;+}++/**+ * Reactive view over the folder tree, for use inside Solid tracking scopes.+ * Folders share the asset version signal, so any folder or asset mutation+ * re-runs dependents.+ */+export function useFolders(world: EngineWorld) {+ const state = folderState(world);+ return {+ /**+ * All folders, unordered.+ */+ all(): Folder[] {+ assetsVersion(world);+ return Array.from(world.folders.values());+ },+ /**+ * A single folder by id.+ */+ get(id: string): Folder | undefined {+ assetsVersion(world);+ return world.folders.get(id);+ },+ /**+ * Direct child folders of a parent (null = root), sorted by name.+ */+ childrenOf(parentId: string | null): Folder[] {+ assetsVersion(world);+ return Array.from(world.folders.values())+ .filter((folder) => effectiveParentId(world, folder) === parentId)+ .sort((a, b) => a.name.localeCompare(b.name));+ },+ /**+ * The id of the folder currently open in the asset panel (null = root).+ */+ currentId(): string | null {+ assetsVersion(world);+ const id = state.currentId();+ return id !== null && world.folders.has(id) ? id : null;+ },+ /**+ * Breadcrumb chain from the root down to the current folder.+ */+ path(): Folder[] {+ assetsVersion(world);+ const chain: Folder[] = [];+ const visited = new Set<string>();+ let current = state.currentId() !== null+ ? world.folders.get(state.currentId()!)+ : undefined;+ while (current && !visited.has(current.id)) {+ chain.unshift(current);+ visited.add(current.id);+ current = current.parentId !== null+ ? world.folders.get(current.parentId)+ : undefined;+ }+ return chain;+ },+ };+}++/**+ * Opens a folder in the asset panel (null = back to root).+ */+export function openFolder(world: EngineWorld, id: string | null): void {+ folderState(world).setCurrentId(id);+}++/**+ * The folder currently open in the asset panel, for use outside tracking+ * scopes (event handlers, keyboard shortcuts). Reactive consumers should use+ * `useFolders(world).currentId()` instead.+ */+export function getCurrentFolderId(world: EngineWorld): string | null {+ const id = folderState(world).currentId();+ return id !== null && world.folders.has(id) ? id : null;+}++/**+ * The next free `base`/`base N` name among a parent's children.+ */+export function uniqueFolderName(world: EngineWorld, base: string, parentId: string | null): string {+ const names = new Set(+ Array.from(world.folders.values())+ .filter((folder) => effectiveParentId(world, folder) === parentId)+ .map((folder) => folder.name),+ );+ let name = base;+ for (let i = 2; names.has(name); i++) name = `${base} ${i}`;+ return name;+}++/**+ * The next free "New folder"/"New folder N" name among a parent's children.+ */+export function nextFolderName(world: EngineWorld, parentId: string | null): string {+ return uniqueFolderName(world, 'New folder', parentId);+}++/**+ * Finds a direct child folder of `parentId` by name (case-insensitive),+ * creating it when missing.+ */+export async function ensureFolder(+ world: EngineWorld,+ name: string,+ parentId: string | null = null,+): Promise<Folder> {+ const target = name.trim().toLowerCase();+ for (const folder of world.folders.values()) {+ if (+ effectiveParentId(world, folder) === parentId &&+ folder.name.trim().toLowerCase() === target+ ) {+ return folder;+ }+ }+ return createFolder(world, name, parentId);+}++/**+ * Creates a folder under `parentId` (null = root) and persists it.+ */+export async function createFolder(+ world: EngineWorld,+ name: string,+ parentId: string | null = null,+): Promise<Folder> {+ const folder: Folder = {+ id: allocateId(world),+ name,+ parentId: parentId !== null && world.folders.has(parentId) ? parentId : null,+ createdAt: new Date().toISOString(),+ };++ world.folders.set(folder.id, folder);+ invalidateAssets(world);++ const db = await folderState(world).db;+ await db.put('folders', folder);++ return folder;+}++/**+ * Renames a folder and persists it.+ */+export async function renameFolder(world: EngineWorld, id: string, name: string): Promise<void> {+ const folder = world.folders.get(id);+ if (!folder || folder.name === name) return;++ const next = { ...folder, name };+ world.folders.set(id, next);+ invalidateAssets(world);++ const db = await folderState(world).db;+ await db.put('folders', next);+}++/**+ * Moves assets into a folder (null = root). Ignores unknown asset ids and+ * unknown target folders.+ */+export async function moveAssetsToFolder(+ world: EngineWorld,+ ids: string[],+ folderId: string | null,+): Promise<void> {+ if (folderId !== null && !world.folders.has(folderId)) return;++ for (const id of ids) {+ const asset = world.assets.get(id);+ if (!asset || (asset.folderId ?? null) === folderId) continue;+ await saveAsset(world, { ...asset, folderId });+ }+}++/**+ * Re-parents a folder (null = root). Returns false when the move would create+ * a cycle (dropping a folder into itself or one of its descendants).+ */+export async function moveFolder(+ world: EngineWorld,+ id: string,+ parentId: string | null,+): Promise<boolean> {+ const folder = world.folders.get(id);+ if (!folder) return false;+ if (parentId === id) return false;+ if (parentId !== null) {+ if (!world.folders.has(parentId)) return false;+ if (isDescendantFolder(world, parentId, id)) return false;+ }+ if (folder.parentId === parentId) return true;++ const next = { ...folder, parentId };+ world.folders.set(id, next);+ invalidateAssets(world);++ const db = await folderState(world).db;+ await db.put('folders', next);+ return true;+}++/**+ * Deletes a folder with its contents.+ */+export async function deleteFolder(world: EngineWorld, id: string) {+ const folder = world.folders.get(id);+ if (!folder) return { deletedFolders: 0, deletedAssets: 0 };++ const state = folderState(world);++ // Navigate out of the doomed subtree before removing it.+ const currentId = state.currentId();+ if (currentId !== null && (currentId === id || isDescendantFolder(world, currentId, id))) {+ state.setCurrentId(folder.parentId);+ }++ const subtree = new Set([id]);+ let grew = true;+ while (grew) {+ grew = false;+ for (const candidate of world.folders.values()) {+ if (candidate.parentId !== null && subtree.has(candidate.parentId) && !subtree.has(candidate.id)) {+ subtree.add(candidate.id);+ grew = true;+ }+ }+ }++ const assetIds = Array.from(world.assets.values())+ .filter((asset) => asset.folderId != null && subtree.has(asset.folderId))+ .map((asset) => asset.id);++ if (assetIds.length > 0) {+ await removeAsset(world, ...assetIds);+ }++ const db = await state.db;+ for (const folderId of subtree) {+ world.folders.delete(folderId);+ await db.delete('folders', folderId);+ }++ invalidateAssets(world);+ return { deletedFolders: subtree.size, deletedAssets: assetIds.length };+}++/**+ * Restores folders from IndexedDB into the in-memory store.+ * Call once during engine init.+ */+export async function restoreFolders(world: EngineWorld): Promise<void> {+ const db = await folderState(world).db;+ const records = await db.getAll('folders');+ if (records.length === 0) return;++ world.folders.clear();+ for (const record of records) {+ world.folders.set(record.id, record);+ }++ raiseIdCounter(world, records.map((record) => record.id));+ invalidateAssets(world);+}diff --git a/apps/web/src/components/engine/api/frame.ts b/apps/web/src/components/engine/api/frame.tsnew file mode 100644index 00000000..839a0631--- /dev/null+++ b/apps/web/src/components/engine/api/frame.ts@@ -0,0 +1,105 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query, Or } from 'bitecs';+import { GeometryType, PaintType } from '../components';+import { aabbFromTransformedRect } from '../math';+import { getParentEntity, switchActiveScene } from './base';+import { getNextName, isScene } from './query';+import { createEntity } from './entities';+import { addComponent, clearComponent, setComponent } from './events';+import { appendChild, removeChild } from './hierarchy';+import { resizeEntity } from './resize';+import { computeLocalMatrix } from '../systems/transform';++import type { EngineWorld } from './world';+import type { Mat2D } from '../math';++/**+ * Wrap the current node selection in a new SCENE (a clipped, playable frame).+ * Mirrors `groupSelection`, but the wrapper is a Scene with its own fixed Size+ * derived from the selection's bounding box, plus the clipping/playback/fill a+ * scene needs. Already-existing scenes in the selection are skipped — scenes+ * can't be nested. Children's positions are rewritten into the scene's local+ * space so their on-canvas position is preserved. Returns the new scene's+ * entity id, or null if there was nothing to frame.+ */+export function frameSelection(world: EngineWorld): number | null {+ const c = world.components;+ const selection = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])]+ .filter(eid => !isScene(world, eid));+ if (selection.length === 0) return null;++ const sceneEid = world.history.transaction('Framing selection', () => {+ const targetParent = getParentEntity(world, selection[0]);+ const frameables = selection.filter(eid => getParentEntity(world, eid) === targetParent);++ // Bounding box of children in target-parent local space.+ let minX = Infinity;+ let minY = Infinity;+ let maxX = -Infinity;+ let maxY = -Infinity;+ for (const eid of frameables) {+ const mat: Mat2D = {+ a: c.LocalTransform.a[eid] ?? 1, b: c.LocalTransform.b[eid] ?? 0,+ c: c.LocalTransform.c[eid] ?? 0, d: c.LocalTransform.d[eid] ?? 1,+ e: c.LocalTransform.e[eid] ?? 0, f: c.LocalTransform.f[eid] ?? 0,+ };+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];+ const bounds = aabbFromTransformedRect(mat, w, h);+ if (bounds.minX < minX) minX = bounds.minX;+ if (bounds.minY < minY) minY = bounds.minY;+ if (bounds.maxX > maxX) maxX = bounds.maxX;+ if (bounds.maxY > maxY) maxY = bounds.maxY;+ }++ const x = Math.round(minX);+ const y = Math.round(minY);+ const width = Math.max(1, Math.round(maxX - minX));+ const height = Math.max(1, Math.round(maxY - minY));++ // A scene is a RECT geometry carrying the Scene/ClipsContent/Playback+ // tags plus a solid fill — same recipe the scene draw tool uses.+ const eid = createEntity(world);+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ addComponent(world, eid, c.Scene);+ addComponent(world, eid, c.ClipsContent);+ setComponent(world, eid, c.Playback, {});+ setComponent(world, eid, c.Name, getNextName(world, 'Scene'));+ setComponent(world, eid, c.Position, { x, y });+ if (targetParent) appendChild(world, eid, targetParent);+ resizeEntity(world, eid, { width, height });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0x000000);+ appendChild(world, fillEid, eid);++ for (const child of frameables) {+ const prevX = c.Position.x[child] ?? 0;+ const prevY = c.Position.y[child] ?? 0;+ const parentEid = getParentEntity(world, child);+ if (parentEid) removeChild(world, child, parentEid);+ appendChild(world, child, eid);+ setComponent(world, child, c.Position, { x: prevX - x, y: prevY - y });+ // Refresh the child's cached local matrix now; the next transform pass+ // re-derives world transforms from it.+ computeLocalMatrix(world, child);+ }++ clearComponent(world, c.Selected, false);+ addComponent(world, eid, c.Selected, false);+ switchActiveScene(world, eid);++ return eid;+ });++ // Make the freshly created frame the active scene (mirrors the scene tool),+ // so the timeline retargets to it. Done outside history — active-scene state+ // isn't part of the undo stack.+ if (sceneEid !== null) switchActiveScene(world, sceneEid);++ return sceneEid;+}diff --git a/apps/web/src/components/engine/api/group.ts b/apps/web/src/components/engine/api/group.tsnew file mode 100644index 00000000..9e19d897--- /dev/null+++ b/apps/web/src/components/engine/api/group.ts@@ -0,0 +1,135 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query, Not, Or } from 'bitecs';+import { ChildOf } from '../components';+import { aabbFromTransformedRect } from '../math';+import { getParentEntity } from './base';+import { getNextName } from './query';+import { createEntity, deleteEntity } from './entities';+import { addComponent, clearComponent, setComponent } from './events';+import { appendChild, removeChild } from './hierarchy';+import { resolveNewSequenceOverlaps } from './overlap';+import { computeLocalMatrix } from '../systems/transform';+import { sortByItemIndex } from '../utils/sort';++import type { EngineWorld } from './world';+import type { Mat2D } from '../math';++/**+ * Wrap the current node selection in a new GROUP. All selected nodes must+ * share the same parent; scenes are skipped. Children's positions are+ * rewritten into the group's local space so their on-canvas position is+ * preserved.+ */+export function groupSelection(world: EngineWorld, sequential: boolean = false): number | null {+ const c = world.components;+ const selection = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];+ if (selection.length === 0) return null;++ return world.history.transaction('Grouping selection', () => {+ const targetParent = getParentEntity(world, selection[0]);++ const groupables = selection+ .filter(eid => getParentEntity(world, eid) === targetParent)+ .sort(sortByItemIndex(world));++ // Bounding box of children in target-parent local space.+ let minX = Infinity;+ let minY = Infinity;+ let maxX = -Infinity;+ let maxY = -Infinity;+ for (const eid of groupables) {+ const mat: Mat2D = {+ a: c.LocalTransform.a[eid] ?? 1, b: c.LocalTransform.b[eid] ?? 0,+ c: c.LocalTransform.c[eid] ?? 0, d: c.LocalTransform.d[eid] ?? 1,+ e: c.LocalTransform.e[eid] ?? 0, f: c.LocalTransform.f[eid] ?? 0,+ };+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];+ const bounds = aabbFromTransformedRect(mat, w, h);+ if (bounds.minX < minX) minX = bounds.minX;+ if (bounds.minY < minY) minY = bounds.minY;+ if (bounds.maxX > maxX) maxX = bounds.maxX;+ if (bounds.maxY > maxY) maxY = bounds.maxY;+ }++ // Sequences sit at the parent's origin (they're passthrough); plain+ // groups sit at the children's AABB origin so their own pivot lines up.+ const x = sequential ? 0 : Math.round(minX);+ const y = sequential ? 0 : Math.round(minY);++ const topItemIndex = c.ItemIndex[groupables[groupables.length - 1]] ?? 0;++ const groupEid = createEntity(world);+ addComponent(world, groupEid, c.Group);+ if (sequential) {+ addComponent(world, groupEid, c.Sequential);+ }+ setComponent(world, groupEid, c.Position, { x, y });+ setComponent(world, groupEid, c.Name, getNextName(world, sequential ? 'Sequence' : 'Group'));+ if (targetParent) appendChild(world, groupEid, targetParent);+ setComponent(world, groupEid, c.ItemIndex, topItemIndex);++ for (const [index, eid] of groupables.entries()) {+ const prevX = c.Position.x[eid] ?? 0;+ const prevY = c.Position.y[eid] ?? 0;+ const parentEid = getParentEntity(world, eid);+ if (parentEid) removeChild(world, eid, parentEid);+ appendChild(world, eid, groupEid);+ setComponent(world, eid, c.ItemIndex, index);+ setComponent(world, eid, c.Position, { x: prevX - x, y: prevY - y });+ // Refresh the child's cached local matrix now. The next transform pass+ computeLocalMatrix(world, eid);+ }+++ if (sequential) {+ resolveNewSequenceOverlaps(world, groupEid);+ }++ clearComponent(world, c.Selected, false);+ addComponent(world, groupEid, c.Selected, false);++ return groupEid;+ });+}++/**+ * Inverse of `groupSelection`. For every GROUP in the current selection,+ * lift its direct children up to the group's parent and remove the group.+ * Children's positions are rewritten so they stay put on canvas.+ */+export function ungroupSelection(world: EngineWorld): void {+ const c = world.components;+ const groups = [...query(world, [c.Selected, c.Group])];+ if (groups.length === 0) return;++ world.history.transaction('Ungrouping selection', () => {+ const promoted: number[] = [];++ for (const groupEid of groups) {+ const targetParent = getParentEntity(world, groupEid);+ // speard is important here+ const children = [...query(world, [ChildOf(groupEid), Not(c.Deleted)])];+ for (const childEid of children) {+ removeChild(world, childEid, groupEid);+ setComponent(world, childEid, c.Position, {+ x: (c.Position.x[childEid] ?? 0) + (c.Position.x[groupEid] ?? 0),+ y: (c.Position.y[childEid] ?? 0) + (c.Position.y[groupEid] ?? 0),+ });++ if (targetParent) {+ appendChild(world, childEid, targetParent);+ }+ promoted.push(childEid);+ }++ deleteEntity(world, groupEid);+ }++ clearComponent(world, c.Selected, false);+ promoted.forEach(eid => addComponent(world, eid, c.Selected, false));+ });+}diff --git a/apps/web/src/components/engine/api/hierarchy.ts b/apps/web/src/components/engine/api/hierarchy.tsnew file mode 100644index 00000000..c19da2a0--- /dev/null+++ b/apps/web/src/components/engine/api/hierarchy.ts@@ -0,0 +1,148 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { addComponent, removeComponent, query, Not, Or } from "bitecs";+import { ChildOf } from "../components";+import * as utils from "./utils";+import { getParentEntity } from "./base";+import { setComponent } from "./events";+import { assert } from "@/utils";+import { getEntityTree } from "./query";+import { sortByItemIndex } from "../utils/sort";++import type { EngineWorld } from "./world";++export type ReorderTarget = 'front' | 'back' | number;++export function appendChild(world: EngineWorld, eid: number, pid: number): void {+ const parentEid = getParentEntity(world, eid);+ assert(parentEid === null, "Entity already has a parent");+ assert(pid !== eid, "Cannot parent entity into itself");+ assert(!getEntityTree(world, eid).includes(pid), "Cannot parent entity into its own subtree");++ world.history.push({+ label: `appending child ${eid} to parent ${pid}`,+ execute: () => appendChildComponent(world, eid, pid),+ reverse: () => removeChildComponent(world, eid, pid),+ });+}++export function removeChild(world: EngineWorld, eid: number, pid: number): void {+ const parentEid = getParentEntity(world, eid);+ assert(parentEid === pid, "Entity is not a child of the specified parent");++ world.history.push({+ label: `removing child ${eid} from parent ${pid}`,+ execute: () => removeChildComponent(world, eid, pid),+ reverse: () => appendChildComponent(world, eid, pid),+ });+}++function appendChildComponent(world: EngineWorld, eid: number, pid: number): void {+ addComponent(world, eid, ChildOf(pid));+ utils.rebuildCaches(world, eid, pid);+ utils.propagateSize(world, eid);+ utils.resolveConstraintOffsets(world, eid);+ utils.disconnectAudioBus(world, eid);+ utils.reactToChildAttached(world, eid);+ utils.persistEntity(world, eid);+ utils.syncInteractiveState(world);+ world.rebuildTimelineIndex();+}++function removeChildComponent(world: EngineWorld, eid: number, pid: number): void {+ removeComponent(world, eid, ChildOf(pid));+ utils.rebuildCaches(world, eid, pid);+ utils.disconnectAudioBus(world, eid);+ utils.persistEntity(world, eid);+ utils.syncInteractiveState(world);+ world.rebuildTimelineIndex();+}++/**+ * Move a single entity within its geometry siblings by rewriting `ItemIndex`+ * on every sibling. `target` may be:+ * - `'front'` — move to the last index (highest ItemIndex = drawn on top)+ * - `'back'` — move to index 0 (lowest ItemIndex = drawn first)+ * - a number — move to that absolute index (clamped into range)+ */+export function reorderEntity(world: EngineWorld, eid: number, target: ReorderTarget): void {+ const c = world.components;+ const parent = getParentEntity(world, eid);+ if (parent === null) return;+ const siblings = [...query(world, [ChildOf(parent), Not(c.Deleted), Or(c.Geometry, c.Group, c.AdjustmentLayer)])];+ siblings.sort(sortByItemIndex(world));+ const index = siblings.indexOf(eid);+ if (index === -1) return;+ const newIndex = resolveReorderIndex(target, siblings.length);+ if (index === newIndex) return;+ siblings.splice(newIndex, 0, siblings.splice(index, 1)[0]);+ world.history.transaction('Reorder', () => {+ for (const [idx, sib] of siblings.entries()) {+ setComponent(world, sib, c.ItemIndex, idx);+ }+ });+}++/**+ * Move the current geometry selection within its parent. `target` may be:+ * - `'front'` — move all selected entities to the front+ * - `'back'` — move all selected entities to the back+ * - a number — insert the selected entities starting at that absolute index+ *+ * Selections that span multiple parents are reordered per-parent; the+ * relative order of the selected entities within each parent is preserved.+ */+export function reorderSelection(world: EngineWorld, target: ReorderTarget): void {+ const c = world.components;+ const selection = [...query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer)])];+ if (selection.length === 0) return;++ const byParent = new Map<number, Set<number>>();+ for (const eid of selection) {+ const parent = getParentEntity(world, eid);+ if (parent === null) continue;+ if (!byParent.has(parent)) byParent.set(parent, new Set());+ byParent.get(parent)!.add(eid);+ }++ world.history.transaction('Reorder', () => {+ for (const [parent, selected] of byParent) {+ const siblings = [...query(world, [ChildOf(parent), Not(c.Deleted), Or(c.Geometry, c.Group, c.AdjustmentLayer)])];+ siblings.sort(sortByItemIndex(world));+ const selectedOrdered = siblings.filter(eid => selected.has(eid));+ const rest = siblings.filter(eid => !selected.has(eid));++ let newOrder: number[];+ if (target === 'front') {+ newOrder = [...rest, ...selectedOrdered];+ } else if (target === 'back') {+ newOrder = [...selectedOrdered, ...rest];+ } else {+ // Insert the selected block starting at the target index, clamped so+ // the whole block still fits inside the sibling array.+ const maxStart = Math.max(0, rest.length);+ const insertAt = Math.max(0, Math.min(maxStart, Math.trunc(target)));+ newOrder = [...rest.slice(0, insertAt), ...selectedOrdered, ...rest.slice(insertAt)];+ }++ let changed = false;+ for (let i = 0; i < newOrder.length; i++) {+ if (newOrder[i] !== siblings[i]) { changed = true; break; }+ }+ if (!changed) continue;++ for (const [idx, sib] of newOrder.entries()) {+ setComponent(world, sib, c.ItemIndex, idx);+ }+ }+ });+}++function resolveReorderIndex(target: ReorderTarget, length: number): number {+ if (target === 'front') return length - 1;+ if (target === 'back') return 0;+ // Numeric target: clamp into [0, length - 1].+ return Math.max(0, Math.min(length - 1, Math.trunc(target)));+}diff --git a/apps/web/src/components/engine/api/index.ts b/apps/web/src/components/engine/api/index.tsnew file mode 100644index 00000000..7f58d524--- /dev/null+++ b/apps/web/src/components/engine/api/index.ts@@ -0,0 +1,25 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from "./base";+export * from "./serialize";+export * from "./query";+export * from "./keyframe";+export * from "./clipboard";+export * from "./group";+export * from "./frame";+export * from "./playback";+export * from "./overlap";+export * from "./assets";+export * from "./folders";+export * from "./engine";+export * from "./entities";+export * from "./components";+export * from "./world";+export * from "./observers";+export * from "./events";+export * from "./hierarchy";+export * from "./timeline-index";+export * from "./interactions";+export * from "./resize";diff --git a/apps/web/src/components/engine/api/interactions.ts b/apps/web/src/components/engine/api/interactions.tsnew file mode 100644index 00000000..b39de4c8--- /dev/null+++ b/apps/web/src/components/engine/api/interactions.ts@@ -0,0 +1,883 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, None, Not, Or, query } from "bitecs";+import { ChildOf, computeLocalMatrix, decompose2D, duplicateSelection, getParentEntity, identity2D, multiply2D, quadsIntersect, rectToQuad, rotate2D, scale2D, translate2D, type Mat2D, type Point, type Quad, transformPoint, invert2D, getSceneAncestor, isPointerInEntity, appendChild, removeChild, togglePlayback, switchActiveScene, transformSystem, clearComponent, computeGroupBounds } from "..";+import { addComponent, removeComponent, setComponent, clearSelectedAssets } from "../api";+import { resizeEntity } from "./resize";+import { syncInteractiveState } from "./utils";+import { buildSnapCandidatesFromCorners, buildSnapCandidatesFromQuad, entityAnchor, entityOffset, entityQuad, entityWorldMat, findSnapTarget, getMarqueeQuad, getSelectionMaskSnapshot, getSelectionTransfromSnapshot, getSnapCandidatesSnapshot, mountNameInput, snapshotSelectionMask, snapshotSelectionTransforms, snapshotSnapCandidates, updateResizeCursor, updateRotationCursor } from "../utils/interaction";+import { assert } from "@/utils";+import z from "zod";++import type { DispatchedPointerEvent } from "../types";+import type { EngineWorld } from "./world";++const SNAP_DISTANCE = 6;++export function handleGeometryInteraction(world: EngineWorld, event: DispatchedPointerEvent) {+ const c = world.components;++ // Equivalent to pointerdown on an entity/ click+ if (event.type === 'dragstart' && event.target.kind === 'entity') {+ if (world.keys.has('shift')) {+ addComponent(world, event.target.id, c.Selected, false);+ } else {+ clearComponent(world, c.Selected, false);+ addComponent(world, event.target.id, c.Selected, false);+ }++ handleMaskInteraction(world, event);+ }++ if (event.type === 'drag') {+ handleMaskInteraction(world, event);+ }++ if (event.type === 'dragend') {+ handleMaskInteraction(world, event);+ }++ if (event.type === 'dblclick' && event.target.kind === 'entity') {+ const parentEid = event.target.id;+ const childEid = findChildHitTarget(world, parentEid, event.clientX, event.clientY);+ if (childEid !== null) {+ removeComponent(world, parentEid, c.Interactive, false);+ for (const cid of query(world, [Or(c.Geometry, c.Group), ChildOf(parentEid), Not(c.Deleted)])) {+ addComponent(world, cid, c.Interactive, false);+ }+ clearComponent(world, c.Selected, false);+ clearComponent(world, c.Hovering, false);+ addComponent(world, childEid, c.Selected, false);+ addComponent(world, childEid, c.Hovering, false);+ }+ }++ if (world.pointer.state === 'lifted') {+ world.cursor.update('default');+ }+}++function findChildHitTarget(world: EngineWorld, parentEid: number, x: number, y: number): number | null {+ const c = world.components;+ const children = query(world, [Or(c.Geometry, c.Group), ChildOf(parentEid), Not(c.IsMask), Not(c.Culled), Not(c.Deleted)]);+ for (let i = children.length - 1; i >= 0; i--) {+ if (isPointerInEntity(world, children[i], { x, y })) {+ return children[i];+ }+ }+ return null;+}++export function handleCanvasInteraction(world: EngineWorld, event: DispatchedPointerEvent) {+ const c = world.components;++ if (event.type === 'dragstart') {+ world.hudMode = 'marquee';+ }++ if (event.type === 'drag' && world.hudMode === 'marquee') {+ const marqueeQuad = getMarqueeQuad(world);+ if (marqueeQuad) {+ clearComponent(world, c.Selected, false);+ for (const eid of query(world, [c.Interactive, Or(c.Geometry, c.Group), Not(c.Deleted), Not(c.Culled)])) {+ if (quadsIntersect(marqueeQuad, entityQuad(world, eid))) {+ addComponent(world, eid, c.Selected, false);+ }+ }+ }++ world.cursor.update('default');+ }++ if (event.type === 'dragend') {+ world.hudMode = 'idle';+ }++ if (event.type === 'pointerup') {+ const x0 = world.pointer.dragStartX;+ const y0 = world.pointer.dragStartY;+ const x1 = event.clientX;+ const y1 = event.clientY;+ const distance = Math.sqrt((x1 - x0) ** 2 + (y1 - y0) ** 2);+ if (distance < 4) {+ clearComponent(world, c.Selected, false);+ syncInteractiveState(world);+ clearComponent(world, c.Hovering, false);+ clearSelectedAssets(world);+ }+ }++ if (world.pointer.state === 'lifted') {+ world.cursor.update('default');+ }+}++export function handlePlayInteraction(world: EngineWorld, event: DispatchedPointerEvent) {+ if (event.target.kind !== 'hud') return;+ const eid = parseHudEntityId(event.target.id, 'play');+ if (eid === null) return;++ if (event.type === 'click') {+ togglePlayback(world, eid);+ }+}++export function handleLabelInteraction(world: EngineWorld, event: DispatchedPointerEvent) {+ if (event.target.kind !== 'hud') return;+ const eid = parseHudEntityId(event.target.id, 'label');+ if (eid === null) return;+ const c = world.components;++ if (event.type === 'pointerenter') {+ clearComponent(world, c.Hovering, false);+ addComponent(world, eid, c.Hovering, false);+ }++ if (event.type === 'pointerleave') {+ clearComponent(world, c.Hovering, false);+ }++ if (event.type === 'dragstart') {+ if (world.keys.has('shift')) {+ addComponent(world, eid, c.Selected, false);+ } else {+ clearComponent(world, c.Selected, false);+ addComponent(world, eid, c.Selected, false);+ }+ }++ if (event.type === 'dblclick') {+ mountNameInput(world, eid);+ }++ if (event.type === 'click' && hasComponent(world, eid, c.Scene)) {+ switchActiveScene(world, eid);+ }++ handleMaskInteraction(world, event);+}++function parseHudEntityId(id: string, prefix: string): number | null {+ if (!id.startsWith(`${prefix}:`)) return null;+ const eid = Number(id.slice(prefix.length + 1));+ return Number.isFinite(eid) ? eid : null;+}++export function handleResizeInteraction(world: EngineWorld, event: DispatchedPointerEvent) {+ const c = world.components;++ const orientation = anchorSchema.parse(event.target.id);+ const snapshot = getSelectionMaskSnapshot();++ if (event.type === 'dragstart') {+ snapshotSelectionMask(world);+ snapshotSelectionTransforms(world);+ snapshotSnapCandidates(world);+ world.snapLines = [];+ world.history.startTransaction('Resize');+ }++ if (event.type === 'drag' && snapshot) {+ const oldTr = snapshot.mat;+ const selection = query(world, [c.Selected, Or(c.Geometry, c.Group)]);+ world.snapLines.length = 0;++ const currentLocalPoint = getPointerCurrentPoint(world, oldTr);+ const initialLocalPoint = getPointerInitialPoint(world, oldTr);++ // Calculate delta in mask local space+ const deltaX = currentLocalPoint.x - initialLocalPoint.x;+ const deltaY = currentLocalPoint.y - initialLocalPoint.y;++ // How the drag distance relates to the mask size+ const factor = HANDLE_RESIZE_FACTOR[orientation];++ // Delta size+ let deltaWidth = deltaX * factor.x;+ let deltaHeight = deltaY * factor.y;++ // Lock aspect ratio when shift is held OR every selected entity has KeepAspectRatio.+ // Both paths run through the same math here so the pivot/position stays consistent;+ // when KAR's stored ratio matches the mask ratio (the observer keeps them in sync),+ // the Size observer's enforceAspectRatio becomes a no-op.+ const lockAR = world.keys.has('shift') || (+ selection.length > 0 && selection.every(eid => hasComponent(world, eid, c.KeepAspectRatio))+ );++ if (lockAR) {+ const w0 = snapshot.width;+ const h0 = snapshot.height;++ if (w0 > 0 && h0 > 0) {+ if (['tl', 'tr', 'bl', 'br'].includes(orientation)) {+ // Project the pointer delta onto the pivot→corner diagonal: the dragged+ // corner gets placed at the closest point on the AR-locked ray, so the+ // cursor stays as close as possible to the corner without ever leaping+ // past it on either axis.+ const denom = w0 * w0 + h0 * h0;+ const t = (deltaX * factor.x * w0 + deltaY * factor.y * h0) / denom;+ deltaWidth = w0 * t;+ deltaHeight = h0 * t;+ } else if (['l', 'r'].includes(orientation)) {+ const scale = (w0 + deltaWidth) / w0;+ deltaHeight = h0 * (scale - 1);+ } else if (['t', 'b'].includes(orientation)) {+ const scale = (h0 + deltaHeight) / h0;+ deltaWidth = w0 * (scale - 1);+ }+ }+ }++ // Pivot point: opposite to the handle being dragged+ // factor -1 → 1 (full), factor 0 → 0.5 (center), factor 1 → 0+ let pivotX = snapshot.width * (1 - factor.x) / 2;+ let pivotY = snapshot.height * (1 - factor.y) / 2;++ // When Alt is pressed, we want to scale the selection from the center+ if (world.keys.has('alt')) {+ pivotX = snapshot.width * 0.5;+ pivotY = snapshot.height * 0.5;+ deltaWidth = deltaWidth * 2;+ deltaHeight = deltaHeight * 2;+ }++ let newWidth = snapshot.width + deltaWidth;+ let newHeight = snapshot.height + deltaHeight;++ // Snap the resize vertices to nearby candidates.+ {+ const proposedScaleX = newWidth / snapshot.width;+ const proposedScaleY = newHeight / snapshot.height;++ let proposedLocalScaleTr = translate2D(pivotX, pivotY);+ proposedLocalScaleTr = multiply2D(proposedLocalScaleTr, scale2D(proposedScaleX, proposedScaleY));+ proposedLocalScaleTr = multiply2D(proposedLocalScaleTr, translate2D(-pivotX, -pivotY));++ const proposedWorldTr = multiply2D(oldTr, proposedLocalScaleTr);+ const proposedQuad = rectToQuad(+ proposedWorldTr,+ snapshot.width,+ snapshot.height,+ );++ // Only snap the vertices of the edge/corner being dragged+ // rectToQuad returns [TL, TR, BR, BL]+ const snapCandidates = getSnapCandidatesSnapshot();+ const draggedVertices = getResizeHandleVertices(orientation, proposedQuad);+ const cornerCandidates = buildSnapCandidatesFromCorners(draggedVertices);+ const snapThreshold = SNAP_DISTANCE * world.resolution;++ if (lockAR) {+ // The dragged corner moves linearly from `base` (s=0, the pivot in+ // world space) through `sourcePoint` (s=proposedScale). Each snap+ // line crosses that ray at exactly one scale, so the ratio of new-to-+ // old scale that puts the corner on it is just (span + offset) / span+ // on the snapped axis. Pick the snap whose ratio is closest to 1 and+ // apply it uniformly to both axes.+ const xSnap = findSnapTarget(cornerCandidates.x, snapCandidates.x, snapThreshold, 'x');+ const ySnap = findSnapTarget(cornerCandidates.y, snapCandidates.y, snapThreshold, 'y');+ const base = transformPoint(oldTr, pivotX, pivotY);++ const ratioOf = (snap: { sourcePoint: Point; offset: number } | null, axis: 'x' | 'y') => {+ if (!snap) return null;+ const span = snap.sourcePoint[axis] - base[axis];+ return Math.abs(span) < 1e-9 ? null : (span + snap.offset) / span;+ };++ const rX = ratioOf(xSnap, 'x');+ const rY = ratioOf(ySnap, 'y');+ const pickX = rX !== null && (rY === null || Math.abs(rX - 1) <= Math.abs(rY - 1));+ const pickY = rY !== null && !pickX;+ const ratio = pickX ? rX! : pickY ? rY! : null;+ const snap = pickX ? xSnap! : pickY ? ySnap! : null;++ if (snap && ratio !== null) {+ newWidth *= ratio;+ newHeight *= ratio;+ world.snapLines.push({+ from: {+ x: base.x + (snap.sourcePoint.x - base.x) * ratio,+ y: base.y + (snap.sourcePoint.y - base.y) * ratio,+ },+ to: snap.targetPoint,+ });+ }+ } else {+ const xSnap = factor.x !== 0 ? findSnapTarget(cornerCandidates.x, snapCandidates.x, snapThreshold, 'x') : null;+ const ySnap = factor.y !== 0 ? findSnapTarget(cornerCandidates.y, snapCandidates.y, snapThreshold, 'y') : null;++ if (xSnap) world.snapLines.push({+ from: {+ x: xSnap.sourcePoint.x + xSnap.offset,+ y: xSnap.sourcePoint.y + (ySnap?.offset ?? 0),+ },+ to: xSnap.targetPoint+ });++ if (ySnap) world.snapLines.push({+ from: {+ x: ySnap.sourcePoint.x + (xSnap?.offset ?? 0),+ y: ySnap.sourcePoint.y + ySnap.offset,+ },+ to: ySnap.targetPoint+ });+++ if (xSnap || ySnap) {+ // Convert the world-space snap offset back into a local-space size correction+ const inverseTr = invert2D(oldTr);+ inverseTr.e = 0;+ inverseTr.f = 0;+ const localCorrection = transformPoint(inverseTr, xSnap?.offset ?? 0, ySnap?.offset ?? 0);++ // The correction needs to be scaled by the factor and alt multiplier+ const altMultiplier = world.keys.has('alt') ? 2 : 1;+ if (factor.x !== 0) {+ deltaWidth += localCorrection.x * factor.x * altMultiplier;+ }+ if (factor.y !== 0) {+ deltaHeight += localCorrection.y * factor.y * altMultiplier;+ }++ newWidth = snapshot.width + deltaWidth;+ newHeight = snapshot.height + deltaHeight;+ }+ }+ }++ // Scale factors+ const scaleX = newWidth / snapshot.width;+ const scaleY = newHeight / snapshot.height;++ // Scale transformation in local space around the pivot+ let localScaleTr = translate2D(pivotX, pivotY);+ localScaleTr = multiply2D(localScaleTr, scale2D(scaleX, scaleY));+ localScaleTr = multiply2D(localScaleTr, translate2D(-pivotX, -pivotY));++ // Groups have no Size of their own — resize them by transforming their+ // direct children instead. Each child's snapshot was captured at dragstart.+ // The group's own transform is left untouched; transformSystem rebuilds+ // its Computed AABB from the moved/resized children.+ const hasGroupSelected = selection.some(eid => hasComponent(world, eid, c.Group));+ // The single-node wobble guard doesn't apply to group children: they're+ // scaled in the group's space, not their own, so rotation/skew can change.+ const writeRotationSkew = selection.length > 1 || hasGroupSelected;++ for (const selectedEid of selection) {+ const targets = hasComponent(world, selectedEid, c.Group)+ ? [...query(world, [ChildOf(selectedEid), Or(c.Geometry, c.Group), Not(c.Deleted)])]+ : [selectedEid];++ for (const eid of targets) {+ const initialState = getSelectionTransfromSnapshot(eid);+ if (!initialState) continue;++ const parentTransform = initialState.parentTransform;+ const anchor = entityAnchor(world, eid);++ // Don't include the pivot point in the old local transform+ const oldLocal = multiply2D(+ initialState.localTransform,+ translate2D(+ initialState.width * anchor.x,+ initialState.height * anchor.y,+ )+ );++ // Convert scaleMatrix from mask local space to world space+ let deltaWorld = multiply2D(oldTr, localScaleTr);+ deltaWorld = multiply2D(deltaWorld, invert2D(oldTr));++ // Calculate new local transform: [new local] = [parent inverted] * [delta] * [parent] * [old local]+ let newLocal = multiply2D(invert2D(parentTransform), deltaWorld);+ newLocal = multiply2D(newLocal, parentTransform);+ newLocal = multiply2D(newLocal, oldLocal);++ // Decompose the new local transform+ const decomposed = decompose2D(newLocal);++ // Calculate the new width and height from the decomposed transform+ // Using the decomposed scale accounts for entity rotation relative to the mask+ // NOTE: Claude added these two lines and I have no idea why they are needed (but it works)+ const newWidth = initialState.width * (decomposed.scaleX / initialState.scaleX);+ const newHeight = initialState.height * (decomposed.scaleY / initialState.scaleY);++ // Calculate the new pivot point+ const newPivotX = (newWidth * anchor.x);+ const newPivotY = (newHeight * anchor.y);++ const newPosX = decomposed.x - newPivotX;+ const newPosY = decomposed.y - newPivotY;++ const offset = entityOffset(world, eid);++ resizeEntity(world, eid, { width: newWidth, height: newHeight });+ {+ const roundedX = Math.round(newPosX - offset.x);+ const roundedY = Math.round(newPosY - offset.y);+ setComponent(world, eid, c.Position, { x: roundedX, y: roundedY });+ }++ if (writeRotationSkew) {+ const roundedRot = Math.round(decomposed.rotation * 100) / 100;+ const roundedSkewX = Math.round(decomposed.skewX * 100) / 100;+ const roundedSkewY = Math.round(decomposed.skewY * 100) / 100;+ setComponent(world, eid, c.Rotation, roundedRot);+ setComponent(world, eid, c.Skew, { x: roundedSkewX, y: roundedSkewY });+ }++ // transformSystem walks parent-first, so a group's computeGroupBounds+ // reads its children's LocalTransform from the previous walk — one frame+ // stale. Refresh this child's LocalTransform synchronously so the AABB+ // computed for any selected ancestor in this same tick is current. The+ // lag is invisible for non-rotated groups but shows up as drift in a+ // rotated direction once the group has a rotation.+ if (hasGroupSelected) {+ computeLocalMatrix(world, eid);+ }+ }++ // A group's own LocalTransform pivots around anchor * Computed.width/height+ // (see computeLocalMatrix). Resizing its children changes the group's AABB,+ // moving that pivot — and with a nonzero group rotation the (I - R)·pivot+ // term shifts the group's world translation, dragging the whole group+ // (children + selection mask) off the pointer-anchored position. The child+ // math above snapshots the group's world transform at dragstart and assumes+ // it stays fixed, so compensate the group's Position to keep its+ // LocalTransform equal to that snapshot. A no-op when the group isn't+ // rotated/skewed, which is why drift only shows up once it's rotated.+ if (hasComponent(world, selectedEid, c.Group)) {+ const groupSnapshot = getSelectionTransfromSnapshot(selectedEid);+ if (groupSnapshot) {+ // Recompute the group's AABB from the freshly-updated children so the+ // new pivot (anchor * new size) reflects the resize.+ computeGroupBounds(world, selectedEid);++ const anchor = entityAnchor(world, selectedEid);+ const newPivotX = anchor.x * c.Computed.width[selectedEid];+ const newPivotY = anchor.y * c.Computed.height[selectedEid];++ // Desired local = the dragstart snapshot; its linear part (rotation,+ // skew, scale) is untouched by the resize.+ const desiredLocal = groupSnapshot.localTransform;+ const linear: Mat2D = {+ a: desiredLocal.a, b: desiredLocal.b,+ c: desiredLocal.c, d: desiredLocal.d,+ e: 0, f: 0,+ };++ // computeLocalMatrix builds L = T(pos) · K with K = T(pivot)·linear·T(-pivot).+ // Solve T(pos) = L · K⁻¹ for the new pivot so the rebuilt matrix matches.+ let k = multiply2D(translate2D(newPivotX, newPivotY), linear);+ k = multiply2D(k, translate2D(-newPivotX, -newPivotY));+ const posMat = multiply2D(desiredLocal, invert2D(k));++ const offset = entityOffset(world, selectedEid);+ setComponent(world, selectedEid, c.Position, {+ x: Math.round(posMat.e - offset.x),+ y: Math.round(posMat.f - offset.y),+ });+ computeLocalMatrix(world, selectedEid);+ }+ }+ }+ updateResizeCursor(world, orientation);+ }++ if (event.type === 'dragend') {+ // Clear state when resize ends+ world.snapLines.length = 0;+ world.history.commitTransaction();+ }++ if (world.pointer.state === 'lifted') {+ updateResizeCursor(world, orientation);+ }+}++export function handleRotateInteraction(world: EngineWorld, event: DispatchedPointerEvent) {+ const c = world.components;++ const snapshot = getSelectionMaskSnapshot();++ if (event.type === 'dragstart') {+ snapshotSelectionTransforms(world);+ snapshotSelectionMask(world);+ world.history.startTransaction('Rotate');+ }++ if (event.type === 'drag' && snapshot) {+ const oldTr = snapshot.mat;++ // Calculate the pivot point in mask local space+ // For 2+ nodes: use the center of the selection+ // For 1 node: use the anchor point of the node+ let pivotX: number;+ let pivotY: number;++ const selection = query(world, [c.Selected, Or(c.Geometry, c.Group)]);++ if (selection.length === 1) {+ const eid = selection[0];++ const anchor = entityAnchor(world, eid);+ // Use the anchor point (which is at the origin in local space after accounting for anchor offset)+ pivotX = snapshot.width * anchor.x;+ pivotY = snapshot.height * anchor.y;+ } else {+ // Use the center of the selection bounding box+ pivotX = snapshot.width / 2;+ pivotY = snapshot.height / 2;+ }++ // Get pointer positions in mask local space+ const currentLocalPoint = getPointerCurrentPoint(world, oldTr);+ const initialLocalPoint = getPointerInitialPoint(world, oldTr);++ // Calculate angles from pivot to pointer positions+ const initialAngle = Math.atan2(+ initialLocalPoint.y - pivotY,+ initialLocalPoint.x - pivotX+ );+ const currentAngle = Math.atan2(+ currentLocalPoint.y - pivotY,+ currentLocalPoint.x - pivotX+ );++ // Calculate rotation delta in radians+ const deltaAngleRad = currentAngle - initialAngle;+ const deltaAngleDeg = deltaAngleRad * 180 / Math.PI;++ // Rotation transformation in local space around the pivot+ let localRotateTr = translate2D(pivotX, pivotY);+ localRotateTr = multiply2D(localRotateTr, rotate2D(deltaAngleDeg));+ localRotateTr = multiply2D(localRotateTr, translate2D(-pivotX, -pivotY));++ for (const eid of selection) {+ const initialState = getSelectionTransfromSnapshot(eid);+ if (!initialState) continue;++ const parentTransform = initialState.parentTransform;+ const anchor = entityAnchor(world, eid);++ // Include the anchor offset in the old local transform+ const oldLocal = multiply2D(+ initialState.localTransform,+ translate2D(+ initialState.width * anchor.x,+ initialState.height * anchor.y,+ )+ );++ // Convert rotation from mask local space to world space+ let deltaWorld = multiply2D(oldTr, localRotateTr);+ deltaWorld = multiply2D(deltaWorld, invert2D(oldTr));++ // Calculate new local transform: [new local] = [parent inverted] * [delta] * [parent] * [old local]+ let newLocal = multiply2D(invert2D(parentTransform), deltaWorld)+ newLocal = multiply2D(newLocal, parentTransform);+ newLocal = multiply2D(newLocal, oldLocal);++ // Decompose the new local transform+ let decomposed = decompose2D(newLocal);++ // Snap rotation to global 15 degree multiples when Shift is pressed.+ // The snap must rotate about the same pivot the interactive rotation+ // used (the mask pivot, in world space) and the position must be+ // re-derived from the snapped transform. Reusing the unsnapped position+ // works for a single node — computeLocalMatrix pivots about the same+ // anchor, so its world position is rotation-invariant — but a group's+ // local matrix pivots about its box center (width/2, height/2) while the+ // interaction pivots about the mask/AABB center (offset by the group's+ // AABB origin). Overriding rotation while keeping the unsnapped position+ // then rotates about the wrong point and the mask jumps.+ if (world.keys.has('shift')) {+ const snapIncrement = 15;+ const snapped = Math.round(decomposed.rotation / snapIncrement) * snapIncrement;+ const snapDelta = snapped - decomposed.rotation;++ if (snapDelta !== 0) {+ const pivotWorld = transformPoint(oldTr, pivotX, pivotY);+ let snapWorld = translate2D(pivotWorld.x, pivotWorld.y);+ snapWorld = multiply2D(snapWorld, rotate2D(snapDelta));+ snapWorld = multiply2D(snapWorld, translate2D(-pivotWorld.x, -pivotWorld.y));++ let snappedLocal = multiply2D(invert2D(parentTransform), snapWorld);+ snappedLocal = multiply2D(snappedLocal, parentTransform);+ snappedLocal = multiply2D(snappedLocal, newLocal);+ newLocal = snappedLocal;+ decomposed = decompose2D(newLocal);+ }+ }++ // Calculate the anchor offset+ const anchorOffsetX = initialState.width * anchor.x;+ const anchorOffsetY = initialState.height * anchor.y;++ const offset = entityOffset(world, eid);+ const newPosX = decomposed.x - anchorOffsetX - offset.x;+ const newPosY = decomposed.y - anchorOffsetY - offset.y;++ const roundedPosX = Math.round(newPosX);+ const roundedPosY = Math.round(newPosY);+ const roundedRot = Math.round(decomposed.rotation * 100) / 100;+ setComponent(world, eid, c.Position, { x: roundedPosX, y: roundedPosY });+ setComponent(world, eid, c.Rotation, roundedRot);+ }+ updateRotationCursor(world);+ }++ if (event.type === 'dragend') {+ // Clear state when rotation ends+ world.history.commitTransaction();+ }++ if (world.pointer.state === 'lifted') {+ updateRotationCursor(world);+ }+}++const transformCorrectionFactors: Map<number, Mat2D> = new Map();++export function handleMaskInteraction(world: EngineWorld, event: DispatchedPointerEvent) {+ const c = world.components;+ const snapshot = getSelectionMaskSnapshot();++ if (event.type === 'dblclick') {+ const selection = query(world, [c.Selected, Or(c.Geometry, c.Group)]);+ if (selection.length === 1) {+ const parentEid = selection[0];+ const childEid = findChildHitTarget(world, parentEid, event.clientX, event.clientY);+ if (childEid !== null) {+ removeComponent(world, parentEid, c.Interactive, false);+ for (const cid of query(world, [Or(c.Geometry, c.Group), ChildOf(parentEid), Not(c.Deleted)])) {+ addComponent(world, cid, c.Interactive, false);+ }+ clearComponent(world, c.Selected, false);+ clearComponent(world, c.Hovering, false);+ addComponent(world, childEid, c.Selected, false);+ addComponent(world, childEid, c.Hovering, false);+ }+ }+ return;+ }++ if (event.type == 'dragstart') {+ // One gesture = one undo step. For an option-drag the clone + the move+ // share this transaction (duplicateSelection's own transaction nests into+ // it); a plain drag just records the move.+ world.history.startTransaction(world.keys.has('alt') ? 'Duplicate' : 'Transform');++ if (world.keys.has('alt')) {+ duplicateSelection(world, { offset: false });+ transformSystem(world);+ }++ // Get the base matrix that was used to render the backdrop+ snapshotSelectionMask(world);+ snapshotSelectionTransforms(world);+ snapshotSnapCandidates(world);+ world.snapLines = [];++ // Initialize correction factors to identity for each selected node+ transformCorrectionFactors.clear();+ for (const eid of query(world, [c.Selected, Or(c.Geometry, c.Group)])) {+ transformCorrectionFactors.set(eid, identity2D());+ }++ world.hudMode = 'moving';+ }++ if (event.type == 'drag' && snapshot) {+ const oldTr = snapshot.mat;+ world.snapLines.length = 0;++ const currentLocalPoint = getPointerCurrentPoint(world, oldTr);+ const initialLocalPoint = getPointerInitialPoint(world, oldTr);++ // Calculate delta in mask local space+ let deltaX = currentLocalPoint.x - initialLocalPoint.x;+ let deltaY = currentLocalPoint.y - initialLocalPoint.y;++ // Determine if the drag is snapping to a guide+ if (!world.keys.has('mod')) {+ const proposedMaskQuad = rectToQuad(+ multiply2D(oldTr, translate2D(deltaX, deltaY)),+ snapshot.width,+ snapshot.height,+ );+ const snapCandidates = getSnapCandidatesSnapshot();+ const proposedMaskCandidates = buildSnapCandidatesFromQuad(proposedMaskQuad);+ const snapThreshold = SNAP_DISTANCE * world.resolution;+ const xSnap = findSnapTarget(proposedMaskCandidates.x, snapCandidates.x, snapThreshold, 'x');+ const ySnap = findSnapTarget(proposedMaskCandidates.y, snapCandidates.y, snapThreshold, 'y');++ if (xSnap) world.snapLines.push({+ from: {+ x: xSnap.sourcePoint.x + xSnap.offset,+ y: xSnap.sourcePoint.y + (ySnap?.offset ?? 0),+ },+ to: xSnap.targetPoint+ });++ if (ySnap) world.snapLines.push({+ from: {+ x: ySnap.sourcePoint.x + (xSnap?.offset ?? 0),+ y: ySnap.sourcePoint.y + ySnap.offset,+ },+ to: ySnap.targetPoint+ });++ if (xSnap || ySnap) {+ const inverseTr = invert2D(oldTr);+ assert(inverseTr, 'Matrix must be invertible');+ inverseTr.e = 0;+ inverseTr.f = 0;++ const localCorrection = transformPoint(inverseTr, xSnap?.offset ?? 0, ySnap?.offset ?? 0);+ deltaX += localCorrection.x;+ deltaY += localCorrection.y;+ }+ }++ // Update mask offset by adding delta to the initial offset+ const localOffsetTr = translate2D(deltaX, deltaY);++ // Apply the offset to each node+ for (const eid of query(world, [c.Selected, Or(c.Geometry, c.Group)])) {+ const initialState = getSelectionTransfromSnapshot(eid);+ if (!initialState) continue;++ const parentEid = getParentEntity(world, eid);+ const oldParentTransform = entityWorldMat(world, parentEid);++ let reparented = false;++ const inScene = getSceneAncestor(world, eid) !== null;+ const sceneHitTarget = findSceneHitTarget(world, event.clientX, event.clientY);++ if (sceneHitTarget && sceneHitTarget !== eid && parentEid === null) {+ try {+ appendChild(world, eid, sceneHitTarget);+ reparented = true;+ } catch {/* ignore */ }+ try {+ switchActiveScene(world, sceneHitTarget);+ } catch { /* ignore */ }+ }++ if (!sceneHitTarget && inScene && parentEid !== null) {+ try {+ removeChild(world, eid, parentEid);+ reparented = true;+ } catch { /* ignore */ }+ }++ if (reparented) {+ // Calculate correction factor: newParent^-1 * oldParent+ // This compensates for the change in parent transform+ const newParentEid = getParentEntity(world, eid);+ const newParentTransform = entityWorldMat(world, newParentEid);+ const correction = multiply2D(invert2D(newParentTransform), oldParentTransform);+ const existingCorrection = transformCorrectionFactors.get(eid) ?? identity2D();+ transformCorrectionFactors.set(eid, multiply2D(existingCorrection, correction));+ }++ const anchor = entityAnchor(world, eid);+ const offsetX = initialState.width * anchor.x;+ const offsetY = initialState.height * anchor.y;++ const parentTransform = initialState.parentTransform;+ const oldLocal = multiply2D(initialState.localTransform, translate2D(offsetX, offsetY));++ // Convert scaleMatrix from mask local space to world space+ let deltaWorld = multiply2D(oldTr, localOffsetTr);+ deltaWorld = multiply2D(deltaWorld, invert2D(oldTr));++ // Get correction factor (identity if no reparenting occurred)+ const correctionFactor = transformCorrectionFactors.get(eid) ?? identity2D();++ // Calculate new local transform: [new local] = [correction] * [parent inverted] * [delta] * [parent] * [old local]+ // The correction factor compensates for any parent changes during the drag+ let newLocal = multiply2D(correctionFactor, invert2D(parentTransform));+ newLocal = multiply2D(newLocal, deltaWorld);+ newLocal = multiply2D(newLocal, parentTransform);+ newLocal = multiply2D(newLocal, oldLocal);++ const offset = entityOffset(world, eid);+ const decomposed = decompose2D(newLocal);+ const newPosX = Math.round(decomposed.x - offsetX - offset.x);+ const newPosY = Math.round(decomposed.y - offsetY - offset.y);++ setComponent(world, eid, c.Position, { x: newPosX, y: newPosY });+ }+ }++ if (event.type == 'dragend') {+ // Clear state when drag ends+ world.snapLines.length = 0;+ world.hudMode = 'idle';+ world.history.commitTransaction();+ }++ if (world.pointer.state === 'lifted') {+ world.cursor.update('default');+ }+}++function getPointerCurrentPoint(world: EngineWorld, mat: Mat2D) {+ const currentX = world.pointer.clientX;+ const currentY = world.pointer.clientY;++ const inverse = invert2D(mat);+ assert(inverse, 'Matrix must be invertible');++ return transformPoint(inverse, currentX, currentY);+}++function getPointerInitialPoint(world: EngineWorld, mat: Mat2D) {+ const initialX = world.pointer.dragStartX ?? 0;+ const initialY = world.pointer.dragStartY ?? 0;++ const inverse = invert2D(mat);+ assert(inverse, 'Matrix must be invertible');++ return transformPoint(inverse, initialX, initialY);+}++function findSceneHitTarget(world: EngineWorld, x: number, y: number) {+ const c = world.components;++ for (const eid of query(world, [c.Scene, None(ChildOf('*'), c.Selected, c.Dragging, c.Culled, c.Deleted)])) {+ if (isPointerInEntity(world, eid, { x, y })) {+ return eid;+ }+ }++ return null;+}++const anchorSchema = z.enum(['tl', 'tr', 'bl', 'br', 't', 'r', 'b', 'l']);+type AnchorType = z.infer<typeof anchorSchema>;++const HANDLE_RESIZE_FACTOR: Record<AnchorType, Point> = {+ tl: { x: -1, y: -1 }, tr: { x: 1, y: -1 },+ bl: { x: -1, y: 1 }, br: { x: 1, y: 1 },+ t: { x: 0, y: -1 }, r: { x: 1, y: 0 },+ b: { x: 0, y: 1 }, l: { x: -1, y: 0 },+};++function getResizeHandleVertices(orientation: AnchorType, q: Quad): Point[] {+ switch (orientation) {+ case 'tl': return [q[0]];+ case 'tr': return [q[1]];+ case 'br': return [q[2]];+ case 'bl': return [q[3]];+ case 't': return [q[0], q[1]];+ case 'r': return [q[1], q[2]];+ case 'b': return [q[2], q[3]];+ case 'l': return [q[3], q[0]];+ }+}diff --git a/apps/web/src/components/engine/api/keyframe.ts b/apps/web/src/components/engine/api/keyframe.tsnew file mode 100644index 00000000..9e10bd03--- /dev/null+++ b/apps/web/src/components/engine/api/keyframe.ts@@ -0,0 +1,164 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, query } from 'bitecs';+import { ChildOf } from '../components/relations';+import { getPropertyPaths, type PropertyPath } from '../systems/motion';+import { getNodeLocalFrame } from './query';+import { getParentEntity } from './base';+import { createEntity, deleteEntity } from './entities';+import { appendChild } from './hierarchy';+import { setComponent } from './events';++import type { EngineWorld } from './world';++/**+ * Find the KeyframeTrack entity (if any) for a (target, property) pair.+ */+export function findKeyframeTrackEntity(world: EngineWorld, target: number, property: string): number | null {+ const c = world.components;+ for (const tid of query(world, [c.KeyframeTrack, ChildOf(target), Not(c.Deleted)])) {+ if (c.KeyframeTrack.property[tid] === property) return tid;+ }+ return null;+}++/**+ * Collect all keyframe entities for a (target, property) pair.+ */+export function getKeyframeTrack(world: EngineWorld, target: number, property: string): number[] {+ const c = world.components;+ const tid = findKeyframeTrackEntity(world, target, property);+ if (tid === null) return [];+ return [...query(world, [c.Keyframe, ChildOf(tid), Not(c.Deleted)])];+}++/**+ * Find the target node for a given entity.+ */+export function findKeyframeTargetNode(world: EngineWorld, eid: number): number | null {+ const c = world.components;++ let current: number | null = eid;+ while (current) {+ if (hasComponent(world, current, c.Geometry) || hasComponent(world, current, c.Group) || hasComponent(world, current, c.AdjustmentLayer)) {+ return current;+ }+ current = getParentEntity(world, current);+ }++ return null;+}++/**+ * Get the KeyframeTrack entity for (target, property), creating one if missing.+ */+function ensureKeyframeTrackEntity(world: EngineWorld, target: number, property: PropertyPath): number {+ const c = world.components;+ const existing = findKeyframeTrackEntity(world, target, property);+ if (existing !== null) return existing;++ const tid = createEntity(world);+ setComponent(world, tid, c.KeyframeTrack, { property });+ appendChild(world, tid, target);+ return tid;+}++/**+ * Add a keyframe at the current local time for (target, property).+ * Reads the current value from the target. If a keyframe at this exact time+ * already exists, its value is overwritten.+ */+export function syncKeyframeTrack(world: EngineWorld, eid: number, property: PropertyPath) {+ const c = world.components;++ const worldProps = getPropertyPaths(world);+ const nodeEid = findKeyframeTargetNode(world, eid);+ if (nodeEid === null) return;++ const trackEid = findKeyframeTrackEntity(world, eid, property);+ if (trackEid === null) return;++ const localFrame = getNodeLocalFrame(world, nodeEid);+ const existingKfEid = query(world, [c.Keyframe, ChildOf(trackEid), Not(c.Deleted)])+ .find(kid => c.Keyframe.time[kid] === localFrame);++ const currentValue = worldProps[property].authored[eid] ?? 0;+ const isNumber = typeof currentValue === 'number';+ if (!isNumber) return;++ if (existingKfEid) {+ setComponent(world, existingKfEid, c.Keyframe, { value: currentValue });+ } else {+ const kfid = createEntity(world);+ setComponent(world, kfid, c.Keyframe, {+ time: localFrame,+ value: currentValue,+ easing: 'linear',+ });+ appendChild(world, kfid, trackEid);+ }+}++/**+ * Toggle a keyframe at the current local time for (target, property).+ * Creates the KeyframeTrack on first use; removes it when its last keyframe+ * is toggled off.+ */+export function toggleKeyframeTrack(world: EngineWorld, eid: number, property: PropertyPath) {+ const c = world.components;++ const worldProps = getPropertyPaths(world);+ const nodeEid = findKeyframeTargetNode(world, eid);+ if (nodeEid === null) return;++ const localFrame = getNodeLocalFrame(world, nodeEid);+ const trackEid = findKeyframeTrackEntity(world, eid, property);++ let trackKeyframes: number[] = [];+ if (trackEid !== null) {+ trackKeyframes = [...query(world, [c.Keyframe, ChildOf(trackEid), Not(c.Deleted)])];+ }++ const existingKfEid = trackKeyframes.find(kid => c.Keyframe.time[kid] === localFrame);++ const currentValue = worldProps[property].authored[eid] ?? 0;+ const isNumber = typeof currentValue === 'number';+ if (!isNumber) return;++ if (existingKfEid) {+ world.history.transaction('Remove keyframe', () => {+ deleteEntity(world, existingKfEid);+ // If that was the track's last keyframe, drop the track too.+ if (trackEid && trackKeyframes.length === 1) {+ deleteEntity(world, trackEid);+ }+ });+ return;+ }++ world.history.transaction('Add keyframe', () => {+ const track = ensureKeyframeTrackEntity(world, eid, property);+ const kfid = createEntity(world);+ setComponent(world, kfid, c.Keyframe, {+ time: localFrame,+ value: currentValue,+ easing: 'linear',+ });+ appendChild(world, kfid, track);+ });+}++export function removeKeyframeTrack(world: EngineWorld, eid: number, property: PropertyPath) {+ const c = world.components;+ const trackEid = findKeyframeTrackEntity(world, eid, property);+ if (trackEid === null) return;++ const keyframes = [...query(world, [c.Keyframe, ChildOf(trackEid), Not(c.Deleted)])];++ world.history.transaction('Remove keyframe track', () => {+ keyframes.forEach(kfEid => deleteEntity(world, kfEid));+ deleteEntity(world, trackEid);+ });+}diff --git a/apps/web/src/components/engine/api/observers.ts b/apps/web/src/components/engine/api/observers.tsnew file mode 100644index 00000000..55a5112c--- /dev/null+++ b/apps/web/src/components/engine/api/observers.ts@@ -0,0 +1,514 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, query, Not } from "bitecs";+import { AnimationPhase, AnimationType, BlendMode, CaptionType, ConstraintType, EffectType, FontStyle, GeometryType, PaintType, ScaleMode, StrokeCap, StrokeJoin, TextAlign, TextBaseline, TextCase, TransitionType } from "../components/constants";+import { ChildOf } from "../components/relations";+import { DEFAULT_CLIP_HEIGHT } from "../timeline/config";+import { getParentEntity } from "./base";+import { observe, addComponent, removeComponent } from "./events";+import { syncKeyframeTrack } from "./keyframe";+import { DEFAULT_DURATION_FRAMES } from "../constants";+import * as utils from "./utils";++import type { EngineWorld } from "./world";++export function observeWorld(world: EngineWorld) {+ const c = world.components;++ observe(world, "set", c.Geometry, (eid, type) => {+ c.Geometry[eid] = type ?? c.Geometry[eid] ?? GeometryType.RECT;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Paint, (eid, type) => {+ c.Paint[eid] = type ?? c.Paint[eid] ?? PaintType.SOLID;+ utils.reactToPaintChange(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Group, (eid) => {+ utils.recomputeEntityTimeRange(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.Group, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Scene, (eid) => {+ utils.recomputeEntityTimeRange(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.Scene, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Audio, (eid) => {+ utils.recomputeEntityTimeRange(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.ExportSettings, (eid, data) => {+ const s = c.ExportSettings;+ s.templateId[eid] = data.templateId ?? s.templateId[eid] ?? null;+ s.format[eid] = data.format ?? s.format[eid] ?? 'mp4';+ s.videoEnabled[eid] = data.videoEnabled ?? s.videoEnabled[eid] ?? true;+ s.videoCodec[eid] = data.videoCodec ?? s.videoCodec[eid] ?? 'avc';+ s.videoBitrate[eid] = data.videoBitrate ?? s.videoBitrate[eid] ?? 10e6;+ s.videoFps[eid] = data.videoFps ?? s.videoFps[eid] ?? 30;+ s.videoResolution[eid] = data.videoResolution ?? s.videoResolution[eid] ?? 1080;+ s.audioEnabled[eid] = data.audioEnabled ?? s.audioEnabled[eid] ?? true;+ s.audioCodec[eid] = data.audioCodec ?? s.audioCodec[eid] ?? 'aac';+ s.audioSampleRate[eid] = data.audioSampleRate ?? s.audioSampleRate[eid] ?? 48000;+ });++ observe(world, "add", c.Selected, (eid) => {+ if (!hasComponent(world, eid, c.Audio)) return;+ for (const fid of [...query(world, [c.Paint, ChildOf(eid), Not(c.Deleted)])]) {+ if (c.Paint[fid] === PaintType.WAVEFORM) {+ removeComponent(world, fid, c.Hidden);+ }+ }+ });++ observe(world, "remove", c.Selected, (eid) => {+ if (!hasComponent(world, eid, c.Audio) || getParentEntity(world, eid) === null) return;+ for (const fid of [...query(world, [c.Paint, ChildOf(eid), Not(c.Deleted)])]) {+ if (c.Paint[fid] === PaintType.WAVEFORM) {+ addComponent(world, fid, c.Hidden);+ }+ }+ });++ observe(world, "set", c.Effect, (eid, { type, value }) => {+ c.Effect.type[eid] = type ?? c.Effect.type[eid] ?? EffectType.BRIGHTNESS;+ c.Effect.value[eid] = value ?? c.Effect.value[eid] ?? 0.5;+ c.Computed.value[eid] = c.Effect.value[eid];+ utils.persistEntity(world, eid);+ if (value !== undefined) syncKeyframeTrack(world, eid, 'effect.value');+ });++ observe(world, "add", c.IsMask, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.IsMask, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Shadow, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Stroke, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Caption, (eid, { type, colors }) => {+ c.Caption.type[eid] = type ?? c.Caption.type[eid] ?? CaptionType.CLASSIC;+ c.Caption.colors[eid] = colors ?? c.Caption.colors[eid] ?? [0xFFFFFF];+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Name, (eid, name) => {+ c.Name[eid] = name ?? c.Name[eid] ?? "";+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Key, (eid, key) => {+ c.Key[eid] = key ?? c.Key[eid] ?? "";+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Position, (eid, { x, y }) => {+ c.Position.x[eid] = x ?? c.Position.x[eid] ?? 0;+ c.Position.y[eid] = y ?? c.Position.y[eid] ?? 0;+ c.Computed.positionX[eid] = c.Position.x[eid];+ c.Computed.positionY[eid] = c.Position.y[eid];+ utils.persistEntity(world, eid);+ if (x !== undefined) syncKeyframeTrack(world, eid, 'position.x');+ if (y !== undefined) syncKeyframeTrack(world, eid, 'position.y');+ });++ observe(world, "set", c.Offset, (eid, { x, y }) => {+ c.Offset.x[eid] = x ?? c.Offset.x[eid] ?? 0;+ c.Offset.y[eid] = y ?? c.Offset.y[eid] ?? 0;+ c.Computed.offsetX[eid] = c.Offset.x[eid];+ c.Computed.offsetY[eid] = c.Offset.y[eid];+ utils.persistEntity(world, eid);+ if (x !== undefined) syncKeyframeTrack(world, eid, 'offset.x');+ if (y !== undefined) syncKeyframeTrack(world, eid, 'offset.y');+ });++ observe(world, "set", c.Rotation, (eid, rotation) => {+ c.Rotation[eid] = rotation ?? c.Rotation[eid] ?? 0;+ c.Computed.rotation[eid] = c.Rotation[eid];+ utils.persistEntity(world, eid);+ if (rotation !== undefined) syncKeyframeTrack(world, eid, 'rotation');+ });++ observe(world, "set", c.Scale, (eid, { x, y }) => {+ c.Scale.x[eid] = x ?? c.Scale.x[eid] ?? 1;+ c.Scale.y[eid] = y ?? c.Scale.y[eid] ?? 1;+ c.Computed.scaleX[eid] = c.Scale.x[eid];+ c.Computed.scaleY[eid] = c.Scale.y[eid];+ utils.persistEntity(world, eid);+ if (x !== undefined) syncKeyframeTrack(world, eid, 'scale.x');+ if (y !== undefined) syncKeyframeTrack(world, eid, 'scale.y');+ });++ observe(world, "set", c.UniformScale, (eid, scale) => {+ c.UniformScale[eid] = scale ?? c.UniformScale[eid] ?? 1;+ c.Computed.scaleX[eid] = c.UniformScale[eid];+ c.Computed.scaleY[eid] = c.UniformScale[eid];+ utils.persistEntity(world, eid);+ if (scale !== undefined) syncKeyframeTrack(world, eid, 'scale');+ });++ observe(world, "set", c.Anchor, (eid, { x, y }) => {+ c.Anchor.x[eid] = x ?? c.Anchor.x[eid] ?? 0.5;+ c.Anchor.y[eid] = y ?? c.Anchor.y[eid] ?? 0.5;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Skew, (eid, { x, y }) => {+ c.Skew.x[eid] = x ?? c.Skew.x[eid] ?? 0;+ c.Skew.y[eid] = y ?? c.Skew.y[eid] ?? 0;+ c.Computed.skewX[eid] = c.Skew.x[eid];+ c.Computed.skewY[eid] = c.Skew.y[eid];+ utils.persistEntity(world, eid);+ if (x !== undefined) syncKeyframeTrack(world, eid, 'skew.x');+ if (y !== undefined) syncKeyframeTrack(world, eid, 'skew.y');+ });++ observe(world, "set", c.Size, (eid, params) => {+ c.Size.width[eid] = params.width ?? c.Size.width[eid] ?? 300;+ c.Size.height[eid] = params.height ?? c.Size.height[eid] ?? 300;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Flip, (eid, { x, y }) => {+ c.Flip.x[eid] = x ?? c.Flip.x[eid] ?? 1;+ c.Flip.y[eid] = y ?? c.Flip.y[eid] ?? 1;+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Hidden, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.Hidden, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.ClipsContent, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.ClipsContent, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Sequential, (eid) => {+ addComponent(world, eid, c.Group);+ removeComponent(world, eid, c.Position);+ removeComponent(world, eid, c.Offset);+ removeComponent(world, eid, c.Rotation);+ removeComponent(world, eid, c.Scale);+ removeComponent(world, eid, c.Skew);+ removeComponent(world, eid, c.Anchor);+ removeComponent(world, eid, c.Flip);+ utils.syncInteractiveState(world);+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.Sequential, (eid) => {+ utils.syncInteractiveState(world);+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Appearance, (eid, { opacity, blendMode }) => {+ c.Appearance.opacity[eid] = opacity ?? c.Appearance.opacity[eid] ?? 1;+ c.Appearance.blendMode[eid] = blendMode ?? c.Appearance.blendMode[eid] ?? BlendMode.SOURCE_OVER;+ c.Computed.opacity[eid] = c.Appearance.opacity[eid];+ utils.persistEntity(world, eid);+ if (opacity !== undefined) syncKeyframeTrack(world, eid, 'opacity');+ });++ observe(world, "set", c.CornerRadius, (eid, cornerRadius) => {+ c.CornerRadius[eid] = cornerRadius ?? c.CornerRadius[eid] ?? 0;+ c.Computed.cornerRadius[eid] = c.CornerRadius[eid];+ utils.persistEntity(world, eid);+ if (cornerRadius !== undefined) syncKeyframeTrack(world, eid, 'vertexRadius');+ });++ observe(world, "set", c.MixedCornerRadius, (eid, params) => {+ c.MixedCornerRadius.topLeft[eid] = params.topLeft ?? c.MixedCornerRadius.topLeft[eid] ?? 0;+ c.MixedCornerRadius.topRight[eid] = params.topRight ?? c.MixedCornerRadius.topRight[eid] ?? 0;+ c.MixedCornerRadius.bottomRight[eid] = params.bottomRight ?? c.MixedCornerRadius.bottomRight[eid] ?? 0;+ c.MixedCornerRadius.bottomLeft[eid] = params.bottomLeft ?? c.MixedCornerRadius.bottomLeft[eid] ?? 0;+ c.Computed.cornerRadiusTopLeft[eid] = c.MixedCornerRadius.topLeft[eid];+ c.Computed.cornerRadiusTopRight[eid] = c.MixedCornerRadius.topRight[eid];+ c.Computed.cornerRadiusBottomRight[eid] = c.MixedCornerRadius.bottomRight[eid];+ c.Computed.cornerRadiusBottomLeft[eid] = c.MixedCornerRadius.bottomLeft[eid];+ utils.persistEntity(world, eid);+ if (params.topLeft !== undefined) syncKeyframeTrack(world, eid, 'mixedVertexRadius.topLeft');+ if (params.topRight !== undefined) syncKeyframeTrack(world, eid, 'mixedVertexRadius.topRight');+ if (params.bottomRight !== undefined) syncKeyframeTrack(world, eid, 'mixedVertexRadius.bottomRight');+ if (params.bottomLeft !== undefined) syncKeyframeTrack(world, eid, 'mixedVertexRadius.bottomLeft');+ });++ observe(world, "set", c.Color, (eid, color) => {+ c.Color[eid] = color ?? c.Color[eid] ?? 0xE0E0E0;+ c.Computed.color[eid] = c.Color[eid];+ utils.persistEntity(world, eid);+ if (color !== undefined) syncKeyframeTrack(world, eid, 'color');+ });++ observe(world, "set", c.Blur, (eid, blur) => {+ c.Blur[eid] = blur ?? c.Blur[eid] ?? 0;+ c.Computed.blur[eid] = c.Blur[eid];+ utils.persistEntity(world, eid);+ if (blur !== undefined) syncKeyframeTrack(world, eid, 'blur');+ });++ observe(world, "set", c.AssetId, (eid, assetId) => {+ c.AssetId[eid] = assetId ?? c.AssetId[eid] ?? "";+ utils.reactToAssetChange(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.ScaleMode, (eid, scaleMode) => {+ c.ScaleMode[eid] = scaleMode ?? c.ScaleMode[eid] ?? ScaleMode.FIT;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Volume, (eid, volume) => {+ c.Volume[eid] = volume ?? c.Volume[eid] ?? 0;+ c.Computed.volume[eid] = c.Volume[eid];+ utils.persistEntity(world, eid);+ if (volume !== undefined) syncKeyframeTrack(world, eid, 'volume');+ });++ observe(world, "add", c.AudioBus, () => {+ // AudioBus is created lazily during the playback tick (resolveAudioBus),+ // after the appendChild rebuild has already run. Rebuild the timeline index+ // so audio-aware UI (e.g. the soundboard meters) reacts to the newly+ // metered layer instead of staying stale until the next reorder/delete.+ world.rebuildTimelineIndex();+ });++ observe(world, "add", c.Muted, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.Muted, (eid) => {+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Chars, (eid, chars) => {+ c.Chars[eid] = chars ?? c.Chars[eid] ?? "Text";+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.TextStyle, (eid, params) => {+ // A TextStyle on a TextRange entity is a *partial* override of its parent's+ // style — only the fields explicitly provided should be written. Defaulting+ // the rest (as we do for standalone text below) would clobber the parent's+ // font, size, case, etc. with "Arial"/16px and break sub-range captions.+ if (hasComponent(world, eid, c.TextRange)) {+ if (params.leading !== undefined) c.TextStyle.leading[eid] = params.leading;+ if (params.fontSize !== undefined) c.TextStyle.fontSize[eid] = params.fontSize;+ if (params.fontFamily !== undefined) c.TextStyle.fontFamily[eid] = params.fontFamily;+ if (params.fontWeight !== undefined) c.TextStyle.fontWeight[eid] = params.fontWeight;+ if (params.fontStyle !== undefined) c.TextStyle.fontStyle[eid] = params.fontStyle;+ if (params.textAlign !== undefined) c.TextStyle.textAlign[eid] = params.textAlign;+ if (params.textBaseline !== undefined) c.TextStyle.textBaseline[eid] = params.textBaseline;+ if (params.textCase !== undefined) c.TextStyle.textCase[eid] = params.textCase;+ if (params.letterSpacing !== undefined) c.TextStyle.letterSpacing[eid] = params.letterSpacing;+ utils.persistEntity(world, eid);+ return;+ }++ c.TextStyle.leading[eid] = params.leading ?? c.TextStyle.leading[eid] ?? 1;+ c.TextStyle.fontSize[eid] = params.fontSize ?? c.TextStyle.fontSize[eid] ?? 16;+ c.TextStyle.fontFamily[eid] = params.fontFamily ?? c.TextStyle.fontFamily[eid] ?? "Arial";+ c.TextStyle.fontWeight[eid] = params.fontWeight ?? c.TextStyle.fontWeight[eid] ?? "400";+ c.TextStyle.fontStyle[eid] = params.fontStyle ?? c.TextStyle.fontStyle[eid] ?? FontStyle.NORMAL;+ c.TextStyle.textAlign[eid] = params.textAlign ?? c.TextStyle.textAlign[eid] ?? TextAlign.LEFT;+ c.TextStyle.textBaseline[eid] = params.textBaseline ?? c.TextStyle.textBaseline[eid] ?? TextBaseline.TOP;+ c.TextStyle.textCase[eid] = params.textCase ?? c.TextStyle.textCase[eid] ?? TextCase.ORIGINAL;+ c.TextStyle.letterSpacing[eid] = params.letterSpacing ?? c.TextStyle.letterSpacing[eid] ?? 0;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.TextRange, (eid, { start, end }) => {+ c.TextRange.start[eid] = start ?? c.TextRange.start[eid] ?? 0;+ c.TextRange.end[eid] = end ?? c.TextRange.end[eid] ?? null;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.ColorStop, (eid, { offset, color, opacity }) => {+ c.ColorStop.offset[eid] = offset ?? c.ColorStop.offset[eid] ?? 0;+ c.ColorStop.color[eid] = color ?? c.ColorStop.color[eid] ?? 0xFFFFFF;+ c.ColorStop.opacity[eid] = opacity ?? c.ColorStop.opacity[eid] ?? 1;+ c.Computed.stopOffset[eid] = c.ColorStop.offset[eid];+ c.Computed.stopColor[eid] = c.ColorStop.color[eid];+ c.Computed.stopOpacity[eid] = c.ColorStop.opacity[eid];+ utils.persistEntity(world, eid);+ if (offset !== undefined) syncKeyframeTrack(world, eid, 'stop.offset');+ if (color !== undefined) syncKeyframeTrack(world, eid, 'stop.color');+ if (opacity !== undefined) syncKeyframeTrack(world, eid, 'stop.opacity');+ });++ observe(world, "set", c.StrokeStyle, (eid, params) => {+ c.StrokeStyle.width[eid] = params.width ?? c.StrokeStyle.width[eid] ?? 1;+ c.StrokeStyle.join[eid] = params.join ?? c.StrokeStyle.join[eid] ?? StrokeJoin.MITER;+ c.StrokeStyle.cap[eid] = params.cap ?? c.StrokeStyle.cap[eid] ?? StrokeCap.BUTT;+ c.StrokeStyle.miterLimit[eid] = params.miterLimit ?? c.StrokeStyle.miterLimit[eid] ?? 3;+ c.Computed.strokeWidth[eid] = c.StrokeStyle.width[eid];+ utils.persistEntity(world, eid);+ if (params.width !== undefined) syncKeyframeTrack(world, eid, 'stroke.width');+ });++ observe(world, "set", c.Playback, (eid, { playing, loop, speed }) => {+ c.Playback.playing[eid] = playing ?? c.Playback.playing[eid] ?? 0;+ c.Playback.loop[eid] = loop ?? c.Playback.loop[eid] ?? 1;+ c.Playback.speed[eid] = speed ?? c.Playback.speed[eid] ?? 1;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.ClipHeight, (eid, height) => {+ c.ClipHeight[eid] = height ?? c.ClipHeight[eid] ?? DEFAULT_CLIP_HEIGHT;+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Expanded, (eid) => {+ utils.persistEntity(world, eid);+ world.rebuildTimelineIndex();+ });++ observe(world, "remove", c.Expanded, (eid) => {+ utils.persistEntity(world, eid);+ world.rebuildTimelineIndex();+ });++ observe(world, "set", c.Delay, (eid, delay) => {+ c.Delay[eid] = delay ?? c.Delay[eid] ?? 0;+ utils.propagateTimeRangeDown(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.PlaybackRate, (eid, playbackRate) => {+ c.PlaybackRate[eid] = playbackRate ?? c.PlaybackRate[eid] ?? 1;+ utils.propagateTimeRangeDown(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Trim, (eid, { start, end }) => {+ const fallbackDuration = c.Computed.duration[eid] ?? DEFAULT_DURATION_FRAMES;+ c.Trim.start[eid] = start ?? c.Trim.start[eid] ?? 0;+ c.Trim.end[eid] = end ?? c.Trim.end[eid] ?? fallbackDuration;+ utils.clampTrimToAssetDuration(world, eid);+ utils.recomputeEntityTimeRange(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "remove", c.Trim, (eid) => {+ utils.recomputeEntityTimeRange(world, eid);+ utils.bubbleTimeRangeUp(world, eid);+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Constraint, (eid, { horizontal, vertical }) => {+ c.Constraint.horizontal[eid] = horizontal ?? c.Constraint.horizontal[eid] ?? ConstraintType.MIN;+ c.Constraint.vertical[eid] = vertical ?? c.Constraint.vertical[eid] ?? ConstraintType.MIN;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.KeepAspectRatio, (eid, { width, height }) => {+ c.KeepAspectRatio.width[eid] = width ?? c.KeepAspectRatio.width[eid] ?? 1;+ c.KeepAspectRatio.height[eid] = height ?? c.KeepAspectRatio.height[eid] ?? 1;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.KeyframeTrack, (eid, { property }) => {+ c.KeyframeTrack.property[eid] = property ?? c.KeyframeTrack.property[eid] ?? "";+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Keyframe, (eid, { time, value, easing }) => {+ c.Keyframe.time[eid] = time ?? c.Keyframe.time[eid] ?? 0;+ c.Keyframe.value[eid] = value ?? c.Keyframe.value[eid] ?? 0;+ c.Keyframe.easing[eid] = easing ?? c.Keyframe.easing[eid] ?? "linear";+ // Ensure keyframes are sorted by frame+ utils.rebuildCaches(world, eid, getParentEntity(world, eid));+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Animation, (eid, { duration, delay, type, phase }) => {+ c.Animation.duration[eid] = duration ?? c.Animation.duration[eid] ?? 0;+ c.Animation.delay[eid] = delay ?? c.Animation.delay[eid] ?? 0;+ c.Animation.type[eid] = type ?? c.Animation.type[eid] ?? AnimationType.FADE;+ c.Animation.phase[eid] = phase ?? c.Animation.phase[eid] ?? AnimationPhase.IN;+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.ItemIndex, (eid, index) => {+ c.ItemIndex[eid] = index ?? c.ItemIndex[eid] ?? 0;+ utils.rebuildCaches(world, eid, getParentEntity(world, eid));+ world.rebuildTimelineIndex();+ utils.persistEntity(world, eid);+ });++ observe(world, "set", c.Transition, (eid, { type, duration }) => {+ c.Transition.type[eid] = type ?? c.Transition.type[eid] ?? TransitionType.DISSOLVE;+ c.Transition.duration[eid] = duration ?? c.Transition.duration[eid] ?? 0;+ utils.persistEntity(world, eid);+ });++ observe(world, "add", c.Deleted, (eid) => {+ utils.rebuildCaches(world, eid, getParentEntity(world, eid));+ utils.reactToChildDetached(world, eid);+ utils.disposeDecoders(world, eid);+ utils.disconnectAudioBus(world, eid);+ utils.unpersistEntity(world, eid);+ world.rebuildTimelineIndex();+ });++ observe(world, "remove", c.Deleted, (eid) => {+ utils.rebuildCaches(world, eid, getParentEntity(world, eid));+ utils.persistEntity(world, eid);+ world.rebuildTimelineIndex();+ });++ observe(world, "add", c.Culled, (eid) => {+ utils.disposeDecoders(world, eid);+ });++ // Non persistent components+ observe(world, "set", c.ClipDragOrigin, (eid, { delay, start, end }) => {+ c.ClipDragOrigin.delay[eid] = delay ?? c.ClipDragOrigin.delay[eid] ?? 0;+ c.ClipDragOrigin.start[eid] = start ?? c.ClipDragOrigin.start[eid] ?? 0;+ c.ClipDragOrigin.end[eid] = end ?? c.ClipDragOrigin.end[eid] ?? 0;+ });++ observe(world, "set", c.KeyframeDragOrigin, (eid, { time }) => {+ c.KeyframeDragOrigin.time[eid] = time ?? c.KeyframeDragOrigin.time[eid] ?? 0;+ });++ observe(world, "set", c.TrimDragOrigin, (eid, { start, end }) => {+ c.TrimDragOrigin.start[eid] = start ?? c.TrimDragOrigin.start[eid] ?? 0;+ c.TrimDragOrigin.end[eid] = end ?? c.TrimDragOrigin.end[eid] ?? 0;+ });+}diff --git a/apps/web/src/components/engine/api/overlap.ts b/apps/web/src/components/engine/api/overlap.tsnew file mode 100644index 00000000..322929a7--- /dev/null+++ b/apps/web/src/components/engine/api/overlap.ts@@ -0,0 +1,173 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, Or, query } from 'bitecs';+import { computeTrimStart, computeTrimEnd } from '../utils';+import { cloneSubtree } from './serialize';+import { getParentEntity } from './base';+import { getEntityTree, isGroup } from './query';+import { ChildOf } from '../components';+import { setComponent } from './events';+import { deleteEntity } from './entities';++import type { EngineWorld } from './world';++/**+ * Enforce the "no two direct children overlap in time" invariant of a+ * Sequential container after a clip has been moved (dragged + released).+ *+ * For every dragged clip whose direct parent is Sequential, each conflicting+ * sibling is resolved against the dragged clip's [start, end) span using an+ * overwrite model:+ * - fully covered → removed+ * - overlaps left edge → trimmed (out-point pulled back to the drop start)+ * - overlaps right edge→ trimmed (in-point pushed to the drop end)+ * - fully engulfs → split into two halves around the dropped clip+ *+ * Group siblings are resolved recursively at the leaf level; their bounds+ * recompute from their remaining children, and an emptied group is removed.+ *+ * Call this while the move's history transaction is still open so the whole+ * resolution lands in the same undo step as the move.+ */+export function resolveSequentialOverlaps(world: EngineWorld, draggedEids: number[]): void {+ const c = world.components;+ if (draggedEids.length === 0) return;++ // Dragged clips never trim or remove each other.+ const ignore = new Set(draggedEids);++ for (const draggedEid of draggedEids) {+ const parentEid = getParentEntity(world, draggedEid);+ if (parentEid === null || !hasComponent(world, parentEid, c.Sequential)) continue;++ const occStart = c.Computed.start[draggedEid];+ const occEnd = c.Computed.end[draggedEid];+ if (occStart === undefined || occEnd === undefined || occEnd <= occStart) continue;++ // Snapshot the sibling list before mutating — resolution deletes, trims,+ // and clones, all of which change the live query result.+ const siblings = [...query(world, [Or(c.Geometry, c.Group), ChildOf(parentEid), Not(c.Deleted)])]+ .filter(sib => !ignore.has(sib));++ for (const sib of siblings) {+ resolveEntityOverlap(world, sib, occStart, occEnd, ignore);+ }+ }+}++/**+ * Enforce the no-overlap invariant on a *freshly created* Sequential container.+ *+ * resolveSequentialOverlaps has an authoritative set — the clips the user just+ * dragged. On creation there is none: every child is a peer that merely happened+ * to overlap on the canvas. We pick a deterministic precedence instead — earlier+ * clips win and keep their full extent; later clips yield, trimmed back to start+ * after the clip preceding them (fully-covered clips are removed).+ *+ * Children are processed in start-frame order with each one authoritative over+ * all later siblings. Because every authoritative pass trims *all* later+ * siblings uniformly, each clip's start stays monotonic by rank, so the "dropped+ * clip lands inside a sibling" split case from resolveEntityOverlap cannot arise+ * here — only edge trims and removals.+ *+ * Call inside the creation transaction so the resolution shares the group's+ * undo step.+ */+export function resolveNewSequenceOverlaps(world: EngineWorld, sequenceEid: number): void {+ const c = world.components;+ if (!hasComponent(world, sequenceEid, c.Sequential)) return;++ const children = [...query(world, [Or(c.Geometry, c.Group), ChildOf(sequenceEid), Not(c.Deleted)])]+ .sort((a, b) => (c.Computed.start[a] ?? 0) - (c.Computed.start[b] ?? 0));++ // No dragged clips to protect; group recursion has no leaves to skip.+ const ignore = new Set<number>();++ for (let i = 0; i < children.length; i++) {+ const eid = children[i];+ // An earlier authoritative clip may have removed or trimmed this one.+ if (hasComponent(world, eid, c.Deleted)) continue;+ const occStart = c.Computed.start[eid];+ const occEnd = c.Computed.end[eid];+ if (occStart === undefined || occEnd === undefined || occEnd <= occStart) continue;++ for (let j = i + 1; j < children.length; j++) {+ const sib = children[j];+ if (hasComponent(world, sib, c.Deleted)) continue;+ resolveEntityOverlap(world, sib, occStart, occEnd, ignore);+ }+ }+}++/**+ * Resolve a single entity against the occupied [occStart, occEnd) span.+ * Groups recurse to their children; leaf clips are trimmed, removed, or split.+ */+function resolveEntityOverlap(+ world: EngineWorld,+ eid: number,+ occStart: number,+ occEnd: number,+ ignore: Set<number>,+): void {+ const c = world.components;++ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];+ if (start === undefined || end === undefined) return;++ // No temporal overlap — nothing to do. Touching edges (end === occStart or+ // start === occEnd) are abutting, not overlapping.+ if (end <= occStart || start >= occEnd) return;++ // Plain groups (incl. nested Sequential containers) have no intrinsic trim;+ // resolve their leaves and let the group's bounds recompute from what's left.+ if (isGroup(world, eid)) {+ if (start >= occStart && end <= occEnd) {+ // Whole group sits inside the dropped span — remove it outright.+ deleteEntity(world, eid);+ return;+ }++ const children = [...query(world, [Or(c.Geometry, c.Group), ChildOf(eid), Not(c.Deleted)])]+ .filter(child => !ignore.has(child));+ for (const child of children) {+ resolveEntityOverlap(world, child, occStart, occEnd, ignore);+ }++ // If every child was removed, the group is now empty — drop it too.+ const remaining = query(world, [Or(c.Geometry, c.Group), ChildOf(eid), Not(c.Deleted)]);+ if (remaining.length === 0) deleteEntity(world, eid);+ return;+ }++ const startCovered = start >= occStart;+ const endCovered = end <= occEnd;++ if (startCovered && endCovered) {+ // Fully covered — remove it.+ deleteEntity(world, eid);+ } else if (!startCovered && endCovered) {+ // Overlaps the dropped clip's left edge: keep the left remainder by+ // pulling the out-point back to the drop start.+ setComponent(world, eid, c.Trim, { end: computeTrimEnd(world, eid, occStart) });+ } else if (startCovered && !endCovered) {+ // Overlaps the dropped clip's right edge: keep the right remainder by+ // pushing the in-point forward to the drop end.+ setComponent(world, eid, c.Trim, { start: computeTrimStart(world, eid, occEnd) });+ } else {+ // The dropped clip lands inside this one — split it into two halves around+ // the span. Clone first so the copy inherits the original (un-shrunk) trim,+ // then shrink the original to the left half and the copy to the right half.+ const copyTrimStart = computeTrimStart(world, eid, occEnd);+ const result = cloneSubtree(world, getEntityTree(world, eid));+ const copyEid = result.get(eid);++ setComponent(world, eid, c.Trim, { end: computeTrimEnd(world, eid, occStart) });+ if (copyEid !== undefined) {+ setComponent(world, copyEid, c.Trim, { start: copyTrimStart });+ }+ }+}diff --git a/apps/web/src/components/engine/api/playback.ts b/apps/web/src/components/engine/api/playback.tsnew file mode 100644index 00000000..cdd3430d--- /dev/null+++ b/apps/web/src/components/engine/api/playback.ts@@ -0,0 +1,199 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, Or, query } from 'bitecs';+import { computeTrimStart, computeTrimEnd } from '../utils';+import { cloneAudioCacheForSplit } from '../timeline/render/audio';+import { cloneThumbnailCacheForSplit } from '../timeline/render/video';+import { cloneSubtree } from './serialize';+import { getParentEntity } from './base';+import { getEntityTree, getNextName, isGroup, isSequence } from './query';+import { ChildOf, PaintType } from '../components';+import { addComponent, clearComponent, removeComponent, setComponent } from './events';+import { createEntity } from './entities';+import { appendChild, removeChild } from './hierarchy';++import type { EngineWorld } from './world';++export function togglePlayback(world: EngineWorld, eid: number | null = world.selection.scene) {+ const c = world.components;++ if (eid === null) return;+ // Playback is an ephemeral component — never recorded in history.+ setComponent(world, eid, c.Playback, {+ playing: Number(!c.Playback.playing[eid]),+ speed: 1,+ }, false);+ world.audio.resume();+}++const MAX_SHUTTLE_SPEED = 3;++export function shuttleForward(world: EngineWorld) {+ const c = world.components;+ const sid = world.selection.scene;+ if (sid === null) return;++ const speed = c.Playback.speed[sid] || 1;++ if (c.Playback.playing[sid] !== 1 || speed < 0) {+ // Start forward playback at 1x+ setComponent(world, sid, c.Playback, { playing: 1, speed: 1 }, false);+ } else {+ // Double the forward speed, capped at max+ setComponent(world, sid, c.Playback, { speed: Math.min(speed * 2, MAX_SHUTTLE_SPEED) }, false);+ }++ world.audio.resume();+}++export function shuttleReverse(world: EngineWorld) {+ const c = world.components;+ const sid = world.selection.scene;+ if (sid === null) return;++ const speed = c.Playback.speed[sid] || 1;++ if (c.Playback.playing[sid] !== 1 || speed > 0) {+ // Start reverse playback at 1x+ setComponent(world, sid, c.Playback, { playing: 1, speed: -1 }, false);+ } else {+ // Double the reverse speed, capped at max+ setComponent(world, sid, c.Playback, { speed: Math.max(speed * 2, -MAX_SHUTTLE_SPEED) }, false);+ }++ world.audio.resume();+}++export function stopPlayback(world: EngineWorld) {+ const c = world.components;+ const sid = world.selection.scene;+ if (sid === null) return;+ setComponent(world, sid, c.Playback, { playing: 0, speed: 1 }, false);+}++export function splitAtPlayhead(world: EngineWorld) {+ const c = world.components;+ const sceneEid = world.selection.scene;+ if (sceneEid === null) return;++ world.history.transaction('Split', () => {+ const splitFrame = c.Computed.localTime[sceneEid];++ // (original, copy) root pairs produced by splitting clips as a unit.+ const pairs: { original: number; copy: number }[] = [];++ // Split a non-sequence clip (a leaf clip or a plain group) as a unit:+ // clone its whole subtree — including all children — then shrink the+ // original to end at the playhead and the copy to start there.+ const splitUnit = (eid: number) => {+ const tree = getEntityTree(world, eid);+ const nextTrimEnd = computeTrimEnd(world, eid, splitFrame);+ const copyTrimStart = computeTrimStart(world, eid, splitFrame);++ // Clone first so the copy inherits the original (un-shrunk) trimEnd.+ const result = cloneSubtree(world, tree);+ const copyEid = result.get(eid);+ if (!copyEid) return;++ // Apply trim to both split roots.+ setComponent(world, eid, c.Trim, { end: nextTrimEnd });+ setComponent(world, copyEid, c.Trim, { start: copyTrimStart });++ cloneAudioCacheForSplit(eid, copyEid);+ cloneThumbnailCacheForSplit(eid, copyEid);++ // Hand the primed video decoder to the copy. The original clip's range+ // now ends at the playhead (no longer in range), while the copy starts+ // there — so the copy is what's about to render. Both share delay and+ // playbackRate, so the decoder's relativeTime is already correct and+ // the copy renders its first frame without a blank/seek flash.+ const fills = query(world, [c.Paint, ChildOf(eid), Not(c.Deleted), Not(c.Hidden)]);+ const origVideoFill = fills.find(fid => c.Paint[fid] === PaintType.VIDEO);+ if (origVideoFill) {+ const decoder = c.VideoDecoder[origVideoFill];+ const copyVideoFill = result.get(origVideoFill);+ if (decoder && copyVideoFill) {+ // Decoder components are flat arrays with no `set` observer, so+ // setComponent would drop the value. Move it by direct assignment.+ addComponent(world, copyVideoFill, c.VideoDecoder, false);+ c.VideoDecoder[copyVideoFill] = decoder;+ removeComponent(world, origVideoFill, c.VideoDecoder, false);+ c.VideoDecoder[origVideoFill] = null;+ }+ }++ const origSequenceFill = fills.find(fid => c.Paint[fid] === PaintType.SEQUENCE);+ if (origSequenceFill) {+ const decoder = c.SequenceDecoder[origSequenceFill];+ const copySequenceFill = result.get(origSequenceFill);+ if (decoder && copySequenceFill) {+ addComponent(world, copySequenceFill, c.SequenceDecoder, false);+ c.SequenceDecoder[copySequenceFill] = decoder;+ removeComponent(world, origSequenceFill, c.SequenceDecoder, false);+ c.SequenceDecoder[origSequenceFill] = null;+ }+ }++ pairs.push({ original: eid, copy: copyEid });+ };++ // Split an entity at the playhead. A sequence can't be trimmed as a unit —+ // its time range is derived from its children — so we descend and split+ // each child the playhead intersects. Everything else (leaf clips, plain+ // groups, scenes) is split as a unit.+ const splitEntity = (eid: number) => {+ if (isSequence(world, eid)) {+ const children = [...query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(eid), Not(c.Deleted)])]+ .filter(child => c.Computed.visibility[child] === 1);+ for (const child of children) splitEntity(child);+ return;+ }++ splitUnit(eid);+ };++ // Split the current selection, or — when nothing is selected — every+ // visible clip directly under the active scene. The active scene itself is+ // the editing context, never a split target.+ const selection = [...query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), c.Selected])]+ .filter(eid => eid !== sceneEid)+ .filter(eid => c.Computed.visibility[eid] === 1);++ const roots = selection.length > 0+ ? selection+ : [...query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(sceneEid), Not(c.Deleted)])]+ .filter(eid => c.Computed.visibility[eid] === 1);++ for (const eid of roots) splitEntity(eid);++ // When the split happens outside a group/sequence (e.g. directly on the+ // scene), wrap each (original, copy) pair in a fresh Sequential group so+ // the two halves stay tied together in time.+ for (const { original, copy } of pairs) {+ const parentEid = getParentEntity(world, original);+ // If the parent already wraps children (a group or sequence) the+ // pair is implicitly tied together; only naked clips under a scene+ // need a fresh Sequential wrapper.+ if (parentEid === null || isGroup(world, parentEid) || hasComponent(world, parentEid, c.Sequential)) continue;++ const groupEid = createEntity(world);+ addComponent(world, groupEid, c.Group);+ addComponent(world, groupEid, c.Sequential);+ setComponent(world, groupEid, c.Name, getNextName(world, 'Sequence'));+ if (hasComponent(world, original, c.ClipHeight)) {+ setComponent(world, groupEid, c.ClipHeight, c.ClipHeight[original]);+ }+ appendChild(world, groupEid, parentEid);++ removeChild(world, original, parentEid);+ appendChild(world, original, groupEid);+ removeChild(world, copy, parentEid);+ appendChild(world, copy, groupEid);+ }++ clearComponent(world, c.Selected, false);+ pairs.forEach(({ copy }) => addComponent(world, copy, c.Selected, false));+ });+}diff --git a/apps/web/src/components/engine/api/query.ts b/apps/web/src/components/engine/api/query.tsnew file mode 100644index 00000000..aa208e97--- /dev/null+++ b/apps/web/src/components/engine/api/query.ts@@ -0,0 +1,140 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query, hasComponent, Not } from 'bitecs';+import { ChildOf, GeometryType } from '../components';+import { getParentEntity } from './base';++import type { EngineWorld } from './world';++export function isScene(world: EngineWorld, eid: number): boolean {+ return hasComponent(world, eid, world.components.Scene);+}++/**+ * Nearest ancestor of `eid` (excluding `eid` itself) that is a scene, or null.+ */+export function getSceneAncestor(world: EngineWorld, eid: number): number | null {+ let current = getParentEntity(world, eid);+ while (current !== null) {+ if (isScene(world, current)) return current;+ current = getParentEntity(world, current);+ }+ return null;+}++export function isGroup(world: EngineWorld, eid: number): boolean {+ return hasComponent(world, eid, world.components.Group);+}++export function isGroupLike(world: EngineWorld, eid: number): boolean {+ const c = world.components;+ return hasComponent(world, eid, c.Group) || hasComponent(world, eid, c.Scene);+}++export function isSequence(world: EngineWorld, eid: number): boolean {+ return hasComponent(world, eid, world.components.Sequential);+}++export function isAudio(world: EngineWorld, eid: number): boolean {+ return hasComponent(world, eid, world.components.Audio);+}++export function isAdjustmentLayer(world: EngineWorld, eid: number): boolean {+ return hasComponent(world, eid, world.components.AdjustmentLayer);+}++export function isCaption(world: EngineWorld, eid: number): boolean {+ return hasComponent(world, eid, world.components.Caption);+}++export function isText(world: EngineWorld, eid: number): boolean {+ const c = world.components;+ return hasComponent(world, eid, c.Geometry) && c.Geometry[eid] === GeometryType.TEXT;+}++export function isRect(world: EngineWorld, eid: number): boolean {+ const c = world.components;+ return hasComponent(world, eid, c.Geometry) && c.Geometry[eid] === GeometryType.RECT;+}++/** A vanilla rect — not a container (group/scene/sequence) or audio clip.+ * (Captions live on TEXT geometry, so they're naturally excluded.) */+export function isShape(world: EngineWorld, eid: number): boolean {+ const c = world.components;+ return hasComponent(world, eid, c.Geometry)+ && c.Geometry[eid] === GeometryType.RECT+ && !hasComponent(world, eid, c.Group)+ && !hasComponent(world, eid, c.Scene)+ && !hasComponent(world, eid, c.Audio);+}++export function isMask(world: EngineWorld, eid: number): boolean {+ return hasComponent(world, eid, world.components.IsMask);+}++/**+ * Returns the local frame for a node in its own source/content time — the+ * timeline frame relative to the node's delay, scaled by its playback rate.+ * This matches `Computed.localTime` (the space keyframes are sampled+ * in), so keyframes authored at any playback rate land on the right content+ * frame.+ */+export function getNodeLocalFrame(world: EngineWorld, nodeEid: number): number {+ const c = world.components;++ const delay = c.Computed.delay[nodeEid];+ const playbackRate = c.PlaybackRate[nodeEid] ?? 1;++ let current: number | null = nodeEid;+ while (current) {+ const parent = getParentEntity(world, current);++ // must be a root playback entity+ if (hasComponent(world, current, c.Playback) && parent === null) {+ const currentTime = c.Computed.localTime[current];+ return Math.round((currentTime - delay) * playbackRate);+ }++ current = parent;+ }++ return 0;+}++export function getNextName(world: EngineWorld, prefix: string): string {+ const c = world.components;++ let max = 0;+ const pattern = new RegExp(`^${prefix} (\\d+)$`);++ for (let i = 0; i < c.Name.length; i++) {+ if (c.Name[i] === undefined) continue;+ const match = c.Name[i]?.match(pattern);+ if (match) {+ const n = parseInt(match[1] ?? '0');+ if (n > max) max = n;+ }+ }++ return `${prefix} ${max + 1}`;+}++export function getEntityTree(world: EngineWorld, rootEid: number): number[] {+ const c = world.components;++ const tree: number[] = [];++ const walk = (eid: number): number[] => {+ tree.push(eid);++ for (const cid of query(world, [ChildOf(eid), Not(c.Deleted)])) {+ walk(cid);+ }++ return tree;+ }++ return walk(rootEid);+}diff --git a/apps/web/src/components/engine/api/resize.ts b/apps/web/src/components/engine/api/resize.tsnew file mode 100644index 00000000..6c22bec9--- /dev/null+++ b/apps/web/src/components/engine/api/resize.ts@@ -0,0 +1,188 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, query } from "bitecs";+import { syncKeyframeTrack } from "./keyframe";+import { removeComponent, setComponent } from "./events";+import { ChildOf, ConstraintType } from "../components";++import type { EngineWorld } from "./world";++type ResizeParams = { width?: number; height?: number };++/**+ * Resize an entity. Enforces aspect ratio, writes the final Size, propagates+ * Computed size down the subtree, reapplies sibling constraints, and syncs+ * the width/height keyframe tracks. Group/Sequential entities don't own a Size+ * — calling this on one strips the component instead.+ */+export function resizeEntity(world: EngineWorld, eid: number, params: ResizeParams): void {+ const c = world.components;++ if (hasComponent(world, eid, c.Group)) {+ removeComponent(world, eid, c.Size);+ return;+ }++ world.history.transaction('Resize', () => {+ // Enforce aspect ratio+ const arWidth = c.KeepAspectRatio.width[eid] ?? 0;+ const arHeight = c.KeepAspectRatio.height[eid] ?? 0;++ if (hasComponent(world, eid, c.KeepAspectRatio) && arWidth > 0 && arHeight > 0) {+ const ratio = arWidth / arHeight;++ if (params.width !== undefined && params.height === undefined) {+ params.height = Math.round(params.width / ratio);+ } else if (params.height !== undefined && params.width === undefined) {+ params.width = Math.round(params.height * ratio);+ } else if (params.width !== undefined && params.height !== undefined) {+ params.height = Math.round(params.width / ratio);+ }+ }++ if (typeof params.width === 'number') {+ params.width = Math.round(params.width);+ }+ if (typeof params.height === 'number') {+ params.height = Math.round(params.height);+ }++ setComponent(world, eid, c.Size, params);+ propagateSize(world, eid);+ resolveConstraintOffsets(world, eid);++ if (params.width !== undefined) {+ syncKeyframeTrack(world, eid, "width");+ }+ if (params.height !== undefined) {+ syncKeyframeTrack(world, eid, "height");+ }+ });+}++export function propagateSize(world: EngineWorld, eid: number) {+ const c = world.components;+ if (!hasComponent(world, eid, c.Size)) return;++ c.Computed.width[eid] = Math.round(c.Size.width[eid]);+ c.Computed.height[eid] = Math.round(c.Size.height[eid]);++ for (const child of query(world, [ChildOf(eid), c.Size])) {+ propagateSize(world, child);+ }+}++export function resolveConstraintOffsets(world: EngineWorld, eid: number): void {+ const c = world.components;++ for (const childEid of query(world, [ChildOf(eid), c.Constraint])) {+ const curParentW = c.Computed.width[eid];+ const curParentH = c.Computed.height[eid];++ const prevParentW = c.ConstraintCache.parentWidth[childEid];+ const prevParentH = c.ConstraintCache.parentHeight[childEid];++ const horizontalConstraint = c.Constraint.horizontal[childEid] ?? 0;+ const verticalConstraint = c.Constraint.vertical[childEid] ?? 0;++ const curChildW = c.Computed.width[childEid];+ const curChildH = c.Computed.height[childEid];++ const prevChildW = c.ConstraintCache.childWidth[childEid];+ const prevChildH = c.ConstraintCache.childHeight[childEid];++ // Update caches+ c.ConstraintCache.parentWidth[childEid] = curParentW;+ c.ConstraintCache.parentHeight[childEid] = curParentH;+ c.ConstraintCache.childWidth[childEid] = curChildW;+ c.ConstraintCache.childHeight[childEid] = curChildH;++ // First time seeing this child (e.g. constraint just assigned): seed the cache+ // without adjusting position — diffing against `undefined` would yield NaN.+ if (prevParentW === undefined || prevParentH === undefined) {+ resolveConstraintOffsets(world, childEid);+ continue;+ }++ // No change+ if (prevParentW === curParentW && prevParentH === curParentH) continue;++ const dpW = curParentW - prevParentW;+ const dpH = curParentH - prevParentH;+ const dcW = curChildW - (prevChildW ?? curChildW);+ const dcH = curChildH - (prevChildH ?? curChildH);+ const positionX = c.Computed.positionX[childEid];+ const positionY = c.Computed.positionY[childEid];++ // Resizing constraints (STRETCH/SCALE) record their new dimension here+ // rather than writing it straight away, so a locked aspect ratio can couple+ // the two axes before the Size is committed.+ let newChildW: number | undefined;+ let newChildH: number | undefined;++ if (horizontalConstraint === ConstraintType.MAX) {+ setComponent(world, childEid, c.Position, { x: positionX + dpW - dcW });+ } else if (horizontalConstraint === ConstraintType.CENTER) {+ setComponent(world, childEid, c.Position, { x: positionX + dpW / 2 - dcW / 2 });+ } else if (horizontalConstraint === ConstraintType.STRETCH) {+ // Pin both left and right edges: hold the left edge in place and grow the+ // child by the parent's width delta so the right margin stays constant.+ newChildW = curChildW + dpW;+ } else if (horizontalConstraint === ConstraintType.SCALE && prevParentW !== 0) {+ // Scale offset and width by the parent's horizontal ratio so the child+ // keeps its relative position and proportion.+ const scale = curParentW / prevParentW;+ newChildW = Math.round(curChildW * scale);+ setComponent(world, childEid, c.Position, { x: positionX * scale });+ }++ if (verticalConstraint === ConstraintType.MAX) {+ setComponent(world, childEid, c.Position, { y: positionY + dpH - dcH });+ } else if (verticalConstraint === ConstraintType.CENTER) {+ setComponent(world, childEid, c.Position, { y: positionY + dpH / 2 - dcH / 2 });+ } else if (verticalConstraint === ConstraintType.STRETCH) {+ // Pin both top and bottom edges: hold the top edge in place and grow the+ // child by the parent's height delta so the bottom margin stays constant.+ newChildH = curChildH + dpH;+ } else if (verticalConstraint === ConstraintType.SCALE && prevParentH !== 0) {+ // Scale offset and height by the parent's vertical ratio so the child+ // keeps its relative position and proportion.+ const scale = curParentH / prevParentH;+ newChildH = Math.round(curChildH * scale);+ setComponent(world, childEid, c.Position, { y: positionY * scale });+ }++ // When the child's aspect ratio is locked, drive the other dimension from+ // whichever axis resized so the proportion is preserved. Width wins when+ // both axes resize, mirroring resizeEntity's precedence.+ const arWidth = c.KeepAspectRatio.width[childEid] ?? 0;+ const arHeight = c.KeepAspectRatio.height[childEid] ?? 0;+ if (+ hasComponent(world, childEid, c.KeepAspectRatio) &&+ arWidth > 0 && arHeight > 0 &&+ (newChildW !== undefined || newChildH !== undefined)+ ) {+ const ratio = arWidth / arHeight;+ if (newChildW !== undefined) {+ newChildH = Math.round(newChildW / ratio);+ } else if (newChildH !== undefined) {+ newChildW = Math.round(newChildH * ratio);+ }+ }++ if (newChildW !== undefined) {+ setComponent(world, childEid, c.Size, { width: newChildW });+ c.Computed.width[childEid] = newChildW;+ c.ConstraintCache.childWidth[childEid] = newChildW;+ }+ if (newChildH !== undefined) {+ setComponent(world, childEid, c.Size, { height: newChildH });+ c.Computed.height[childEid] = newChildH;+ c.ConstraintCache.childHeight[childEid] = newChildH;+ }++ resolveConstraintOffsets(world, childEid);+ }+}diff --git a/apps/web/src/components/engine/api/serialize.ts b/apps/web/src/components/engine/api/serialize.tsnew file mode 100644index 00000000..9e3577b1--- /dev/null+++ b/apps/web/src/components/engine/api/serialize.ts@@ -0,0 +1,430 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, getRelationTargets } from "bitecs";+import { ChildOf } from "../components/relations";+import { assert } from "@/utils";+import { createEntity, deleteEntity } from "./entities";+import { appendChild } from "./hierarchy";+import { addComponent, setComponent } from "./events";+import { resizeEntity } from "./resize";++import type { DBEntity } from "../types";+import type { EngineWorld } from "./world";++export function serializeEntity(world: EngineWorld, eid: number): DBEntity {+ const record: DBEntity = { id: String(eid), eid };+ const c = world.components;++ if (hasComponent(world, eid, c.Geometry)) {+ record.Geometry = c.Geometry[eid];+ }+ if (hasComponent(world, eid, c.Paint)) {+ record.Paint = c.Paint[eid];+ }+ if (hasComponent(world, eid, c.Group)) {+ record.Group = {};+ }+ if (hasComponent(world, eid, c.Scene)) {+ record.Scene = {};+ }+ if (hasComponent(world, eid, c.Audio)) {+ record.Audio = {};+ }+ if (hasComponent(world, eid, c.AdjustmentLayer)) {+ record.AdjustmentLayer = {};+ }+ if (hasComponent(world, eid, c.Effect)) {+ record.Effect = { type: c.Effect.type[eid], value: c.Effect.value[eid] };+ }+ if (hasComponent(world, eid, c.Shadow)) {+ record.Shadow = {};+ }+ if (hasComponent(world, eid, c.Stroke)) {+ record.Stroke = {};+ }+ if (hasComponent(world, eid, c.Name)) {+ record.Name = c.Name[eid];+ }+ if (hasComponent(world, eid, c.Key)) {+ record.Key = c.Key[eid];+ }+ if (hasComponent(world, eid, c.ItemIndex)) {+ record.ItemIndex = c.ItemIndex[eid] ?? 0;+ }+ if (hasComponent(world, eid, c.ClipHeight)) {+ record.ClipHeight = c.ClipHeight[eid];+ }+ if (hasComponent(world, eid, c.Expanded)) {+ record.Expanded = {};+ }+ if (hasComponent(world, eid, ChildOf('*'))) {+ record.ChildOf = getRelationTargets(world, eid, ChildOf)[0] ?? 0;+ }+ if (hasComponent(world, eid, c.IsMask)) {+ record.IsMask = {};+ }+ if (hasComponent(world, eid, c.Position)) {+ record.Position = { x: c.Position.x[eid], y: c.Position.y[eid] };+ }+ if (hasComponent(world, eid, c.Offset)) {+ record.Offset = { x: c.Offset.x[eid], y: c.Offset.y[eid] };+ }+ if (hasComponent(world, eid, c.Rotation)) {+ record.Rotation = c.Rotation[eid];+ }+ if (hasComponent(world, eid, c.Scale)) {+ record.Scale = { x: c.Scale.x[eid], y: c.Scale.y[eid] };+ }+ if (hasComponent(world, eid, c.UniformScale)) {+ record.UniformScale = c.UniformScale[eid];+ }+ if (hasComponent(world, eid, c.Anchor)) {+ record.Anchor = { x: c.Anchor.x[eid], y: c.Anchor.y[eid] };+ }+ if (hasComponent(world, eid, c.Skew)) {+ record.Skew = { x: c.Skew.x[eid], y: c.Skew.y[eid] };+ }+ if (hasComponent(world, eid, c.Size)) {+ record.Size = { width: c.Size.width[eid], height: c.Size.height[eid] };+ }+ if (hasComponent(world, eid, c.Flip)) {+ record.Flip = { x: c.Flip.x[eid], y: c.Flip.y[eid] };+ }+ if (hasComponent(world, eid, c.Appearance)) {+ record.Appearance = {+ opacity: c.Appearance.opacity[eid],+ blendMode: c.Appearance.blendMode[eid],+ };+ }+ if (hasComponent(world, eid, c.CornerRadius)) {+ record.CornerRadius = c.CornerRadius[eid];+ }+ if (hasComponent(world, eid, c.MixedCornerRadius)) {+ record.MixedCornerRadius = {+ topLeft: c.MixedCornerRadius.topLeft[eid],+ topRight: c.MixedCornerRadius.topRight[eid],+ bottomRight: c.MixedCornerRadius.bottomRight[eid],+ bottomLeft: c.MixedCornerRadius.bottomLeft[eid],+ };+ }+ if (hasComponent(world, eid, c.Color)) {+ record.Color = c.Color[eid];+ }+ if (hasComponent(world, eid, c.Blur)) {+ record.Blur = c.Blur[eid];+ }+ if (hasComponent(world, eid, c.AssetId)) {+ record.AssetId = c.AssetId[eid];+ }+ if (hasComponent(world, eid, c.ScaleMode)) {+ record.ScaleMode = c.ScaleMode[eid];+ }+ if (hasComponent(world, eid, c.Volume)) {+ record.Volume = c.Volume[eid];+ }+ if (hasComponent(world, eid, c.Muted)) {+ record.Muted = {};+ }+ if (hasComponent(world, eid, c.ColorStop)) {+ record.ColorStop = {+ offset: c.ColorStop.offset[eid],+ color: c.ColorStop.color[eid],+ opacity: c.ColorStop.opacity[eid],+ };+ }+ if (hasComponent(world, eid, c.StrokeStyle)) {+ record.StrokeStyle = {+ width: c.StrokeStyle.width[eid],+ join: c.StrokeStyle.join[eid],+ cap: c.StrokeStyle.cap[eid],+ miterLimit: c.StrokeStyle.miterLimit[eid],+ };+ }+ if (hasComponent(world, eid, c.Hidden)) {+ record.Hidden = true;+ }+ if (hasComponent(world, eid, c.ClipsContent)) {+ record.ClipsContent = true;+ }+ if (hasComponent(world, eid, c.Sequential)) {+ record.Sequential = {};+ }+ if (hasComponent(world, eid, c.Playback)) {+ record.Playback = {+ loop: c.Playback.loop[eid],+ };+ }+ if (hasComponent(world, eid, c.Delay)) {+ record.Delay = c.Delay[eid];+ }+ if (hasComponent(world, eid, c.PlaybackRate)) {+ record.PlaybackRate = c.PlaybackRate[eid];+ }+ if (hasComponent(world, eid, c.Trim)) {+ record.Trim = {+ start: c.Trim.start[eid],+ end: c.Trim.end[eid],+ };+ }+ if (hasComponent(world, eid, c.Transition)) {+ record.Transition = {+ type: c.Transition.type[eid],+ duration: c.Transition.duration[eid],+ };+ }+ if (hasComponent(world, eid, c.Constraint)) {+ record.Constraint = {+ horizontal: c.Constraint.horizontal[eid],+ vertical: c.Constraint.vertical[eid],+ };+ }+ if (hasComponent(world, eid, c.KeepAspectRatio)) {+ record.KeepAspectRatio = {+ width: c.KeepAspectRatio.width[eid],+ height: c.KeepAspectRatio.height[eid],+ };+ }+ if (hasComponent(world, eid, c.KeyframeTrack)) {+ record.KeyframeTrack = {+ property: c.KeyframeTrack.property[eid],+ };+ }+ if (hasComponent(world, eid, c.Keyframe)) {+ record.Keyframe = {+ time: c.Keyframe.time[eid],+ value: c.Keyframe.value[eid],+ easing: c.Keyframe.easing[eid],+ };+ }+ if (hasComponent(world, eid, c.Animation)) {+ record.Animation = {+ duration: c.Animation.duration[eid],+ delay: c.Animation.delay[eid],+ type: c.Animation.type[eid],+ phase: c.Animation.phase[eid],+ };+ }+ if (hasComponent(world, eid, c.Caption)) {+ record.Caption = {+ type: c.Caption.type[eid],+ colors: c.Caption.colors[eid]?.map(v => v),+ };+ }+ if (hasComponent(world, eid, c.Chars)) {+ record.Chars = c.Chars[eid];+ }+ if (hasComponent(world, eid, c.TextStyle)) {+ record.TextStyle = {+ leading: c.TextStyle.leading[eid],+ fontSize: c.TextStyle.fontSize[eid],+ fontFamily: c.TextStyle.fontFamily[eid],+ fontWeight: c.TextStyle.fontWeight[eid],+ fontStyle: c.TextStyle.fontStyle[eid],+ textAlign: c.TextStyle.textAlign[eid],+ textBaseline: c.TextStyle.textBaseline[eid],+ textCase: c.TextStyle.textCase[eid],+ letterSpacing: c.TextStyle.letterSpacing[eid],+ };+ }++ return record;+}++export function deserializeEntity(world: EngineWorld, eid: number, e: Partial<DBEntity>): void {+ const c = world.components;++ if (e.Geometry !== undefined) {+ setComponent(world, eid, c.Geometry, e.Geometry);+ }+ if (e.Paint !== undefined) {+ setComponent(world, eid, c.Paint, e.Paint);+ }+ if (e.Group !== undefined) {+ addComponent(world, eid, c.Group);+ }+ if (e.Scene !== undefined) {+ addComponent(world, eid, c.Scene);+ }+ if (e.Audio !== undefined) {+ addComponent(world, eid, c.Audio);+ }+ if (e.AdjustmentLayer !== undefined) {+ addComponent(world, eid, c.AdjustmentLayer);+ }+ if (e.Effect !== undefined) {+ setComponent(world, eid, c.Effect, e.Effect);+ }+ if (e.Shadow !== undefined) {+ addComponent(world, eid, c.Shadow);+ }+ if (e.Stroke !== undefined) {+ addComponent(world, eid, c.Stroke);+ }+ if (e.Name !== undefined) {+ setComponent(world, eid, c.Name, e.Name);+ }+ if (e.Key !== undefined) {+ setComponent(world, eid, c.Key, e.Key);+ }+ if (e.ItemIndex !== undefined) {+ setComponent(world, eid, c.ItemIndex, e.ItemIndex);+ }+ if (e.ClipHeight !== undefined) {+ setComponent(world, eid, c.ClipHeight, e.ClipHeight);+ }+ if (e.Expanded !== undefined) {+ addComponent(world, eid, c.Expanded);+ }+ if (e.IsMask !== undefined) {+ addComponent(world, eid, c.IsMask);+ }+ if (e.Position !== undefined) {+ setComponent(world, eid, c.Position, e.Position);+ }+ if (e.Offset !== undefined) {+ setComponent(world, eid, c.Offset, e.Offset);+ }+ if (e.Rotation !== undefined) {+ setComponent(world, eid, c.Rotation, e.Rotation);+ }+ if (e.Scale !== undefined) {+ setComponent(world, eid, c.Scale, e.Scale);+ }+ if (e.UniformScale !== undefined) {+ setComponent(world, eid, c.UniformScale, e.UniformScale);+ }+ if (e.Anchor !== undefined) {+ setComponent(world, eid, c.Anchor, e.Anchor);+ }+ if (e.Skew !== undefined) {+ setComponent(world, eid, c.Skew, e.Skew);+ }+ if (e.Size !== undefined) {+ resizeEntity(world, eid, e.Size);+ }+ if (e.Flip !== undefined) {+ setComponent(world, eid, c.Flip, e.Flip);+ }+ if (e.Appearance !== undefined) {+ setComponent(world, eid, c.Appearance, e.Appearance);+ }+ if (e.CornerRadius !== undefined) {+ setComponent(world, eid, c.CornerRadius, e.CornerRadius);+ }+ if (e.MixedCornerRadius !== undefined) {+ setComponent(world, eid, c.MixedCornerRadius, e.MixedCornerRadius);+ }+ if (e.Color !== undefined) {+ setComponent(world, eid, c.Color, e.Color);+ }+ if (e.Blur !== undefined) {+ setComponent(world, eid, c.Blur, e.Blur);+ }+ if (e.AssetId !== undefined) {+ setComponent(world, eid, c.AssetId, e.AssetId);+ }+ if (e.ScaleMode !== undefined) {+ setComponent(world, eid, c.ScaleMode, e.ScaleMode);+ }+ if (e.Volume !== undefined) {+ setComponent(world, eid, c.Volume, e.Volume);+ }+ if (e.Muted !== undefined) {+ addComponent(world, eid, c.Muted);+ }+ if (e.ColorStop !== undefined) {+ setComponent(world, eid, c.ColorStop, e.ColorStop);+ }+ if (e.StrokeStyle !== undefined) {+ setComponent(world, eid, c.StrokeStyle, e.StrokeStyle);+ }+ if (e.Hidden !== undefined) {+ addComponent(world, eid, c.Hidden);+ }+ if (e.ClipsContent !== undefined) {+ addComponent(world, eid, c.ClipsContent);+ }+ if (e.Sequential !== undefined) {+ addComponent(world, eid, c.Sequential);+ }+ if (e.Playback !== undefined) {+ setComponent(world, eid, c.Playback, e.Playback);+ }+ if (e.Delay !== undefined) {+ setComponent(world, eid, c.Delay, e.Delay);+ }+ if (e.PlaybackRate !== undefined) {+ setComponent(world, eid, c.PlaybackRate, e.PlaybackRate);+ }+ if (e.Trim !== undefined) {+ setComponent(world, eid, c.Trim, e.Trim);+ }+ if (e.Transition !== undefined) {+ setComponent(world, eid, c.Transition, e.Transition);+ }+ if (e.Constraint !== undefined) {+ setComponent(world, eid, c.Constraint, e.Constraint);+ }+ if (e.KeepAspectRatio !== undefined) {+ setComponent(world, eid, c.KeepAspectRatio, e.KeepAspectRatio);+ }+ if (e.KeyframeTrack !== undefined) {+ setComponent(world, eid, c.KeyframeTrack, e.KeyframeTrack);+ }+ if (e.Keyframe !== undefined) {+ setComponent(world, eid, c.Keyframe, e.Keyframe);+ }+ if (e.Animation !== undefined) {+ setComponent(world, eid, c.Animation, e.Animation);+ }+ if (e.Caption !== undefined) {+ setComponent(world, eid, c.Caption, e.Caption);+ }+ if (e.Chars !== undefined) {+ setComponent(world, eid, c.Chars, e.Chars);+ }+ if (e.TextStyle !== undefined) {+ setComponent(world, eid, c.TextStyle, e.TextStyle);+ }+ // Attach to parent last so rebuildCaches sees every component this entity+ // has (KeyframeTrack, Keyframe, Animation, IsMask, …). Otherwise their+ // caches stay empty and the UI/motion system can't find them after reload.+ if (e.ChildOf !== undefined) {+ appendChild(world, eid, e.ChildOf);+ }+}++export function cloneFromRecords(world: EngineWorld, records: DBEntity[]) {+ const eidMap = new Map<number, number>();++ for (const record of records) {+ eidMap.set(record.eid, createEntity(world));+ }++ for (const record of records) {+ const eid = eidMap.get(record.eid);+ const copy = { ...record };++ try {+ assert(eid, `Entity ${copy.eid} not found`);++ if (copy.ChildOf !== undefined) {+ copy.ChildOf = eidMap.get(copy.ChildOf) ?? copy.ChildOf;+ }++ deserializeEntity(world, eid, copy);+ } catch (error) {+ if (eid) deleteEntity(world, eid);+ console.error(error);+ }+ }++ return eidMap;+}++export function cloneSubtree(world: EngineWorld, tree: number[]) {+ const records = tree.map(e => serializeEntity(world, e));+ return cloneFromRecords(world, records);+}diff --git a/apps/web/src/components/engine/api/timeline-index.ts b/apps/web/src/components/engine/api/timeline-index.tsnew file mode 100644index 00000000..c95d9012--- /dev/null+++ b/apps/web/src/components/engine/api/timeline-index.ts@@ -0,0 +1,152 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, query } from "bitecs";+import { ChildOf } from "../components/relations";+import { sortByItemIndex } from "../utils/sort";+import { isSequence } from "./query";++import type { EngineWorld } from "./world";++export type TimelineNodeKind = 'geometry' | 'sub-item' | 'keyframe-track';++export type TimelineNode = {+ eid: number;+ kind: TimelineNodeKind;+ expanded: boolean;+ expandable: boolean;+ children: TimelineNode[];+};++export type TimelineIndexValue = {+ root: number | null;+ layers: TimelineNode[];+};++export function buildTimelineLayers(world: EngineWorld, parent: number): TimelineNode[] {+ const c = world.components;+ const sequence = isSequence(world, parent);++ const tracks: number[] = [];+ const geoms: number[] = [];+ const masks: number[] = [];+ const subitems: number[] = [];++ for (const cid of query(world, [ChildOf(parent), Not(c.Deleted)])) {+ if (hasComponent(world, cid, c.Keyframe)) continue;+ if (sequence && !hasKeyframes(world, cid)) continue;++ if (hasComponent(world, cid, c.KeyframeTrack)) {+ tracks.push(cid);+ } else if (hasComponent(world, cid, c.IsMask)) {+ masks.push(cid);+ } else if (hasComponent(world, cid, c.Geometry) || hasComponent(world, cid, c.Group) || hasComponent(world, cid, c.AdjustmentLayer)) {+ geoms.push(cid);+ } else {+ subitems.push(cid);+ }+ }++ const sort = sortByItemIndex(world);+ tracks.sort(sort).reverse();+ geoms.sort(sort).reverse();+ masks.sort(sort).reverse();+ subitems.sort(sort).reverse();++ const nodes: TimelineNode[] = [];++ for (const cid of tracks) {+ nodes.push({+ eid: cid,+ kind: 'keyframe-track',+ expanded: false,+ expandable: false,+ children: [],+ });+ }++ for (const cid of subitems) {+ const node = buildNode(world, cid, 'sub-item');+ if (node.expandable) {+ nodes.push(node);+ }+ }++ for (const cid of geoms) {+ nodes.push(buildNode(world, cid, 'geometry'));+ }++ for (const cid of masks) {+ nodes.push(buildNode(world, cid, 'geometry'));+ }++ return nodes;+}++/**+ * Build one row node. Expanded nodes get their subtree; collapsed ones stay+ * empty and only probe whether a subtree exists.+ */+function buildNode(world: EngineWorld, eid: number, kind: TimelineNodeKind): TimelineNode {+ const c = world.components;++ if (!hasComponent(world, eid, c.Expanded)) {+ return {+ eid,+ kind,+ expanded: false,+ expandable: isExpandable(world, eid),+ children: [],+ };+ }++ const children = buildTimelineLayers(world, eid);+ return {+ eid,+ kind,+ expanded: true,+ expandable: children.length > 0,+ children,+ };+}++/**+ * Early-exit probe: check if a layer could be expanded.+ */+function isExpandable(world: EngineWorld, parent: number): boolean {+ const c = world.components;+ const sequence = isSequence(world, parent);++ for (const cid of query(world, [ChildOf(parent), Not(c.Deleted)])) {+ if (hasComponent(world, cid, c.Keyframe)) continue;+ if (sequence && !hasKeyframes(world, cid)) continue;+ if (+ hasComponent(world, cid, c.IsMask) ||+ hasComponent(world, cid, c.Geometry) ||+ hasComponent(world, cid, c.Group) ||+ hasComponent(world, cid, c.AdjustmentLayer) ||+ hasComponent(world, cid, c.KeyframeTrack) ||+ isExpandable(world, cid)+ ) {+ return true;+ }+ }++ return false;+}++/**+ * Deep probe: does `eid`'s subtree contain a live KeyframeTrack? Tracks are+ * deleted with their last keyframe, so track presence implies keyframes.+ */+function hasKeyframes(world: EngineWorld, eid: number): boolean {+ const c = world.components;++ for (const cid of query(world, [ChildOf(eid), Not(c.Deleted)])) {+ if (hasComponent(world, cid, c.KeyframeTrack)) return true;+ if (hasKeyframes(world, cid)) return true;+ }++ return false;+}diff --git a/apps/web/src/components/engine/api/utils.ts b/apps/web/src/components/engine/api/utils.tsnew file mode 100644index 00000000..ea19d714--- /dev/null+++ b/apps/web/src/components/engine/api/utils.ts@@ -0,0 +1,426 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { entityExists, hasComponent, query, Not, Or } from "bitecs";+import { ChildOf } from "../components/relations";+import { sortByFrame, sortByItemIndex } from "../utils/sort";+import { DEFAULT_DURATION_FRAMES } from "../constants";+import { findAssetDuration } from "../utils/time";+import { getParentEntity } from "./base";+import { isGroupLike, isScene } from "./query";+import { removeComponent, setComponent, addComponent, clearComponent } from "./events";++import type { EngineWorld } from "./world";++export function rebuildCaches(world: EngineWorld, eid: number, pid: number | null) {+ const c = world.components;+ if (pid === null) return;++ if (hasComponent(world, eid, c.Geometry) || hasComponent(world, eid, c.Group) || hasComponent(world, eid, c.AdjustmentLayer)) {+ c.Cache.children[pid] = [...query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(pid), Not(c.IsMask), Not(c.Deleted)])];+ c.Cache.children[pid].sort(sortByItemIndex(world));+ }++ if (hasComponent(world, eid, c.IsMask)) {+ c.Cache.masks[pid] = [...query(world, [c.Geometry, c.IsMask, ChildOf(pid), Not(c.Deleted)])];+ c.Cache.masks[pid].sort(sortByItemIndex(world));+ }++ if (hasComponent(world, eid, c.KeyframeTrack)) {+ const geomEid = findClosestParentGeometry(world, pid);+ aggregateKeyframeTracks(world, geomEid);+ resetAnimatedValues(world, geomEid);+ }++ if (hasComponent(world, eid, c.Keyframe)) {+ c.Cache.keyframes[pid] = [...query(world, [c.Keyframe, ChildOf(pid), Not(c.Deleted)])];+ c.Cache.keyframes[pid].sort(sortByFrame(world));+ }++ if (hasComponent(world, eid, c.Animation)) {+ c.Cache.animations[pid] = [...query(world, [c.Animation, ChildOf(pid), Not(c.Deleted)])];+ c.Cache.animations[pid].sort(sortByItemIndex(world));+ resetAnimatedValues(world, pid);+ }++ if (hasComponent(world, eid, c.Paint)) {+ c.Cache.fills[pid] = [...query(world, [c.Paint, ChildOf(pid), Not(c.Deleted)])];+ c.Cache.fills[pid].sort(sortByItemIndex(world));+ }++ if (hasComponent(world, eid, c.Stroke)) {+ c.Cache.strokes[pid] = [...query(world, [c.Stroke, ChildOf(pid), Not(c.Deleted)])];+ c.Cache.strokes[pid].sort(sortByItemIndex(world));+ }++ if (hasComponent(world, eid, c.Effect)) {+ c.Cache.effects[pid] = [...query(world, [c.Effect, ChildOf(pid), Not(c.Shadow), Not(c.Deleted)])];+ c.Cache.effects[pid].sort(sortByItemIndex(world));+ }++ if (hasComponent(world, eid, c.Shadow)) {+ c.Cache.shadows[pid] = [...query(world, [c.Shadow, ChildOf(pid), Not(c.Effect), Not(c.Deleted)])];+ c.Cache.shadows[pid].sort(sortByItemIndex(world));+ }++ if (hasComponent(world, eid, c.TextRange)) {+ c.Cache.textRanges[pid] = [...query(world, [c.TextRange, ChildOf(pid), Not(c.Deleted)])];+ c.Cache.textRanges[pid].sort(sortByItemIndex(world));+ }+}++export function persistEntity(world: EngineWorld, eid: number) {+ const c = world.components;++ if (world.mode !== 'realtime' || !entityExists(world, eid) || hasComponent(world, eid, c.Deleted)) return;++ world.store.queue.scheduleWrite(world, eid);+}++export function unpersistEntity(world: EngineWorld, eid: number) {+ const c = world.components;++ if (world.mode !== 'realtime' || !entityExists(world, eid) || !hasComponent(world, eid, c.Deleted)) return;++ removeComponent(world, eid, c.Selected, false);+ world.store.queue.scheduleDelete(world, eid);+}++export function findClosestParentGeometry(world: EngineWorld, eid: number) {+ const c = world.components;+ let current: number | null = eid;+ while (current) {+ if (hasComponent(world, current, c.Geometry) || hasComponent(world, current, c.Group) || hasComponent(world, current, c.AdjustmentLayer)) {+ return current;+ }+ current = getParentEntity(world, current);+ }+ return null;+}++/**+ * Collect every KeyframeTrack under a geometry, stopping at nested geometries+ * (each enclosing geometry owns its own cache entry). Refreshes the denormalised+ * `target` field on each track so consumers iterating the cache can look up the+ * animated entity without walking ChildOf.+ */+export function aggregateKeyframeTracks(world: EngineWorld, nodeEid: number | null): void {+ if (nodeEid === null) return;++ const c = world.components;+ const tracks: number[] = [];++ const walk = (eid: number) => {+ for (const cid of query(world, [ChildOf(eid), Not(c.Deleted)])) {+ if (hasComponent(world, cid, c.KeyframeTrack)) {+ c.KeyframeTrack.target[cid] = getParentEntity(world, cid) ?? 0;+ tracks.push(cid);+ continue;+ }+ // Stop at nested nodes — each geometry, group, or adjustment layer owns+ // its own cache entry.+ if (hasComponent(world, cid, c.Geometry) || hasComponent(world, cid, c.Group) || hasComponent(world, cid, c.AdjustmentLayer)) continue;+ walk(cid);+ }+ };++ walk(nodeEid);+ c.Cache.keyframeTracks[nodeEid] = tracks;+}++export function disposeDecoders(world: EngineWorld, eid: number): void {+ const ImageDecoder = world.components.ImageDecoder;+ const VideoDecoder = world.components.VideoDecoder;+ const SequenceDecoder = world.components.SequenceDecoder;+ const AudioDecoder = world.components.AudioDecoder;++ ImageDecoder[eid]?.dispose();+ ImageDecoder[eid] = null;+ VideoDecoder[eid]?.dispose();+ VideoDecoder[eid] = null;+ SequenceDecoder[eid]?.dispose();+ SequenceDecoder[eid] = null;+ AudioDecoder[eid]?.reset();+ AudioDecoder[eid] = null;++ for (const child of query(world, [ChildOf(eid)])) {+ disposeDecoders(world, child);+ }+}++export function disconnectAudioBus(world: EngineWorld, eid: number): void {+ const AudioBus = world.components.AudioBus;+ AudioBus[eid]?.disconnect();+ AudioBus[eid] = null;++ for (const child of query(world, [ChildOf(eid)])) {+ disconnectAudioBus(world, child);+ }+}++/**+ * Time utilty functions.+ */++/**+ * Recompute trim when asset id of an entity changes.+ */+export function reactToAssetChange(world: EngineWorld, eid: number) {+ const c = world.components;++ if (hasComponent(world, eid, c.Paint)) {+ reactToPaintChange(world, eid);+ } else if (hasComponent(world, eid, c.Audio)) {+ reactToGeometryDurationChange(world, eid);+ }+}++/**+ * Re-clamp the parent geometry's trim and bubble the new bounds up.+ */+export function reactToPaintChange(world: EngineWorld, paintEid: number) {+ const c = world.components;+ const eid = getParentEntity(world, paintEid);+ if (eid === null || !hasComponent(world, eid, c.Geometry)) return;++ clampTrimToAssetDuration(world, eid);+ recomputeEntityTimeRange(world, eid);+ bubbleTimeRangeUp(world, eid);+}++/**+ * Recompute a geometry's bounds and bubble. Used when something other than+ * its own Trim/Delay shifts its duration (e.g. an attached asset id on an+ * Audio entity).+ */+export function reactToGeometryDurationChange(world: EngineWorld, eid: number) {+ const c = world.components;+ if (!hasComponent(world, eid, c.Geometry)) return;++ clampTrimToAssetDuration(world, eid);+ recomputeEntityTimeRange(world, eid);+ bubbleTimeRangeUp(world, eid);+}++/**+ * Deleted onAdd hook (covers the user-facing "remove" path). Mirror of+ * reactToChildAttached: if the dying entity is a geometry the parent group's+ * bounds may shrink; if it's a paint the parent geometry may lose its asset+ * source and needs a Trim pinned at its current duration.+ */+export function reactToChildDetached(world: EngineWorld, childEid: number) {+ const c = world.components;++ if (hasComponent(world, childEid, c.Geometry) || hasComponent(world, childEid, c.Group)) {+ bubbleTimeRangeUp(world, childEid);+ return;+ }++ if (hasComponent(world, childEid, c.Paint)) {+ const parentEid = getParentEntity(world, childEid);+ if (parentEid === null || !hasComponent(world, parentEid, c.Geometry)) return;+ // Pin the current duration before recomputing — otherwise the geometry+ // would silently fall back to the 16s default after losing its paint.+ pinTrimToCurrentDuration(world, parentEid);+ }+}++export function recomputeEntityTimeRange(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);++ const parentDelay = parentEid !== null ? (c.Computed.delay[parentEid] ?? 0) : 0;+ const ownDelay = c.Delay[eid] ?? 0;+ const accumulatedDelay = parentDelay + ownDelay;++ c.Computed.delay[eid] = accumulatedDelay;++ const playbackRate = c.PlaybackRate[eid] ?? 1;++ let start: number;+ let end: number;++ if (hasComponent(world, eid, c.Trim)) {+ const trimStart = c.Trim.start[eid] ?? 0;+ const trimEnd = c.Trim.end[eid] ?? 0;+ start = Math.round(accumulatedDelay + trimStart / playbackRate);+ end = Math.round(accumulatedDelay + trimEnd / playbackRate);+ } else if (isGroupLike(world, eid)) {+ const children = c.Cache.children[eid] ?? [];+ if (children.length === 0) {+ start = accumulatedDelay;+ end = accumulatedDelay + DEFAULT_DURATION_FRAMES;+ } else {+ let minStart = Infinity;+ let maxEnd = -Infinity;+ for (const child of children) {+ const cs = c.Computed.start[child] ?? accumulatedDelay;+ const ce = c.Computed.end[child] ?? accumulatedDelay;+ if (cs < minStart) minStart = cs;+ if (ce > maxEnd) maxEnd = ce;+ }+ start = minStart;+ end = maxEnd;+ }+ } else {+ const assetDuration = findAssetDuration(world, eid);+ const sourceDuration = assetDuration ?? DEFAULT_DURATION_FRAMES;+ start = accumulatedDelay;+ end = Math.round(accumulatedDelay + sourceDuration / playbackRate);+ }++ c.Computed.start[eid] = start;+ c.Computed.end[eid] = end;+ c.Computed.duration[eid] = end - start;+}++/**+ * Recompute eid and every descendant (geometry children). Use when something+ * that affects accumulated delay or playback rate changes — every child below+ * needs its delay refreshed.+ */+export function propagateTimeRangeDown(world: EngineWorld, eid: number): void {+ const c = world.components;+ recomputeEntityTimeRange(world, eid);+ for (const child of c.Cache.children[eid] ?? []) {+ propagateTimeRangeDown(world, child);+ }+ for (const mask of c.Cache.masks[eid] ?? []) {+ propagateTimeRangeDown(world, mask);+ }+ recomputeEntityTimeRange(world, eid);+}++/**+ * Walk upward recomputing any ancestor whose bounds depend on its children+ * (group-like without an explicit Trim). Call with the PARENT of the entity+ * that changed.+ */+export function bubbleTimeRangeUp(world: EngineWorld, childEid: number): void {+ const eid = getParentEntity(world, childEid);+ if (eid === null) return;++ const c = world.components;++ const dependsOnChildren = isGroupLike(world, eid) && !hasComponent(world, eid, c.Trim);+ if (!dependsOnChildren) return;++ recomputeEntityTimeRange(world, eid);+ bubbleTimeRangeUp(world, eid);+}++/**+ * Clamp a Trim's end so it never exceeds the entity's available asset+ * duration. Mutates the Trim component directly — caller is responsible for+ * triggering downstream recomputes.+ */+export function clampTrimToAssetDuration(world: EngineWorld, eid: number): void {+ const c = world.components;+ if (!hasComponent(world, eid, c.Trim)) return;++ const assetDuration = findAssetDuration(world, eid);+ if (!assetDuration) return;++ c.Trim.end[eid] = Math.min(c.Trim.end[eid] ?? 0, assetDuration);+}++/**+ * "Paint is removed" rule: if the geometry has no Trim, pin its current+ * computed duration as a fresh Trim so the entity does not silently fall+ * back to the 16s default after losing its asset source.+ */+export function pinTrimToCurrentDuration(world: EngineWorld, eid: number): void {+ const c = world.components;+ if (hasComponent(world, eid, c.Trim)) return;++ const playbackRate = c.PlaybackRate[eid] ?? 1;+ const globalDuration = c.Computed.duration[eid] ?? 0;+ const localDuration = Math.round(globalDuration * playbackRate);++ setComponent(world, eid, c.Trim, {+ start: 0,+ end: localDuration,+ });+}++export function reactToChildAttached(world: EngineWorld, childEid: number) {+ const c = world.components;++ if (hasComponent(world, childEid, c.Geometry) || hasComponent(world, childEid, c.Group)) {+ propagateTimeRangeDown(world, childEid);+ bubbleTimeRangeUp(world, childEid);+ return;+ }++ if (hasComponent(world, childEid, c.Paint)) {+ reactToPaintChange(world, childEid);+ }+}++export function syncInteractiveState(world: EngineWorld) {+ const c = world.components;++ clearComponent(world, c.Interactive, false);++ const walk = (eid: number, isRoot: boolean) => {+ const children = query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(eid), Not(c.Deleted)]);+ const isSequential = hasComponent(world, eid, c.Sequential);+ // Only a root (top-level) scene passes through to its children. A nested+ // scene is a clickable unit like a group: it becomes Interactive itself+ // and does not expose its children until it is entered (double-click).+ const isRootSceneWithChildren = isRoot && isScene(world, eid) && children.length > 0;++ if (isSequential || isRootSceneWithChildren) {+ for (const child of children) {+ walk(child, false);+ }+ return;+ }++ addComponent(world, eid, c.Interactive, false);+ }++ for (const eid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(ChildOf('*')), Not(c.Deleted)])) {+ walk(eid, true);+ }+}++export function resetAnimatedValues(world: EngineWorld, eid: number | null) {+ if (eid === null) return;++ const c = world.components;++ c.Computed.positionX[eid] = c.Position.x[eid] ?? 0;+ c.Computed.positionY[eid] = c.Position.y[eid] ?? 0;+ c.Computed.offsetX[eid] = c.Offset.x[eid] ?? 0;+ c.Computed.offsetY[eid] = c.Offset.y[eid] ?? 0;+ c.Computed.rotation[eid] = c.Rotation[eid] ?? 0;+ c.Computed.skewX[eid] = c.Skew.x[eid] ?? 0;+ c.Computed.skewY[eid] = c.Skew.y[eid] ?? 0;+ c.Computed.opacity[eid] = c.Appearance.opacity[eid] ?? 1;+ c.Computed.color[eid] = c.Color[eid] ?? 0;+ c.Computed.blur[eid] = c.Blur[eid] ?? 0;+ c.Computed.volume[eid] = c.Volume[eid] ?? 0;+ c.Computed.strokeWidth[eid] = c.StrokeStyle.width[eid] ?? 1;+ c.Computed.cornerRadius[eid] = c.CornerRadius[eid] ?? 0;+ c.Computed.cornerRadiusTopLeft[eid] = c.MixedCornerRadius.topLeft[eid] ?? 0;+ c.Computed.cornerRadiusTopRight[eid] = c.MixedCornerRadius.topRight[eid] ?? 0;+ c.Computed.cornerRadiusBottomRight[eid] = c.MixedCornerRadius.bottomRight[eid] ?? 0;+ c.Computed.cornerRadiusBottomLeft[eid] = c.MixedCornerRadius.bottomLeft[eid] ?? 0;+ c.Computed.stopOffset[eid] = c.ColorStop.offset[eid] ?? 0;+ c.Computed.stopColor[eid] = c.ColorStop.color[eid] ?? 0;+ c.Computed.stopOpacity[eid] = c.ColorStop.opacity[eid] ?? 1;+ c.Computed.chars[eid] = c.Chars[eid] ?? '';++ if (hasComponent(world, eid, c.UniformScale)) {+ c.Computed.scaleX[eid] = c.UniformScale[eid] ?? 1;+ c.Computed.scaleY[eid] = c.UniformScale[eid] ?? 1;+ } else {+ c.Computed.scaleX[eid] = c.Scale.x[eid] ?? 1;+ c.Computed.scaleY[eid] = c.Scale.y[eid] ?? 1;+ }+}++export { propagateSize, resolveConstraintOffsets } from "./resize";diff --git a/apps/web/src/components/engine/api/world.ts b/apps/web/src/components/engine/api/world.tsnew file mode 100644index 00000000..5ccc6ba0--- /dev/null+++ b/apps/web/src/components/engine/api/world.ts@@ -0,0 +1,87 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createWorld } from "bitecs";+import { createSignal } from "solid-js";++import { observeWorld } from "./observers";+import { createComponents } from "./components";+import { createHistory } from "../utils/history";+import { createStore } from "../db";+import { initAssets } from "./assets";+import { initFolders } from "./folders";+import { buildTimelineLayers, type TimelineIndexValue } from "./timeline-index";+import { updateCursor } from "../utils";++import type { FontSource } from "../font";+import type { Asset, Folder } from "../db";+import type { RuntimeMode, HitRegion, Camera2D, PointerState, SnapLine, HudMode } from "../types";++export const DEFAULT_BACKGROUND = 0x171717;++export function createEngineWorld(projectId: string, audioContext: AudioContext | OfflineAudioContext) {+ const [timelineIndex, setTimelineIndex] = createSignal<TimelineIndexValue>({ root: null, layers: [] });++ const world = createWorld({+ projectId,+ components: createComponents(),+ history: createHistory(),+ selection: {+ scene: null as number | null,+ tool: 0,+ },+ mode: 'realtime' as RuntimeMode,+ camera: { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 } as Camera2D,+ background: DEFAULT_BACKGROUND,+ canvas: null as HTMLCanvasElement | OffscreenCanvas | null,+ resolution: window.devicePixelRatio,+ ctx: null as CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null,+ keys: new Set<string>(),+ hitRegions: [] as HitRegion[],+ snapLines: [] as SnapLine[],+ hudMode: 'idle' as HudMode,+ pointer: {+ state: 'lifted',+ button: 0,+ clientX: 0,+ clientY: 0,+ dragStartX: 0,+ dragStartY: 0,+ } as PointerState,+ timestamp: {+ now: 0,+ delta: 0,+ },+ frameRate: 30,+ fonts: [] as FontSource[],+ audio: audioContext,+ assets: new Map<string, Asset>(),+ folders: new Map<string, Folder>(),+ store: createStore(projectId),+ promises: null as (Promise<unknown> | null)[] | null,+ timelineIndex,+ rebuildTimelineIndex: () => { },+ cursor: { update: updateCursor }+ });++ world.rebuildTimelineIndex = () => {+ const root = world.selection.scene;++ if (root == null) {+ setTimelineIndex({ root: null, layers: [] });+ return;+ }++ setTimelineIndex({ root, layers: buildTimelineLayers(world, root) });+ };++ initAssets(world, projectId);+ initFolders(world, projectId);++ observeWorld(world);++ return world;+}++export type EngineWorld = ReturnType<typeof createEngineWorld>;diff --git a/apps/web/src/components/engine/components/components.ts b/apps/web/src/components/engine/components/components.tsnew file mode 100644index 00000000..3a9420a4--- /dev/null+++ b/apps/web/src/components/engine/components/components.ts@@ -0,0 +1,419 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { VideoCodec, AudioCodec } from "mediabunny";+import type { ContainerFormat } from "../encode/types";+import type { Token } from "../utils/text";+import type { AudioBus as AudioBusInstance } from "../services/audio-bus";+import type { ImageDecoder as ImageDecoderInstance } from "../decoders/image";+import type { VideoDecoderInstance } from "../decoders/video";+import type { SequenceDecoder as SequenceDecoderInstance } from "../decoders/sequence";+import type { AudioDecoder as AudioDecoderInstance } from "../decoders/audio";+import type { CaptionDecoder as CaptionDecoderInstance } from "../decoders/caption";+// Geometric primitive — RECT or TEXT (see GeometryType). Other node-like+// roles (group, audio, scene, caption) are layered on top via tag components.+export const Geometry = [] as number[];++// Paint applied to a geometry (or stroke). The value is a PaintType enum index.+export const Paint = [] as number[];++// Tag marking a geometry as a group container. Groups have no Size of+// their own — their Computed.width/height are derived from the local AABB+// of their direct children (see transformSystem). They carry a transform+// state (Position/Rotation/Scale/...) like any other entity.+export const Group = {};++// Tag marking a geometry as a scene — a clipped, playable frame. Scenes+// have a fixed Size like any frame; the tag layers playback + clipping on+// top. Scenes are NOT Groups.+export const Scene = {};++// Tag marking a geometry as an audio clip (no visual rendering).+export const Audio = {};++export const AdjustmentLayer = {};++export const ExportSettings = {+ templateId: [] as (string | null)[],+ format: [] as (ContainerFormat | undefined)[],+ videoEnabled: [] as (boolean | undefined)[],+ videoCodec: [] as (VideoCodec | undefined)[],+ videoBitrate: [] as (number | undefined)[],+ videoFps: [] as (number | undefined)[],+ videoResolution: [] as (number | undefined)[],+ audioEnabled: [] as (boolean | undefined)[],+ audioCodec: [] as (AudioCodec | undefined)[],+ audioSampleRate: [] as (number | undefined)[],+};++export const Effect = {+ type: [] as number[],+ value: [] as number[],+};++// Tag marking an entity as a mask. Masks are ChildOf their target.+// MaskCache[targetEid] is derived by childCacheSystem from IsMask + ChildOf queries.+export const IsMask = {};++// Tag for shadow sub-entities (distinguishes from other Effect sub-entities in ChildOf queries).+export const Shadow = {};++// Tag for stroke sub-entities (distinguishes from parent Stroke component in ChildOf queries).+export const Stroke = {};++// Caption preset configuration — only on CAPTION node entities.+// The transcript is either a standalone TRANSCRIPT asset or embedded in an AUDIO/VIDEO asset, referenced via AssetId.+export const Caption = {+ type: [] as number[], // CaptionType enum index,+ colors: [] as number[][],+};++export const Name = [] as string[];++// Stable identity for entities.+export const Key = [] as string[];++export const Position = {+ x: [] as number[],+ y: [] as number[],+};++export const Offset = {+ x: [] as number[],+ y: [] as number[],+};++export const Rotation = [] as number[];++export const Scale = {+ x: [] as number[],+ y: [] as number[],+};++export const UniformScale = [] as number[];++export const Anchor = {+ x: [] as number[],+ y: [] as number[],+};++export const Skew = {+ x: [] as number[],+ y: [] as number[],+};++export const Size = {+ width: [] as number[],+ height: [] as number[],+};++export const Flip = {+ x: [] as (-1 | 1)[],+ y: [] as (-1 | 1)[],+};++export const LocalTransform = {+ a: [] as number[],+ b: [] as number[],+ c: [] as number[],+ d: [] as number[],+ e: [] as number[],+ f: [] as number[],+};++export const WorldTransform = {+ a: [] as number[],+ b: [] as number[],+ c: [] as number[],+ d: [] as number[],+ e: [] as number[],+ f: [] as number[],+};++export const WorldBounds = {+ minX: [] as number[],+ minY: [] as number[],+ maxX: [] as number[],+ maxY: [] as number[],+};++export const Culled = {};++export const Hidden = {};++export const ClipsContent = {};++// Tag marking a container whose direct children cannot overlap in time.+// Drag/trim of any direct child clamps at the neighbour's edge.+export const Sequential = {};++export const Generating = {};++export const Appearance = {+ opacity: [] as number[],+ blendMode: [] as number[],+};++export const CornerRadius = [] as number[];++// Per-corner radii (CSS order: TL, TR, BR, BL).+export const MixedCornerRadius = {+ topLeft: [] as number[],+ topRight: [] as number[],+ bottomRight: [] as number[],+ bottomLeft: [] as number[],+};++export const Blur = [] as number[];++export const Color = [] as number[];++export const AssetId = [] as string[];++// Scale mode — index into SCALE_MODES. Used by image fills and any future+// entity with a scaled asset display.+export const ScaleMode = [] as number[];++// Audio volume in decibels (0 dB = unity, -Infinity = silence).+export const Volume = [] as number[];++// Audio mute tag — presence means muted.+export const Muted = {};++// Runtime-only solo tag (not serialized) — presence means soloed.+export const Soloed = {};++// Text content — stores text-specific data for TextNode entities.+// Text characters — only on the parent TextNode, not shared with ranges.+export const Chars = [] as string[];++// Text style properties — shared between TextNode and TextRange sub-entities.+// On a TextNode this is the default style; on a range sub-entity it overrides.+export const TextStyle = {+ leading: [] as number[],+ fontSize: [] as number[],+ fontFamily: [] as string[],+ fontWeight: [] as string[],+ fontStyle: [] as number[], // index into FONT_STYLES+ textAlign: [] as number[], // index into TEXT_ALIGNS+ textBaseline: [] as number[], // index into TEXT_BASELINES+ textCase: [] as number[], // -1 = none, index into TEXT_CASES+ letterSpacing: [] as number[], // extra spacing between characters (px)+};++// Runtime-only: cached text layout data (not serialized).+export const TextCache = {+ tokens: [] as Token[][][],+};++export const TextRange = {+ start: [] as number[],+ end: [] as (number | null)[],+};++// Single gradient stop. Each stop is its own entity, ChildOf the gradient fill.+// Stop count is fixed for the lifetime of the fill — to animate "between+// gradients with different stop counts" use a separate fill and cross-fade.+export const ColorStop = {+ offset: [] as number[],+ color: [] as number[],+ opacity: [] as number[],+};++export const StrokeStyle = {+ width: [] as number[],+ join: [] as number[], // 0=miter, 1=round, 2=bevel+ cap: [] as number[], // 0=butt, 1=round, 2=square+ miterLimit: [] as number[],+};++// Playback state of an entity.+export const Playback = {+ playing: [] as number[], // 0 = paused, 1 = playing+ loop: [] as number[], // 0 = no loop, 1 = loop+ speed: [] as number[], // playback speed multiplier (negative = reverse, default 1)+};++// Per-clip user-customized row height.+export const ClipHeight = [] as number[];++// Tag: this clip's keyframe rows are expanded below the clip body.+export const Expanded = {};++// Offset where the node starts inside its parent's timeline (frames).+export const Delay = [] as number[];++// Speed multiplier for the node's local time (1 = normal).+export const PlaybackRate = [] as number[];++// Explicit duration window in the clip's own local time. When present, the+// node has fixed bounds (workarea on scenes, trimmed source on media clips).+// When absent: scenes auto-fit to their children, other nodes have no+// inherent duration (runtime adds Trim immediately on creation).+export const Trim = {+ start: [] as number[],+ end: [] as number[],+};++// Constraint anchoring — stores CONSTRAINT_TYPES values (0=MIN, 1=MAX, 2=CENTER).+export const Constraint = {+ horizontal: [] as number[],+ vertical: [] as number[],+};++// Aspect ratio lock — stores the target aspect ratio snapshot+// When the component is set, the current dimensions are captured.+export const KeepAspectRatio = {+ width: [] as number[],+ height: [] as number[],+};++// KeyframeTrack entity — one per (target, property) pair. ChildOf its target+// (geometry, paint, color stop, …) and owns the Keyframe entities as children.+// `target` is denormalised: ChildOf is authoritative, but the keyed lookup is+// refreshed in `aggregateKeyframeTracks` so motion/render don't have to walk+// up the relation on every frame.+export const KeyframeTrack = {+ property: [] as string[],+ target: [] as number[],+};++// Keyframe entity component — each keyframe is its own entity, ChildOf its KeyframeTrack.+// Easing applies to the segment from this keyframe to the next-in-time on the same track.+export const Keyframe = {+ time: [] as number[],+ value: [] as number[],+ easing: [] as string[],+};++// Animation component — each animation is its own entity.+export const Animation = {+ type: [] as number[],+ duration: [] as number[],+ delay: [] as number[],+ phase: [] as number[],+};++export const ConstraintCache = {+ parentWidth: [] as number[],+ parentHeight: [] as number[],+ childWidth: [] as number[],+ childHeight: [] as number[],+};++export const Computed = {+ positionX: [] as number[],+ positionY: [] as number[],+ offsetX: [] as number[],+ offsetY: [] as number[],+ // Local-space origin of the entity's bounding rect. Non-zero only for+ // Group/Sequential containers whose children's AABB extends past (0, 0).+ originX: [] as number[],+ originY: [] as number[],+ rotation: [] as number[],+ scaleX: [] as number[],+ scaleY: [] as number[],+ skewX: [] as number[],+ skewY: [] as number[],+ opacity: [] as number[],+ color: [] as number[],+ blur: [] as number[],+ volume: [] as number[],+ value: [] as number[],+ strokeWidth: [] as number[],+ cornerRadius: [] as number[],+ cornerRadiusTopLeft: [] as number[],+ cornerRadiusTopRight: [] as number[],+ cornerRadiusBottomRight: [] as number[],+ cornerRadiusBottomLeft: [] as number[],+ stopOffset: [] as number[],+ stopColor: [] as number[],+ stopOpacity: [] as number[],+ width: [] as number[],+ height: [] as number[],+ chars: [] as (string | undefined)[],+ localTimeInSeconds: [] as number[], // playhead position in seconds+ localTime: [] as number[], // playhead position in frames (mirrors localTimeInSeconds)+ duration: [] as number[], // duration in frames+ start: [] as number[],+ end: [] as number[],+ delay: [] as number[],+ visibility: [] as number[],+};++export const ItemIndex = [] as number[];++// Per-entity owned-sub-entity lists. Populated by observers from ChildOf+// queries; consumed by render, motion, and UI code.+export const Cache = {+ children: [] as number[][],+ fills: [] as number[][],+ shadows: [] as number[][],+ strokes: [] as number[][],+ effects: [] as number[][],+ textRanges: [] as number[][],+ masks: [] as number[][],+ keyframeTracks: [] as number[][],+ keyframes: [] as number[][],+ animations: [] as number[][],+};++export const ImageDecoder = [] as (ImageDecoderInstance | null)[];++export const VideoDecoder = [] as (VideoDecoderInstance | null)[];++export const SequenceDecoder = [] as (SequenceDecoderInstance | null)[];++export const AudioDecoder = [] as (AudioDecoderInstance | null)[];++export const CaptionDecoder = [] as (CaptionDecoderInstance | null)[];++export const AudioBus = [] as (AudioBusInstance | null)[];++// Transition between adjacent clips in a track.+// Stored on clip entities — describes the transition INTO this clip from the previous one.+export const Transition = {+ type: [] as number[], // TransitionType enum index+ duration: [] as number[], // duration in frames+};++export const AudioPlayback = {+ wasPlaying: [] as number[],+ contextOffsetInSeconds: [] as number[],+ timelineOffsetInSeconds: [] as number[],+};++export const Selected = {};++export const Deleted = {};++export const Interactive = {};++export const Hovering = {};++export const Dragging = {};++export const Timeline = {+ scrollX: [] as number[],+ scrollY: [] as number[],+ resolution: [] as number[],+ transform: [] as DOMMatrix[],+};++export const ClipDragOrigin = {+ delay: [] as number[],+ start: [] as number[],+ end: [] as number[],+};++export const KeyframeDragOrigin = {+ time: [] as number[],+};++// Snapshot of the clip's start/end frames at the moment a trim interaction+// began. Tagged on the single clip being trimmed; removed on release.+export const TrimDragOrigin = {+ start: [] as number[],+ end: [] as number[],+};\ No newline at end of filediff --git a/apps/web/src/components/engine/components/constants.ts b/apps/web/src/components/engine/components/constants.tsnew file mode 100644index 00000000..28991aba--- /dev/null+++ b/apps/web/src/components/engine/components/constants.ts@@ -0,0 +1,160 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export enum BlendMode {+ SOURCE_OVER,+ MULTIPLY,+ SCREEN,+ OVERLAY,+ DARKEN,+ LIGHTEN,+ COLOR_DODGE,+ COLOR_BURN,+ HARD_LIGHT,+ SOFT_LIGHT,+ DIFFERENCE,+ EXCLUSION,+ HUE,+ SATURATION,+ COLOR,+ LUMINOSITY,+};++export const COMPOSITE_OPERATIONS = Object.keys(BlendMode)+ .filter(key => isNaN(Number(key)))+ .map(key => key.toLowerCase().replace(/_/g, '-')) as GlobalCompositeOperation[];++export enum StrokeJoin {+ MITER,+ ROUND,+ BEVEL,+}++export enum StrokeCap {+ BUTT,+ ROUND,+ SQUARE,+}++export enum ScaleMode {+ COVER,+ FILL,+ FIT,+ NONE,+}++export enum ConstraintType {+ MIN,+ MAX,+ CENTER,+ STRETCH,+ SCALE,+}++export enum GeometryType {+ RECT,+ TEXT,+}++export enum PaintType {+ SOLID,+ IMAGE,+ VIDEO,+ LINEAR_GRADIENT,+ RADIAL_GRADIENT,+ SEQUENCE,+ WAVEFORM,+}++export enum EffectType {+ DROP_SHADOW,+ LAYER_BLUR,+ BRIGHTNESS,+ CONTRAST,+ GRAYSCALE,+ HUE_ROTATION,+ INVERT,+ SATURATE,+ SEPIA,+}++export enum MotionType {+ ANIMATION,+ KEYFRAME,+}++export enum AnimationType {+ FADE,+ GAIN,+ GROW,+ SHRINK,+ BLUR,+ SLIDE_LEFT,+ SLIDE_RIGHT,+ SLIDE_UP,+ SLIDE_DOWN,+ SPIN,+ TWIST,+ APPEAR_WORD,+ APPEAR_CHAR,+ SCRAMBLE,+}++export enum AnimationPhase {+ IN,+ OUT,+}++export enum TextAlign {+ LEFT,+ CENTER,+ RIGHT,+}++export enum TextBaseline {+ TOP,+ MIDDLE,+ BOTTOM,+ ALPHABETIC,+}++export enum TextCase {+ ORIGINAL,+ UPPER,+ LOWER,+}++export enum FontStyle {+ NORMAL,+ ITALIC,+ OBLIQUE,+}++export enum TransitionType {+ DISSOLVE,+ SLIDE_FROM_RIGHT,+ SLIDE_FROM_LEFT,+ FADE_TO_BLACK,+ FADE_TO_WHITE,+}++export enum CaptionType {+ CLASSIC,+ CASCADE,+ SPOTLIGHT,+ WHISPER,+ PAPER,+ GUINEA,+ STARK,+}++export enum ToolType {+ MOVE,+ HAND,+ BLADE,+ SCENE,+ RECT,+ TEXT,+ TEXT_EDIT,+}diff --git a/apps/web/src/components/engine/components/index.ts b/apps/web/src/components/engine/components/index.tsnew file mode 100644index 00000000..11df8dbc--- /dev/null+++ b/apps/web/src/components/engine/components/index.ts@@ -0,0 +1,6 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './constants';+export * from './relations';diff --git a/apps/web/src/components/engine/components/relations.ts b/apps/web/src/components/engine/components/relations.tsnew file mode 100644index 00000000..8baf6ec5--- /dev/null+++ b/apps/web/src/components/engine/components/relations.ts@@ -0,0 +1,16 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createRelation, withAutoRemoveSubject } from 'bitecs';++/**+ * Universal parent-child relation. Replaces all array-based ownership:+ * Hierarchy.parent/children, Fills, Shadows, Strokes, Effects,+ * TextRanges, Timeline.tracks, Track.clips, Track.animations.+ *+ * Uses withAutoRemoveSubject so removing a parent auto-removes its children.+ * Children are distinguished by their type tags (Fill, Node, Track, etc.).+ * Ordering is encoded via the Index component on each child.+ */+export const ChildOf = createRelation(withAutoRemoveSubject);diff --git a/apps/web/src/components/engine/constants.ts b/apps/web/src/components/engine/constants.tsnew file mode 100644index 00000000..f76594fb--- /dev/null+++ b/apps/web/src/components/engine/constants.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export const CONONICAL_TIME_BASE = 1e6;+export const DEFAULT_DURATION_FRAMES = 16 * 30;+export const SPACE_HOLD_DELAY_MS = 200;diff --git a/apps/web/src/components/engine/db/global-db.ts b/apps/web/src/components/engine/db/global-db.tsnew file mode 100644index 00000000..d788f5fb--- /dev/null+++ b/apps/web/src/components/engine/db/global-db.ts@@ -0,0 +1,298 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { openDB } from 'idb';+import type * as idb from 'idb';+import { nanoid } from 'nanoid';+import { DEFAULT_PROJECT_ID, deleteProjectDB, getProjectDB } from './project-db';++const adjectives = ["Golden", "Silent", "Fast", "Bright", "Dark", "Wild", "Calm"];+const nouns = ["River", "Mountain", "Dream", "Storm", "Sunset", "Forest", "Ocean"];++function getRandomElement<T>(arr: T[]): T {+ return arr[Math.floor(Math.random() * arr.length)]!;+}++export function generateProjectName(): string {+ const adj = getRandomElement(adjectives);+ const noun = getRandomElement(nouns);+ const now = new Date();+ const day = now.getDate();+ const month = now.toLocaleString("en-US", { month: "short" });+ return `${adj} ${noun} ${day} ${month}`;+}++export interface Directory {+ id: string;+ name: string;+ handle: FileSystemDirectoryHandle;+ createdAt: string;+ lastAccessedAt: string;+}++export interface ProjectEntry {+ id: string;+ name: string;+ createdAt: string;+ lastAccessedAt: string;+ thumbnail?: Blob;+}++export interface GlobalDBSchema extends idb.DBSchema {+ directories: {+ value: Directory;+ key: string;+ indexes: {+ 'by-name': string;+ 'by-last-accessed': string;+ };+ };+ projects: {+ value: ProjectEntry;+ key: string;+ indexes: {+ 'by-name': string;+ 'by-last-accessed': string;+ };+ };+}++const DB_NAME = 'global-db';+const DB_VERSION = 1;++const dbPromise = openDB<GlobalDBSchema>(DB_NAME, DB_VERSION, {+ upgrade(db) {+ if (!db.objectStoreNames.contains('directories')) {+ const store = db.createObjectStore('directories', {+ keyPath: 'id',+ });+ store.createIndex('by-name', 'name');+ store.createIndex('by-last-accessed', 'lastAccessedAt');+ }++ if (!db.objectStoreNames.contains('projects')) {+ const store = db.createObjectStore('projects', {+ keyPath: 'id',+ });+ store.createIndex('by-name', 'name');+ store.createIndex('by-last-accessed', 'lastAccessedAt');+ }+ },+});++/**+ * Saves a directory handle to the database.+ * If the same handle already exists, it will be updated.+ */+export async function saveDirectoryHandle(handle: FileSystemDirectoryHandle) {+ const db = await dbPromise;+ const now = new Date().toISOString();++ let id = nanoid();+ let createdAt = now;++ const existingEntries = await db.getAll('directories');+ for (const entry of existingEntries) {+ if (typeof entry.handle?.isSameEntry !== 'function') continue;+ if (await entry.handle.isSameEntry(handle)) {+ id = entry.id;+ createdAt = entry.createdAt;+ break;+ }+ }++ const entry: Directory = {+ id,+ name: handle.name,+ handle,+ createdAt,+ lastAccessedAt: now,+ };++ await db.put('directories', entry);+ return entry;+}++/**+ * Returns the most recently accessed directory handle, or null if none exists.+ */+export async function retrieveLastAccessedDirectory(): Promise<Directory | null> {+ const db = await dbPromise;+ const cursor = await db+ .transaction('directories', 'readonly')+ .store.index('by-last-accessed')+ .openCursor(null, 'prev');++ return cursor?.value ?? null;+}++/**+ * Finds the last accessed directory handle, or creates a new one if none exists.+ * Uses OPFS as a fallback if the indexeddb is not available.+ * @returns The directory handle.+ */+export async function retrieveDirectoryHandle() {+ const lastAccessed = await retrieveLastAccessedDirectory();+ if (lastAccessed) {+ return lastAccessed.handle;+ }++ return await navigator.storage.getDirectory();+}++const PROJECT_ID_PATTERN = /^[A-Za-z0-9_-]{21}$/;++export async function markProjectOpened(projectId: string): Promise<void> {+ if (!PROJECT_ID_PATTERN.test(projectId) || projectId === DEFAULT_PROJECT_ID) return;++ const db = await dbPromise;+ const now = new Date().toISOString();+ const tx = db.transaction('projects', 'readwrite');+ const existing = await tx.store.get(projectId);++ const entry: ProjectEntry = {+ id: projectId,+ name: existing?.name ?? generateProjectName(),+ createdAt: existing?.createdAt ?? now,+ lastAccessedAt: now,+ };++ await tx.store.put(entry);+ await tx.done;+}++export async function createProject(name?: string): Promise<ProjectEntry> {+ const db = await dbPromise;+ const now = new Date().toISOString();+ const entry: ProjectEntry = {+ id: nanoid(),+ name: name?.trim() || generateProjectName(),+ createdAt: now,+ lastAccessedAt: now,+ };+ await db.put('projects', entry);+ return entry;+}++export async function getProjectName(projectId: string): Promise<string> {+ const db = await dbPromise;++ const project = await db.get('projects', projectId)+ if (!project) return generateProjectName();++ return project.name;+}++export async function getProject(projectId: string): Promise<ProjectEntry | null> {+ if (!PROJECT_ID_PATTERN.test(projectId)) return null;+ const db = await dbPromise;+ return (await db.get('projects', projectId)) ?? null;+}++export async function setProjectName(projectId: string, name: string): Promise<void> {+ if (!PROJECT_ID_PATTERN.test(projectId)) return;++ const db = await dbPromise;+ const tx = db.transaction('projects', 'readwrite');+ const existing = await tx.store.get(projectId);+ const now = new Date().toISOString();++ const entry: ProjectEntry = {+ id: projectId,+ name,+ createdAt: existing?.createdAt ?? now,+ lastAccessedAt: now,+ };++ await tx.store.put(entry);+ await tx.done;+}++export async function listRecentProjects(limit = 10): Promise<ProjectEntry[]> {+ const db = await dbPromise;++ const tx = db.transaction('projects', 'readonly');+ let cursor = await tx.store.index('by-last-accessed').openCursor(null, 'prev');++ const entries: ProjectEntry[] = [];+ while (cursor && entries.length < limit) {+ entries.push(cursor.value);+ cursor = await cursor.continue();+ }++ await tx.done;+ return entries;+}++export async function setProjectThumbnail(projectId: string, thumbnail: Blob): Promise<void> {+ if (!PROJECT_ID_PATTERN.test(projectId) || projectId === DEFAULT_PROJECT_ID) return;++ const db = await dbPromise;+ const tx = db.transaction('projects', 'readwrite');+ const existing = await tx.store.get(projectId);+ if (!existing) {+ await tx.done;+ return;+ }++ existing.thumbnail = thumbnail;+ await tx.store.put(existing);+ await tx.done;+}++export async function getProjectThumbnail(projectId: string): Promise<Blob | null> {+ const db = await dbPromise;+ const project = await db.get('projects', projectId);+ return project?.thumbnail ?? null;+}++export async function duplicateProject(projectId: string): Promise<ProjectEntry | null> {+ if (!PROJECT_ID_PATTERN.test(projectId)) return null;++ const db = await dbPromise;+ const source = await db.get('projects', projectId);+ if (!source) return null;++ const newProjectId = nanoid();+ const now = new Date().toISOString();++ const sourceDB = await getProjectDB(projectId);+ const targetDB = await getProjectDB(newProjectId);++ const [entities, assets, folders, fonts] = await Promise.all([+ sourceDB.getAll('entities'),+ sourceDB.getAll('assets'),+ sourceDB.getAll('folders'),+ sourceDB.getAll('fonts'),+ ]);++ const tx = targetDB.transaction(['entities', 'assets', 'folders', 'fonts'], 'readwrite');+ await Promise.all([+ ...entities.map((entity) => tx.objectStore('entities').put(entity)),+ ...assets.map((asset) => tx.objectStore('assets').put(asset)),+ ...folders.map((folder) => tx.objectStore('folders').put(folder)),+ ...fonts.map((font) => tx.objectStore('fonts').put(font)),+ tx.done,+ ]);++ const entry: ProjectEntry = {+ id: newProjectId,+ name: `${source.name} (Copy)`,+ createdAt: now,+ lastAccessedAt: now,+ thumbnail: source.thumbnail,+ };++ await db.put('projects', entry);+ return entry;+}++export async function deleteProject(projectId: string): Promise<void> {+ if (!PROJECT_ID_PATTERN.test(projectId)) return;++ const db = await dbPromise;+ await db.delete('projects', projectId);++ await deleteProjectDB(projectId);+}diff --git a/apps/web/src/components/engine/db/index.ts b/apps/web/src/components/engine/db/index.tsnew file mode 100644index 00000000..01bc2ab7--- /dev/null+++ b/apps/web/src/components/engine/db/index.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './project-db';+export * from './global-db';+export * from './schemas';diff --git a/apps/web/src/components/engine/db/migrations.ts b/apps/web/src/components/engine/db/migrations.tsnew file mode 100644index 00000000..f7ecfceb--- /dev/null+++ b/apps/web/src/components/engine/db/migrations.ts@@ -0,0 +1,439 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type * as idb from 'idb';+import type { DBEntity } from '../types';+import type { EngineDBSchema } from './project-db';++type Transaction = idb.IDBPTransaction<EngineDBSchema, ("entities" | "assets" | "folders" | "fonts" | "world")[], "versionchange">;++const LEGACY_FPS = 30;++export async function migrateToV2(tx: Transaction) {+ // v1 → v2: rename time/frame fields and convert seconds → frames.+ // Mappings:+ // Workarea.start (s) → Workarea.startFrame (f)+ // Workarea.end (s) → Workarea.stopFrame (f)+ // Time.delay (s) → Time.delayInFrames (f)+ // Time.trimStart (s) → Time.trimStartFrame (f)+ // Time.trimEnd (s) → Time.trimEndFrame (f)+ // Timeline.currentTime (s) → Timeline.currentTimeInSeconds (rename only)+ // Transition.duration (s) → Transition.durationInFrames (f)+ // Animation.duration (s) → Animation.durationInFrames (f)+ // Keyframe.time (s) → Keyframe.frame (f)+ const store = tx.objectStore('entities');+ let cursor = await store.openCursor();+ while (cursor) {+ const record = cursor.value as DBEntity & {+ Workarea?: { start?: number; end?: number; startFrame?: number; stopFrame?: number };+ Time?: {+ delay?: number; trimStart?: number; trimEnd?: number;+ delayInFrames?: number; trimStartFrame?: number; trimEndFrame?: number;+ playbackRate?: number;+ };+ Timeline?: { currentTime?: number; currentTimeInSeconds?: number; loop?: number };+ Transition?: { type?: number; duration?: number; durationInFrames?: number };+ Animation?: { type?: number; duration?: number; durationInFrames?: number; phase?: number };+ Keyframe?: { time?: number; frame?: number; value?: number; property?: string; easing?: string };+ };+ let changed = false;++ if (record.Workarea) {+ if (record.Workarea.start !== undefined) {+ record.Workarea.startFrame = Math.round(record.Workarea.start * LEGACY_FPS);+ delete record.Workarea.start;+ changed = true;+ }+ if (record.Workarea.end !== undefined) {+ record.Workarea.stopFrame = Math.round(record.Workarea.end * LEGACY_FPS);+ delete record.Workarea.end;+ changed = true;+ }+ }++ if (record.Time) {+ if (record.Time.delay !== undefined) {+ record.Time.delayInFrames = Math.round(record.Time.delay * LEGACY_FPS);+ delete record.Time.delay;+ changed = true;+ }+ if (record.Time.trimStart !== undefined) {+ record.Time.trimStartFrame = Math.round(record.Time.trimStart * LEGACY_FPS);+ delete record.Time.trimStart;+ changed = true;+ }+ if (record.Time.trimEnd !== undefined) {+ record.Time.trimEndFrame = Math.round(record.Time.trimEnd * LEGACY_FPS);+ delete record.Time.trimEnd;+ changed = true;+ }+ }++ if (record.Timeline && record.Timeline.currentTime !== undefined) {+ record.Timeline.currentTimeInSeconds = record.Timeline.currentTime;+ delete record.Timeline.currentTime;+ changed = true;+ }++ if (record.Transition && record.Transition.duration !== undefined) {+ record.Transition.durationInFrames = Math.round(record.Transition.duration * LEGACY_FPS);+ delete record.Transition.duration;+ changed = true;+ }++ if (record.Animation && record.Animation.duration !== undefined) {+ record.Animation.durationInFrames = Math.round(record.Animation.duration * LEGACY_FPS);+ delete record.Animation.duration;+ changed = true;+ }++ if (record.Keyframe && record.Keyframe.time !== undefined) {+ record.Keyframe.frame = Math.round(record.Keyframe.time * LEGACY_FPS);+ delete record.Keyframe.time;+ changed = true;+ }++ if (changed) {+ await cursor.update(record);+ }+ cursor = await cursor.continue();+ }+}++/** Legacy stage entity id used before the v3 refactor. */+const LEGACY_STAGE_EID = 1;++/**+ * v2 → v3: drop the deprecated stage entity (eid=1) and unparent anything+ * that pointed at it. Removing STAGE=0 from the NodeType enum also shifts+ * the remaining values down by one, so Node.type on every surviving record+ * is decremented to match. Camera and background fall back to defaults on+ * the next load — we don't bother carrying the stage's values over.+ */+export async function migrateToV3(tx: Transaction) {+ const entities = tx.objectStore('entities');++ let cursor = await entities.openCursor();+ while (cursor) {+ const record = cursor.value as DBEntity & { Node?: { type?: number } };++ if (record.eid === LEGACY_STAGE_EID) {+ await cursor.delete();+ } else {+ let changed = false;+ if (record.ChildOf === LEGACY_STAGE_EID) {+ delete record.ChildOf;+ changed = true;+ }+ if (record.Node?.type !== undefined && record.Node.type > 0) {+ record.Node.type -= 1;+ changed = true;+ }+ if (changed) await cursor.update(record);+ }++ cursor = await cursor.continue();+ }+}++/**+ * v4 → v5: drop the Tracks model. Each clip becomes its own layer (motion-+ * graphics style). For each entity record:+ * - Rename `TrackIndex` → `ItemIndex` (preserving the integer value).+ * - Drop the scene-level `Tracks` payload entirely — per-track mute/hide/+ * volume/height are not preserved.+ * - Assign `ClipHeight = DEFAULT_CLIP_HEIGHT` to every Node entity so the+ * new render path has a height to fall back on.+ * - Rename `Timeline` → `Playback`, keeping only `loop`. Time-tracking fields+ * (currentTimeInSeconds, etc.) moved to Computed and are recomputed+ * at runtime, so we drop any residual values from older shapes.+ *+ * Clips that previously shared a TrackIndex will share an ItemIndex after the+ * rename. In the new model that means they stack on the same row visually+ * (overlapping); the user can drag to fix.+ */+const DEFAULT_CLIP_HEIGHT_V5 = 32;+/** NodeType.SCENE — pinned so this migration survives enum reordering. */+const SCENE_NODE_TYPE_V5 = 0;+type LegacyEntity = DBEntity & {+ TrackIndex?: number;+ Tracks?: unknown;+ Timeline?: { loop?: number };+ Workarea?: { startFrame?: number; stopFrame?: number };+ Time?: {+ delayInFrames?: number;+ trimStartFrame?: number;+ trimEndFrame?: number;+ playbackRate?: number;+ mode?: number;+ };+ Node?: { type?: number };+ DelayInFrames?: number;+ PlaybackRate?: number;+ Trim?: { startFrame?: number; endFrame?: number };+};+export async function migrateToV5(tx: Transaction) {+ const entities = tx.objectStore('entities');+ let cursor = await entities.openCursor();+ while (cursor) {+ const record = cursor.value as LegacyEntity;+ let changed = false;++ if (record.TrackIndex !== undefined) {+ record.ItemIndex = record.TrackIndex;+ delete record.TrackIndex;+ changed = true;+ }++ if (record.Tracks !== undefined) {+ delete record.Tracks;+ changed = true;+ }++ if (record.Node !== undefined && record.ClipHeight === undefined) {+ record.ClipHeight = DEFAULT_CLIP_HEIGHT_V5;+ changed = true;+ }++ if (record.Timeline !== undefined) {+ record.Playback = { loop: record.Timeline.loop ?? 1 };+ delete record.Timeline;+ changed = true;+ }++ // Split the old Time record into separate scalar components plus an+ // optional Trim. The old Time held both placement (delay, rate) and+ // explicit bounds (trimStart, trimEnd); bounds now live in Trim, whose+ // absence means "auto-fit" (scenes) or "no inherent duration" (clips).+ if (record.Time) {+ record.DelayInFrames = record.Time.delayInFrames ?? 0;+ record.PlaybackRate = record.Time.playbackRate ?? 1;+ const isScene = record.Node?.type === SCENE_NODE_TYPE_V5;+ const hasExplicitTrim =+ !isScene ||+ record.Workarea !== undefined ||+ record.Time.mode === 0;+ if (hasExplicitTrim) {+ record.Trim = {+ startFrame: record.Workarea?.startFrame ?? record.Time.trimStartFrame ?? 0,+ endFrame: record.Workarea?.stopFrame ?? record.Time.trimEndFrame ?? 0,+ };+ }+ delete record.Time;+ changed = true;+ }++ if (record.Workarea) {+ delete record.Workarea;+ changed = true;+ }++ if (changed) await cursor.update(record);+ cursor = await cursor.continue();+ }+}++/** FillType enum value for SOLID — pinned to a constant so this migration+ * keeps working if the runtime enum is later reordered. */+const SOLID_FILL_TYPE = 0;++/**+ * v5 → v6: drop the `Node` and `Fill` typed components in favour of flat+ * arrays and tag components.+ *+ * Node = { type } (NodeType enum) → Geometry = number (RECT|TEXT)+ * + Group / Audio tags as needed+ * + ClipsContent for scenes+ * Fill = { type } (FillType enum) → Paint = number (PaintType enum)+ *+ * Old NodeType values are pinned below — they reflect the v5 enum order+ * (SCENE=0, SHAPE=1, TEXT=2, AUDIO=3, CAPTION=4, GROUP=5) and won't move+ * even if the live enum is later renamed/removed.+ *+ * The mapping (chosen with the user):+ * SCENE → Geometry=RECT, +Scene, +ClipsContent+ * SHAPE → Geometry=RECT+ * TEXT → Geometry=TEXT+ * AUDIO → Geometry=RECT, +Audio+ * CAPTION → Geometry=TEXT, + ensure Caption preset component is present+ * GROUP → Geometry=RECT, +Group+ *+ * FillType values transfer 1:1 (no reordering) — WAVEFORM is appended to+ * PaintType but isn't emitted by any legacy data. We just copy the integer over.+ */+const V6_NODE_TYPE_SCENE = 0;+const V6_NODE_TYPE_SHAPE = 1;+const V6_NODE_TYPE_TEXT = 2;+const V6_NODE_TYPE_AUDIO = 3;+const V6_NODE_TYPE_CAPTION = 4;+const V6_NODE_TYPE_GROUP = 5;++const V6_GEOMETRY_RECT = 0;+const V6_GEOMETRY_TEXT = 1;++export async function migrateToV6(tx: Transaction) {+ const entities = tx.objectStore('entities');++ let cursor = await entities.openCursor();+ while (cursor) {+ const record = cursor.value as DBEntity & {+ Node?: { type?: number };+ Fill?: { type?: number };+ };+ let changed = false;++ if (record.Node !== undefined) {+ const nodeType = record.Node.type ?? V6_NODE_TYPE_SHAPE;++ // Both TEXT and CAPTION nodes get a text geometry — captions are+ // just text nodes with a Caption preset component attached.+ record.Geometry = nodeType === V6_NODE_TYPE_TEXT || nodeType === V6_NODE_TYPE_CAPTION+ ? V6_GEOMETRY_TEXT+ : V6_GEOMETRY_RECT;++ if (nodeType === V6_NODE_TYPE_SCENE) {+ record.Scene = {};+ record.ClipsContent = true;+ } else if (nodeType === V6_NODE_TYPE_GROUP) {+ record.Group = {};+ } else if (nodeType === V6_NODE_TYPE_AUDIO) {+ record.Audio = {};+ } else if (nodeType === V6_NODE_TYPE_CAPTION) {+ // Caption preset config is added on-demand by the sidebar; ensure+ // it's present so the new model can detect captions via hasComponent.+ if (record.Caption === undefined) {+ record.Caption = {};+ }+ }++ delete record.Node;+ changed = true;+ }++ if (record.Keyframe !== undefined) {+ delete record.Keyframe;+ changed = true;+ }++ if (record.Fill !== undefined) {+ record.Paint = record.Fill.type ?? 0;+ delete record.Fill;+ changed = true;+ }++ if (changed) {+ await cursor.update(record);+ }+ cursor = await cursor.continue();+ }+}++/**+ * v3 → v4: gradient fills changed shape. The old `ColorStops` aggregate (parallel+ * positions/colors/opacities arrays on the fill entity) was replaced by per-stop+ * `ColorStop` child entities. Rather than migrate the stops one-by-one (which+ * would need to allocate fresh eids and add ChildOf relations), we degrade+ * gradient fills to solid fills using the first stop's color. Users can rebuild+ * the gradient in the picker if needed.+ */+export async function migrateToV4(tx: Transaction) {+ const entities = tx.objectStore('entities');++ let cursor = await entities.openCursor();+ while (cursor) {+ const record = cursor.value as DBEntity & {+ ColorStops?: { positions?: number[]; colors?: number[]; opacities?: number[] };+ Fill?: { type?: number };+ };++ if (record.ColorStops !== undefined) {+ const firstColor = record.ColorStops.colors?.[0] ?? 0xFFFFFF;+ record.Color = firstColor;+ record.Fill = { type: SOLID_FILL_TYPE };+ delete record.ColorStops;+ await cursor.update(record);+ }++ cursor = await cursor.continue();+ }+}++/**+ * v6 → v7: drop the redundant `Frame`/`InFrames` unit suffix from time fields+ * now that frames are the default unit. Pure key renames — values are already+ * in frames, so no numeric conversion is needed.+ * DelayInFrames → Delay+ * Trim.startFrame → Trim.start+ * Trim.endFrame → Trim.end+ * Transition.durationInFrames → Transition.duration+ * Animation.durationInFrames → Animation.duration+ * Animation.delayInFrames → Animation.delay+ * Keyframe.frame → Keyframe.time+ */+export async function migrateToV7(tx: Transaction) {+ const entities = tx.objectStore('entities');+ let cursor = await entities.openCursor();+ while (cursor) {+ const record = cursor.value as DBEntity & {+ DelayInFrames?: number;+ Delay?: number;+ Trim?: { startFrame?: number; endFrame?: number; start?: number; end?: number };+ Transition?: { type?: number; durationInFrames?: number; duration?: number };+ Animation?: {+ type?: number; phase?: number;+ durationInFrames?: number; delayInFrames?: number;+ duration?: number; delay?: number;+ };+ Keyframe?: { frame?: number; time?: number; value?: number; easing?: string };+ };+ let changed = false;++ if (record.DelayInFrames !== undefined) {+ record.Delay = record.DelayInFrames;+ delete record.DelayInFrames;+ changed = true;+ }++ if (record.Trim) {+ if (record.Trim.startFrame !== undefined) {+ record.Trim.start = record.Trim.startFrame;+ delete record.Trim.startFrame;+ changed = true;+ }+ if (record.Trim.endFrame !== undefined) {+ record.Trim.end = record.Trim.endFrame;+ delete record.Trim.endFrame;+ changed = true;+ }+ }++ if (record.Transition && record.Transition.durationInFrames !== undefined) {+ record.Transition.duration = record.Transition.durationInFrames;+ delete record.Transition.durationInFrames;+ changed = true;+ }++ if (record.Animation) {+ if (record.Animation.durationInFrames !== undefined) {+ record.Animation.duration = record.Animation.durationInFrames;+ delete record.Animation.durationInFrames;+ changed = true;+ }+ if (record.Animation.delayInFrames !== undefined) {+ record.Animation.delay = record.Animation.delayInFrames;+ delete record.Animation.delayInFrames;+ changed = true;+ }+ }++ if (record.Keyframe && record.Keyframe.frame !== undefined) {+ record.Keyframe.time = record.Keyframe.frame;+ delete record.Keyframe.frame;+ changed = true;+ }++ if (changed) await cursor.update(record);+ cursor = await cursor.continue();+ }+}diff --git a/apps/web/src/components/engine/db/project-db.ts b/apps/web/src/components/engine/db/project-db.tsnew file mode 100644index 00000000..2aa4b0d9--- /dev/null+++ b/apps/web/src/components/engine/db/project-db.ts@@ -0,0 +1,315 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * IndexedDB persistence for the ECS engine.+ *+ * Each project gets its own database (`db-{projectId}`).+ * Entity records are stored as plain objects keyed by numeric eid+ * (converted to string for IDB). World-level state (camera, background)+ * lives in the `world` store under a single fixed key.+ *+ * A `WriteQueue` batches put/delete operations via requestIdleCallback+ * so persistence never blocks the render loop.+ */++import { deleteDB, openDB } from 'idb';+import { serializeEntity } from '../api';+import { migrateToV2, migrateToV3, migrateToV4, migrateToV5, migrateToV6, migrateToV7 } from './migrations';++import type * as idb from 'idb';+import type { DBEntity, Camera2D } from '../types';+import type { EngineWorld } from '../api/world';+import type { Asset, Folder } from './schemas';+import type { FontSource } from '../font';++if (typeof window !== 'undefined' && typeof requestIdleCallback !== 'function') {+ Object.assign(window, { requestIdleCallback: requestAnimationFrame });+}++export const WORLD_STATE_KEY = 'world';+export const DEFAULT_PROJECT_ID = 'V1StGXR8_Z5jdHi6B-myT';++export type DBWorldState = {+ id: string; // always WORLD_STATE_KEY+ camera: Camera2D;+ background: number;+};++export interface EngineDBSchema extends idb.DBSchema {+ entities: {+ value: DBEntity;+ key: string;+ };+ assets: {+ value: Asset;+ key: string;+ };+ folders: {+ value: Folder;+ key: string;+ };+ fonts: {+ value: FontSource;+ key: string;+ };+ world: {+ value: DBWorldState;+ key: string;+ };+}++const dbPromises = new Map<string, Promise<idb.IDBPDatabase<EngineDBSchema>>>();++const STORE_KEY_PATHS: Record<string, string> = {+ entities: 'id',+ assets: 'id',+ folders: 'id',+ fonts: 'source',+ world: 'id',+};++/**+ * In-memory stand-in for a project database, covering the subset of the idb+ * API the engine uses. Backs the session-only default project.+ */+function createMemoryDB(): idb.IDBPDatabase<EngineDBSchema> {+ const stores = new Map<string, Map<string, unknown>>(+ Object.keys(STORE_KEY_PATHS).map((name) => [name, new Map()]),+ );++ const objectStore = (name: string) => {+ const store = stores.get(name)!;+ return {+ put: async (value: Record<string, unknown>) => {+ const key = String(value[STORE_KEY_PATHS[name]!]);+ store.set(key, value);+ return key;+ },+ delete: async (key: string) => {+ store.delete(key);+ },+ };+ };++ return {+ get: async (name: string, key: string) => stores.get(name)!.get(key),+ getAll: async (name: string) => Array.from(stores.get(name)!.values()),+ put: (name: string, value: Record<string, unknown>) => objectStore(name).put(value),+ delete: (name: string, key: string) => objectStore(name).delete(key),+ transaction: () => ({ objectStore, done: Promise.resolve() }),+ close: () => { },+ } as unknown as idb.IDBPDatabase<EngineDBSchema>;+}++export function getProjectDB(projectId: string, version = 8) {+ const dbName = `db-v2-${projectId}`;+ let cacheKey = `${dbName}@${version}`;++ if (projectId === DEFAULT_PROJECT_ID) {+ cacheKey = `${dbName}@memory`;+ }++ const cached = dbPromises.get(cacheKey);+ if (cached) return cached;++ if (projectId === DEFAULT_PROJECT_ID) {+ const promise = Promise.resolve(createMemoryDB());+ dbPromises.set(cacheKey, promise);+ return promise;+ }++ const promise = openDB<EngineDBSchema>(dbName, version, {+ async upgrade(db, oldVersion, _newVersion, tx) {+ if (!db.objectStoreNames.contains('entities')) {+ db.createObjectStore('entities', { keyPath: 'id' });+ }+ if (!db.objectStoreNames.contains('assets')) {+ db.createObjectStore('assets', { keyPath: 'id' });+ }+ if (!db.objectStoreNames.contains('folders')) {+ db.createObjectStore('folders', { keyPath: 'id' });+ }+ if (!db.objectStoreNames.contains('fonts')) {+ db.createObjectStore('fonts', { keyPath: 'source' });+ }+ if (!db.objectStoreNames.contains('world')) {+ db.createObjectStore('world', { keyPath: 'id' });+ }++ if (oldVersion < 2) {+ await migrateToV2(tx);+ }+ if (oldVersion < 3) {+ await migrateToV3(tx);+ }+ if (oldVersion < 4) {+ await migrateToV4(tx);+ }+ if (oldVersion < 5) {+ await migrateToV5(tx);+ }+ if (oldVersion < 6) {+ await migrateToV6(tx);+ }+ if (oldVersion < 7) {+ await migrateToV7(tx);+ }+ },+ });++ dbPromises.set(cacheKey, promise);+ return promise;+}++/**+ * Deletes the per-project IndexedDB database and clears any cached DB handles.+ */+export async function deleteProjectDB(projectId: string): Promise<void> {+ const dbName = `db-v2-${projectId}`;+ const cachePrefix = `${dbName}@`;++ for (const [cacheKey, dbPromise] of dbPromises) {+ if (!cacheKey.startsWith(cachePrefix)) continue;++ try {+ const db = await dbPromise;+ db.close();+ } catch {+ // Ignore failed opens; cache still needs to be cleared.+ }++ dbPromises.delete(cacheKey);+ }++ await deleteDB(dbName);+}++// ─── Write queue ─────────────────────────────────────────────────++/**+ * Batches put and delete operations into single IDB transactions.+ * Uses requestIdleCallback so writes never block the main thread.+ */+export class WriteQueue {+ private puts = new Map<string, DBEntity>();+ private deletes = new Set<string>();+ private isWriting = false;+ private db: Promise<idb.IDBPDatabase<EngineDBSchema>>;++ public constructor(db: Promise<idb.IDBPDatabase<EngineDBSchema>>) {+ this.db = db;+ }++ /** Enqueue an entity upsert. */+ public scheduleWrite(world: EngineWorld, eid?: number): void {+ if (!eid) return;++ this.deletes.delete(eid.toString());+ this.puts.set(eid.toString(), serializeEntity(world, eid));+ requestIdleCallback(this.flush.bind(this));+ }++ /** Enqueue an entity deletion. */+ public scheduleDelete(_world: EngineWorld, eid?: number): void {+ if (!eid) return;++ this.puts.delete(eid.toString());+ this.deletes.add(eid.toString());+ requestIdleCallback(this.flush.bind(this));+ }++ /** Flush all pending puts and deletes in one transaction. */+ public async flush(): Promise<void> {+ const db = await this.db;++ if (this.isWriting || (this.puts.size === 0 && this.deletes.size === 0)) {+ return;+ }++ try {+ this.isWriting = true;++ const putData = Array.from(this.puts.values());+ const deleteKeys = Array.from(this.deletes);+ this.puts.clear();+ this.deletes.clear();++ const tx = db.transaction('entities', 'readwrite');++ await Promise.all([+ ...putData.map(data => tx.objectStore('entities').put(data)),+ ...deleteKeys.map(key => tx.objectStore('entities').delete(key)),+ tx.done,+ ]);++ // Re-check in case new items were queued during the await+ requestIdleCallback(this.flush.bind(this));+ } catch (e) {+ console.error('[engine] WriteQueue flush failed:', e);+ } finally {+ this.isWriting = false;+ }+ }+}++/**+ * Persists the single world-state record (camera + background). Unlike the+ * entity WriteQueue, there's no key-space to track — every schedule call+ * replaces the same row, so we just remember which world is dirty and snapshot+ * its current state at flush time.+ */+export class WorldStateWriter {+ private dirty: EngineWorld | null = null;+ private isWriting = false;+ private db: Promise<idb.IDBPDatabase<EngineDBSchema>>;++ public constructor(db: Promise<idb.IDBPDatabase<EngineDBSchema>>) {+ this.db = db;+ }++ /** Schedule a write of the current world state. Rapid calls coalesce. */+ public schedule(world: EngineWorld): void {+ this.dirty = world;+ requestIdleCallback(this.flush.bind(this));+ }++ private async flush(): Promise<void> {+ if (this.isWriting || !this.dirty) return;++ const world = this.dirty;+ this.dirty = null;+ this.isWriting = true;++ try {+ const db = await this.db;+ await db.put('world', {+ id: WORLD_STATE_KEY,+ camera: { ...world.camera },+ background: world.background,+ });+ } catch (e) {+ console.error('[engine] WorldStateWriter flush failed:', e);+ } finally {+ this.isWriting = false;+ // Something dirtied us during the await — re-queue.+ if (this.dirty) requestIdleCallback(this.flush.bind(this));+ }+ }+}++export type Store = {+ queue: WriteQueue;+ worldState: WorldStateWriter;+ db: Promise<idb.IDBPDatabase<EngineDBSchema>>;+};++export function createStore(projectId: string): Store {+ const db = getProjectDB(projectId);+ return {+ queue: new WriteQueue(db),+ worldState: new WorldStateWriter(db),+ db,+ };+}diff --git a/apps/web/src/components/engine/db/schemas.ts b/apps/web/src/components/engine/db/schemas.tsnew file mode 100644index 00000000..088ad3dc--- /dev/null+++ b/apps/web/src/components/engine/db/schemas.ts@@ -0,0 +1,142 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { z } from "zod";+import { transcriptionOutput } from "@diffusionstudio/api-contract";+import { ElectronFileHandle } from "@/lib/electron-file-handle";++export const aspectRatioSchema = z.enum(["1:1", "4:3", "3:4", "16:9", "9:16"]);+export type AspectRatio = z.infer<typeof aspectRatioSchema>;++export const imageGenerationConfigSchema = z.object({+ mode: z.literal("IMAGE"),+ model: z.string(),+ prompt: z.string(),+ aspectRatio: aspectRatioSchema,+ count: z.number().int().min(1).max(4),+ imageRefIds: z.array(z.string()).optional(),+});++export const videoGenerationConfigSchema = z.object({+ mode: z.literal("VIDEO"),+ model: z.string(),+ prompt: z.string(),+ aspectRatio: aspectRatioSchema,+ duration: z.number().int().min(1),+ generateAudio: z.boolean().optional(),+ startFrameImageId: z.string().optional(),+ endFrameImageId: z.string().optional(),+});++export const voiceGenerationConfigSchema = z.object({+ mode: z.literal("VOICE"),+ model: z.string(),+ prompt: z.string(),+ voice: z.string(),+});++export const audioGenerationConfigSchema = z.object({+ mode: z.literal("AUDIO"),+ model: z.string(),+ prompt: z.string(),+});++export const generationConfigSchema = z.discriminatedUnion("mode", [+ imageGenerationConfigSchema,+ videoGenerationConfigSchema,+ voiceGenerationConfigSchema,+ audioGenerationConfigSchema,+]);++export type ImageGenerationConfig = z.infer<typeof imageGenerationConfigSchema>;+export type VideoGenerationConfig = z.infer<typeof videoGenerationConfigSchema>;+export type VoiceGenerationConfig = z.infer<typeof voiceGenerationConfigSchema>;+export type AudioGenerationConfig = z.infer<typeof audioGenerationConfigSchema>;+export type GenerationConfig = z.infer<typeof generationConfigSchema>;++export const folderSchema = z.object({+ id: z.string(),+ name: z.string(),+ parentId: z.string().nullable(),+ createdAt: z.iso.datetime(),+});++export type Folder = z.infer<typeof folderSchema>;++export const assetBaseSchema = z.object({+ id: z.string(),+ hash: z.string(),+ createdAt: z.iso.datetime(),+ lastModified: z.number().optional(),+ name: z.string(),+ mimeType: z.string(),+ size: z.number().optional(),+ handle: z.union([+ z.instanceof(FileSystemFileHandle),+ z.instanceof(ElectronFileHandle),+ ]),+ generationId: z.string().nullable().optional(),+ folderId: z.string().nullable().optional(),+});++export const imageAssetSchema = assetBaseSchema.extend({+ type: z.literal('IMAGE'),+ width: z.number(),+ height: z.number(),+});++export type ImageAsset = z.infer<typeof imageAssetSchema>;++export const audioAssetSchema = assetBaseSchema.extend({+ type: z.literal('AUDIO'),+ duration: z.number(),+ sampleRate: z.number(),+ channels: z.number(),+ transcript: transcriptionOutput.optional(),+});++export type AudioAsset = z.infer<typeof audioAssetSchema>;++export const videoAssetSchema = assetBaseSchema.extend({+ type: z.literal('VIDEO'),+ duration: z.number(),+ width: z.number(),+ height: z.number(),+ frameRate: z.number(),+ bitRate: z.number(),+ sampleRate: z.number().optional(),+ channels: z.number().optional(),+ transcript: transcriptionOutput.optional(),+});++export type VideoAsset = z.infer<typeof videoAssetSchema>;++export const transcriptAssetSchema = assetBaseSchema.extend({+ type: z.literal('TRANSCRIPT'),+ sourceHash: z.string().optional(),+});++export type TranscriptAsset = z.infer<typeof transcriptAssetSchema>;++// `handle` points to the first frame's file (so generic preview/thumbnail+export const sequenceAssetSchema = assetBaseSchema.extend({+ type: z.literal('SEQUENCE'),+ width: z.number(),+ height: z.number(),+ frameRate: z.number(),+ duration: z.number(),+ directoryHandle: z.instanceof(FileSystemDirectoryHandle),+});++export type SequenceAsset = z.infer<typeof sequenceAssetSchema>;++export const assetSchema = z.discriminatedUnion('type', [+ imageAssetSchema,+ audioAssetSchema,+ videoAssetSchema,+ transcriptAssetSchema,+ sequenceAssetSchema,+]);++export type Asset = z.infer<typeof assetSchema>;diff --git a/apps/web/src/components/engine/decoders/audio-peaks.ts b/apps/web/src/components/engine/decoders/audio-peaks.tsnew file mode 100644index 00000000..b9d4ef1a--- /dev/null+++ b/apps/web/src/components/engine/decoders/audio-peaks.ts@@ -0,0 +1,128 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { AudioSampleSink } from 'mediabunny';+import { getAudioTrack } from './audio';++import type { AudioAsset, VideoAsset } from '../db';++const peakCache = new Map<string, Uint8ClampedArray>();+const inflight = new Map<string, Promise<Uint8ClampedArray | null>>();++const TARGET_BARS = 128;++export function clearAudioPeaksCache() {+ peakCache.clear();+ inflight.clear();+}++/**+ * Synchronous, allocation-free peak lookup for hot paths (render loop).+ * Returns cached peaks or `null`. Kicks off a build on first call.+ */+export function getAudioPeaks(+ asset: AudioAsset | VideoAsset,+): Uint8ClampedArray | null {+ const key = asset.id;++ const cached = peakCache.get(key);+ if (cached) return cached;++ if (!inflight.has(key)) {+ inflight.set(key, buildPeaks(key, asset));+ }++ return null;+}++/**+ * Async peak lookup for UI components that can await.+ * Returns peaks from cache or waits for the build to finish.+ */+export async function getAudioPeaksAsync(+ asset: AudioAsset | VideoAsset,+): Promise<Uint8ClampedArray | null> {+ const key = asset.id;++ const cached = peakCache.get(key);+ if (cached) return cached;++ let promise = inflight.get(key);+ if (!promise) {+ promise = buildPeaks(key, asset);+ inflight.set(key, promise);+ }++ return promise;+}++async function buildPeaks(+ key: string,+ asset: AudioAsset | VideoAsset,+): Promise<Uint8ClampedArray | null> {+ try {+ const track = await getAudioTrack(asset);+ if (!track) return null;++ const sink = new AudioSampleSink(track);+ const chunks: Uint8ClampedArray[] = [];++ for await (const sample of sink.samples()) {+ let floats: Float32Array;+ let numChannels: number;+ let numFrames: number;+ try {+ const size = sample.allocationSize({ format: 'f32', planeIndex: 0 });+ floats = new Float32Array(size / Float32Array.BYTES_PER_ELEMENT);+ sample.copyTo(floats, { format: 'f32', planeIndex: 0 });++ numChannels = sample.numberOfChannels;+ numFrames = floats.length / numChannels;+ } finally {+ sample.close();+ }++ const framePeaks = new Uint8ClampedArray(numFrames);+ for (let f = 0; f < numFrames; f++) {+ let max = 0;+ for (let ch = 0; ch < numChannels; ch++) {+ max = Math.max(max, Math.pow(Math.abs(floats[f * numChannels + ch]), 0.8));+ }+ framePeaks[f] = Math.floor(max * 255);+ }+ chunks.push(framePeaks);+ }++ if (chunks.length === 0) return null;++ const totalFrames = chunks.reduce((s, c) => s + c.length, 0);+ const merged = new Uint8ClampedArray(totalFrames);+ let offset = 0;+ for (const chunk of chunks) {+ merged.set(chunk, offset);+ offset += chunk.length;+ }++ const peaks = new Uint8ClampedArray(TARGET_BARS);+ const ratio = totalFrames / TARGET_BARS;++ for (let i = 0; i < TARGET_BARS; i++) {+ const start = Math.floor(i * ratio);+ const end = Math.floor((i + 1) * ratio);+ let max = 0;+ for (let j = start; j < end && j < totalFrames; j++) {+ max = Math.max(max, merged[j]);+ }+ peaks[i] = max;+ }++ peakCache.set(key, peaks);+ return peaks;+ } catch (e) {+ console.error('Failed to build audio peaks', e);+ return null;+ } finally {+ inflight.delete(key);+ }+}diff --git a/apps/web/src/components/engine/decoders/audio.ts b/apps/web/src/components/engine/decoders/audio.tsnew file mode 100644index 00000000..cd6d0a57--- /dev/null+++ b/apps/web/src/components/engine/decoders/audio.ts@@ -0,0 +1,277 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Input, ALL_FORMATS, BlobSource, AudioBufferSink, type WrappedAudioBuffer, type InputAudioTrack } from 'mediabunny';+import { AsyncMutex } from '@/utils';+import { assert } from '@/utils';+import { TimeStretcher } from './time-stretcher';+import { addComponent } from '../api/events';++import type { EngineWorld } from '../api/world';+import type { AudioAsset, VideoAsset } from '../db';+import type { AudioBus } from '../services/audio-bus';++const audioTrackCache = new Map<string, Promise<InputAudioTrack | null>>();++export function clearAudioTrackCache() {+ audioTrackCache.clear();+}++/**+ * Keyed by asset ID so multiple decoders for the same source+ * audio reuse a single Input + InputAudioTrack.+ */+export function getAudioTrack(source: AudioAsset | VideoAsset) {+ let promise = audioTrackCache.get(source.id);+ if (promise) return promise;++ promise = (async () => {+ try {+ const blob = await source.handle.getFile();+ const input = new Input({+ formats: ALL_FORMATS,+ source: new BlobSource(blob),+ });+ return await input.getPrimaryAudioTrack();+ } catch {+ audioTrackCache.delete(source.id);+ return null;+ }+ })();++ audioTrackCache.set(source.id, promise);+ return promise;+}++type PlayOptions = {+ relativeFrom: number;+ relativeTo: number;+ trimStart: number;+ trimEnd: number;+ playbackRate: number;+ currentTime: number;+ relativeDelay: number;+}++export class AudioDecoder {+ readonly assetId: string;++ private readonly asset: AudioAsset | VideoAsset;+ private readonly mutex = new AsyncMutex();+ private readonly audioNodes = new Set<AudioBufferSourceNode>();++ private iterator: AsyncGenerator<WrappedAudioBuffer, void, unknown> | null = null;+ private firstBuffer: WrappedAudioBuffer | null = null;+ private lastBuffer: WrappedAudioBuffer | null = null;+ private stretcher: TimeStretcher | null = null;+ private nextTimestamp = 0;+ private audioTrack: InputAudioTrack | null = null;+ private sink!: AudioBufferSink;++ public ready = false;++ public constructor(asset: AudioAsset | VideoAsset) {+ this.asset = asset;+ this.assetId = asset.id;+ }++ public async init() {+ this.audioTrack = await getAudioTrack(this.asset);+ assert(this.audioTrack, 'Audio track not found');+ this.sink = new AudioBufferSink(this.audioTrack);+ this.ready = true;+ }++ private renderData(bus: AudioBus, options: PlayOptions, data: Float32Array[] | null, sampleRate: number) {+ if (!data) {+ return;+ }++ const { relativeDelay, playbackRate } = options;++ const trimStart = options.trimStart / playbackRate;+ const trimEnd = options.trimEnd / playbackRate;+ const context = bus.context;+ const input = bus.input;++ const newBuffer = new AudioBuffer({+ length: data[0].length,+ sampleRate,+ numberOfChannels: data.length,+ });+ for (let c = 0; c < data.length; c++) {+ newBuffer.copyToChannel(data[c] as Float32Array<ArrayBuffer>, c);+ }++ const newBufferTimestamp = this.nextTimestamp;+ this.nextTimestamp += newBuffer.duration;++ let start = relativeDelay + newBufferTimestamp;+ let offset = 0;+ let duration = newBuffer.duration;++ // Check if the buffer goes beyond the clip's end, and if so, truncate it+ if (newBufferTimestamp + duration > trimEnd) {+ duration = trimEnd - newBufferTimestamp;+ }++ // Check if the buffer starts before the clip's start, and if so, trim the start+ if (newBufferTimestamp < trimStart) {+ start += trimStart - newBufferTimestamp;+ offset += trimStart - newBufferTimestamp;+ }++ // Check if the start is before the context's current time (which is illegal)+ if (start < context.currentTime) {+ offset += context.currentTime - start;+ start = context.currentTime;+ }++ // Dumb, DIRTY hack. For some reason (probably due to some bug in the Web Audio API), sometimes a clicking noise+ // can be heard on the boundary between two audio clips. By shifting all audio buffers by half a sample, this is+ // typically avoided. My guess is that it forces the renderer into a sub-sample rendering algorithm which doesn't+ // have the buggy behavior.+ start += 0.5 / context.sampleRate;++ duration -= offset;+ duration = Math.max(0, duration);++ const bufferSource = context.createBufferSource();+ bufferSource.buffer = newBuffer;+ bufferSource.connect(input);+ bufferSource.start(start, offset, duration);++ this.audioNodes.add(bufferSource);+ bufferSource.onended = () => this.audioNodes.delete(bufferSource);+ }++ public async playTo(bus: AudioBus | null, options: PlayOptions) {+ if (!this.asset.channels || !this.asset.sampleRate || !bus) {+ // Asset has no audio data+ return;+ }++ const { relativeFrom, relativeTo } = options;++ const release = await this.mutex.acquire();++ const firstTs = this.firstBuffer?.timestamp ?? Number.POSITIVE_INFINITY;+ const lastTs = this.lastBuffer?.timestamp ?? Number.NEGATIVE_INFINITY;+ const isBufferOutOfRange = relativeFrom < firstTs || lastTs < relativeFrom - 1;++ try {+ if (this.iterator == null || this.stretcher == null || isBufferOutOfRange) {+ // Close the previous iterator so its pre-decoded AudioSamples get released.+ await this.iterator?.return();+ this.iterator = this.sink.buffers(relativeFrom);+ this.firstBuffer = null;+ this.lastBuffer = null;+ this.stretcher = null;+ }++ while (true) {+ const nextBuffer = (await this.iterator.next()).value;+ // Use the actual decoded sample rate if available+ const sampleRate = nextBuffer?.buffer.sampleRate ?? this.asset.sampleRate;+ const numberOfChannels = nextBuffer?.buffer.numberOfChannels ?? this.asset.channels;+ const playbackRate = 1 / options.playbackRate;++ this.stretcher ??= new TimeStretcher(numberOfChannels, sampleRate, playbackRate);++ if (!nextBuffer) {+ this.renderData(bus, options, this.stretcher.finalize(), sampleRate);+ break;+ }++ if (!this.firstBuffer) {+ this.nextTimestamp = nextBuffer.timestamp / options.playbackRate;+ }++ if (this.lastBuffer) {+ const sampleGap = Math.round(+ nextBuffer.timestamp - (this.lastBuffer.timestamp + this.lastBuffer.duration)+ );++ if (sampleGap > 0) {+ this.renderData(+ bus,+ options,+ Array(numberOfChannels).fill(new Float32Array(sampleGap)),+ sampleRate+ );+ }+ }++ this.firstBuffer ??= nextBuffer;+ this.lastBuffer = nextBuffer;++ const buffers: Float32Array[] = [];+ for (let c = 0; c < nextBuffer.buffer.numberOfChannels; c++) {+ const channelData = nextBuffer.buffer.getChannelData(c);+ buffers.push(channelData);+ }++ // TODO: Handle gap in timestamps case++ this.renderData(bus, options, this.stretcher.append(buffers), sampleRate);++ if (nextBuffer.timestamp >= relativeTo) {+ break;+ }+ }+ } finally {+ release();+ }+ }++ public reset() {+ if (!this.iterator) return;++ this.iterator?.return();+ this.iterator = null;+ this.firstBuffer = null;+ this.lastBuffer = null;++ for (const node of this.audioNodes) {+ node.stop();+ }+ this.audioNodes.clear();+ }+}+++type ResolvedAudioDecoder = {+ decoder: AudioDecoder;+ initPromise: Promise<void> | null;+};++export function resolveAudioDecoder(world: EngineWorld, eid: number): ResolvedAudioDecoder | null {+ const AssetId = world.components.AssetId;+ const assetId = AssetId[eid];+ if (!assetId) return null;++ const existing = world.components.AudioDecoder[eid];+ if (existing && existing.assetId === assetId) {+ return {+ decoder: existing,+ initPromise: null,+ };+ };++ // Asset changed — reset old decoder and create a new one.+ if (existing) existing.reset();++ const asset = world.assets.get(assetId);+ if (!asset || (asset.type !== 'AUDIO' && asset.type !== 'VIDEO')) return null;+ if (asset.type === 'VIDEO' && !asset.channels) return null;++ addComponent(world, eid, world.components.AudioDecoder, false);++ const decoder = new AudioDecoder(asset);+ world.components.AudioDecoder[eid] = decoder;+ return {+ decoder,+ initPromise: decoder.init(),+ };+}diff --git a/apps/web/src/components/engine/decoders/caption/cascade.ts b/apps/web/src/components/engine/decoders/caption/cascade.tsnew file mode 100644index 00000000..658a147c--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/cascade.ts@@ -0,0 +1,100 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { CaptionType, PaintType, FontStyle, TextAlign, TextBaseline, TextCase } from '../../components';+import { renderText } from '../../utils/text';+import { loadWebFont } from '../../font/utils';+import { groupBy, findActiveGroup, resolveTranscript } from './utils';+import { getParentEntity, createEntity } from '../../api';+import { appendChild } from '../../api/hierarchy';+import { setComponent } from '../../api/events';+import { resizeEntity } from '../../api/resize';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';++const WIDTH = 800;+const HEIGHT = 200;++export class CascadeCaptionDecoder implements CaptionDecoder {+ public readonly type = CaptionType.CASCADE;+ public groups: ReturnType<typeof groupBy> = [];+ public ready = false;++ private readonly asset: Asset;+ private currentText = '';++ constructor(asset: Asset) {+ this.asset = asset;+ this.init();+ }++ private async init() {+ if (this.ready) return;+ const transcript = await resolveTranscript(this.asset);+ this.groups = groupBy(transcript, { length: 50 });+ this.ready = true;+ }++ public applyStyles(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return;+ const parentHeight = c.Computed.height[parentEid];++ resizeEntity(world, eid, { width: WIDTH, height: HEIGHT });+ setComponent(world, eid, c.Position, { x: 100, y: parentHeight - HEIGHT - 50 });+ setComponent(world, eid, c.TextStyle, {+ fontFamily: 'Inter',+ fontWeight: '300',+ fontSize: 50,+ textAlign: TextAlign.LEFT,+ textBaseline: TextBaseline.TOP,+ fontStyle: FontStyle.NORMAL,+ textCase: TextCase.ORIGINAL,+ leading: 1.2,+ });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0xFFFFFF);+ appendChild(world, fillEid, eid);++ loadWebFont(world, 'Inter');+ }++ public seekTo(world: EngineWorld, eid: number, relativeTime: number): void {+ const groupIndex = findActiveGroup(this.groups, relativeTime);++ if (groupIndex === -1) {+ world.components.Chars[eid] = '';+ this.currentText = '';+ return;+ }++ const group = this.groups[groupIndex];++ // Progressive reveal: only show words that have started+ const text = group+ .filter(word => word.start <= relativeTime)+ .map(w => w.text)+ .join(' ');++ if (text !== this.currentText) {+ this.currentText = text;+ world.components.Chars[eid] = text;+ }+ }++ public draw(world: EngineWorld, eid: number): void {+ renderText(world, eid);+ }++ public dispose(): void {+ this.groups = [];+ this.currentText = '';+ }+}diff --git a/apps/web/src/components/engine/decoders/caption/classic.ts b/apps/web/src/components/engine/decoders/caption/classic.tsnew file mode 100644index 00000000..16522683--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/classic.ts@@ -0,0 +1,112 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { CaptionType, PaintType, FontStyle, TextAlign, TextBaseline, TextCase } from '../../components';+import { renderText } from '../../utils/text';+import { loadWebFont } from '../../font/utils';+import { groupBy, findActiveGroup, resolveTranscript } from './utils';+import { getParentEntity, createEntity } from '../../api';+import { appendChild } from '../../api/hierarchy';+import { addComponent, setComponent } from '../../api/events';+import { resizeEntity } from '../../api/resize';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';++export const CLASSIC_PRESET_WIDTH = 600;+export const CLASSIC_PRESET_HEIGHT = 100;++export class ClassicCaptionDecoder implements CaptionDecoder {+ public readonly type = CaptionType.CLASSIC;+ public groups: ReturnType<typeof groupBy> = [];+ public ready = false;++ private readonly asset: Asset;+ private currentGroupIndex = -1;++ constructor(asset: Asset) {+ this.asset = asset;+ this.init();+ }++ private async init() {+ if (this.ready) return;+ const transcript = await resolveTranscript(this.asset);+ this.groups = groupBy(transcript, { duration: 0.2 });+ this.ready = true;+ }++ public applyStyles(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return;++ const parentWidth = c.Computed.width[parentEid];+ const parentHeight = c.Computed.height[parentEid];++ resizeEntity(world, eid, {+ width: CLASSIC_PRESET_WIDTH,+ height: CLASSIC_PRESET_HEIGHT,+ });++ setComponent(world, eid, c.Position, {+ x: (parentWidth - CLASSIC_PRESET_WIDTH) / 2,+ y: (parentHeight - CLASSIC_PRESET_HEIGHT) / 2,+ });++ setComponent(world, eid, c.TextStyle, {+ fontFamily: 'Urbanist',+ fontWeight: '600',+ fontSize: 62,+ textAlign: TextAlign.CENTER,+ textBaseline: TextBaseline.MIDDLE,+ textCase: TextCase.LOWER,+ fontStyle: FontStyle.NORMAL,+ leading: 1,+ });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0xFFFFFF);+ appendChild(world, fillEid, eid);++ const shadowEid = createEntity(world);+ addComponent(world, shadowEid, c.Shadow);+ setComponent(world, shadowEid, c.Color, 0x000000);+ setComponent(world, shadowEid, c.Appearance, { opacity: 1 });+ setComponent(world, shadowEid, c.Blur, 28);+ setComponent(world, shadowEid, c.Offset, { x: 0, y: 5 });+ appendChild(world, shadowEid, eid);++ loadWebFont(world, 'Urbanist');+ }++ public seekTo(world: EngineWorld, eid: number, relativeTime: number): void {+ const groupIndex = findActiveGroup(this.groups, relativeTime);++ if (groupIndex === -1) {+ world.components.Chars[eid] = '';+ this.currentGroupIndex = -1;+ return;+ }++ const group = this.groups[groupIndex];++ if (groupIndex !== this.currentGroupIndex) {+ this.currentGroupIndex = groupIndex;+ world.components.Chars[eid] = group.map(w => w.text).join(' ');+ }+ }++ public draw(world: EngineWorld, eid: number): void {+ renderText(world, eid);+ }++ public dispose(): void {+ this.groups = [];+ this.currentGroupIndex = -1;+ }+}diff --git a/apps/web/src/components/engine/decoders/caption/guinea.ts b/apps/web/src/components/engine/decoders/caption/guinea.tsnew file mode 100644index 00000000..b0180da1--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/guinea.ts@@ -0,0 +1,150 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { CaptionType, PaintType, FontStyle, TextAlign, TextBaseline, TextCase } from '../../components';+import { renderText } from '../../utils/text';+import { loadWebFont } from '../../font/utils';+import { groupBy, findActiveGroup, splitSequence, clearTextRanges, resolveTranscript } from './utils';+import { getParentEntity, createEntity } from '../../api';+import { appendChild } from '../../api/hierarchy';+import { setComponent } from '../../api/events';+import { resizeEntity } from '../../api/resize';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';++const WIDTH = 700;+const HEIGHT = 200;++const HIGHLIGHT_COLOR_0 = 0xF55353;+const HIGHLIGHT_COLOR_1 = 0xFEB139;+const HIGHLIGHT_COLOR_2 = 0xF6F54D;++const PSEUDO_RANDOM_SEQUENCE = [0, 1, 0, 2, 1, 1, 0, 0, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1];++export class GuineaCaptionDecoder implements CaptionDecoder {+ public readonly type = CaptionType.GUINEA;+ public groups: ReturnType<typeof groupBy> = [];+ public ready = false;++ private readonly asset: Asset;+ private currentGroupIndex = -1;+ private activeSplit: 'left' | 'right' | null = null;+ private fillEid: number | null = null;+ private colorIndex = 0;++ constructor(asset: Asset) {+ this.asset = asset;+ this.init();+ }++ private async init() {+ if (this.ready) return;+ const transcript = await resolveTranscript(this.asset);+ this.groups = groupBy(transcript, { length: 18 });+ this.ready = true;+ }++ public applyStyles(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return;+ const parentWidth = c.Computed.width[parentEid];+ const parentHeight = c.Computed.height[parentEid];++ resizeEntity(world, eid, { width: WIDTH, height: HEIGHT });+ setComponent(world, eid, c.Position, { x: (parentWidth - WIDTH) / 2, y: (parentHeight - HEIGHT) / 2 });+ setComponent(world, eid, c.TextStyle, {+ fontFamily: 'The Bold Font',+ fontWeight: '500',+ fontSize: 62,+ textAlign: TextAlign.CENTER,+ textBaseline: TextBaseline.MIDDLE,+ textCase: TextCase.UPPER,+ fontStyle: FontStyle.NORMAL,+ leading: 1,+ });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0xFFFFFF);+ appendChild(world, fillEid, eid);++ loadWebFont(world, 'The Bold Font');+ }++ public seekTo(world: EngineWorld, eid: number, relativeTime: number): void {+ const c = world.components;+ const groupIndex = findActiveGroup(this.groups, relativeTime);++ if (groupIndex === -1) {+ setComponent(world, eid, c.Chars, '');+ clearTextRanges(world, eid);+ this.currentGroupIndex = -1;+ this.activeSplit = null;+ return;+ }++ const group = this.groups[groupIndex];+ const [left, right] = splitSequence(group);+ const leftText = left.map(w => w.text).join(' ');+ const rightText = right.map(w => w.text).join(' ');+ const text = rightText ? `${leftText}\n${rightText}` : leftText;+ const activeSplit = right.length > 0 && relativeTime >= right[0].start ? 'right' : 'left';++ if (groupIndex !== this.currentGroupIndex || activeSplit !== this.activeSplit) {+ this.currentGroupIndex = groupIndex;+ this.activeSplit = activeSplit;+ c.Chars[eid] = text;++ // Active line gets a random highlight color and a slightly larger font (1.1x).+ clearTextRanges(world, eid);+ const start = activeSplit === 'left' ? 0 : leftText.length + 1;+ const end = activeSplit === 'left' ? leftText.length : text.length;+ if (end > start) {+ const baseSize = c.TextStyle.fontSize[eid] ?? 62;+ const fontSize = Math.round(baseSize * 1.1);++ const rid = createEntity(world);+ setComponent(world, rid, c.TextRange, { start, end });+ setComponent(world, rid, c.TextStyle, { fontSize });+ appendChild(world, rid, eid);++ this.fillEid = createEntity(world);+ setComponent(world, this.fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, this.fillEid, c.Color, HIGHLIGHT_COLOR_0);+ setComponent(world, this.fillEid, c.ItemIndex, 0);+ appendChild(world, this.fillEid, rid);++ this.colorIndex++;+ }+ }+ }++ public draw(world: EngineWorld, eid: number): void {+ const c = world.components;++ const colors = [+ c.Caption.colors[eid]?.[0] ?? HIGHLIGHT_COLOR_0,+ c.Caption.colors[eid]?.[1] ?? HIGHLIGHT_COLOR_1,+ c.Caption.colors[eid]?.[2] ?? HIGHLIGHT_COLOR_2,+ ] as const;++ const index = PSEUDO_RANDOM_SEQUENCE[this.colorIndex % PSEUDO_RANDOM_SEQUENCE.length];++ if (this.fillEid) {+ c.Color[this.fillEid] = colors[index];+ }++ renderText(world, eid);+ }++ public dispose(): void {+ this.groups = [];+ this.currentGroupIndex = -1;+ this.activeSplit = null;+ }+}diff --git a/apps/web/src/components/engine/decoders/caption/index.ts b/apps/web/src/components/engine/decoders/caption/index.tsnew file mode 100644index 00000000..b2ed5724--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/index.ts@@ -0,0 +1,82 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent } from 'bitecs';+import { CaptionType } from '../../components';+import { addComponent } from '../../api/events';+import { ClassicCaptionDecoder } from './classic';+import { CascadeCaptionDecoder } from './cascade';+import { SpotlightCaptionDecoder } from './spotlight';+import { WhisperCaptionDecoder } from './whisper';+import { PaperCaptionDecoder } from './paper';+import { GuineaCaptionDecoder } from './guinea';+import { StarkCaptionDecoder } from './stark';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';++export type { CaptionDecoder } from './types';+export { ClassicCaptionDecoder } from './classic';+export { CascadeCaptionDecoder } from './cascade';+export { SpotlightCaptionDecoder } from './spotlight';+export { WhisperCaptionDecoder } from './whisper';+export { PaperCaptionDecoder } from './paper';+export { GuineaCaptionDecoder } from './guinea';+export { StarkCaptionDecoder } from './stark';++function createCaptionDecoder(type: CaptionType, asset: Asset): CaptionDecoder {+ switch (type) {+ case CaptionType.CLASSIC:+ return new ClassicCaptionDecoder(asset);+ case CaptionType.CASCADE:+ return new CascadeCaptionDecoder(asset);+ case CaptionType.SPOTLIGHT:+ return new SpotlightCaptionDecoder(asset);+ case CaptionType.WHISPER:+ return new WhisperCaptionDecoder(asset);+ case CaptionType.PAPER:+ return new PaperCaptionDecoder(asset);+ case CaptionType.GUINEA:+ return new GuineaCaptionDecoder(asset);+ case CaptionType.STARK:+ return new StarkCaptionDecoder(asset);+ default:+ return new ClassicCaptionDecoder(asset);+ }+}++/**+ * Lazily resolve (or create) a caption decoder for a caption entity.+ * Recreates the decoder when the caption type changes.+ * Returns null if the transcript asset isn't available yet.+ */+export function resolveCaptionDecoder(world: EngineWorld, eid: number): CaptionDecoder | null {+ const AssetId = world.components.AssetId;+ const assetId = AssetId[eid];+ if (!assetId) return null;++ const captionType = world.components.Caption.type[eid];+ const existing = world.components.CaptionDecoder[eid];++ if (existing && captionType === existing.type) return existing;++ const typeChanged = existing != null;+ existing?.dispose();++ const asset = world.assets.get(assetId);+ if (!asset) return null;++ addComponent(world, eid, world.components.CaptionDecoder);++ const decoder = createCaptionDecoder(captionType, asset);+ world.components.CaptionDecoder[eid] = decoder;+++ if (typeChanged || !hasComponent(world, eid, world.components.TextStyle)) {+ decoder.applyStyles(world, eid);+ }++ return decoder;+}diff --git a/apps/web/src/components/engine/decoders/caption/paper.ts b/apps/web/src/components/engine/decoders/caption/paper.tsnew file mode 100644index 00000000..025b52f4--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/paper.ts@@ -0,0 +1,126 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { CaptionType, PaintType, FontStyle, TextAlign, TextBaseline, TextCase } from '../../components';+import { renderText } from '../../utils/text';+import { loadWebFont } from '../../font/utils';+import { groupBy, findActiveGroup, splitSequence, clearTextRanges, resolveTranscript } from './utils';+import { getParentEntity, createEntity } from '../../api';+import { appendChild } from '../../api/hierarchy';+import { setComponent } from '../../api/events';+import { resizeEntity } from '../../api/resize';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';++const WIDTH = 700;+const HEIGHT = 200;++export class PaperCaptionDecoder implements CaptionDecoder {+ public readonly type = CaptionType.PAPER;+ public groups: ReturnType<typeof groupBy> = [];+ public ready = false;++ private readonly asset: Asset;+ private currentGroupIndex = -1;+ private activeSplit: 'left' | 'right' | null = null;++ constructor(asset: Asset) {+ this.asset = asset;+ this.init();+ }++ private async init() {+ if (this.ready) return;+ const transcript = await resolveTranscript(this.asset);+ this.groups = groupBy(transcript, { length: 18 });+ this.ready = true;+ }++ public applyStyles(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return;+ const parentWidth = c.Computed.width[parentEid];+ const parentHeight = c.Computed.height[parentEid];++ resizeEntity(world, eid, {+ width: WIDTH,+ height: HEIGHT,+ });++ setComponent(world, eid, c.Position, {+ x: (parentWidth - WIDTH) / 2,+ y: (parentHeight - HEIGHT) / 2,+ });++ setComponent(world, eid, c.TextStyle, {+ fontFamily: 'Montserrat',+ fontWeight: '300',+ fontSize: 50,+ textAlign: TextAlign.CENTER,+ textBaseline: TextBaseline.MIDDLE,+ textCase: TextCase.ORIGINAL,+ leading: 0.9,+ fontStyle: FontStyle.NORMAL,+ });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0xFFFFFF);+ appendChild(world, fillEid, eid);++ loadWebFont(world, 'Montserrat');+ }++ public seekTo(world: EngineWorld, eid: number, relativeTime: number): void {+ const c = world.components;+ const groupIndex = findActiveGroup(this.groups, relativeTime);++ if (groupIndex === -1) {+ c.Chars[eid] = '';+ clearTextRanges(world, eid);+ this.currentGroupIndex = -1;+ this.activeSplit = null;+ return;+ }++ const group = this.groups[groupIndex];+ const [left, right] = splitSequence(group);+ const leftText = left.map(w => w.text).join(' ');+ const rightText = right.map(w => w.text).join(' ');+ const text = rightText ? `${leftText}\n${rightText}` : leftText;+ const activeSplit = right.length > 0 && relativeTime >= right[0].start ? 'right' : 'left';++ if (groupIndex !== this.currentGroupIndex || activeSplit !== this.activeSplit) {+ this.currentGroupIndex = groupIndex;+ this.activeSplit = activeSplit;+ c.Chars[eid] = text;++ // Two-line display with newline separator.+ // The active line gets weight '500', inactive stays at the node's '300'.+ clearTextRanges(world, eid);+ const start = activeSplit === 'left' ? 0 : leftText.length + 1;+ const end = activeSplit === 'left' ? leftText.length : text.length;+ if (end > start) {+ const rid = createEntity(world);+ setComponent(world, rid, c.TextRange, { start, end });+ setComponent(world, rid, c.TextStyle, { fontWeight: '500' });+ appendChild(world, rid, eid);+ }+ }+ }++ public draw(world: EngineWorld, eid: number): void {+ renderText(world, eid);+ }++ public dispose(): void {+ this.groups = [];+ this.currentGroupIndex = -1;+ this.activeSplit = null;+ }+}diff --git a/apps/web/src/components/engine/decoders/caption/spotlight.ts b/apps/web/src/components/engine/decoders/caption/spotlight.tsnew file mode 100644index 00000000..94b98212--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/spotlight.ts@@ -0,0 +1,143 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { CaptionType, PaintType, FontStyle, TextAlign, TextBaseline, TextCase } from '../../components';+import { renderText } from '../../utils/text';+import { loadWebFont } from '../../font/utils';+import { groupBy, findActiveGroup, clearTextRanges, resolveTranscript } from './utils';+import { getParentEntity, createEntity } from '../../api';+import { appendChild } from '../../api/hierarchy';+import { setComponent } from '../../api/events';+import { resizeEntity } from '../../api/resize';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';+++const WIDTH = 700;+const HEIGHT = 100;+const HIGHLIGHT_COLOR = 0x24D5FF;++export class SpotlightCaptionDecoder implements CaptionDecoder {+ public readonly type = CaptionType.SPOTLIGHT;+ public groups: ReturnType<typeof groupBy> = [];+ public ready = false;++ private readonly asset: Asset;+ private currentGroupIndex = -1;+ private currentWordIndex = -1;+ private fillEid: number | null = null;++ constructor(asset: Asset) {+ this.asset = asset;+ this.init();+ }++ private async init() {+ if (this.ready) return;+ const transcript = await resolveTranscript(this.asset);+ this.groups = groupBy(transcript, { length: 10 });+ this.ready = true;+ }++ public applyStyles(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return;+ const parentWidth = c.Computed.width[parentEid];+ const parentHeight = c.Computed.height[parentEid];++ resizeEntity(world, eid, {+ width: WIDTH,+ height: HEIGHT,+ });++ setComponent(world, eid, c.Position, {+ x: (parentWidth - WIDTH) / 2,+ y: (parentHeight - HEIGHT) / 2,+ });++ setComponent(world, eid, c.TextStyle, {+ fontFamily: 'The Bold Font',+ fontWeight: '500',+ fontStyle: FontStyle.ITALIC,+ fontSize: 70,+ textAlign: TextAlign.CENTER,+ textBaseline: TextBaseline.MIDDLE,+ textCase: TextCase.ORIGINAL,+ leading: 1,+ });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0xFFFFFF);+ appendChild(world, fillEid, eid);++ loadWebFont(world, 'The Bold Font');+ }++ public seekTo(world: EngineWorld, eid: number, relativeTime: number): void {+ const c = world.components;+ const groupIndex = findActiveGroup(this.groups, relativeTime);++ if (groupIndex === -1) {+ c.Chars[eid] = '';+ clearTextRanges(world, eid);+ this.fillEid = null;+ this.currentGroupIndex = -1;+ this.currentWordIndex = -1;+ return;+ }++ const group = this.groups[groupIndex];++ const wordIndex = group.findIndex(word =>+ relativeTime >= word.start && relativeTime <= word.end+ );++ const text = group.map(w => w.text).join(' ');++ if (groupIndex !== this.currentGroupIndex || wordIndex !== this.currentWordIndex) {+ this.currentGroupIndex = groupIndex;+ this.currentWordIndex = wordIndex;+ c.Chars[eid] = text;++ clearTextRanges(world, eid);+ this.fillEid = null;++ if (group.length > 1 && wordIndex !== -1) {+ const start = group.slice(0, wordIndex).map(w => w.text).join(' ').length;+ const end = group.slice(0, wordIndex + 1).map(w => w.text).join(' ').length;+ const rid = createEntity(world);+ setComponent(world, rid, c.TextRange, { start, end });+ appendChild(world, rid, eid);++ this.fillEid = createEntity(world);+ setComponent(world, this.fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, this.fillEid, c.Color, HIGHLIGHT_COLOR);+ appendChild(world, this.fillEid, rid);+ }+ }+ }++ public draw(world: EngineWorld, eid: number): void {+ const c = world.components;++ const highlightColor = c.Caption.colors[eid]?.[0] ?? HIGHLIGHT_COLOR;++ if (this.fillEid) {+ c.Color[this.fillEid] = highlightColor;+ }++ renderText(world, eid);+ }++ public dispose(): void {+ this.groups = [];+ this.currentGroupIndex = -1;+ this.currentWordIndex = -1;+ }+}diff --git a/apps/web/src/components/engine/decoders/caption/stark.ts b/apps/web/src/components/engine/decoders/caption/stark.tsnew file mode 100644index 00000000..7c8f315f--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/stark.ts@@ -0,0 +1,102 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { BlendMode, CaptionType, PaintType, FontStyle, TextAlign, TextBaseline, TextCase } from '../../components';+import { renderText } from '../../utils/text';+import { loadWebFont } from '../../font/utils';+import { groupBy, findActiveGroup, resolveTranscript } from './utils';+import { getParentEntity, createEntity } from '../../api';+import { appendChild } from '../../api/hierarchy';+import { setComponent } from '../../api/events';+import { resizeEntity } from '../../api/resize';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';++const WIDTH = 700;+const HEIGHT = 100;++export class StarkCaptionDecoder implements CaptionDecoder {+ public readonly type = CaptionType.STARK;+ public groups: ReturnType<typeof groupBy> = [];+ public ready = false;++ private readonly asset: Asset;+ private currentGroupIndex = -1;++ constructor(asset: Asset) {+ this.asset = asset;+ this.init();+ }++ private async init() {+ if (this.ready) return;+ const transcript = await resolveTranscript(this.asset);+ this.groups = groupBy(transcript, { duration: 0.2 });+ this.ready = true;+ }++ public applyStyles(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return;+ const parentWidth = c.Computed.width[parentEid];+ const parentHeight = c.Computed.height[parentEid];++ resizeEntity(world, eid, {+ width: WIDTH,+ height: HEIGHT,+ });++ setComponent(world, eid, c.Position, {+ x: (parentWidth - WIDTH) / 2,+ y: (parentHeight - HEIGHT) / 2,+ });++ setComponent(world, eid, c.TextStyle, {+ fontFamily: 'Figtree',+ fontWeight: '800',+ fontSize: 70,+ textAlign: TextAlign.CENTER,+ textBaseline: TextBaseline.MIDDLE,+ textCase: TextCase.UPPER,+ fontStyle: FontStyle.NORMAL,+ leading: 1,+ });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0xFFFFFF);+ setComponent(world, fillEid, c.Appearance, { blendMode: BlendMode.DIFFERENCE });+ appendChild(world, fillEid, eid);++ loadWebFont(world, 'Figtree');+ }++ public seekTo(world: EngineWorld, eid: number, relativeTime: number): void {+ const groupIndex = findActiveGroup(this.groups, relativeTime);++ if (groupIndex === -1) {+ world.components.Chars[eid] = '';+ this.currentGroupIndex = -1;+ return;+ }++ if (groupIndex !== this.currentGroupIndex) {+ this.currentGroupIndex = groupIndex;+ world.components.Chars[eid] = this.groups[groupIndex].map(w => w.text).join(' ');+ }+ }++ public draw(world: EngineWorld, eid: number): void {+ renderText(world, eid);+ }++ public dispose(): void {+ this.groups = [];+ this.currentGroupIndex = -1;+ }+}diff --git a/apps/web/src/components/engine/decoders/caption/types.ts b/apps/web/src/components/engine/decoders/caption/types.tsnew file mode 100644index 00000000..9e9c4e0a--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/types.ts@@ -0,0 +1,17 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { CaptionType } from '../../components';+import type { EngineWorld } from '../../api/world';+import type { WordGroup } from '@diffusionstudio/api-contract';++export interface CaptionDecoder {+ readonly type: CaptionType;+ groups: WordGroup[];+ ready: boolean;+ applyStyles(world: EngineWorld, eid: number): void;+ seekTo(world: EngineWorld, eid: number, relativeTime: number): void;+ draw(world: EngineWorld, eid: number): void;+ dispose(): void;+}diff --git a/apps/web/src/components/engine/decoders/caption/utils.ts b/apps/web/src/components/engine/decoders/caption/utils.tsnew file mode 100644index 00000000..c4d2e8d2--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/utils.ts@@ -0,0 +1,120 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query } from 'bitecs';+import { ChildOf } from '../../components/relations';+import { deleteEntity } from '../../api/entities';++import type { Transcript, WordGroup } from '@diffusionstudio/api-contract';+import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';++export type TextRangeOverride = {+ start: number;+ end: number;+};+++export type GroupByOptions = {+ duration: number;+} | {+ length: number;+};++const ENDING_PUNCTUATION = ['.', '!', '?', ',', ';'];++export function groupBy(transcript: Transcript, options: GroupByOptions): WordGroup[] {+ const groups: WordGroup[] = [[]];++ for (const segment of transcript) {+ // Segment boundaries are sentence boundaries — never merge across them.+ if (groups[groups.length - 1].length > 0) {+ groups.push([]);+ }++ for (const word of segment.words) {+ const last = groups[groups.length - 1];+ const charCount = last.reduce((acc, w) => acc + w.text.length, 0);+ const duration = last.reduce((acc, w) => acc + (w.end - w.start), 0);++ if ('duration' in options && duration + (word.end - word.start) > options.duration) {+ groups.push([]);+ } else if ('length' in options && charCount + word.text.length > options.length) {+ groups.push([]);+ }++ groups.at(-1)?.push(word);++ if (ENDING_PUNCTUATION.some(p => word.text.endsWith(p))) {+ groups.push([]);+ }+ }+ }++ return groups.filter(g => g.length > 0);+}++/**+ * Find the active group index for a given time.+ * Returns -1 if no group is active.+ */+export function findActiveGroup(groups: WordGroup[], relativeTime: number): number {+ return groups.findIndex(group =>+ relativeTime >= group[0].start && relativeTime <= (group.at(-1)?.end ?? 0)+ );+}++export function clearTextRanges(world: EngineWorld, parentEid: number) {+ const c = world.components;++ for (const rid of query(world, [ChildOf(parentEid), c.TextRange])) {+ deleteEntity(world, rid);+ }++ c.Cache.textRanges[parentEid] = [];+}++/**+ * Split a word group into two halves at the nearest word boundary+ * to the midpoint of the joined text. Used by paper and guinea presets.+ */+export function splitSequence(sequence: WordGroup): [WordGroup, WordGroup] {+ const text = sequence.map(w => w.text).join(' ');+ const midPoint = Math.ceil(text.length / 2);++ let index = text.length;+ for (let i = midPoint, j = midPoint; i > 0 && j < text.length - 1; i--, j++) {+ if (text[i] === ' ') {+ index = i;+ break;+ }+ if (text[j] === ' ') {+ index = j;+ break;+ }+ }++ const leftText = text.slice(0, index).trim();+ const splitAt = leftText.split(/ /).length;++ return [sequence.slice(0, splitAt), sequence.slice(splitAt)];+}+++/**+ * Resolve a transcript from any asset type that can carry one.+ */+export async function resolveTranscript(asset: Asset): Promise<Transcript> {+ if (asset.type === 'TRANSCRIPT') {+ const file = await asset.handle.getFile();+ const text = await file.text();+ return JSON.parse(text);+ }++ if ((asset.type === 'AUDIO' || asset.type === 'VIDEO') && asset.transcript) {+ return asset.transcript;+ }++ return [];+}diff --git a/apps/web/src/components/engine/decoders/caption/whisper.ts b/apps/web/src/components/engine/decoders/caption/whisper.tsnew file mode 100644index 00000000..1da584c5--- /dev/null+++ b/apps/web/src/components/engine/decoders/caption/whisper.ts@@ -0,0 +1,103 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { CaptionType, PaintType, FontStyle, TextAlign, TextBaseline, TextCase } from '../../components';+import { renderText } from '../../utils/text';+import { loadWebFont } from '../../font/utils';+import { groupBy, findActiveGroup, resolveTranscript } from './utils';+import { getParentEntity, createEntity } from '../../api';+import { appendChild } from '../../api/hierarchy';+import { setComponent } from '../../api/events';+import { resizeEntity } from '../../api/resize';++import type { EngineWorld } from '../../api/world';+import type { Asset } from '../../db';+import type { CaptionDecoder } from './types';++const WIDTH = 1000;+const HEIGHT = 100;++export class WhisperCaptionDecoder implements CaptionDecoder {+ public readonly type = CaptionType.WHISPER;+ public groups: ReturnType<typeof groupBy> = [];+ public ready = false;++ private readonly asset: Asset;+ private currentGroupIndex = -1;++ constructor(asset: Asset) {+ this.asset = asset;+ this.init();+ }++ private async init() {+ if (this.ready) return;+ const transcript = await resolveTranscript(this.asset);+ this.groups = groupBy(transcript, { duration: 2 });++ this.ready = true;+ }++ public applyStyles(world: EngineWorld, eid: number): void {+ const c = world.components;++ const parentEid = getParentEntity(world, eid);+ if (parentEid === null) return;+ const parentWidth = c.Computed.width[parentEid];+ const parentHeight = c.Computed.height[parentEid];++ resizeEntity(world, eid, {+ width: WIDTH,+ height: HEIGHT,+ });++ setComponent(world, eid, c.Position, {+ x: (parentWidth - WIDTH) / 2,+ y: parentHeight - HEIGHT - 100,+ });++ setComponent(world, eid, c.TextStyle, {+ fontFamily: 'Montserrat',+ fontWeight: '400',+ fontSize: 40,+ textAlign: TextAlign.CENTER,+ textBaseline: TextBaseline.MIDDLE,+ textCase: TextCase.ORIGINAL,+ leading: 1.4,+ fontStyle: FontStyle.NORMAL,+ });++ const fid = createEntity(world);+ setComponent(world, fid, c.Paint, PaintType.SOLID);+ setComponent(world, fid, c.Color, 0xFFFFFF);+ appendChild(world, fid, eid);++ loadWebFont(world, 'Montserrat');+ }++ public seekTo(world: EngineWorld, eid: number, relativeTime: number): void {+ const c = world.components;+ const groupIndex = findActiveGroup(this.groups, relativeTime);++ if (groupIndex === -1) {+ c.Chars[eid] = '';+ this.currentGroupIndex = -1;+ return;+ }++ if (groupIndex !== this.currentGroupIndex) {+ this.currentGroupIndex = groupIndex;+ c.Chars[eid] = this.groups[groupIndex].map(w => w.text).join(' ');+ }+ }++ public draw(world: EngineWorld, eid: number): void {+ renderText(world, eid);+ }++ public dispose(): void {+ this.groups = [];+ this.currentGroupIndex = -1;+ }+}diff --git a/apps/web/src/components/engine/decoders/frame-cache.ts b/apps/web/src/components/engine/decoders/frame-cache.tsnew file mode 100644index 00000000..9a8e041b--- /dev/null+++ b/apps/web/src/components/engine/decoders/frame-cache.ts@@ -0,0 +1,181 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++type FrameCacheConfig = {+ pixels: number;+ count: number;+}++type FrameTile = {+ tileIndex: number;+ frameIndex: number;+}++type Frame = VideoFrame | ImageBitmap;++function getDisplaySize(frame: Frame) {+ if (frame instanceof VideoFrame) {+ return [frame.displayWidth, frame.displayHeight];+ }+ return [frame.width, frame.height]+}++export class FrameCache {+ public readonly config: FrameCacheConfig;+ public readonly atlas = new OffscreenCanvas(0, 0);+ public readonly atlasCtx = this.atlas.getContext('2d')!;+ public readonly source = new OffscreenCanvas(0, 0);+ public readonly sourceCtx = this.source.getContext('2d')!;++ private tileWidth: number = 0;+ private tileHeight: number = 0;+ private columns: number = 0;+ private tiles: FrameTile[];++ public rotation: number = 0;+ public leftFrameIndex: number;+ public rightFrameIndex: number;+ public lastInserted: number = -1;++ public constructor(config: FrameCacheConfig) {+ this.config = config;+ this.leftFrameIndex = 0;+ this.rightFrameIndex = config.count - 1;+ this.tiles = [];+ }++ private resizeCaches(frame: Frame) {+ const rotation = this.rotation;+ const [width, height] = getDisplaySize(frame);+ const pixelCount = width * height;++ const factor = Math.min(1, Math.sqrt(this.config.pixels / pixelCount));++ const sourceWidth = rotation === 90 || rotation === 270+ ? height+ : width;++ const sourceHeight = rotation === 90 || rotation === 270+ ? width+ : height;++ this.tileWidth = Math.floor(sourceWidth * factor);+ this.tileHeight = Math.floor(sourceHeight * factor);++ // Lay tiles in a 2D grid+ this.columns = Math.ceil(Math.sqrt(this.config.count));+ const rows = Math.ceil(this.config.count / this.columns);++ const absoluteWidth = this.tileWidth * this.columns;+ const absoluteHeight = this.tileHeight * rows;++ if (this.atlas.width !== absoluteWidth || this.atlas.height !== absoluteHeight) {+ this.atlas.width = absoluteWidth;+ this.atlas.height = absoluteHeight;+ this.atlasCtx.imageSmoothingEnabled = false;+ this.tiles = []; // setting the canvas size resets the tiles+ }+ }++ private drawRotated(frame: Frame) {+ const ctx = this.sourceCtx;+ const rotation = this.rotation;++ const [displayWidth, displayHeight] = getDisplaySize(frame);++ const width = rotation === 90 || rotation === 270+ ? displayHeight+ : displayWidth;++ const height = rotation === 90 || rotation === 270+ ? displayWidth+ : displayHeight;++ if (this.source.width !== width || this.source.height !== height) {+ this.source.width = width;+ this.source.height = height;+ ctx.imageSmoothingEnabled = false;+ }++ ctx.resetTransform();+ ctx.clearRect(0, 0, width, height);+ ctx.translate(width / 2, height / 2);+ ctx.rotate((rotation * Math.PI) / 180);+ ctx.drawImage(frame, -displayWidth / 2, -displayHeight / 2, displayWidth, displayHeight);+ }++ private evictTiles() {+ if (this.tiles.length < this.config.count) return;++ this.tiles = this.tiles.filter(t => t.frameIndex >= this.leftFrameIndex && t.frameIndex <= this.rightFrameIndex);+ }++ private insertTile(frameIndex: number) {+ let tileIndex = 0;+ while (this.tiles.some(t => t.tileIndex === tileIndex)) {+ tileIndex++;+ }++ this.tiles.push({ tileIndex, frameIndex });++ const ctx = this.atlasCtx;+ const x = (tileIndex % this.columns) * this.tileWidth;+ const y = Math.floor(tileIndex / this.columns) * this.tileHeight;++ ctx.clearRect(x, y, this.tileWidth, this.tileHeight);+ ctx.drawImage(this.source, x, y, this.tileWidth, this.tileHeight);+ }++ public has(frameIndex: number) {+ return this.tiles.some(t => t.frameIndex === frameIndex);+ }++ public findNearest(frameIndex: number, tolerance: number): number | undefined {+ let best: number | undefined;+ let bestDistance = tolerance + 1;++ for (const tile of this.tiles) {+ const distance = Math.abs(tile.frameIndex - frameIndex);+ if (distance < bestDistance) {+ bestDistance = distance;+ best = tile.frameIndex;+ }+ }++ return best;+ }++ public insert(frame: VideoFrame | ImageBitmap, index: number) {+ if (this.has(index)) return;++ this.evictTiles();+ this.resizeCaches(frame);+ this.drawRotated(frame);+ this.insertTile(index);+ this.lastInserted = index;+ }++ public findTile(frameIndex: number) {+ const tile = this.tiles.find(t => t.frameIndex === frameIndex);++ if (!tile) return;++ const x = (tile.tileIndex % this.columns) * this.tileWidth;+ const y = Math.floor(tile.tileIndex / this.columns) * this.tileHeight;++ return { x, y, width: this.tileWidth, height: this.tileHeight };+ }++ public dispose() {+ this.atlas.width = 0;+ this.atlas.height = 0;+ this.source.width = 0;+ this.source.height = 0;+ this.tileWidth = 0;+ this.tileHeight = 0;+ this.columns = 0;+ this.lastInserted = -1;+ this.tiles = [];+ }+}diff --git a/apps/web/src/components/engine/decoders/image.ts b/apps/web/src/components/engine/decoders/image.tsnew file mode 100644index 00000000..3632bdf8--- /dev/null+++ b/apps/web/src/components/engine/decoders/image.ts@@ -0,0 +1,187 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { addComponent } from '../api/events';+import type { EngineWorld } from '../api/world';+import type { ImageAsset } from '../db';++export type DecodedImage = ImageBitmap | HTMLImageElement;++export interface ImageDecoder {+ readonly assetId: string;+ readonly failed: boolean;+ readonly ready: boolean;+ init(): Promise<void>;+ getBitmap(targetWidth: number, targetHeight: number): DecodedImage | null;+ dispose(): void;+}++/**+ * Image decoder backed by `createImageBitmap`. Used for raster formats+ * (PNG, JPEG, WebP, …) where we want a GPU-friendly bitmap.+ *+ * Fetching + decoding starts immediately on construction.+ */+export class BitmapImageDecoder implements ImageDecoder {+ readonly assetId: string;+ public failed = false;+ private bitmap: ImageBitmap | null = null;+ private disposed = false;++ public constructor(private readonly asset: ImageAsset) {+ this.assetId = asset.id;+ }++ public async init() {+ if (this.disposed) return;++ try {+ const file = await this.asset.handle.getFile();+ const result = await createImageBitmap(file);+ if (this.disposed) {+ result.close();+ return;+ }+ this.bitmap = result;+ } catch (e) {+ console.error('Error decoding image', e);+ this.failed = true;+ }+ }+++ public get ready() {+ return this.bitmap !== null;+ }++ public getBitmap(_targetWidth: number, _targetHeight: number): ImageBitmap | null {+ // TODO: mipmap — pick the LOD closest to targetWidth × targetHeight+ return this.bitmap;+ }++ public dispose() {+ if (this.disposed) return;+ if (this.bitmap) {+ this.bitmap.close();+ this.bitmap = null;+ }+ this.disposed = true;+ }+}++/**+ * Image decoder backed by `HTMLImageElement`. Used for formats that+ * `createImageBitmap` doesn't handle reliably across browsers — most+ * notably SVG, where we want the browser's native vector renderer.+ */+export class ElementImageDecoder implements ImageDecoder {+ readonly assetId: string;+ public failed = false;+ private element: HTMLImageElement | null = null;+ private url: string | null = null;+ private disposed = false;+ private readonly width: number;+ private readonly height: number;++ public constructor(private readonly asset: ImageAsset) {+ this.assetId = asset.id;+ this.width = asset.width;+ this.height = asset.height;+ }++ public get ready() {+ return this.element !== null;+ }++ public async init() {+ if (this.disposed) return;++ try {+ const file = await this.asset.handle.getFile();+ const url = URL.createObjectURL(file);++ await new Promise<void>((resolve) => {+ const img = new Image();+ img.onload = () => {+ if (this.disposed) {+ URL.revokeObjectURL(url);+ return resolve();+ }+ // SVGs without explicit width/height attributes report+ // naturalWidth/Height = 0. Pin to the asset's recorded+ // dimensions so getScaledImageProps gets a real aspect.+ img.width = this.width;+ img.height = this.height;+ this.element = img;+ this.url = url;+ resolve();+ };+ img.onerror = () => {+ URL.revokeObjectURL(url);+ this.failed = true;+ resolve();+ };+ img.src = url;+ })+ } catch (e) {+ console.error('Error decoding image', e);+ this.failed = true;+ }+ }++ public getBitmap(_targetWidth: number, _targetHeight: number): HTMLImageElement | null {+ return this.element;+ }++ public dispose() {+ if (this.disposed) return;+ if (this.url) {+ URL.revokeObjectURL(this.url);+ this.url = null;+ }+ this.element = null;+ this.disposed = true;+ }+}++function createImageDecoder(asset: ImageAsset): ImageDecoder {+ if (asset.mimeType === 'image/svg+xml') {+ return new ElementImageDecoder(asset);+ }+ return new BitmapImageDecoder(asset);+}++type ResolvedImageDecoder = {+ decoder: ImageDecoder;+ initPromise: Promise<void> | null;+}++export function resolveImageDecoder(world: EngineWorld, eid: number): ResolvedImageDecoder | null {+ const AssetId = world.components.AssetId;+ const assetId = AssetId[eid];+ if (!assetId) return null;++ const existing = world.components.ImageDecoder[eid];+ if (existing && existing.assetId === assetId) {+ return {+ decoder: existing,+ initPromise: null,+ };+ };++ // Asset changed — dispose old decoder and create a new one.+ if (existing) existing.dispose();++ const asset = world.assets.get(assetId);+ if (!asset || asset.type !== 'IMAGE') return null;++ addComponent(world, eid, world.components.ImageDecoder, false);++ const decoder = createImageDecoder(asset);+ world.components.ImageDecoder[eid] = decoder;+ return {+ decoder,+ initPromise: decoder.init(),+ };+}diff --git a/apps/web/src/components/engine/decoders/index.ts b/apps/web/src/components/engine/decoders/index.tsnew file mode 100644index 00000000..eb4a8cc2--- /dev/null+++ b/apps/web/src/components/engine/decoders/index.ts@@ -0,0 +1,11 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './audio';+export * from './audio-peaks';+export * from './caption';+export * from './image';+export * from './sequence';+export * from './time-stretcher';+export * from './video';diff --git a/apps/web/src/components/engine/decoders/sequence.ts b/apps/web/src/components/engine/decoders/sequence.tsnew file mode 100644index 00000000..b77c87d8--- /dev/null+++ b/apps/web/src/components/engine/decoders/sequence.ts@@ -0,0 +1,268 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { assert } from '@/utils';+import { addComponent } from '../api/events';+import { FrameCache } from './frame-cache';++import type { EngineWorld } from '../api/world';+import type { SequenceAsset } from '../db';++const FRAME_EXTENSIONS = /\.(png|jpe?g|webp|avif|bmp|gif)$/i;++export type SequenceBufferMode = 'discarded' | 'idle' | 'alive';+const IDLE_TIMEOUT_MS = 10_000;++export class SequenceDecoder {+ public currentFrame: number = 0;+ public errored = false;+ public disposed = false;+ public hasCache = true;+ public asset: SequenceAsset;+ public mode: SequenceBufferMode = 'alive';+ public initialized: Promise<void>;++ private frames: File[] = [];+ private lastRenderedFrame: number = -1;+ private seekGeneration = 0;+ private idleTimer: ReturnType<typeof setTimeout> | null = null;+ private seekLock: Promise<void> = Promise.resolve();++ public readonly cache = new FrameCache({ pixels: 720 * 720, count: 49 });+ public readonly canvas = new OffscreenCanvas(0, 0);+ public readonly ctx = this.canvas.getContext('2d')!;++ public constructor(asset: SequenceAsset, hasCache: boolean) {+ this.hasCache = hasCache;+ this.asset = asset;+ this.initialized = this.initialize();+ }++ private async initialize() {+ try {+ const entries: { name: string; handle: FileSystemFileHandle }[] = [];++ for await (const [name, entry] of this.asset.directoryHandle.entries()) {+ if (entry.kind !== 'file') continue;+ if (!FRAME_EXTENSIONS.test(name)) continue;+ entries.push({ name, handle: entry as FileSystemFileHandle });+ }++ // Natural-order sort so frame_2 comes before frame_10.+ entries.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }));+ this.frames = await Promise.all(entries.map(e => e.handle.getFile()));+ assert(this.frames.length > 0, 'No frames found');+ } catch {+ this.errored = true;+ }+ }++ private updateBitmap(frameIndex: number) {+ if (frameIndex === this.lastRenderedFrame) return;+ const tile = this.cache.findTile(frameIndex);+ if (!tile) return;+ const ctx = this.ctx;++ if (this.canvas.width !== tile.width || this.canvas.height !== tile.height) {+ this.canvas.width = tile.width;+ this.canvas.height = tile.height;+ ctx.imageSmoothingEnabled = false;+ }++ ctx.clearRect(0, 0, tile.width, tile.height);+ ctx.drawImage(+ this.cache.atlas,+ tile.x,+ tile.y,+ tile.width,+ tile.height,+ 0,+ 0,+ tile.width,+ tile.height,+ );++ this.lastRenderedFrame = frameIndex;+ }++ public toBitmap() {+ if (this.canvas.width === 0 || this.canvas.height === 0) {+ return null;+ }++ return this.canvas;+ }++ private computeWindow(targetFrame: number, forward: boolean): [number, number] {+ const span = this.cache.config.count - 2;+ const lastFrameIndex = this.frames.length - 1;++ // Whole video fits in the cache — keep all of it.+ if (lastFrameIndex <= span) {+ return [0, lastFrameIndex];+ }++ const ahead = Math.round((span * 2) / 3);+ const behind = span - ahead;++ let left = targetFrame - (forward ? behind : ahead);+ let right = targetFrame + (forward ? ahead : behind);++ // Push budget that falls outside the boundaries onto the other side.+ if (left < 0) {+ right -= left;+ left = 0;+ }+ if (right > lastFrameIndex) {+ left -= right - lastFrameIndex;+ right = lastFrameIndex;+ }++ return [Math.max(0, left), Math.min(lastFrameIndex, right)];+ }++ private async updateBitmapAsync(frame: number) {+ try {+ await this.initialized;+ const file = this.frames[frame];+ if (file === undefined) return;+ const bitmap = await createImageBitmap(file);++ if (this.canvas.width !== bitmap.width || this.canvas.height !== bitmap.height) {+ this.canvas.width = bitmap.width;+ this.canvas.height = bitmap.height;+ this.ctx.imageSmoothingEnabled = false;+ }++ this.ctx.clearRect(0, 0, bitmap.width, bitmap.height);+ this.ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height);+ bitmap.close();+ } catch { /** ignore */ }+ }++ public async seekTo(frame: number, frameRate: number) {+ let targetFrame = Math.round((frame / frameRate) * this.asset.frameRate);++ // Path without cache+ if (!this.hasCache) {+ return this.updateBitmapAsync(targetFrame);+ }++ this.updateBitmap(targetFrame);++ const isCurrentFrame = targetFrame === this.currentFrame;+ const isEmpty = this.frames.length === 0;+ const isIdle = this.mode === 'idle' && isCurrentFrame;+ const isCached = this.cache.has(targetFrame) && isCurrentFrame;+ const errored = this.errored;++ if (isEmpty || isCached || isIdle || errored) {+ return;+ }++ this.touch();++ const generation = ++this.seekGeneration;++ // When the cache does not have the target frame, forward must be true (latency optimization)+ const forward = this.cache.has(targetFrame) ? targetFrame >= this.currentFrame : true;+ this.currentFrame = targetFrame;++ const [left, right] = this.computeWindow(targetFrame, forward);+ this.cache.leftFrameIndex = left;+ this.cache.rightFrameIndex = right;++ let run: Promise<void>+ if (forward) {+ run = this.seekLock.then(() => this.fillCache([targetFrame, this.cache.rightFrameIndex], generation));+ } else {+ // +1 to include the target frame+ run = this.seekLock.then(() => this.fillCache([this.cache.leftFrameIndex, targetFrame], generation));+ }++ // Run after the previous seek finishes — never concurrently.+ this.seekLock = run.catch(() => { });+ }++ private async fillCache(range: [number, number], generation: number): Promise<void> {+ if (generation !== this.seekGeneration || range[0] > range[1]) return;++ for (let index = range[0]; index <= range[1]; index++) {+ const file = this.frames[index];+ if (file === undefined || this.cache.has(index)) continue;++ try {+ const bitmap = await createImageBitmap(file);+ this.cache.insert(bitmap, index);+ bitmap.close();+ this.updateBitmap(this.currentFrame);+ } catch { /** ignore */ }++ if (generation !== this.seekGeneration) break;+ }+ }++ private touch() {+ this.mode = 'alive';+ if (this.idleTimer !== null) {+ clearTimeout(this.idleTimer);+ }+ this.idleTimer = setTimeout(() => this.idle(), IDLE_TIMEOUT_MS);+ }++ public idle() {+ if (this.mode !== 'alive') return;+ this.mode = 'idle';++ if (this.idleTimer !== null) {+ clearTimeout(this.idleTimer);+ this.idleTimer = null;+ }++ this.cache.dispose();+ }+++ public dispose() {+ if (this.mode === 'discarded') return;+ this.mode = 'discarded';++ if (this.idleTimer !== null) {+ clearTimeout(this.idleTimer);+ this.idleTimer = null;+ }++ this.cache.dispose();++ // Release the display canvas backing store.+ this.canvas.width = 0;+ this.canvas.height = 0;+ this.lastRenderedFrame = -1;+ }+}++export function resolveSequenceDecoder(world: EngineWorld, fid: number, hasCache = true): SequenceDecoder | null {+ const AssetId = world.components.AssetId;+ const assetId = AssetId[fid];+ if (!assetId) return null;++ const asset = world.assets.get(assetId);+ if (!asset || asset.type !== 'SEQUENCE') return null;++ // Identity check (not just id) so decoders rebuild when asset metadata —+ // e.g. frameRate — changes via `assets.save({ ...asset, frameRate: ... })`.+ const existing = world.components.SequenceDecoder[fid];+ if (existing && existing.asset === asset) {+ existing.hasCache = hasCache;+ return existing;+ }++ existing?.dispose();++ addComponent(world, fid, world.components.SequenceDecoder, false);++ const decoder = new SequenceDecoder(asset, hasCache);+ world.components.SequenceDecoder[fid] = decoder;+ return decoder;+}diff --git a/apps/web/src/components/engine/decoders/time-stretcher.ts b/apps/web/src/components/engine/decoders/time-stretcher.tsnew file mode 100644index 00000000..4af25cf5--- /dev/null+++ b/apps/web/src/components/engine/decoders/time-stretcher.ts@@ -0,0 +1,260 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */+++/**+ * Utility class for performing time stretching on a multi-channel audio signal. The input audio will be stretched by+ * a configurable factor without changing its pitch.+ *+ * Internally, this uses a WSOLA-like algorithm.+ */+export class TimeStretcher {+ factor: number; // This value can be changed at runtime++ private numberOfChannels: number;+ private synthesisHopSize: number;+ private windowSize: number;+ private overlapSize: number;+ private tolerance: number;+ private buffers: Float32Array[];+ private bufferEndIndex: number;+ private outputBuffers: Float32Array[];+ private nextOutputBufferShiftAmount: number;+ private outputBufferLength: number;+ private hasDoneOutput: boolean;+ private finalized: boolean;+ private blendValues: number[];++ public constructor(numberOfChannels: number, sampleRate: number, factor: number) {+ this.numberOfChannels = numberOfChannels;+ this.synthesisHopSize = Math.floor((512 * sampleRate) / 48000);+ this.windowSize = 2 * this.synthesisHopSize;+ this.overlapSize = this.synthesisHopSize;+ this.tolerance = this.synthesisHopSize;+ this.buffers = [];+ this.bufferEndIndex = this.tolerance;+ this.factor = factor;+ this.outputBuffers = [];+ this.nextOutputBufferShiftAmount = 0;+ this.outputBufferLength = 2 ** 16;+ this.hasDoneOutput = false;+ this.finalized = false;++ for (let i = 0; i < numberOfChannels; i++) {+ this.buffers.push(new Float32Array(2 ** 16));+ this.outputBuffers.push(new Float32Array(this.outputBufferLength));+ }++ this.blendValues = [];+ for (let i = 0; i < this.overlapSize; i++) {+ this.blendValues[i] = 0.5 * (1 - Math.cos((Math.PI * i) / this.overlapSize));+ }+ }++ private ensureOutputBufferLength(requiredLength: number): void {+ if (requiredLength > this.outputBufferLength) {+ this.outputBufferLength = requiredLength;+ for (let i = 0; i < this.numberOfChannels; i++) {+ const largerBuffer = new Float32Array(this.outputBufferLength);+ largerBuffer.set(this.outputBuffers[i], 0);+ this.outputBuffers[i] = largerBuffer;+ }+ }+ }++ private clearOutputBuffers(): void {+ if (this.nextOutputBufferShiftAmount > 0) {+ for (let i = 0; i < this.numberOfChannels; i++) {+ const buffer = this.outputBuffers[i];+ buffer.set(buffer.subarray(this.nextOutputBufferShiftAmount), 0);+ }++ this.nextOutputBufferShiftAmount = 0;+ }+ }++ private synthesizeSegment(+ i: number,+ windowSize: number,+ inputStartPos: number,+ maxPositiveOffset: number = this.tolerance+ ): void {+ const crossCorrelateAllChannels = (k: number): number => {+ let dot = 0;+ let normOldTotal = 0;+ let normNewTotal = 0;++ for (let chan = 0; chan < this.numberOfChannels; chan++) {+ const inputBuffer = this.buffers[chan];+ const outputBuffer = this.outputBuffers[chan];++ for (let j = 0; j < this.overlapSize; j++) {+ const oldValue = outputBuffer[i + j];+ const newValue = inputBuffer[inputStartPos + k + j];++ dot += oldValue * newValue;+ normOldTotal += oldValue ** 2;+ normNewTotal += newValue ** 2;+ }+ }++ const ncc = dot / (Math.sqrt(normOldTotal * normNewTotal) || 1e-10);+ return ncc;+ };++ let bestCorr = -Infinity;+ let bestOffset = 0;++ if (!this.hasDoneOutput || this.factor === 1) {+ bestOffset = 0;+ } else {+ let k = -this.tolerance;+ bestCorr = crossCorrelateAllChannels(k);+ bestOffset = k;++ const minStepSize = 1;+ const maxStepSize = 16;+ let prevCorr = bestCorr;++ while (k < maxPositiveOffset) {+ const nextK = Math.min(k + 1, maxPositiveOffset);+ const corr = crossCorrelateAllChannels(nextK);++ const gradient = Math.abs(corr - prevCorr);+ const adaptiveStep = Math.max(+ minStepSize,+ Math.min(maxStepSize, Math.floor(maxStepSize * Math.exp(-gradient * 3)))+ );++ if (corr > bestCorr) {+ bestCorr = corr;+ bestOffset = nextK;+ }++ prevCorr = corr;+ k += adaptiveStep;+ }++ // Fine-tuning phase+ const fineRange = 8;+ for (k = bestOffset - fineRange; k <= bestOffset + fineRange; k++) {+ if (k >= -this.tolerance && k <= maxPositiveOffset) {+ const corr = crossCorrelateAllChannels(k);+ if (corr > bestCorr) {+ bestCorr = corr;+ bestOffset = k;+ }+ }+ }+ }++ for (let chan = 0; chan < this.numberOfChannels; chan++) {+ const inputBuffer = this.buffers[chan];+ const outputBuffer = this.outputBuffers[chan];++ for (let j = 0; j < windowSize; j++) {+ const blendValue = j < this.overlapSize ? this.blendValues[j] : 1;+ outputBuffer[i + j] *= 1 - blendValue;+ outputBuffer[i + j] += blendValue * inputBuffer[inputStartPos + bestOffset + j];+ }+ }++ this.hasDoneOutput = true;+ }++ public append(newBuffers: Float32Array[]): Float32Array[] | null {+ if (this.finalized) {+ throw new Error('Cannot append more buffers after calling finalize.');+ }++ // Fast path: when factor is 1, pass through directly without any processing+ if (this.factor === 1) {+ this.hasDoneOutput = true;+ return newBuffers;+ }++ for (let i = 0; i < this.numberOfChannels; i++) {+ const newBuffer = newBuffers[i];+ const requiredLength = this.bufferEndIndex + newBuffer.length;+ let currentLength = this.buffers[i].length;++ while (currentLength < requiredLength) {+ currentLength *= 2;+ }++ if (currentLength !== this.buffers[i].length) {+ const largerBuffer = new Float32Array(currentLength);+ largerBuffer.set(this.buffers[i], 0);+ this.buffers[i] = largerBuffer;+ }++ this.buffers[i].set(newBuffer, this.bufferEndIndex);+ }++ this.bufferEndIndex += newBuffers[0].length;++ return this.process();+ }++ private process(): Float32Array[] | null {+ let synthesisLength = 0;+ // eslint-disable-next-line no-constant-condition+ for (synthesisLength; true; synthesisLength += this.synthesisHopSize) {+ const inputShiftAmount = Math.floor(synthesisLength / this.factor);++ if (inputShiftAmount + this.windowSize + 2 * this.tolerance > this.bufferEndIndex) {+ synthesisLength -= this.synthesisHopSize;+ break;+ }+ }++ if (synthesisLength <= 0) {+ return null;+ }++ const inputShiftAmount = Math.floor(synthesisLength / this.factor);+ const outputLength = synthesisLength - this.synthesisHopSize + this.windowSize;++ this.clearOutputBuffers();+ this.ensureOutputBufferLength(outputLength);++ for (let i = 0; i < synthesisLength; i += this.synthesisHopSize) {+ const inputStartPos = this.tolerance + Math.floor(i / this.factor);+ this.synthesizeSegment(i, this.windowSize, inputStartPos);+ }++ // Shift all input buffers+ for (let chan = 0; chan < this.numberOfChannels; chan++) {+ const inputBuffer = this.buffers[chan];+ inputBuffer.set(inputBuffer.subarray(inputShiftAmount, this.bufferEndIndex), 0);+ }++ this.bufferEndIndex -= inputShiftAmount;+ this.nextOutputBufferShiftAmount = synthesisLength;++ return this.outputBuffers.map(x => x.subarray(0, synthesisLength));+ }++ public finalize(): Float32Array[] | null {+ this.finalized = true;++ // Fast path: when factor is 1, nothing is buffered+ if (this.factor === 1) {+ return null;+ }++ if (this.bufferEndIndex <= this.tolerance) {+ return null;+ }++ this.clearOutputBuffers();++ const synthesisLength = this.bufferEndIndex - this.tolerance;+ this.ensureOutputBufferLength(synthesisLength);++ this.synthesizeSegment(0, synthesisLength, this.tolerance, 0);++ return this.outputBuffers.map(x => x.subarray(0, synthesisLength));+ }+}diff --git a/apps/web/src/components/engine/decoders/video.ts b/apps/web/src/components/engine/decoders/video.tsnew file mode 100644index 00000000..b1e6f9ff--- /dev/null+++ b/apps/web/src/components/engine/decoders/video.ts@@ -0,0 +1,552 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { BlobSource, ALL_FORMATS, Input, InputVideoTrack, EncodedPacketSink, EncodedPacket, CanvasSink, type WrappedCanvas } from 'mediabunny';+import { addComponent } from '../api/events';+import { assert } from '@/utils/common';+import { FrameCache } from './frame-cache';++import type { EngineWorld } from '../api/world';+import type { VideoAsset } from '../db';+++export type VideoBufferMode = 'discarded' | 'idle' | 'alive';++/**+ * Inactivity window after which an `alive` buffer automatically drops to+ * `idle`, freeing its decoder and frame cache while keeping the display canvas.+ */+const IDLE_TIMEOUT_MS = 10_000;++/**+ * Max extra frames we are willing to decode forward from the live cursor in+ * order to avoid a keyframe lookup + decoder reseed. Higher = stronger bias.+ */+const FORWARD_BIAS_FRAMES = 24;++/**+ * Frames used to drain the decoder in case of a backward seek to+ * ensure the target frame is surfaced.+ */+const DRAIN_FRAMES = 8;++export class VideoBuffer {+ public errored = false;+ public asset: VideoAsset;+ public firstPacketTimestamp = 0;+ public packetSink: EncodedPacketSink | null = null;+ public mode: VideoBufferMode = 'alive';+ public initialized: Promise<void>;++ public readonly cache = new FrameCache({ pixels: 768 * 432, count: 81 });+ public readonly queue = new VideoDecoderQueue(this.frameCallback.bind(this));++ // user facing display canvas+ public readonly canvas = new OffscreenCanvas(0, 0);+ public readonly ctx = this.canvas.getContext('2d')!;++ private currentFrame: number = -1;+ private isDirty: boolean = true;++ private lastFrameIndex: number = 0;+ private seekGeneration = 0;+ private seekLock: Promise<void> = Promise.resolve();+ private iterator: AsyncGenerator<EncodedPacket, void, unknown> | null = null;+ private idleTimer: ReturnType<typeof setTimeout> | null = null;+ private iteratorStart: number = Infinity;++ public constructor(asset: VideoAsset) {+ this.asset = asset;+ this.initialized = this.initialize();+ }++ private async initialize() {+ try {+ const videoTrack = await getVideoTrack(this.asset);++ assert(videoTrack, 'Video track not found');++ await this.queue.init(videoTrack);++ this.cache.rotation = videoTrack.rotation;+ this.packetSink = new EncodedPacketSink(videoTrack);+ this.firstPacketTimestamp = await videoTrack.getFirstTimestamp() ?? 0;+ this.lastFrameIndex = Math.max(0, Math.round(this.asset.duration * this.asset.frameRate) - 1);+ this.isDirty = true;+ } catch (e) {+ console.error('Error initializing video decoder', e);+ this.errored = true;+ }+ }++ private frameCallback(frame: VideoFrame) {+ const timestampSeconds = frame.timestamp / 1e6;+ const frameIndex = this.secondsToFrames(timestampSeconds);+ this.cache.insert(frame, frameIndex);+ this.isDirty = true;+ }++ public seekTo(frame: number, frameRate: number): undefined {+ let targetFrame = Math.round((frame / frameRate) * this.asset.frameRate);++ const isEmpty = !this.packetSink;+ const isCurrentFrame = targetFrame === this.currentFrame;+ const isCached = this.cache.has(targetFrame) && isCurrentFrame;+ const isIdle = this.mode === 'idle' && isCurrentFrame;+ const errored = this.errored;++ if (isEmpty || isCurrentFrame || isCached || isIdle || errored) {+ return;+ }++ const previousFrame = this.currentFrame;+ const forward = this.isBlockedFrame(targetFrame)+ ? targetFrame >= previousFrame+ : true;+++ this.currentFrame = targetFrame;+ this.isDirty = true;++ this.touch();++ const generation = ++this.seekGeneration;++ const [left, right] = this.computeWindow(targetFrame, forward);+ this.cache.leftFrameIndex = left;+ this.cache.rightFrameIndex = right;++ let run: Promise<void>+ if (forward) {+ while (this.isBlockedFrame(targetFrame) && targetFrame <= this.cache.rightFrameIndex) {+ targetFrame++;+ }++ run = this.seekLock.then(() => this.fillCache([targetFrame, this.cache.rightFrameIndex], generation));+ } else {+ while (this.cache.has(targetFrame) && targetFrame >= this.cache.leftFrameIndex) {+ targetFrame--;+ }++ // TODO: Find a better solution for DRAIN_FRAMES+ run = this.seekLock.then(() => this.fillCache([this.cache.leftFrameIndex, targetFrame + DRAIN_FRAMES], generation));+ }++ // Run after the previous seek finishes — never concurrently.+ this.seekLock = run.catch(() => { });+ }++ private framesToSeconds(frames: number) {+ return Math.max(this.firstPacketTimestamp, (frames / this.asset.frameRate) + this.firstPacketTimestamp);+ }++ private secondsToFrames(seconds: number) {+ return Math.max(0, Math.round((seconds - this.firstPacketTimestamp) * this.asset.frameRate));+ }++ /**+ * Whether `frame` is already taken care of — decoded into the cache, or still in-flight+ */+ private isBlockedFrame(frame: number) {+ if (this.cache.has(frame)) return true;+ const cursor = this.queue.lastSubmitted;+ if (!cursor || this.iteratorStart === Infinity) return false;+ return frame >= this.secondsToFrames(this.iteratorStart)+ && frame <= this.secondsToFrames(cursor.timestamp);+ }++ private computeWindow(targetFrame: number, forward: boolean): [number, number] {+ const span = this.cache.config.count - 2;++ // Whole video fits in the cache — keep all of it.+ if (this.lastFrameIndex <= span) {+ return [0, this.lastFrameIndex];+ }++ const ahead = Math.round((span * 2) / 3);+ const behind = span - ahead;++ let left = targetFrame - (forward ? behind : ahead);+ let right = targetFrame + (forward ? ahead : behind);++ // Push budget that falls outside the boundaries onto the other side.+ if (left < 0) {+ right -= left;+ left = 0;+ }+ if (right > this.lastFrameIndex) {+ left -= right - this.lastFrameIndex;+ right = this.lastFrameIndex;+ }++ return [Math.max(0, left), Math.min(this.lastFrameIndex, right)];+ }++ private async fillCache(range: [number, number], generation: number): Promise<void> {+ if (generation !== this.seekGeneration || Math.abs(range[1] - range[0]) <= 3) return;+ // Note: only decode for three or more frames at a time to avoid unnecessary reseeding++ const fromSecs = this.framesToSeconds(range[0]);+ const untilSecs = this.framesToSeconds(range[1]);+ const cursor = this.queue.lastSubmitted;+ const live = !!(this.iterator && this.queue.isAlive && cursor);++ let reuse = live && cursor!.timestamp < untilSecs;+ let keyPacket: EncodedPacket | null = null;++ // If the cursor lags far behind the range start, skip forward to the nearest+ // keyframe rather than decoding through the whole gap.+ const biasSecs = FORWARD_BIAS_FRAMES / this.asset.frameRate;+ if (reuse && cursor!.timestamp < fromSecs - biasSecs) {+ keyPacket = (await this.packetSink?.getKeyPacket(fromSecs)) ?? null;+ if (keyPacket && keyPacket.timestamp - cursor!.timestamp > biasSecs) {+ reuse = false; // jumping to the keyframe+ }+ }++ // we cant reuse the iterator, so we need to reseed the decoder+ // and get create a new iterator+ if (!reuse) {+ keyPacket ??= (await this.packetSink?.getKeyPacket(fromSecs)) ?? null;+ if (!keyPacket) return;+ await this.iterator?.return();+ this.iterator = this.packetSink?.packets(keyPacket) ?? null;+ this.iteratorStart = keyPacket.timestamp;+ }++ if (!this.queue.isAlive) {+ this.queue.reseed();+ }++ if (generation !== this.seekGeneration || !this.iterator) return;++ while (true) {+ const { value: packet, done } = await this.iterator.next();+ if (done || !packet) break;++ await this.queue.decode(packet);++ if (generation !== this.seekGeneration || packet.timestamp >= untilSecs) break;+ }+ }++ public toBitmap() {+ if (this.isDirty && this.currentFrame >= 0) {+ const tile = this.cache.findTile(this.currentFrame);+ const ctx = this.ctx;++ if (tile && (this.canvas.width !== tile.width || this.canvas.height !== tile.height)) {+ this.canvas.width = tile.width;+ this.canvas.height = tile.height;+ this.ctx.imageSmoothingEnabled = false;+ }++ if (tile) {+ ctx.drawImage(+ this.cache.atlas,+ tile.x,+ tile.y,+ tile.width,+ tile.height,+ 0,+ 0,+ tile.width,+ tile.height,+ );+ this.isDirty = false;+ }+ }++ if (this.canvas.width === 0 || this.canvas.height === 0) {+ return null;+ }++ return this.canvas;+ }++ private touch() {+ this.mode = 'alive';+ if (this.idleTimer !== null) {+ clearTimeout(this.idleTimer);+ }+ this.idleTimer = setTimeout(() => this.idle(), IDLE_TIMEOUT_MS);+ }++ public idle() {+ if (this.mode !== 'alive') return;+ this.mode = 'idle';++ if (this.idleTimer !== null) {+ clearTimeout(this.idleTimer);+ this.idleTimer = null;+ }++ this.cache.dispose();+ this.queue.dispose();+ this.iterator?.return();+ this.iterator = null;+ this.iteratorStart = Infinity;+ }++ public dispose() {+ if (this.mode === 'discarded') return;+ this.mode = 'discarded';++ if (this.idleTimer !== null) {+ clearTimeout(this.idleTimer);+ this.idleTimer = null;+ }++ this.cache.dispose();+ this.queue.dispose();+ this.iterator?.return();+ this.iterator = null;+ this.iteratorStart = Infinity;++ // Release the display canvas backing store.+ this.canvas.width = 0;+ this.canvas.height = 0;+ }+}++class VideoDecoderQueue {+ private config: VideoDecoderConfig | null = null;+ private decoder: VideoDecoder | null = null;+ private resolver: ReturnType<typeof Promise.withResolvers> | null = null;+ private callback: (frame: VideoFrame) => void;+ public lastSubmitted: EncodedPacket | null = null;++ public constructor(callback: (frame: VideoFrame) => void) {+ this.callback = callback;+ }++ public get isAlive() {+ return this.decoder?.state === 'configured';+ }++ /**+ * Synchronously discard all in-flight work and re-arm the decoder for a fresh keyframe+ */+ public reseed() {+ if (!this.decoder) return;+ this.decoder.reset();+ assert(this.config, 'Decoder config not available');+ this.decoder.configure(this.config);+ this.resolver?.resolve(null);+ this.resolver = null;+ this.lastSubmitted = null;+ }++ private handleOutput(frame: VideoFrame) {+ this.resolver?.resolve(null);+ this.callback(frame);+ frame.close();+ }++ private handleDequeue() {+ this.resolver?.resolve(null);+ this.resolver = null;+ };++ private handleError(e?: DOMException) {+ console.error(e?.message);+ this.dispose();+ }++ public async init(track: InputVideoTrack) {+ this.config = await track.getDecoderConfig();+ assert(this.config, 'Failed to get decoder config from track');+ const support = await VideoDecoder.isConfigSupported(this.config);+ assert(support.supported, 'Decoder config not supported');+ }++ private ensureDecoder(packet: EncodedPacket) {+ if (this.decoder || packet.type === 'delta') return;++ assert(this.config, 'Decoder config not available');++ this.decoder = new VideoDecoder({+ error: this.handleError.bind(this),+ output: this.handleOutput.bind(this),+ });++ this.decoder.addEventListener('dequeue', this.handleDequeue.bind(this));+ this.decoder.configure(this.config);+ }++ public async decode(packet: EncodedPacket) {+ this.ensureDecoder(packet);++ if (this.decoder?.state !== 'configured') {+ this.lastSubmitted = null;+ this.resolver?.resolve(null);+ this.resolver = null;+ return;+ }++ if (this.decoder.decodeQueueSize > 2) {+ this.resolver = Promise.withResolvers();+ }++ this.decoder.decode(packet.toEncodedVideoChunk());+ this.lastSubmitted = packet;++ await this.resolver?.promise;+ }++ public dispose() {+ try {+ this.decoder?.close();+ } catch { /* ignore */ }+ this.resolver?.resolve(null);+ this.decoder = null;+ this.lastSubmitted = null;+ this.resolver = null;+ }+}++/**+ * Dedicated, full-resolution video decoder for export.+ */+export class VideoExporter {+ public errored = false;+ public asset: VideoAsset;+ public initialized: Promise<void>;++ private input: Input | null = null;+ private canvasSink: CanvasSink | null = null;+ private iterator: AsyncGenerator<WrappedCanvas, void, unknown> | null = null;+ private currentCanvas: WrappedCanvas | null = null;+ private firstTimestamp: number = 0;++ public constructor(asset: VideoAsset) {+ this.asset = asset;+ this.initialized = this.initialize();+ }++ private async initialize() {+ try {+ const blob = await this.asset.handle.getFile();+ this.input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });+ const track = await this.input.getPrimaryVideoTrack();+ assert(track, 'Video track not found');+ this.firstTimestamp = await track.getFirstTimestamp() ?? 0;+ this.canvasSink = new CanvasSink(track, { poolSize: 2 });+ } catch (e) {+ console.error('Error initializing video exporter', e);+ this.errored = true;+ }+ }++ public async seekTo(frame: number, frameRate: number): Promise<void> {+ await this.initialized;++ if (this.errored || !this.canvasSink) return;++ const targetFrame = Math.round((frame / frameRate) * this.asset.frameRate);+ const lastFrame = this.currentCanvas+ ? this.secondsToFrames(this.currentCanvas.timestamp)+ : -1;++ if (targetFrame === lastFrame) return;++ if (!this.iterator || targetFrame < lastFrame) {+ this.iterator = this.canvasSink?.canvases(this.framesToSeconds(targetFrame)) ?? null;+ }+ if (!this.iterator) return;++ // Walk forward while the lookahead frame still starts at/before target.+ while (true) {+ const { value, done } = await this.iterator.next();+ if (done || !value) break;++ this.currentCanvas = value;++ if (this.secondsToFrames(value.timestamp) >= targetFrame) {+ break;+ }+ }+ }++ private framesToSeconds(frames: number) {+ return Math.max(this.firstTimestamp, (frames / this.asset.frameRate) + this.firstTimestamp);+ }++ private secondsToFrames(seconds: number) {+ return Math.max(0, Math.round((seconds - this.firstTimestamp) * this.asset.frameRate));+ }++ public toBitmap(): HTMLCanvasElement | OffscreenCanvas | null {+ if (!this.currentCanvas) {+ return null;+ }++ return this.currentCanvas.canvas;+ }++ public idle(): void { }++ public dispose(): void {+ this.iterator?.return();+ this.iterator = null;+ this.input?.dispose();+ }+}++export type VideoDecoderInstance = VideoBuffer | VideoExporter;++const videoTrackCache = new Map<string, Promise<InputVideoTrack | null>>();++export function clearVideoTrackCache() {+ videoTrackCache.clear();+}++export function getVideoTrack(source: VideoAsset) {+ let promise = videoTrackCache.get(source.id);+ if (promise) {+ return promise;+ }++ promise = (async () => {+ try {+ const blob = await source.handle.getFile();+ const input = new Input({+ formats: ALL_FORMATS,+ source: new BlobSource(blob)+ });+ return await input.getPrimaryVideoTrack();+ } catch {+ videoTrackCache.delete(source.id);+ return null;+ }+ })();++ videoTrackCache.set(source.id, promise);+ return promise;+}++export function resolveVideoDecoder(world: EngineWorld, fid: number): VideoDecoderInstance | null {+ const AssetId = world.components.AssetId;+ const assetId = AssetId[fid];+ if (!assetId) return null;++ const existing = world.components.VideoDecoder[fid];+ if (existing && existing.asset.id === assetId) {+ return existing;+ }++ // Asset changed — dispose old decoder and create a new one.+ existing?.dispose();++ const asset = world.assets.get(assetId);+ if (!asset || asset.type !== 'VIDEO') return null;++ addComponent(world, fid, world.components.VideoDecoder, false);++ const decoder = world.mode === 'realtime'+ ? new VideoBuffer(asset)+ : new VideoExporter(asset);+ world.components.VideoDecoder[fid] = decoder;+ return decoder;+}diff --git a/apps/web/src/components/engine/encode/buffer.ts b/apps/web/src/components/engine/encode/buffer.tsnew file mode 100644index 00000000..72705ae7--- /dev/null+++ b/apps/web/src/components/engine/encode/buffer.ts@@ -0,0 +1,50 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { BufferTarget, StreamTarget, Target } from 'mediabunny';++import type { ContainerFormat, WritableFileTarget } from './types';++export class TargetBuffer {+ public target: Target;+ public fastStart: false | 'in-memory';+ public handle: FileSystemFileHandle | WritableFileTarget | undefined;++ public constructor(+ target: StreamTarget | BufferTarget,+ fastStart: false | 'in-memory',+ handle: FileSystemFileHandle | WritableFileTarget | undefined+ ) {+ this.target = target;+ this.fastStart = fastStart;+ this.handle = handle;+ }++ public static async create(+ handle?: FileSystemFileHandle | WritableFileTarget+ ): Promise<TargetBuffer> {+ if (handle) {+ const fileStream = await handle.createWritable();+ return new TargetBuffer(new StreamTarget(fileStream, { chunked: true }), false, handle);+ }++ return new TargetBuffer(new BufferTarget(), 'in-memory', undefined);+ }++ public async close(format: ContainerFormat = 'mp4'): Promise<Blob | undefined> {+ if (this.fastStart === 'in-memory' && this.target instanceof BufferTarget) {+ if (!this.target.buffer) return;+ return new Blob([this.target.buffer], { type: mimeTypes[format] });+ }++ return undefined;+ }+}++const mimeTypes: Record<ContainerFormat, string> = {+ mp4: 'video/mp4',+ webm: 'video/webm',+ ogg: 'audio/ogg',+ mov: 'video/quicktime',+};diff --git a/apps/web/src/components/engine/encode/encoder.ts b/apps/web/src/components/engine/encode/encoder.tsnew file mode 100644index 00000000..56dcc5ca--- /dev/null+++ b/apps/web/src/components/engine/encode/encoder.ts@@ -0,0 +1,490 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { framesToSeconds } from '../utils';+import {+ CanvasSource,+ Output,+ AudioSample,+ AudioSampleSource,+} from 'mediabunny';+import { TargetBuffer } from './buffer';+import { createOutputFormat } from './format';+import { assert } from '@/utils';+import { createRenderEventDetail } from './utils';+import { version } from '../../../../package.json';+import { hasComponent, Hierarchy, Not, Or, query } from 'bitecs';++import { ChildOf } from '../components';+import { createEngineWorld, switchActiveScene } from '../api';+import { recomputeEntityTimeRange } from '../api/utils';+import { addComponent, removeComponent } from '../api/events';+import { playbackSystem } from '../systems/playback';+import { motionSystem } from '../systems/motion';+import { transformSystem } from '../systems/transform';+import { renderSystem } from '../systems/render';+import { cloneFromRecords, serializeEntity } from '../api/serialize';+import { getEntityTree } from '../api/query';+import { AudioBus } from '../services/audio-bus';++import type { EngineWorld } from '../api/world';+import type { EncoderConfig } from './interfaces';+import type { ExportResult } from './types';++export async function createEncoder(sourceWorld: EngineWorld, config: EncoderConfig) {+ const sourceComponents = sourceWorld.components;+ const sourceSceneEid = config.scene;+ const frameRate = config.video?.fps ?? sourceWorld.frameRate;+ const numberOfChannels = config.audio?.numberOfChannels ?? 2;+ const sampleRate = config.audio?.sampleRate ?? 48000;+ const sceneWidth = sourceComponents.Computed.width[sourceSceneEid];+ const sceneHeight = sourceComponents.Computed.height[sourceSceneEid];+ const sceneEnd = sourceComponents.Computed.end[sourceSceneEid];++ // Honor the scene's Trim component (the timeline workarea): render only the+ // frames between Trim.start and Trim.end instead of the full scene+ // duration.+ const hasWorkarea = hasComponent(sourceWorld, sourceSceneEid, sourceComponents.Trim);+ const workareaStart = hasWorkarea+ ? Math.max(0, Math.min(sceneEnd, sourceComponents.Trim.start[sourceSceneEid] ?? 0))+ : 0;+ const workareaEnd = hasWorkarea+ ? Math.max(workareaStart, Math.min(sceneEnd, sourceComponents.Trim.end[sourceSceneEid] ?? sceneEnd))+ : sceneEnd;+ const workareaFrames = workareaEnd - workareaStart;++ const playheadStartSeconds = framesToSeconds(workareaStart, sourceWorld.frameRate);+ const duration = framesToSeconds(workareaFrames, sourceWorld.frameRate);+ const audioBitrate = config.audio?.bitrate ?? 128e3;+ const videoBitrate = config.video?.bitrate ?? 10e6;+ const audioCodec = config.audio?.codec ?? 'aac';+ const resolution = config.video?.resolution ?? 1080;+ const scale = Math.round(resolution * 1e6 / sceneHeight) / 1e6;+ const width = Math.round(sceneWidth * scale / 2) * 2;+ const height = Math.round(sceneHeight * scale / 2) * 2;+ const videoCodec = config.video?.codec ?? 'avc';+ const containerFormat = config.format ?? 'mp4';+ const audioEnabled = config.audio?.enabled ?? true;+ const videoEnabled = config.video?.enabled ?? true;+ const frameDuration = 1 / frameRate;++ if (config.format === 'ogg') {+ config.audio = { ...config.audio, enabled: true };+ config.video = { ...config.video, enabled: false };+ }++ const sceneSubtree = getEntityTree(sourceWorld, sourceSceneEid);+ const subtreeRecords = sceneSubtree.map(eid => serializeEntity(sourceWorld, eid));++ // Offscreen canvas+ const offscreenCanvas = new OffscreenCanvas(width, height);+ const offscreenCtx = offscreenCanvas.getContext('2d')!;++ // Offline audio context+ const offlineAudioCtx = new OfflineAudioContext(+ numberOfChannels,+ Math.ceil(duration * sampleRate),+ sampleRate,+ );++ // Build a fresh offline world that shares assets with the source. Fonts are+ // already loaded into the document; copying the array just tracks them as+ // loaded so the new world doesn't try to re-add them.+ const world = createEngineWorld(sourceWorld.projectId, offlineAudioCtx);+ world.mode = videoEnabled ? 'offline-video' : 'offline-audio';+ world.assets = sourceWorld.assets;+ world.fonts = [...sourceWorld.fonts];+ world.ctx = offscreenCtx;+ world.canvas = offscreenCanvas;+ world.resolution = scale;+ world.camera = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };+ world.frameRate = frameRate;+ world.promises = [];++ const eidMap = cloneFromRecords(world, subtreeRecords);+ const sceneEid = eidMap.get(sourceSceneEid);+ assert(sceneEid !== undefined, 'Failed to clone scene subtree');++ rescaleFrameTimestamps(world, sourceWorld.frameRate, frameRate);+ rescaleAllTimeRanges(world);+ normalizeSceneTransform(world, sceneEid);++ switchActiveScene(world, sceneEid);++ const c = world.components;+ // Drop the scene's Trim in the offline world — the encoder drives the+ // playhead explicitly within the workarea window, and leaving Trim in place+ // would only affect the (skipped) realtime advancePlayhead branch anyway.+ if (hasComponent(world, sceneEid, c.Trim)) {+ // Render-only mutation on the offline world — keep it off the undo stack.+ removeComponent(world, sceneEid, c.Trim, false);+ }+ c.Computed.localTimeInSeconds[sceneEid] = playheadStartSeconds;+ c.Computed.localTime[sceneEid] = Math.round(playheadStartSeconds * frameRate);+ c.Playback.playing[sceneEid] = 1;+ c.Playback.loop[sceneEid] = 0;+ c.Playback.speed[sceneEid] = 1;+ // Anchor audio scheduling: context starts at t=0 but the playhead starts at+ // playheadStartSeconds, so audioDelay = -playheadStartSeconds shifts each+ // entity's scheduled audio back into the encoded window.+ c.AudioPlayback.contextOffsetInSeconds[sceneEid] = 0;+ c.AudioPlayback.timelineOffsetInSeconds[sceneEid] = playheadStartSeconds;++ // Set up mediabunny output+ const buffer = await TargetBuffer.create(config.target);+ const format = await createOutputFormat(buffer, config.format);+ const output = new Output({ format, target: buffer.target });++ output.setMetadataTags({+ comment: `Made with Diffusion v${version}`,+ });++ const audioSource = new AudioSampleSource({+ codec: audioCodec,+ bitrate: audioBitrate,+ });++ const sceneFills = [...query(world, [c.Paint, ChildOf(sceneEid), Not(c.Deleted)])];++ const videoSource = new CanvasSource(offscreenCanvas, {+ codec: videoCodec,+ bitrate: videoBitrate,+ latencyMode: 'quality',+ alpha: containerFormat === 'webm' && !sceneFills.length+ ? 'keep'+ : 'discard',+ });++ if (audioEnabled) {+ output.addAudioTrack(audioSource);+ }++ if (videoEnabled) {+ output.addVideoTrack(videoSource);+ }++ // Audio worklet streams render-quantum chunks back to the main thread so+ // we can hand them to mediabunny in step with the visual frame loop.+ const audioWorkletUrl = createAudioWorkletUrl();+ await offlineAudioCtx.audioWorklet.addModule(audioWorkletUrl);++ const sharedBuffer = new SharedArrayBuffer(4);+ const sharedUint32Array = new Uint32Array(sharedBuffer);+ const mixNode = offlineAudioCtx.createGain();++ const sinkNode = new AudioWorkletNode(offlineAudioCtx, 'sink', {+ channelCount: numberOfChannels,+ channelCountMode: 'explicit',+ numberOfInputs: 1,+ numberOfOutputs: 1,+ outputChannelCount: [numberOfChannels],+ processorOptions: {+ buffer: sharedUint32Array,+ },+ });++ mixNode.connect(sinkNode);+ sinkNode.connect(offlineAudioCtx.destination);++ // connect the scene bus to the mix node+ addComponent(world, sceneEid, c.AudioBus, false);+ const newbus = new AudioBus(world, sceneEid);+ c.AudioBus[sceneEid] = newbus;+ newbus.connect(mixNode);++ let sampleIndex = 0;+ let audioSourcePromise: Promise<void> | null = null;++ const allAudioReceived = Promise.withResolvers<void>();++ sinkNode.port.onmessage = event => {+ if (output?.state === 'canceled') {+ return;+ }++ const planarBuffer = event.data as Float32Array;++ if (planarBuffer.length === 0) {+ allAudioReceived.resolve();+ return;+ }++ const sampleCount = planarBuffer.length / numberOfChannels;++ const audioSample = new AudioSample({+ data: planarBuffer,+ format: 'f32-planar',+ numberOfChannels,+ sampleRate,+ timestamp: sampleIndex / sampleRate,+ });+ audioSourcePromise = audioSource.add(audioSample).finally(() => {+ audioSample.close();+ });++ sampleIndex += sampleCount;+ };++ const emitProgress = createThrottledCallback(config.onProgress, 1000 / 3); // 3 times per second++ let canceled = false;+ const cancel = () => (canceled = true);++ const render = async (): Promise<ExportResult> => {+ try {+ await output.start();+ const start = performance.now();+ const startTime = start;+ const totalFrames = Math.floor(duration * frameRate);++ let audioRenderingDone = false;+ let audioRenderingCompleted: Promise<AudioBuffer> | null = null;+ if (audioEnabled) {+ audioRenderingCompleted = offlineAudioCtx.startRendering();+ audioRenderingCompleted.then(() => { audioRenderingDone = true; });+ }++ let lastAudioSampleCount = 0;++ for (let frame = 0; frame < totalFrames; frame++) {+ if (canceled) {+ await output.cancel();+ Atomics.store(sharedUint32Array, 0, 2 ** 31 - 1);+ return { type: 'canceled' };+ }++ const timestamp = frame * frameDuration;+ const playheadSeconds = playheadStartSeconds + timestamp;++ // advancePlayhead is a no-op in offline mode; the encoder owns the+ // playhead and writes both seconds + frames before each tick.+ c.Computed.localTimeInSeconds[sceneEid] = playheadSeconds;+ c.Computed.localTime[sceneEid] = Math.round(playheadSeconds * frameRate);+ world.timestamp.delta = frameDuration * 1000;+ world.timestamp.now += world.timestamp.delta;++ {+ playbackSystem(world);+ await resolverSystem(world);+ motionSystem(world);+ }++ if (videoEnabled) {+ // only visual systems+ transformSystem(world);+ renderSystem(world);+ }++ if (videoEnabled) {+ await videoSource.add(timestamp, frameDuration);+ }++ if (audioEnabled) {+ await audioSourcePromise;++ while (Atomics.load(sharedUint32Array, 0) > sampleRate && !audioRenderingDone) {+ await new Promise(resolve => setTimeout(resolve, 0));+ }++ const totalAudioSampleCount = Math.floor(timestamp * sampleRate);+ const diff = totalAudioSampleCount - lastAudioSampleCount;+ Atomics.add(sharedUint32Array, 0, diff);+ lastAudioSampleCount = totalAudioSampleCount;+ }++ emitProgress(createRenderEventDetail(frame, totalFrames, startTime));+ }++ console.info(+ `Encoded frames at ${((totalFrames * 1000) / (performance.now() - start)).toFixed(2)}FPS`+ );++ if (audioEnabled) {+ assert(audioRenderingCompleted !== null, 'Audio rendering was not started');++ Atomics.add(+ sharedUint32Array,+ 0,+ Math.ceil(duration * sampleRate) + sampleRate - lastAudioSampleCount,+ );++ await audioRenderingCompleted;++ sinkNode.port.postMessage(null);+ await allAudioReceived.promise;+ }++ console.info('Finalizing file');++ await output.finalize();++ console.info('Export complete');++ return {+ type: 'success',+ data: await buffer.close(containerFormat),+ };+ } catch (e) {+ return {+ type: 'error',+ error: e instanceof Error ? e : new Error('Unknown error'),+ };+ } finally {+ URL.revokeObjectURL(audioWorkletUrl);+ }+ };++ return {+ render,+ cancel,+ };+}+++function audioWorkletCode() {+ // eslint-disable-next-line no-undef+ class SinkProcessor extends AudioWorkletProcessor {+ buffer: Uint32Array;++ constructor(options: {+ processorOptions: {+ buffer: Uint32Array;+ };+ }) {+ super();++ this.buffer = options.processorOptions.buffer;++ this.port.onmessage = () => {+ this.port.postMessage(new Float32Array(0));+ };+ }++ process(inputs: Float32Array[][], outputs: Float32Array[][]) {+ const input = inputs[0];+ const output = outputs[0];+ const renderQuantum = output[0].length;++ while (Atomics.load(this.buffer, 0) < renderQuantum);++ const planarBuffer = new Float32Array(output.length * output[0].length);+ for (let channel = 0; channel < Math.min(input.length, output.length); channel++) {+ planarBuffer.set(input[channel], channel * output[0].length);+ }++ this.port.postMessage(planarBuffer, [planarBuffer.buffer]);++ Atomics.sub(this.buffer, 0, renderQuantum);++ return true;+ }+ }++ // eslint-disable-next-line no-undef+ registerProcessor('sink', SinkProcessor);+}++function createAudioWorkletUrl(): string {+ const blob = new Blob([`(${audioWorkletCode.toString()})()`], { type: 'application/javascript' });+ return URL.createObjectURL(blob);+}++function createThrottledCallback<T>(callback: ((value: T) => void) | undefined, intervalMs: number): (value: T) => void {+ let lastCalledAt = -Infinity;++ return (value: T) => {+ const now = performance.now();+ if (now - lastCalledAt < intervalMs) {+ return;+ }++ lastCalledAt = now;+ callback?.(value);+ };+}++function rescaleFrameTimestamps(+ world: EngineWorld,+ sourceFrameRate: number,+ targetFrameRate: number,+): void {+ if (sourceFrameRate === targetFrameRate) return;++ const c = world.components;+ const ratio = targetFrameRate / sourceFrameRate;+ const rescale = (v: number) => Math.round(v * ratio);++ for (const eid of query(world, [Or(c.Delay, c.Trim, c.Transition, c.Keyframe, c.Animation)])) {+ if (hasComponent(world, eid, c.Delay)) {+ c.Delay[eid] = rescale(c.Delay[eid] ?? 0);+ }+ if (hasComponent(world, eid, c.Trim)) {+ c.Trim.start[eid] = rescale(c.Trim.start[eid] ?? 0);+ c.Trim.end[eid] = rescale(c.Trim.end[eid] ?? 0);+ }+ if (hasComponent(world, eid, c.Transition)) {+ c.Transition.duration[eid] = rescale(c.Transition.duration[eid] ?? 0);+ }+ if (hasComponent(world, eid, c.Keyframe)) {+ c.Keyframe.time[eid] = rescale(c.Keyframe.time[eid] ?? 0);+ }+ if (hasComponent(world, eid, c.Animation)) {+ c.Animation.duration[eid] = rescale(c.Animation.duration[eid] ?? 0);+ c.Animation.delay[eid] = rescale(c.Animation.delay[eid] ?? 0);+ }+ }+}++function normalizeSceneTransform(world: EngineWorld, sceneEid: number): void {+ const c = world.components;+ c.Position.x[sceneEid] = 0;+ c.Position.y[sceneEid] = 0;+ c.Offset.x[sceneEid] = 0;+ c.Offset.y[sceneEid] = 0;+ c.Rotation[sceneEid] = 0;+ c.Scale.x[sceneEid] = 1;+ c.Scale.y[sceneEid] = 1;+ c.Skew.x[sceneEid] = 0;+ c.Skew.y[sceneEid] = 0;+ // computeLocalMatrix reads the Computed.* mirror, not the raw components.+ // The base components are populated via setComponent during the clone, which+ // fires the observer that copies the (canvas) position into Computed. Writing+ // the raw arrays above bypasses that observer, so the Computed mirror must be+ // reset here too — otherwise the scene renders at its canvas position instead+ // of centered in the export.+ c.Computed.positionX[sceneEid] = 0;+ c.Computed.positionY[sceneEid] = 0;+ c.Computed.offsetX[sceneEid] = 0;+ c.Computed.offsetY[sceneEid] = 0;+ c.Computed.rotation[sceneEid] = 0;+ c.Computed.scaleX[sceneEid] = 1;+ c.Computed.scaleY[sceneEid] = 1;+ c.Computed.skewX[sceneEid] = 0;+ c.Computed.skewY[sceneEid] = 0;+}++async function resolverSystem(world: EngineWorld) {+ if (world.promises?.length) {+ await Promise.all(world.promises.filter(promise => promise !== null));+ world.promises = [];+ }+}++function rescaleAllTimeRanges(world: EngineWorld): void {+ const c = world.components;+ // TODO: Find a better solution for this+ // Hierarchy(ChildOf) yields parents before children (top-down). A single pass+ // is wrong for group-like nodes: their bounds aggregate from children, but the+ // children haven't been rescaled yet when the parent is visited, so the group+ // would inherit stale (pre-rescale) child bounds. Do two passes:+ // 1. top-down — refresh accumulated delay + leaf/Trim bounds (parents first)+ // 2. bottom-up — groups now aggregate from already-rescaled children+ const entities = query(world, [Or(c.Geometry, c.Group), Hierarchy(ChildOf), Not(c.Deleted)]);+ for (let i = 0; i < entities.length; i++) {+ recomputeEntityTimeRange(world, entities[i]);+ }+ for (let i = entities.length - 1; i >= 0; i--) {+ recomputeEntityTimeRange(world, entities[i]);+ }+}diff --git a/apps/web/src/components/engine/encode/format.ts b/apps/web/src/components/engine/encode/format.tsnew file mode 100644index 00000000..1b831363--- /dev/null+++ b/apps/web/src/components/engine/encode/format.ts@@ -0,0 +1,25 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { TargetBuffer } from './buffer';+import type { ContainerFormat } from './types';++/**+ * Lazily imports the output format based on the format specified+ */+export async function createOutputFormat(buffer: TargetBuffer, format?: ContainerFormat) {+ if (format == 'webm') {+ const { WebMOutputFormat } = await import('mediabunny');+ return new WebMOutputFormat();+ } else if (format == 'ogg') {+ const { OggOutputFormat } = await import('mediabunny');+ return new OggOutputFormat();+ } else if (format == 'mov') {+ const { MovOutputFormat } = await import('mediabunny');+ return new MovOutputFormat();+ } else {+ const { Mp4OutputFormat } = await import('mediabunny');+ return new Mp4OutputFormat({ fastStart: buffer.fastStart });+ }+}diff --git a/apps/web/src/components/engine/encode/interfaces.ts b/apps/web/src/components/engine/encode/interfaces.tsnew file mode 100644index 00000000..0e8d7238--- /dev/null+++ b/apps/web/src/components/engine/encode/interfaces.ts@@ -0,0 +1,126 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { VideoCodec, AudioCodec } from 'mediabunny';+import type { ContainerFormat, EncoderProgress, WritableFileTarget } from './types';++export interface AudioConfig {+ /**+ * Enable audio encoding+ * @default true+ */+ enabled?: boolean;++ /**+ * A floating point number indicating the audio context's sample rate, in samples per second.+ * @default 48000+ */+ sampleRate?: number;++ /**+ * Defines the number of channels of the composed audio+ * @default 2+ */+ numberOfChannels?: number;++ /**+ * Defines the bitrate at which the audio should be rendered at+ * @default 128e3+ */+ bitrate?: number;++ /**+ * Defines the codec to use for the audio+ * @default 'aac'+ */+ codec?: AudioCodec;+}++export interface VideoConfig {+ /**+ * Defines the codec to use for the video+ * @default 'avc'+ */+ codec?: VideoCodec;++ /**+ * The full codec string as specified in the WebCodecs API Codec Registry.+ */+ fullCodecString?: string;++ /**+ * Enable video encoding+ * @default true+ */+ enabled?: boolean;++ /**+ * Defines the bitrate at which the video should be rendered at+ * @default 10e6+ */+ bitrate?: number;++ /**+ * Defines the fps at which the composition will be rendered+ * @default 30+ */+ fps?: number;++ /**+ * Resolution of the composition+ * @example+ * 1080 for 1080p+ * 1440 for 1440p+ * 2160 for 4k+ * @default 1080+ */+ resolution?: number;+}++export interface EncoderConfig {+ /**+ * Video encoding configuration+ */+ video?: VideoConfig;++ /**+ * Audio encoding configuration+ */+ audio?: AudioConfig;++ /**+ * Defines the output format of the encoded file+ * @default 'mp4'+ */+ format?: ContainerFormat;++ /**+ * Defines the range of the composition to encode+ */+ trim?: {+ /**+ * Defines the time when the encoding should end+ * @default scene.duration+ */+ end?: number;+ };++ /**+ * Defines the target file to encode to.+ * When a FileSystemFileHandle (or any WritableFileTarget) is provided, the+ * output is streamed to the file. When omitted, the output is buffered in+ * memory and returned as a Blob in the ExportResult.+ */+ target?: FileSystemFileHandle | WritableFileTarget;++ /**+ * Defines the progress callback+ */+ onProgress?: (progress: EncoderProgress) => void;++ /**+ * Defines the source scene to encode+ */+ scene: number;+}diff --git a/apps/web/src/components/engine/encode/types.ts b/apps/web/src/components/engine/encode/types.tsnew file mode 100644index 00000000..40408172--- /dev/null+++ b/apps/web/src/components/engine/encode/types.ts@@ -0,0 +1,31 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { StreamTargetChunk } from 'mediabunny';++export type ContainerFormat = 'mp4' | 'webm' | 'ogg' | 'mov';++// Minimal FileSystemFileHandle-shaped target+export interface WritableFileTarget {+ createWritable(): Promise<WritableStream<StreamTargetChunk>>;+}++export type EncoderProgress = {+ total: number;+ progress: number;+ remaining: Date;+};++export type ExportResult =+ | {+ type: 'success';+ data: Blob | undefined;+ }+ | {+ type: 'canceled';+ }+ | {+ type: 'error';+ error: Error;+ };diff --git a/apps/web/src/components/engine/encode/utils.ts b/apps/web/src/components/engine/encode/utils.tsnew file mode 100644index 00000000..99496a5a--- /dev/null+++ b/apps/web/src/components/engine/encode/utils.ts@@ -0,0 +1,22 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Helper for creating the render event detail+ */+export function createRenderEventDetail(progress: number, total: number, startTime: number) {+ const duration = performance.now() - startTime;+ const time = (duration / gte1(progress)) * (total - progress);+ const remaining = new Date(time);++ return { remaining, progress, total };+}++/**+ * Helper for making sure a number is greater than 1+ */+function gte1(num: number): number {+ if (num < 1) return 1;+ return num;+}diff --git a/apps/web/src/components/engine/font/fixtures.ts b/apps/web/src/components/engine/font/fixtures.tsnew file mode 100644index 00000000..62f7b079--- /dev/null+++ b/apps/web/src/components/engine/font/fixtures.ts@@ -0,0 +1,62 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export const WebFonts = {+ Inter: {+ weights: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],+ url: 'https://fonts.gstatic.com/s/inter/v20/UcCo3FwrK3iLTcviYwYZ8UA3.woff2',+ },+ 'The Bold Font': {+ weights: ['500'],+ url: 'https://diffusion-studio-public.s3.eu-central-1.amazonaws.com/fonts/the-bold-font.ttf',+ },+ 'Komika Axis': {+ weights: ['400'],+ url: 'https://diffusion-studio-public.s3.eu-central-1.amazonaws.com/fonts/komika-axis.ttf',+ },+ Geologica: {+ weights: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],+ url: 'https://fonts.gstatic.com/s/geologica/v1/oY1l8evIr7j9P3TN9YwNAdyjzUyDKkKdAGOJh1UlCDUIhAIdhCZOn1fLsig7jfvCCPHZckUWE1lELWNN-w.woff2',+ },+ Nunito: {+ weights: ['200', '300', '400', '500', '600', '700', '800', '900'],+ url: 'https://fonts.gstatic.com/s/nunito/v26/XRXV3I6Li01BKofINeaBTMnFcQ.woff2',+ },+ Figtree: {+ weights: ['300', '400', '500', '600', '700', '800', '900'],+ url: 'https://fonts.gstatic.com/s/figtree/v5/_Xms-HUzqDCFdgfMm4S9DaRvzig.woff2',+ },+ Urbanist: {+ weights: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],+ url: 'https://fonts.gstatic.com/s/urbanist/v15/L0x-DF02iFML4hGCyMqlbS1miXK2.woff2',+ },+ Montserrat: {+ weights: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],+ url: 'https://fonts.gstatic.com/s/montserrat/v26/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2',+ },+ Bangers: {+ weights: ['400'],+ url: 'https://fonts.gstatic.com/s/bangers/v20/FeVQS0BTqb0h60ACH55Q2J5hm24.woff2',+ },+ Chewy: {+ weights: ['400'],+ url: 'https://fonts.gstatic.com/s/chewy/v18/uK_94ruUb-k-wn52KjI9OPec.woff2',+ },+ 'Source Code Pro': {+ weights: ['200', '300', '400', '500', '600', '700', '800', '900'],+ url: 'https://fonts.gstatic.com/s/sourcecodepro/v22/HI_SiYsKILxRpg3hIP6sJ7fM7PqlPevWnsUnxg.woff2',+ },+} as const;++export const FONT_WEIGHTS = {+ '100': 'Thin',+ '200': 'Extra Light',+ '300': 'Light',+ '400': 'Normal',+ '500': 'Medium',+ '600': 'Semi Bold',+ '700': 'Bold',+ '800': 'Extra Bold',+ '900': 'Black',+} as const;diff --git a/apps/web/src/components/engine/font/index.ts b/apps/web/src/components/engine/font/index.tsnew file mode 100644index 00000000..1afa1c0f--- /dev/null+++ b/apps/web/src/components/engine/font/index.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './utils';+export * from './types';+export * from './fixtures';diff --git a/apps/web/src/components/engine/font/types.ts b/apps/web/src/components/engine/font/types.tsnew file mode 100644index 00000000..5723b586--- /dev/null+++ b/apps/web/src/components/engine/font/types.ts@@ -0,0 +1,44 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */+++import type { FontStyle } from '../components';++++/**+ * Defines the properties that are required+ * to load a new font+ */+export type FontSource = {+ /**+ * Name of the Family+ * @example 'Arial'+ */+ family: string;+ /**+ * Source of the Variant+ * @example url(arial.ttf)+ */+ source: string;+ /**+ * Defines the font style+ * @example 'italic'+ */+ style?: FontStyle;+ /**+ * The weight of the font+ * @example '400'+ */+ weight?: string;+};++/**+ * Defines a single font that has one or+ * more variants+ */+export type FontSources = {+ family: string;+ variants: FontSource[];+};diff --git a/apps/web/src/components/engine/font/utils.ts b/apps/web/src/components/engine/font/utils.tsnew file mode 100644index 00000000..dda16a37--- /dev/null+++ b/apps/web/src/components/engine/font/utils.ts@@ -0,0 +1,178 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { WebFonts } from './fixtures';+import { FontStyle } from '../components';++import type * as types from './types';+import type { EngineWorld } from '../api/world';++const STYLE_MAP = {+ [FontStyle.NORMAL]: 'normal',+ [FontStyle.ITALIC]: 'italic',+ [FontStyle.OBLIQUE]: 'oblique',+} as const;++/**+ * Get all available local fonts, requires the+ * **Local Font Access API**+ */+export async function getLocalFonts(): Promise<types.FontSources[]> {+ const localFonts: Record<string, any> = {};++ // group by font family+ for (const font of await window.queryLocalFonts()) {+ if (font.family in localFonts) {+ localFonts[font.family].push(font);+ continue;+ }+ localFonts[font.family] = [font];+ }++ return Object.keys(localFonts).map((family: any) => {+ return {+ family,+ variants: localFonts[family].map((font: any) => {+ return {+ family,+ source: `local('${font.fullName}'), local('${font.postscriptName}')`,+ weight: matchFontWeight(font.style),+ style: matchFontStyle(font.style),+ };+ }),+ };+ });+}++/**+ * Get common web fonts+ */+export function getWebFonts(): types.FontSources[] {+ return Object.keys(WebFonts).map((family) => {+ return {+ family,+ variants: WebFonts[family as keyof typeof WebFonts].weights.map((weight) => {+ return {+ family,+ source: `url(${WebFonts[family as keyof typeof WebFonts].url})`,+ weight: weight,+ };+ }),+ };+ });+}++export async function loadWebFont(+ world: EngineWorld,+ family: keyof typeof WebFonts,+ style: FontStyle = FontStyle.NORMAL,+ weight?: string,+) {+ const source = `url(${WebFonts[family].url})`;+ const font: types.FontSource = {+ source,+ family,+ weight,+ style,+ };++ // Already loaded+ if (world.fonts.some((f) => f.source === font.source && f.weight === font.weight)) {+ return font;+ }++ world.fonts.push(font);++ // Load all weights if no weight is specified+ if (!weight) {+ const config = WebFonts[family as keyof typeof WebFonts];+ const weights = config.weights;+ weight = weights.length > 1 ? `${weights[0]} ${weights[weights.length - 1]}` : weights[0]+ }++ const fontFace = new FontFace(family, source, { weight, style: STYLE_MAP[style] });++ await new Promise((resolve, reject) => {+ fontFace+ .load()+ .then((font) => {+ document.fonts.add(font);+ resolve(null);+ })+ .catch((error) => {+ world.fonts = world.fonts.filter((f) => f.source !== font.source && f.weight !== font.weight);+ reject(error);+ });+ });++ const db = await world.store.db;+ await db.put('fonts', font);+}++export async function restoreFonts(world: EngineWorld): Promise<void> {+ const db = await world.store.db;++ for (const font of await db.getAll('fonts')) {+ if (font.family in WebFonts) {+ await loadWebFont(+ world,+ font.family as keyof typeof WebFonts,+ font.style as FontStyle,+ font.weight,+ );+ }+ }+}++function matchFontStyle(style: any) {+ if (`${style}`.match(/oblique/i)) {+ return FontStyle.OBLIQUE;+ }++ if (`${style}`.match(/italic/i)) {+ return FontStyle.ITALIC;+ }++ return FontStyle.NORMAL;+}++function matchFontWeight(weight: any) {+ if (`${weight}`.match(/black|heavy/i)) {+ return '900';+ }++ if (`${weight}`.match(/extrabold|ultrabold/i)) {+ return '800';+ }++ if (`${weight}`.match(/semibold|demibold/i)) {+ return '600';+ }++ if (`${weight}`.match(/bold|strong/i)) {+ return '700';+ }++ if (`${weight}`.match(/medium/i)) {+ return '500';+ }++ if (`${weight}`.match(/normal|regular|book|plain/i)) {+ return '400';+ }++ if (`${weight}`.match(/extralight|ultralight/i)) {+ return '200';+ }++ if (`${weight}`.match(/thin|hairline/i)) {+ return '100';+ }++ if (`${weight}`.match(/light/i)) {+ return '300';+ }++ return '400';+}diff --git a/apps/web/src/components/engine/hooks/index.ts b/apps/web/src/components/engine/hooks/index.tsnew file mode 100644index 00000000..951d0059--- /dev/null+++ b/apps/web/src/components/engine/hooks/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './use-ecs';diff --git a/apps/web/src/components/engine/hooks/use-ecs.ts b/apps/web/src/components/engine/hooks/use-ecs.tsnew file mode 100644index 00000000..d8848ec2--- /dev/null+++ b/apps/web/src/components/engine/hooks/use-ecs.ts@@ -0,0 +1,253 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createMemo, createSignal, onCleanup, type Accessor } from 'solid-js';+import { domSyncSubs, querySyncSubs, tagSyncSubs, worldStateSyncSubs } from '../systems/dom';++import type { ValueSyncSub, TagSyncSub, QuerySyncSub, WorldStateSyncSub } from '../systems/dom';+import type { EngineWorld } from '../api/world';+import type { QueryTerm } from 'bitecs';++type EidAccessor = number | null | undefined | Accessor<number | null | undefined>;+++/**+ * Subscribe to an ECS component field/scalar for a given entity.+ * Pass the SoA array directly (e.g. `world.components.Position.x`).+ * Returns a SolidJS accessor that stays in sync every frame.+ */+export function useEntityState<T>(store: T[], eid: EidAccessor, initial: T): Accessor<T>;+export function useEntityState<T>(store: T[], eid?: EidAccessor, initial?: undefined): Accessor<T | undefined>;+export function useEntityState<T>(store: T[], eid?: EidAccessor, initial?: T): Accessor<T | undefined> {+ const [value, setValue] = createSignal(initial);+ let currentSub: ValueSyncSub | undefined;++ const resolvedEid = createMemo(() => {+ if (typeof eid === 'function') {+ return eid();+ }+ return eid;+ })++ createEffect(() => {+ const currentEid = resolvedEid();++ // Tear down previous subscription when eid changes+ if (currentSub) {+ domSyncSubs.delete(currentSub);+ currentSub = undefined;+ }++ if (typeof currentEid !== 'number') {+ setValue(() => initial);+ return;+ }++ // Prime synchronously from the store when (re)subscribing. Without this,+ // a value left over from a previously-tracked eid would persist whenever+ // the new eid's stored value equals `initial`, since dom-sync only fires+ // on a *change* and the fresh sub starts at `prev: initial`. (Same hazard+ // the plural `useEntityStates` guards against — reusing a row instance for+ // a different entity, e.g. on reorder, would otherwise show a stale value.)+ const stored = (store as unknown[])[currentEid] as T | undefined;+ const primed = stored !== undefined ? stored : initial;+ setValue(() => primed);++ const sub: ValueSyncSub = {+ store: store as unknown[],+ eid: currentEid,+ prev: primed,+ set: (v) => setValue(() => v as T),+ };+ domSyncSubs.add(sub);+ currentSub = sub;+ });++ onCleanup(() => {+ if (currentSub) {+ domSyncSubs.delete(currentSub);+ }+ });++ return value;+}+++type EidAccessors = number[] | Accessor<number[]>;++/**+ * Fan-out of `useEntityState` over a list of entities. The list itself may be+ * reactive (e.g. from `useQuery`). Returns one value per eid, in the same+ * order as the input. Subs are torn down and rebuilt when the eid list changes.+ */+export function useEntityStates<T>(store: T[], eids: EidAccessors, initial: T): Accessor<T[]>;+export function useEntityStates<T>(store: T[], eids: EidAccessors, initial?: undefined): Accessor<(T | undefined)[]>;+export function useEntityStates<T>(store: T[], eids: EidAccessors, initial?: T): Accessor<(T | undefined)[]> {+ const resolvedEids = createMemo(() => {+ if (typeof eids === 'function') {+ return eids();+ }+ return eids;+ });++ const [values, setValues] = createSignal<(T | undefined)[]>([]);+ let currentSubs: ValueSyncSub[] = [];++ const unsubAll = () => {+ for (const sub of currentSubs) {+ domSyncSubs.delete(sub);+ }+ currentSubs = [];+ };++ createEffect(() => {+ unsubAll();++ const currentEids = resolvedEids();++ // Prime values synchronously from the store. Without this, consumers+ // would see `undefined` slots until the next dom-sync tick — and slots+ // whose stored value already equals `initial` would never trigger a+ // sync at all, since dom-sync only fires on a *change*.+ const primed: (T | undefined)[] = currentEids.map(eid => {+ const v = (store as unknown[])[eid] as T | undefined;+ return v !== undefined ? v : initial;+ });+ setValues(primed);++ currentSubs = currentEids.map((eid, i) => {+ const sub: ValueSyncSub = {+ store: store as unknown[],+ eid,+ prev: primed[i],+ set: (v) => setValues(prev => {+ const next = [...prev];+ next[i] = v as T;+ return next;+ }),+ };+ domSyncSubs.add(sub);+ return sub;+ });+ });++ onCleanup(unsubAll);++ return values;+}++/**+ * Subscribe to an ECS tag component for a given entity.+ * Returns a SolidJS accessor that stays in sync every frame.+ * To mutate, call `addComponentTracked` / `removeComponentTracked` directly.+ */+export function useEntityTag(component: object, eid?: EidAccessor): Accessor<boolean> {+ const [value, setValue] = createSignal(false);+ let currentSub: TagSyncSub | undefined;++ const resolvedEid = createMemo(() => {+ if (typeof eid === 'function') {+ return eid();+ }+ return eid;+ })++++ createEffect(() => {+ const currentEid = resolvedEid();++ if (currentSub) {+ tagSyncSubs.delete(currentSub);+ currentSub = undefined;+ }++ if (!currentEid) {+ setValue(false);+ return;+ }++ // Reset to the absent state whenever we (re)subscribe to a different eid.+ // Without this, a stale `true` left over from the previously-tracked eid+ // persists if the new eid lacks the tag: the fresh sub starts at+ // `prev: false` and dom-sync only fires `set` on a *change*, so it never+ // corrects `false`. This surfaces when an <Index> reuses a row instance+ // for a different entity (e.g. reordering layers) — two rows would then+ // appear Selected at once.+ setValue(false);++ const sub: TagSyncSub = {+ component,+ eid: currentEid,+ prev: false,+ set: (v) => setValue(v),+ };+ tagSyncSubs.add(sub);+ currentSub = sub;+ });++ onCleanup(() => {+ if (currentSub) {+ tagSyncSubs.delete(currentSub);+ }+ });++ return value;+}++export function useQuery(query: QueryTerm[]): Accessor<number[]> {+ const [value, setValue] = createSignal<number[]>([]);+ let currentSub: QuerySyncSub | undefined;++ createEffect(() => {+ const sub: QuerySyncSub = {+ query,+ prev: new Uint32Array(0),+ set: (result) => setValue(result),+ };+ querySyncSubs.add(sub);+ currentSub = sub;+ });++ onCleanup(() => {+ if (currentSub) {+ querySyncSubs.delete(currentSub);+ }+ });++ return value;+}++/**+ * Subscribe to a world-level state value via a getter. Examples:+ * useWorldState(w => w.selection.scene, null)+ * useWorldState(w => w.camera.a, 1)+ * useWorldState(w => w.background, 0x171717)+ */+export function useWorldState<T>(get: (world: EngineWorld) => T, initial: T): Accessor<T> {+ const [value, setValue] = createSignal<T>(initial);+ let currentSub: WorldStateSyncSub | undefined;++ createEffect(() => {+ if (currentSub) {+ worldStateSyncSubs.delete(currentSub);+ }++ const sub: WorldStateSyncSub = {+ get: get as (world: EngineWorld) => unknown,+ prev: initial,+ set: (v) => setValue(() => v as T),+ };+ worldStateSyncSubs.add(sub);+ currentSub = sub;+ });++ onCleanup(() => {+ if (currentSub) {+ worldStateSyncSubs.delete(currentSub);+ }+ });++ return value;+}diff --git a/apps/web/src/components/engine/index.ts b/apps/web/src/components/engine/index.tsnew file mode 100644index 00000000..965397ff--- /dev/null+++ b/apps/web/src/components/engine/index.ts@@ -0,0 +1,13 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './types';+export * from './math';+export * from './components';+export * from './utils';+export * from './selection';+export * from './systems';+export * from './api';+export * from './hooks';+export * from './services';diff --git a/apps/web/src/components/engine/math/aabb.ts b/apps/web/src/components/engine/math/aabb.tsnew file mode 100644index 00000000..e5856e5e--- /dev/null+++ b/apps/web/src/components/engine/math/aabb.ts@@ -0,0 +1,114 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Axis-Aligned Bounding Box utilities.+ */++import type { Mat2D } from './matrix2d';++export type AABB = { minX: number; minY: number; maxX: number; maxY: number };++/**+ * Compute the world-space AABB of a rectangle [0,0]→[w,h]+ * transformed by a 2D affine matrix.+ */+export function aabbFromTransformedRect(mat: Mat2D, w: number, h: number): AABB {+ const { a, b, c, d, e, f } = mat;++ // Transform 4 corners: (0,0), (w,0), (w,h), (0,h)+ const x0 = e, y0 = f;+ const x1 = a * w + e, y1 = b * w + f;+ const x2 = a * w + c * h + e, y2 = b * w + d * h + f;+ const x3 = c * h + e, y3 = d * h + f;++ return {+ minX: Math.min(x0, x1, x2, x3),+ minY: Math.min(y0, y1, y2, y3),+ maxX: Math.max(x0, x1, x2, x3),+ maxY: Math.max(y0, y1, y2, y3),+ };+}++/** Test whether two AABBs overlap. */+export function aabbsIntersect(a: AABB, b: AABB): boolean {+ return !(+ a.maxX < b.minX ||+ a.minX > b.maxX ||+ a.maxY < b.minY ||+ a.minY > b.maxY+ );+}++// ─── Polygon geometry ───────────────────────────────────────────++export type Point = { x: number; y: number };++/** Four corners of a transformed rect: [TL, TR, BR, BL]. */+export type Quad = [Point, Point, Point, Point];++/** Get the four world-space corners of a rect [0,0]→[w,h] through a Mat2D. */+export function rectToQuad(mat: Mat2D, w: number, h: number): Quad {+ const { a, b, c, d, e, f } = mat;+ return [+ { x: e, y: f },+ { x: a * w + e, y: b * w + f },+ { x: a * w + c * h + e, y: b * w + d * h + f },+ { x: c * h + e, y: d * h + f },+ ];+}++/** Transform a single point through a Mat2D. */+export function transformPoint(mat: Mat2D, px: number, py: number): Point {+ return {+ x: mat.a * px + mat.c * py + mat.e,+ y: mat.b * px + mat.d * py + mat.f,+ };+}++/** Invert a Mat2D. */+export function invert2D(m: Mat2D): Mat2D {+ const { a, b, c, d, e, f } = m;+ const det = a * d - b * c;++ const inv = 1 / det;+ return {+ a: d * inv,+ b: -b * inv,+ c: -c * inv,+ d: a * inv,+ e: (c * f - d * e) * inv,+ f: (b * e - a * f) * inv,+ };+}++/** Point-in-polygon test (ray casting). */+export function pointInQuad(px: number, py: number, q: Quad): boolean {+ let inside = false;+ for (let i = 0, j = 3; i < 4; j = i++) {+ const xi = q[i].x, yi = q[i].y;+ const xj = q[j].x, yj = q[j].y;+ if (((yi > py) !== (yj > py)) && (px < (xj - xi) * (py - yi) / (yj - yi) + xi)) {+ inside = !inside;+ }+ }+ return inside;+}++/** Test whether two quads intersect (vertex containment check). */+export function quadsIntersect(a: Quad, b: Quad): boolean {+ for (let i = 0; i < 4; i++) {+ if (pointInQuad(a[i].x, a[i].y, b)) return true;+ if (pointInQuad(b[i].x, b[i].y, a)) return true;+ }+ return false;+}++/** Center point of a quad. */+export function quadCenter(q: Quad): Point {+ return {+ x: (q[0].x + q[1].x + q[2].x + q[3].x) / 4,+ y: (q[0].y + q[1].y + q[2].y + q[3].y) / 4,+ };+}diff --git a/apps/web/src/components/engine/math/common.ts b/apps/web/src/components/engine/math/common.tsnew file mode 100644index 00000000..3f13b64f--- /dev/null+++ b/apps/web/src/components/engine/math/common.ts@@ -0,0 +1,18 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Shared math constants and helpers.+ */++export const DEG_TO_RAD = Math.PI / 180;+export const RAD_TO_DEG = 180 / Math.PI;++export function degToRad(deg: number): number {+ return deg * DEG_TO_RAD;+}++export function radToDeg(rad: number): number {+ return rad * RAD_TO_DEG;+}diff --git a/apps/web/src/components/engine/math/index.ts b/apps/web/src/components/engine/math/index.tsnew file mode 100644index 00000000..7366f8d0--- /dev/null+++ b/apps/web/src/components/engine/math/index.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './common';+export * from './matrix2d';+export * from './aabb';diff --git a/apps/web/src/components/engine/math/matrix2d.ts b/apps/web/src/components/engine/math/matrix2d.tsnew file mode 100644index 00000000..4ebbfcb0--- /dev/null+++ b/apps/web/src/components/engine/math/matrix2d.ts@@ -0,0 +1,226 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Pure 2D affine matrix utilities.+ *+ * Mat2D uses named properties { a, b, c, d, e, f } matching+ * CanvasRenderingContext2D / DOMMatrix:+ *+ * | a c e |+ * | b d f |+ * | 0 0 1 |+ */++import { degToRad } from './common';++export type Mat2D = {+ a: number; b: number; c: number;+ d: number; e: number; f: number;+};++/** Return a fresh identity matrix. */+export function identity2D(): Mat2D {+ return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };+}++/**+ * Compose a local 2D affine matrix from transform properties.+ *+ * Equivalent to: T(pos+pivot) · R(rot) · SkewX · SkewY · S(scale) · T(-pivot)+ *+ * @param x Position X+ * @param y Position Y+ * @param rotation Rotation in **degrees**+ * @param scaleX Scale X+ * @param scaleY Scale Y+ * @param pivotX Pivot X in pixels (anchorX × width)+ * @param pivotY Pivot Y in pixels (anchorY × height)+ * @param skewX Skew X in **degrees**+ * @param skewY Skew Y in **degrees**+ */+export function compose2D(+ x: number,+ y: number,+ rotation: number,+ scaleX: number,+ scaleY: number,+ pivotX: number,+ pivotY: number,+ skewX: number,+ skewY: number,+): Mat2D {+ const rot = degToRad(rotation);+ const skx = degToRad(skewX);+ const sky = degToRad(skewY);++ const cos = Math.cos(rot);+ const sin = Math.sin(rot);+ const tanSkewX = Math.tan(skx);+ const tanSkewY = Math.tan(sky);++ // SkewX · SkewY · Scale (pre-rotation matrix)+ const a1 = scaleX * (1 + tanSkewX * tanSkewY);+ const b1 = tanSkewY * scaleX;+ const c1 = tanSkewX * scaleY;+ const d1 = scaleY;++ // R(rot) · [a1 c1; b1 d1]+ const a = cos * a1 - sin * b1;+ const b = sin * a1 + cos * b1;+ const c = cos * c1 - sin * d1;+ const d = sin * c1 + cos * d1;++ // T(pos+pivot) · M · T(-pivot)+ const tx = x + pivotX;+ const ty = y + pivotY;+ const e = tx + a * (-pivotX) + c * (-pivotY);+ const f = ty + b * (-pivotX) + d * (-pivotY);++ return { a, b, c, d, e, f };+}++/**+ * Multiply two 2D affine matrices: result = p × q.+ */+export function multiply2D(p: Mat2D, q: Mat2D): Mat2D {+ return {+ a: p.a * q.a + p.c * q.b,+ b: p.b * q.a + p.d * q.b,+ c: p.a * q.c + p.c * q.d,+ d: p.b * q.c + p.d * q.d,+ e: p.e + p.a * q.e + p.c * q.f,+ f: p.f + p.b * q.e + p.d * q.f,+ };+}++/** Return a translation matrix. */+export function translate2D(tx: number, ty: number): Mat2D {+ return { a: 1, b: 0, c: 0, d: 1, e: tx, f: ty };+}++/** Return a rotation matrix. Angle is in **degrees**. */+export function rotate2D(degrees: number): Mat2D {+ const r = degToRad(degrees);+ const cos = Math.cos(r);+ const sin = Math.sin(r);+ return { a: cos, b: sin, c: -sin, d: cos, e: 0, f: 0 };+}++/** Return a scale matrix. */+export function scale2D(sx: number, sy: number): Mat2D {+ return { a: sx, b: 0, c: 0, d: sy, e: 0, f: 0 };+}++/** Return a skew matrix. Angles are in **degrees**. */+export function skew2D(degreesX: number, degreesY: number): Mat2D {+ const tx = Math.tan(degToRad(degreesX));+ const ty = Math.tan(degToRad(degreesY));+ return { a: 1, b: ty, c: tx, d: 1, e: 0, f: 0 };+}++export type Decomposed2D = {+ x: number;+ y: number;+ rotation: number;+ scaleX: number;+ scaleY: number;+ skewX: number; // degrees+ skewY: number; // degrees+};++const EPS = 1e-12;++/**+ * Decompose a 2D matrix into translate / rotate / scale / skew.+ *+ * Uses column-based QR decomposition. In our matrix layout+ * | a c e |+ * | b d f |+ * | 0 0 1 |+ * column 0 is (a, b) and column 1 is (c, d).+ */+export function decompose2D(m: Mat2D): Decomposed2D {+ const { a, b, c, d, e, f } = m;++ // Translation is direct.+ const x = e;+ const y = f;++ // Compute scaleX as length of column 0 (a, b).+ let scaleX = Math.hypot(a, b);++ // If scaleX is ~0, matrix is degenerate.+ if (scaleX < EPS) {+ // Fall back: treat column 0 as zero, get scaleY from column 1.+ const scaleY = Math.hypot(c, d);+ return {+ x,+ y,+ rotation: 0,+ scaleX: 0,+ scaleY,+ skewX: 0,+ skewY: 0,+ };+ }++ // Normalize column 0 to get rotation.+ const r0x = a / scaleX;+ const r0y = b / scaleX;++ // "Shear" factor: dot of normalized column 0 with column 1.+ let shear = r0x * c + r0y * d;++ // Remove shear from column 1 to isolate scaleY.+ let c2 = c - r0x * shear;+ let d2 = d - r0y * shear;++ let scaleY = Math.hypot(c2, d2);++ // If scaleY is ~0, it's also degenerate.+ if (scaleY < EPS) {+ const rotationRad = Math.atan2(r0y, r0x);+ return {+ x,+ y,+ rotation: rotationRad * 180 / Math.PI,+ scaleX,+ scaleY: 0,+ skewX: 0,+ skewY: 0,+ };+ }++ // Normalize shear to get the actual shear value in "tan(angle)" space.+ shear /= scaleY;++ // Detect reflection (negative determinant) and fold it into scaleY by convention.+ const det = a * d - b * c;+ if (det < 0) {+ // Flip one axis. Common choice: flip scaleY.+ scaleY = -scaleY;+ shear = -shear;+ c2 = -c2;+ d2 = -d2;+ }++ // Rotation in radians from normalized column 0.+ const rotationRad = Math.atan2(r0y, r0x);+ const rotation = rotationRad * 180 / Math.PI;++ // Convert shear factor to skew angle (X-shear).+ const skewX = Math.atan(shear) * 180 / Math.PI;+ const skewY = 0;++ return {+ x,+ y,+ rotation,+ scaleX,+ scaleY,+ skewX,+ skewY,+ };+}diff --git a/apps/web/src/components/engine/selection.ts b/apps/web/src/components/engine/selection.tsnew file mode 100644index 00000000..1383ab28--- /dev/null+++ b/apps/web/src/components/engine/selection.ts@@ -0,0 +1,76 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, Or, query } from 'bitecs';+import { ChildOf } from './components/relations';+import { clearComponent, getParentEntity } from '.';+import { addComponent } from './api/events';++import type { EngineWorld } from './api/world';++export function selectStageEntities(world: EngineWorld): void {+ const c = world.components;+ for (const eid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(ChildOf('*')), Not(c.Sequential), Not(c.Deleted), Not(c.Hidden), Not(c.Culled)])) {+ addComponent(world, eid, c.Selected, false);+ }+}++/**+ * Replace the current selection with the parents of the selected nodes.+ * Top-level entities (no parent) are skipped; Sequential GROUP ancestors+ * are transparent — keep walking up until a selectable parent is found.+ * A no-op if no valid parent exists.+ */+export function selectParentEntities(world: EngineWorld): void {+ const c = world.components;+ const selection = query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer)])+ if (selection.length === 0) return;++ const parents = new Set<number>();+ for (const eid of selection) {+ let parent = getParentEntity(world, eid);+ while (parent !== null && hasComponent(world, parent, c.Sequential)) {+ parent = getParentEntity(world, parent);+ }+ if (parent !== null) {+ parents.add(parent);+ }+ }+ if (parents.size === 0) return;++ clearComponent(world, c.Selected, false);+ parents.forEach(parent => addComponent(world, parent, c.Selected, false));+}++/**+ * Replace the current selection with the direct children of selected nodes.+ * Sequential GROUP children are transparent — descend into them so the+ * caller selects actual selectable nodes underneath. No-op when no selected+ * node has any selectable descendant.+ */+export function selectChildEntities(world: EngineWorld): void {+ const c = world.components;+ const selection = query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer)])+ if (selection.length === 0) return;++ const children = new Set<number>();++ const collect = (parentEid: number) => {+ for (const child of query(world, [ChildOf(parentEid), Not(c.Deleted), Not(c.Hidden), Not(c.Culled)])) {+ if (hasComponent(world, child, c.Sequential)) {+ collect(child);+ continue;+ }++ children.add(child);+ }+ };+ for (const eid of selection) {+ collect(eid);+ }+ if (children.size === 0) return;++ clearComponent(world, c.Selected, false);+ children.forEach(child => addComponent(world, child, c.Selected, false));+}diff --git a/apps/web/src/components/engine/services/audio-bus.ts b/apps/web/src/components/engine/services/audio-bus.tsnew file mode 100644index 00000000..4ce3a3a6--- /dev/null+++ b/apps/web/src/components/engine/services/audio-bus.ts@@ -0,0 +1,69 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent } from 'bitecs';+import { attempt } from '@/utils';++import type { EngineWorld } from '../api/world';++/**+ * Per-entity audio bus. Each clip and each scene gets its own gain node.+ * Child buses connect directly into the parent bus's input — there is no+ * per-track sub-mix anymore (each clip is its own layer).+ */+export class AudioBus {+ public context: BaseAudioContext;++ private gain: GainNode;+ private eid: number;+ private world: EngineWorld;+ private _input: AudioNode;++ public constructor(world: EngineWorld, eid: number) {+ this.context = world.audio;+ this.gain = world.audio.createGain();+ this._input = this.gain;+ this.eid = eid;+ this.world = world;+ }++ public get input(): AudioNode {+ return this._input;+ }++ public getGain(): GainNode {+ return this.gain;+ }++ public sync(): void {+ this.gain.gain.value = this.getVolume();+ }++ public connect(node: AudioNode) {+ this.gain.connect(node);+ }++ public mute(): void {+ this.gain.gain.value = 0;+ }++ public disconnect() {+ attempt(() => this.gain.disconnect());+ this._input = this.gain;+ }++ private getVolume(): number {+ const c = this.world.components;++ const volumeDb = c.Computed.volume[this.eid] ?? 0;+ const muted = hasComponent(this.world, this.eid, c.Muted);++ /** Minimum dB value — treated as silence (maps to linear gain 0). */+ if (muted || volumeDb === -Infinity) {+ return 0;+ }++ return Math.pow(10, volumeDb / 20);+ }+}diff --git a/apps/web/src/components/engine/services/index.ts b/apps/web/src/components/engine/services/index.tsnew file mode 100644index 00000000..61c00e1b--- /dev/null+++ b/apps/web/src/components/engine/services/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './audio-bus';diff --git a/apps/web/src/components/engine/systems/camera-controller.ts b/apps/web/src/components/engine/systems/camera-controller.tsnew file mode 100644index 00000000..fe75ce68--- /dev/null+++ b/apps/web/src/components/engine/systems/camera-controller.ts@@ -0,0 +1,275 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { persistWorldState } from '../api';+import { isPanMode } from './input-system';+import { ToolType } from '../components';++import type { EngineWorld } from '../api/world';+import { Or, query } from 'bitecs';++export type Camera = ReturnType<typeof createCameraController>;++export function createCameraController(world: EngineWorld) {+ let isPanning = false;+ let panStartX = 0;+ let panStartY = 0;+ let panStartCamera: [e: number, f: number];++ const c = world.components;++ let canvas: HTMLCanvasElement | null = null;+ const cam = world.camera;+++ /** Pan the camera by a screen-space delta (CSS pixels). */+ const pan = (screenDx: number, screenDy: number): void => {+ const { a, b, c, d, e, f } = cam;++ // Invert the camera to convert screen delta to world delta+ const det = a * d - b * c;+ if (Math.abs(det) < 1e-12) return;++ const invDet = 1 / det;+ const worldDx = (d * screenDx - c * screenDy) * invDet;+ const worldDy = (-b * screenDx + a * screenDy) * invDet;++ // Translate: M' = M * T(-worldDelta)+ cam.e = e - (a * worldDx + c * worldDy);+ cam.f = f - (b * worldDx + d * worldDy);+ }++ /**+ * Zoom the camera towards a screen point (CSS pixels).+ * @param screenX Cursor X in CSS pixels relative to the canvas+ * @param screenY Cursor Y in CSS pixels relative to the canvas+ * @param factor Zoom multiplier (>1 = zoom in, <1 = zoom out)+ */+ const zoom = (screenX: number, screenY: number, factor: number): void => {+ const { a, b, c, d, e, f } = cam;++ // Convert screen point to world coordinates via camera inverse+ const det = a * d - b * c;+ if (Math.abs(det) < 1e-12) return;+ const invDet = 1 / det;++ const worldX = invDet * (d * (screenX - e) - c * (screenY - f));+ const worldY = invDet * (-b * (screenX - e) + a * (screenY - f));++ // Clamp resulting scale+ const currentScale = Math.hypot(a, b);+ const targetScale = currentScale * factor;+ const clampedScale = Math.max(0.01, Math.min(10, targetScale));+ const s = clampedScale / currentScale;++ // M' = T(world) * S(s) * T(-world) * M+ cam.a = a * s;+ cam.b = b * s;+ cam.c = c * s;+ cam.d = d * s;+ cam.e = screenX - (a * s * worldX + c * s * worldY);+ cam.f = screenY - (b * s * worldX + d * s * worldY);+ }++ /** Zoom at the canvas center by a factor (>1 zoom in, <1 zoom out). */+ const zoomBy = (factor: number): void => {+ if (!canvas) return;+ const rect = canvas.getBoundingClientRect();+ zoom(rect.width / 2, rect.height / 2, factor);+ persistWorldState(world);+ }++ /** Reset camera zoom to 100% at the canvas center. */+ const resetZoom = (): void => {+ const currentScale = Math.hypot(cam.a, cam.b);+ if (currentScale > 0) zoomBy(1 / currentScale);+ }++ /**+ * Center the camera on a world-space rectangle with optional padding.+ * @param bounds { x, y, width, height } in world coordinates+ * @param padding Padding in CSS pixels+ */+ const centerRect = (bounds: { x: number; y: number; width: number; height: number }, padding = 80): void => {+ const parent = canvas?.parentElement;+ if (!parent) return;++ const rect = parent.getBoundingClientRect();+ const screenWidth = rect.width;+ const screenHeight = rect.height;++ const scaleX = (screenWidth - padding * 2) / bounds.width;+ const scaleY = (screenHeight - padding * 2) / bounds.height;+ const scale = Math.min(scaleX, scaleY, 1);++ const centerX = bounds.x + bounds.width / 2;+ const centerY = bounds.y + bounds.height / 2;+ const tx = screenWidth / 2 - centerX * scale;+ const ty = screenHeight / 2 - centerY * scale;++ cam.a = scale;+ cam.b = 0;+ cam.c = 0;+ cam.d = scale;+ cam.e = tx;+ cam.f = ty;++ persistWorldState(world);+ }++ /**+ * Compute the union of WorldBounds for a set of entities in pre-camera+ * scene-space (the space centerRect expects). Returns null if no entity+ * has bounds. WorldBounds are stored post-camera (Camera × dpr), so we+ * invert that transform here.+ */+ const computeSceneSpaceBounds = (eids: number[]): { x: number; y: number; width: number; height: number } | null => {+ const sx = cam.a * world.resolution;+ const sy = cam.d * world.resolution;+ const tx = cam.e * world.resolution;+ const ty = cam.f * world.resolution;+ if (sx === 0 || sy === 0) return null;++ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;+ let found = false;+ for (const eid of eids) {+ if (c.WorldBounds.minX[eid] === undefined) continue;+ const x0 = ((c.WorldBounds.minX[eid] ?? 0) - tx) / sx;+ const x1 = ((c.WorldBounds.maxX[eid] ?? 0) - tx) / sx;+ const y0 = ((c.WorldBounds.minY[eid] ?? 0) - ty) / sy;+ const y1 = ((c.WorldBounds.maxY[eid] ?? 0) - ty) / sy;+ minX = Math.min(minX, x0, x1);+ maxX = Math.max(maxX, x0, x1);+ minY = Math.min(minY, y0, y1);+ maxY = Math.max(maxY, y0, y1);+ found = true;+ }+ if (!found) return null;+ const width = maxX - minX;+ const height = maxY - minY;+ if (width <= 0 || height <= 0) return null;+ return { x: minX, y: minY, width, height };+ }++ /** Fit the current selection into view. No-op if nothing is selected. */+ const fitToSelection = (): void => {+ const selection = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];+ const bounds = computeSceneSpaceBounds(selection);+ if (bounds) centerRect(bounds);+ }++ /** Fit the given entities into view. No-op if none have bounds yet. */+ const focusEntities = (eids: number[]): void => {+ if (eids.length === 0) return;+ const bounds = computeSceneSpaceBounds(eids);+ if (bounds) centerRect(bounds);+ }++ /** Fit the active scene into view. No-op if no active scene. */+ const fitToActiveScene = (): void => {+ const sceneEid = world.selection.scene;+ if (sceneEid === null) return;+ const Position = world.components.Position;+ const Computed = world.components.Computed;+ const x = Position.x[sceneEid] ?? 0;+ const y = Position.y[sceneEid] ?? 0;+ const width = Computed.width[sceneEid];+ const height = Computed.height[sceneEid];+ if (width <= 0 || height <= 0) return;+ centerRect({ x, y, width, height });+ }++ // ── Wheel: zoom + scroll-pan ──++ const handleWheel = (e: WheelEvent) => {+ if (!canvas) return;++ e.preventDefault();+ const delta = e.deltaMode === 0 ? 1 : (e.deltaMode === 1 ? 16 : 600);++ if (e.ctrlKey || e.metaKey) {+ const rect = canvas?.getBoundingClientRect();+ const screenX = e.clientX - rect.left;+ const screenY = e.clientY - rect.top;+ const dy = Math.max(-50, Math.min(50, e.deltaY * delta));+ zoom(screenX, screenY, Math.exp(-dy * 0.01));+ } else {+ pan(e.deltaX * delta, e.deltaY * delta);+ }++ persistWorldState(world);+ };++ // ── Space + drag: pan ──+ const handleKeyUp = (e: KeyboardEvent) => {+ // Releasing space mid-drag ends the pan even though the pointer is still down.+ if (e.code === 'Space') isPanning = false;+ if (world.selection.tool !== ToolType.HAND) {+ world.cursor.update('default');+ }+ };++ const handlePointerDown = (e: PointerEvent) => {+ if (!isPanMode(world) || !canvas) return;++ isPanning = true;+ canvas.setPointerCapture(e.pointerId);++ const rect = canvas.getBoundingClientRect();+ panStartX = e.clientX - rect.left;+ panStartY = e.clientY - rect.top;+ panStartCamera = [cam.e, cam.f];+ };++ const handlePointerMove = (e: PointerEvent) => {+ if (!isPanning || !canvas) return;++ const rect = canvas.getBoundingClientRect();+ const dx = (e.clientX - rect.left) - panStartX;+ const dy = (e.clientY - rect.top) - panStartY;++ cam.e = panStartCamera[0] + dx;+ cam.f = panStartCamera[1] + dy;+ };++ const handlePointerUp = () => {+ if (!isPanning || !canvas) return;+ isPanning = false;+ persistWorldState(world);+ };++ const init = (el: HTMLCanvasElement) => {+ if (canvas) return;++ canvas = el;+ canvas.addEventListener('wheel', handleWheel, { passive: false });+ canvas.addEventListener('pointerdown', handlePointerDown);+ canvas.addEventListener('pointermove', handlePointerMove);+ canvas.addEventListener('pointerup', handlePointerUp);+ canvas.addEventListener('pointercancel', handlePointerUp);+ window.addEventListener('keyup', handleKeyUp);+ };++ function dispose() {+ canvas?.removeEventListener('wheel', handleWheel);+ canvas?.removeEventListener('pointerdown', handlePointerDown);+ canvas?.removeEventListener('pointermove', handlePointerMove);+ canvas?.removeEventListener('pointerup', handlePointerUp);+ canvas?.removeEventListener('pointercancel', handlePointerUp);+ window.removeEventListener('keyup', handleKeyUp);+ }++ return {+ dispose,+ pan,+ zoom,+ zoomBy,+ resetZoom,+ centerRect,+ fitToSelection,+ fitToActiveScene,+ focusEntities,+ init,+ };+}diff --git a/apps/web/src/components/engine/systems/dom.ts b/apps/web/src/components/engine/systems/dom.tsnew file mode 100644index 00000000..448853e2--- /dev/null+++ b/apps/web/src/components/engine/systems/dom.ts@@ -0,0 +1,88 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query, asBuffer, hasComponent, type QueryTerm } from 'bitecs';++import type { EngineWorld } from '../api/world';++// Global set of active subscriptions.+export type ValueSyncSub = {+ store: unknown[];+ eid: number;+ prev: unknown;+ set: (v: unknown) => void;+};++export const domSyncSubs = new Set<ValueSyncSub>();++// Tag-based subscriptions (boolean presence via hasComponent).+export type TagSyncSub = {+ component: object;+ eid: number;+ prev: boolean;+ set: (v: boolean) => void;+};++export const tagSyncSubs = new Set<TagSyncSub>();++// Query-based subscriptions for tag components (e.g. Selected, Active).+export type QuerySyncSub = {+ query: QueryTerm[];+ prev: Uint32Array;+ set: (result: number[]) => void;+};++export const querySyncSubs = new Set<QuerySyncSub>();++// World-level state subscriptions. The getter reads a value out of the world+// (e.g. `w => w.selection.scene`, `w => w.camera.a`, `w => w.background`).+export type WorldStateSyncSub = {+ get: (world: EngineWorld) => unknown;+ prev: unknown;+ set: (v: unknown) => void;+};++export const worldStateSyncSubs = new Set<WorldStateSyncSub>();++/**+ * Flush all subscriptions – called once per frame by the sync system.+ * Compares the current ECS value against the cached previous value and+ * updates the SolidJS signal only when they differ.+ */+export function syncDomSystem(world: EngineWorld): void {+ for (const sub of domSyncSubs) {+ const next = sub.store[sub.eid];+ if (next !== undefined && next !== sub.prev) {+ sub.prev = next;+ sub.set(next);+ }+ }++ for (const sub of tagSyncSubs) {+ const next = hasComponent(world, sub.eid, sub.component);+ if (next !== sub.prev) {+ sub.prev = next;+ sub.set(next);+ }+ }++ for (const sub of querySyncSubs) {+ const result = query(world, sub.query, asBuffer) as Uint32Array;++ // We may need to find a better way to compare the arrays.+ // This is in a hot path, so we need to be careful.+ if (result.length !== sub.prev.length || result[0] !== sub.prev[0]) {+ sub.prev = new Uint32Array(result);+ sub.set([...Array.from(result)]);+ }+ }++ for (const sub of worldStateSyncSubs) {+ const next = sub.get(world);+ if (next !== sub.prev) {+ sub.prev = next;+ sub.set(next);+ }+ }+}diff --git a/apps/web/src/components/engine/systems/hud.ts b/apps/web/src/components/engine/systems/hud.tsnew file mode 100644index 00000000..adc9269d--- /dev/null+++ b/apps/web/src/components/engine/systems/hud.ts@@ -0,0 +1,500 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, Or, query } from "bitecs";+import { invert2D, multiply2D, rectToQuad, rotate2D, scale2D, transformPoint, translate2D, type Mat2D } from "../math";+import * as callbacks from "../api/interactions";+import { entityQuad, entityWorldMat, getMarqueeQuad, getMountedNameInput, getSelectionMask } from "../utils/interaction";+import { ChildOf } from "../components";++import type { EngineWorld } from "../api/world";++export function hudSystem(world: EngineWorld) {+ const c = world.components;+ const ctx = world.ctx!;+ const res = world.resolution;++ // Draw snap guides+ if (!world.keys.has('mod') && world.snapLines.length > 0) {+ const res = world.resolution;+ const crossSize = Math.round(3 * res);++ ctx.resetTransform();+ ctx.beginPath();++ for (const snapLine of world.snapLines) {+ ctx.moveTo(snapLine.from.x, snapLine.from.y);+ ctx.lineTo(snapLine.to.x, snapLine.to.y);+ }++ ctx.closePath();++ ctx.strokeStyle = '#F43535';+ ctx.lineWidth = Math.round(res);+ ctx.stroke();++ const drawCross = (x: number, y: number) => {+ ctx.moveTo(x - crossSize, y - crossSize);+ ctx.lineTo(x + crossSize, y + crossSize);+ ctx.moveTo(x - crossSize, y + crossSize);+ ctx.lineTo(x + crossSize, y - crossSize);+ };++ ctx.beginPath();++ for (const snapLine of world.snapLines) {+ drawCross(snapLine.from.x, snapLine.from.y);+ drawCross(snapLine.to.x, snapLine.to.y);+ }++ ctx.strokeStyle = '#F43535';+ ctx.lineWidth = Math.round(res);+ ctx.stroke();+ }++ // Draw hover indicators+ {+ for (const eid of query(world, [c.Hovering, Or(c.Geometry, c.Group), Not(c.Sequential), Not(c.Culled), Not(c.Deleted)])) {+ const quad = entityQuad(world, eid);++ ctx.resetTransform();+ ctx.beginPath();+ ctx.moveTo(quad[0].x, quad[0].y);+ ctx.lineTo(quad[1].x, quad[1].y);+ ctx.lineTo(quad[2].x, quad[2].y);+ ctx.lineTo(quad[3].x, quad[3].y);+ ctx.closePath();++ ctx.strokeStyle = '#008CFF';+ ctx.lineWidth = Math.round(2 * res);+ ctx.stroke();+ }+ }++ // Draw headers+ for (const eid of query(world, [Or(c.Name, c.Generating), Not(c.Deleted), Not(c.Culled), Not(c.Hidden), Not(ChildOf('*'))])) {+ const isGenerating = hasComponent(world, eid, c.Generating);+ if (!isGenerating && !hasComponent(world, eid, c.Name)) continue;++ const name = isGenerating ? 'Generating...' : c.Name[eid];+ if (!name) continue;++ const header = getHeaderLayout(world, eid);+ const hasTimelineComp = hasComponent(world, eid, c.Playback);++ ctx.setTransform(header.mat.a, header.mat.b, header.mat.c, header.mat.d, header.mat.e, header.mat.f);++ let labelStartX = 0;++ const isActive = world.selection.scene === eid;+ const isSelected = hasComponent(world, eid, c.Selected);++ // Play/pause button (only for entities with Timeline)+ if (hasTimelineComp) {+ ctx.save();+ ctx.fillStyle = isSelected ? '#cce8ff' : '#9E9E9E';+ if (c.Playback.playing[eid] !== 1) {+ ctx.translate(2, 3);+ ctx.fill(PLAY_PATH);+ } else {+ ctx.translate(4, 3);+ ctx.fill(PAUSE_PATH);+ }+ ctx.restore();+ labelStartX = 18;++ world.hitRegions.push({+ target: { kind: 'hud', id: `play:${eid}`, quad: rectToQuad(header.mat, 16, 22) },+ callback: callbacks.handlePlayInteraction,+ });+ }++ // Label+ const labelMat = multiply2D(header.mat, translate2D(labelStartX, 3));+ ctx.setTransform(labelMat.a, labelMat.b, labelMat.c, labelMat.d, labelMat.e, labelMat.f);+ ctx.textAlign = 'left';+ ctx.textBaseline = 'top';+ ctx.font = '350 11px Inter, sans-serif';++ const activeIndicatorWidth = isActive ? 60 : 0;+ const fittedText = fitTextToWidth(ctx, name, header.width - labelStartX - activeIndicatorWidth);++ if (fittedText) {+ ctx.fillStyle = isSelected ? '#cce8ff' : '#9E9E9E';+ ctx.fillText(fittedText.value, 0, 0);++ const labelHitMat = multiply2D(header.mat, translate2D(labelStartX, 0));+ world.hitRegions.push({+ target: { kind: 'hud', id: `label:${eid}`, quad: rectToQuad(labelHitMat, fittedText.width + 4, 22) },+ callback: callbacks.handleLabelInteraction,+ });+ }++ const { input, eid: inputEid } = getMountedNameInput();++ // Position the label input overlay if editing this entity+ if (input && inputEid === eid) {+ const inputMat = multiply2D(header.mat, translate2D(labelStartX - 3, 0));+ const res = world.resolution;+ input.style.left = `${inputMat.e / res}px`;+ input.style.top = `${inputMat.f / res}px`;+ input.style.transform = `rotate(${header.rotation}deg)`;+ input.style.width = `${(fittedText?.width ?? 40) + 4}px`;+ }++ // Active indicator+ if (header.width > activeIndicatorWidth && isActive) {+ ctx.setTransform(header.mat.a, header.mat.b, header.mat.c, header.mat.d, header.mat.e, header.mat.f);+ ctx.translate((fittedText?.width ?? 0) + labelStartX + 4, 0);+ ctx.beginPath();+ ctx.roundRect(0, 0, 40, 16, 2);+ ctx.closePath();+ ctx.fillStyle = isSelected ? '#013e70' : '#292929';+ ctx.fill();++ ctx.translate(4, 3);+ ctx.textAlign = 'left';+ ctx.textBaseline = 'top';+ ctx.font = '350 11px Inter, sans-serif';+ ctx.fillStyle = isSelected ? '#cce8ff' : '#9E9E9E';+ ctx.fillText("Active", 0, 0);+ }++ // Duration (only for entities with Timeline)+ if (hasTimelineComp && ((fittedText?.width ?? 0) + activeIndicatorWidth + 60) < header.width) {+ ctx.setTransform(header.mat.a, header.mat.b, header.mat.c, header.mat.d, header.mat.e, header.mat.f);+ ctx.translate(header.width, 3);++ ctx.textAlign = 'right';+ ctx.textBaseline = 'top';+ ctx.font = '400 11px JetBrains Mono';++ const duration = c.Computed.duration[eid];++ const durationSeconds = duration / world.frameRate;+ const m = Math.floor(durationSeconds / 60).toString().padStart(2, '0');+ const s = Math.floor(durationSeconds % 60).toString().padStart(2, '0');++ if (isSelected) {+ ctx.globalAlpha = 0.7;+ ctx.fillStyle = '#cce8ff';+ } else {+ ctx.fillStyle = '#666666';+ }+ ctx.fillText(`${m}:${s}`, 0, 0);+ ctx.globalAlpha = 1;+ }+ }++ const mask = getSelectionMask(world);++ // Draw selection mask+ if (mask && world.hudMode !== 'moving') {+ const { width, height, mat } = mask;+ const selection = query(world, [Or(c.Geometry, c.Group), c.Selected, Not(c.Sequential)]);++ ctx.resetTransform();+ ctx.beginPath();++ // Draw the quad of each node+ for (const eid of selection) {+ const quad = entityQuad(world, eid);++ ctx.moveTo(quad[0].x, quad[0].y);+ ctx.lineTo(quad[1].x, quad[1].y);+ ctx.lineTo(quad[2].x, quad[2].y);+ ctx.lineTo(quad[3].x, quad[3].y);+ ctx.lineTo(quad[0].x, quad[0].y);+ }++ // Draw the selection mask+ ctx.setTransform(mat.a, mat.b, mat.c, mat.d, mat.e, mat.f);+ ctx.rect(0, 0, width, height);++ ctx.closePath();++ ctx.strokeStyle = '#008CFF';+ ctx.lineWidth = Math.round(selection.length === 1 ? 2 : 1 * res);+ ctx.stroke();++ world.hitRegions.push({+ target: { kind: 'hud', id: 'selection', quad: rectToQuad(mat, width, height) },+ callback: callbacks.handleMaskInteraction,+ });++ // Set rotation regions++ const rr = Math.round(16 * res);++ const rotationRegions = {+ rtl: [-rr, -rr],+ rtr: [width, -rr],+ rbr: [width, height],+ rbl: [-rr, height],+ };++ for (const [id, [x, y]] of Object.entries(rotationRegions)) {+ const tr = multiply2D(mat, translate2D(x, y));+ world.hitRegions.push({+ target: { kind: 'hud', id, quad: rectToQuad(tr, rr, rr) },+ callback: callbacks.handleRotateInteraction,+ });+ }++ // Set scale regions++ const sr = Math.round(6 * res);+ const sr2 = Math.round(sr / 2);++ const scaleRegions = {+ l: [-sr2, 0, sr, height],+ t: [0, -sr2, width, sr],+ r: [width - sr2, 0, sr, height],+ b: [0, height - sr2, width, sr],+ };++ for (const [id, [x, y, width, height]] of Object.entries(scaleRegions)) {+ const tr = multiply2D(mat, translate2D(x, y));+ world.hitRegions.push({+ target: { kind: 'hud', id, quad: rectToQuad(tr, width, height) },+ callback: callbacks.handleResizeInteraction,+ });+ }++ // Draw the selection handles (handles move with the mask)++ ctx.beginPath();++ const hs = Math.round(8 * res);+ const hs2 = Math.round(hs / 2);++ const cornerHandles = {+ tl: [-hs2, -hs2],+ tr: [width - hs2, -hs2],+ br: [width - hs2, height - hs2],+ bl: [-hs2, height - hs2],+ };++ for (const [id, [x, y]] of Object.entries(cornerHandles)) {+ const tr = multiply2D(mat, translate2D(x, y));+ ctx.setTransform(tr.a, tr.b, tr.c, tr.d, tr.e, tr.f);+ ctx.rect(0, 0, hs, hs);+ world.hitRegions.push({+ target: { kind: 'hud', id, quad: rectToQuad(tr, hs, hs) },+ callback: callbacks.handleResizeInteraction,+ });+ }++ ctx.closePath();++ ctx.fillStyle = '#FFFFFF';+ ctx.fill();+ ctx.strokeStyle = '#008CFF';+ ctx.lineWidth = Math.round(res);+ ctx.stroke();+ }++ // Render the dimensions+ if (mask && world.hudMode !== 'moving') {+ const selection = query(world, [c.Selected, Or(c.Geometry, c.Group), Not(c.Sequential)]);++ let rotation = 0;+ let center = 0;+ let x = 0;+ let y = 0;+ let width = 0;+ let height = 0;++ if (selection.length === 1) {+ const eid = selection[0];++ // get the lowest 2 points sorted by x+ const lowestPoints = [...entityQuad(world, eid)]+ .sort((a, b) => b.y - a.y)+ .slice(0, 2)+ .sort((a, b) => a.x - b.x);++ // get rotation between points in degrees+ rotation = Math.atan2(+ lowestPoints[1].y - lowestPoints[0].y,+ lowestPoints[1].x - lowestPoints[0].x+ ) * 180 / Math.PI;++ const a = lowestPoints[0].x - lowestPoints[1].x;+ const b = lowestPoints[0].y - lowestPoints[1].y;++ center = Math.sqrt(a * a + b * b) / 2;+ width = c.Computed.width[eid] * Math.abs(c.Computed.scaleX[eid]);+ height = c.Computed.height[eid] * Math.abs(c.Computed.scaleY[eid]);+ x = lowestPoints[0].x;+ y = lowestPoints[0].y;+ } else {+ // Get inverse transform and zero out translation to transform as vector, not point+ const worldTransform = entityWorldMat(world, null);+ const inverseTransform = invert2D(worldTransform);+ inverseTransform.e = 0;+ inverseTransform.f = 0;++ const transformed = transformPoint(inverseTransform, mask.width, mask.height);++ width = transformed.x;+ height = transformed.y;++ x = mask.mat.e;+ y = mask.mat.f + mask.height;+ center = mask.width / 2;+ }++ ctx.save();++ let mat = translate2D(x, y);+ mat = multiply2D(mat, rotate2D(rotation));+ mat = multiply2D(mat, scale2D(res, res));+ mat = multiply2D(mat, translate2D(center / res, 16));++ ctx.setTransform(mat.a, mat.b, mat.c, mat.d, mat.e, mat.f);++ const roundedWidth = Math.round(width * 100) / 100;+ const roundedHeight = Math.round(height * 100) / 100;+ const text = `${roundedWidth}x${roundedHeight}`;++ ctx.textAlign = 'center';+ ctx.textBaseline = 'middle';+ ctx.font = '11px Inter, sans-serif';++ const tw = ctx.measureText(text).width + 8; // text width + padding+ const tw2 = tw / 2; // text width / 2+ const br = 3; // border radius+ const th = 16; // text height + padding+ const to = -(th + 2) / 2; // text offset++ ctx.beginPath();+ ctx.roundRect(-tw2, to, tw, th, br);+ ctx.closePath();+ ctx.fillStyle = '#008CFF';+ ctx.fill();++ ctx.fillStyle = '#FFFFFF';+ ctx.fillText(text, 0, 0);++ ctx.restore();+ }+++ // Draw marquee selection rectangle+ const marqueeQuad = getMarqueeQuad(world);+ if (marqueeQuad) {+ const x = marqueeQuad[0].x;+ const y = marqueeQuad[0].y;+ const w = marqueeQuad[1].x - marqueeQuad[0].x;+ const h = marqueeQuad[3].y - marqueeQuad[0].y;++ ctx.resetTransform();+ ctx.beginPath();+ ctx.rect(x, y, w, h);+ ctx.closePath();++ ctx.fillStyle = '#008CFF';+ ctx.globalAlpha = 0.15;+ ctx.fill();+ ctx.globalAlpha = 1;+ ctx.strokeStyle = '#008CFF';+ ctx.lineWidth = Math.round(res);+ ctx.stroke();+ }+}++const PLAY_PATH = new Path2D("M0.24182 0.0683919C0.3919 -0.017789 0.5784 -0.022846 0.73338 0.0550586L9.7334 4.57886C9.8974 4.66129 10 4.82339 10 4.99999C10 5.17659 9.8974 5.3387 9.7334 5.42113L0.73338 9.94494C0.5784 10.0228 0.3919 10.0178 0.24182 9.93161C0.0917501 9.84541 0 9.69065 0 9.5238V0.476191C0 0.309296 0.0917501 0.154573 0.24182 0.0683919ZM1 1.26595V8.73399L8.4288 4.99999L1 1.26595Z");+const PAUSE_PATH = new Path2D("M1.08197 0.518868C1.08197 0.232311 0.839803 0 0.540984 0C0.242203 0 0 0.232311 0 0.518868V9.48113C0 9.76764 0.242203 10 0.540984 10C0.839803 10 1.08197 9.76764 1.08197 9.48113V0.518868ZM6 0.518868C6 0.232311 5.75784 0 5.45902 0C5.1602 0 4.91803 0.232311 4.91803 0.518868V9.48113C4.91803 9.76764 5.1602 10 5.45902 10C5.75784 10 6 9.76764 6 9.48113V0.518868Z");++function getHeaderLayout(world: EngineWorld, eid: number) {+ const quad = entityQuad(world, eid);++ // Find two highest points, sorted by x+ const highestPoints = [...quad]+ .sort((a, b) => a.y - b.y)+ .slice(0, 2)+ .sort((a, b) => a.x - b.x);++ const rotation = Math.atan2(+ highestPoints[1].y - highestPoints[0].y,+ highestPoints[1].x - highestPoints[0].x+ ) * 180 / Math.PI;++ const x = highestPoints[0].x;+ const y = highestPoints[0].y;++ const dx = highestPoints[0].x - highestPoints[1].x;+ const dy = highestPoints[0].y - highestPoints[1].y;+ const width = Math.sqrt(dx * dx + dy * dy) / world.resolution;++ const rad = rotation * Math.PI / 180;+ const cos = Math.cos(rad);+ const sin = Math.sin(rad);++ const res = world.resolution;+ const mat: Mat2D = {+ a: cos * res,+ b: sin * res,+ c: -sin * res,+ d: cos * res,+ e: x + (-22) * (-sin * res),+ f: y + (-22) * (cos * res),+ };++ return { x, y, rotation, width, mat };+};++const TEXT_WIDTH_CACHE: Map<string, number> = new Map();+type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;++function fitTextToWidth(ctx: Ctx2D, text: string, maxWidth: number) {+ const getTextWidth = (text: string) => {+ if (TEXT_WIDTH_CACHE.has(text)) {+ return TEXT_WIDTH_CACHE.get(text)!;+ }+ const width = ctx.measureText(text).width;+ TEXT_WIDTH_CACHE.set(text, width);+ return width;+ };++ const textWidth = getTextWidth(text);++ if (textWidth > maxWidth) {+ const availableWidth = maxWidth - getTextWidth('...');++ if (availableWidth > 0) {+ let start = 0;+ let end = text.length;+ let bestLength = 0;++ while (start <= end) {+ const mid = Math.floor((start + end) / 2);+ const testText = text.slice(0, mid);+ const testWidth = getTextWidth(testText);++ if (testWidth <= availableWidth) {+ bestLength = mid;+ start = mid + 1;+ } else {+ end = mid - 1;+ }+ }++ if (bestLength > 0) {+ const value = text.slice(0, bestLength) + '...';+ return {+ value,+ width: getTextWidth(value),+ };+ }++ return null;+ } else {+ return null;+ }+ }++ return { value: text, width: textWidth };+}diff --git a/apps/web/src/components/engine/systems/index.ts b/apps/web/src/components/engine/systems/index.tsnew file mode 100644index 00000000..9ef32f1a--- /dev/null+++ b/apps/web/src/components/engine/systems/index.ts@@ -0,0 +1,10 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './transform';+export * from './render';+export * from './camera-controller';+export * from './playback';+export * from './motion';+export * from './keyboard';diff --git a/apps/web/src/components/engine/systems/input-system.ts b/apps/web/src/components/engine/systems/input-system.tsnew file mode 100644index 00000000..975bbc39--- /dev/null+++ b/apps/web/src/components/engine/systems/input-system.ts@@ -0,0 +1,195 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { assert, isInputTarget } from "@/utils";+import { addComponent, removeComponent } from "bitecs";+import { pointInQuad } from "../math";+import { isPointerInEntity } from "../utils";+import { ToolType } from "../components";+import { clearComponent } from "../api/events";++import type { EngineWorld } from "../api/world";+import type { CustomPointerEvent, CustomPointerEventType, HitRegion } from "../types/input";++export const isPanMode = (world: EngineWorld) =>+ world.selection.tool === ToolType.HAND || world.keys.has(' ');+++const events: CustomPointerEvent[] = []+let initializedProject = null as string | null;++function addEventListeners(world: EngineWorld) {+ const canvas = world.canvas;+ const projectId = world.projectId;++ if (initializedProject === projectId || !canvas) return;+ assert(canvas instanceof HTMLCanvasElement, 'Canvas must be an HTMLCanvasElement');++ initializedProject = projectId;++ const pushEvent = (type: CustomPointerEventType, event: PointerEvent | MouseEvent) => {+ const rect = canvas.getBoundingClientRect();+ const dpr = window.devicePixelRatio;++ events.push({+ type,+ clientX: (event.clientX - rect.left) * dpr,+ clientY: (event.clientY - rect.top) * dpr,+ button: event.button,+ });+ }++ // click/dblclick listeners+ canvas.addEventListener('click', (event) => pushEvent('click', event));+ canvas.addEventListener('dblclick', (event) => pushEvent('dblclick', event));++ // pointer down/up/cancel listeners+ canvas.addEventListener('pointerdown', (event) => pushEvent('pointerdown', event));+ canvas.addEventListener('pointermove', (event) => pushEvent('pointermove', event));++ // make globally+ window.addEventListener('pointerup', (event) => pushEvent('pointerup', event));+ window.addEventListener('pointercancel', (event) => pushEvent('pointerup', event));++ // keyboard listeners+ window.addEventListener('keydown', (event) => {+ if (isInputTarget(event)) return;++ world.keys.add(event.key.toLowerCase());++ if (event.key === 'Meta' || event.key === 'Control') {+ world.keys.add('mod');+ }+ });+ window.addEventListener('keyup', (event) => {+ world.keys.delete(event.key.toLowerCase());++ if (event.key === 'Meta' || event.key === 'Control') {+ world.keys.delete('mod');+ }+ });+}+++let lastHoverRegion: HitRegion | null = null;+let lastDragRegion: HitRegion | null = null;++export function inputSystem(world: EngineWorld) {+ addEventListeners(world);+ const c = world.components;+ const panMode = isPanMode(world);++ for (const event of events) {+ world.pointer.clientX = event.clientX;+ world.pointer.clientY = event.clientY;+ world.pointer.button = event.button;++ if (event.type === 'pointerdown') {+ world.pointer.state = 'pressed';+ world.pointer.dragStartX = event.clientX;+ world.pointer.dragStartY = event.clientY;+ } else if (event.type === 'pointerup') {+ world.pointer.state = 'lifted';+ }++ if (panMode) continue;++ const region = hitTest(world, event);++ // handle pointer enter/leave callbacks+ if (event.type === 'pointermove') {+ const lastTarget = lastHoverRegion?.target.id ?? null;+ const currentTarget = region?.target.id ?? null;++ if (lastTarget !== currentTarget && lastTarget !== null) {+ if (lastHoverRegion?.target.kind === 'entity') {+ removeComponent(world, lastHoverRegion.target.id, c.Hovering);+ }+ lastHoverRegion?.callback(world, {+ ...event,+ target: lastHoverRegion.target,+ type: 'pointerleave' as const,+ })+ }++ if (currentTarget !== null && currentTarget !== lastTarget) {+ if (region?.target.kind === 'entity') {+ addComponent(world, region.target.id, c.Hovering);+ }+ region?.callback(world, {+ ...event,+ target: region.target,+ type: 'pointerenter' as const,+ })+ }++ lastHoverRegion = region;+ }++ // handle drag start/drag/end callbacks+ if (event.type === 'pointerdown') {+ if (region?.target.kind === 'entity') {+ addComponent(world, region.target.id, c.Dragging);+ }+ region?.callback(world, {+ ...event,+ target: region.target,+ type: 'dragstart' as const,+ });+ lastDragRegion = region;+ }++ if (event.type === 'pointermove') {+ lastDragRegion?.callback(world, {+ ...event,+ target: lastDragRegion.target,+ type: 'drag' as const,+ });+ }++ if (event.type === 'pointerup') {+ if (lastDragRegion?.target.kind === 'entity'){+ removeComponent(world, lastDragRegion.target.id, c.Dragging);+ }+ lastDragRegion?.callback(world, {+ ...event,+ target: lastDragRegion.target,+ type: 'dragend' as const,+ });+ lastDragRegion = null;+ }++ // all other callbacks+ region?.callback(world, { ...event, target: region.target });+ }++ if (panMode) {+ world.cursor.update(world.pointer.state === 'pressed' ? 'grabbing' : 'grab');+ clearComponent(world, c.Hovering, false);+ clearComponent(world, c.Dragging, false);+ }++ events.length = 0;+ world.hitRegions.length = 0;+}++function hitTest(world: EngineWorld, event: CustomPointerEvent): HitRegion | null {+ const x = event.clientX;+ const y = event.clientY;++ for (let i = world.hitRegions.length - 1; i >= 0; i--) {+ const hitRegion = world.hitRegions[i];++ if (hitRegion.target.kind === 'entity') {+ const eid = hitRegion.target.id;+ if (isPointerInEntity(world, eid, { x, y })) {+ return hitRegion;+ }+ } else if (pointInQuad(x, y, hitRegion.target.quad)) {+ return hitRegion;+ }+ }++ return null;+}diff --git a/apps/web/src/components/engine/systems/keyboard.ts b/apps/web/src/components/engine/systems/keyboard.tsnew file mode 100644index 00000000..a2712163--- /dev/null+++ b/apps/web/src/components/engine/systems/keyboard.ts@@ -0,0 +1,468 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ToolType, FontStyle, ChildOf } from '../components';+import {+ copySelection,+ pasteClipboard,+ duplicateSelection,+ togglePlayback,+ shuttleForward,+ shuttleReverse,+ stopPlayback,+ splitAtPlayhead,+ groupSelection,+ ungroupSelection,+ frameSelection,+ isScene,+ isText,+ deleteEntity,+ switchActiveScene,+ reorderSelection,+ getParentEntity,+ isSequence,+ loadAsset,+ getCurrentFolderId,+} from '../api';+import {+ selectStageEntities,+ selectParentEntities,+ selectChildEntities,+} from '../selection';+import { SPACE_HOLD_DELAY_MS } from '../constants';+import { isInputTarget, showFileDialog } from '@/utils';+import { query, None, hasComponent, Or, Not } from 'bitecs';+import { addComponent, clearComponent, removeComponent, setComponent } from '../api/events';++import type { EngineWorld } from '../api/world';+import type { Camera } from './camera-controller';++type KeyboardHandler = (e: KeyboardEvent) => void;++export function createKeyboardSystem(world: EngineWorld, camera: Camera) {+ const c = world.components;+ const history = world.history;++ let spaceHandTimer: number | undefined;+ let spaceDownCameraHash: string | undefined;+ let timelineFocused = false;++ const onTimelineEnter = () => { timelineFocused = true; };+ const onTimelineLeave = () => { timelineFocused = false; };++ const cameraHash = () =>+ `${world.camera.a},${world.camera.d},${world.camera.e},${world.camera.f}`;++ const moveSelection = (amount: number, axis: 'x' | 'y') => {+ world.history.transaction('Nudge', () => {+ for (const eid of query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer)])) {+ setComponent(world, eid, c.Position, { [axis]: (c.Position[axis][eid] ?? 0) + amount });+ }+ });+ };++ const seek = (deltaFrames: number) => {+ const sid = world.selection.scene;+ const fps = world.frameRate;+ if (sid === null) return;+ const next = c.Computed.localTime[sid] + deltaFrames;+ c.Computed.localTimeInSeconds[sid] = next / fps;+ c.Computed.localTime[sid] = next;+ };++ const deleteSelection = () => {+ const selection = [...query(world, [world.components.Selected])];+ const activeScene = world.selection.scene;++ // Tracks owning any selected keyframe — a track whose every keyframe is+ // deleted is empty and should go too (mirrors toggleKeyframeTrack).+ const keyframeTracks = new Set<number>();+ // Parents of any selected node — candidates for empty-sequence cleanup.+ const containers = new Set<number>();+ for (const eid of selection) {+ if (hasComponent(world, eid, c.Keyframe)) {+ const tid = getParentEntity(world, eid);+ if (tid !== null) keyframeTracks.add(tid);+ } else {+ const pid = getParentEntity(world, eid);+ if (pid !== null) containers.add(pid);+ }+ }++ world.history.transaction('Delete', () => {+ selection.forEach(eid => deleteEntity(world, eid));++ for (const tid of keyframeTracks) {+ if (query(world, [c.Keyframe, ChildOf(tid), Not(c.Deleted)]).length === 0) {+ deleteEntity(world, tid);+ }+ }++ // A sequence emptied by the deletion is dropped too, cascading to any+ // parent sequence it in turn empties.+ for (const start of containers) {+ let pid: number | null = start;+ while (pid !== null && !hasComponent(world, pid, c.Deleted) && isSequence(world, pid)) {+ if (query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(pid), Not(c.Deleted)]).length > 0) break;+ const parent = getParentEntity(world, pid);+ deleteEntity(world, pid);+ pid = parent;+ }+ }+ });+ clearComponent(world, c.Selected, false);++ if (selection.find(eid => eid === activeScene)) {+ const children = query(world, [c.Geometry, None(ChildOf('*'), c.Deleted, c.Hidden)]);+ const nextScene = children.find((eid: number) => isScene(world, eid));+ switchActiveScene(world, nextScene ?? null);+ }+ };++ const handleSpaceDown = () => {+ if (!spaceDownCameraHash) {+ spaceDownCameraHash = cameraHash();+ if (timelineFocused) {+ togglePlayback(world);+ }+ }+ if (!spaceHandTimer) {+ spaceHandTimer = window.setTimeout(() => {+ world.selection.tool = ToolType.HAND;+ spaceHandTimer = undefined;+ }, SPACE_HOLD_DELAY_MS);+ }+ };++ const handleSpaceUp = () => {+ if (spaceHandTimer) {+ clearTimeout(spaceHandTimer);+ spaceHandTimer = undefined;+ }+ if (spaceDownCameraHash && !timelineFocused) {+ if (spaceDownCameraHash === cameraHash()) {+ togglePlayback(world);+ }+ }+ spaceDownCameraHash = undefined;+ world.selection.tool = ToolType.MOVE;+ };++ // ── Modifier key handlers ──++ const modUndo: KeyboardHandler = (e) => {+ e.preventDefault();+ if (e.shiftKey) {+ history.redo();+ } else {+ history.undo();+ }+ };++ const modCopy: KeyboardHandler = (e) => {+ if (!isInputTarget(e)) {+ e.preventDefault();+ copySelection(world);+ }+ };++ const modPaste: KeyboardHandler = (e) => {+ if (!isInputTarget(e)) {+ e.preventDefault();+ pasteClipboard(world);+ }+ };++ const modCut: KeyboardHandler = (e) => {+ if (!isInputTarget(e)) {+ e.preventDefault();+ copySelection(world);+ deleteSelection();+ }+ };++ const modDuplicate: KeyboardHandler = (e) => {+ if (!isInputTarget(e)) {+ e.preventDefault();+ duplicateSelection(world);+ }+ };++ const modSplit: KeyboardHandler = (e) => {+ if (!isInputTarget(e)) {+ e.preventDefault();+ splitAtPlayhead(world);+ }+ };++ const modImport: KeyboardHandler = async (e) => {+ if (isInputTarget(e)) return;+ e.preventDefault();+ const files = await showFileDialog();+ const folderId = getCurrentFolderId(world);+ await Promise.all(files.map((file) => loadAsset(world, file, { folderId })));+ };++ const modNewFolder: KeyboardHandler = (e) => {+ if (!e.shiftKey) return;+ if (isInputTarget(e)) return;+ e.preventDefault();+ e.stopPropagation();+ window.dispatchEvent(new CustomEvent('engine:create-folder'));+ };++ const modBold: KeyboardHandler = (e) => {+ const eids = [...query(world, [c.Selected, c.Geometry])].filter(eid => isText(world, eid));+ if (eids.length === 0) {+ modSplit(e);+ return;+ }+ e.preventDefault();+ const allBold = eids.every((eid) => (c.TextStyle.fontWeight[eid] ?? '400') === '700');+ world.history.transaction('Toggle bold', () => {+ eids.forEach(eid => setComponent(world, eid, c.TextStyle, {+ fontWeight: allBold ? '400' : '700'+ }));+ });+ };++ const modItalic: KeyboardHandler = (e) => {+ const eids = [...query(world, [c.Selected, c.Geometry])].filter(eid => isText(world, eid));+ if (eids.length === 0) {+ modImport(e);+ return;+ }+ e.preventDefault();+ const allItalic = eids.every((eid) => (c.TextStyle.fontStyle[eid] ?? FontStyle.NORMAL) === FontStyle.ITALIC);+ world.history.transaction('Toggle italic', () => {+ eids.forEach(eid => setComponent(world, eid, c.TextStyle, {+ fontStyle: allItalic ? FontStyle.NORMAL : FontStyle.ITALIC+ }));+ });+ };++ const modExport: KeyboardHandler = (e) => {+ if (isInputTarget(e)) return;+ e.preventDefault();+ const eventName = e.shiftKey ? 'engine:export-frame' : 'engine:export-scene';+ window.dispatchEvent(new CustomEvent(eventName));+ };++ const modHide: KeyboardHandler = (e) => {+ if (!e.shiftKey || isInputTarget(e)) return;+ e.preventDefault();++ const eids = query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer)]);+ const anyVisible = Array.from(eids).some((eid) => !hasComponent(world, eid, c.Hidden));++ world.history.transaction(anyVisible ? 'Hide' : 'Show', () => {+ if (anyVisible) {+ eids.forEach(eid => addComponent(world, eid, c.Hidden));+ } else {+ eids.forEach(eid => removeComponent(world, eid, c.Hidden));+ }+ });+ };++ const modGroup: KeyboardHandler = (e) => {+ if (isInputTarget(e)) return;+ e.preventDefault();+ if (e.altKey) {+ // Cmd/Ctrl+Alt+G — wrap the selection in a frame (scene) instead of a group.+ frameSelection(world);+ } else if (e.shiftKey) {+ ungroupSelection(world);+ } else {+ groupSelection(world);+ }+ };++ const modSequential: KeyboardHandler = (e) => {+ if (isInputTarget(e)) return;+ e.preventDefault();+ if (e.shiftKey) {+ ungroupSelection(world);+ } else {+ groupSelection(world, true);+ }+ };++ const modSelectAll: KeyboardHandler = (e) => {+ if (isInputTarget(e)) return;+ e.preventDefault();+ selectStageEntities(world);+ };++ const modZoomIn: KeyboardHandler = (e) => {+ e.preventDefault();+ camera.zoomBy(1.25);+ };++ const modZoomOut: KeyboardHandler = (e) => {+ e.preventDefault();+ camera.zoomBy(0.8);+ };++ const modZoomReset: KeyboardHandler = (e) => {+ e.preventDefault();+ camera.resetZoom();+ };++ const modZoomFit: KeyboardHandler = (e) => {+ if (isInputTarget(e)) return;+ e.preventDefault();+ camera.fitToActiveScene();+ };++ const modZoomSelection: KeyboardHandler = (e) => {+ if (isInputTarget(e)) return;+ e.preventDefault();+ camera.fitToSelection();+ };++ // ── Non-modifier key handlers ──+ const onSeekBackFrame: KeyboardHandler = () => seek(-1);+ const onSeekForwardFrame: KeyboardHandler = () => seek(1);+ const onSeekForwardSec: KeyboardHandler = () => seek(world.frameRate);+ const onSeekBackSec: KeyboardHandler = () => seek(-world.frameRate);+ const onMoveLeft: KeyboardHandler = (e) => moveSelection(e.shiftKey ? -10 : -1, 'x');+ const onMoveRight: KeyboardHandler = (e) => moveSelection(e.shiftKey ? 10 : 1, 'x');+ const onMoveUp: KeyboardHandler = (e) => moveSelection(e.shiftKey ? -10 : -1, 'y');+ const onMoveDown: KeyboardHandler = (e) => moveSelection(e.shiftKey ? 10 : 1, 'y');+ const onSpace: KeyboardHandler = (e) => {+ e.preventDefault();+ handleSpaceDown();+ };+ const onDelete: KeyboardHandler = (e) => {+ e.preventDefault();+ deleteSelection();+ };+ const onShuttleForward: KeyboardHandler = () => shuttleForward(world);+ const onShuttleReverse: KeyboardHandler = () => shuttleReverse(world);+ const onStopPlayback: KeyboardHandler = () => stopPlayback(world);+ const onToolMove: KeyboardHandler = () => (world.selection.tool = ToolType.MOVE);+ const onToolHand: KeyboardHandler = () => (world.selection.tool = ToolType.HAND);+ const onToolScene: KeyboardHandler = () => (world.selection.tool = ToolType.SCENE);+ const onToolText: KeyboardHandler = () => (world.selection.tool = ToolType.TEXT);+ const onToolRect: KeyboardHandler = () => (world.selection.tool = ToolType.RECT);+ const onSelectParent: KeyboardHandler = (e) => {+ e.preventDefault();+ selectParentEntities(world);+ };+ const onSelectChildren: KeyboardHandler = (e) => {+ e.preventDefault();+ selectChildEntities(world);+ };+ const onBringToFront: KeyboardHandler = (e) => {+ e.preventDefault();+ reorderSelection(world, 'front');+ };+ const onSendToBack: KeyboardHandler = (e) => {+ e.preventDefault();+ reorderSelection(world, 'back');+ };+ const onDeselect: KeyboardHandler = (e) => {+ e.preventDefault();+ clearComponent(world, c.Selected, false);+ const tool = world.selection.tool;+ if (tool === ToolType.MOVE || tool === ToolType.HAND) return;+ world.selection.tool = ToolType.MOVE;+ };++ // ── Keybinding tables ──++ const modBindings: Record<string, KeyboardHandler> = {+ 'z': modUndo,+ 'c': modCopy,+ 'v': modPaste,+ 'x': modCut,+ 'd': modDuplicate,+ 'b': modBold,+ 'i': modItalic,+ 'e': modExport,+ 'h': modHide,+ 'n': modNewFolder,+ 'g': modGroup,+ 's': modSequential,+ 'a': modSelectAll,+ '=': modZoomIn,+ '+': modZoomIn,+ '-': modZoomOut,+ '0': modZoomReset,+ '1': modZoomFit,+ '2': modZoomSelection,+ };++ const keyBindings: Record<string, KeyboardHandler> = {+ ' ': onSpace,+ 'arrowleft': onMoveLeft,+ 'arrowright': onMoveRight,+ 'arrowup': onMoveUp,+ 'arrowdown': onMoveDown,+ 'a': onSeekBackFrame,+ 'd': onSeekForwardFrame,+ 'w': onSeekForwardSec,+ 's': onSeekBackSec,+ 'backspace': onDelete,+ 'delete': onDelete,+ 'j': onShuttleReverse,+ 'k': onStopPlayback,+ 'l': onShuttleForward,+ 'v': onToolMove,+ 'h': onToolHand,+ 'f': onToolScene,+ 't': onToolText,+ 'r': onToolRect,+ '\\': onSelectParent,+ 'enter': onSelectChildren,+ 'escape': onDeselect,+ ']': onBringToFront,+ '[': onSendToBack,+ };++ const handleKeyDown = (e: KeyboardEvent) => {+ const isMod = e.metaKey || e.ctrlKey;++ if (isMod) {+ // On macOS, holding Option rewrites e.key for letter keys (Opt+G → "©"),+ // so fall back to the layout's physical code when Alt is held.+ const key = e.altKey && /^Key[A-Z]$/.test(e.code)+ ? e.code.slice(3).toLowerCase()+ : e.key.toLowerCase();+ modBindings[key]?.(e);+ return;+ }++ if (isInputTarget(e)) return;+ keyBindings[e.key.toLowerCase()]?.(e);+ };++ const handleKeyUp = (e: KeyboardEvent) => {+ if (e.key === ' ' && !isInputTarget(e)) {+ e.preventDefault();+ handleSpaceUp();+ }+ };++ function init() {+ window.addEventListener('keydown', handleKeyDown);+ window.addEventListener('keyup', handleKeyUp);++ const timelineCanvas = document.getElementById('timeline-canvas');+ timelineCanvas?.addEventListener('mouseenter', onTimelineEnter);+ timelineCanvas?.addEventListener('mouseleave', onTimelineLeave);+ }++ function dispose() {+ window.removeEventListener('keydown', handleKeyDown);+ window.removeEventListener('keyup', handleKeyUp);+ if (spaceHandTimer) clearTimeout(spaceHandTimer);++ const timelineCanvas = document.getElementById('timeline-canvas');+ timelineCanvas?.removeEventListener('mouseenter', onTimelineEnter);+ timelineCanvas?.removeEventListener('mouseleave', onTimelineLeave);+ }++ return { init, dispose };+}diff --git a/apps/web/src/components/engine/systems/motion.ts b/apps/web/src/components/engine/systems/motion.tsnew file mode 100644index 00000000..96d1e5db--- /dev/null+++ b/apps/web/src/components/engine/systems/motion.ts@@ -0,0 +1,450 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query, Not, Or, Hierarchy, hasComponent } from 'bitecs';+import { cubicBezier, steps, spring } from "animejs";+import { AnimationType, ChildOf } from '../components';+import type { EngineWorld } from '../api/world';+import { revealChars, revealWords, scrambleChars } from '../utils/text-motion';+import { resetAnimatedValues } from '../api/utils';+++/**+ * Apply an animation to a node.+ * @param world - The engine world.+ * @param eid - The entity id of the node to apply the animation to.+ * @param aid - The animation id.+ * @param progress - The progress of the animation.+ */+function applyAnimation(world: EngineWorld, eid: number, aid: number, progress: number) {+ const c = world.components;++ switch (c.Animation.type[aid]) {+ case AnimationType.FADE: {+ const phase = c.Animation.phase[aid];+ const func = cubicBezier(0.1, 0.7, 0.5, 1);+ const eased = clamp01(func(progress));+ c.Computed.opacity[eid] = phase == 1 ? 1 - eased : eased;+ break;+ }+ case AnimationType.GAIN: {+ const phase = c.Animation.phase[aid];+ const func = cubicBezier(0.4, 0.095, 0.546, 0.875);+ const eased = clamp01(func(progress));+ c.Computed.volume[eid] = phase == 1 ? 1 - eased : eased;+ break;+ }+ case AnimationType.GROW: {+ const phase = c.Animation.phase[aid];+ const func = cubicBezier(0.1, 0.7, 0.5, 1);+ const eased = clamp01(func(progress));+ const t = phase == 1 ? eased : 1 - eased;+ const scale = 1 - 0.5 * t;+ c.Computed.scaleX[eid] = scale;+ c.Computed.scaleY[eid] = scale;+ break;+ }+ case AnimationType.SHRINK: {+ const phase = c.Animation.phase[aid];+ const func = cubicBezier(0.1, 0.7, 0.5, 1);+ const eased = clamp01(func(progress));+ const t = phase == 1 ? eased : 1 - eased;+ const scale = 1 + 0.5 * t;+ c.Computed.scaleX[eid] = scale;+ c.Computed.scaleY[eid] = scale;+ break;+ }+ case AnimationType.BLUR: {+ const phase = c.Animation.phase[aid];+ const func = phase == 1 ? cubicBezier(0.4, 0, 1, 1) : cubicBezier(0.33, 0, 0.2, 1);+ const eased = clamp01(func(progress));+ c.Computed.blur[eid] = phase == 1 ? lerp(0, 24, eased) : lerp(24, 0, eased);+ break;+ }+ case AnimationType.SLIDE_LEFT:+ case AnimationType.SLIDE_RIGHT:+ case AnimationType.SLIDE_UP:+ case AnimationType.SLIDE_DOWN: {+ const phase = c.Animation.phase[aid];+ const type = c.Animation.type[aid];+ const func = cubicBezier(0.1, 0.7, 0.5, 1);+ const eased = clamp01(func(progress));+ const t = phase == 1 ? eased : 1 - eased;++ const sign = phase == 1 ? -1 : 1;+ if (type === AnimationType.SLIDE_LEFT) {+ c.Computed.offsetX[eid] = sign * 100 * t;+ } else if (type === AnimationType.SLIDE_RIGHT) {+ c.Computed.offsetX[eid] = sign * -100 * t;+ } else if (type === AnimationType.SLIDE_UP) {+ c.Computed.offsetY[eid] = sign * 100 * t;+ } else if (type === AnimationType.SLIDE_DOWN) {+ c.Computed.offsetY[eid] = sign * -100 * t;+ }+ c.Computed.opacity[eid] = 1 - t;+ break;+ }+ case AnimationType.SPIN: {+ const phase = c.Animation.phase[aid];+ const func = cubicBezier(0.44, 0.02, 0.252, 0.992);+ const eased = clamp01(func(progress));+ const t = phase == 1 ? eased : 1 - eased;+ const scale = 1 - t;+ c.Computed.scaleX[eid] = scale;+ c.Computed.scaleY[eid] = scale;+ c.Computed.rotation[eid] = -45 * t;+ break;+ }+ case AnimationType.TWIST: {+ const phase = c.Animation.phase[aid];+ const func = cubicBezier(0.1, 0.7, 0.5, 1);+ const eased = clamp01(func(progress));+ const t = phase == 1 ? eased : 1 - eased;+ const scale = 1 + t;+ c.Computed.scaleX[eid] = scale;+ c.Computed.scaleY[eid] = scale;+ c.Computed.rotation[eid] = -10 * t;+ c.Computed.offsetX[eid] = -30 * t;+ c.Computed.offsetY[eid] = -30 * t;+ break;+ }+ case AnimationType.APPEAR_WORD: {+ const phase = c.Animation.phase[aid];+ const t = phase == 1 ? progress : 1 - progress;+ const chars = c.Chars[eid] ?? '';+ c.Computed.chars[eid] = revealWords(chars, 1 - t);+ break;+ }+ case AnimationType.APPEAR_CHAR: {+ const phase = c.Animation.phase[aid];+ const t = phase == 1 ? progress : 1 - progress;+ const chars = c.Chars[eid] ?? '';+ c.Computed.chars[eid] = revealChars(chars, 1 - t);+ break;+ }+ case AnimationType.SCRAMBLE: {+ const phase = c.Animation.phase[aid];+ const t = phase == 1 ? progress : 1 - progress;+ const chars = c.Chars[eid] ?? '';+ c.Computed.chars[eid] = scrambleChars(chars, 1 - t);+ break;+ }+ }+}++export function motionSystem(world: EngineWorld): void {+ const c = world.components;+ const worldProps = getPropertyPaths(world);++ for (const eid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), Hierarchy(ChildOf), ChildOf('*'), Not(c.Deleted), Not(c.Hidden), Not(c.Culled)])) {++ if (c.Computed.visibility[eid] === 0) continue;++ const hasAnimations = c.Cache.animations[eid].length > 0;+ const hasKeyframes = c.Cache.keyframeTracks[eid].length > 0;+ if (!hasAnimations && !hasKeyframes) continue;++ resetAnimatedValues(world, eid);++ let trimStart = 0+ let trimEnd = c.Computed.duration[eid];++ if (hasComponent(world, eid, c.Trim)) {+ trimStart = c.Trim.start[eid];+ trimEnd = c.Trim.end[eid] ?? trimEnd;+ }++ const localFrame = c.Computed.localTime[eid];++ // 1: Preset animations (FADE/GAIN/GROW/SHRINK/BLUR/SLIDE)+ for (const aid of c.Cache.animations[eid]) {+ const duration = c.Animation.duration[aid] ?? 0;+ if (duration <= 0) continue;++ const delay = c.Animation.delay[aid] ?? 0;+ const isOut = c.Animation.phase[aid] == 1;+ const windowStart = isOut+ ? trimEnd - duration - delay+ : trimStart + delay;+ const windowEnd = windowStart + duration;+ if (isOut ? localFrame < windowStart : localFrame >= windowEnd) continue;++ const progress = clamp01((localFrame - windowStart) / duration);+ applyAnimation(world, eid, aid, progress);+ }++ // 2: Keyframe tracks+ for (const tid of c.Cache.keyframeTracks[eid]) {+ const property = c.KeyframeTrack.property[tid] as PropertyPath;+ const target = c.KeyframeTrack.target[tid];+ const keyframes = c.Cache.keyframes[tid] ?? [];+ const result = sampleTrack(world, keyframes, localFrame, property);+ if (result === null) continue;+ worldProps[property].computed[target] = result;+ }++ // Uniform scale is authored/animated as scaleX only; mirror it onto scaleY.+ if (hasComponent(world, eid, c.UniformScale)) {+ c.Computed.scaleY[eid] = c.Computed.scaleX[eid];+ }+ }+}++/**+ * Read the current value of an ECS component property by dot-path string.+ */+export function getPropertyPaths(world: EngineWorld) {+ const c = world.components;+ return {+ 'position.x': {+ computed: c.Computed.positionX,+ authored: c.Position.x,+ },+ 'position.y': {+ computed: c.Computed.positionY,+ authored: c.Position.y,+ },+ 'offset.x': {+ computed: c.Computed.offsetX,+ authored: c.Offset.x,+ },+ 'offset.y': {+ computed: c.Computed.offsetY,+ authored: c.Offset.y,+ },+ 'rotation': {+ computed: c.Computed.rotation,+ authored: c.Rotation,+ },+ 'scale.x': {+ computed: c.Computed.scaleX,+ authored: c.Scale.x,+ },+ 'scale.y': {+ computed: c.Computed.scaleY,+ authored: c.Scale.y,+ },+ 'scale': {+ computed: c.Computed.scaleX,+ authored: c.UniformScale,+ },+ 'skew.x': {+ computed: c.Computed.skewX,+ authored: c.Skew.x,+ },+ 'skew.y': {+ computed: c.Computed.skewY,+ authored: c.Skew.y,+ },+ 'width': {+ computed: c.Computed.width,+ authored: c.Size.width,+ },+ 'height': {+ computed: c.Computed.height,+ authored: c.Size.height,+ },+ 'opacity': {+ computed: c.Computed.opacity,+ authored: c.Appearance.opacity,+ },+ 'color': {+ computed: c.Computed.color,+ authored: c.Color,+ },+ 'blur': {+ computed: c.Computed.blur,+ authored: c.Blur,+ },+ 'volume': {+ computed: c.Computed.volume,+ authored: c.Volume,+ },+ 'effect.value': {+ computed: c.Computed.value,+ authored: c.Effect.value,+ },+ 'stroke.width': {+ computed: c.Computed.strokeWidth,+ authored: c.StrokeStyle.width,+ },+ 'vertexRadius': {+ computed: c.Computed.cornerRadius,+ authored: c.CornerRadius,+ },+ 'mixedVertexRadius.topLeft': {+ computed: c.Computed.cornerRadiusTopLeft,+ authored: c.MixedCornerRadius.topLeft,+ },+ 'mixedVertexRadius.topRight': {+ computed: c.Computed.cornerRadiusTopRight,+ authored: c.MixedCornerRadius.topRight,+ },+ 'mixedVertexRadius.bottomRight': {+ computed: c.Computed.cornerRadiusBottomRight,+ authored: c.MixedCornerRadius.bottomRight,+ },+ 'mixedVertexRadius.bottomLeft': {+ computed: c.Computed.cornerRadiusBottomLeft,+ authored: c.MixedCornerRadius.bottomLeft,+ },+ 'stop.offset': {+ computed: c.Computed.stopOffset,+ authored: c.ColorStop.offset,+ },+ 'stop.color': {+ computed: c.Computed.stopColor,+ authored: c.ColorStop.color,+ },+ 'stop.opacity': {+ computed: c.Computed.stopOpacity,+ authored: c.ColorStop.opacity,+ },+ 'chars': {+ computed: c.Computed.chars,+ authored: c.Chars,+ },+ };+}++export type PropertyPath = keyof ReturnType<typeof getPropertyPaths>;++// ─── Easing ─────────────────────────────────────────────────++type EasingFunction = (t: number) => number;++const easingCache = new Map<string, EasingFunction>();++/**+ * Parse an easing descriptor string and return an easing function.+ * Returns null for empty/undefined (= default linear interpolation).+ * Supported formats:+ * "steps(9)" or "steps(9,true)" → animejs steps(n, fromStart?)+ * "cubicBezier(0.25,0.1,0.25,1)" → animejs cubicBezier(x1,y1,x2,y2)+ * "spring(0.5,500)" → animejs spring({ bounce, duration })+ */+function resolveEasing(descriptor: string | undefined): EasingFunction | null {+ if (!descriptor || descriptor === '') return null;++ const cached = easingCache.get(descriptor);+ if (cached) return cached;++ let fn: EasingFunction | null = null;++ const stepsMatch = descriptor.match(/^steps\((\d+)(?:,(true|false))?\)$/);+ if (stepsMatch) {+ const n = Number.parseInt(stepsMatch[1], 10);+ const fromStart = stepsMatch[2] === 'true';+ fn = steps(n, fromStart);+ }++ const bezierMatch = descriptor.match(/^cubicBezier\(([\d.]+),([\d.]+),([\d.]+),([\d.]+)\)$/);+ if (bezierMatch) {+ const [, x1, y1, x2, y2] = bezierMatch;+ fn = cubicBezier(Number(x1), Number(y1), Number(x2), Number(y2));+ }++ const springMatch = descriptor.match(/^spring\(([\d.-]+),([\d.-]+)\)$/);+ if (springMatch) {+ const [, bounce, duration] = springMatch;+ const s = spring({+ bounce: Number(bounce),+ duration: Number(duration),+ });+ fn = (t: number) => s.ease(t);+ }++ if (fn) {+ easingCache.set(descriptor, fn);+ return fn;+ }++ return null;+}++/**+ * Sample a presorted aggregated keyframe track at a local frame.+ * Returns null only if the track has no keyframes.+ */+function sampleTrack(+ world: EngineWorld,+ keyframes: number[],+ frame: number,+ property: PropertyPath,+): number | null {+ const Keyframe = world.components.Keyframe;+ if (keyframes.length === 0) return null;++ if (keyframes.length === 1) {+ return Keyframe.value[keyframes[0]];+ }++ const firstValue = Keyframe.value[keyframes[0]];+ const lastValue = Keyframe.value[keyframes[keyframes.length - 1]];++ const firstFrame = Keyframe.time[keyframes[0]];+ const lastFrame = Keyframe.time[keyframes[keyframes.length - 1]];++ if (frame <= firstFrame) {+ return firstValue;+ }++ if (frame >= lastFrame) {+ return lastValue;+ }++ for (let i = 0; i < keyframes.length - 1; i++) {+ const start = Keyframe.time[keyframes[i]];+ const end = Keyframe.time[keyframes[i + 1]];+ if (frame < start || frame > end) continue;++ const span = end - start;+ if (span <= 0) continue;++ let progress = Math.max(0, Math.min(1, (frame - start) / span));++ const easingFn = resolveEasing(Keyframe.easing[keyframes[i]]);+ if (easingFn) {+ progress = easingFn(progress);+ }++ const startValue = Keyframe.value[keyframes[i]];+ const endValue = Keyframe.value[keyframes[i + 1]];++ if (property === 'color' || property === 'stop.color') {+ return lerpColor(startValue, endValue, progress);+ }++ // Linear interpolation+ return startValue + (endValue - startValue) * progress;+ }++ return lastValue;+}++/**+ * Channel-wise linear interpolation between two packed 0xRRGGBB colors.+ * Linear interpolation on the packed integer bleeds bits between channels+ * and produces wrong intermediate hues.+ */+function lerpColor(from: number, to: number, progress: number): number {+ const r0 = (from >> 16) & 0xFF;+ const g0 = (from >> 8) & 0xFF;+ const b0 = from & 0xFF;+ const r1 = (to >> 16) & 0xFF;+ const g1 = (to >> 8) & 0xFF;+ const b1 = to & 0xFF;+ const r = Math.round(r0 + (r1 - r0) * progress);+ const g = Math.round(g0 + (g1 - g0) * progress);+ const b = Math.round(b0 + (b1 - b0) * progress);+ return (r << 16) | (g << 8) | b;+}++function clamp01(value: number): number {+ return Math.max(0, Math.min(1, value));+}++function lerp(from: number, to: number, progress: number): number {+ return from + (to - from) * progress;+}diff --git a/apps/web/src/components/engine/systems/playback.ts b/apps/web/src/components/engine/systems/playback.tsnew file mode 100644index 00000000..bdc4b0da--- /dev/null+++ b/apps/web/src/components/engine/systems/playback.ts@@ -0,0 +1,410 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, Or, query } from 'bitecs';+import { ChildOf, PaintType } from '../components';+import { resolveAudioDecoder, resolveCaptionDecoder, resolveImageDecoder, resolveSequenceDecoder, resolveVideoDecoder } from '../decoders';+import { getParentEntity } from '../api';+import { getTransitionWindow } from '../utils/transition';+import { AudioBus } from '../services/audio-bus';+import { clamp } from '@/utils';+import { addComponent, removeComponent } from '../api/events';++import type { EngineWorld } from '../api/world';++const WARMUP_FRAMES = 15;++function advancePlayhead(world: EngineWorld, eid: number): void {+ const c = world.components;+ // In offline mode the encoder sets the playhead explicitly per frame, so+ // skip the delta-based advance — running it would either double-step or+ // drift depending on how the caller set `world.timestamp.delta`.+ if (world.mode !== 'realtime') return;++ const fps = world.frameRate;+ let looped = false;++ // Only advance the playhead while playing. The audio play/stop bookkeeping+ // below must still run when stopped, otherwise a manual stop (playing+ // flipped to 0 externally) is never observed — `wasPlaying` stays stuck at+ // 1 and the next play isn't re-anchored, so scheduled buffers land in the+ // past and play silently.+ if (c.Playback.playing[eid] === 1) {+ const dt = world.timestamp.delta / 1000;+ const speed = c.Playback.speed[eid] || 1;+ const previousTime = c.Computed.localTimeInSeconds[eid];+ let time = previousTime + dt * speed;++ const hasTrim = hasComponent(world, eid, c.Trim);+ const duration = c.Computed.duration[eid];+ const durationSeconds = duration / fps;++ const maxSeconds = hasTrim+ ? (c.Trim.end[eid] ?? duration) / fps+ : durationSeconds;++ const minSeconds = hasTrim+ ? (c.Trim.start[eid] ?? 0) / fps+ : 0;++ if (time >= maxSeconds) {+ if (c.Playback.loop[eid] === 1) {+ time = minSeconds;+ looped = true;+ } else {+ c.Playback.playing[eid] = 0;+ }+ } else if (time <= minSeconds) {+ if (c.Playback.loop[eid] === 1) {+ time = maxSeconds;+ looped = true;+ } else {+ c.Playback.playing[eid] = 0;+ time = minSeconds;+ }+ }++ c.Computed.localTimeInSeconds[eid] = clamp(time, minSeconds, maxSeconds);+ c.Computed.localTime[eid] = Math.round(c.Computed.localTimeInSeconds[eid] * fps);+ }++ // Handle audio play/stop transitions+ const ctx = world.audio;+ const playing = c.Playback.playing[eid] ?? 0;+ const wasPlaying = c.AudioPlayback.wasPlaying[eid] ?? 0;++ if ((playing && !wasPlaying) || looped) {+ c.AudioPlayback.contextOffsetInSeconds[eid] = ctx.currentTime;+ c.AudioPlayback.timelineOffsetInSeconds[eid] = c.Computed.localTimeInSeconds[eid];+ }++ if (!playing && wasPlaying) {+ resetDecoders(world, eid);+ }++ c.AudioPlayback.wasPlaying[eid] = playing;+}++function forwardVideoDecoder(world: EngineWorld, sid: number, eid: number, fid: number): void {+ const c = world.components;+ const fps = world.frameRate;++ const globalFrame = c.Computed.localTime[sid];+ const localFrame = c.Computed.localTime[eid];+ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];+ const hasCache = world.mode === 'realtime';+ const warmupDecoder = globalFrame >= start - WARMUP_FRAMES && globalFrame < end + WARMUP_FRAMES && hasCache;++ let trimStart = 0+ let trimEnd = c.Computed.duration[eid];++ if (hasComponent(world, eid, c.Trim)) {+ trimStart = c.Trim.start[eid];+ trimEnd = c.Trim.end[eid] ?? trimEnd;+ }++ const decoder = resolveVideoDecoder(world, fid);+ if (!decoder) return;++ if (c.Computed.visibility[eid] === 1 || warmupDecoder) {+ const seekFrame = clamp(localFrame, trimStart, trimEnd);+ const seekPromise = decoder.seekTo(seekFrame, fps);+ world.promises?.push(seekPromise ?? null);+ }+}++function forwardSequenceDecoder(world: EngineWorld, sid: number, eid: number, fid: number): void {+ const c = world.components;+ const fps = world.frameRate;++ const globalFrame = c.Computed.localTime[sid];+ const localFrame = c.Computed.localTime[eid];+ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];+ const hasCache = world.mode === 'realtime';+ const warmupDecoder = globalFrame >= start - WARMUP_FRAMES && globalFrame < end + WARMUP_FRAMES && hasCache;++ let trimStart = 0+ let trimEnd = c.Computed.duration[eid];++ if (hasComponent(world, eid, c.Trim)) {+ trimStart = c.Trim.start[eid];+ trimEnd = c.Trim.end[eid] ?? trimEnd;+ }++ const decoder = resolveSequenceDecoder(world, fid, hasCache);+ if (!decoder) return;++ if (c.Computed.visibility[eid] === 1 || warmupDecoder) {+ const seekFrame = clamp(localFrame, trimStart, trimEnd);+ const seekPromise = decoder.seekTo(seekFrame, fps);+ world.promises?.push(seekPromise);+ }+}++function forwardCaptionDecoder(world: EngineWorld, _sid: number, eid: number): void {+ const c = world.components;++ const localFrame = c.Computed.localTime[eid];+ const fps = world.frameRate;++ const decoder = resolveCaptionDecoder(world, eid);+ decoder?.seekTo(world, eid, localFrame / fps);+}++/**+ * Forward audio decoder for a child entity.+ * @param world Engine World+ * @param sid Scene Entity Id+ * @param eid Child Entity Id+ * @param aid Optional alterantive eid of the entity that carries the audio+ * @returns+ */+function forwardAudioDecoder(world: EngineWorld, sid: number, eid: number, aid?: number): void {+ const c = world.components;++ if (hasComponent(world, eid, c.Muted)) return;++ const resolvedDecoder = resolveAudioDecoder(world, aid ?? eid);+ if (!resolvedDecoder) return;++ const { decoder, initPromise } = resolvedDecoder;++ const fps = world.frameRate;+ const currentTime = c.Computed.localTime[sid];+ const localFrame = c.Computed.localTime[eid];+ const trimStart = c.Trim.start[eid] ?? 0;++ const playbackRate = c.PlaybackRate[eid] ?? 1;+ const delay = c.Computed.delay[eid];+ const trimEnd = c.Trim.end[eid] ?? c.Computed.duration[eid] ?? 0;++ const audioOffset = c.AudioPlayback.contextOffsetInSeconds[sid] ?? 0;+ const playbackOffset = c.AudioPlayback.timelineOffsetInSeconds[sid] ?? 0;+ // In offline rendering the encoder pins contextOffset to 0 and playbackOffset+ // to the workarea start, so this term shifts scheduled audio back into the+ // encoded window (and resolves to 0 when there is no workarea).+ const audioDelay = audioOffset - playbackOffset+ const bus = resolveAudioBus(world, eid);++ if (!decoder.ready) {+ world.promises?.push(initPromise);+ } else if (c.Computed.visibility[eid] === 1 && c.Playback.playing[sid] === 1) {+ const playPromise = decoder.playTo(bus, {+ relativeFrom: localFrame / fps,+ relativeTo: (localFrame + 15) / fps,+ trimStart: trimStart / fps,+ trimEnd: trimEnd / fps,+ playbackRate,+ currentTime: currentTime / fps,+ relativeDelay: (delay / fps) + audioDelay,+ });+ world.promises?.push(playPromise);+ } else {+ decoder.reset();+ }+}++function forwardImageDecoder(world: EngineWorld, _sid: number, _eid: number, fid: number): void {+ const resolvedDecoder = resolveImageDecoder(world, fid);+ if (!resolvedDecoder) return;++ const { decoder, initPromise } = resolvedDecoder;++ if (!decoder.ready) {+ world.promises?.push(initPromise);+ }+}++/**+ * Forward decoders for a child entity.+ * @param world Engine World+ * @param sid Scene Entity Id+ * @param eid Child Entity Id+ */+function forwardDecoders(world: EngineWorld, sid: number, eid: number): void {+ const c = world.components;++ const hidden =+ hasComponent(world, eid, c.Hidden)+ || hasComponent(world, eid, c.Culled)+ || world.mode === 'offline-audio';++ let paintAudioEid: number | undefined;+ if (!hidden) {+ for (const fid of query(world, [ChildOf(eid), c.Paint, Not(c.Deleted), Not(c.Hidden)])) {+ if (c.Paint[fid] === PaintType.VIDEO) {+ forwardVideoDecoder(world, sid, eid, fid);+ paintAudioEid = fid;+ }++ if (c.Paint[fid] === PaintType.SEQUENCE) {+ forwardSequenceDecoder(world, sid, eid, fid);+ }++ if (c.Paint[fid] === PaintType.IMAGE) {+ forwardImageDecoder(world, sid, eid, fid);+ }+ }+ }++ if (hasComponent(world, eid, c.Caption) && !hidden) {+ forwardCaptionDecoder(world, sid, eid);+ }++ if (hasComponent(world, eid, c.Audio) || paintAudioEid) {+ forwardAudioDecoder(world, sid, eid, paintAudioEid);+ }++ for (const cid of query(world, [ChildOf(eid), Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(c.Deleted), Not(c.Hidden)])) {+ forwardDecoders(world, sid, cid);+ }+}++function updateVisibility(world: EngineWorld, sid: number, eid: number): void {+ const c = world.components;++ // Root or dragging entity is always visible+ if (eid === sid || hasComponent(world, eid, c.Dragging)) {+ c.Computed.visibility[eid] = 1;+ } else {+ const globalFrame = c.Computed.localTime[sid];+ const delay = c.Computed.delay[eid] ?? 0;+ const playbackRate = c.PlaybackRate[eid] ?? 1;++ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];++ c.Computed.localTime[eid] = Math.round((globalFrame - delay) * playbackRate);+ c.Computed.visibility[eid] = globalFrame >= start && globalFrame < end ? 1 : 0;+ }++ for (const cid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(eid), Not(c.Deleted)])) {+ updateVisibility(world, sid, cid);+ }+}++function resetDecoders(world: EngineWorld, eid: number): void {+ const c = world.components;+ c.AudioDecoder[eid]?.reset();++ for (const cid of query(world, [ChildOf(eid), c.AudioDecoder, Not(c.Deleted)])) {+ resetDecoders(world, cid);+ }+}+++function collectAncestors(world: EngineWorld, eid: number): number[] {+ const path: number[] = [];++ let current: number | null = eid;+ while (current) {+ path.push(current);+ current = getParentEntity(world, current);+ }++ return path.toReversed();+}++function resolveAudioBus(world: EngineWorld, eid: number) {+ const c = world.components;+ let bus = c.AudioBus[eid];+ if (bus) return bus;++ const ancestors = collectAncestors(world, eid);++ // Walk root -> leaf, connecting each bus's gain into its parent's input+ // (root connects into the context destination). Reuse buses that already+ // exist; only newly created ones need wiring.+ let currentInput: AudioNode = world.audio.destination;++ for (const aeid of ancestors) {+ let abus = c.AudioBus[aeid];++ if (!abus) {+ abus = new AudioBus(world, aeid);+ addComponent(world, aeid, c.AudioBus, false);+ c.AudioBus[aeid] = abus;+ abus.connect(currentInput);+ }++ currentInput = abus.input;+ }++ return c.AudioBus[eid];+}++function getGlobalFrame(world: EngineWorld, eid: number): number {+ const c = world.components;++ let current: number | null = eid;+ while (current) {+ if (hasComponent(world, current, c.Playback)) {+ return c.Computed.localTime[current];+ }+ current = getParentEntity(world, current);+ }++ return 0;+}++export function playbackSystem(world: EngineWorld): void {+ const c = world.components;++ // handle root playback+ for (const eid of query(world, [c.Playback, Not(c.Deleted)])) {+ advancePlayhead(world, eid);+ }++ for (const eid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(ChildOf('*')), Not(c.Deleted)])) {+ updateVisibility(world, eid, eid);+ forwardDecoders(world, eid, eid);+ }++ // handle transition visibility+ for (const cid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), c.Transition, Not(c.Deleted)])) {+ const parentEid = getParentEntity(world, cid);++ if (parentEid == null || !hasComponent(world, parentEid, c.Sequential)) {+ console.info('Removing transition due to non-sequential parent', cid);+ // System-driven cleanup of orphaned state — not a user edit.+ removeComponent(world, cid, c.Transition, false);+ continue;+ }++ const children = query(world, [ChildOf(parentEid), Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(c.Deleted)]);+ const partner = children.find(rid => c.Computed.start[rid] === c.Computed.end[cid]);+ if (!partner) continue;+ const window = getTransitionWindow(world, cid, partner);+ const globalFrame = getGlobalFrame(world, cid);+ if (globalFrame >= window.start && globalFrame < window.end) {+ c.Computed.visibility[cid] = 1;+ c.Computed.visibility[partner] = 1;+ }+ }++ // Sync audio buses+ let soloedEntities: Set<number> | null = null;+ for (const eid of query(world, [c.AudioBus, Not(c.Deleted)])) {+ c.AudioBus[eid]?.sync();+ if (!hasComponent(world, eid, c.Soloed)) continue;++ if (soloedEntities === null) {+ soloedEntities = new Set();+ }++ for (const aid of collectAncestors(world, eid)) {+ soloedEntities.add(aid);+ }+ }++ if (soloedEntities) {+ for (const eid of query(world, [c.AudioBus, Not(c.Deleted)])) {+ if (!soloedEntities.has(eid)) {+ c.AudioBus[eid]?.mute();+ }+ }+ }+}diff --git a/apps/web/src/components/engine/systems/render.ts b/apps/web/src/components/engine/systems/render.tsnew file mode 100644index 00000000..1c04f38a--- /dev/null+++ b/apps/web/src/components/engine/systems/render.ts@@ -0,0 +1,839 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, query, Not, Or } from 'bitecs';+import { ChildOf, COMPOSITE_OPERATIONS, EffectType, GeometryType, PaintType, ScaleMode, StrokeCap, StrokeJoin, TransitionType } from '../components';+import { getParentEntity } from '../api/base';+import { cubicBezier } from 'animejs';+import { resolveImageDecoder, resolveVideoDecoder, resolveSequenceDecoder, resolveCaptionDecoder } from '../decoders';+import { getAudioPeaks } from '../decoders/audio-peaks';+import { renderText } from '../utils/text';+import { getTransitionWindow } from '../utils/transition';+import { colorToHex } from '../../../utils/color';+import { handleCanvasInteraction, handleGeometryInteraction } from '../api/interactions';++import type { EngineWorld } from '../api/world';+import type { Quad } from '..';++type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;++const MISSING_ASSET_COLOR = '#5C2828';++export function drawRectPath(world: EngineWorld, eid: number): void {+ const ctx = world.ctx!;+ const c = world.components;+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];++ const computed = c.Computed;+ const hasMixed = hasComponent(world, eid, c.MixedCornerRadius);+ let tl = hasMixed ? computed.cornerRadiusTopLeft[eid] : computed.cornerRadius[eid];+ let tr = hasMixed ? computed.cornerRadiusTopRight[eid] : tl;+ let br = hasMixed ? computed.cornerRadiusBottomRight[eid] : tl;+ let bl = hasMixed ? computed.cornerRadiusBottomLeft[eid] : tl;++ ctx.beginPath();++ if (tl === 0 && tr === 0 && br === 0 && bl === 0) {+ ctx.rect(0, 0, w, h);+ } else if (tl === tr && tr === br && br === bl) {+ ctx.roundRect(0, 0, w, h, tl);+ } else {+ // Clamp radii so adjacent corners don't exceed the edge length (CSS spec algorithm)+ const scale = Math.min(+ w / (tl + tr || 1),+ h / (tr + br || 1),+ w / (br + bl || 1),+ h / (bl + tl || 1),+ 1,+ );+ if (scale < 1) {+ tl *= scale;+ tr *= scale;+ br *= scale;+ bl *= scale;+ }++ ctx.moveTo(tl, 0);+ ctx.lineTo(w - tr, 0);+ if (tr > 0) ctx.arcTo(w, 0, w, tr, tr);+ else ctx.lineTo(w, 0);+ ctx.lineTo(w, h - br);+ if (br > 0) ctx.arcTo(w, h, w - br, h, br);+ else ctx.lineTo(w, h);+ ctx.lineTo(bl, h);+ if (bl > 0) ctx.arcTo(0, h, 0, h - bl, bl);+ else ctx.lineTo(0, h);+ ctx.lineTo(0, tl);+ if (tl > 0) ctx.arcTo(0, 0, tl, 0, tl);+ else ctx.lineTo(0, 0);+ }++ ctx.closePath();+}++function getScaledImageProps(+ mode: number,+ imgW: number,+ imgH: number,+ targetW: number,+ targetH: number,+): [dx: number, dy: number, sw: number, sh: number] {+ if (mode === ScaleMode.FILL) {+ return [0, 0, targetW, targetH];+ }+ if (mode === ScaleMode.FIT) {+ const scale = Math.min(targetW / imgW, targetH / imgH);+ const sw = imgW * scale;+ const sh = imgH * scale;+ return [(targetW - sw) / 2, (targetH - sh) / 2, sw, sh];+ }+ if (mode === ScaleMode.COVER) {+ const scale = Math.max(targetW / imgW, targetH / imgH);+ const sw = imgW * scale;+ const sh = imgH * scale;+ return [(targetW - sw) / 2, (targetH - sh) / 2, sw, sh];+ }+ // ScaleMode.NONE — original size+ return [0, 0, imgW, imgH];+}++/** Create a canvas linear gradient from ECS components. */+export function createLinearGradient(+ world: EngineWorld,+ fid: number,+ ctx: Ctx2D,+ w: number,+ h: number,+): CanvasGradient {+ const Computed = world.components.Computed;++ // (px, py) is the gradient center in normalized shape-local space. Fills+ // without a Position component (the default for stock gradient fills) get+ // (0.5, 0.5) so the gradient spans the shape. With Position present, the+ // motion-system-sampled Computed values are used (keyframeable).+ const hasPos = hasComponent(world, fid, world.components.Position);+ const px = hasPos ? Computed.positionX[fid] : 0.5;+ const py = hasPos ? Computed.positionY[fid] : 0.5;+ const sx = Computed.scaleX[fid];+ const sy = Computed.scaleY[fid];+ const angle = (Computed.rotation[fid] * Math.PI) / 180;+ const cos = Math.cos(angle);+ const sin = Math.sin(angle);++ // Transform normalized start (0, 0.5) and end (1, 0.5) points+ const startLocalX = (0 - 0.5) * sx;+ const startLocalY = (0.5 - 0.5) * sy;+ const x0 = (px + startLocalX * cos - startLocalY * sin) * w;+ const y0 = (py + startLocalX * sin + startLocalY * cos) * h;++ const endLocalX = (1 - 0.5) * sx;+ const endLocalY = (0.5 - 0.5) * sy;+ const x1 = (px + endLocalX * cos - endLocalY * sin) * w;+ const y1 = (py + endLocalX * sin + endLocalY * cos) * h;++ const gradient = ctx.createLinearGradient(x0, y0, x1, y1);++ addStopsTo(world, fid, gradient);+ return gradient;+}++/** Create a canvas radial gradient from ECS components. */+export function createRadialGradient(+ world: EngineWorld,+ fid: number,+ ctx: Ctx2D,+ w: number,+ h: number,+): CanvasGradient {+ const Computed = world.components.Computed;++ const hasPos = hasComponent(world, fid, world.components.Position);+ const px = hasPos ? Computed.positionX[fid] : 0.5;+ const py = hasPos ? Computed.positionY[fid] : 0.5;+ const sx = Computed.scaleX[fid];+ const sy = Computed.scaleY[fid];+ const angle = (Computed.rotation[fid] * Math.PI) / 180;+ const cos = Math.cos(angle);+ const sin = Math.sin(angle);++ // Center point (0.5, 0.5) in normalized space+ const cx = px * w;+ const cy = py * h;++ // Edge points to determine radius+ const edgeXLocalX = (1 - 0.5) * sx;+ const edgeXLocalY = (0.5 - 0.5) * sy;+ const edgeXAbsX = (px + edgeXLocalX * cos - edgeXLocalY * sin) * w;+ const edgeXAbsY = (py + edgeXLocalX * sin + edgeXLocalY * cos) * h;++ const edgeYLocalX = (0.5 - 0.5) * sx;+ const edgeYLocalY = (1 - 0.5) * sy;+ const edgeYAbsX = (px + edgeYLocalX * cos - edgeYLocalY * sin) * w;+ const edgeYAbsY = (py + edgeYLocalX * sin + edgeYLocalY * cos) * h;++ const distX = Math.hypot(edgeXAbsX - cx, edgeXAbsY - cy);+ const distY = Math.hypot(edgeYAbsX - cx, edgeYAbsY - cy);+ const outerRadius = Math.max(0.0001, distX, distY);++ const gradient = ctx.createRadialGradient(cx, cy, 0, cx, cy, outerRadius);++ addStopsTo(world, fid, gradient);+ return gradient;+}++/** Push a fill's ColorStop children onto a CanvasGradient. Reads Computed+ * values so the latest keyframe-sampled state is what gets painted. Offsets+ * beyond 1 wrap via modulo (1.5 → 0.5) so animated stops can cycle; offset+ * exactly 1 is preserved as the gradient end. */+function addStopsTo(world: EngineWorld, fid: number, gradient: CanvasGradient): void {+ const c = world.components;+ const Computed = c.Computed;+ const stops = [...query(world, [c.ColorStop, ChildOf(fid), Not(c.Deleted)])]+ .map(sid => {+ const raw = Computed.stopOffset[sid];+ return {+ offset: raw <= 1 ? Math.max(0, raw) : raw % 1,+ color: Computed.stopColor[sid],+ opacity: Computed.stopOpacity[sid],+ };+ })+ .sort((a, b) => a.offset - b.offset);++ for (const { offset, color, opacity } of stops) {+ gradient.addColorStop(offset, toGradientColor(color, opacity));+ }+}++function toGradientColor(color: number, opacity: number): string {+ if (opacity >= 1) return colorToHex(color);++ const r = (color >> 16) & 0xFF;+ const g = (color >> 8) & 0xFF;+ const b = color & 0xFF;+ return `rgba(${r},${g},${b},${Math.max(0, Math.min(1, opacity))})`;+}++const EPSILON = 1e-4;++/** Build a single CSS filter fragment from an effect sub-entity. Returns null if hidden or no-op. */+function effectFilter(world: EngineWorld, subEid: number): string | null {+ const c = world.components;++ if (hasComponent(world, subEid, c.Hidden)) return null;++ const value = c.Computed.value[subEid];+ const type = c.Effect.type[subEid] ?? 0;++ if (type === EffectType.LAYER_BLUR) {+ const clamped = Math.max(0, value);+ return clamped > EPSILON ? `blur(${clamped}px)` : null;+ }+ if (type === EffectType.BRIGHTNESS) {+ const clamped = Math.min(1, Math.max(0, value));+ return Math.abs(clamped - 1) > EPSILON ? `brightness(${clamped})` : null;+ }+ if (type === EffectType.CONTRAST) {+ const clamped = Math.min(1, Math.max(0, value));+ return Math.abs(clamped - 1) > EPSILON ? `contrast(${clamped})` : null;+ }+ if (type === EffectType.GRAYSCALE) {+ const clamped = Math.min(1, Math.max(0, value));+ return clamped > EPSILON ? `grayscale(${clamped})` : null;+ }+ if (type === EffectType.HUE_ROTATION) {+ return Math.abs(value) > EPSILON ? `hue-rotate(${value}deg)` : null;+ }+ if (type === EffectType.INVERT) {+ const clamped = Math.min(1, Math.max(0, value));+ return clamped > EPSILON ? `invert(${clamped})` : null;+ }+ if (type === EffectType.SATURATE) {+ const clamped = Math.min(1, Math.max(0, value));+ return Math.abs(clamped - 1) > EPSILON ? `saturate(${clamped})` : null;+ }+ if (type === EffectType.SEPIA) {+ const clamped = Math.min(1, Math.max(0, value));+ return clamped > EPSILON ? `sepia(${clamped})` : null;+ }+ return null;+}++/** Apply CSS filter from effect sub-entities. Returns true if a filter was applied. */+function buildEffects(world: EngineWorld, eid: number): string | null {+ const c = world.components;++ const parts: string[] = [];++ const blurVal = c.Computed.blur[eid];+ if (blurVal > EPSILON) {+ parts.push(`blur(${blurVal}px)`);+ }++ const effects = c.Cache.effects[eid];+ for (const effect of effects) {+ const f = effectFilter(world, effect);+ if (f) parts.push(f);+ }++ if (parts.length === 0) return null;++ return parts.join(' ');+}++export function renderFills(world: EngineWorld, eid: number): void {+ const c = world.components;+ const ctx = world.ctx!;++ for (const fid of c.Cache.fills[eid]) {+ if (hasComponent(world, fid, c.Hidden)) continue;+ const savedAlpha = ctx.globalAlpha;+ const savedCO = ctx.globalCompositeOperation;+ const bi = c.Appearance.blendMode[fid] ?? 0;++ if (bi !== 0) {+ ctx.globalCompositeOperation = COMPOSITE_OPERATIONS[bi];+ }++ ctx.globalAlpha = savedAlpha * c.Computed.opacity[fid];++ if (c.Paint[fid] === PaintType.IMAGE) {+ const decoder = resolveImageDecoder(world, fid)?.decoder;+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];+ const bitmap = decoder?.getBitmap(w, h);++ if (bitmap) {+ ctx.save();+ ctx.clip();++ const mode = c.ScaleMode[fid] ?? 0;+ const [dx, dy, sw, sh] = getScaledImageProps(mode, bitmap.width, bitmap.height, w, h);+ ctx.drawImage(bitmap, dx, dy, sw, sh);++ ctx.restore();+ } else if (decoder?.failed) {+ ctx.fillStyle = MISSING_ASSET_COLOR;+ ctx.fill();+ }+ } else if (c.Paint[fid] === PaintType.VIDEO) {+ const decoder = resolveVideoDecoder(world, fid);+ const frame = decoder?.toBitmap();++ if (frame) {+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];++ ctx.save();+ ctx.clip();++ const mode = c.ScaleMode[fid] ?? 0;+ const [dx, dy, sw, sh] = getScaledImageProps(mode, frame.width, frame.height, w, h);+ ctx.drawImage(frame, dx, dy, sw, sh);++ ctx.restore();+ } else if (decoder?.errored) {+ ctx.fillStyle = MISSING_ASSET_COLOR;+ ctx.fill();+ }+ } else if (c.Paint[fid] === PaintType.SEQUENCE) {+ const decoder = resolveSequenceDecoder(world, fid);+ const frame = decoder?.toBitmap();++ if (frame) {+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];++ ctx.save();+ ctx.clip();++ const mode = c.ScaleMode[fid] ?? 0;+ const [dx, dy, sw, sh] = getScaledImageProps(mode, frame.width, frame.height, w, h);+ ctx.drawImage(frame, dx, dy, sw, sh);++ ctx.restore();+ } else if (decoder?.errored) {+ ctx.fillStyle = MISSING_ASSET_COLOR;+ ctx.fill();+ }+ } else if (c.Paint[fid] === PaintType.SOLID) {+ ctx.fillStyle = colorToHex(c.Computed.color[fid]);+ ctx.fill();+ } else if (c.Paint[fid] === PaintType.LINEAR_GRADIENT) {+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];+ ctx.fillStyle = createLinearGradient(world, fid, ctx, w, h);+ ctx.fill();+ } else if (c.Paint[fid] === PaintType.RADIAL_GRADIENT) {+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];+ ctx.fillStyle = createRadialGradient(world, fid, ctx, w, h);+ ctx.fill();+ } else if (c.Paint[fid] === PaintType.WAVEFORM) {+ renderWaveform(world, eid, fid);+ }++ ctx.globalCompositeOperation = savedCO;+ ctx.globalAlpha = savedAlpha;+ }+}++function renderShadows(world: EngineWorld, eid: number): void {+ const ctx = world.ctx!;+ const c = world.components;++ const shadows = c.Cache.shadows[eid];+ if (!shadows) return;++ ctx.save();+ const savedAlpha = ctx.globalAlpha;++ // ctx.shadowBlur/OffsetX/OffsetY are in device-pixel space and are not+ // affected by the current transform, so scale them up to match the+ // content transform (camera * resolution).+ const shadowScale = world.camera.a * world.resolution;++ for (const sid of shadows) {+ if (hasComponent(world, sid, c.Hidden)) continue;+ const color = colorToHex(c.Computed.color[sid]);+ ctx.shadowColor = color;+ ctx.fillStyle = color;+ ctx.globalAlpha = savedAlpha * c.Computed.opacity[sid];+ ctx.shadowBlur = c.Computed.blur[sid] * shadowScale;+ ctx.shadowOffsetX = c.Computed.offsetX[sid] * shadowScale;+ ctx.shadowOffsetY = c.Computed.offsetY[sid] * shadowScale;+ ctx.fill();+ }++ ctx.restore();+}++function renderStrokes(world: EngineWorld, eid: number): void {+ const ctx = world.ctx!;+ const strokes = world.components.Cache.strokes[eid];+ if (!strokes) return;++ const Stroke = world.components.StrokeStyle;+ const Computed = world.components.Computed;++ ctx.lineWidth = Computed.strokeWidth[eid];+ ctx.lineJoin = StrokeJoin[Stroke.join[eid] ?? 0].toLocaleLowerCase() as CanvasLineJoin;+ ctx.lineCap = StrokeCap[Stroke.cap[eid] ?? 0].toLocaleLowerCase() as CanvasLineCap;+ ctx.miterLimit = Stroke.miterLimit[eid] ?? 3;++ const Hidden = world.components.Hidden;+ const Appearance = world.components.Appearance;+ const Paint = world.components.Paint;++ for (const sid of strokes) {+ if (hasComponent(world, sid, Hidden)) continue;+ const savedAlpha = ctx.globalAlpha;+ const savedCO = ctx.globalCompositeOperation;+ const bi = Appearance.blendMode[sid] ?? 0;++ if (bi !== 0) {+ ctx.globalCompositeOperation = COMPOSITE_OPERATIONS[bi];+ }++ ctx.globalAlpha = savedAlpha * Computed.opacity[sid];++ const paintType = Paint[sid];+ if (paintType === PaintType.LINEAR_GRADIENT) {+ const w = Computed.width[eid];+ const h = Computed.height[eid];+ ctx.strokeStyle = createLinearGradient(world, sid, ctx, w, h);+ } else if (paintType === PaintType.RADIAL_GRADIENT) {+ const w = Computed.width[eid];+ const h = Computed.height[eid];+ ctx.strokeStyle = createRadialGradient(world, sid, ctx, w, h);+ } else {+ ctx.strokeStyle = colorToHex(Computed.color[sid]);+ }+ ctx.stroke();++ ctx.globalCompositeOperation = savedCO;+ ctx.globalAlpha = savedAlpha;+ }+}++/**+ * Pulse animation for entities with the Generating tag.+ *+ * Easing: cubic-bezier(0.52, 0.18, 0.56, 0.88)+ * Duration: 0.6s per half-cycle (alternating)+ * Delay: 0.2s before the first transition+ * Full cycle: 0.2 delay + 0.6 forward + 0.6 reverse = 1.4s+ * repeats ∞ for the entire gen phase (~4.5s)+ *+ * Pulses between --background (#1c1c1c) and --secondary (#292929).+ */+const generatingEase = cubicBezier(0.52, 0.18, 0.56, 0.88);++const GEN_DELAY = 200; // ms+const GEN_DURATION = 600; // ms per half-cycle+const GEN_CYCLE = GEN_DURATION * 2; // full forward+reverse cycle++// Colors: #1c1c1c → rgb(28,28,28) and #292929 → rgb(41,41,41)+const GEN_FROM_R = 28, GEN_FROM_G = 28, GEN_FROM_B = 28;+const GEN_TO_R = 41, GEN_TO_G = 41, GEN_TO_B = 41;++function renderGenerating(world: EngineWorld, eid: number): void {+ const c = world.components;+ const ctx = world.ctx!;+ if (!hasComponent(world, eid, c.Generating)) return;++ const t = world.timestamp.now;++ // Before initial delay → show base color+ const elapsed = t % (GEN_DELAY + GEN_CYCLE);+ let factor = 0;++ if (elapsed >= GEN_DELAY) {+ const cycleT = elapsed - GEN_DELAY;+ const half = cycleT % GEN_DURATION;+ const progress = half / GEN_DURATION;+ const eased = generatingEase(progress);++ // Alternate direction: first half forward, second half reverse+ const inReverse = cycleT >= GEN_DURATION;+ factor = inReverse ? 1 - eased : eased;+ }++ const r = Math.round(GEN_FROM_R + (GEN_TO_R - GEN_FROM_R) * factor);+ const g = Math.round(GEN_FROM_G + (GEN_TO_G - GEN_FROM_G) * factor);+ const b = Math.round(GEN_FROM_B + (GEN_TO_B - GEN_FROM_B) * factor);++ ctx.fillStyle = `rgb(${r},${g},${b})`;+ ctx.fill();+}++// ── WAVEFORM paint ─────────────────────────────────────+//+// Renders an audio asset's pre-computed peaks as a bar chart inside the+// parent geometry's bounds. Sourced from `c.AssetId[fid]` — the paint+// carries its own asset reference, exactly like IMAGE/VIDEO/SEQUENCE paints.++const WAVEFORM_BAR_WIDTH = 6;+const WAVEFORM_BAR_GAP = 6;+const WAVEFORM_BAR_RADIUS = WAVEFORM_BAR_WIDTH / 2;+const WAVEFORM_MIN_BAR_HEIGHT = 4;+const WAVEFORM_PADDING = 12;+const WAVEFORM_BG_COLOR = '#202020';+const WAVEFORM_BG_RADIUS = 12;++function renderWaveform(world: EngineWorld, eid: number, fid: number): void {+ const c = world.components;+ const ctx = world.ctx!;++ const assetId = c.AssetId[fid];+ if (!assetId) return;++ const asset = world.assets.get(assetId);+ // Both AUDIO and VIDEO assets carry pre-computed peaks (video has audio).+ if (asset?.type !== 'AUDIO' && asset?.type !== 'VIDEO') return;++ const peaks = getAudioPeaks(asset);+ if (!peaks || peaks.length === 0) return;++ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];++ ctx.save();+ ctx.clip();++ // Background+ ctx.fillStyle = WAVEFORM_BG_COLOR;+ ctx.beginPath();+ ctx.roundRect(0, 0, w, h, WAVEFORM_BG_RADIUS);+ ctx.fill();++ // Bars+ const step = WAVEFORM_BAR_WIDTH + WAVEFORM_BAR_GAP;+ const availableWidth = w - WAVEFORM_PADDING * 2;+ const barCount = Math.floor(availableWidth / step);+ const maxBarHeight = h - WAVEFORM_PADDING * 2;+ if (barCount <= 0 || maxBarHeight <= 0) {+ ctx.restore();+ return;+ }++ const startX = WAVEFORM_PADDING + (availableWidth - barCount * step + WAVEFORM_BAR_GAP) / 2;++ ctx.fillStyle = '#ffffff';++ for (let i = 0; i < barCount; i++) {+ const peakIndex = Math.floor((i / barCount) * peaks.length);+ const value = (peaks[peakIndex] ?? 0) / 255;+ const barHeight = Math.max(value * maxBarHeight, WAVEFORM_MIN_BAR_HEIGHT);+ const x = startX + i * step;+ const y = (h - barHeight) / 2;++ ctx.beginPath();+ ctx.roundRect(x, y, WAVEFORM_BAR_WIDTH, barHeight, WAVEFORM_BAR_RADIUS);+ ctx.fill();+ }++ ctx.restore();+}++function renderShapeNode(world: EngineWorld, eid: number): void {+ drawRectPath(world, eid);+ renderShadows(world, eid);+ renderFills(world, eid);+ renderGenerating(world, eid);+ renderStrokes(world, eid);+}++function renderTextNode(world: EngineWorld, eid: number): void {+ renderText(world, eid);+}++function renderCaptionNode(world: EngineWorld, eid: number): void {+ resolveCaptionDecoder(world, eid)?.draw(world, eid);+}++// ── Transition rendering ─────────────────────────────────────++function renderTransition(world: EngineWorld, sceneEid: number, leftEid: number): void {+ const ctx = world.ctx!;++ const c = world.components;++ const currentTime = c.Computed.localTime[sceneEid];++ const children = world.components.Cache.children[sceneEid];+ const rightEid = children.find(rid => c.Computed.start[rid] === c.Computed.end[leftEid]);+ if (!rightEid) return;++ const win = getTransitionWindow(world, leftEid, rightEid);++ if (currentTime < win.start || currentTime >= win.end) return;++ // we are transitioning+ const duration = win.end - win.start;+ const completion = (currentTime - win.start) / duration;++ const Transition = world.components.Transition;+ const type = Transition.type[leftEid] ?? TransitionType.DISSOLVE;++ const Computed = world.components.Computed;+ const parentEid = getParentEntity(world, leftEid);+ if (parentEid === null) return;+ const width = Computed.width[parentEid];+ const height = Computed.height[parentEid];++ switch (type) {+ case TransitionType.SLIDE_FROM_RIGHT: {+ renderNode(world, leftEid);+ ctx.save();+ ctx.translate(((1 - completion) ** 2 * width) | 0, 0);+ renderNode(world, rightEid);+ ctx.restore();+ break;+ }+ case TransitionType.SLIDE_FROM_LEFT: {+ renderNode(world, leftEid);+ ctx.save();+ ctx.translate(((1 - completion) ** 2 * width * -1) | 0, 0);+ renderNode(world, rightEid);+ ctx.restore();+ break;+ }+ case TransitionType.FADE_TO_BLACK: {+ if (completion < 0.5) {+ renderNode(world, leftEid);+ } else {+ renderNode(world, rightEid);+ }+ ctx.save();+ ctx.beginPath();+ ctx.rect(0, 0, width, height);+ ctx.closePath();+ ctx.fillStyle = '#000000';+ ctx.globalAlpha = completion < 0.5 ? 2 * completion : 2 * (1 - completion);+ ctx.fill();+ ctx.restore();+ break;+ }+ case TransitionType.FADE_TO_WHITE: {+ if (completion < 0.5) {+ renderNode(world, leftEid);+ } else {+ renderNode(world, rightEid);+ }+ ctx.save();+ ctx.beginPath();+ ctx.rect(0, 0, width, height);+ ctx.closePath();+ ctx.fillStyle = '#FFFFFF';+ ctx.globalAlpha = completion < 0.5 ? 2 * completion : 2 * (1 - completion);+ ctx.fill();+ ctx.restore();+ break;+ }+ default: {+ // Dissolve (default)+ renderNode(world, leftEid);+ ctx.save();+ ctx.globalAlpha = completion;+ renderNode(world, rightEid);+ ctx.restore();+ break;+ }+ }++ // Mark both partners as already drawn this frame so the parent's+ // children loop skips its plain renderNode pass for them.+ c.Computed.visibility[leftEid] = 0;+ c.Computed.visibility[rightEid] = 0;+}++export function renderNode(world: EngineWorld, eid: number): void {+ const c = world.components;+ const ctx = world.ctx!;++ if (c.Computed.visibility[eid] === 0 || hasComponent(world, eid, c.Culled)) return;++ if (hasComponent(world, eid, c.Interactive)) {+ world.hitRegions.push({+ callback: handleGeometryInteraction,+ target: { kind: 'entity', id: eid },+ });+ }++ if (hasComponent(world, eid, c.IsMask) || hasComponent(world, eid, c.Hidden)) return;++ ctx.save();++ ctx.transform(+ c.LocalTransform.a[eid],+ c.LocalTransform.b[eid],+ c.LocalTransform.c[eid],+ c.LocalTransform.d[eid],+ c.LocalTransform.e[eid],+ c.LocalTransform.f[eid],+ );++ for (const maskEid of world.components.Cache.masks[eid]) {+ if (c.Computed.visibility[maskEid] === 0) continue;+ ctx.save();+ ctx.setTransform(+ c.WorldTransform.a[maskEid],+ c.WorldTransform.b[maskEid],+ c.WorldTransform.c[maskEid],+ c.WorldTransform.d[maskEid],+ c.WorldTransform.e[maskEid],+ c.WorldTransform.f[maskEid],+ );+ drawRectPath(world, maskEid);+ ctx.restore();+ ctx.clip();+ }++ // Appearance+ ctx.globalAlpha *= c.Computed.opacity[eid];+ const bi = c.Appearance.blendMode[eid] ?? 0;+ if (bi !== 0) ctx.globalCompositeOperation = COMPOSITE_OPERATIONS[bi];++ const effects = buildEffects(world, eid);+ let initialFilter = 'none';++ if (effects !== null) {+ initialFilter = ctx.filter;+ ctx.filter = effects;+ }+++ if (hasComponent(world, eid, c.Caption)) {+ renderCaptionNode(world, eid);+ } else if (c.Geometry[eid] === GeometryType.TEXT) {+ renderTextNode(world, eid);+ } else if (c.Geometry[eid] === GeometryType.RECT) {+ renderShapeNode(world, eid);+ }++ // Clip and render children+ const children = c.Cache.children[eid];+ if (children.length) {+ if (hasComponent(world, eid, c.ClipsContent)) {+ ctx.save();+ ctx.clip();+ }++ for (const child of children) {+ // Edge case: Child with transition+ if (hasComponent(world, child, c.Transition)) {+ renderTransition(world, eid, child);+ // Note: we are not breaking here since the transition handler will hide/unhide the children+ }++ renderNode(world, child);+ }++ if (hasComponent(world, eid, c.ClipsContent)) {+ ctx.restore();+ }+ }++ // Reset filter after drawing+ if (initialFilter !== 'none') {+ ctx.filter = initialFilter;+ }++ ctx.restore();+}++/**+ * Render system entry point. Call after transformSystem.+ *+ * Reads camera, background, and canvas size from world state and applies+ * DPR * Camera as the base canvas transform before drawing top-level nodes.+ */+export function renderSystem(world: EngineWorld): void {+ const ctx = world.ctx!;++ const cw = world.canvas!.width;+ const ch = world.canvas!.height;+ const c = world.components;++ // Clear + background (identity transform for full-canvas clear)+ ctx.setTransform(1, 0, 0, 1, 0, 0);+ ctx.clearRect(0, 0, cw, ch);++ // The stage background is a preview-only affordance; offline encoding+ // renders just the scene onto a transparent canvas (the scene paints its+ // own fill if it has one).+ if (world.mode === 'realtime') {+ ctx.fillStyle = colorToHex(world.background);+ ctx.fillRect(0, 0, cw, ch);+ world.hitRegions.push({+ target: { kind: 'hud', id: 'canvas', quad: getCanvasQuad(world) },+ callback: handleCanvasInteraction,+ });+ }++ // Apply camera transform: DPR * Camera+ ctx.setTransform(+ world.camera.a * world.resolution,+ world.camera.b * world.resolution,+ world.camera.c * world.resolution,+ world.camera.d * world.resolution,+ world.camera.e * world.resolution,+ world.camera.f * world.resolution,+ );++ // Render top-level nodes.+ for (const eid of query(world, [Or(c.Geometry, c.Group), Not(ChildOf('*')), Not(c.Deleted), Not(c.Culled)])) {+ renderNode(world, eid);+ }+}++function getCanvasQuad(world: EngineWorld): Quad {+ return [+ { x: 0, y: 0 },+ { x: world.canvas!.width, y: 0 },+ { x: world.canvas!.width, y: world.canvas!.height },+ { x: 0, y: world.canvas!.height },+ ];+}diff --git a/apps/web/src/components/engine/systems/transform.ts b/apps/web/src/components/engine/systems/transform.tsnew file mode 100644index 00000000..753f96c4--- /dev/null+++ b/apps/web/src/components/engine/systems/transform.ts@@ -0,0 +1,295 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, query, Not, Or } from 'bitecs';++import { ChildOf } from '../components/relations';+import { addComponent, removeComponent } from '../api/events';+import { getParentEntity } from '../api/base';++import type { EngineWorld } from '../api/world';++import {+ multiply2D,+ aabbFromTransformedRect,+ aabbsIntersect,+ translate2D,+ rotate2D,+ skew2D,+ scale2D,+ type Mat2D,+} from '../math';++/**+ * Compute the local 2D affine matrix from Offset, Rotation, Scale,+ * Anchor, Skew and Size. Stores result in LocalMatrix[eid].+ */+export function computeLocalMatrix(world: EngineWorld, eid: number): void {+ const Flip = world.components.Flip;+ const Anchor = world.components.Anchor;+ const Computed = world.components.Computed;+ const LocalTransform = world.components.LocalTransform;++ const positionX = Computed.positionX[eid] + Computed.offsetX[eid];+ const positionY = Computed.positionY[eid] + Computed.offsetY[eid];+ const pivotX = (Anchor.x[eid] ?? 0.5) * Computed.width[eid];+ const pivotY = (Anchor.y[eid] ?? 0.5) * Computed.height[eid];+ const scaleX = (Flip.x[eid] ?? 1) * Computed.scaleX[eid];+ const scaleY = (Flip.y[eid] ?? 1) * Computed.scaleY[eid];+ const rotation = Computed.rotation[eid];+ const skewX = Computed.skewX[eid];+ const skewY = Computed.skewY[eid];++ let mat = translate2D(positionX, positionY);+ mat = multiply2D(mat, translate2D(pivotX, pivotY));+ mat = multiply2D(mat, rotate2D(rotation));+ mat = multiply2D(mat, skew2D(skewX, skewY));+ mat = multiply2D(mat, scale2D(scaleX, scaleY));+ mat = multiply2D(mat, translate2D(-pivotX, -pivotY));++ LocalTransform.a[eid] = mat.a;+ LocalTransform.b[eid] = mat.b;+ LocalTransform.c[eid] = mat.c;+ LocalTransform.d[eid] = mat.d;+ LocalTransform.e[eid] = mat.e;+ LocalTransform.f[eid] = mat.f;+}++/**+ * WorldTransform = Parent.WorldTransform * LocalMatrix+ * For top-level entities (no entity parent), pass the camera × DPR matrix.+ */+export function computeWorldTransform(world: EngineWorld, eid: number, parentEid: number | null): void {+ const WorldTransform = world.components.WorldTransform;+ const LocalTransform = world.components.LocalTransform;++ if (LocalTransform.a[eid] === undefined) {+ LocalTransform.a[eid] = 1;+ LocalTransform.b[eid] = 0;+ LocalTransform.c[eid] = 0;+ LocalTransform.d[eid] = 1;+ LocalTransform.e[eid] = 0;+ LocalTransform.f[eid] = 0;+ }++ let parent: Mat2D;+ if (parentEid !== null) {+ parent = {+ a: WorldTransform.a[parentEid], b: WorldTransform.b[parentEid],+ c: WorldTransform.c[parentEid], d: WorldTransform.d[parentEid],+ e: WorldTransform.e[parentEid], f: WorldTransform.f[parentEid],+ }+ } else {+ const res = world.resolution;+ parent = {+ a: world.camera.a * res, b: world.camera.b * res,+ c: world.camera.c * res, d: world.camera.d * res,+ e: world.camera.e * res, f: world.camera.f * res,+ };+ }++ const local: Mat2D = {+ a: LocalTransform.a[eid], b: LocalTransform.b[eid],+ c: LocalTransform.c[eid], d: LocalTransform.d[eid],+ e: LocalTransform.e[eid], f: LocalTransform.f[eid],+ };++ const m = multiply2D(parent, local);++ WorldTransform.a[eid] = m.a;+ WorldTransform.b[eid] = m.b;+ WorldTransform.c[eid] = m.c;+ WorldTransform.d[eid] = m.d;+ WorldTransform.e[eid] = m.e;+ WorldTransform.f[eid] = m.f;+}++/**+ * Compute world-space AABB from world transform and size.+ */+export function computeWorldBounds(world: EngineWorld, eid: number): void {+ const WorldBounds = world.components.WorldBounds;+ const WorldTransform = world.components.WorldTransform;+ const Computed = world.components.Computed;++ const worldMat: Mat2D = {+ a: WorldTransform.a[eid], b: WorldTransform.b[eid],+ c: WorldTransform.c[eid], d: WorldTransform.d[eid],+ e: WorldTransform.e[eid], f: WorldTransform.f[eid],+ };+ const mat = multiply2D(worldMat, translate2D(Computed.originX[eid], Computed.originY[eid]));+ const bounds = aabbFromTransformedRect(mat, Computed.width[eid], Computed.height[eid]);++ WorldBounds.minX[eid] = bounds.minX;+ WorldBounds.minY[eid] = bounds.minY;+ WorldBounds.maxX[eid] = bounds.maxX;+ WorldBounds.maxY[eid] = bounds.maxY;+}++function cullEntity(world: EngineWorld, eid: number, parentEid: number | null): void {+ const WorldBounds = world.components.WorldBounds;+ const Culled = world.components.Culled;++ // Inherit cull from the parent: the renderer already skips entire+ // subtrees of culled parents, so descendants are effectively invisible+ // even when their own AABB intersects the parent's. Propagating the tag+ // down lets us free their decoders too. Pre-order DFS guarantees the+ // parent's tag is already settled by the time we reach the child.+++ let intersect = true;++ if (parentEid === null) {+ intersect = aabbsIntersect({+ minX: WorldBounds.minX[eid],+ minY: WorldBounds.minY[eid],+ maxX: WorldBounds.maxX[eid],+ maxY: WorldBounds.maxY[eid],+ }, {+ minX: 0,+ minY: 0,+ maxX: world.canvas!.width,+ maxY: world.canvas!.height,+ });+ } else {+ intersect = !hasComponent(world, parentEid, Culled);+ }++ const wasCulled = hasComponent(world, eid, Culled);++ if (!intersect) {+ if (!wasCulled) {+ addComponent(world, eid, Culled, false);+ }+ } else if (wasCulled) {+ removeComponent(world, eid, Culled, false);+ }+}++/**+ * Recompute a Group/Sequential entity's Computed bounds from the union of its+ * children's transformed boxes. Leaf entities own an absolute Size and need no+ * resolution here.+ */+export function computeGroupBounds(world: EngineWorld, eid: number): void {+ const c = world.components;++ if (hasComponent(world, eid, c.Group) || hasComponent(world, eid, c.Sequential)) {+ let minX = Infinity;+ let minY = Infinity;+ let maxX = -Infinity;+ let maxY = -Infinity;+ let any = false;++ for (const childEid of query(world, [Or(c.Geometry, c.Group), ChildOf(eid), Not(c.Deleted), Not(c.Hidden)])) {+ const mat: Mat2D = {+ a: c.LocalTransform.a[childEid] ?? 1, b: c.LocalTransform.b[childEid] ?? 0,+ c: c.LocalTransform.c[childEid] ?? 0, d: c.LocalTransform.d[childEid] ?? 1,+ e: c.LocalTransform.e[childEid] ?? 0, f: c.LocalTransform.f[childEid] ?? 0,+ };+ const bounds = aabbFromTransformedRect(mat, c.Computed.width[childEid], c.Computed.height[childEid]);+ if (bounds.minX < minX) minX = bounds.minX;+ if (bounds.minY < minY) minY = bounds.minY;+ if (bounds.maxX > maxX) maxX = bounds.maxX;+ if (bounds.maxY > maxY) maxY = bounds.maxY;+ any = true;+ }++ if (!any) {+ c.Computed.width[eid] = 0;+ c.Computed.height[eid] = 0;+ return;+ }++ c.Computed.width[eid] = Math.max(0, maxX - minX);+ c.Computed.height[eid] = Math.max(0, maxY - minY);+ c.Computed.originX[eid] = minX;+ c.Computed.originY[eid] = minY;+ }+}++function adjustLayers(world: EngineWorld, adjust: number) {+ const c = world.components;++ if (c.Computed.visibility[adjust] === 0 || hasComponent(world, adjust, c.Hidden)) return;+++ // get next non sequential parent+ let slot = adjust;+ let parent = getParentEntity(world, slot);+ while (parent !== null && hasComponent(world, parent, c.Sequential)) {+ slot = parent;+ parent = getParentEntity(world, slot);+ }+ if (parent === null) return;++ const siblings = c.Cache.children[parent];+ if (!siblings) return;+ const idx = siblings.indexOf(slot);+ if (idx <= 0) return;++ const target = siblings[idx - 1];+ if (target === undefined) return;++ // adjust's own local matrix must be current; it is not visited by the walk+ // (adjustment layers are neither Geometry nor Group) and reads only+ // motion-resolved Computed values.+ computeLocalMatrix(world, adjust);++ const adjustLocal: Mat2D = {+ a: c.LocalTransform.a[adjust], b: c.LocalTransform.b[adjust], c: c.LocalTransform.c[adjust],+ d: c.LocalTransform.d[adjust], e: c.LocalTransform.e[adjust], f: c.LocalTransform.f[adjust],+ };+ const clipLocal: Mat2D = {+ a: c.LocalTransform.a[target], b: c.LocalTransform.b[target], c: c.LocalTransform.c[target],+ d: c.LocalTransform.d[target], e: c.LocalTransform.e[target], f: c.LocalTransform.f[target],+ };++ const composed = multiply2D(adjustLocal, clipLocal);+ c.LocalTransform.a[target] = composed.a;+ c.LocalTransform.b[target] = composed.b;+ c.LocalTransform.c[target] = composed.c;+ c.LocalTransform.d[target] = composed.d;+ c.LocalTransform.e[target] = composed.e;+ c.LocalTransform.f[target] = composed.f;++ const reworld = (eid: number, parentEid: number | null) => {+ computeWorldTransform(world, eid, parentEid);+ computeWorldBounds(world, eid);+ cullEntity(world, eid, parentEid);++ for (const childEid of query(world, [Or(c.Geometry, c.Group), ChildOf(eid), Not(c.Deleted)])) {+ reworld(childEid, eid);+ }+ }++ reworld(target, parent);+}++/**+ * Transform system entry point. Call once per frame before renderSystem.+ */+export function transformSystem(world: EngineWorld): void {+ const c = world.components;++ const walk = (eid: number, parentEid: number | null) => {+ computeGroupBounds(world, eid);+ computeLocalMatrix(world, eid);+ computeWorldTransform(world, eid, parentEid);+ computeWorldBounds(world, eid);+ cullEntity(world, eid, parentEid);++ for (const childEid of query(world, [Or(c.Geometry, c.Group), ChildOf(eid), Not(c.Deleted)])) {+ walk(childEid, eid);+ }+ }++ for (const eid of query(world, [Not(ChildOf('*')), Or(c.Geometry, c.Group), Not(c.Deleted)])) {+ walk(eid, null);+ }++ for (const adjust of query(world, [c.AdjustmentLayer, Not(c.Deleted)])) {+ adjustLayers(world, adjust);+ }+}diff --git a/apps/web/src/components/engine/thumbnail.ts b/apps/web/src/components/engine/thumbnail.tsnew file mode 100644index 00000000..848e1c92--- /dev/null+++ b/apps/web/src/components/engine/thumbnail.ts@@ -0,0 +1,32 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++const THUMBNAIL_WIDTH = 464;+const THUMBNAIL_HEIGHT = 260;+const JPEG_QUALITY = 0.8;++export async function captureCanvasThumbnail(+ canvas?: HTMLCanvasElement | OffscreenCanvas | null,+): Promise<Blob | null> {+ if (!(canvas instanceof HTMLCanvasElement)) {+ return null;+ }++ const offscreen = document.createElement('canvas');+ offscreen.width = THUMBNAIL_WIDTH;+ offscreen.height = THUMBNAIL_HEIGHT;++ const ctx = offscreen.getContext('2d');+ if (!ctx) return null;++ ctx.drawImage(canvas, 0, 0, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);++ return new Promise((resolve) => {+ offscreen.toBlob(+ resolve,+ 'image/jpeg',+ JPEG_QUALITY,+ );+ });+}diff --git a/apps/web/src/components/engine/timeline/config.ts b/apps/web/src/components/engine/timeline/config.tsnew file mode 100644index 00000000..12e11052--- /dev/null+++ b/apps/web/src/components/engine/timeline/config.ts@@ -0,0 +1,32 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export const MIN_CLIP_HEIGHT = 28;+export const MAX_CLIP_HEIGHT = 116;+export const KEYFRAME_TRACK_HEIGHT = 32;+export const TARGET_MAJOR_TICK_DISTANCE = 160;+export const TIMELINE_RESOLUTION_RANGE = [0.03, 12] as const;+export const DEFAULT_TIMELINE_RESOLUTION = 1 / 0.7;+export const DEFAULT_CLIP_HEIGHT = 32;++export const TIMELINE_PADDING_LEFT = 8;++export const CLICK_DISTANCE_THRESHOLD = 5;+export const DOUBLE_CLICK_THRESHOLD = 500;++export const RULER_HEIGHT = 32;+export const RULER_TICK_HEIGHT_MAJOR = 9;+export const RULER_TICK_HEIGHT_MINOR = 3;+export const RULER_LABEL_Y = 16;++export const CLIP_CORNER_RADIUS = 4;+export const CLIP_FONT = '11px Inter';+export const CLIP_LABEL_X = 6;+export const CLIP_LABEL_Y = 10;+export const CLIP_LABEL_HEIGHT = 20;++export const CLIP_BREAKPOINTS = {+ xs: 32,+ sm: 40,+}diff --git a/apps/web/src/components/engine/timeline/constants.ts b/apps/web/src/components/engine/timeline/constants.tsnew file mode 100644index 00000000..030558a6--- /dev/null+++ b/apps/web/src/components/engine/timeline/constants.ts@@ -0,0 +1,115 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { secondsToFrames } from "../utils";++export const RULER_INTERVALS = [+ {+ numerator: secondsToFrames(30),+ denominator: 10,+ },+ {+ numerator: secondsToFrames(10),+ denominator: 10,+ },+ {+ numerator: secondsToFrames(5),+ denominator: 10,+ },+ {+ numerator: secondsToFrames(3),+ denominator: 10,+ },+ {+ numerator: secondsToFrames(2),+ denominator: 10,+ },+ {+ numerator: secondsToFrames(1),+ denominator: 10,+ },+ {+ numerator: 15,+ denominator: 5,+ },+ {+ numerator: 10,+ denominator: 10,+ },+ {+ numerator: 5,+ denominator: 5,+ },+];++// window.getComputedStyle(document.body).getPropertyValue('--background')++export const COLORS = {+ background: {+ default: '#1C1C1C',+ muted: '#292929',+ accent: '#292929',+ },+ border: {+ darker: '#1C1C1C',+ input: '#3E3F41',+ ring: '#008CFF',+ scrubber: '#F43535', // ambient red+ },+ ruler: {+ tick: '#404040',+ text: '#505050',+ },+ clip: {+ group: {+ background: '#40464F',+ primary: '#545D67',+ foreground: '#EDF0F3',+ },+ video: {+ background: '#0F3C8A',+ primary: '#70A7FF', // Waveform+ foreground: '#CCE0FF', // Label+ },+ audio: {+ background: '#004732',+ primary: '#0DBF8A',+ foreground: '#CBFAED',+ },+ caption: {+ background: '#7B1E5A',+ primary: '#AA317B', // Word background+ foreground: '#F9DCED',+ },+ image: {+ background: '#A55912',+ foreground: '#F9F2EC',+ },+ text: {+ background: '#303E4F',+ foreground: '#E7EFF9',+ },+ shape: {+ background: '#933325',+ foreground: '#FAEDEB',+ },+ scene: {+ background: '#066284',+ primary: '#5AB9DD',+ foreground: '#DBEAF0',+ },+ mask: {+ background: '#5455DE',+ foreground: '#EAE8FC',+ },+ adjustment: {+ background: '#4827B0',+ foreground: '#E7DFFB',+ },+ html: {+ background: '#2B525F',+ foreground: '#E7F4F9',+ },+ },+} as const;diff --git a/apps/web/src/components/engine/timeline/index.ts b/apps/web/src/components/engine/timeline/index.tsnew file mode 100644index 00000000..18b2b868--- /dev/null+++ b/apps/web/src/components/engine/timeline/index.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './timeline';+export * from './render';+export * from './utils';diff --git a/apps/web/src/components/engine/timeline/paths.ts b/apps/web/src/components/engine/timeline/paths.tsnew file mode 100644index 00000000..b2e56573--- /dev/null+++ b/apps/web/src/components/engine/timeline/paths.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export const KNOB_PATH = new Path2D("M6.47987 12.372C5.68637 13.2449 4.31359 13.2449 3.52004 12.372L0.520121 9.07213C0.185444 8.70399 4.73995e-07 8.22432 4.61669e-07 7.72679L3.19793e-07 2C2.92428e-07 0.89543 0.895431 1.57728e-07 2 2.54292e-07L7.99987 7.78817e-07C9.10449 8.75386e-07 9.99994 0.895511 9.99987 2.00013L9.99949 7.72692C9.99946 8.22437 9.81405 8.70396 9.47945 9.07206L6.47987 12.372Z");+export const IN_POINT_PATH = new Path2D("M1.95052 0H4.61719V10H1.95052V8.5V6.25L0.771284 5.97362C-0.257794 5.73243 -0.257794 4.26757 0.771284 4.02638L1.95052 3.75V1.5V0Z");+export const OUT_POINT_PATH = new Path2D("M2.66667 0H0V10H2.66667V8.5V6.25L3.8459 5.97362C4.87498 5.73243 4.87498 4.26757 3.8459 4.02638L2.66667 3.75V1.5V0Z");diff --git a/apps/web/src/components/engine/timeline/pointer.ts b/apps/web/src/components/engine/timeline/pointer.tsnew file mode 100644index 00000000..1e7caab9--- /dev/null+++ b/apps/web/src/components/engine/timeline/pointer.ts@@ -0,0 +1,302 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { assert } from "@/utils";+import * as cfg from "./config";++type MousePosition = {+ state: 'idle';+ currentX: number;+ currentY: number;+} | {+ state: 'pressed' | 'pressing' | 'lifted';+ initialX: number;+ initialY: number;+ timestamp: number;+ currentX: number;+ currentY: number;+ deltaX: number;+ deltaY: number;+}++type TransformedRegion = {+ minX: number;+ minY: number;+ maxX: number;+ maxY: number;+ id: string;+ passthrough: boolean;+}++type HitRegions = {+ prev: Array<TransformedRegion>;+ next: Array<TransformedRegion>;+ id: string;+ index: number;+};++export type Pointer = ReturnType<typeof createPointer>;++type PointerOptions = {+ marquee?: {+ x: number;+ y: number;+ width: number;+ height: number;+ };+ canvas?: HTMLCanvasElement | null;+ ctx?: CanvasRenderingContext2D | null;+};++export function createPointer(options: PointerOptions) {+ let position: MousePosition | null = null;+ let pressRegionID: string | null = null;+ let hitRegions: HitRegions = {+ prev: [],+ next: [],+ id: '',+ index: 0,+ };+ let lastClickPosition: {+ x: number;+ y: number;+ timestamp: number;+ } | null = null;++ let shiftPressed = false;++ function down(event: PointerEvent) {+ const rect = options.canvas?.getBoundingClientRect();+ if (!rect || event.button !== 0) return;++ const currentX = event.clientX - rect.left;+ const currentY = event.clientY - rect.top;++ position = {+ state: 'pressed',+ timestamp: performance.now(),+ initialX: currentX,+ initialY: currentY,+ currentX,+ currentY,+ deltaX: 0,+ deltaY: 0,+ };++ shiftPressed = event.shiftKey;+ }++ function move(event: PointerEvent) {+ const rect = options.canvas?.getBoundingClientRect();+ if (!rect) return;++ shiftPressed = event.shiftKey;++ const currentX = event.clientX - rect.left;+ const currentY = event.clientY - rect.top;++ if (!position) {+ position = {+ state: 'idle',+ currentX,+ currentY,+ };+ return;+ }++ if (position.state != 'idle') {+ position.deltaX = currentX - position.initialX;+ position.deltaY = currentY - position.initialY;+ }++ position.currentX = currentX;+ position.currentY = currentY;+ }++ function up(event: PointerEvent) {+ const rect = options.canvas?.getBoundingClientRect();+ if (!rect) return;+ if (!position || position.state === 'idle') return;++ const currentX = event.clientX - rect.left;+ const currentY = event.clientY - rect.top;++ position = {+ ...position,+ state: 'lifted',+ currentX,+ currentY,+ deltaX: currentX - position.initialX,+ deltaY: currentY - position.initialY,+ };+ pressRegionID = null;+ shiftPressed = event.shiftKey;+ }+++ function scope(id: string) {+ hitRegions.id = id;+ hitRegions.index = 0;++ return pointer;+ }++ function region(x = 0, y = 0, w: number, h: number, id?: string, passthrough = false) {+ assert(options.ctx, 'Canvas context must be set');++ if (!position) return {+ hovering: false,+ clicked: false,+ pressing: false,+ pressed: false,+ dragging: false,+ doubleClicked: false,+ intersectsMarquee: false,+ };++ const regionData = {+ id: `${hitRegions.id}/${id ?? hitRegions.index}`,+ ...transformRegionToCanvas(options.ctx, x, y, w, h),+ passthrough,+ };++ hitRegions.index++;+ hitRegions.next.push(regionData);++ // Mouse position is in CSS pixels, scale to device pixels to match canvas coordinates+ const mouseX = position.currentX * window.devicePixelRatio;+ const mouseY = position.currentY * window.devicePixelRatio;++ const matches = hitRegions.prev.filter(({ minX, minY, maxX, maxY }) => (+ mouseX >= minX &&+ mouseX < maxX &&+ mouseY >= minY &&+ mouseY < maxY+ ));++ const lastMatch = matches.findLast(({ passthrough }) => !passthrough);++ let isPrimary = lastMatch?.id === regionData.id;+ let isPassive = matches.some(({ passthrough, id }) => passthrough && id == regionData.id);+ let hovering = isPrimary || isPassive;+ let pressing = hovering && position?.state == 'pressing';+ let pressed = hovering && position?.state == 'pressed';++ // Track the region that was pressed down on+ if (pressed) {+ pressRegionID = lastMatch?.id ?? null;+ }++ // Assign dragging state after a distance threshold has been passed+ let dragging = false;+ if (position?.state == 'pressing' && pressRegionID == regionData.id) {+ const distance = Math.sqrt(position.deltaX ** 2 + position.deltaY ** 2);+ dragging = distance >= cfg.CLICK_DISTANCE_THRESHOLD;+ }++ // Only consider click if pointer hasn't moved beyond the distance threshold+ let clicked = false;+ if (position?.state == 'lifted') {+ const distance = Math.sqrt(position.deltaX ** 2 + position.deltaY ** 2);+ clicked = distance < cfg.CLICK_DISTANCE_THRESHOLD && hovering;+ }++ let doubleClicked = false;+ if (clicked && lastClickPosition) {+ const delta = performance.now() - lastClickPosition.timestamp;+ const distance = Math.sqrt(+ Math.pow(position.currentX - lastClickPosition.x, 2) ++ Math.pow(position.currentY - lastClickPosition.y, 2)+ );+ doubleClicked = delta < cfg.DOUBLE_CLICK_THRESHOLD && hovering && distance < 10;+ }++ let intersectsMarquee = false;+ if (options.marquee) {+ // Convert marquee selection from CSS pixels to canvas coordinates+ const marqueeMinX = options.marquee.x * window.devicePixelRatio;+ const marqueeMaxX = (options.marquee.x + options.marquee.width) * window.devicePixelRatio;+ const marqueeMinY = options.marquee.y * window.devicePixelRatio;+ const marqueeMaxY = (options.marquee.y + options.marquee.height) * window.devicePixelRatio;++ // Check intersection: regions intersect if they overlap+ intersectsMarquee = !(+ regionData.maxX < marqueeMinX ||+ regionData.minX > marqueeMaxX ||+ regionData.maxY < marqueeMinY ||+ regionData.minY > marqueeMaxY+ );+ }++ return {+ hovering, // If the pointer is over the rect+ clicked, // If the rect was clicked this frame+ pressing, // If the pointer is pressing down on the rect this frame+ pressed, // If the just started pressing down on the rect this frame+ dragging, // If the pointer is dragging the rect this frame+ doubleClicked, // If the rect was double clicked this frame+ intersectsMarquee, // If the region intersects the marquee selection+ };+ }++ function reset() {+ hitRegions.prev = [...hitRegions.next];+ hitRegions.next.length = 0;++ if (position?.state == 'lifted') {+ position = {+ ...position,+ state: 'idle',+ };+ lastClickPosition = {+ x: position.currentX,+ y: position.currentY,+ timestamp: performance.now(),+ };+ }++ if (position?.state == 'pressed') {+ position = {+ ...position,+ state: 'pressing',+ };+ }+ }++ const pointer = {+ get position() {+ return position;+ },+ get shiftPressed() {+ return shiftPressed;+ },+ down,+ move,+ up,+ scope,+ region,+ reset,+ };++ return pointer;+}++function transformRegionToCanvas(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number) {+ // Transform the region to canvas coordinates when storing it+ const transform = ctx.getTransform();++ // Transform all four corners of the region to canvas coordinates+ const topLeft = transform.transformPoint(new DOMPoint(x, y));+ const topRight = transform.transformPoint(new DOMPoint(x + w, y));+ const bottomLeft = transform.transformPoint(new DOMPoint(x, y + h));+ const bottomRight = transform.transformPoint(new DOMPoint(x + w, y + h));++ // Compute bounding box in canvas coordinates+ return {+ minX: Math.min(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x),+ maxX: Math.max(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x),+ minY: Math.min(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y),+ maxY: Math.max(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y),+ };+}diff --git a/apps/web/src/components/engine/timeline/render/audio.ts b/apps/web/src/components/engine/timeline/render/audio.tsnew file mode 100644index 00000000..330425a0--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/audio.ts@@ -0,0 +1,516 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { assert } from '@/utils';+import { AudioSample, AudioSampleSink } from 'mediabunny';+import { framesToPixels, getRelativeViewport, getCurrentResolution } from '../utils';+import { CLIP_BREAKPOINTS, CLIP_CORNER_RADIUS } from '../config';+import { getAudioTrack } from '../../decoders/audio';++import type { EngineWorld } from '../../api/world';+import type { TimelineContext } from '../world';+import type { AudioAsset, VideoAsset } from '../../db';++interface StoredPeaks {+ start: number;+ end: number;+ id: string;+}++interface SampledPeaks extends StoredPeaks {+ data: Uint8ClampedArray;+ peaksPerSecond: number;+};++type SampleOptions = {+ clipEid: number;+ asset: VideoAsset | AudioAsset;+ peaksPerSecond: number;+ start: number;+ end: number;+}++type PeakData = {+ start: number;+ end: number;+ data: Uint8ClampedArray;+}++type WaveformDrawOptions = {+ asset: VideoAsset | AudioAsset;+ offsetY: number;+ padding: number;+ color: string;+}++type AudioCache = {+ samples: SampledPeaks[];+ start: number;+ end: number;+ hash: string;+ updating: boolean;+ pendingUpdate: SampleOptions | null;+}++type AudioStore = {+ initializing: boolean;+ data: StoredPeaks[];+}++const HIGH_RES_PEAKS_PER_SECOND = 800;+const MAX_CHUNK_DURATION = 2;+const SAMPLE_WIDTH = 1;++const IDB_NAME = "peak-cache-db";+const IDB_VERSION = 1;+const IDB_STORE_NAME = "data";++const audioCache = new Map<number, AudioCache>(); // By clip eid+const audioStore = new Map<string, AudioStore>(); // By asset id++export function pixelsToSeconds(world: EngineWorld, pixels: number) {+ const resolution = getCurrentResolution(world);+ const fps = world.frameRate;++ return pixels / (fps * resolution);+}++export function cloneAudioCacheForSplit(clipEid: number, splitClipEid: number) {+ const sourceCache = audioCache.get(clipEid);+ if (!sourceCache) return;++ audioCache.set(splitClipEid, {+ ...sourceCache,+ // Keep a separate cache object/array but reuse underlying peak buffers.+ samples: sourceCache.samples.map(sample => ({ ...sample })),+ updating: false,+ pendingUpdate: null,+ });+}++export function clearAudioCache(eid?: number) {+ if (eid != undefined) {+ audioCache.delete(eid);+ return;+ }++ audioCache.clear();+}++export function clearAudioBuffers() {+ audioCache.clear();+ audioStore.clear();+}++export function renderAudioWaveform(world: EngineWorld, timeline: TimelineContext, eid: number, options: WaveformDrawOptions) {+ const ctx = timeline.ctx!;++ if (!options.asset.sampleRate) return;++ const resolution = getCurrentResolution(world);++ const c = world.components;+ const fps = world.frameRate;++ const layerHeight = timeline.currentLayerHeight;+ const clipLeft = framesToPixels(world, c.Computed.start[eid]);+ const clipRight = framesToPixels(world, c.Computed.end[eid]);+ const clipWidth = clipRight - clipLeft;+ const maskHeight = layerHeight - options.offsetY;++ const [vpl, vpr] = getRelativeViewport(world, timeline);++ ctx.save();++ // Clip the waveform to the background+ {+ ctx.beginPath();+ ctx.roundRect(clipLeft, options.offsetY, clipWidth, maskHeight, CLIP_CORNER_RADIUS);+ ctx.clip();+ }++ // Make the samples a bit smaller to avoid clipping+ const waveformHeight = maskHeight - options.padding;++ const adjustedViewportLeft = vpl - 5;+ const adjustedViewportRight = vpr + 5;++ const playbackRate = c.PlaybackRate[eid] ?? 1;++ // Each pixel covers playbackRate× more source audio when sped up, so we+ // need proportionally fewer peaks per source second to keep one peak/pixel.+ const pixelsPerSecond = Math.floor(fps * resolution);+ const peaksPerSecond = pixelsPerSecond / SAMPLE_WIDTH / playbackRate;++ // Trim is in source frames; the clip occupies trim/playbackRate timeline frames.+ const inPx = framesToPixels(world, (c.Trim.start[eid] ?? 0) / playbackRate);+ const outPx = framesToPixels(world, (c.Trim.end[eid] ?? c.Computed.duration[eid]) / playbackRate);+ const delayPx = framesToPixels(world, c.Computed.delay[eid]);++ const firstSample = Math.max(inPx, adjustedViewportLeft - delayPx);+ const lastSample = Math.min(outPx, adjustedViewportRight - delayPx);++ updateSamples({+ clipEid: eid,+ asset: options.asset,+ start: pixelsToSeconds(world, firstSample) * playbackRate,+ end: pixelsToSeconds(world, lastSample) * playbackRate,+ peaksPerSecond,+ });++ ctx.fillStyle = options.color;++ const positionMultiplier = maskHeight > CLIP_BREAKPOINTS.sm ? 0.5 : 1;+ const minSampleHeight = maskHeight > CLIP_BREAKPOINTS.sm ? 1 : 0;++ // Tone the waveform down on short clip rows so the label stays readable.+ if (timeline.currentLayerHeight <= CLIP_BREAKPOINTS.sm) {+ ctx.globalAlpha *= 0.6;+ }++ // Draw samples+ ctx.translate(delayPx, options.offsetY + options.padding * positionMultiplier);++ // Enables search at O(1) time complexity when peaks are sorted by start time ascending+ let lastPeakIndex = 0;++ for (let sampleX = firstSample; sampleX < lastSample; sampleX += SAMPLE_WIDTH) {+ const samples = audioCache.get(eid)?.samples;+ const time = pixelsToSeconds(world, sampleX) * playbackRate;+ const index = samples?.findIndex(p => time >= p.start && time <= p.end, lastPeakIndex) ?? -1;+ const sampleData = samples?.[index];+ lastPeakIndex = index;++ if (!sampleData) continue;++ const sampleIndex = Math.floor((time - sampleData.start) * sampleData.peaksPerSecond);+ const sample: number | undefined = sampleData.data[sampleIndex];++ if (sample === undefined) continue;++ const value = sample / 255;+ const sampleHeight = Math.max(value * waveformHeight, minSampleHeight);+ const sampleTop = (waveformHeight - sampleHeight);+ const sampleY = sampleTop * positionMultiplier;++ ctx.fillRect(sampleX, sampleY, SAMPLE_WIDTH, sampleHeight);+ }++ // close clip path+ ctx.closePath();+ ctx.restore();+}++function updateSamples(options: SampleOptions) {+ const stored = audioStore.get(options.asset.id);+ if (!stored || (!stored.initializing && stored.data.length === 0)) {+ initializePeakCache(options);+ }++ if (stored && stored.data.length > 0) {+ updateSampleCache(options, stored);+ }+}+++function findBestPeakRange(options: SampleOptions) {+ const stored = audioStore.get(options.asset.id);++ assert(stored, 'Stored must be set');++ const minValue = Math.max(0, options.start);+ const maxValue = Math.min(options.asset.duration, options.end);++ const fistMatch = stored.data.find(p => inRange(minValue, [p.start, p.end]));+ const lastMatch = stored.data.find(p => inRange(maxValue, [p.start, p.end]));++ const start = fistMatch?.start ?? stored.data.at(0)?.start ?? 0;+ const end = lastMatch?.end ?? stored.data.at(-1)?.end ?? 0;++ const hash = createRangeHash({ ...options, start, end });++ return { start, end, hash };+}++async function updateSampleCache(options: SampleOptions, stored: AudioStore) {+ let cache = audioCache.get(options.clipEid);+ if (!cache) {+ cache = {+ samples: [],+ start: 0,+ end: 0,+ hash: '',+ updating: false,+ pendingUpdate: null,+ }+ audioCache.set(options.clipEid, cache);+ }++ if (cache.updating) {+ cache.pendingUpdate = options;+ return;+ }++ try {+ const { peaksPerSecond } = options;+ const bestRange = findBestPeakRange(options);++ if (bestRange.hash === cache.hash) {+ return;+ }++ cache.updating = true;+ cache.hash = bestRange.hash;++ for (const peak of stored.data) {+ if (!inRange(peak.start, [bestRange.start, bestRange.end])) {+ continue;+ }++ // Downsample to desired peaks per second+ const duration = peak.end - peak.start;+ const targetPeaks = Math.ceil(duration * peaksPerSecond);+ const downsampledBytes = new Uint8ClampedArray(targetPeaks);+ const data = await loadPeaks(peak.id);++ if (!data) continue;+ const numFrames = data.length;++ // Downsample by calculating peaks directly for target positions+ const ratio = numFrames / targetPeaks;+ for (let i = 0; i < targetPeaks; i++) {+ const start = Math.floor(i * ratio);+ const end = Math.floor((i + 1) * ratio);+ let max = 0;++ // For each frame in the range, find max across all channels+ for (let frameIdx = start; frameIdx < end && frameIdx < numFrames; frameIdx++) {+ max = Math.max(max, data[frameIdx]);+ }++ downsampledBytes[i] = max;+ }++ cache.samples = cache.samples.filter(p => p.id !== peak.id);+ cache.samples.push({+ ...peak,+ data: downsampledBytes,+ peaksPerSecond,+ });+ // order by start time ascending+ cache.samples.sort((a, b) => a.start - b.start);+ }++ cache.samples = cache.samples.filter(p => inRange(p.start, [+ bestRange.start,+ bestRange.end,+ ]));+ } catch (error) {+ console.error('Error updating peak cache', error);+ } finally {+ cache.updating = false;+ }++ if (cache.pendingUpdate) {+ const pending = cache.pendingUpdate;+ if (!pending) return;+ cache.pendingUpdate = null;+ void updateSampleCache(pending, stored);+ }+}++async function initializePeakCache(options: SampleOptions) {+ let stored = audioStore.get(options.asset.id);+ if (!stored) {+ stored = { initializing: false, data: [] };+ audioStore.set(options.asset.id, stored);+ }++ try {+ stored.initializing = true;+ const track = await getAudioTrack(options.asset);+ if (!track) return;+ const sink = new AudioSampleSink(track);+ // const iterator = sink.samples(...clip.range);+ const iterator = sink.samples();++ const peaks: PeakData[] = [];+ let duration = 0;++ for await (const sample of iterator) {+ duration += sample.duration;+ try {+ peaks.push(getPeaksFromAudioSample(sample))+ } finally {+ sample.close();+ }++ if (duration > MAX_CHUNK_DURATION) {+ const mergedPeaks = mergePeaks(peaks);+ const id = `${options.asset.id}-${mergedPeaks.start}`;++ stored.data.push({+ start: mergedPeaks.start,+ end: mergedPeaks.end,+ id,+ });+ await storePeaks(id, mergedPeaks.data);+ peaks.length = 0;+ duration = 0;+ }+ }++ if (peaks.length > 0) {+ const mergedPeaks = mergePeaks(peaks);+ const id = `${options.asset.id}-${mergedPeaks.start}`;++ stored.data.push({+ start: mergedPeaks.start,+ end: mergedPeaks.end,+ id,+ });++ await storePeaks(id, mergedPeaks.data);+ }++ stored.data.sort((a, b) => a.start - b.start);+ } catch (error) {+ console.error('Error initializing peak cache', error);+ } finally {+ stored.initializing = false;+ }+}++function getPeaksFromAudioSample(sample: AudioSample): PeakData {+ const size = sample.allocationSize({ format: 'f32', planeIndex: 0 });+ const floats = new Float32Array(size / Float32Array.BYTES_PER_ELEMENT);+ sample.copyTo(floats, { format: 'f32', planeIndex: 0 });++ const numChannels = sample.numberOfChannels;+ const numFrames = floats.length / numChannels;+ const timestamp = sample.timestamp;+ const duration = sample.duration;++ // Downsample to 500 peaks per second+ const targetPeaks = Math.ceil(duration * HIGH_RES_PEAKS_PER_SECOND);+ const downsampledBytes = new Uint8ClampedArray(targetPeaks);++ // Downsample by calculating peaks directly for target positions+ const ratio = numFrames / targetPeaks;++ for (let i = 0; i < targetPeaks; i++) {+ const start = Math.floor(i * ratio);+ const end = Math.floor((i + 1) * ratio);+ let max = 0;++ // For each frame in the range, find max across all channels+ for (let frameIdx = start; frameIdx < end && frameIdx < numFrames; frameIdx++) {+ // Find the max across all channels for this frame+ for (let ch = 0; ch < numChannels; ch++) {+ const floatIdx = frameIdx * numChannels + ch;+ // make a more visually pleasing waveform using a power function+ max = Math.max(max, Math.pow(Math.abs(floats[floatIdx]), 0.8));+ }+ }++ downsampledBytes[i] = Math.floor(255 * max);+ }++ return {+ start: timestamp,+ end: timestamp + duration,+ data: downsampledBytes,+ }+}++function mergePeaks(peaks: PeakData[]): PeakData {+ const length = peaks.reduce((acc, peak) => acc + peak.data.length, 0);+ const mergedPeaks = new Uint8ClampedArray(length);++ let offset = 0;+ for (const peak of peaks) {+ mergedPeaks.set(peak.data, offset);+ offset += peak.data.length;+ }++ return {+ start: peaks[0].start,+ end: peaks[peaks.length - 1].end,+ data: mergedPeaks,+ };+}++type RangeHashOptions = {+ peaksPerSecond: number;+ start?: number;+ end?: number;+}++function createRangeHash(options: RangeHashOptions) {+ return `${options.peaksPerSecond}.${options.start}.${options.end}`;+}++let dbPromise: Promise<IDBDatabase> | null = null;++function getDB(): Promise<IDBDatabase> {+ if (!dbPromise) {+ dbPromise = new Promise((resolve, reject) => {+ const req = indexedDB.open(IDB_NAME, IDB_VERSION);++ req.onupgradeneeded = () => {+ req.result.createObjectStore(IDB_STORE_NAME);+ };++ req.onsuccess = () => {+ const db = req.result;++ const tx = db.transaction(IDB_STORE_NAME, "readwrite");+ tx.objectStore(IDB_STORE_NAME).clear();+ tx.oncomplete = () => resolve(db);+ tx.onerror = () => reject(tx.error);+ };++ req.onerror = () => reject(req.error);+ });+ }+ return dbPromise;+}++async function storePeaks(key: string, peaks: Uint8ClampedArray) {+ const db = await getDB();++ const tx = db.transaction(IDB_STORE_NAME, "readwrite");+ const store = tx.objectStore(IDB_STORE_NAME);++ const blob = new Blob([new Uint8Array(peaks)]);+ store.put(blob, key);+++ return new Promise((resolve, reject) => {+ tx.oncomplete = () => resolve(true);+ tx.onerror = () => reject(tx.error);+ });+}++async function loadPeaks(key: string): Promise<Uint8ClampedArray | null> {+ const db = await getDB();++ const tx = db.transaction(IDB_STORE_NAME, "readonly");+ const store = tx.objectStore(IDB_STORE_NAME);++ const blob: Blob | null = await new Promise((resolve, reject) => {+ const req = store.get(key);+ req.onsuccess = () => resolve(req.result);+ req.onerror = () => reject(req.error);+ });++ if (!blob) return null;++ const buffer = await blob.arrayBuffer();+ return new Uint8ClampedArray(buffer);+}++const inRange = (value: number, range: [number, number]) => {+ return value >= range[0] && value <= range[1];+}diff --git a/apps/web/src/components/engine/timeline/render/background.ts b/apps/web/src/components/engine/timeline/render/background.tsnew file mode 100644index 00000000..7c078886--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/background.ts@@ -0,0 +1,70 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent } from "bitecs";+import { getCurrentResolution, getCurrentScrollX, framesToPixels } from "../utils";+import { assert } from "@/utils";+import { DEFAULT_DURATION_FRAMES } from "../../constants";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";+import { clearComponent } from "../../api/events";++export function renderBackground(world: EngineWorld, timeline: TimelineContext) {+ const canvas = timeline.canvas!;+ const ctx = timeline.ctx!;+ const pointer = timeline.pointer!;++ const scrollX = getCurrentScrollX(world);+ const resolution = getCurrentResolution(world);+ const scene = world.selection.scene;++ const c = world.components;++ // Handle marquee selection+ {+ const { clicked, dragging } = pointer+ .scope('canvas')+ .region(0, 0, canvas.width, canvas.height);++ if (clicked) {+ clearComponent(world, c.Selected, false);+ }++ if (dragging) {+ assert(pointer.position, 'Mouse position must be set');+ assert(pointer.position?.state != 'idle', 'Mouse position must be pressing');++ const x = Math.min(pointer.position.currentX, pointer.position.initialX);+ const y = Math.min(pointer.position.currentY, pointer.position.initialY);+ const width = Math.abs(pointer.position.currentX - pointer.position.initialX);+ const height = Math.abs(pointer.position.currentY - pointer.position.initialY);++ if (!timeline.marquee) {+ clearComponent(world, c.Selected, false);+ }++ timeline.marquee = { x, y, width, height };+ } else if (timeline.marquee) {+ timeline.marquee = undefined;+ }+ }++ // Draw workarea background+ if (scene !== null && hasComponent(world, scene, c.Trim)) {+ const start = c.Trim.start[scene] ?? 0;+ const stopFrame = c.Trim.end[scene] ?? DEFAULT_DURATION_FRAMES;+ ctx.save();++ ctx.translate(-(scrollX * resolution), 0);++ const inPx = framesToPixels(world, start);+ const outPx = framesToPixels(world, stopFrame);++ ctx.fillStyle = timeline.colors.background.default;+ ctx.fillRect(inPx, 0, outPx - inPx, canvas.height);++ ctx.restore();+ }+}diff --git a/apps/web/src/components/engine/timeline/render/caption.ts b/apps/web/src/components/engine/timeline/render/caption.tsnew file mode 100644index 00000000..06d4252f--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/caption.ts@@ -0,0 +1,103 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { binarySearchTextLength, framesToPixels } from "../utils";+import { CaptionType } from "../../components";+import { isCaption } from "../../api";+import { CLIP_CORNER_RADIUS, CLIP_FONT, CLIP_BREAKPOINTS, CLIP_LABEL_HEIGHT } from "../config";+import { getClipStyle } from "./clip";+import { secondsToFrames } from "../../utils";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";++const NAME_MAP: Record<CaptionType, string> = {+ [CaptionType.CLASSIC]: 'Classic',+ [CaptionType.CASCADE]: 'Cascade',+ [CaptionType.SPOTLIGHT]: 'Spotlight',+ [CaptionType.WHISPER]: 'Whisper',+ [CaptionType.PAPER]: 'Paper',+ [CaptionType.GUINEA]: 'Guinea',+ [CaptionType.STARK]: 'Stark',+} as const;++const GROUP_GAP = 2;+const GROUP_PADDING = 8;+const GROUP_PADDING_TOP = 12;++export function renderCaption(world: EngineWorld, timeline: TimelineContext, eid: number) {+ const ctx = timeline.ctx!;+ const c = world.components;++ if (!isCaption(world, eid)) return;++ const decoder = c.CaptionDecoder[eid];+ const groups = decoder?.groups;+ if (!groups?.length) return;++ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];+ const layerHeight = timeline.currentLayerHeight;++ const clipLeft = framesToPixels(world, start);+ const clipRight = framesToPixels(world, end);+ const delay = c.Computed.delay[eid];++ const style = getClipStyle(world, timeline, eid, null);++ ctx.save();++ // Clip to the caption clip bounds+ ctx.beginPath();+ ctx.roundRect(clipLeft, 0, clipRight - clipLeft, layerHeight, CLIP_CORNER_RADIUS);+ ctx.clip();++ for (const group of groups) {+ if (!group.length) continue;++ const groupStart = secondsToFrames(group[0]?.start) + delay;+ const groupEnd = secondsToFrames(group[group.length - 1]?.end) + delay;++ // Skip groups outside the clip range+ if (groupEnd < start || groupStart >= end) continue;++ const clampedStart = Math.max(groupStart, start);+ const clampedEnd = Math.min(groupEnd, end);+ const groupX = framesToPixels(world, clampedStart);+ const groupWidth = framesToPixels(world, clampedEnd) - groupX;+ const groupY = layerHeight < CLIP_BREAKPOINTS.sm ? GROUP_PADDING_TOP : CLIP_LABEL_HEIGHT;+ const groupHeight = layerHeight - groupY - 1;++ if (groupWidth < 2 || groupHeight < 4) continue;++ // Word group background+ ctx.beginPath();+ ctx.roundRect(groupX, groupY, groupWidth - GROUP_GAP, groupHeight, CLIP_CORNER_RADIUS);+ ctx.closePath();++ ctx.fillStyle = style.primary!;+ ctx.fill();++ // Word group text+ const groupText = group.map(w => w.text).join(' ');+ ctx.fontStretch = 'ultra-condensed';+ ctx.font = CLIP_FONT;+ ctx.fillStyle = style.foreground;+ ctx.textAlign = 'left';+ ctx.textBaseline = 'middle';++ const text = binarySearchTextLength(ctx, groupText, groupWidth - GROUP_PADDING);+ if (text) {+ ctx.fillText(text, groupX + 4, groupY + Math.round(groupHeight / 2));+ }+ }++ // Let's assing the name of the clip here to avoid another branch in the main clip function+ {+ const type = c.Caption.type[eid] ?? CaptionType.CLASSIC;+ c.Name[eid] = NAME_MAP[type as CaptionType] + ' Captions';+ }++ ctx.restore();+}diff --git a/apps/web/src/components/engine/timeline/render/clip.ts b/apps/web/src/components/engine/timeline/render/clip.tsnew file mode 100644index 00000000..04d35242--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/clip.ts@@ -0,0 +1,469 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { assert, clamp } from "@/utils";+import { binarySearchTextLength, getCurrentFrame, getRelativeViewport, pixelsToFrames, framesToPixels } from "../utils";+import { secondsToFrames, computeTrimEnd, computeTrimStart } from "../../utils";+import { CLIP_BREAKPOINTS, CLIP_CORNER_RADIUS, CLIP_FONT, CLIP_LABEL_HEIGHT, CLIP_LABEL_X, CLIP_LABEL_Y } from "../config";+import { renderImageThumbnails } from "./image";+import { renderAudioWaveform } from "./audio";+import { renderVideoThumbnails } from "./video";+import { getParentEntity, isAdjustmentLayer, isCaption, isGroup, isMask, isScene, isText } from "../../api";+import { renderCaption } from "./caption";+import { hasComponent, Not, Or, query } from "bitecs";+import { addComponent, clearComponent, removeComponent, setComponent } from "../../api/events";+import { resolveSequentialOverlaps } from "../../api/overlap";+import { renderGroup } from "./group";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";+import type { Asset } from "../../db";+import { ChildOf } from "../../components";++const TRIM_AREA_WIDTH = 10;++export function renderClip(world: EngineWorld, timeline: TimelineContext, eid: number) {+ const ctx = timeline.ctx!;+ const pointer = timeline.pointer!;++ const c = world.components;+ const scene = world.selection.scene;++ if (scene === null) return;++ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];++ let clipLeft = framesToPixels(world, start);+ const clipRight = framesToPixels(world, end);+ const clipWidth = clipRight - clipLeft;+ // Plain text nodes label with their content; captions label with their name+ // (set by the caption renderer to "{preset} Captions").+ const label = isText(world, eid) && !isCaption(world, eid)+ ? (c.Chars[eid] ?? c.Name[eid] ?? '')+ : (c.Name[eid] ?? '');++ pointer.scope(String(eid));++ const assetId = findAssetId(world, eid);+ const asset = world.assets.get(assetId ?? '') ?? null;+ const style = getClipStyle(world, timeline, eid, asset);++ // Handle background interactions+ {+ const { clicked, dragging, intersectsMarquee } = pointer.region(clipLeft, 0, clipWidth, timeline.currentLayerHeight);+ const clipIsSelected = hasComponent(world, eid, c.Selected);++ if (intersectsMarquee && !clipIsSelected) {+ addComponent(world, eid, c.Selected, false);+ }++ if (timeline.marquee && !intersectsMarquee && clipIsSelected) {+ removeComponent(world, eid, c.Selected, false);+ }++ if (clicked && pointer.shiftPressed) {+ addComponent(world, eid, c.Selected, false);+ }++ if (clicked && !pointer.shiftPressed) {+ clearComponent(world, c.Selected, false);+ addComponent(world, eid, c.Selected, false);+ }++ // Starts the drag interaction. Snapshot the original local delay and+ // start/end frames once so subsequent frames apply target =+ // originDelay + offsetFrames absolutely. Start/end snapshots+ // are needed because groups' visual edges aren't derivable from delay.+ if (dragging && !hasComponent(world, eid, c.ClipDragOrigin)) {+ // Open the gesture transaction once, when the grabbed clip starts+ // dragging. Every per-frame Delay write accumulates into it;+ // it commits in renderLayers when the drag ends.+ world.history.startTransaction('Move clip');+ setComponent(world, eid, c.ClipDragOrigin, {+ delay: c.Delay[eid] ?? 0,+ start: c.Computed.start[eid] ?? 0,+ end: c.Computed.end[eid] ?? 0,+ }, false);+ }+ }++ // Apply the drag live: write the snapped delay every frame+ if (hasComponent(world, eid, c.ClipDragOrigin) && pointer.position?.state !== 'idle') {+ const dragX = pointer.position?.deltaX ?? 0;+ const originDelay = c.ClipDragOrigin.delay[eid] ?? 0;+ const offsetFrames = pixelsToFrames(world, dragX);+ const snapFrameDelta = findSnapFrameDelta(world, timeline, offsetFrames);+ const newDelay = originDelay + offsetFrames - snapFrameDelta;++ // this should recompute the start frame+ setComponent(world, eid, c.Delay, newDelay);++ clipLeft = framesToPixels(world, c.Computed.start[eid]);+ }++ // Draw the background of the clip+ {+ ctx.save();++ ctx.beginPath();+ ctx.roundRect(clipLeft, 0, clipWidth, timeline.currentLayerHeight, CLIP_CORNER_RADIUS);+ ctx.closePath();++ ctx.fillStyle = style.background;+ ctx.fill();++ ctx.restore();+ }++ if (isGroup(world, eid)) {+ renderGroup(world, timeline, eid);+ } else if (asset?.type === 'IMAGE' || asset?.type === 'SEQUENCE') {+ renderImageThumbnails(world, timeline, eid, { asset });+ } else if (asset?.type === 'AUDIO') {+ renderAudioWaveform(world, timeline, eid, {+ asset,+ color: timeline.colors.clip.audio.primary,+ offsetY: timeline.currentLayerHeight > CLIP_BREAKPOINTS.sm ? CLIP_LABEL_HEIGHT : 2,+ padding: 4,+ });+ } else if (asset?.type === 'VIDEO') {+ renderVideoThumbnails(world, timeline, eid, { asset });+ }++ if (isCaption(world, eid)) {+ renderCaption(world, timeline, eid);+ }++ // Render the label+ if (!(isCaption(world, eid) && timeline.currentLayerHeight < CLIP_BREAKPOINTS.sm)) {+ ctx.save();++ const [vpl] = getRelativeViewport(world, timeline);+ const labelX = Math.max(clipLeft, vpl);+ const labelMaxWidth = clipLeft + clipWidth - labelX - 2 * CLIP_LABEL_X;++ ctx.translate(labelX, 0);++ ctx.fillStyle = style.foreground;+ ctx.fontStretch = 'ultra-condensed';+ ctx.font = CLIP_FONT;+ ctx.textAlign = 'left';+ ctx.textBaseline = 'middle';++ const transformedLabel = binarySearchTextLength(ctx, label, labelMaxWidth);++ if (transformedLabel) {+ const h = timeline.currentLayerHeight;+ const labelY = h >= CLIP_BREAKPOINTS.xs ? CLIP_LABEL_Y : h / 2;+ ctx.fillText(transformedLabel, CLIP_LABEL_X, labelY);+ }++ ctx.restore();+ }++ // Draw the border last so it sits above thumbnails, waveforms, and labels+ {+ ctx.save();++ ctx.beginPath();+ ctx.roundRect(clipLeft, 0, clipWidth, timeline.currentLayerHeight, CLIP_CORNER_RADIUS);+ ctx.closePath();++ ctx.clip();+ ctx.strokeStyle = hasComponent(world, eid, c.Selected)+ ? timeline.colors.border.ring+ : timeline.colors.border.darker;+ ctx.lineWidth = hasComponent(world, eid, c.Selected) ? 2 : 1;++ ctx.stroke();++ ctx.restore();+ }++ // Handle trim — groups derive their range from children and aren't directly trimmable.+ {+ const trimAreaWidth = Math.min(Math.max(clipWidth / 3, 3), clipWidth / 2, TRIM_AREA_WIDTH);+ const isTrimming = hasComponent(world, eid, c.TrimDragOrigin);++ const { hovering: hoveringLeft, dragging: draggingLeft } = pointer.region(+ clipLeft,+ 0,+ trimAreaWidth,+ timeline.currentLayerHeight,+ );++ const { hovering: hoveringRight, dragging: draggingRight } = pointer.region(+ clipLeft + clipWidth - trimAreaWidth,+ 0,+ trimAreaWidth,+ timeline.currentLayerHeight,+ );++ if (hoveringLeft || draggingLeft) {+ timeline.cursor = 'trim-right';+ } else if (hoveringRight || draggingRight) {+ timeline.cursor = 'trim-left';+ }++ const dragging = draggingLeft || draggingRight;++ if (dragging && !isTrimming) {+ world.history.startTransaction('Trim');+ setComponent(world, eid, c.TrimDragOrigin, {+ start: start,+ end: end,+ }, false);+ }++ if (dragging && hasComponent(world, eid, c.TrimDragOrigin)) {+ assert(pointer.position, 'Mouse position must be set');+ assert(pointer.position.state != 'idle', 'Mouse position must be pressing');++ const deltaFrames = pixelsToFrames(world, pointer.position.deltaX);+ const initialStart = c.TrimDragOrigin.start[eid];+ const initialEnd = c.TrimDragOrigin.end[eid];++ let minFrame: number;+ let maxFrame: number;++ // In the motion-graphics model each clip is its own layer, so trim+ // bounds are no longer constrained by neighboring clips — only by the+ // clip's own range and (below) the underlying asset duration.+ if (draggingLeft) {+ minFrame = 0;+ maxFrame = initialEnd - 1;+ } else {+ minFrame = initialStart + 1;+ maxFrame = Number.POSITIVE_INFINITY;+ }++ if (asset && (asset.type === 'AUDIO' || asset.type === 'VIDEO' || asset.type === 'SEQUENCE')) {+ const delay = c.Computed.delay[eid];+ const playbackRate = c.PlaybackRate[eid] ?? 1;+ const assetDuration = secondsToFrames(asset.duration);+ const assetEnd = delay + assetDuration / playbackRate;++ if (draggingLeft) {+ minFrame = Math.max(minFrame, delay);+ } else {+ maxFrame = Math.min(maxFrame, assetEnd);+ }+ }++ let newFrame: number;+ if (draggingLeft) {+ newFrame = initialStart + deltaFrames;+ } else {+ newFrame = initialEnd + deltaFrames;+ }++ const snapPoints = getSnapFrames(world, timeline);+ const matchedPoint = snapPoints.find(({ frame }) => {+ const distance = framesToPixels(world, Math.abs(frame - newFrame))+ const snapStart = distance < timeline.snapDistance;+ const inRange = frame > minFrame && frame < maxFrame;++ return inRange && snapStart;+ });++ if (matchedPoint) {+ newFrame = matchedPoint.frame;+ const pointX = framesToPixels(world, newFrame);+ timeline.snapX = pointX;+ }++ const clampedValue = clamp(newFrame, minFrame, maxFrame);+ const clampedTrimStart = computeTrimStart(world, eid, clampedValue);+ const clampedTrimEnd = computeTrimEnd(world, eid, clampedValue);++ if (draggingLeft) {+ setComponent(world, eid, c.Trim, { start: clampedTrimStart });+ } else {+ setComponent(world, eid, c.Trim, { end: clampedTrimEnd });+ }+ }++ if (!dragging && isTrimming) {+ resolveSequentialOverlaps(world, [eid]);+ removeComponent(world, eid, c.TrimDragOrigin, false);+ world.history.commitTransaction();+ }+ }+}++type ClipStyle = {+ background: string;+ foreground: string;+ primary?: string;+}++export function getClipStyle(+ world: EngineWorld,+ timeline: TimelineContext,+ eid: number,+ asset: Asset | null+): ClipStyle {+ // Captions are text-geometry too, so check the more-specific tag first.+ if (isCaption(world, eid)) {+ return timeline.colors.clip.caption;+ }++ if (isText(world, eid)) {+ return timeline.colors.clip.text;+ }++ if (isScene(world, eid)) {+ return timeline.colors.clip.scene;+ }++ if (isGroup(world, eid)) {+ return timeline.colors.clip.group;+ }++ if (isMask(world, eid)) {+ return timeline.colors.clip.mask;+ }++ if (isAdjustmentLayer(world, eid)) {+ return timeline.colors.clip.adjustment;+ }++ if (asset?.type == 'VIDEO') {+ return timeline.colors.clip.video;+ }+ if (asset?.type == 'IMAGE') {+ return timeline.colors.clip.image;+ }+ if (asset?.type == 'AUDIO') {+ return timeline.colors.clip.audio;+ }++ return timeline.colors.clip.shape;+}++function getSnapFrames(world: EngineWorld, timeline: TimelineContext) {+ const c = world.components;+ const scene = world.selection.scene;++ if (!timeline.snapping || scene === null) return [];++ // Any entity whose time range moves with — or is derived from — an active+ // drag/trim is a useless snap target. Walk ancestors (groups whose extents+ // come from their children) and descendants (children that shift along+ // with their dragged parent group) of every active item.+ const activeItems = [+ ...query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), c.ClipDragOrigin]),+ ...query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), c.TrimDragOrigin]),+ ];+ const excluded = new Set<number>();+ for (const item of activeItems) {+ let parent = getParentEntity(world, item);+ while (parent !== null && parent !== scene) {+ excluded.add(parent);+ parent = getParentEntity(world, parent);+ }+ for (const descendant of getSceneChildren(world, item)) {+ excluded.add(descendant);+ }+ }++ const availableClips = getSceneChildren(world, scene)+ .filter(cid => {+ if (hasComponent(world, cid, c.ClipDragOrigin)) return false;+ if (hasComponent(world, cid, c.TrimDragOrigin)) return false;+ if (hasComponent(world, cid, c.Selected)) return false;+ if (excluded.has(cid)) return false;+ return true;+ });++ const snapPoints = new Map<number, number | null>();+ snapPoints.set(0, null);+ snapPoints.set(getCurrentFrame(world), null);++ for (const cid of availableClips) {+ snapPoints.set(c.Computed.start[cid], cid);+ snapPoints.set(c.Computed.end[cid], cid);+ }++ return Array.from(snapPoints.entries()).map(([frame, clipEid]) => ({ frame, clipEid }));+}++/**+ * Find the frame-space adjustment needed to snap the active drag to a+ * nearby reference point. Returns the signed frame delta (candidate edge -+ * snap point) the caller must subtract from its offsetFrames to land on the+ * snap target, or 0 if nothing is in range.+ *+ * Doing this in frame space (not pixel space) avoids a floor/round+ * round-trip that otherwise jitters the clip by ±1 frame near the snap+ * point at fractional resolutions.+ */+function findSnapFrameDelta(world: EngineWorld, timeline: TimelineContext, offsetFrames: number) {+ const c = world.components;++ // Candidates: each dragging item contributes its snapshotted start and end+ // frame shifted by the current drag offset. Using snapshots (rather than+ // reconstructing from delay + trim) keeps groups correct — their visual+ // edges come from children, not their own delay.+ const dragItems = query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), c.ClipDragOrigin]);+ const snapCandidates = new Set<number>();+ for (const itemEid of dragItems) {+ const originStart = c.ClipDragOrigin.start[itemEid] ?? 0;+ const originEnd = c.ClipDragOrigin.end[itemEid] ?? 0;+ snapCandidates.add(originStart + offsetFrames);+ snapCandidates.add(originEnd + offsetFrames);+ }++ const snapPoints = getSnapFrames(world, timeline);++ let bestMatch: { snapFrame: number; frameDelta: number; pxDelta: number } | null = null;+ for (const point of snapPoints) {+ for (const candidate of snapCandidates) {+ const frameDelta = candidate - point.frame;+ const pxDelta = framesToPixels(world, frameDelta);+ if (Math.abs(pxDelta) >= timeline.snapDistance) continue;+ if (bestMatch && Math.abs(pxDelta) >= Math.abs(bestMatch.pxDelta)) continue;+ bestMatch = { snapFrame: point.frame, frameDelta, pxDelta };+ }+ }++ if (bestMatch) {+ timeline.snapX = framesToPixels(world, bestMatch.snapFrame);+ return bestMatch.frameDelta;+ }++ return 0;+}++function findAssetId(world: EngineWorld, entityEid: number) {+ const AssetId = world.components.AssetId;++ if (hasComponent(world, entityEid, AssetId) && AssetId[entityEid]) {+ return AssetId[entityEid];+ }++ for (const fill of world.components.Cache.fills[entityEid]) {+ if (hasComponent(world, fill, AssetId) && AssetId[fill]) {+ return AssetId[fill];+ };+ }++ return undefined;+}++function getSceneChildren(world: EngineWorld, eid: number): number[] {+ const tree: number[] = [];+ const c = world.components;++ const walk = (eid: number) => {+ for (const cid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(eid), Not(c.Deleted)])) {+ tree.push(cid);+ walk(cid);+ }+ }+ walk(eid);++ return tree;+}diff --git a/apps/web/src/components/engine/timeline/render/group.ts b/apps/web/src/components/engine/timeline/render/group.tsnew file mode 100644index 00000000..70a317ac--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/group.ts@@ -0,0 +1,49 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { framesToPixels } from "../utils";+import { CLIP_CORNER_RADIUS } from "../config";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";++export function renderGroup(world: EngineWorld, timeline: TimelineContext, eid: number) {+ const ctx = timeline.ctx!;+ const c = world.components;++ const children = c.Cache.children[eid];+ if (children.length === 0) return;++ const layerHeight = timeline.currentLayerHeight;+ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];+ const clipLeft = framesToPixels(world, start);+ const clipRight = framesToPixels(world, end);++ const childY = 20;+ const childHeight = layerHeight - childY;+ if (childHeight < 12) return;++ ctx.save();++ // Clip to the group clip bounds+ ctx.beginPath();+ ctx.roundRect(clipLeft, 0, clipRight - clipLeft, layerHeight, CLIP_CORNER_RADIUS);+ ctx.clip();++ for (const childEid of children) {+ const childStart = Math.max(start, c.Computed.start[childEid]);+ const childEnd = Math.min(end, c.Computed.end[childEid]);+ const childLeft = framesToPixels(world, childStart);+ const childWidth = framesToPixels(world, childEnd) - childLeft;+ if (childWidth < 2) continue;++ ctx.beginPath();+ ctx.roundRect(childLeft, childY, childWidth, childHeight, CLIP_CORNER_RADIUS);+ ctx.fillStyle = timeline.colors.clip.group.primary;+ ctx.fill();+ }++ ctx.restore();+}diff --git a/apps/web/src/components/engine/timeline/render/image.ts b/apps/web/src/components/engine/timeline/render/image.tsnew file mode 100644index 00000000..2b929ef4--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/image.ts@@ -0,0 +1,166 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { framesToPixels, getRelativeViewport } from "../utils";+import { CLIP_BREAKPOINTS, CLIP_LABEL_HEIGHT, MAX_CLIP_HEIGHT } from '../config';++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";+import type { ImageAsset, SequenceAsset } from '../../db';++type ThumbnailAsset = ImageAsset | SequenceAsset;++type ThumbnailCache = {+ canvas: OffscreenCanvas;+ hash: string;+ width: number;+ height: number;+}++type ThumbnailOptions = {+ width: number;+ height: number;+}++let thumbnailCache = new WeakMap<ThumbnailAsset, ThumbnailCache>();++// 3 discrete thumbnail widths to prevent constant repositioning during resize+const THUMBNAIL_WIDTHS = [80, 100, 120] as const;++function getSnappedThumbnailWidth(clipHeight: number): number {+ if (clipHeight >= 100) return THUMBNAIL_WIDTHS[2];+ if (clipHeight >= 70) return THUMBNAIL_WIDTHS[1];+ return THUMBNAIL_WIDTHS[0];+}++type ImageThumbnailOptions = {+ asset: ThumbnailAsset;+}++export function clearImageThumbnailCache() {+ thumbnailCache = new WeakMap<ThumbnailAsset, ThumbnailCache>();+}++export function renderImageThumbnails(world: EngineWorld, timeline: TimelineContext, eid: number, { asset }: ImageThumbnailOptions) {+ const ctx = timeline.ctx!;++ // SVGs aren't supported by createImageBitmap on every browser, so skip+ // the timeline thumbnail strip for them.+ if (asset.mimeType === 'image/svg+xml') return;++ const c = world.components;++ // Don't render thumbnails if clip is too small+ const layerHeight = timeline.currentLayerHeight;+ if (layerHeight <= CLIP_BREAKPOINTS.sm) return;++ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];++ const clipDelayPx = framesToPixels(world, start);+ const clipWidth = framesToPixels(world, end) - clipDelayPx;++ const [firstX, lastX] = getRelativeViewport(world, timeline);++ // Thumbnail fills full height, but width snaps to 3 discrete values for stability+ const thumbnailWidth = getSnappedThumbnailWidth(layerHeight);+ const thumbnailHeight = Math.round(thumbnailWidth * (asset.height / asset.width));++ const tileCount = Math.ceil(clipWidth / thumbnailWidth);+ const firstIndex = Math.max(0, Math.floor((firstX - clipDelayPx) / thumbnailWidth));+ const lastIndex = Math.min(tileCount - 1, Math.floor((lastX - clipDelayPx) / thumbnailWidth));++ // Update the thumbnail cache+ updateThumbnailCache(asset, {+ width: thumbnailWidth,+ height: thumbnailHeight,+ });++ const cached = thumbnailCache.get(asset);++ if (!cached) return;++ const thumbnailY = 18;+ const maskHeight = layerHeight - CLIP_LABEL_HEIGHT;++ // Calculate image crop to match object-fit: cover behavior+ const srcAspect = cached.width / cached.height;+ const destAspect = thumbnailWidth / maskHeight;++ let cropX = 0;+ let cropY = 0;+ let cropWidth = cached.width;+ let cropHeight = cached.height;++ if (srcAspect > destAspect) {+ // Source is wider - crop horizontally+ cropWidth = cached.height * destAspect;+ cropX = (cached.width - cropWidth) / 2;+ } else {+ // Source is taller - crop vertically+ cropHeight = cached.width / destAspect;+ cropY = (cached.height - cropHeight) / 2;+ }++ // Draw thumbnails+ {+ ctx.save();++ // translate to the delay of the clip+ ctx.translate(clipDelayPx, 0);++ // create a drawing area for the thumbnails+ ctx.beginPath();+ ctx.roundRect(2, 20, clipWidth - 4, maskHeight - 2, 2);+ ctx.clip();++ ctx.translate(-clipDelayPx, 0);++ for (let i = firstIndex; i <= lastIndex; i++) {+ const thumbnailX = clipDelayPx + i * thumbnailWidth;++ ctx.drawImage(+ cached.canvas,+ cropX, cropY, cropWidth, cropHeight,+ thumbnailX, thumbnailY, thumbnailWidth, maskHeight,+ );+ }++ ctx.closePath();++ ctx.restore();+ }+}++let decoding = false;+async function updateThumbnailCache(asset: ThumbnailAsset, options: ThumbnailOptions) {+ const hash = `$${options.width}x${options.height}`;++ try {+ if (hash != thumbnailCache.get(asset)?.hash && !decoding) {+ decoding = true;+ const blob = await asset.handle.getFile();+ const bitmap = await createImageBitmap(blob);++ const dpr = window.devicePixelRatio;+ const scale = Math.min(1, Math.max(+ (options.width * dpr) / bitmap.width,+ (MAX_CLIP_HEIGHT * dpr) / bitmap.height,+ ));+ const canvasWidth = Math.max(1, Math.round(bitmap.width * scale));+ const canvasHeight = Math.max(1, Math.round(bitmap.height * scale));+ const canvas = new OffscreenCanvas(canvasWidth, canvasHeight);+ const ctx = canvas.getContext('2d')!;++ ctx.drawImage(bitmap, 0, 0, canvasWidth, canvasHeight);+ bitmap.close();++ thumbnailCache.set(asset, { canvas, hash, width: canvasWidth, height: canvasHeight });+ }+ } catch (e) {+ console.error('Error updating thumbnail cache', e);+ } finally {+ decoding = false;+ }+}diff --git a/apps/web/src/components/engine/timeline/render/index.ts b/apps/web/src/components/engine/timeline/render/index.tsnew file mode 100644index 00000000..6a11dc5a--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/index.ts@@ -0,0 +1,15 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './background';+export * from './layers';+export * from './marquee';+export * from './playhead';+export * from './ruler';+export * from './workarea';+export * from './snap';+export * from './clip';+export * from './audio';+export * from './video';+export * from './image';diff --git a/apps/web/src/components/engine/timeline/render/keyframe.ts b/apps/web/src/components/engine/timeline/render/keyframe.tsnew file mode 100644index 00000000..fa20fbac--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/keyframe.ts@@ -0,0 +1,136 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { KEYFRAME_TRACK_HEIGHT } from "../config";+import { getRelativeViewport, pixelsToFrames, framesToPixels, getClipTransform } from "../utils";+import { hasComponent } from "bitecs";+import { addComponent, clearComponent, removeComponent, setComponent } from "../../api/events";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";++const KEYFRAME_COLOR = '#9E9E9E';+const KEYFRAME_SIZE = 8;+const KEYFRAME_HALF_SIZE = KEYFRAME_SIZE / 2;+const KEYFRAME_HITBOX_PADDING = 2;+const KEYFRAME_HITBOX_SIZE = KEYFRAME_SIZE + KEYFRAME_HITBOX_PADDING * 2;+const KEYFRAME_HITBOX_HALF_SIZE = KEYFRAME_HITBOX_SIZE / 2;++export function renderKeyframeTrack(+ world: EngineWorld,+ timeline: TimelineContext,+ trackEid: number,+ clipEid: number | null,+) {+ if (!clipEid) return;++ const ctx = timeline.ctx!;+ const pointer = timeline.pointer!;++ const c = world.components;+ const keyframeEids = c.Cache.keyframes[trackEid];+ if (!keyframeEids?.length) return;++ const transform = getClipTransform(world, timeline);+ if (!transform) return;++ const [vpl, vpr] = getRelativeViewport(world, timeline);+ const delay = c.Computed.delay[clipEid] ?? 0;+ const playbackRate = c.PlaybackRate[clipEid] ?? 1;+ const rowCenterY = KEYFRAME_TRACK_HEIGHT / 2;+ const firstFrame = c.Keyframe.time[keyframeEids[0]];+ const lastFrame = c.Keyframe.time[keyframeEids[keyframeEids.length - 1]];++ ctx.save();+ ctx.setTransform(transform);+ ctx.lineWidth = 1;++ if (hasComponent(world, trackEid, c.Hovering)) {+ ctx.fillStyle = timeline.colors.background.muted;+ ctx.globalAlpha = 0.6;+ ctx.fillRect(vpl, 0, vpr - vpl, KEYFRAME_TRACK_HEIGHT);+ ctx.globalAlpha = 1;+ }++ pointer.scope(String(trackEid));++ for (const kid of keyframeEids) {+ const kfTime = c.Keyframe.time[kid] ?? 0;+ const absoluteFrame = delay + kfTime / playbackRate;+ const x = framesToPixels(world, absoluteFrame);++ if (x + KEYFRAME_HITBOX_HALF_SIZE < vpl || x - KEYFRAME_HITBOX_HALF_SIZE > vpr) continue;++ const { intersectsMarquee, clicked, dragging } = pointer.region(+ x - KEYFRAME_HITBOX_HALF_SIZE,+ rowCenterY - KEYFRAME_HITBOX_HALF_SIZE,+ KEYFRAME_HITBOX_SIZE,+ KEYFRAME_HITBOX_SIZE,+ String(kid),+ );++ const isKeyframeSelected = hasComponent(world, kid, c.Selected);++ if (intersectsMarquee && !isKeyframeSelected) {+ addComponent(world, kid, c.Selected, false);+ }+ if (timeline.marquee && !intersectsMarquee && isKeyframeSelected) {+ removeComponent(world, kid, c.Selected, false);+ }++ if (clicked && pointer.shiftPressed) {+ addComponent(world, kid, c.Selected, false);+ }+ if (clicked && !pointer.shiftPressed) {+ clearComponent(world, c.Selected, false);+ addComponent(world, kid, c.Selected, false);+ }++ if (dragging && !hasComponent(world, kid, c.KeyframeDragOrigin)) {+ world.history.startTransaction('Move keyframes');+ setComponent(world, kid, c.KeyframeDragOrigin, { time: kfTime }, false);+ }++ if (hasComponent(world, kid, c.KeyframeDragOrigin) && pointer.position && pointer.position.state !== 'idle') {+ const target = c.KeyframeDragOrigin.time[kid] + pixelsToFrames(world, pointer.position.deltaX) * playbackRate;+ setComponent(world, kid, c.Keyframe, { time: target });+ }++ const keyframeColor = isKeyframeSelected ? timeline.colors.border.ring : KEYFRAME_COLOR;+ ctx.strokeStyle = keyframeColor;+ ctx.fillStyle = keyframeColor;+ ctx.beginPath();+ ctx.moveTo(x, rowCenterY - KEYFRAME_HALF_SIZE);+ ctx.lineTo(x + KEYFRAME_HALF_SIZE, rowCenterY);+ ctx.lineTo(x, rowCenterY + KEYFRAME_HALF_SIZE);+ ctx.lineTo(x - KEYFRAME_HALF_SIZE, rowCenterY);+ ctx.closePath();+ ctx.stroke();++ const isFirst = kfTime === firstFrame;+ const isLast = kfTime === lastFrame;++ if (!isFirst && !isLast) {+ ctx.fill();+ } else if (isFirst && isLast) {+ ctx.fill();+ } else if (isFirst) {+ ctx.beginPath();+ ctx.moveTo(x, rowCenterY - KEYFRAME_HALF_SIZE);+ ctx.lineTo(x + KEYFRAME_HALF_SIZE, rowCenterY);+ ctx.lineTo(x, rowCenterY + KEYFRAME_HALF_SIZE);+ ctx.closePath();+ ctx.fill();+ } else if (isLast) {+ ctx.beginPath();+ ctx.moveTo(x, rowCenterY - KEYFRAME_HALF_SIZE);+ ctx.lineTo(x - KEYFRAME_HALF_SIZE, rowCenterY);+ ctx.lineTo(x, rowCenterY + KEYFRAME_HALF_SIZE);+ ctx.closePath();+ ctx.fill();+ }+ }++ ctx.restore();+}diff --git a/apps/web/src/components/engine/timeline/render/layers.ts b/apps/web/src/components/engine/timeline/render/layers.tsnew file mode 100644index 00000000..ff5251bb--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/layers.ts@@ -0,0 +1,179 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { DEFAULT_CLIP_HEIGHT } from "../config";+import { getRelativeViewport, pixelsToFrames, getClipTransform, getNodeHeight, getSubtreeHeight } from "../utils";+import { clearAudioCache } from "./audio";+import { clearThumbnailCache } from "./video";+import { renderClip } from "./clip";+import { hasComponent, Not, Or, query } from "bitecs";+import { removeComponent, setComponent } from "../../api/events";+import { resolveSequentialOverlaps } from "../../api/overlap";+import { ChildOf } from "../../components";+import { renderKeyframeTrack } from "./keyframe";++import type { EngineWorld } from "../../api/world";+import type { TimelineNode } from "../../api/timeline-index";+import type { TimelineContext } from "../world";++const VIEWPORT_PADDING = 10; // 10 pixels++export function renderLayers(world: EngineWorld, timeline: TimelineContext) {+ const ctx = timeline.ctx!;++ const c = world.components;+ const scene = world.selection.scene;++ if (scene === null) return;++ ctx.save();++ const [left, right] = getRelativeViewport(world, timeline);+ const minFrame = pixelsToFrames(world, left - VIEWPORT_PADDING);+ const maxFrame = pixelsToFrames(world, right + VIEWPORT_PADDING);++ const dragging = isPointerDragging(timeline);++ const clipDragItems = [...query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), c.ClipDragOrigin])];+ if (!dragging) {+ if (clipDragItems.length > 0) {+ for (const cid of clipDragItems) {+ removeComponent(world, cid, c.ClipDragOrigin, false);+ }+ resolveSequentialOverlaps(world, clipDragItems);+ world.history.commitTransaction();+ }+ } else {+ for (const cid of clipDragItems) {+ if (hasComponent(world, cid, c.Selected)) {+ // case multidrag — snapshot origin once per newly-tagged sibling so+ // subsequent frames keep applying target = origin + delta absolutely.+ for (const sid of query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(c.ClipDragOrigin)])) {+ setComponent(world, sid, c.ClipDragOrigin, {+ delay: c.Delay[sid] ?? 0,+ start: c.Computed.start[sid] ?? 0,+ end: c.Computed.end[sid] ?? 0,+ }, false);+ }+ }+ }+ }++ // Keyframe drag management+ const keyframeDragItems = [...query(world, [c.Keyframe, c.KeyframeDragOrigin])];+ if (!dragging) {+ if (keyframeDragItems.length > 0) {+ // Drag has ended — close the 'Move keyframes' transaction opened in+ // renderKeyframeTrack.+ for (const kid of keyframeDragItems) {+ removeComponent(world, kid, c.KeyframeDragOrigin, false);+ }+ world.history.commitTransaction();+ }+ } else {+ for (const kid of keyframeDragItems) {+ if (hasComponent(world, kid, c.Selected)) {+ // case multidrag — snapshot originFrame once per newly-tagged keyframe+ // so subsequent frames keep applying target = origin + delta absolutely.+ for (const skid of query(world, [c.Selected, c.Keyframe, Not(c.KeyframeDragOrigin)])) {+ setComponent(world, skid, c.KeyframeDragOrigin, { time: c.Keyframe.time[skid] ?? 0 }, false);+ }+ }+ }+ }++ timeline.currentLayerTop = 0;++ const renderNodes = (nodes: TimelineNode[], clipEid: number | null) => {+ for (const node of nodes) {+ if (node.kind === 'keyframe-track') {+ renderKeyframeTrack(world, timeline, node.eid, clipEid);+ timeline.currentLayerTop += getNodeHeight(world, node);+ continue;+ }++ if (node.kind === 'sub-item') {+ timeline.currentLayerTop += getNodeHeight(world, node);+ renderNodes(node.children, clipEid);+ continue;+ }++ const start = c.Computed.start[node.eid];+ const end = c.Computed.end[node.eid];++ if (end < minFrame || start > maxFrame) {+ clearThumbnailCache(node.eid);+ clearAudioCache(node.eid);+ timeline.currentLayerTop += getSubtreeHeight(world, node);+ continue;+ }++ // Don't render expanded children of a sequential container.+ if (clipEid === null || !hasComponent(world, clipEid, c.Sequential)) {+ renderLayer(world, timeline, node.eid);+ }++ timeline.currentLayerTop += getNodeHeight(world, node);+ renderNodes(node.children, node.eid);+ }+ }++ renderNodes(world.timelineIndex().layers, null);++ ctx.restore();+}++/**+ * Render one timeline row. For a regular clip, this is just renderClip with+ * the row's transform applied. For a GROUP, the row becomes a horizontal+ * track: the group itself isn't drawn, and each of its direct children is+ * rendered as a clip inside the group's row (sharing its transform and+ * row height).+ */+function renderLayer(world: EngineWorld, timeline: TimelineContext, layerEid: number) {+ const c = world.components;+ const ctx = timeline.ctx!;++ const transform = getClipTransform(world, timeline);+ if (!transform) return;+ ctx.setTransform(transform);++ timeline.currentLayerHeight = c.ClipHeight[layerEid] ?? DEFAULT_CLIP_HEIGHT;+ ctx.globalAlpha = hasComponent(world, layerEid, c.Hidden) ? 0.5 : 1;++ if (hasComponent(world, layerEid, c.Hovering)) {+ const [vpl, vpr] = getRelativeViewport(world, timeline);+ ctx.globalAlpha = 0.5;+ ctx.fillStyle = timeline.colors.background.accent;+ ctx.fillRect(vpl, 0, vpr - vpl, timeline.currentLayerHeight);+ ctx.globalAlpha = 1;+ }++ if (!hasComponent(world, layerEid, c.Sequential)) {+ timeline.currentClip = layerEid;+ renderClip(world, timeline, layerEid);+ return;+ }++ const deferred: number[] = [];+ for (const cid of query(world, [Or(c.Geometry, c.Group, c.AdjustmentLayer), ChildOf(layerEid), Not(c.Deleted)])) {+ if (hasComponent(world, cid, c.ClipDragOrigin) || hasComponent(world, cid, c.TrimDragOrigin)) {+ deferred.push(cid);+ continue;+ }+ timeline.currentClip = cid;+ renderClip(world, timeline, cid);+ }++ for (const cid of deferred) {+ timeline.currentClip = cid;+ renderClip(world, timeline, cid);+ }+}+++function isPointerDragging(timeline: TimelineContext) {+ const pointer = timeline.pointer!;+ return !!pointer.position && pointer.position.state !== 'idle';+}diff --git a/apps/web/src/components/engine/timeline/render/marquee.ts b/apps/web/src/components/engine/timeline/render/marquee.tsnew file mode 100644index 00000000..0d7a14e9--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/marquee.ts@@ -0,0 +1,28 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";++export function renderMarquee(_world: EngineWorld, timeline: TimelineContext) {+ const ctx = timeline.ctx!;++ if (timeline.marquee) {+ const { x, y, width, height } = timeline.marquee;++ ctx.save();++ ctx.fillStyle = timeline.colors.border.ring;+ ctx.strokeStyle = timeline.colors.border.ring;+ ctx.lineWidth = 1;++ ctx.globalAlpha = 0.2;+ ctx.fillRect(x, y, width, height);++ ctx.globalAlpha = 1;+ ctx.strokeRect(x, y, width, height);++ ctx.restore();+ }+}diff --git a/apps/web/src/components/engine/timeline/render/playhead.ts b/apps/web/src/components/engine/timeline/render/playhead.tsnew file mode 100644index 00000000..2ccd7a45--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/playhead.ts@@ -0,0 +1,114 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { KNOB_PATH } from "../paths";+import { getCurrentScrollX, getCurrentResolution, getCurrentFrame, framesToPixels } from "../utils";+import { RULER_HEIGHT } from "../config";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";++// Critically-damped spring state for gradient width+const GRADIENT_PX_PER_VELOCITY = 25;+const GRADIENT_RESPONSE_TIME = 0.15;+const GRADIENT_MAX_WIDTH = 150;+let gradientWidthValue = 0;+let gradientWidthVelocity = 0;+let lastSampledFrame = 0;+let lastFrameTimestamp = 0;++export function renderPlayhead(world: EngineWorld, timeline: TimelineContext) {+ const ctx = timeline.ctx!;+ const canvas = timeline.canvas!;++ const currentTime = getCurrentFrame(world);+ const scrollX = getCurrentScrollX(world);+ const resolution = getCurrentResolution(world);++ ctx.save();++ const x = framesToPixels(world, currentTime);++ ctx.translate(-(scrollX * resolution), 0);+ ctx.translate(x, 0);++ // Draw knob+ {+ ctx.save();++ ctx.translate(-5, 2);++ ctx.fillStyle = timeline.colors.border.ring;+ ctx.strokeStyle = timeline.colors.border.darker;+ ctx.lineWidth = 2;+ ctx.stroke(KNOB_PATH);+ ctx.fill(KNOB_PATH);++ ctx.restore();+ }++ // Draw playhead line+ {+ ctx.translate(0, RULER_HEIGHT);++ // Critically-damped spring on signed gradient width, driven by measured playhead velocity.+ // Sign carries direction; magnitude reflects actual motion (handles play/pause, scrub, speed change).+ const now = performance.now();+ const realDt = lastFrameTimestamp ? (now - lastFrameTimestamp) / 1000 : 0;+ lastFrameTimestamp = now;++ const fps = world.frameRate;+ const deltaSeconds = (currentTime - lastSampledFrame) / fps;+ const measuredVelocity = realDt > 0 ? deltaSeconds / realDt : 0;+ lastSampledFrame = currentTime;++ let target = GRADIENT_PX_PER_VELOCITY * measuredVelocity;+ if (target > GRADIENT_MAX_WIDTH) {+ target = GRADIENT_MAX_WIDTH;+ } else if (target < -GRADIENT_MAX_WIDTH) {+ target = -GRADIENT_MAX_WIDTH;+ }++ // Closed-form critically-damped spring step — unconditionally stable for any dt.+ if (realDt > 0) {+ const omega = 2 / GRADIENT_RESPONSE_TIME;+ const dt = Math.min(realDt, 0.25);+ const decay = Math.exp(-omega * dt);+ const error = gradientWidthValue - target;+ const b = gradientWidthVelocity + omega * error;+ gradientWidthValue = target + (error + b * dt) * decay;+ gradientWidthVelocity = (gradientWidthVelocity - omega * b * dt) * decay;+ }++ const absWidth = Math.abs(gradientWidthValue);+ if (absWidth > 0.5) {+ const reverse = gradientWidthValue < 0;+ const startX = reverse ? absWidth : -absWidth;++ const gradient = ctx.createLinearGradient(startX, 0, 0, 0);+ gradient.addColorStop(0, timeline.colors.border.ring + '00');+ gradient.addColorStop(1, timeline.colors.border.ring);++ ctx.fillStyle = gradient;+ ctx.globalAlpha = 0.16;+ ctx.fillRect(reverse ? 0 : -absWidth, 0, absWidth, canvas.height);+ ctx.globalAlpha = 1;+ }++ ctx.beginPath();+ ctx.moveTo(0, 0);+ ctx.lineTo(0, canvas.height);+ ctx.closePath();++ ctx.strokeStyle = timeline.colors.border.darker;+ ctx.lineWidth = 3;+ ctx.stroke();++ ctx.strokeStyle = timeline.colors.border.ring;+ ctx.lineWidth = 1;+ ctx.stroke();+ }++ ctx.restore();+}diff --git a/apps/web/src/components/engine/timeline/render/ruler.ts b/apps/web/src/components/engine/timeline/render/ruler.tsnew file mode 100644index 00000000..ad26b7df--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/ruler.ts@@ -0,0 +1,170 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent } from "bitecs";+import { assert } from "@/utils";+import { RULER_INTERVALS } from "../constants";+import { RULER_HEIGHT, RULER_LABEL_Y, RULER_TICK_HEIGHT_MAJOR, RULER_TICK_HEIGHT_MINOR, TARGET_MAJOR_TICK_DISTANCE } from "../config";+import { pixelsToFrames, framesToPixels, getRelativeViewport, getCurrentScrollX, getCurrentResolution, setCurrentFrame } from "../utils";+import { setComponent } from "../../api/events";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";++// Tracks the open 'Set work area' gesture transaction across frames so the+// whole shift-drag collapses into a single undo step.+let workareaTxOpen = false;++export function renderRuler(world: EngineWorld, timeline: TimelineContext) {+ const ctx = timeline.ctx!;+ const canvas = timeline.canvas!;+ const pointer = timeline.pointer!;++ const scrollX = getCurrentScrollX(world);+ const resolution = getCurrentResolution(world);++ const c = world.components;++ const fps = world.frameRate;+ const scene = world.selection.scene;++ ctx.save();++ ctx.beginPath()+ ctx.rect(0, 0, canvas.width, RULER_HEIGHT);+ ctx.closePath();+ ctx.fillStyle = timeline.colors.background.default;+ ctx.fill();++ ctx.translate(-(scrollX * resolution), 0);++ if (scene && hasComponent(world, scene, c.Trim)) {+ const inPx = framesToPixels(world, c.Trim.start[scene]);+ const outPx = framesToPixels(world, c.Trim.end[scene]);++ ctx.fillStyle = timeline.colors.background.default;+ ctx.fillRect(inPx, 0, outPx - inPx, RULER_HEIGHT);+ }++ const layout = getRulerLayout(world);+ const [minX, maxX] = getRelativeViewport(world, timeline);++ const { dragging, clicked } = pointer+ .scope('ruler')+ .region(minX, 0, maxX - minX, RULER_HEIGHT);++ if (clicked || (dragging && !pointer.shiftPressed)) {+ assert(pointer.position, 'Mouse position must be set');++ const frame = pixelsToFrames(+ world,+ pointer.position.currentX + scrollX * resolution+ );++ if (scene !== null) {+ c.Playback.playing[scene] = 0;+ }+ setCurrentFrame(world, frame);+ }++ if (scene !== null && dragging && pointer.shiftPressed) {+ assert(pointer.position, 'Mouse position must be set');+ assert(pointer.position?.state != 'idle', 'Mouse position must be pressing');++ if (!workareaTxOpen) {+ world.history.startTransaction('Set work area');+ workareaTxOpen = true;+ }++ const newStart = pixelsToFrames(world, pointer.position.initialX + scrollX * resolution);+ const newStop = pixelsToFrames(world, pointer.position.currentX + scrollX * resolution);+ setComponent(world, scene, c.Trim, { start: newStart, end: newStop });++ if (pointer.position.currentX > pointer.position.initialX) {+ setCurrentFrame(world, newStop);+ } else {+ setCurrentFrame(world, newStart);+ }+ } else if (workareaTxOpen) {+ // Shift-drag ended — close the gesture transaction.+ world.history.commitTransaction();+ workareaTxOpen = false;+ }++ const firstFrame = pixelsToFrames(world, minX);+ const lastFrame = pixelsToFrames(world, maxX);+ const frameInterval = Math.max(1, Math.round(layout.numerator / layout.denominator));++ const majorOffset = RULER_HEIGHT - RULER_TICK_HEIGHT_MAJOR;+ const minorOffset = RULER_HEIGHT - RULER_TICK_HEIGHT_MINOR;++ ctx.font = '300 10px JetBrains Mono';+ ctx.fillStyle = timeline.colors.ruler.text;+ ctx.textBaseline = 'middle';+ ctx.textAlign = 'center';++ const start = Math.floor(firstFrame / frameInterval) * frameInterval;+ for (let frame = start; frame <= lastFrame; frame += frameInterval) {+ const x = framesToPixels(world, frame);+ let y = minorOffset;++ if (frame % layout.numerator === 0) {+ y = majorOffset;+ const label = formatTickLabel(frame, fps);+ ctx.fillText(label, x, RULER_LABEL_Y);+ }++ ctx.lineWidth = 1;+ ctx.strokeStyle = timeline.colors.ruler.tick;+ ctx.beginPath();+ ctx.moveTo(x, y);+ ctx.lineTo(x, RULER_HEIGHT);+ ctx.stroke();+ }++ ctx.restore();+}+++function formatTickLabel(frame: number, fps: number) {+ if (frame === 0) {+ return '0';+ }++ if (frame % fps != 0) {+ // this means its in frames+ return `${frame}f`;+ }++ const minutes = Math.floor(Math.round(frame / fps) / 60).toString().padStart(2, '0');+ const seconds = Math.floor(Math.round(frame / fps) % 60).toString().padStart(2, '0');++ return `${minutes}:${seconds}`;+}++function getRulerLayout(world: EngineWorld) {+ let interval: typeof RULER_INTERVALS[number] | null = null;++ for (const value of RULER_INTERVALS) {+ if (!interval) {+ interval = value;+ continue;+ }++ const currentDistance = framesToPixels(world, interval.numerator);+ const currentDelta = Math.abs(currentDistance - TARGET_MAJOR_TICK_DISTANCE);++ const distance = framesToPixels(world, value.numerator);+ const delta = Math.abs(distance - TARGET_MAJOR_TICK_DISTANCE);+++ if (delta < currentDelta) {+ interval = value;+ }+ }++ assert(interval, 'No ruler interval found');++ return interval;+}diff --git a/apps/web/src/components/engine/timeline/render/snap.ts b/apps/web/src/components/engine/timeline/render/snap.tsnew file mode 100644index 00000000..23e883d2--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/snap.ts@@ -0,0 +1,38 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { RULER_HEIGHT } from "../config";+import { getCurrentResolution, getCurrentScrollX } from "../utils";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";++export function renderSnapPoints(world: EngineWorld, timeline: TimelineContext) {+ if (timeline.snapX == null) return;++ const ctx = timeline.ctx!;+ const canvas = timeline.canvas!;++ const scrollX = getCurrentScrollX(world);+ const resolution = getCurrentResolution(world);++ ctx.save();++ ctx.translate(-(scrollX * resolution), 0);++ const pointX = timeline.snapX;+ const height = canvas.height / window.devicePixelRatio;++ ctx.beginPath();+ ctx.moveTo(pointX, RULER_HEIGHT);+ ctx.lineTo(pointX, height);++ ctx.strokeStyle = timeline.colors.border.scrubber;+ ctx.lineWidth = 1;+ ctx.stroke();++ ctx.restore();++ timeline.snapX = null;+}diff --git a/apps/web/src/components/engine/timeline/render/video.ts b/apps/web/src/components/engine/timeline/render/video.tsnew file mode 100644index 00000000..39f4d26b--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/video.ts@@ -0,0 +1,515 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { assert } from '@/utils';+import { CanvasSink } from 'mediabunny';+import { framesToPixels, getRelativeViewport, pixelsToFrames, getCurrentResolution } from '../utils';+import { getVideoTrack } from '../../decoders/video';+import { renderAudioWaveform } from './audio';+import { CLIP_BREAKPOINTS, CLIP_LABEL_HEIGHT } from '../config';+import { secondsToFrames } from '../../utils/time';++import type { TimelineContext } from '../world';+import type { VideoAsset } from '../../db';+import type { EngineWorld } from '../../api/world';++type ThumbnailOptions = {+ clipId: number;+ asset: VideoAsset;+ interval: number;+ width: number;+ height: number;+ firstFrame: number;+ lastFrame: number;+ fps: number;+};++type Thumbnail = {+ timestamp: number;+ canvas: OffscreenCanvas | HTMLCanvasElement;+ tombstoned?: boolean;+}++type ThumbnailCache = {+ thumbnails: Thumbnail[];+ options?: ThumbnailOptions;+ start: number;+ end: number;+ pendingUpdate: ThumbnailOptions | null;+ decoding: boolean;+ fps: number;+};++type ThumbnailStore = {+ thumbnails: Thumbnail[];+ decoding: boolean;+};++const thumbnailCache = new Map<number, ThumbnailCache>(); // By clip eid+const thumbnailStore = new Map<string, ThumbnailStore>(); // By asset id++export function cloneThumbnailCacheForSplit(sourceClipId: number, splitClipId: number) {+ const sourceCache = thumbnailCache.get(sourceClipId);+ if (!sourceCache) return;++ thumbnailCache.set(splitClipId, {+ ...sourceCache,+ // Keep per-clip mutable metadata separate; reuse canvas buffers by reference.+ thumbnails: sourceCache.thumbnails.map(thumbnail => ({ ...thumbnail })),+ pendingUpdate: null,+ decoding: false,+ });+}++export function clearThumbnailCache(id?: number) {+ if (id) {+ thumbnailCache.delete(id);+ return;+ }++ thumbnailCache.clear();+}++export function clearVideoBuffers() {+ thumbnailCache.clear();+ thumbnailStore.clear();+}++type VideoThumbnailOptions = {+ asset: VideoAsset;+}++const MIN_MASK_HEIGHT = 42;++function getClipLayout(timeline: TimelineContext) {+ let maskHeight = 0;++ const clipHeight = timeline.currentLayerHeight;++ if ((clipHeight - CLIP_LABEL_HEIGHT) > MIN_MASK_HEIGHT) {+ maskHeight = (clipHeight - CLIP_LABEL_HEIGHT) * 0.5;+ }++ let waveformOffsetY = clipHeight > CLIP_BREAKPOINTS.sm ? maskHeight + CLIP_LABEL_HEIGHT : 2;++ let thumbnailHeight = 46;+ let thumbnailWidth = 56;++ if (maskHeight > 44) {+ thumbnailHeight = 52;+ thumbnailWidth = 84;+ }++ let thumbnailOffsetY = CLIP_LABEL_HEIGHT + (maskHeight - thumbnailHeight);++ return {+ maskHeight,+ waveformOffsetY,+ thumbnailOffsetY,+ thumbnailHeight,+ thumbnailWidth,+ }+}++export function renderVideoThumbnails(world: EngineWorld, timeline: TimelineContext, eid: number, { asset }: VideoThumbnailOptions) {+ const ctx = timeline.ctx!;++ const c = world.components;+ const fps = world.frameRate;++ const layout = getClipLayout(timeline);++ const start = c.Computed.start[eid];+ const end = c.Computed.end[eid];++ const delay = c.Computed.delay[eid];+ const trimStart = c.Trim.start[eid] ?? 0;+ const trimEnd = c.Trim.end[eid] ?? c.Computed.duration[eid] ?? 0;+ const playbackRate = c.PlaybackRate[eid] ?? 1;++ renderAudioWaveform(world, timeline, eid, {+ color: timeline.colors.clip.video.primary,+ asset,+ padding: 0,+ offsetY: layout.waveformOffsetY,+ });++ // Don't render thumbnails if clip is too small+ if (layout.maskHeight == 0) {+ return;+ }++ const clipLeft = framesToPixels(world, start);+ const clipRight = framesToPixels(world, end);+ const clipWidth = clipRight - clipLeft;++ const [vpl, vpr] = getRelativeViewport(world, timeline);++ ctx.save();++ {+ // create a drawing area for the thumbnails+ ctx.beginPath();+ ctx.roundRect(clipLeft + 2, CLIP_LABEL_HEIGHT, clipWidth - 4, layout.maskHeight, 2);+ ctx.clip();+ }++ // Thumbnail interval in asset (source) frames, scaled by playbackRate so a+ // thumbnailWidth of timeline pixels maps to the correct chunk of source.+ // Kept as a float — at high zoom this can be sub-frame (e.g. 0.28); rounding+ // it to 0 with `pixelsToFrames` makes the decode range collapse to NaN and+ // every thumbnail goes missing.+ const interval = (layout.thumbnailWidth / getCurrentResolution(world)) * playbackRate;++ const adjustedVpl = vpl;+ const adjustedVpr = vpr;++ const delayPx = framesToPixels(world, delay);++ // Intersect the trim range with the viewport directly in frames — going+ // through pixels first lets `framesToPixels` floor and `pixelsToFrames`+ // round, which can shave a frame off `lastFrame` when `trimEnd`+ // sits at a thumbnail boundary, leaving the last thumbnail un-decoded.+ // Multiply by playbackRate to match the trim frames' source time base.+ const vplFrames = (pixelsToFrames(world, adjustedVpl) - delay) * playbackRate;+ const vprFrames = (pixelsToFrames(world, adjustedVpr) - delay) * playbackRate;++ const firstFrame = Math.max(trimStart, vplFrames);+ const lastFrame = Math.min(trimEnd, vprFrames);++ updateThumbnails({+ clipId: eid,+ asset,+ fps,+ firstFrame,+ lastFrame,+ width: layout.thumbnailWidth,+ height: layout.thumbnailHeight,+ interval,+ });++ ctx.translate(delayPx, 0);++ // draw thumnail when available — indices are in asset time so they+ // line up with the asset-time thumbnails after the delayPx translate.+ const firstIndex = Math.floor(trimStart / interval);+ const lastIndex = Math.floor(trimEnd / interval);++ const cachedStart = thumbnailCache.get(eid)?.start;+ const cachedEnd = thumbnailCache.get(eid)?.end;++ for (let i = firstIndex; i <= lastIndex; i++) {+ const timestamp = i * interval;++ const hasCached = cachedStart != undefined && cachedEnd != undefined;+ if (!hasCached || (timestamp < cachedStart - interval || timestamp > cachedEnd + interval)) {+ var thumbnails = thumbnailStore.get(asset.id)?.thumbnails ?? [];+ } else {+ var thumbnails = thumbnailCache.get(eid)?.thumbnails ?? [];+ }++ const thumbnailIndex = binarySearchClosest(thumbnails, timestamp, x => x.timestamp);+ const thumbnail = thumbnails[thumbnailIndex];++ if (!thumbnail) continue;++ const thumbnailX = i * layout.thumbnailWidth;+ const thumbnailY = layout.thumbnailOffsetY;++ ctx.drawImage(+ thumbnail.canvas,+ thumbnailX,+ thumbnailY,+ layout.thumbnailWidth,+ layout.thumbnailHeight,+ );+ }++ ctx.closePath();++ ctx.restore();+}+++function updateThumbnails(options: ThumbnailOptions) {+ const stored = thumbnailStore.get(options.asset.id);+ if (!stored || (!stored.decoding && stored.thumbnails.length === 0)) {+ initializeThumbnailCache(options);+ }++ if (stored && stored.thumbnails.length > 0) {+ updateThumbnailCache(options);+ }+}++function createBestThumbnailRange(options: ThumbnailOptions) {+ const { firstFrame, lastFrame, interval } = options;+ const { asset } = options;++ // decode one more thumbnail than the visible range+ const margin = 1;++ const minIndex = 0;+ const maxIndex = Math.floor(secondsToFrames(asset.duration) / interval);++ const startIndex = Math.max(Math.floor(firstFrame / interval) - margin, minIndex);+ const endIndex = Math.min(Math.floor(lastFrame / interval) + margin, maxIndex);++ return {+ start: startIndex * interval,+ end: endIndex * interval,+ startIndex,+ endIndex,+ }+}++async function updateThumbnailCache(options: ThumbnailOptions) {+ let cached = thumbnailCache.get(options.clipId);++ if (cached?.decoding == true) {+ cached.pendingUpdate = options;+ return;+ }++ if (cached == undefined) {+ cached = {+ thumbnails: [],+ start: -1,+ end: -1,+ pendingUpdate: null,+ decoding: true,+ fps: options.fps,+ }+ thumbnailCache.set(options.clipId, cached);+ }++ try {+ cached.decoding = true;++ const currentHash = createRangeHash(cached.options);+ const newHash = createRangeHash(options);++ if (currentHash == newHash) {+ return;+ }++ const bestRange = createBestThumbnailRange(options);+ const intersects = intersect(+ [bestRange.start, bestRange.end],+ [cached.start, cached.end],+ );+ const resized = createSizeHash(options) != createSizeHash(cached.options);+ const intervalChanged = options.interval != cached.options?.interval;++ // indices of the thumbnails to decode+ let decodeStartIndex: number = 0;+ let decodeEndIndex: number = 0;++ // if the interval has changed, we need to re-initialize the cache+ // or there is no intersection between the new range and the cache+ if (intervalChanged || !intersects || resized) {+ decodeStartIndex = bestRange.startIndex;+ decodeEndIndex = bestRange.endIndex;++ // Tombstone all the canvases in the cache+ cached.thumbnails.forEach(c => c.tombstoned = true);+ } else if (bestRange.start < cached.start) {+ decodeStartIndex = bestRange.startIndex;+ decodeEndIndex = Math.floor(cached.start / options.interval);+ } else if (bestRange.end > cached.end) {+ decodeStartIndex = Math.floor(cached.end / options.interval);+ decodeEndIndex = bestRange.endIndex;+ }++ // Tombstone the canvases that are outside the new range+ cached.thumbnails.forEach(c => {+ if (c.timestamp > bestRange.end || c.timestamp < bestRange.start) {+ c.tombstoned = true;+ }+ });++ const decodeCount = decodeEndIndex - decodeStartIndex;++ // This case handles when no new thumbnails need to be decoded because the+ // existing cache already covers the visible range.+ if (decodeCount <= 0) {+ cached.thumbnails = cached.thumbnails+ .filter(c => !c.tombstoned)+ .sort((a, b) => a.timestamp - b.timestamp);+ cached.start = bestRange.start;+ cached.end = bestRange.end;+ cached.options = options;+ return;+ }++ const track = await getVideoTrack(options.asset);+ assert(track, 'Track must be set');++ const sink = new CanvasSink(track, {+ width: options.width * window.devicePixelRatio,+ height: options.height * window.devicePixelRatio,+ fit: 'cover',+ });++ for (let i = 0; i < decodeCount; i++) {+ try {+ const frameTimestamp = (decodeStartIndex + i) * options.interval;+ const canvas = await sink.getCanvas(frameTimestamp / options.fps);+ if (!canvas) continue;++ // Decoder may snap to the nearest keyframe — store the actual returned+ // timestamp so the binary search at draw time finds the right thumbnail.+ const decodedFrame = secondsToFrames(canvas.timestamp);++ cached.thumbnails = cached.thumbnails+ .filter(c => !c.tombstoned || c.timestamp > decodedFrame)+ .sort((a, b) => a.timestamp - b.timestamp);++ cached.thumbnails.push({+ timestamp: decodedFrame,+ canvas: canvas.canvas,+ tombstoned: false,+ });+ } catch {+ // Must not be handled+ }+ }++ cached.thumbnails = cached.thumbnails+ .filter(c => !c.tombstoned)+ .sort((a, b) => a.timestamp - b.timestamp);+ cached.start = bestRange.start;+ cached.end = bestRange.end;+ cached.options = options;+ } catch (e) {+ console.error('Error updating thumbnail cache', e);+ } finally {+ cached.decoding = false;+ }++ if (cached.pendingUpdate) {+ const options = cached.pendingUpdate;+ if (!options) return;+ cached.pendingUpdate = null;+ void updateThumbnailCache(options);+ }+}++async function initializeThumbnailCache(options: ThumbnailOptions) {+ const { asset } = options;++ let stored = thumbnailStore.get(options.asset.id);++ if (stored?.decoding) {+ return;+ }++ if (!stored) {+ stored = { thumbnails: [], decoding: true };+ thumbnailStore.set(options.asset.id, stored);+ }++ try {+ stored.decoding = true;++ if (asset.duration < 60 * 10) {+ var count = 7+ } else if (asset.duration < 20) {+ var count = 5+ } else {+ var count = 10;+ }++ const track = await getVideoTrack(asset);+ assert(track, 'Track must be set');+ const firstTimestamp = await track.getFirstTimestamp();+ const lastTimestamp = await track.computeDuration();++ const dpr = window.devicePixelRatio;+ const sink = new CanvasSink(track, {+ width: options.width * dpr,+ height: options.height * dpr,+ fit: 'cover',+ });++ for (let i = 0; i < count; i++) {+ try {+ const timestamp = firstTimestamp + i * (lastTimestamp - firstTimestamp) / count;+ const canvas = await sink.getCanvas(timestamp);+ if (!canvas) continue;++ stored.thumbnails.push({+ timestamp: secondsToFrames(canvas.timestamp),+ canvas: canvas.canvas,+ });+ } catch {+ // Must not be handled+ }+ }+ } catch (e) {+ console.error('Error initializing thumbnail cache', e);+ } finally {+ stored.decoding = false;+ }+}++function binarySearchClosest<T>(+ arr: T[],+ key: number,+ valueGetter: (x: T) => number+) {+ if (arr.length === 0) return -1;++ let low = 0;+ let high = arr.length - 1;+ let closestIndex = -1;+ let closestDistance = Infinity;++ while (low <= high) {+ const mid = (low + (high - low + 1) / 2) | 0;+ const midVal = valueGetter(arr[mid]!);+ const distance = Math.abs(midVal - key);++ if (distance < closestDistance) {+ closestDistance = distance;+ closestIndex = mid;+ }++ if (midVal < key) {+ low = mid + 1;+ } else if (midVal > key) {+ high = mid - 1;+ } else {+ // Exact match+ return mid;+ }+ }++ return closestIndex;+}++function createRangeHash(options?: ThumbnailOptions) {+ if (!options) return '';++ return `$${options.width}x${options.height}@${window.devicePixelRatio}-${options.interval}-${options.firstFrame}-${options.lastFrame}`;+}++function createSizeHash(options?: ThumbnailOptions) {+ if (!options) return '';++ return `$${options.width}x${options.height}@${window.devicePixelRatio}`;+}++/**+ * Check if two ranges intersect (non-inclusive)+ * @param range1 [start, end]+ * @param range2 [start, end]+ * @returns true if the ranges intersect, false otherwise+ */+export function intersect(range1: [number, number], range2: [number, number]): boolean {+ const [x1, x2] = range1;+ const [y1, y2] = range2;++ return x1 < y2 && y1 < x2;+}diff --git a/apps/web/src/components/engine/timeline/render/workarea.ts b/apps/web/src/components/engine/timeline/render/workarea.tsnew file mode 100644index 00000000..c424c12e--- /dev/null+++ b/apps/web/src/components/engine/timeline/render/workarea.ts@@ -0,0 +1,147 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent } from "bitecs";+import { assert } from "@/utils";+import { IN_POINT_PATH, OUT_POINT_PATH } from "../paths";+import { framesToPixels, pixelsToFrames, getCurrentScrollX, getCurrentResolution } from "../utils";+import { RULER_HEIGHT } from "../config";+import { removeComponent, setComponent } from "../../api/events";++import type { EngineWorld } from "../../api/world";+import type { TimelineContext } from "../world";+++let workareaDragStart: [number, number] = [0, 0];+// Tracks the open work-area drag transaction across frames so the whole drag+// (move / in-handle / out-handle) collapses into a single undo step.+let workareaTxOpen = false;++export function renderWorkarea(world: EngineWorld, timeline: TimelineContext) {+ const ctx = timeline.ctx!;+ const pointer = timeline.pointer!;++ // Set true by any of the three handle regions while it is being dragged.+ let anyDragging = false;+ const beginGesture = () => {+ anyDragging = true;+ if (!workareaTxOpen) {+ world.history.startTransaction('Adjust work area');+ workareaTxOpen = true;+ }+ };++ const scrollX = getCurrentScrollX(world);+ const resolution = getCurrentResolution(world);+ const sid = world.selection.scene;+ if (sid === null) return;+ const c = world.components;+ if (!hasComponent(world, sid, c.Trim)) return;++ const start = c.Trim.start[sid] ?? 0;+ const stopFrame = c.Trim.end[sid] ?? 0;++ ctx.save();++ ctx.translate(-(scrollX * resolution), 0);++ const inPx = framesToPixels(world, start);+ const outPx = framesToPixels(world, stopFrame);++ const height = 10;+ const y = RULER_HEIGHT - height;++ {+ const { dragging, pressed, doubleClicked } = pointer+ .scope('workarea')+ .region(inPx, y, outPx - inPx, height);++ if (dragging) {+ assert(pointer.position, 'Mouse position must be set');+ assert(pointer.position?.state != 'idle', 'Mouse position must be pressing');++ beginGesture();++ const deltaFrames = pixelsToFrames(world, pointer.position.deltaX);++ setComponent(world, sid, c.Trim, {+ start: workareaDragStart[0] + deltaFrames,+ end: workareaDragStart[1] + deltaFrames,+ });+ }++ if (pressed) {+ workareaDragStart = [start, stopFrame];+ }++ if (doubleClicked) {+ removeComponent(world, sid, c.Trim);+ }++ ctx.globalCompositeOperation = 'difference';+ ctx.fillStyle = 'rgba(100, 100, 100, 1)';+ ctx.fillRect(inPx, y, outPx - inPx, height);+ ctx.globalCompositeOperation = 'source-over';+ }+ {+ ctx.lineWidth = 1;+ ctx.fillStyle = timeline.colors.border.ring;+ ctx.strokeStyle = timeline.colors.border.darker;++ ctx.translate(inPx - 5, y);+ ctx.stroke(IN_POINT_PATH);+ ctx.fill(IN_POINT_PATH);++ const { dragging, pressed } = pointer.region(0, 0, 5, height);++ if (dragging) {+ assert(pointer.position, 'Mouse position must be set');+ assert(pointer.position?.state != 'idle', 'Mouse position must be pressing');++ beginGesture();++ const deltaFrames = pixelsToFrames(world, pointer.position.deltaX);++ setComponent(world, sid, c.Trim, {+ start: workareaDragStart[0] + deltaFrames,+ });+ }++ if (pressed) {+ workareaDragStart = [start, stopFrame];+ }+ }+ {+ ctx.translate(outPx - inPx + 5, 0);+ ctx.stroke(OUT_POINT_PATH);+ ctx.fill(OUT_POINT_PATH);++ const { dragging, pressed } = pointer.region(0, 0, 5, height);++ if (dragging) {+ assert(pointer.position, 'Mouse position must be set');+ assert(pointer.position?.state != 'idle', 'Mouse position must be pressing');++ beginGesture();++ const deltaFrames = pixelsToFrames(world, pointer.position.deltaX);++ setComponent(world, sid, c.Trim, {+ end: workareaDragStart[1] + deltaFrames,+ });+ }++ if (pressed) {+ workareaDragStart = [start, stopFrame];+ }+ }++ // No handle dragged this frame — close any open work-area transaction.+ if (workareaTxOpen && !anyDragging) {+ world.history.commitTransaction();+ workareaTxOpen = false;+ }++ ctx.restore();+}diff --git a/apps/web/src/components/engine/timeline/timeline.ts b/apps/web/src/components/engine/timeline/timeline.tsnew file mode 100644index 00000000..c9f370d0--- /dev/null+++ b/apps/web/src/components/engine/timeline/timeline.ts@@ -0,0 +1,288 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createPointer } from "./pointer";+import { assert, clamp } from "@/utils";+import {+ renderBackground,+ renderMarquee,+ renderPlayhead,+ renderRuler,+ renderWorkarea,+ renderSnapPoints,+ renderLayers,+} from "./render";+import { pixelsToFrames, updateTimelineTransform } from "./utils";+import { DEFAULT_TIMELINE_RESOLUTION, TIMELINE_RESOLUTION_RANGE, TIMELINE_PADDING_LEFT } from "./config";+import { useEngine } from "@/context/engine";+import { useCursor } from "@/hooks/use-cursor";+import { createTimelineContext } from "./world";++export type { Marquee, TimelineContext } from "./world";++export function createTimeline() {+ const engine = useEngine();+ const world = engine.world;+ const c = world.components;++ const timeline = createTimelineContext();++ const pointer = createPointer({+ get marquee() { return timeline.marquee },+ get canvas() { return timeline.canvas },+ get ctx() { return timeline.ctx },+ });++ const cursor = useCursor();++ let layersEl: HTMLElement | null = null;+ let layersContainerEl: HTMLElement | null = null;+ let animationId: number | null = null;+ let layerScrollX = 0;++ const applyResize = () => {+ const canvas = timeline.canvas;+ const parent = canvas?.parentElement;+ if (!parent || !canvas) return;++ timeline.layout = parent.getBoundingClientRect();+ applyScroll();++ const dpr = window.devicePixelRatio;+ const nextWidth = Math.floor(timeline.layout.width * dpr);+ const nextHeight = Math.floor(timeline.layout.height * dpr);++ canvas.style.width = `${timeline.layout.width}px`;+ canvas.style.height = `${timeline.layout.height}px`;++ if (canvas.width === nextWidth && canvas.height === nextHeight) return;++ canvas.width = nextWidth;+ canvas.height = nextHeight;+ }++ const resize = () => {+ applyResize();++ updateTimelineTransform(world);++ if (engine.running && timeline.canvas && timeline.ctx) {+ drawFrame();+ }+ }++ const observer = new ResizeObserver(resize);++ const layerObserver = new ResizeObserver(() => {+ applyScroll();+ updateTimelineTransform(world);+ });++ const drawFrame = () => {+ const canvas = timeline.canvas;+ const ctx = timeline.ctx;+ if (!canvas || !ctx || !timeline.pointer) return;++ try {+ ctx.setTransform(1, 0, 0, 1, 0, 0);+ ctx.clearRect(0, 0, canvas.width, canvas.height);+ ctx.fillStyle = timeline.colors.background.default;+ ctx.fillRect(0, 0, canvas.width, canvas.height);+ ctx.scale(window.devicePixelRatio, window.devicePixelRatio);++ timeline.cursor = 'default';++ renderBackground(world, timeline);+ renderLayers(world, timeline);+ renderMarquee(world, timeline);+ renderRuler(world, timeline);+ renderWorkarea(world, timeline);+ renderPlayhead(world, timeline);+ renderSnapPoints(world, timeline);++ cursor.set(canvas, timeline.cursor);+ } catch (e) {+ console.error(e);+ } finally {+ timeline.pointer.reset();+ }+ }++ const render = () => {+ if (engine.running) {+ drawFrame();+ }++ animationId = requestAnimationFrame(render);+ }++ const applyScroll = () => {+ if (!layersEl || !layersContainerEl) return;++ const sid = world.selection.scene;+ if (sid === null) return;++ const container = layersContainerEl;+ const layers = layersEl;++ const scrollY = c.Timeline.scrollY[sid] ?? 0;+ const newScrollY = Math.max(0, Math.min(scrollY, container.scrollHeight - container.clientHeight));++ c.Timeline.scrollY[sid] = newScrollY;+ layers.style.transform = `translateY(${-newScrollY}px)`;++ const windows = layers.querySelectorAll<HTMLElement>('[data-layer-label]');+ let maxScrollX = 0;+ windows.forEach((el) => { maxScrollX = Math.max(maxScrollX, el.scrollWidth - el.clientWidth); });+ layerScrollX = Math.max(0, Math.min(layerScrollX, maxScrollX));+ layers.style.setProperty('--layer-x', `${layerScrollX}px`);+ }++ const handleWheelEvent = (event: WheelEvent) => {+ event.preventDefault();++ const sid = world.selection.scene;+ if (sid === null) return;+ const scrollX = c.Timeline.scrollX[sid] ?? 0;+ const resolution = c.Timeline.resolution[sid] || DEFAULT_TIMELINE_RESOLUTION;+ const minScrollX = -TIMELINE_PADDING_LEFT / resolution;++ // Prioritize: Z (zoom) > X (horizontal) > Y (vertical)+ // Only one axis can be scrolled at a time+ if (event.ctrlKey || event.metaKey) {+ // Zoom (Z axis)+ const rect = timeline.canvas?.getBoundingClientRect();+ const timelineX = event.clientX - (rect?.left ?? 0);++ let newResolution = resolution;+ newResolution *= 1.01 ** -event.deltaY;+ newResolution = clamp(newResolution, 1 / TIMELINE_RESOLUTION_RANGE[1], 1 / TIMELINE_RESOLUTION_RANGE[0]);++ let newScrollX = scrollX + timelineX / resolution - timelineX / newResolution;+ newScrollX = Math.max(minScrollX, newScrollX);+ c.Timeline.scrollX[sid] = newScrollX;+ c.Timeline.resolution[sid] = newResolution;+ } else if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {+ // Horizontal scroll (X axis) - when horizontal movement is dominant+ const frameDelta = event.deltaX / resolution;++ let newScrollX = scrollX + frameDelta;+ newScrollX = Math.max(minScrollX, newScrollX);+ c.Timeline.scrollX[sid] = newScrollX;+ } else {+ // Vertical scroll (Y axis) - default when no other conditions match+ c.Timeline.scrollY[sid] = (c.Timeline.scrollY[sid] ?? 0) + event.deltaY;++ applyScroll();+ }++ updateTimelineTransform(world);+ }+++ const unmount = () => {+ layerObserver.disconnect();++ if (animationId) {+ cancelAnimationFrame(animationId);+ animationId = null;+ }++ document.body.removeEventListener('pointermove', pointer.move);+ document.body.removeEventListener('pointerup', pointer.up);+ }++ const scroll = (event: WheelEvent) => {+ event.preventDefault();++ const sid = world.selection.scene;+ if (sid === null) return;++ if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {+ layerScrollX += event.deltaX;+ } else {+ c.Timeline.scrollY[sid] = (c.Timeline.scrollY[sid] ?? 0) + event.deltaY;+ }++ applyScroll();+ updateTimelineTransform(world);+ }++ const clientToFrame = (clientX: number) => {+ const sid = world.selection.scene;+ if (sid === null) return 0;+ const scrollX = c.Timeline.scrollX[sid] ?? 0;+ const resolution = c.Timeline.resolution[sid] || DEFAULT_TIMELINE_RESOLUTION;+ const rect = timeline.canvas?.getBoundingClientRect();+ const worldX = clientX - (rect?.left ?? 0) + scrollX * resolution;+ return pixelsToFrames(world, worldX);+ }++ const clientToTime = (clientX: number) => (clientToFrame(clientX) / world.frameRate);++ const attachCanvas = () => {+ const canvas = document.getElementById('timeline-canvas') as HTMLCanvasElement;+ assert(canvas, 'Timeline canvas must be defined');++ const parent = canvas.parentElement;+ assert(parent, 'Timeline canvas must have a parent element');++ timeline.canvas = canvas;+ timeline.layout = parent.getBoundingClientRect();+ timeline.ctx = canvas.getContext('2d')!;++ observer.observe(parent);++ canvas.addEventListener('wheel', handleWheelEvent);+ canvas.addEventListener('pointerdown', pointer.down, { passive: true });++ applyResize();+ }++ const detachCanvas = () => {+ observer.disconnect();++ const canvas = timeline.canvas;+ canvas?.removeEventListener('wheel', handleWheelEvent);+ canvas?.removeEventListener('pointerdown', pointer.down);++ // Drop the stale references so the render loop no-ops until the next+ // attachCanvas() rebinds a live element.+ timeline.canvas = null;+ timeline.ctx = null;+ }++ // The layer refs, pointer and render loop live as long as <Layers>, which+ // stays mounted across timeline visibility toggles.+ const mount = () => {+ const layers = document.querySelector<HTMLElement>('[data-timeline-layers]');+ assert(layers, 'Timeline layers element must be defined');++ const layersContainer = document.querySelector<HTMLElement>('[data-timeline-layers-container]');+ assert(layersContainer, 'Timeline layers container element must be defined');++ timeline.pointer = pointer;+ layersEl = layers;+ layersContainerEl = layersContainer;++ layerObserver.observe(layers);++ document.body.addEventListener('pointermove', pointer.move, { passive: true });+ document.body.addEventListener('pointerup', pointer.up, { passive: true });++ if (!animationId) {+ animationId = requestAnimationFrame(render);+ }+ }++ return {+ mount,+ unmount,+ attachCanvas,+ detachCanvas,+ scroll,+ clientToTime,+ clientToFrame,+ };+}diff --git a/apps/web/src/components/engine/timeline/utils.ts b/apps/web/src/components/engine/timeline/utils.tsnew file mode 100644index 00000000..3bd10bc1--- /dev/null+++ b/apps/web/src/components/engine/timeline/utils.ts@@ -0,0 +1,182 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent } from "bitecs";+import { DEFAULT_CLIP_HEIGHT, DEFAULT_TIMELINE_RESOLUTION, KEYFRAME_TRACK_HEIGHT, RULER_HEIGHT, TIMELINE_PADDING_LEFT } from "./config";+import { addComponent } from "../api/events";++import type { TimelineContext } from "./world";+import type { EngineWorld } from "../api/world";+import type { TimelineNode } from "../api/timeline-index";++export function getCurrentFrame(world: EngineWorld) {+ const sid = world.selection.scene;+ if (sid === null) return 0;+ return world.components.Computed.localTime[sid];+}++export function setCurrentFrame(world: EngineWorld, frame: number) {+ const sid = world.selection.scene;+ const fps = world.frameRate;+ if (sid === null) return;+ const clamped = Math.max(0, frame);+ world.components.Computed.localTime[sid] = clamped;+ world.components.Computed.localTimeInSeconds[sid] = clamped / fps;+}++export function getCurrentResolution(world: EngineWorld) {+ const sid = world.selection.scene;+ if (sid === null) return DEFAULT_TIMELINE_RESOLUTION;+ return world.components.Timeline.resolution[sid] ?? DEFAULT_TIMELINE_RESOLUTION;+}+++export function getCurrentScrollX(world: EngineWorld) {+ const sid = world.selection.scene;+ if (sid === null) return -TIMELINE_PADDING_LEFT / getCurrentResolution(world);+ return world.components.Timeline.scrollX[sid] ?? 0;+}++export function getCurrentScrollY(world: EngineWorld) {+ const sid = world.selection.scene;+ if (sid === null) return 0;+ return world.components.Timeline.scrollY[sid] ?? 0;+}++export function getRelativeViewport(world: EngineWorld, timeline: TimelineContext): [number, number] {+ const scrollX = getCurrentScrollX(world);+ const resolution = getCurrentResolution(world);+ const left = scrollX * resolution;++ const right = left + timeline.layout.width;+ return [left, right];+}+++export function framesToPixels(world: EngineWorld, frames: number = 0) {+ const resolution = getCurrentResolution(world);+ return Math.floor(frames * resolution);+}++export function pixelsToFrames(world: EngineWorld, pixels: number) {+ const resolution = getCurrentResolution(world);+ return Math.round(pixels / resolution);+}++export function clientToWorldX(world: EngineWorld, timeline: TimelineContext, clientX: number) {+ const scrollX = getCurrentScrollX(world);+ const resolution = getCurrentResolution(world);+ return clientX - (timeline.layout?.left ?? 0) + scrollX * resolution;+}++export function clientToWorldY(world: EngineWorld, timeline: TimelineContext, clientY: number) {+ const scrollY = getCurrentScrollY(world);+ return clientY - (timeline.layout?.top ?? 0) + scrollY;+}++export function getClipTransform(world: EngineWorld, timeline: TimelineContext): DOMMatrix | undefined {+ const c = world.components;+ const sid = world.selection.scene ?? -1;+ const transform = c.Timeline.transform[sid];+ return transform?.translate(0, timeline.currentLayerTop);+}++export function getNodeHeight(world: EngineWorld, node: TimelineNode) {+ if (node.kind === 'geometry') {+ return world.components.ClipHeight[node.eid] ?? DEFAULT_CLIP_HEIGHT;+ }+ return KEYFRAME_TRACK_HEIGHT;+}++/**+ * Total height of a row plus all of its (expanded) descendant rows.+ */+export function getSubtreeHeight(world: EngineWorld, node: TimelineNode): number {+ let height = getNodeHeight(world, node);+ for (const child of node.children) {+ height += getSubtreeHeight(world, child);+ }+ return height;+}++export function updateTimelineTransform(world: EngineWorld) {+ const sid = world.selection.scene;+ if (sid === null) return;++ const c = world.components;++ if (!hasComponent(world, sid, c.Timeline)) {+ addComponent(world, sid, c.Timeline, false);+ c.Timeline.resolution[sid] = DEFAULT_TIMELINE_RESOLUTION;+ c.Timeline.scrollX[sid] = -TIMELINE_PADDING_LEFT / DEFAULT_TIMELINE_RESOLUTION;+ c.Timeline.scrollY[sid] = 0;+ c.Timeline.transform[sid] = new DOMMatrix();+ }++ const resolution = c.Timeline.resolution[sid];+ const scrollX = c.Timeline.scrollX[sid];+ const scrollY = c.Timeline.scrollY[sid];+ const dpr = window.devicePixelRatio;++ const transform = new DOMMatrix();+ transform.scaleSelf(dpr, dpr);+ transform.translateSelf(-(scrollX * resolution), -scrollY);+ transform.translateSelf(0, RULER_HEIGHT);+ c.Timeline.transform[sid] = transform;+}++const TEXT_WIDTH_CACHE: Map<string, number> = new Map();++// Widths measured before web fonts finish loading reflect the fallback font and+// will under-report once the real font swaps in, causing labels to overflow.+document?.fonts.addEventListener('loadingdone', () => TEXT_WIDTH_CACHE.clear());++export function binarySearchTextLength(+ ctx: CanvasRenderingContext2D,+ text: string,+ maxWidth: number,+ cacheId: string = 'default'+): string | null {+ const getTextWidth = (text: string) => {+ const cacheKey = `${cacheId}-${text}`;++ if (TEXT_WIDTH_CACHE.has(cacheKey)) {+ return TEXT_WIDTH_CACHE.get(cacheKey)!;+ }++ const width = ctx.measureText(text).width;+ TEXT_WIDTH_CACHE.set(cacheKey, width);+ return width;+ }++ if (getTextWidth(text) > maxWidth) {+ const availableWidth = maxWidth - getTextWidth('...');++ if (availableWidth > 0) {+ // Binary search for optimal text length+ let start = 0;+ let end = text.length;+ let bestLength = 0;++ while (start <= end) {+ const mid = Math.floor((start + end) / 2);+ const testText = text.slice(0, mid);+ const testWidth = getTextWidth(testText);++ if (testWidth <= availableWidth) {+ bestLength = mid;+ start = mid + 1;+ } else {+ end = mid - 1;+ }+ }++ return bestLength > 0 ? text.slice(0, bestLength) + '...' : null;+ } else {+ return null;+ }+ }++ return text;+}diff --git a/apps/web/src/components/engine/timeline/world.ts b/apps/web/src/components/engine/timeline/world.tsnew file mode 100644index 00000000..331b368c--- /dev/null+++ b/apps/web/src/components/engine/timeline/world.ts@@ -0,0 +1,36 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { COLORS } from "./constants";+import { DEFAULT_CLIP_HEIGHT } from "./config";++import type { CursorType } from "@/hooks/use-cursor";+import type { Pointer } from "./pointer";++export type Marquee = {+ x: number;+ y: number;+ width: number;+ height: number;+}++export type TimelineContext = ReturnType<typeof createTimelineContext>;++export function createTimelineContext() {+ return {+ colors: COLORS,+ snapping: true,+ snapDistance: 10,+ snapX: null as number | null,+ currentClip: null as number | null,+ currentLayerTop: 0,+ currentLayerHeight: DEFAULT_CLIP_HEIGHT,+ cursor: 'default' as CursorType,+ canvas: null as HTMLCanvasElement | null,+ ctx: null as CanvasRenderingContext2D | null,+ layout: new DOMRect(),+ pointer: null as Pointer | null,+ marquee: undefined as Marquee | undefined,+ };+}diff --git a/apps/web/src/components/engine/types/common.ts b/apps/web/src/components/engine/types/common.tsnew file mode 100644index 00000000..dc7c290d--- /dev/null+++ b/apps/web/src/components/engine/types/common.ts@@ -0,0 +1,21 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export type RuntimeMode = 'realtime' | 'offline-video' | 'offline-audio';++export type HudMode = 'idle' | 'moving' | 'marquee';++/**+ * 2D affine matrix representing the camera transform in CSS pixel space+ * (before DPR scaling). The render system multiplies this by devicePixelRatio+ * to derive the canvas transform.+ */+export type Camera2D = {+ a: number;+ b: number;+ c: number;+ d: number;+ e: number;+ f: number;+};diff --git a/apps/web/src/components/engine/types/db.ts b/apps/web/src/components/engine/types/db.tsnew file mode 100644index 00000000..f847d5a4--- /dev/null+++ b/apps/web/src/components/engine/types/db.ts@@ -0,0 +1,139 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export interface DBEntity {+ id: string;+ eid: number;+ Geometry?: number;+ Paint?: number;+ Group?: {};+ Scene?: {};+ Audio?: {};+ AdjustmentLayer?: {};+ Effect?: {+ type?: number;+ value?: number;+ };+ Caption?: {+ type?: number;+ colors?: number[];+ };+ IsMask?: {};+ Shadow?: {};+ Stroke?: {};+ Name?: string;+ Key?: string;+ ChildOf?: number;+ ItemIndex?: number;+ ClipHeight?: number;+ Expanded?: {};+ Position?: {+ x?: number;+ y?: number;+ };+ Offset?: {+ x?: number;+ y?: number;+ };+ Rotation?: number;+ Scale?: {+ x?: number;+ y?: number;+ };+ UniformScale?: number;+ Anchor?: {+ x?: number;+ y?: number;+ };+ Skew?: {+ x?: number;+ y?: number;+ };+ Size?: {+ width?: number;+ height?: number;+ };+ Flip?: {+ x?: -1 | 1;+ y?: -1 | 1;+ };+ Appearance?: {+ opacity?: number;+ blendMode?: number;+ };+ CornerRadius?: number;+ MixedCornerRadius?: {+ topLeft: number;+ topRight: number;+ bottomRight: number;+ bottomLeft: number;+ };+ Color?: number;+ Blur?: number;+ AssetId?: string;+ ScaleMode?: number;+ Volume?: number;+ Muted?: {};+ ColorStop?: {+ offset?: number;+ color?: number;+ opacity?: number;+ };+ StrokeStyle?: {+ width?: number;+ join?: number;+ cap?: number;+ miterLimit?: number;+ };+ Hidden?: boolean;+ ClipsContent?: boolean;+ Sequential?: {};+ Playback?: {+ loop?: number;+ };+ Delay?: number;+ PlaybackRate?: number;+ Trim?: {+ start?: number;+ end?: number;+ };+ Constraint?: {+ horizontal?: number;+ vertical?: number;+ };+ KeepAspectRatio?: {+ width?: number;+ height?: number;+ };+ Transition?: {+ type?: number;+ duration?: number;+ };+ KeyframeTrack?: {+ property?: string;+ };+ Keyframe?: {+ time?: number;+ value?: number;+ easing?: string;+ };+ Animation?: {+ duration?: number;+ delay?: number;+ type?: number;+ phase?: number;+ };+ Chars?: string;+ TextStyle?: {+ leading?: number;+ fontSize?: number;+ fontFamily?: string;+ fontWeight?: string;+ fontStyle?: number;+ textAlign?: number;+ textBaseline?: number;+ textCase?: number;+ letterSpacing?: number;+ };+};diff --git a/apps/web/src/components/engine/types/index.ts b/apps/web/src/components/engine/types/index.tsnew file mode 100644index 00000000..19fe103b--- /dev/null+++ b/apps/web/src/components/engine/types/index.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './input';+export * from './db';+export * from './common';diff --git a/apps/web/src/components/engine/types/input.ts b/apps/web/src/components/engine/types/input.tsnew file mode 100644index 00000000..018a6046--- /dev/null+++ b/apps/web/src/components/engine/types/input.ts@@ -0,0 +1,57 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { Point, Quad } from "../math";+import type { EngineWorld } from "../api/world";++export type CustomPointerEventType =+ | "pointermove"+ | "pointerdown"+ | "pointerup"+ | "pointerenter"+ | "pointerleave"+ | "dragstart"+ | "drag"+ | "dragend"+ | "click"+ | "dblclick";+++export type CustomPointerEvent = {+ type: CustomPointerEventType;+ clientX: number;+ clientY: number;+ button: number; // 0: left, 1: middle, 2: right+}++export type PointerState = {+ state: 'pressed' | 'lifted';+ button: number;+ clientX: number;+ clientY: number;+ dragStartX: number;+ dragStartY: number;+}++export type SnapLine = { from: Point; to: Point; }++export type DispatchedPointerEvent = CustomPointerEvent & {+ target: HudTarget | EntityTarget;+}++export type HudTarget = {+ kind: 'hud';+ id: string;+ quad: Quad;+}++export type EntityTarget = {+ kind: 'entity';+ id: number;+};++export type HitRegion = {+ target: HudTarget | EntityTarget;+ callback: (world: EngineWorld, event: DispatchedPointerEvent) => void;+}diff --git a/apps/web/src/components/engine/utils/audio-sync.ts b/apps/web/src/components/engine/utils/audio-sync.tsnew file mode 100644index 00000000..0b93c156--- /dev/null+++ b/apps/web/src/components/engine/utils/audio-sync.ts@@ -0,0 +1,219 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ALL_FORMATS, AudioSampleSink, BlobSource, Input } from 'mediabunny';+import { assert } from '@/utils';++import type { Asset } from '../db';++// Envelope sample rate. 500 Hz → 2 ms resolution (well under one video frame),+// and keeps the FFT small enough for multi-minute clips. Parabolic+// interpolation around the peak refines below one bin.+const SYNC_ENVELOPE_RATE_HZ = 500;+// Require at least this much overlapping audio for a lag to be considered.+const SYNC_MIN_OVERLAP_SEC = 1;+// Below this correlation the match is treated as no match, and we fail loudly+// rather than return a confident-looking but meaningless offset.+const SYNC_NO_MATCH_FLOOR = 0.1;++export type AudioSyncResult = {+ // Place the audio at: audioStart = videoStart + offsetSeconds.+ // Positive = the recording started after the camera rolled.+ offsetSeconds: number;+ confidence: number; // 0..1 (clamped Pearson correlation at the best lag)+};++// RMS energy envelope of an asset's primary audio track, at `rate` bins/sec.+async function extractAudioEnvelope(asset: Asset, rate: number): Promise<Float32Array> {+ const blob = await asset.handle.getFile();+ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });+ try {+ const track = await input.getPrimaryAudioTrack();+ assert(track, `Asset ${asset.id} has no audio track to sync.`);+ const sink = new AudioSampleSink(track);+ const bins: number[] = [];+ for await (const sample of sink.samples()) {+ try {+ const size = sample.allocationSize({ format: 'f32', planeIndex: 0 });+ const floats = new Float32Array(size / Float32Array.BYTES_PER_ELEMENT);+ sample.copyTo(floats, { format: 'f32', planeIndex: 0 });++ const numChannels = sample.numberOfChannels;+ const numFrames = floats.length / numChannels;+ const targetBins = Math.max(1, Math.round(sample.duration * rate));+ const ratio = numFrames / targetBins;++ for (let i = 0; i < targetBins; i++) {+ const start = Math.floor(i * ratio);+ const end = Math.max(start + 1, Math.floor((i + 1) * ratio));+ let sumSq = 0;+ let count = 0;+ for (let f = start; f < end && f < numFrames; f++) {+ for (let ch = 0; ch < numChannels; ch++) {+ const v = floats[f * numChannels + ch];+ sumSq += v * v;+ count++;+ }+ }+ bins.push(count ? Math.sqrt(sumSq / count) : 0);+ }+ } finally {+ sample.close();+ }+ }+ return Float32Array.from(bins);+ } finally {+ input.dispose();+ }+}++function nextPow2(n: number): number {+ let p = 1;+ while (p < n) p <<= 1;+ return p;+}++// In-place iterative radix-2 Cooley-Tukey FFT (inverse when `invert`).+function fft(re: Float64Array, im: Float64Array, invert: boolean): void {+ const n = re.length;+ for (let i = 1, j = 0; i < n; i++) {+ let bit = n >> 1;+ for (; j & bit; bit >>= 1) j ^= bit;+ j ^= bit;+ if (i < j) {+ const tr = re[i]; re[i] = re[j]; re[j] = tr;+ const ti = im[i]; im[i] = im[j]; im[j] = ti;+ }+ }+ for (let len = 2; len <= n; len <<= 1) {+ const ang = ((invert ? 2 : -2) * Math.PI) / len;+ const wr = Math.cos(ang);+ const wi = Math.sin(ang);+ for (let i = 0; i < n; i += len) {+ let cwr = 1;+ let cwi = 0;+ for (let k = 0; k < len >> 1; k++) {+ const a = i + k;+ const b = a + (len >> 1);+ const vr = re[b] * cwr - im[b] * cwi;+ const vi = re[b] * cwi + im[b] * cwr;+ re[b] = re[a] - vr; im[b] = im[a] - vi;+ re[a] += vr; im[a] += vi;+ const ncwr = cwr * wr - cwi * wi;+ cwi = cwr * wi + cwi * wr;+ cwr = ncwr;+ }+ }+ }+ if (invert) {+ for (let i = 0; i < n; i++) { re[i] /= n; im[i] /= n; }+ }+}++// Linear cross-correlation via FFT. Returns cc where cc[m] = Σ a[i]·b[i+m]+// (negative lags wrap to the high indices; safe because of zero padding).+function crossCorrelate(a: Float32Array, b: Float32Array): Float64Array {+ const n = nextPow2(a.length + b.length);+ const ar = new Float64Array(n);+ const ai = new Float64Array(n);+ const br = new Float64Array(n);+ const bi = new Float64Array(n);+ ar.set(a);+ br.set(b);+ fft(ar, ai, false);+ fft(br, bi, false);+ // conj(FA) .* FB+ for (let k = 0; k < n; k++) {+ const cr = ar[k] * br[k] + ai[k] * bi[k];+ const ci = ar[k] * bi[k] - ai[k] * br[k];+ ar[k] = cr;+ ai[k] = ci;+ }+ fft(ar, ai, true);+ return ar; // real part holds the correlation+}++function prefixSums(x: Float32Array): { sum: Float64Array; sumSq: Float64Array } {+ const sum = new Float64Array(x.length + 1);+ const sumSq = new Float64Array(x.length + 1);+ for (let i = 0; i < x.length; i++) {+ sum[i + 1] = sum[i] + x[i];+ sumSq[i + 1] = sumSq[i] + x[i] * x[i];+ }+ return { sum, sumSq };+}++export async function computeAudioSyncOffset(+ audioAsset: Asset,+ videoAsset: Asset,+): Promise<AudioSyncResult> {+ const rate = SYNC_ENVELOPE_RATE_HZ;+ const A = await extractAudioEnvelope(audioAsset, rate);+ const B = await extractAudioEnvelope(videoAsset, rate);+ const La = A.length;+ const Lb = B.length;+ assert(La > 0 && Lb > 0, "No reliable alignment found: an asset has no decodable audio.");++ const cc = crossCorrelate(A, B);+ const n = cc.length;+ const pa = prefixSums(A);+ const pb = prefixSums(B);+ const minOverlap = Math.max(1, Math.floor(rate * SYNC_MIN_OVERLAP_SEC));++ // Pearson correlation of the overlapping region at lag L (audio index i ↔+ // video index i+L), computed in O(1) from prefix sums + the FFT dot product.+ const nccAt = (L: number): number => {+ const iLo = Math.max(0, -L);+ const iHi = Math.min(La, Lb - L);+ const cnt = iHi - iLo;+ if (cnt < minOverlap) return -Infinity;+ const jLo = iLo + L;+ const jHi = iHi + L;+ const sumA = pa.sum[iHi] - pa.sum[iLo];+ const sumSqA = pa.sumSq[iHi] - pa.sumSq[iLo];+ const sumB = pb.sum[jHi] - pb.sum[jLo];+ const sumSqB = pb.sumSq[jHi] - pb.sumSq[jLo];+ const meanA = sumA / cnt;+ const meanB = sumB / cnt;+ const varA = sumSqA - cnt * meanA * meanA;+ const varB = sumSqB - cnt * meanB * meanB;+ if (varA <= 1e-9 || varB <= 1e-9) return -Infinity;+ const dot = cc[((L % n) + n) % n];+ const cov = dot - cnt * meanA * meanB;+ return cov / Math.sqrt(varA * varB);+ };++ let bestL = 0;+ let bestNcc = -Infinity;+ for (let L = -(La - 1); L <= Lb - 1; L++) {+ const v = nccAt(L);+ if (v > bestNcc) {+ bestNcc = v;+ bestL = L;+ }+ }+ assert(+ bestNcc > -Infinity,+ "No reliable alignment found: the clips don't overlap enough to align.",+ );+ assert(+ bestNcc >= SYNC_NO_MATCH_FLOOR,+ "No reliable alignment found: the audio tracks share too little common sound.",+ );++ // Parabolic interpolation around the peak for sub-bin precision.+ let delta = 0;+ const ym = nccAt(bestL - 1);+ const yp = nccAt(bestL + 1);+ if (Number.isFinite(ym) && Number.isFinite(yp)) {+ const denom = ym - 2 * bestNcc + yp;+ if (denom !== 0) delta = (0.5 * (ym - yp)) / denom;+ if (!Number.isFinite(delta) || Math.abs(delta) > 1) delta = 0;+ }++ return {+ offsetSeconds: (bestL + delta) / rate,+ confidence: Math.max(0, Math.min(1, bestNcc)),+ };+}diff --git a/apps/web/src/components/engine/utils/captions.ts b/apps/web/src/components/engine/utils/captions.tsnew file mode 100644index 00000000..c3234243--- /dev/null+++ b/apps/web/src/components/engine/utils/captions.ts@@ -0,0 +1,164 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, entityExists } from "bitecs";+import { trpc } from "@/lib/trpc";+import { PaintType, getEntityTree, getParentEntity, secondsToFrames, uploadBlob, loadAsset, saveAsset } from "@/components/engine";+import { createEncoder } from "@/components/engine/encode/encoder";+import { resolveTranscript } from "@/components/engine/decoders/caption/utils";+import { assert } from "@/utils";++import type { Transcript } from "@diffusionstudio/api-contract";+import type { Engine, EngineWorld } from "@/components/engine";+import type { Asset } from "@/components/engine/db";++const CAPTIONS_NAME_REGEX = /^Captions (\d+)$/;++function nextCaptionsName(all: ReadonlyArray<Asset>): string {+ let max = 0;+ for (const asset of all) {+ const match = asset.name.match(CAPTIONS_NAME_REGEX);+ if (match) max = Math.max(max, Number(match[1]));+ }+ return `Captions ${max + 1}`;+}++export function hasAudioSources(world: EngineWorld, sceneEid: number): boolean {+ const c = world.components;+ for (const eid of getEntityTree(world, sceneEid)) {+ if (hasComponent(world, eid, c.Muted)) continue;+ if (hasComponent(world, eid, c.Audio) && c.AssetId[eid]) return true;+ if (hasComponent(world, eid, c.Paint) && c.Paint[eid] === PaintType.VIDEO && c.AssetId[eid]) {+ return true;+ }+ }+ return false;+}++/**+ * Fingerprint of everything that shapes a scene's audible mix — source+ * content, placement, source offset, rate, and gain. Volume fades and audio+ * transitions are not captured; they don't change the spoken words.+ */+export function sceneAudioFingerprint(world: EngineWorld, sceneEid: number): string {+ const c = world.components;+ const entries: string[] = [];++ for (const eid of getEntityTree(world, sceneEid)) {+ if (hasComponent(world, eid, c.Muted)) continue;++ // Video paints carry the asset; their timing lives on the geometry parent.+ let timingEid = eid;+ if (hasComponent(world, eid, c.Paint) && c.Paint[eid] === PaintType.VIDEO) {+ timingEid = getParentEntity(world, eid) ?? eid;+ } else if (!hasComponent(world, eid, c.Audio)) {+ continue;+ }++ const asset = c.AssetId[eid] ? world.assets.get(c.AssetId[eid]) : undefined;+ if (!asset) continue;++ entries.push([+ asset.hash,+ c.Computed.start[timingEid] ?? 0,+ c.Computed.end[timingEid] ?? 0,+ c.Computed.delay[timingEid] ?? 0,+ c.PlaybackRate[timingEid] ?? 1,+ c.Volume[timingEid] ?? 0,+ ].join(":"));+ }++ return `v1:${fnv1a(entries.sort().join("|"))}`;+}++function fnv1a(input: string): string {+ let hash = 0x811c9dc5;+ for (let i = 0; i < input.length; i++) {+ hash ^= input.charCodeAt(i);+ hash = Math.imul(hash, 0x01000193);+ }+ return (hash >>> 0).toString(16);+}++function transcriptTrim(transcript: Transcript): { start: number; end: number } {+ const firstWord = transcript.at(0)?.words.at(0);+ const lastWord = transcript.at(-1)?.words.at(-1);+ return { start: secondsToFrames(firstWord?.start), end: secondsToFrames(lastWord?.end) };+}++export type TranscribeStatus = "encoding" | "uploading" | "transcribing";++/**+ * Encodes a scene's audio, transcribes it, and stores the transcript as an asset.+ */+export async function transcribeScene(+ engine: Engine,+ sceneEid: number,+ onStatus?: (status: TranscribeStatus) => void,+) {+ const world = engine.world;+ const c = world.components;++ if (!entityExists(world, sceneEid) || !hasComponent(world, sceneEid, c.Scene)) {+ throw new Error(`Node ${sceneEid} is not a scene.`);+ }+ if (!hasAudioSources(world, sceneEid)) {+ throw new Error("No audio found. Add an audio or video clip to the scene to generate captions.");+ }++ const sourceHash = sceneAudioFingerprint(world, sceneEid);+ const cached = Array.from(world.assets.values())+ .find(a => a.type === "TRANSCRIPT" && a.sourceHash === sourceHash);++ if (cached) {+ const transcript = await resolveTranscript(cached);+ if (transcript.length) {+ return {+ asset: { id: cached.id, name: cached.name, type: cached.type },+ trim: transcriptTrim(transcript),+ };+ }+ }++ onStatus?.("encoding");+ engine.stop();+ let result;+ try {+ const encoder = await createEncoder(world, {+ scene: sceneEid,+ video: { enabled: false },+ audio: { enabled: true, codec: "opus", sampleRate: 24000 },+ format: "ogg",+ });+ result = await encoder.render();+ } finally {+ engine.start();+ }++ if (result.type !== "success" || !result.data) {+ throw new Error("Failed to encode audio");+ }++ onStatus?.("uploading");+ const assetid = crypto.randomUUID();+ const audioFile = new File([result.data], `${assetid}.ogg`, { type: "audio/ogg" });+ const fileRef = await uploadBlob(audioFile, assetid);+ assert(fileRef, "Failed to upload audio");++ onStatus?.("transcribing");+ const { results: transcript } = await trpc.transcribe.mutate({ audio: fileRef });++ assert(transcript.length, "No speech detected. The audio does not appear to contain recognizable speech.");+ assert(transcript.every((s) => s.words.length > 0), "No speech detected. The audio does not appear to contain recognizable speech.");++ const name = nextCaptionsName(Array.from(world.assets.values()));+ const blob = new Blob([JSON.stringify(transcript)], { type: "application/json" });+ const file = new File([blob], `${name}.json`, { type: "application/json" });+ const asset = await loadAsset(world, file, { name });++ assert(asset.type === "TRANSCRIPT", "Expected a transcript asset");+ await saveAsset(world, { ...asset, sourceHash });++ return { asset: { id: asset.id, name: asset.name, type: asset.type }, trim: transcriptTrim(transcript) };+}diff --git a/apps/web/src/components/engine/utils/coordinates.ts b/apps/web/src/components/engine/utils/coordinates.tsnew file mode 100644index 00000000..8e031c81--- /dev/null+++ b/apps/web/src/components/engine/utils/coordinates.ts@@ -0,0 +1,107 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Not, query } from 'bitecs';+import { ChildOf } from '../components';+import { isScene } from '../api/query';+import type { EngineWorld } from '../api/world';+import { aabbFromTransformedRect, invert2D, transformPoint, type Mat2D, type Point } from '../math';++/** Convert a screen-space point (CSS pixels) to world coordinates via the camera matrix. */+export function screenToWorld(world: EngineWorld, sx: number, sy: number): Point {+ const { a, b, c, d, e, f } = world.camera;++ const det = a * d - b * c;+ const inv = 1 / det;++ return {+ x: inv * (d * (sx - e) - c * (sy - f)),+ y: inv * (-b * (sx - e) + a * (sy - f)),+ };+}++/** Convert a world-space point (as produced by `screenToWorld`) to an entity's+ * local coordinates via its LocalTransform. Assumes the entity is top-level+ * (parent-less) so its LocalTransform is in world space. */+export function worldToLocal(world: EngineWorld, eid: number, wx: number, wy: number): Point {+ const LocalTransform = world.components.LocalTransform;++ const a = LocalTransform.a[eid] ?? 1;+ const b = LocalTransform.b[eid] ?? 0;+ const c = LocalTransform.c[eid] ?? 0;+ const d = LocalTransform.d[eid] ?? 1;+ const e = LocalTransform.e[eid] ?? 0;+ const f = LocalTransform.f[eid] ?? 0;++ const det = a * d - b * c;+ const inv = 1 / det;++ return {+ x: inv * (d * (wx - e) - c * (wy - f)),+ y: inv * (-b * (wx - e) + a * (wy - f)),+ };+}++/** Find the first scene entity whose world-space bounds contain the given+ * world-space point (as produced by `screenToWorld`). */+export function findSceneAt(world: EngineWorld, wx: number, wy: number): number | null {+ const c = world.components;++ for (const cid of query(world, [Not(ChildOf('*')), c.Geometry, Not(c.Deleted), Not(c.Culled), Not(c.Hidden)])) {+ if (!isScene(world, cid)) continue;++ const mat: Mat2D = {+ a: c.LocalTransform.a[cid] ?? 1,+ b: c.LocalTransform.b[cid] ?? 0,+ c: c.LocalTransform.c[cid] ?? 0,+ d: c.LocalTransform.d[cid] ?? 1,+ e: c.LocalTransform.e[cid] ?? 0,+ f: c.LocalTransform.f[cid] ?? 0,+ };+ const bounds = aabbFromTransformedRect(+ mat,+ c.Computed.width[cid],+ c.Computed.height[cid],+ );++ if (wx >= bounds.minX && wx <= bounds.maxX && wy >= bounds.minY && wy <= bounds.maxY) {+ return cid;+ }+ }++ return null;+}++export function isPointerInEntity(world: EngineWorld, eid: number, point: Point) {+ const c = world.components;+ const minX = c.WorldBounds.minX[eid];+ const minY = c.WorldBounds.minY[eid];+ const maxX = c.WorldBounds.maxX[eid];+ const maxY = c.WorldBounds.maxY[eid];++ const x = point.x;+ const y = point.y;++ if (x < minX || x > maxX || y < minY || y > maxY) return false;++ // Precise test: map pointer into entity-local space so rotation/skew+ // don't produce false positives along the AABB's outer slack.+ const world2D: Mat2D = {+ a: c.WorldTransform.a[eid], b: c.WorldTransform.b[eid],+ c: c.WorldTransform.c[eid], d: c.WorldTransform.d[eid],+ e: c.WorldTransform.e[eid], f: c.WorldTransform.f[eid],+ };+ const inv = invert2D(world2D);+ const local = transformPoint(inv, x, y);+ const w = c.Computed.width[eid];+ const h = c.Computed.height[eid];+ const ox = c.Computed.originX[eid];+ const oy = c.Computed.originY[eid];++ if (local.x >= ox && local.x <= ox + w && local.y >= oy && local.y <= oy + h) {+ return true;+ }++ return false;+}diff --git a/apps/web/src/components/engine/utils/cursor.ts b/apps/web/src/components/engine/utils/cursor.tsnew file mode 100644index 00000000..08d2ded3--- /dev/null+++ b/apps/web/src/components/engine/utils/cursor.ts@@ -0,0 +1,70 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { MAIN_CANVAS_ID } from "@/components/canvas"+import { assert } from "@/utils"++const CORNER_SVG = `<path d='m19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill='%23fff'/><path d='m18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill='%23000'/>`+const EDGE_SVG = `<path d='m9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill='%23fff'/><path d='m17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill='%23000'/>`+const ROTATE_SVG = `<path d="M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill="black"/><path fill-rule="evenodd" clip-rule="evenodd" d="M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill="white"/>`++const TRIM_SINGLE_PATH_W = `M11.8787 2C12.7072 2 13.3787 2.67157 13.3787 3.5V18.5C13.3787 19.3284 12.7072 20 11.8787 20C11.0504 19.9999 10.3787 19.3284 10.3787 18.5V12.1572H8.12093L9.09554 13.1318C9.68134 13.7176 9.68128 14.6672 9.09554 15.2529V15.2539C8.51037 15.838 7.56062 15.8391 6.97445 15.2529L3.60921 11.8877C3.58251 11.8609 3.56103 11.8314 3.5389 11.8057C3.50719 11.7796 3.47273 11.7512 3.43929 11.7178C2.85306 11.1315 2.8544 10.1817 3.43832 9.59668L6.97445 6.06055C7.56013 5.47494 8.50978 5.47528 9.09554 6.06055L9.19906 6.1748C9.67956 6.76396 9.64471 7.63345 9.09554 8.18262L8.12093 9.15723H10.3787V3.5C10.3787 2.67161 11.0504 2.00006 11.8787 2ZM11.8787 3C11.6027 3.00006 11.3787 3.22389 11.3787 3.5V9.54004C11.6495 9.78246 11.8319 10.1212 11.8709 10.5029L11.8787 10.6572C11.8785 11.1008 11.685 11.4987 11.3787 11.7734V18.5L11.3885 18.6006C11.435 18.8285 11.6371 19 11.8787 19C12.1549 19 12.3787 18.7761 12.3787 18.5V3.5C12.3787 3.22386 12.1549 3 11.8787 3ZM8.38851 6.76758C8.19324 6.57276 7.87661 6.57252 7.68148 6.76758L4.14632 10.3037C3.95145 10.499 3.9512 10.8156 4.14632 11.0107C4.17397 11.0384 4.20533 11.0603 4.23714 11.0801C4.25992 11.1149 4.28563 11.15 4.31722 11.1816L7.68148 14.5459C7.87664 14.7411 8.19322 14.7408 8.38851 14.5459C8.58376 14.3506 8.58377 14.0341 8.38851 13.8389L5.70687 11.1572H10.3787V10.1572H5.70687L8.38851 7.47559C8.58377 7.28032 8.58377 6.96284 8.38851 6.76758Z`+const TRIM_SINGLE_PATH_B = `M11.8785 3C12.1546 3 12.3785 3.22386 12.3785 3.5V18.5C12.3785 18.7761 12.1546 19 11.8785 19C11.6025 18.9998 11.3785 18.776 11.3785 18.5V11.1562H5.70757L8.38921 13.8389C8.5843 14.0341 8.58423 14.3507 8.38921 14.5459C8.19396 14.7409 7.87737 14.741 7.68217 14.5459L4.31694 11.1807C4.28531 11.149 4.25867 11.115 4.23589 11.0801C4.20439 11.0604 4.17441 11.0372 4.14702 11.0098C3.95186 10.8145 3.95179 10.498 4.14702 10.3027L7.68217 6.76758C7.87742 6.57256 8.194 6.57249 8.38921 6.76758C8.5844 6.96277 8.58426 7.27933 8.38921 7.47461L5.70659 10.1572H11.3785V3.5C11.3785 3.22399 11.6025 3.00021 11.8785 3Z`+const TRIM_DOUBLE_PATH_W = `M14.8787 2C15.7072 2 16.3787 2.67157 16.3787 3.5V18.5C16.3787 19.3284 15.7072 20 14.8787 20C14.0504 19.9999 13.3787 19.3284 13.3787 18.5C13.3787 19.3284 12.7072 20 11.8787 20C11.0504 19.9999 10.3787 19.3284 10.3787 18.5V12.1572H8.12093L9.09554 13.1318C9.68134 13.7176 9.68128 14.6672 9.09554 15.2529V15.2539C8.51037 15.838 7.56062 15.8391 6.97445 15.2529L3.60921 11.8877C3.58251 11.8609 3.56103 11.8314 3.5389 11.8057C3.50719 11.7796 3.47273 11.7512 3.43929 11.7178C2.85306 11.1315 2.8544 10.1817 3.43832 9.59668L6.97445 6.06055C7.56013 5.47494 8.50978 5.47528 9.09554 6.06055L9.19906 6.1748C9.67956 6.76396 9.64471 7.63345 9.09554 8.18262L8.12093 9.15723H10.3787V3.5C10.3787 2.67161 11.0504 2.00006 11.8787 2C12.7072 2 13.3787 2.67157 13.3787 3.5C13.3787 2.67161 14.0504 2.00007 14.8787 2ZM11.8787 3C11.6027 3.00006 11.3787 3.22389 11.3787 3.5V9.54004C11.6495 9.78246 11.8319 10.1212 11.8709 10.5029L11.8787 10.6572C11.8785 11.1008 11.685 11.4987 11.3787 11.7734V18.5L11.3885 18.6006C11.435 18.8285 11.6371 19 11.8787 19C12.1549 19 12.3787 18.7761 12.3787 18.5V3.5C12.3787 3.22386 12.1549 3 11.8787 3ZM14.8787 3C14.6027 3.00007 14.3787 3.2239 14.3787 3.5V18.5L14.3885 18.6006C14.435 18.8285 14.6371 18.9999 14.8787 19C15.1549 19 15.3787 18.7761 15.3787 18.5V3.5C15.3787 3.22386 15.1549 3 14.8787 3ZM8.38851 6.76758C8.19324 6.57276 7.87661 6.57252 7.68148 6.76758L4.14632 10.3037C3.95145 10.499 3.9512 10.8156 4.14632 11.0107C4.17397 11.0384 4.20533 11.0603 4.23714 11.0801C4.25992 11.1149 4.28563 11.15 4.31722 11.1816L7.68148 14.5459C7.87664 14.7411 8.19322 14.7408 8.38851 14.5459C8.58376 14.3506 8.58377 14.0341 8.38851 13.8389L5.70687 11.1572H10.3787V10.1572H5.70687L8.38851 7.47559C8.58377 7.28032 8.58377 6.96284 8.38851 6.76758Z`+const TRIM_DOUBLE_PATH_B = `M11.8785 3C12.1546 3 12.3785 3.22386 12.3785 3.5V18.5C12.3785 18.7761 12.1546 19 11.8785 19C11.6025 18.9998 11.3785 18.776 11.3785 18.5V11.1562H5.70757L8.38921 13.8389C8.5843 14.0341 8.58423 14.3507 8.38921 14.5459C8.19396 14.7409 7.87737 14.741 7.68217 14.5459L4.31694 11.1807C4.28531 11.149 4.25867 11.115 4.23589 11.0801C4.20439 11.0604 4.17441 11.0372 4.14702 11.0098C3.95186 10.8145 3.95179 10.498 4.14702 10.3027L7.68217 6.76758C7.87742 6.57256 8.194 6.57249 8.38921 6.76758C8.5844 6.96277 8.58426 7.27933 8.38921 7.47461L5.70659 10.1572H11.3785V3.5C11.3785 3.22398 11.6025 3.0002 11.8785 3ZM14.8785 3C15.1546 3 15.3785 3.22386 15.3785 3.5V18.5C15.3785 18.7761 15.1546 19 14.8785 19C14.6025 18.9998 14.3785 18.776 14.3785 18.5V3.5C14.3785 3.22398 14.6025 3.0002 14.8785 3Z`++// Position the bar (clip edge marker) at the cursor hotspot (16, 16). Bar in the+// source SVG is centered at x≈11.85 — translate by 4.15 in X to align it with the+// hotspot. RIGHT variant scales -1 horizontally and translates so the mirrored bar+// also lands on the hotspot. DOUBLE places the midpoint between the two bars on it.+const TRIM_LEFT_SVG = `<g transform='translate(4.15 4)'><path d='${TRIM_SINGLE_PATH_W}' fill='%23fff'/><path d='${TRIM_SINGLE_PATH_B}' fill='%23000'/></g>`+const TRIM_RIGHT_SVG = `<g transform='translate(27.85 4) scale(-1 1)'><path d='${TRIM_SINGLE_PATH_W}' fill='%23fff'/><path d='${TRIM_SINGLE_PATH_B}' fill='%23000'/></g>`+const TRIM_DOUBLE_SVG = `<g transform='translate(2.65 4)'><path d='${TRIM_DOUBLE_PATH_W}' fill='%23fff'/><path d='${TRIM_DOUBLE_PATH_B}' fill='%23000'/></g>`++const STATIC_CURSORS = new Set(['default', 'pointer', 'cross', 'move', 'grab', 'grabbing', 'text', 'zoom-in', 'zoom-out'])++function getCursorCss(svg: string, r: number, tr: number, color: string, hx = 16, hy = 16) {+ const a = (-tr - r) * (Math.PI / 180)+ const dx = Math.cos(a) - Math.sin(a)+ const dy = Math.sin(a) + Math.cos(a)+ return `url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' style='color: ${color};'><defs><filter id='shadow' y='-40%' x='-40%' width='180px' height='180%' color-interpolation-filters='sRGB'><feDropShadow dx='${dx}' dy='${dy}' stdDeviation='1.2' flood-opacity='.5'/></filter></defs><g fill='none' transform='rotate(${r + tr} 16 16)' filter='url(%23shadow)'>${svg.replaceAll(`"`, `'`)}</g></svg>") ${hx} ${hy}, pointer`+}++const CURSORS: Record<string, (r: number, c: string) => string> = {+ 'ew-resize': (r, c) => getCursorCss(EDGE_SVG, r, 0, c),+ 'ns-resize': (r, c) => getCursorCss(EDGE_SVG, r, 90, c),+ 'nesw-resize': (r, c) => getCursorCss(CORNER_SVG, r, 0, c),+ 'nwse-resize': (r, c) => getCursorCss(CORNER_SVG, r, 90, c),+ 'nwse-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 0, c),+ 'nesw-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 90, c),+ 'senw-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 180, c),+ 'swne-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 270, c),+ 'trim-left': (_r, c) => getCursorCss(TRIM_LEFT_SVG, 0, 0, c),+ 'trim-right': (_r, c) => getCursorCss(TRIM_RIGHT_SVG, 0, 0, c),+ 'trim-both': (_r, c) => getCursorCss(TRIM_DOUBLE_SVG, 0, 0, c),+}++export type CursorType = 'none' | 'default' | 'pointer' | 'cross' | 'grab' | 'rotate' | 'grabbing' | 'resize-edge' | 'resize-corner' | 'text' | 'move' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'nesw-rotate' | 'nwse-rotate' | 'swne-rotate' | 'senw-rotate' | 'zoom-in' | 'zoom-out' | 'trim-left' | 'trim-right' | 'trim-both';++let currentCursor: string | null = null;++/**+ * Sets the cursor on the main canvas element.+ */+export function updateCursor(type: CursorType, rotation = 0, color = 'black') {+ const hash = `${type}-${rotation}-${color}`+ if (currentCursor === hash) return;+ currentCursor = hash;++ const el = document.getElementById(MAIN_CANVAS_ID);+ assert(el, 'Main canvas not found');++ el.style.cursor = 'var(--tl-cursor)'++ const cursor = STATIC_CURSORS.has(type)+ ? type+ : CURSORS[type]?.(rotation * 180 / Math.PI, color) ?? 'default'++ el.style.setProperty('--tl-cursor', cursor)+}diff --git a/apps/web/src/components/engine/utils/history.ts b/apps/web/src/components/engine/utils/history.tsnew file mode 100644index 00000000..d120abe2--- /dev/null+++ b/apps/web/src/components/engine/utils/history.ts@@ -0,0 +1,256 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal } from "solid-js";++export type HistoryEntry = {+ label: string;+ execute: () => void;+ reverse: () => void;+ /** Called after execute and reverse to enqueue persistence. */+ finalize?: () => void;+ /** Called when the entry is permanently evicted from history and can never be undone/redone. */+ dispose?: () => void;+};++export type HistoryTransaction = {+ label: string;+ entries: HistoryEntry[];+};++export type History = ReturnType<typeof createHistory>;++function disposeTransaction(tx: HistoryTransaction): void {+ for (const entry of tx.entries) {+ entry.dispose?.();+ }+}++export function createHistory(maxSize = 100) {+ const undoStack: HistoryTransaction[] = [];+ const redoStack: HistoryTransaction[] = [];+ const [dirty, setDirty] = createSignal(0);++ let activeTransaction: HistoryTransaction | null = null;+ // Nesting depth: an inner start/commit pair appends to the outermost+ // transaction and only the outermost commit flushes it to the stack.+ let txDepth = 0;+ let untracked = false;++ /**+ * Push and immediately execute a history entry.+ * If a transaction is active the entry is appended to it;+ * otherwise it becomes its own single-entry transaction.+ */+ function push(entry: HistoryEntry): void {+ entry.execute();+ entry.finalize?.();++ if (untracked) return;++ if (activeTransaction) {+ activeTransaction.entries.push(entry);+ return;+ }++ undoStack.push({ label: entry.label, entries: [entry] });+ if (undoStack.length > maxSize) {+ const evicted = undoStack.shift();+ if (evicted) {+ disposeTransaction(evicted);+ }+ }++ // Any new action kills the redo branch+ for (const tx of redoStack) {+ disposeTransaction(tx);+ }+ redoStack.length = 0;+ setDirty(d => d + 1);+ }++ /**+ * Begin a transaction. All entries pushed until `commit()` are+ * grouped as one undoable step.+ */+ function startTransaction(label: string): void {+ if (activeTransaction) {+ // Nested: keep appending to the outer one; track depth so the+ // matching inner commit doesn't flush the outer transaction early.+ txDepth++;+ return;+ }+ activeTransaction = { label, entries: [] };+ txDepth = 1;+ }++ /** Commit the active transaction onto the undo stack. */+ function commitTransaction(): void {+ if (!activeTransaction) return;++ // Unwind one nesting level; only the outermost commit flushes.+ if (txDepth > 1) {+ txDepth--;+ return;+ }++ if (activeTransaction.entries.length > 0) {+ undoStack.push(activeTransaction);+ if (undoStack.length > maxSize) {+ const evicted = undoStack.shift();+ if (evicted) {+ disposeTransaction(evicted);+ }+ }+ for (const tx of redoStack) {+ disposeTransaction(tx);+ }+ redoStack.length = 0;+ }++ activeTransaction = null;+ txDepth = 0;+ setDirty(d => d + 1);+ }++ /** Discard the active transaction and reverse all its entries. */+ function rollbackTransaction(): void {+ if (!activeTransaction) return;++ const tx = activeTransaction;+ // Reverse in LIFO order. Suppress recording so observer reactions fired+ // inside reverse() don't push fresh entries.+ withUntracked(() => {+ for (let i = tx.entries.length - 1; i >= 0; i--) {+ tx.entries[i]?.reverse();+ tx.entries[i]?.finalize?.();+ }+ });++ activeTransaction = null;+ txDepth = 0;+ setDirty(d => d + 1);+ }++ /**+ * Callback-style transaction: wraps `fn` in start/commit.+ * Rolls back automatically if `fn` throws.+ */+ function transaction<T>(label: string, fn: () => T): T {+ startTransaction(label);+ try {+ const result = fn();+ commitTransaction();+ return result;+ } catch (e) {+ rollbackTransaction();+ throw e;+ }+ }++ /** Undo the most recent action or transaction. */+ function undo(): void {+ const tx = undoStack.pop();+ if (!tx) return;++ // The recorded entries already replay the change. Observers fired inside+ // reverse() may call the primitives again — suppress recording so they+ // don't push new entries onto the stacks mid-undo.+ withUntracked(() => {+ for (let i = tx.entries.length - 1; i >= 0; i--) {+ tx.entries[i]?.reverse();+ tx.entries[i]?.finalize?.();+ }+ });++ redoStack.push(tx);+ setDirty(d => d + 1);+ }++ /** Redo the most recently undone action or transaction. */+ function redo(): void {+ const tx = redoStack.pop();+ if (!tx) return;++ withUntracked(() => {+ for (const entry of tx.entries) {+ entry.execute();+ entry.finalize?.();+ }+ });++ undoStack.push(tx);+ setDirty(d => d + 1);+ }++ /** Clear all history. */+ function clear(): void {+ for (const tx of undoStack) {+ disposeTransaction(tx);+ }+ for (const tx of redoStack) {+ disposeTransaction(tx);+ }+ undoStack.length = 0;+ redoStack.length = 0;+ activeTransaction = null;+ txDepth = 0;+ setDirty(d => d + 1);+ }++ /**+ * Run `fn` with recording suppressed, restoring the previous flag after.+ * Save/restore (rather than force-off) so nested calls — e.g. an ephemeral+ * push inside an undo replay — don't re-enable recording mid-operation.+ */+ function withUntracked<T>(fn: () => T): T {+ const prev = untracked;+ untracked = true;+ try {+ return fn();+ } finally {+ untracked = prev;+ }+ }++ /**+ * Execute `fn` without recording any history entries.+ * Calls inside still execute and finalize, but are not undoable.+ */+ function untrack(fn: () => void): void {+ withUntracked(fn);+ }++ return {+ push,+ untrack,+ startTransaction,+ commitTransaction,+ rollbackTransaction,+ transaction,+ undo,+ redo,+ clear,+ get canUndo() {+ dirty();+ return undoStack.length > 0;+ },+ get canRedo() {+ dirty();+ return redoStack.length > 0;+ },+ get undoCount() {+ dirty();+ return undoStack.length;+ },+ get redoCount() {+ dirty();+ return redoStack.length;+ },+ get isTransacting() {+ dirty();+ return activeTransaction !== null;+ },+ };+}diff --git a/apps/web/src/components/engine/utils/index.ts b/apps/web/src/components/engine/utils/index.tsnew file mode 100644index 00000000..ca5006c4--- /dev/null+++ b/apps/web/src/components/engine/utils/index.ts@@ -0,0 +1,12 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './coordinates';+export * from './history';+export * from './time';+export * from './sort';+export * from './cursor';+export * from './transcode';+export * from './audio-sync';+export * from './captions';diff --git a/apps/web/src/components/engine/utils/interaction.ts b/apps/web/src/components/engine/utils/interaction.tsnew file mode 100644index 00000000..7a40dafd--- /dev/null+++ b/apps/web/src/components/engine/utils/interaction.ts@@ -0,0 +1,431 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Not, query, Or } from "bitecs";+import { getParentEntity, setComponent, type EngineWorld } from "../api";+import { decompose2D, identity2D, multiply2D, quadCenter, rotate2D, scale2D, skew2D, translate2D, type Mat2D } from "../math";+import { rectToQuad, type Point, type Quad } from "../math";+import { ChildOf } from "../components";+import { assert } from "@/utils";++import type { CursorType } from "./cursor";++type NodeState = {+ localTransform: Mat2D;+ parentTransform: Mat2D;+ height: number;+ width: number;+ scaleX: number;+ scaleY: number;+}++const selectionTransformSnapshot: Map<number, NodeState> = new Map();+export function snapshotSelectionTransforms(world: EngineWorld) {+ const c = world.components;+ selectionTransformSnapshot.clear();++ const snapshot = (eid: number) => {+ if (selectionTransformSnapshot.has(eid)) return;+ const parentEid = getParentEntity(world, eid);+ selectionTransformSnapshot.set(eid, {+ localTransform: entityLocalMat(world, eid),+ parentTransform: entityWorldMat(world, parentEid),+ width: c.Computed.width[eid],+ height: c.Computed.height[eid],+ scaleX: c.Scale.x[eid] ?? 1,+ scaleY: c.Scale.y[eid] ?? 1,+ });++ if (hasComponent(world, eid, c.Group)) {+ for (const child of query(world, [ChildOf(eid), Or(c.Geometry, c.Group), Not(c.Deleted)])) {+ snapshot(child);+ }+ }+ };++ // Store initial node states (local transforms and parent transforms).+ // Groups have no Size of their own, so we also snapshot their direct+ // children — those are the entities a group-resize actually transforms.+ for (const eid of query(world, [c.Selected, Or(c.Geometry, c.Group)])) {+ snapshot(eid);+ }+}++export function getSelectionTransfromSnapshot(id: number) {+ return selectionTransformSnapshot.get(id);+}++type TransformMaskState = {+ width: number;+ height: number;+ mat: Mat2D;+}++export function getSelectionMask(world: EngineWorld): TransformMaskState | null {+ const c = world.components;+ const selection = query(world, [c.Selected, Or(c.Geometry, c.Group), Not(c.Sequential)]);+ if (selection.length === 0) return null;++ let width: number = 0;+ let height: number = 0;+ let mat = identity2D();++ if (selection.length === 1) {+ const eid = selection[0];+ const worldMat = multiply2D(entityWorldMat(world, eid), translate2D(+ c.Computed.originX[eid],+ c.Computed.originY[eid],+ ));+ const d = decompose2D(worldMat);++ width = c.Computed.width[eid] * Math.abs(d.scaleX);+ height = c.Computed.height[eid] * Math.abs(d.scaleY);++ const signX = Math.sign(d.scaleX) || 1;+ const signY = Math.sign(d.scaleY) || 1;++ mat = multiply2D(mat, translate2D(d.x, d.y));+ mat = multiply2D(mat, rotate2D(d.rotation));+ mat = multiply2D(mat, scale2D(signX, signY));+ mat = multiply2D(mat, skew2D(d.skewX, d.skewY));+ } else {+ let minX = Infinity, minY = Infinity;+ let maxX = -Infinity, maxY = -Infinity;++ for (const eid of selection) {+ const q = entityQuad(world, eid);+ for (const p of q) {+ if (p.x < minX) minX = p.x;+ if (p.y < minY) minY = p.y;+ if (p.x > maxX) maxX = p.x;+ if (p.y > maxY) maxY = p.y;+ }+ }++ width = maxX - minX;+ height = maxY - minY;+ mat = translate2D(minX, minY);+ }++ return { width, height, mat };+}++let transformStartMaskState: TransformMaskState | null = null;+export function snapshotSelectionMask(world: EngineWorld) {+ transformStartMaskState = getSelectionMask(world);+}++export function getSelectionMaskSnapshot() {+ return transformStartMaskState;+}++export function updateRotationCursor(world: EngineWorld) {+ const state = getSelectionMask(world);+ if (state === null) return;+ const { mat, width, height } = state;++ // Mouse position in world space+ const mouseX = world.pointer.clientX;+ const mouseY = world.pointer.clientY;++ // Convert mask to quad and get center+ const quad = rectToQuad(mat, width, height);+ const centerX = (quad[0].x + quad[1].x + quad[2].x + quad[3].x) / 4;+ const centerY = (quad[0].y + quad[1].y + quad[2].y + quad[3].y) / 4;++ // Calculate angle from mouse to center+ const angle = Math.atan2(centerY - mouseY, centerX - mouseX);++ world.cursor.update('nwse-rotate', angle - Math.PI / 4);+}++const HANDLE_RESIZE_CURSOR: Record<string, CursorType> = {+ tr: 'nesw-resize', br: 'nwse-resize',+ bl: 'nesw-resize', tl: 'nwse-resize',+ t: 'ns-resize', r: 'ew-resize',+ b: 'ns-resize', l: 'ew-resize',+};++export function updateResizeCursor(world: EngineWorld, orientation: string) {+ const state = getSelectionMask(world);+ if (state === null) return;+ const { a, b } = state.mat;+ const rotation = Math.atan2(b, a);++ world.cursor.update(HANDLE_RESIZE_CURSOR[orientation], rotation);+}++type SnapAxisCandidate = { value: number; point: Point };+type SnapCandidates = { x: SnapAxisCandidate[]; y: SnapAxisCandidate[] };++const snapCandidatesSnapshot: SnapCandidates = { x: [], y: [] };+export function snapshotSnapCandidates(world: EngineWorld) {+ snapCandidatesSnapshot.x.length = 0;+ snapCandidatesSnapshot.y.length = 0;++ const seen = new Set<string>();+ const c = world.components;+ const selection = new Set<number>(query(world, [c.Selected, Or(c.Geometry, c.Group)]));++ const addNodeCandidates = (eid: number) => {+ if (c.Computed.visibility[eid] === 0) return;++ const quad = entityQuad(world, eid);+ const nodeCandidates = buildSnapCandidatesFromQuad(quad);+ const axisCandidates = [+ ...nodeCandidates.x.map(candidate => ({ axis: 'x' as const, candidate })),+ ...nodeCandidates.y.map(candidate => ({ axis: 'y' as const, candidate })),+ ];++ for (const { axis, candidate } of axisCandidates) {+ const key = axis === 'x'+ ? `${axis}:${Math.round(candidate.value * 100) / 100}:${Math.round(candidate.point.y * 100) / 100}`+ : `${axis}:${Math.round(candidate.value * 100) / 100}:${Math.round(candidate.point.x * 100) / 100}`;+ if (seen.has(key)) continue;+ seen.add(key);++ if (axis === 'x') {+ snapCandidatesSnapshot.x.push(candidate);+ } else {+ snapCandidatesSnapshot.y.push(candidate);+ }+ }+ };++ let parentEid: number | null = null;+ if (selection.size === 1) {+ parentEid = getParentEntity(world, selection.values().next().value);+ }++ let parentComponent = Not(ChildOf('*'));+ if (parentEid) {+ parentComponent = ChildOf(parentEid);+ }++ const siblings = [+ ...query(world, [+ parentComponent,+ Or(c.Geometry, c.Group),+ Not(c.Deleted),+ Not(c.Culled),+ Not(c.Hidden),+ ])+ ];++ for (const childEid of siblings) {+ if (selection.has(childEid)) continue;+ addNodeCandidates(childEid);+ }++ if (parentEid !== null && !selection.has(parentEid)) {+ addNodeCandidates(parentEid);+ }+}++export function getSnapCandidatesSnapshot(): SnapCandidates {+ return snapCandidatesSnapshot;+}++const LABEL_INPUT_STYLE = {+ position: 'absolute',+ transformOrigin: 'left top',+ font: '350 11px Inter, sans-serif',+ color: 'var(--foreground)',+ background: 'var(--input)',+ border: '1px solid var(--primary)',+ borderRadius: '2px',+ outline: 'none',+ padding: '0 0 0 2px',+ margin: '0',+ boxSizing: 'content-box',+ zIndex: '1000',+}++let mountedNameInput: HTMLInputElement | null = null;+let mountedNameInputEid: number | null = null;++export function mountNameInput(world: EngineWorld, eid: number) {+ const canvas = world.canvas;+ assert(canvas instanceof HTMLCanvasElement, 'Canvas must be an HTMLCanvasElement');+ const container = canvas.parentElement;+ const c = world.components;+ if (!container) return;++ const originalName = c.Name[eid] ?? '';+ world.history.startTransaction('Edit label');++ const labelInput = document.createElement('input');+ labelInput.type = 'text';+ labelInput.value = originalName;++ Object.assign(labelInput.style, LABEL_INPUT_STYLE);++ labelInput.addEventListener('input', (e) => {+ const input = e.currentTarget as HTMLInputElement;+ setComponent(world, eid, c.Name, input.value ?? '');+ });++ labelInput.addEventListener('blur', (e) => {+ const input = e.currentTarget as HTMLInputElement;+ input.remove();++ if (!input.value.trim()) {+ setComponent(world, eid, c.Name, originalName);+ }++ world.history.commitTransaction();+ mountedNameInput = null;+ mountedNameInputEid = null;+ });++ labelInput.addEventListener('keydown', (e) => {+ e.stopPropagation();+ const input = e.currentTarget as HTMLInputElement;++ if (e.key === 'Escape') {+ setComponent(world, eid, c.Name, originalName);+ input.blur();+ }++ if (e.key === 'Enter') {+ input.blur();+ }+ });++ container.appendChild(labelInput);+ labelInput.focus();+ labelInput.select();++ mountedNameInput = labelInput;+ mountedNameInputEid = eid;+};++export function getMountedNameInput() {+ return { input: mountedNameInput, eid: mountedNameInputEid };+}++export function findSnapTarget(source: SnapAxisCandidate[], targets: SnapAxisCandidate[], threshold: number, axis: 'x' | 'y') {+ let best: {+ offset: number;+ distance: number;+ sourcePoint: Point;+ targetPoint: Point;+ } | null = null;++ for (const sourceCandidate of source) {+ for (const target of targets) {+ const offset = target.value - sourceCandidate.value;+ const distance = Math.abs(offset);+ const crossDistance = axis === 'x'+ ? Math.abs(target.point.y - sourceCandidate.point.y)+ : Math.abs(target.point.x - sourceCandidate.point.x);++ if (distance > threshold) continue;+ if (!best || distance < best.distance || (distance === best.distance && crossDistance < (axis === 'x'+ ? Math.abs(best.targetPoint.y - best.sourcePoint.y)+ : Math.abs(best.targetPoint.x - best.sourcePoint.x)))) {+ best = {+ offset,+ distance,+ sourcePoint: sourceCandidate.point,+ targetPoint: target.point,+ };+ }+ }+ }++ return best;+};++export function getMarqueeQuad(world: EngineWorld): Quad | null {+ if (world.hudMode !== 'marquee') return null;++ const x0 = world.pointer.dragStartX;+ const y0 = world.pointer.dragStartY;+ const x1 = world.pointer.clientX;+ const y1 = world.pointer.clientY;++ const minX = Math.min(x0, x1);+ const minY = Math.min(y0, y1);+ const maxX = Math.max(x0, x1);+ const maxY = Math.max(y0, y1);++ return [+ { x: minX, y: minY },+ { x: maxX, y: minY },+ { x: maxX, y: maxY },+ { x: minX, y: maxY },+ ];+}++export function buildSnapCandidatesFromQuad(quad: Quad): { x: SnapAxisCandidate[], y: SnapAxisCandidate[] } {+ const center = quadCenter(quad);+ const corners = quad;+ const points: Point[] = [...corners, center];++ return {+ x: points.map(point => ({ value: point.x, point })),+ y: points.map(point => ({ value: point.y, point })),+ };+}++export function buildSnapCandidatesFromCorners(points: Point[]): { x: SnapAxisCandidate[], y: SnapAxisCandidate[] } {+ return {+ x: points.map(point => ({ value: point.x, point })),+ y: points.map(point => ({ value: point.y, point })),+ };+}++export function entityWorldMat(world: EngineWorld, eid: number | null): Mat2D {+ if (eid === null) {+ const res = world.resolution;+ return {+ a: world.camera.a * res, b: world.camera.b * res,+ c: world.camera.c * res, d: world.camera.d * res,+ e: world.camera.e * res, f: world.camera.f * res,+ };+ }++ const WorldTransform = world.components.WorldTransform;+ return {+ a: WorldTransform.a[eid] ?? 1, b: WorldTransform.b[eid] ?? 0,+ c: WorldTransform.c[eid] ?? 0, d: WorldTransform.d[eid] ?? 1,+ e: WorldTransform.e[eid] ?? 0, f: WorldTransform.f[eid] ?? 0,+ };+}++export function entityLocalMat(world: EngineWorld, eid: number): Mat2D {+ const LocalTransform = world.components.LocalTransform;+ return {+ a: LocalTransform.a[eid] ?? 1, b: LocalTransform.b[eid] ?? 0,+ c: LocalTransform.c[eid] ?? 0, d: LocalTransform.d[eid] ?? 1,+ e: LocalTransform.e[eid] ?? 0, f: LocalTransform.f[eid] ?? 0,+ };+}++export function entityOffset(world: EngineWorld, eid: number): Point {+ const Offset = world.components.Offset;+ return {+ x: Offset.x[eid] ?? 0,+ y: Offset.y[eid] ?? 0,+ };+}++export function entityAnchor(world: EngineWorld, eid: number): Point {+ const Anchor = world.components.Anchor;+ return {+ x: Anchor.x[eid] ?? 0.5,+ y: Anchor.y[eid] ?? 0.5,+ };+}++export function entityQuad(world: EngineWorld, eid: number): Quad {+ const Computed = world.components.Computed;+ const width = Computed.width[eid];+ const height = Computed.height[eid];++ const mat = multiply2D(entityWorldMat(world, eid), translate2D(Computed.originX[eid], Computed.originY[eid]));++ return rectToQuad(mat, width, height);+}diff --git a/apps/web/src/components/engine/utils/sort.ts b/apps/web/src/components/engine/utils/sort.tsnew file mode 100644index 00000000..517f751e--- /dev/null+++ b/apps/web/src/components/engine/utils/sort.ts@@ -0,0 +1,25 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { EngineWorld } from "../api/world";++export function sortByItemIndex(world: EngineWorld) {+ const ItemIndex = world.components.ItemIndex;+ return (a: number, b: number) => (ItemIndex[a] ?? 0) - (ItemIndex[b] ?? 0);+}++export function sortByStartTime(world: EngineWorld) {+ const Computed = world.components.Computed;+ return (a: number, b: number) => (Computed.start[a]) - (Computed.start[b]);+}++export function sortByOffset(world: EngineWorld) {+ const Computed = world.components.Computed;+ return (a: number, b: number) => Computed.stopOffset[a] - Computed.stopOffset[b];+}++export function sortByFrame(world: EngineWorld) {+ const Keyframe = world.components.Keyframe;+ return (a: number, b: number) => Keyframe.time[a] - Keyframe.time[b];+}diff --git a/apps/web/src/components/engine/utils/text-motion.ts b/apps/web/src/components/engine/utils/text-motion.tsnew file mode 100644index 00000000..0d35f566--- /dev/null+++ b/apps/web/src/components/engine/utils/text-motion.ts@@ -0,0 +1,246 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Text animation helpers used by the motion system.+// All functions take the target text and a normalized ratio (0..1), returning+// the partial display string for that progress.++export function revealWords(chars: string, ratio: number): string {+ if (ratio >= 1) return chars;+ if (ratio <= 0) return '';+ const words = chars.split(/(\s+)/);+ const wordTokens = words.filter((_, i) => i % 2 === 0);+ const visibleCount = Math.floor(ratio * wordTokens.length);+ if (visibleCount <= 0) return '';+ let out = '';+ let shown = 0;+ for (let i = 0; i < words.length; i++) {+ if (i % 2 === 0) {+ if (shown >= visibleCount) break;+ out += words[i];+ shown++;+ } else {+ if (shown >= visibleCount) break;+ out += words[i];+ }+ }+ return out;+}++export function revealChars(chars: string, ratio: number): string {+ if (ratio >= 1) return chars;+ if (ratio <= 0) return '';+ const visibleCount = Math.floor(ratio * chars.length);+ return chars.slice(0, visibleCount);+}++// ─── Scramble Text ──────────────────────────────────────────+// Adapted from anime.js scrambleText (src/text/scramble.js).+// The motion system has no DOM target, prevTween, or wall-clock duration —+// progress is the normalized ratio (0 = blank, 1 = settled). Real-time+// concepts (revealRate/interval/settleDuration) collapse onto SCRAMBLE_SETTLE_RATIO+// (per-char active window) and SCRAMBLE_SETTLE_RATE (refreshes across the animation).+// Structural arrays are cached per text; scramble character lookups are stateless,+// keyed by (seed, position, step) so timeline scrubbing stays deterministic.++const SCRAMBLE_CHARSETS: Record<string, string> = {+ lowercase: 'a-z',+ uppercase: 'A-Z',+ numbers: '0-9',+ symbols: '!%#_|*+=',+ braille: '⠀-⣿',+ blocks: '▀-▟',+ shades: '░-▓',+};++const SCRAMBLE_DEFAULT_CHARS = 'a-zA-Z0-9!%#_';+const SCRAMBLE_SETTLE_RATIO = 0.3;+const SCRAMBLE_SETTLE_RATE = 30;+const SCRAMBLE_FROM: 'left' | 'right' | 'center' | 'random' | number = 'left';+const SCRAMBLE_REVERSED = false;+const SCRAMBLE_PERTURBATION = 0;+const SCRAMBLE_CURSOR = '';+const SCRAMBLE_CACHE_LIMIT = 64;++type ScrambleState = {+ animLength: number;+ endLength: number;+ characters: string;+ cursorChars: string;+ cursorLen: number;+ cursorZone: number;+ settleSpacing: number;+ stepRatio: number;+ charStarts: Float32Array;+ charEnds: Float32Array;+ seed: number;+};++const scrambleStateCache = new Map<string, ScrambleState>();++function expandCharRanges(str: string): string {+ let result = '';+ for (let i = 0, l = str.length; i < l; i++) {+ if (i + 2 < l && str[i + 1] === '-' && str.charCodeAt(i) < str.charCodeAt(i + 2)) {+ const start = str.charCodeAt(i);+ const end = str.charCodeAt(i + 2);+ for (let c = start; c <= end; c++) result += String.fromCharCode(c);+ i += 2;+ } else {+ result += str[i];+ }+ }+ return result;+}++function hashTextToSeed(text: string): number {+ let h = 2166136261;+ for (let i = 0; i < text.length; i++) {+ h ^= text.charCodeAt(i);+ h = Math.imul(h, 16777619);+ }+ return h >>> 0;+}++function createSeededRandom(seed: number): (min: number, max: number) => number {+ let state = (seed >>> 0) || 1;+ return (min, max) => {+ state = (state + 0x6d2b79f5) | 0;+ let t = Math.imul(state ^ (state >>> 15), 1 | state);+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;+ const r = ((t ^ (t >>> 14)) >>> 0) / 4294967296;+ return Math.floor(r * (max - min + 1)) + min;+ };+}++function pickScrambleChar(seed: number, position: number, step: number, charset: string): string {+ let h = (seed ^ Math.imul(position + 1, 0x9e3779b1) ^ Math.imul(step + 1, 0x85ebca6b)) >>> 0;+ h = Math.imul(h ^ (h >>> 16), 0x85ebca6b);+ h = Math.imul(h ^ (h >>> 13), 0xc2b2ae35);+ h ^= h >>> 16;+ return charset[(h >>> 0) % charset.length];+}++function buildScrambleState(text: string): ScrambleState {+ const characters = expandCharRanges(SCRAMBLE_CHARSETS[SCRAMBLE_DEFAULT_CHARS] ?? SCRAMBLE_DEFAULT_CHARS);+ const cursorChars = SCRAMBLE_CURSOR;+ const cursorLen = cursorChars.length;++ const seed = hashTextToSeed(text);+ const rng = createSeededRandom(seed);++ const animLength = text.length;+ const endLength = text.length;++ const settleRatio = SCRAMBLE_SETTLE_RATIO;+ const settleSpacing = animLength > 0 ? (1 - settleRatio) / animLength : 0;+ const cursorZone = cursorLen * settleSpacing;+ const stepRatio = 1 / SCRAMBLE_SETTLE_RATE;++ const charOrder = new Int32Array(animLength);+ if (SCRAMBLE_FROM === 'random') {+ for (let i = 0; i < animLength; i++) charOrder[i] = i;+ for (let i = animLength - 1; i > 0; i--) {+ const j = rng(0, i);+ const tmp = charOrder[i];+ charOrder[i] = charOrder[j];+ charOrder[j] = tmp;+ }+ } else {+ const ref = SCRAMBLE_FROM === 'right' ? animLength - 1+ : SCRAMBLE_FROM === 'center' ? (animLength - 1) / 2+ : typeof SCRAMBLE_FROM === 'number' ? SCRAMBLE_FROM+ : 0;+ const indices = new Array<number>(animLength);+ for (let i = 0; i < animLength; i++) indices[i] = i;+ indices.sort((a, b) => Math.abs(a - ref) - Math.abs(b - ref));+ for (let i = 0; i < animLength; i++) charOrder[indices[i]] = i;+ }+ if (SCRAMBLE_REVERSED) {+ const last = animLength - 1;+ for (let i = 0; i < animLength; i++) charOrder[i] = last - charOrder[i];+ }++ const charStarts = new Float32Array(animLength);+ const charEnds = new Float32Array(animLength);+ const scale = SCRAMBLE_PERTURBATION > 0 ? SCRAMBLE_PERTURBATION * settleRatio : 0;+ for (let c = 0; c < animLength; c++) {+ const so = scale > 0 ? ((rng(0, 2000) - 1000) / 1000) * scale : 0;+ const eo = scale > 0 ? ((rng(0, 2000) - 1000) / 1000) * scale : 0;+ charStarts[c] = charOrder[c] * settleSpacing + so;+ charEnds[c] = Math.ceil((charStarts[c] + settleRatio + eo) / stepRatio) * stepRatio;+ }++ return {+ animLength,+ endLength,+ characters,+ cursorChars,+ cursorLen,+ cursorZone,+ settleSpacing,+ stepRatio,+ charStarts,+ charEnds,+ seed,+ };+}++function getScrambleState(text: string): ScrambleState {+ let state = scrambleStateCache.get(text);+ if (!state) {+ if (scrambleStateCache.size >= SCRAMBLE_CACHE_LIMIT) {+ const firstKey = scrambleStateCache.keys().next().value;+ if (firstKey !== undefined) scrambleStateCache.delete(firstKey);+ }+ state = buildScrambleState(text);+ scrambleStateCache.set(text, state);+ }+ return state;+}++export function scrambleChars(chars: string, ratio: number): string {+ if (chars.length === 0) return '';+ if (ratio >= 1) return chars;++ const {+ animLength, endLength, characters, charStarts, charEnds,+ cursorChars, cursorLen, cursorZone, settleSpacing, stepRatio, seed,+ } = getScrambleState(chars);+ const hasCursor = cursorLen > 0;+ const step = (ratio / stepRatio) | 0;++ let out = '';+ for (let c = 0; c < animLength; c++) {+ const charStart = charStarts[c];+ const charEnd = charEnds[c];++ // Settled: target glyph+ if (ratio >= charEnd) {+ if (c < endLength) out += chars[c];+ continue;+ }++ const isSpace = c < endLength && chars[c] === ' ';+ if (isSpace) {+ out += ' ';+ continue;+ }++ // Pre-transition: override scramble char (length stays constant — equivalent to+ // anime.js override=true with startLength == animLength)+ if (ratio < charStart) {+ out += pickScrambleChar(seed, c, step, characters);+ continue;+ }++ // Active zone: cursor sub-zone, then scramble+ if (hasCursor && ratio - charStart < cursorZone) {+ out += cursorChars[cursorLen - 1 - (((ratio - charStart) / settleSpacing) | 0)];+ } else {+ out += pickScrambleChar(seed, c, step, characters);+ }+ }+ return out;+}diff --git a/apps/web/src/components/engine/utils/text.ts b/apps/web/src/components/engine/utils/text.tsnew file mode 100644index 00000000..f9ec3981--- /dev/null+++ b/apps/web/src/components/engine/utils/text.ts@@ -0,0 +1,653 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { clamp } from "@/utils";+import { colorToHex } from "@/utils/color";+import { COMPOSITE_OPERATIONS, PaintType, FontStyle, StrokeCap, StrokeJoin, TextAlign, TextBaseline, TextCase } from "../components";+import { createLinearGradient, createRadialGradient } from "../systems/render";+import { hasComponent } from "bitecs";++import type { EngineWorld } from "../api/world";++type Ctx = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;++export type TokenOptions = {+ /**+ * Defines the characters to render+ */+ chars: string;+ /**+ * Defines the X offset of the token to the left of the line+ */+ offset: number;+ /**+ * Defines the metrics of the token+ */+ metrics: TextMetrics;+ /**+ * Defines the style of the token+ */+ ranges: number[];+}++export type Line = {+ offsetX: number;+ offsetY: number;+ baseline: number;+ height: number;+};++type RenderSplit = {+ words: string[];+ ranges: number[];+};++/** Global offscreen canvas used solely for text measurement. */+let measureCanvas: OffscreenCanvas | null = null;+let measureCtx: OffscreenCanvasRenderingContext2D | null = null;++function getMeasureCtx(): OffscreenCanvasRenderingContext2D {+ if (!measureCtx) {+ measureCanvas = new OffscreenCanvas(1, 1);+ measureCtx = measureCanvas.getContext('2d', { willReadFrequently: true, alpha: true })!;+ }+ return measureCtx;+}++export class Token {+ public offset: number;+ public metrics: TextMetrics;+ public ranges: number[];+ public chars: string;+ public width: number;+ public height: number;+ public line = { offsetX: 0, offsetY: 0, baseline: 0, height: 0 };++ constructor(options: TokenOptions) {+ this.offset = options.offset;+ this.metrics = options.metrics;+ this.ranges = options.ranges;+ this.width = options.metrics.width;+ this.height = options.metrics.fontBoundingBoxAscent + options.metrics.fontBoundingBoxDescent;+ this.chars = options.chars;+ }++ public get x(): number {+ return (this.offset + this.line.offsetX) | 0;+ }++ public get y(): number {+ return (this.line.offsetY + this.line.baseline) | 0;+ }++ public get left(): number {+ return (+ this.offset ++ this.line.offsetX -+ this.metrics.actualBoundingBoxLeft+ ) | 0;+ }++ public get right(): number {+ return (+ this.offset ++ this.line.offsetX ++ this.metrics.actualBoundingBoxRight+ ) | 0;+ }++ public get top(): number {+ return (+ this.line.offsetY ++ this.line.baseline -+ this.metrics.actualBoundingBoxAscent+ ) | 0+ }++ public get bottom(): number {+ return (+ this.line.offsetY ++ this.line.baseline ++ this.metrics.actualBoundingBoxDescent+ ) | 0+ }++ public setLine(line: Line) {+ this.line = { ...line };+ }+}++function applyFont(ctx: Ctx, world: EngineWorld, eid: number, ranges: number[]) {+ const size = getFontSize(world, eid, ranges);+ const family = getFontFamily(world, eid, ranges);+ const weight = getFontWeight(world, eid, ranges);+ const style = getFontStyle(world, eid, ranges);+ const baseline = getTextBaseline(world, eid, ranges);+ const spacing = getLetterSpacing(world, eid, ranges);++ const mappedStyle = FontStyle[style].toLowerCase();+ const mappedBaseline = TextBaseline[baseline].toLowerCase() as CanvasTextBaseline;++ ctx.font = `${mappedStyle} ${weight.toLowerCase()} ${size}px ${family}`.trim();+ ctx.textBaseline = mappedBaseline;+ ctx.letterSpacing = `${spacing}px`;+}++function applyStroke(ctx: Ctx, world: EngineWorld, eid: number) {+ const Stroke = world.components.StrokeStyle;++ ctx.lineWidth = Stroke.width[eid] ?? 1;+ ctx.lineJoin = StrokeJoin[Stroke.join[eid] ?? 0].toLocaleLowerCase() as CanvasLineJoin;+ ctx.lineCap = StrokeCap[Stroke.cap[eid] ?? 0].toLocaleLowerCase() as CanvasLineCap;+ ctx.miterLimit = Stroke.miterLimit[eid] ?? 3;+}++function shapeTokens(world: EngineWorld, eid: number): void {+ const Computed = world.components.Computed;+ const Size = world.components.Size;+ const lines = world.components.TextCache.tokens[eid];+ const leading = world.components.TextStyle.leading[eid] ?? 1;+ const textAlign = world.components.TextStyle.textAlign[eid] ?? TextAlign.LEFT;+ const textBaseline = world.components.TextStyle.textBaseline[eid] ?? TextBaseline.TOP;+ if (!lines) return;++ // Measure each line's width by summing word widths and spaces+ const lineWidths: number[] = lines.map(line => line.reduce((acc, word) => acc + word.width, 0));+ const lineHeights: number[] = lines.map(line => Math.max(...line.map(word => word.height)));++ // Find the maximum line width+ const maxLineWidth = Math.max(...lineWidths);++ // Calculate total height based on leading+ const totalHeight = lineHeights.reduce((acc, height, i) => acc + height * (i < lineHeights.length - 1 ? leading : 1), 0);++ // When Size is assigned, use Computed for positioning; otherwise set it from text dimensions+ const hasSizeComponent = hasComponent(world, eid, Size);+ if (!hasSizeComponent || !Computed.width[eid] || !Computed.height[eid]) {+ Computed.width[eid] = Math.ceil(maxLineWidth);+ Computed.height[eid] = Math.ceil(totalHeight);+ }++ const containerWidth = Computed.width[eid];+ const containerHeight = Computed.height[eid];++ // Calculate initial vertical offset based on text baseline and container height+ let offsetY = 0;+ if (textBaseline === TextBaseline.MIDDLE) {+ offsetY = (containerHeight - totalHeight) / 2;+ } else if (textBaseline === TextBaseline.BOTTOM) {+ offsetY = containerHeight - totalHeight;+ }++ // Calculate coordinates for each word+ const line = {+ offsetX: 0,+ offsetY,+ baseline: 0,+ height: 0,+ };++ for (let l = 0; l < lines.length; l++) {+ line.height = lineHeights[l];++ if (textAlign === TextAlign.LEFT) {+ line.offsetX = 0;+ } else if (textAlign === TextAlign.CENTER) {+ line.offsetX = (containerWidth - lineWidths[l]) / 2;+ } else if (textAlign === TextAlign.RIGHT) {+ line.offsetX = containerWidth - lineWidths[l];+ }++ if (textBaseline === TextBaseline.TOP) {+ line.baseline = 0;+ } else if (textBaseline === TextBaseline.MIDDLE) {+ line.baseline = lineHeights[l] / 2;+ } else if (textBaseline === TextBaseline.BOTTOM) {+ line.baseline = lineHeights[l];+ } else if (textBaseline === TextBaseline.ALPHABETIC) {+ const maxAscent = Math.max(...lines[l].map(word => word.metrics.fontBoundingBoxAscent));+ line.baseline = maxAscent || lineHeights[l] * 0.75; // Fallback if no words in line+ }++ for (const word of lines[l]) {+ word.setLine(line);+ }++ line.offsetY += lineHeights[l] * leading;+ }+}++function tokenizeText(world: EngineWorld, eid: number) {+ const ctx = getMeasureCtx();++ // Split text into segments based on style overrides first+ const lines: Token[][] = [[]];++ let maxWidth = world.components.Size.width[eid] ?? Number.POSITIVE_INFINITY;+ if (typeof maxWidth === 'string') {+ maxWidth = world.components.Computed.width[eid] ?? Number.POSITIVE_INFINITY;+ }++ let offset = 0;+ for (const { words, ranges } of createRenderSplits(world, eid)) {+ applyFont(ctx, world, eid, ranges);++ for (const word of words) {+ const splits = word.split('\n');++ for (let i = 0; i < splits.length; i++) {+ const caseValue = getTextCase(world, eid, ranges);+ const chars = transformText(splits[i], caseValue);++ const metrics = ctx.measureText(chars);++ // check if word is too wide for the current line but not the first word+ if (offset + metrics.width > maxWidth && offset > 0) {+ lines.push([]);+ offset = 0;+ }++ // add word to current line+ lines[lines.length - 1].push(new Token({ chars, ranges, metrics, offset }));+ offset += metrics.width;++ // add new line if not the last line+ if (i < splits.length - 1) {+ lines.push([]);+ offset = 0;+ }+ }+ }+ }++ world.components.TextCache.tokens[eid] = lines;+}++/** Renders text tokens directly to the given canvas context. */+function renderTokens(ctx: Ctx, world: EngineWorld, eid: number): void {+ const lines = world.components.TextCache.tokens[eid];+ if (!lines) return;+ const words = lines.flat();++ const savedAlpha = ctx.globalAlpha;++ // Draw all text shadows+ {+ ctx.save();+ ctx.textAlign = 'start';+ ctx.textBaseline = 'top';++ // ctx.shadowBlur/OffsetX/OffsetY are in device-pixel space and are not+ // affected by the current transform, so scale them up to match the+ // content transform (camera * resolution).+ const shadowScale = world.camera.a * world.resolution;++ for (const word of words) {+ applyFont(ctx, world, eid, word.ranges);++ const strokes = getStrokes(world, eid, word.ranges);+ const shadows = getShadows(world, eid, word.ranges);++ if (strokes.length) {+ applyStroke(ctx, world, eid);+ }++ // Draw shadows first (if any)+ for (const sid of shadows) {+ if (hasComponent(world, sid, world.components.Hidden)) continue;++ ctx.shadowOffsetX = (world.components.Offset.x[sid] ?? 0) * shadowScale;+ ctx.shadowOffsetY = (world.components.Offset.y[sid] ?? 0) * shadowScale;+ ctx.shadowBlur = (world.components.Blur[sid] ?? 0) * shadowScale;+ ctx.shadowColor = colorToHex(world.components.Color[sid] ?? 0x000000);+ ctx.fillStyle = colorToHex(world.components.Color[sid] ?? 0x000000);+ ctx.globalAlpha = savedAlpha * (world.components.Appearance.opacity[sid] ?? 1);++ if (strokes.length) {+ ctx.strokeText(word.chars, word.x, word.y);+ } else {+ ctx.fillText(word.chars, word.x, word.y);+ }+ }++ // Reset shadow properties if any shadows are applied+ if (shadows.length) {+ ctx.globalAlpha = savedAlpha;+ ctx.shadowColor = 'transparent';+ }+ }+ ctx.restore();+ }++ // Draw all text strokes+ {+ ctx.save();+ ctx.textAlign = 'start';+ ctx.textBaseline = 'top';++ for (const word of words) {+ const strokes = getStrokes(world, eid, word.ranges);+ if (!strokes.length) continue;++ applyFont(ctx, world, eid, word.ranges);+ applyStroke(ctx, world, eid);++ const w = world.components.Computed.width[eid];+ const h = world.components.Computed.height[eid];++ // Draw strokes (if any)+ for (const sid of strokes) {+ if (hasComponent(world, sid, world.components.Hidden)) continue;++ const savedCO = ctx.globalCompositeOperation;+ const blendMode = world.components.Appearance.blendMode[sid] ?? 0;+ if (blendMode !== 0) {+ ctx.globalCompositeOperation = COMPOSITE_OPERATIONS[blendMode];+ }+ ctx.globalAlpha = savedAlpha * (world.components.Appearance.opacity[sid] ?? 1);++ const paintType = world.components.Paint[sid];+ if (paintType === PaintType.LINEAR_GRADIENT) {+ ctx.strokeStyle = createLinearGradient(world, sid, ctx, w, h);+ } else if (paintType === PaintType.RADIAL_GRADIENT) {+ ctx.strokeStyle = createRadialGradient(world, sid, ctx, w, h);+ } else {+ ctx.strokeStyle = colorToHex(world.components.Color[sid] ?? 0x000000);+ }+ ctx.strokeText(word.chars, word.x, word.y);+ ctx.globalCompositeOperation = savedCO;+ }+ }+ ctx.restore();+ }++ // Draw all text fills+ {+ ctx.save();+ ctx.textAlign = 'start';+ ctx.textBaseline = 'top';++ for (const word of words) {+ const fills = getFills(world, eid, word.ranges);+ if (!fills.length) continue;++ applyFont(ctx, world, eid, word.ranges);++ const w = world.components.Computed.width[eid];+ const h = world.components.Computed.height[eid];++ for (const fid of fills) {+ if (hasComponent(world, fid, world.components.Hidden)) continue;++ const savedCO = ctx.globalCompositeOperation;+ const blendMode = world.components.Appearance.blendMode[fid] ?? 0;+ if (blendMode !== 0) {+ ctx.globalCompositeOperation = COMPOSITE_OPERATIONS[blendMode];+ }+ ctx.globalAlpha = savedAlpha * (world.components.Appearance.opacity[fid] ?? 1);++ const paintType = world.components.Paint[fid];+ if (paintType === PaintType.LINEAR_GRADIENT) {+ ctx.fillStyle = createLinearGradient(world, fid, ctx, w, h);+ } else if (paintType === PaintType.RADIAL_GRADIENT) {+ ctx.fillStyle = createRadialGradient(world, fid, ctx, w, h);+ } else {+ ctx.fillStyle = colorToHex(world.components.Color[fid] ?? 0x000000);+ }+ ctx.fillText(word.chars, word.x, word.y);+ ctx.globalCompositeOperation = savedCO;+ }+ }+ ctx.restore();+ }+}++/** Render text tokens directly to world.ctx. Call measureText first. */+export function renderText(world: EngineWorld, eid: number) {+ const ctx = world.ctx;+ if (!ctx) return;+ tokenizeText(world, eid);+ shapeTokens(world, eid);+ renderTokens(ctx, world, eid);+}++/**+ * Splits text into segments based on overlapping text range eids.+ * Handles overlapping ranges by merging their eids.+ * @returns Array of RenderSplit objects with words, merged style, and contributing styleIds+ */+function createRenderSplits(world: EngineWorld, eid: number): RenderSplit[] {+ const chars = world.components.Computed.chars[eid] ?? world.components.Chars[eid] ?? '';++ const textRangeEids = world.components.Cache.textRanges[eid];++ // Fast path: no styles+ if (textRangeEids.length === 0) {+ return [{+ words: tokenize(chars),+ ranges: [],+ }];+ }++ // Fast path: empty text+ if (chars.length === 0) {+ return [{+ words: [],+ ranges: [],+ }];+ }++ // Collect all unique boundary points+ const boundaries = new Set<number>();+ boundaries.add(0);+ boundaries.add(chars.length);++ for (const rid of textRangeEids) {+ let start = world.components.TextRange.start[rid] ?? 0;+ let end = world.components.TextRange.end[rid] ?? chars.length;++ // Clamp boundaries to valid text range+ start = clamp(start, 0, chars.length);+ end = clamp(end, 0, chars.length);++ boundaries.add(start);+ boundaries.add(end);+ }++ // Sort boundaries in ascending order+ const sortedBoundaries = Array.from(boundaries).sort((a, b) => a - b);++ // Create segments between each pair of boundaries+ const segments: RenderSplit[] = [];++ for (let i = 0; i < sortedBoundaries.length - 1; i++) {+ const segStart = sortedBoundaries[i];+ const segEnd = sortedBoundaries[i + 1];++ // Skip empty segments+ if (segStart >= segEnd) continue;++ // Find all active styles for this segment+ const ranges: number[] = [];++ for (const rid of textRangeEids) {+ let start = world.components.TextRange.start[rid] ?? 0;+ let end = world.components.TextRange.end[rid] ?? chars.length;++ // Clamp boundaries to valid text range+ start = clamp(start, 0, chars.length);+ end = clamp(end, 0, chars.length);++ // A style is active if segment falls within its range [start, end)+ // Using < for end to treat ranges as [start, end)+ if (start <= segStart && end > segStart) {+ ranges.push(rid);+ }+ }++ segments.push({+ words: tokenize(chars.slice(segStart, segEnd)),+ ranges: ranges,+ });+ }++ return segments;+}++function tokenize(input: string): string[] {+ // Fast path for inputs without spaces+ if (input.indexOf(' ') === -1) {+ return [input];+ }++ // Use regex to match:+ // 1. Any characters up to and including a space+ // 2. OR any remaining characters to the end+ return input.match(/[^]*? |[^]+$/g) || [input];+}++export function transformText(text: string, textCase?: number): string {+ if (textCase == TextCase.LOWER) {+ return text.toLocaleLowerCase();+ }++ if (textCase == TextCase.UPPER) {+ return text.toUpperCase();+ }++ return text;+}+++function getFills(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.Cache.fills[eid];++ for (const rid of ranges) {+ const rangeValue = world.components.Cache.fills[rid];+ if (rangeValue.length) {+ value = rangeValue;+ }+ }++ return value;+}+++function getStrokes(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.Cache.strokes[eid];++ for (const rid of ranges) {+ const rangeValue = world.components.Cache.strokes[rid];+ if (rangeValue.length) {+ value = rangeValue;+ }+ }++ return value;+}++function getShadows(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.Cache.shadows[eid];++ for (const rid of ranges) {+ const rangeValue = world.components.Cache.shadows[rid];+ if (rangeValue.length) {+ value = rangeValue;+ }+ }++ return value;+}++function getTextCase(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.TextStyle.textCase[eid] ?? 0;++ for (const rid of ranges) {+ const rangeValue = world.components.TextStyle.textCase[rid];+ if (rangeValue !== undefined) {+ value = rangeValue;+ }+ }++ return value;+}++function getFontSize(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.TextStyle.fontSize[eid] ?? 16;++ for (const rid of ranges) {+ const rangeValue = world.components.TextStyle.fontSize[rid];+ if (rangeValue !== undefined) {+ value = rangeValue;+ }+ }++ return value;+}++function getFontFamily(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.TextStyle.fontFamily[eid] ?? 'Inter';++ for (const rid of ranges) {+ const rangeValue = world.components.TextStyle.fontFamily[rid];+ if (rangeValue !== undefined) {+ value = rangeValue;+ }+ }++ return value;+}++function getFontWeight(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.TextStyle.fontWeight[eid] ?? '400';++ for (const rid of ranges) {+ const rangeValue = world.components.TextStyle.fontWeight[rid];+ if (rangeValue !== undefined) {+ value = rangeValue;+ }+ }++ return value;+}+++function getFontStyle(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.TextStyle.fontStyle[eid] ?? FontStyle.NORMAL;++ for (const rid of ranges) {+ const rangeValue = world.components.TextStyle.fontStyle[rid];+ if (rangeValue !== undefined) {+ value = rangeValue;+ }+ }++ return value;+}++function getTextBaseline(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.TextStyle.textBaseline[eid] ?? TextBaseline.TOP;++ for (const rid of ranges) {+ const rangeValue = world.components.TextStyle.textBaseline[rid];+ if (rangeValue !== undefined) {+ value = rangeValue;+ }+ }++ return value;+}++function getLetterSpacing(world: EngineWorld, eid: number, ranges: number[]) {+ let value = world.components.TextStyle.letterSpacing[eid] ?? 0;++ for (const rid of ranges) {+ const rangeValue = world.components.TextStyle.letterSpacing[rid];+ if (rangeValue !== undefined) {+ value = rangeValue;+ }+ }++ return value;+}diff --git a/apps/web/src/components/engine/utils/time.ts b/apps/web/src/components/engine/utils/time.tsnew file mode 100644index 00000000..5056c5ad--- /dev/null+++ b/apps/web/src/components/engine/utils/time.ts@@ -0,0 +1,97 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent } from "bitecs";+import { PaintType } from "../components";+import { CONONICAL_TIME_BASE } from "../constants";++import type { EngineWorld } from "../api/world";++export function snapToMs(seconds: number) {+ return Math.round(seconds * CONONICAL_TIME_BASE) / CONONICAL_TIME_BASE;+}++export function snapToFps(seconds: number, fps: number = 30) {+ return Math.round(seconds * fps) / fps;+}++export function secondsToFrames(seconds: number = 0, fps: number = 30) {+ return Math.round(seconds * fps);+}++export function framesToSeconds(frames: number = 0, fps: number = 30) {+ return snapToMs(frames / fps);+}++/**+ * Computes the trim start frame (local) for a given entity,+ * based on the specified start frame (global) and playback rate.+ */+export function computeTrimStart(world: EngineWorld, eid: number, start: number) {+ const c = world.components;+ const delay = c.Computed.delay[eid] ?? 0;+ const playbackRate = c.PlaybackRate[eid] ?? 1;++ return Math.round((start - delay) * playbackRate);+}++/**+ * Computes the trim end frame (local) for a given entity,+ * based on the specified end frame (global) and playback rate.+ */+export function computeTrimEnd(world: EngineWorld, eid: number, end: number) {+ const c = world.components;+ const delay = c.Computed.delay[eid] ?? 0;+ const playbackRate = c.PlaybackRate[eid] ?? 1;++ return Math.round((end - delay) * playbackRate);+}++export function findGeometryAsset(world: EngineWorld, eid: number) {+ const c = world.components;++ if (hasComponent(world, eid, c.AssetId)) {+ const asset = world.assets.get(c.AssetId[eid] ?? '');++ if (asset) {+ return asset;+ }+ }+++ for (const fid of c.Cache.fills[eid]) {+ if (hasComponent(world, fid, c.AssetId)) {+ const asset = world.assets.get(c.AssetId[fid] ?? '');+ if (asset) {+ return asset;+ }+ }+ }++ return null;+}++export function findAssetDuration(world: EngineWorld, eid: number) {+ const c = world.components;++ if (hasComponent(world, eid, c.Audio)) {+ const asset = world.assets.get(c.AssetId[eid] ?? '');++ if (asset?.type === 'AUDIO' || asset?.type === 'VIDEO') {+ return secondsToFrames(asset.duration, world.frameRate);+ }+ }+++ for (const fid of c.Cache.fills[eid]) {+ if (c.Paint[fid] === PaintType.VIDEO || c.Paint[fid] === PaintType.SEQUENCE) {+ const asset = world.assets.get(c.AssetId[fid] ?? '');+ if (asset && (asset.type === 'VIDEO' || asset.type === 'SEQUENCE')) {+ return secondsToFrames(asset.duration, world.frameRate);+ }+ }+ }++ return null;+}diff --git a/apps/web/src/components/engine/utils/transcode.ts b/apps/web/src/components/engine/utils/transcode.tsnew file mode 100644index 00000000..3be0932d--- /dev/null+++ b/apps/web/src/components/engine/utils/transcode.ts@@ -0,0 +1,524 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ALL_FORMATS, AudioSampleSink, BlobSource, BufferTarget, CanvasSink, Conversion, Input, InputAudioTrack, Mp4OutputFormat, OggOutputFormat, Output, StreamTarget } from 'mediabunny';+import { assert } from '@/utils';+import type { StreamTargetChunk } from 'mediabunny';+import type { Asset } from '../db';++export async function transcodeForTranscription(asset: Asset): Promise<File> {+ const blob = await asset.handle.getFile();+ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });+ try {+ const output = new Output({ format: new OggOutputFormat(), target: new BufferTarget() });+ const conversion = await Conversion.init({+ input,+ output,+ video: { discard: true },+ audio: { codec: "opus", numberOfChannels: 1, sampleRate: 16000 },+ });+ if (!conversion.isValid || conversion.utilizedTracks.length === 0) {+ throw new Error("No audio found. The asset has no audio track to transcribe.");+ }+ await conversion.execute();++ const buffer = output.target.buffer;+ assert(buffer, "Transcoding produced no output.");+ return new File([buffer], `${crypto.randomUUID()}.ogg`, { type: "audio/ogg" });+ } finally {+ input.dispose();+ }+}++export async function transcodeForAnalysis(asset: Asset, window?: TimeWindow) {+ const blob = await asset.handle.getFile();+ const hasWindow = window?.start !== undefined || window?.end !== undefined;++ if (!(asset.type === "VIDEO" || asset.type === "AUDIO")) {+ return { readable: blob.stream() as ReadableStream<Uint8Array<ArrayBuffer>> };+ }++ const isVideo = asset.type === "VIDEO";+ const trim = hasWindow ? resolveWindow(asset.duration, window) : undefined;++ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });++ const { writable, readable } = new TransformStream<StreamTargetChunk, Uint8Array<ArrayBuffer>>({+ transform: (chunk, controller) => controller.enqueue(chunk.data),+ });++ const target = new StreamTarget(writable);+ const format = isVideo+ ? new Mp4OutputFormat({ fastStart: "fragmented" })+ : new OggOutputFormat();+ const output = new Output({ format, target });++ const conversion = await Conversion.init({+ input,+ output,+ trim: (trim && { start: trim.start, end: trim.end }),+ video: { width: 640, frameRate: 24, bitrate: 500_000, discard: !isVideo },+ audio: { codec: isVideo ? undefined : "opus", numberOfChannels: 1, sampleRate: 16_000 },+ });++ if (!conversion.isValid || conversion.utilizedTracks.length === 0) {+ input.dispose();+ throw new Error("Nothing to analyze. The asset has no usable video or audio track.");+ }++ const run = async () => {+ try {+ await conversion.execute();+ } finally {+ input.dispose();+ }+ };++ return { readable, run };+}++const MAX_IMAGE_SIZE = 560 ** 2;+const PATCH_SIZE = 28;+const MAX_WIDTH_IN_TOKENS = 92;+const MAX_HEIGHT_IN_TOKENS = 52;+const THUMBNAIL_HEIGHT_IN_TOKENS = 5;+const WAVEFORM_HEIGHT_IN_TOKENS = 3;+const RULER_HEIGHT_IN_TOKENS = 1;+const AUDIO_WAVEFORM_HEIGHT_IN_TOKENS = 6;+const AUDIO_COLUMN_WIDTH_IN_TOKENS = 6;+const WAVEFORM_SAMPLE_WIDTH = 2; // pixels per peak; wider = less noisy+const SILENCE_THRESHOLD = 12; // peak value (0-255) at/below which audio counts as silent+const SILENCE_MIN_SECONDS = 0.4;++function formatTimestamp(seconds: number, secondsPerColumn: number): string {+ if (secondsPerColumn <= 1) {+ return Math.round(seconds * 1000) + 'ms';+ }++ const total = Math.floor(seconds);+ const hh = Math.floor(total / 3600);+ const mm = Math.floor((total % 3600) / 60);+ const ss = total % 60;+ const parts = [hh, mm, ss].map((v) => String(v).padStart(2, '0'));+ return parts.join(':');+}++export type AssetVisualization = {+ dataUrl: string;+} & Record<string, unknown>;++export type TimeWindow = { start?: number; end?: number };++export type VisualizeOptions = TimeWindow & { scale?: number };++const MIN_SCALE = 0.25;+const MAX_SCALE = 4;++function resolveScale(scale?: number): number {+ if (scale === undefined) return 1;+ assert(Number.isFinite(scale) && scale > 0, `scale must be a positive number (got ${scale}).`);+ return Math.min(Math.max(scale, MIN_SCALE), MAX_SCALE);+}++// Clamp a requested [start, end] window (in seconds) to the asset's timeline.+// `start` defaults to 0 and `end` to the full duration.+function resolveWindow(duration: number, window?: TimeWindow): { start: number; end: number; duration: number } {+ const start = Math.min(Math.max(window?.start ?? 0, 0), duration);+ const end = Math.min(Math.max(window?.end ?? duration, start), duration);+ assert(end > start, `The requested window is empty; start (${start.toFixed(2)}s) is at or past the asset's end (${duration.toFixed(2)}s).`);+ return { start, end, duration: end - start };+}++export async function visualizeAsset(asset: Asset, options?: VisualizeOptions): Promise<AssetVisualization> {+ const blob = await asset.handle.getFile();+ const scale = resolveScale(options?.scale);++ if (asset.type === "IMAGE") {+ const pixelCount = asset.width * asset.height;+ const factor = Math.min(1, Math.sqrt(MAX_IMAGE_SIZE / pixelCount) * scale);++ const outputWidth = Math.floor(asset.width * factor);+ const outputHeight = Math.floor(asset.height * factor);++ const bitmap = await createImageBitmap(blob);+ const canvas = document.createElement('canvas');+ canvas.width = outputWidth;+ canvas.height = outputHeight;+ const ctx = canvas.getContext('2d')!;+ ctx.drawImage(bitmap, 0, 0, outputWidth, outputHeight);+ bitmap.close();+ return { dataUrl: canvas.toDataURL('image/png') };+ }++ if (asset.type === "VIDEO") {+ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });+ const videoTrack = await input.getPrimaryVideoTrack();+ assert(videoTrack, "Video track not found");+ const audioTrack = await input.getPrimaryAudioTrack();+ const { start: windowStart, duration } = resolveWindow(asset.duration, options);+ const aspect = asset.width / asset.height;+ const frameRate = asset.frameRate;++ const fixedRowTokens = RULER_HEIGHT_IN_TOKENS + (audioTrack ? WAVEFORM_HEIGHT_IN_TOKENS : 0);+ const thumbnailHeightInTokens = Math.min(+ Math.max(Math.round(THUMBNAIL_HEIGHT_IN_TOKENS * scale), 1),+ MAX_HEIGHT_IN_TOKENS - fixedRowTokens,+ );+ const rowHeightInTokens = thumbnailHeightInTokens + fixedRowTokens;++ const columnWidthInTokens = Math.min(+ Math.max(Math.floor(thumbnailHeightInTokens * aspect), 1),+ MAX_WIDTH_IN_TOKENS,+ );++ const thumbnailWidthInPixels = columnWidthInTokens * PATCH_SIZE;+ const thumbnailHeightInPixels = thumbnailHeightInTokens * PATCH_SIZE;+ const rowHeightInPixels = rowHeightInTokens * PATCH_SIZE;++ const rows = Math.floor(MAX_HEIGHT_IN_TOKENS / rowHeightInTokens);+ const columns = Math.floor(MAX_WIDTH_IN_TOKENS / columnWidthInTokens);+ const cells = rows * columns;++ const secondsPerColumn = Math.max(duration / cells, 1 / frameRate);+ const secondsPerRow = secondsPerColumn * columns;++ const canvas = document.createElement('canvas');+ canvas.width = columnWidthInTokens * columns * PATCH_SIZE;+ canvas.height = rowHeightInTokens * rows * PATCH_SIZE;+ const ctx = canvas.getContext('2d')!;++ ctx.fillStyle = '#000';+ ctx.fillRect(0, 0, canvas.width, canvas.height);++ const sink = new CanvasSink(videoTrack, {+ width: thumbnailWidthInPixels,+ height: thumbnailHeightInPixels,+ fit: 'cover',+ poolSize: 1,+ });++ const rulerHeight = RULER_HEIGHT_IN_TOKENS * PATCH_SIZE;++ const timestamps = Array.from({ length: cells }, (_, i) => windowStart + i * secondsPerColumn);+ const interator = sink.canvasesAtTimestamps(timestamps);+ for (let i = 0; i < cells; i++) {+ const wrapped = await interator.next();+ if (!wrapped.value?.canvas) continue;++ const column = i % columns;+ const row = Math.floor(i / columns);++ ctx.drawImage(+ wrapped.value.canvas,+ column * columnWidthInTokens * PATCH_SIZE,+ rulerHeight + row * rowHeightInTokens * PATCH_SIZE,+ thumbnailWidthInPixels,+ thumbnailHeightInPixels+ );+ }++ if (audioTrack) {+ const peaksPerSecond = Math.round(thumbnailWidthInPixels / secondsPerColumn / WAVEFORM_SAMPLE_WIDTH);+ const audioPeaks = await downsampleAudio(audioTrack, { peaksPerSecond, range: [windowStart, windowStart + duration] });++ drawWaveform(ctx, audioPeaks, {+ rows,+ rowWidth: columns * thumbnailWidthInPixels,+ rowHeightInPixels,+ waveformOffset: rulerHeight + thumbnailHeightInPixels,+ waveformHeight: WAVEFORM_HEIGHT_IN_TOKENS * PATCH_SIZE,+ peaksPerSecond,+ align: 'bottom',+ });+ }++ drawRuler(ctx, {+ cells,+ columns,+ columnWidthInPixels: columnWidthInTokens * PATCH_SIZE,+ rowHeightInPixels,+ rulerHeight,+ secondsPerColumn,+ startOffset: windowStart,+ });++ return {+ dataUrl: canvas.toDataURL('image/png'),+ column: {+ width: thumbnailWidthInPixels,+ count: columns,+ duration: secondsPerColumn,+ },+ row: {+ height: rowHeightInPixels,+ count: rows,+ duration: secondsPerRow,+ },+ };+ }++ if (asset.type === "AUDIO") {+ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });+ try {+ const audioTrack = await input.getPrimaryAudioTrack();+ assert(audioTrack, "Audio track not found");+ const { start: windowStart, duration } = resolveWindow(asset.duration, options);++ const waveformHeightInTokens = Math.min(+ Math.max(Math.round(AUDIO_WAVEFORM_HEIGHT_IN_TOKENS * scale), 1),+ MAX_HEIGHT_IN_TOKENS - RULER_HEIGHT_IN_TOKENS,+ );+ const rowHeightInTokens = waveformHeightInTokens + RULER_HEIGHT_IN_TOKENS;+ const columnWidthInTokens = Math.min(+ Math.max(Math.round(AUDIO_COLUMN_WIDTH_IN_TOKENS * scale), 1),+ MAX_WIDTH_IN_TOKENS,+ );++ const rows = Math.floor(MAX_HEIGHT_IN_TOKENS / rowHeightInTokens);+ const columns = Math.floor(MAX_WIDTH_IN_TOKENS / columnWidthInTokens);+ const cells = rows * columns;++ const secondsPerColumn = duration / cells;+ const secondsPerRow = secondsPerColumn * columns;++ const columnWidthInPixels = columnWidthInTokens * PATCH_SIZE;+ const rowHeightInPixels = rowHeightInTokens * PATCH_SIZE;+ const rulerHeight = RULER_HEIGHT_IN_TOKENS * PATCH_SIZE;+ const waveformHeight = waveformHeightInTokens * PATCH_SIZE;+ const rowWidth = columns * columnWidthInPixels;++ const canvas = document.createElement('canvas');+ canvas.width = rowWidth;+ canvas.height = rowHeightInPixels * rows;+ const ctx = canvas.getContext('2d')!;++ ctx.fillStyle = '#000';+ ctx.fillRect(0, 0, canvas.width, canvas.height);++ const peaksPerSecond = Math.round(columnWidthInPixels / secondsPerColumn / WAVEFORM_SAMPLE_WIDTH);+ const audioPeaks = await downsampleAudio(audioTrack, { peaksPerSecond, range: [windowStart, windowStart + duration] });++ drawWaveform(ctx, audioPeaks, {+ rows,+ rowWidth,+ rowHeightInPixels,+ waveformOffset: rulerHeight,+ waveformHeight,+ peaksPerSecond,+ align: 'center',+ });++ drawRuler(ctx, {+ cells,+ columns,+ columnWidthInPixels,+ rowHeightInPixels,+ rulerHeight,+ secondsPerColumn,+ startOffset: windowStart,+ });++ return {+ dataUrl: canvas.toDataURL('image/png'),+ column: {+ width: columnWidthInPixels,+ count: columns,+ duration: secondsPerColumn,+ },+ row: {+ height: rowHeightInPixels,+ count: rows,+ duration: secondsPerRow,+ },+ };+ } finally {+ input.dispose();+ }+ }++ throw new Error(`Unsupported asset type: ${asset.type}`);+}++type WaveformLayout = {+ rows: number;+ rowWidth: number; // pixels spanning all columns of a row+ rowHeightInPixels: number;+ waveformOffset: number; // y offset within a row where the waveform begins+ waveformHeight: number;+ peaksPerSecond: number;+ align: 'center' | 'bottom';+};++function drawWaveform(ctx: CanvasRenderingContext2D, audioPeaks: Uint8ClampedArray, layout: WaveformLayout) {+ const { rows, rowWidth, rowHeightInPixels, waveformOffset, waveformHeight, peaksPerSecond, align } = layout;+ const peaksPerRow = Math.floor(rowWidth / WAVEFORM_SAMPLE_WIDTH);+ const fullHeight = align === 'bottom' ? waveformHeight : waveformHeight / 2;++ const waveformTopOf = (row: number) => row * rowHeightInPixels + waveformOffset;++ ctx.fillStyle = '#FFF';+ for (let row = 0; row < rows; row++) {+ const top = waveformTopOf(row);++ for (let col = 0; col < peaksPerRow; col++) {+ const peakIndex = row * peaksPerRow + col;+ if (peakIndex >= audioPeaks.length) break;++ const amplitude = (audioPeaks[peakIndex] / 255) * fullHeight;+ const x = col * WAVEFORM_SAMPLE_WIDTH;+ if (align === 'bottom') {+ const barHeight = Math.max(amplitude, 1);+ ctx.fillRect(x, top + waveformHeight - barHeight, WAVEFORM_SAMPLE_WIDTH, barHeight);+ } else {+ const centerY = top + fullHeight;+ ctx.fillRect(x, centerY - amplitude, WAVEFORM_SAMPLE_WIDTH, Math.max(amplitude * 2, 1));+ }+ }+ }++ const minSilencePeaks = Math.round(SILENCE_MIN_SECONDS * peaksPerSecond);+ const silentSpans: Array<{ start: number; end: number }> = [];+ let runStart = -1;+ for (let i = 0; i <= audioPeaks.length; i++) {+ const silent = i < audioPeaks.length && audioPeaks[i] <= SILENCE_THRESHOLD;+ if (silent && runStart === -1) {+ runStart = i;+ } else if (!silent && runStart !== -1) {+ if (i - runStart >= minSilencePeaks) {+ silentSpans.push({ start: runStart, end: i });+ }+ runStart = -1;+ }+ }++ for (const span of silentSpans) {+ let i = span.start;+ while (i < span.end) {+ const row = Math.floor(i / peaksPerRow);+ const segEnd = Math.min(span.end, (row + 1) * peaksPerRow);+ const x = (i % peaksPerRow) * WAVEFORM_SAMPLE_WIDTH;+ const width = (segEnd - i) * WAVEFORM_SAMPLE_WIDTH;+ const top = waveformTopOf(row);++ ctx.fillStyle = 'rgba(255, 64, 64, 0.4)';+ ctx.fillRect(x, top, width, waveformHeight);++ i = segEnd;+ }+ }+}++type RulerLayout = {+ cells: number;+ columns: number;+ columnWidthInPixels: number;+ rowHeightInPixels: number;+ rulerHeight: number;+ secondsPerColumn: number;+ startOffset?: number;+};++function drawRuler(ctx: CanvasRenderingContext2D, layout: RulerLayout) {+ const { cells, columns, columnWidthInPixels, rowHeightInPixels, rulerHeight, secondsPerColumn, startOffset = 0 } = layout;++ const baseFontSize = Math.round(rulerHeight * 0.8);+ const leadFontSize = Math.round(rulerHeight * 0.9);+ const paddingLeft = 5;+ const paddingTop = 2;+ const tickHeight = Math.round(rulerHeight * 0.4);++ const rows = Math.ceil(cells / columns);+ const fullWidth = columns * columnWidthInPixels;+ ctx.strokeStyle = 'rgba(255, 64, 64, 1)';+ ctx.lineWidth = 2;+ for (let row = 1; row < rows; row++) {+ const y = row * rowHeightInPixels + 0.5;+ ctx.beginPath();+ ctx.moveTo(0, y);+ ctx.lineTo(fullWidth, y);+ ctx.stroke();+ }++ ctx.fillStyle = '#FFF';+ ctx.strokeStyle = '#FFF';+ ctx.lineWidth = 2;+ ctx.textBaseline = 'middle';+ ctx.textAlign = 'left';+ for (let i = 0; i < cells; i++) {+ const column = i % columns;+ const row = Math.floor(i / columns);+ const columnX = column * columnWidthInPixels;+ const rowTop = row * rowHeightInPixels;++ ctx.beginPath();+ ctx.moveTo(columnX + 0.5, rowTop + rulerHeight - tickHeight);+ ctx.lineTo(columnX + 0.5, rowTop + rulerHeight);+ ctx.stroke();++ ctx.font = column === 0+ ? `bold ${leadFontSize}px sans-serif`+ : `${baseFontSize}px sans-serif`;+ ctx.fillText(formatTimestamp(startOffset + i * secondsPerColumn, secondsPerColumn), columnX + paddingLeft, (rowTop + rulerHeight / 2) + paddingTop);+ }+}++type SamplerOptions = {+ peaksPerSecond: number;+ range?: [start: number, end: number]; // seconds; omitted = whole track+}++async function downsampleAudio(track: InputAudioTrack, options: SamplerOptions) {+ const sink = new AudioSampleSink(track);+ const iterator = options.range ? sink.samples(...options.range) : sink.samples();++ const peaks: Uint8ClampedArray<ArrayBuffer>[] = [];+ for await (const sample of iterator) {+ try {+ const size = sample.allocationSize({ format: 'f32', planeIndex: 0 });+ const floats = new Float32Array(size / Float32Array.BYTES_PER_ELEMENT);+ sample.copyTo(floats, { format: 'f32', planeIndex: 0 });++ const numChannels = sample.numberOfChannels;+ const numFrames = floats.length / numChannels;+ const duration = sample.duration;++ // Downsample to peaksPerSecond+ const targetPeaks = Math.ceil(duration * options.peaksPerSecond);+ const downsampledBytes = new Uint8ClampedArray(targetPeaks);++ // Downsample by calculating peaks directly for target positions+ const ratio = numFrames / targetPeaks;++ for (let i = 0; i < targetPeaks; i++) {+ const start = Math.floor(i * ratio);+ const end = Math.floor((i + 1) * ratio);+ let max = 0;++ for (let frameIdx = start; frameIdx < end && frameIdx < numFrames; frameIdx++) {+ for (let ch = 0; ch < numChannels; ch++) {+ const floatIdx = frameIdx * numChannels + ch;+ max = Math.max(max, Math.sqrt(Math.abs(floats[floatIdx])));+ }+ }++ downsampledBytes[i] = Math.floor(255 * max);+ }++ peaks.push(downsampledBytes);+ } finally {+ sample.close();+ }+ }++ const length = peaks.reduce((acc, peak) => acc + peak.length, 0);+ const mergedPeaks = new Uint8ClampedArray(length);++ let offset = 0;+ for (const peak of peaks) {+ mergedPeaks.set(peak, offset);+ offset += peak.length;+ }++ return mergedPeaks;+}diff --git a/apps/web/src/components/engine/utils/transition.ts b/apps/web/src/components/engine/utils/transition.tsnew file mode 100644index 00000000..a6a20414--- /dev/null+++ b/apps/web/src/components/engine/utils/transition.ts@@ -0,0 +1,34 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { EngineWorld } from '../api/world';++export type TransitionWindow = { start: number; end: number; midpointFrame: number };++/**+ * Compute the transition window between two adjacent clips.+ *+ * The left clip must have a Transition component.+ * Returns null if no transition is defined.+ */+export function getTransitionWindow(+ world: EngineWorld,+ leftEid: number,+ rightEid: number,+): TransitionWindow {+ const Transition = world.components.Transition;+ const Computed = world.components.Computed;++ const leftEnd = Computed.end[leftEid];+ const rightStart = Computed.start[rightEid];++ // Midpoint between the two clips, but never before the left clip ends+ const midpointFrame = Math.max(Math.floor((leftEnd + rightStart) / 2), leftEnd);++ const duration = Transition.duration[leftEid] ?? 1;+ const start = midpointFrame - duration / 2;+ const end = midpointFrame + duration / 2;++ return { start, end, midpointFrame };+}diff --git a/apps/web/src/components/footer/index.tsx b/apps/web/src/components/footer/index.tsxnew file mode 100644index 00000000..7fe30005--- /dev/null+++ b/apps/web/src/components/footer/index.tsx@@ -0,0 +1,114 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Icon } from "@/components/ui/icon";+import { useEngine } from "@/context/engine";+import { DEFAULT_TIMELINE_RESOLUTION, TIMELINE_RESOLUTION_RANGE, TIMELINE_PADDING_LEFT } from "../engine/timeline/config";+import { createEffect, createSignal } from "solid-js";+import { SliderThumb, SliderFill, SliderTrack, Slider } from "../ui/slider";+import { Button } from "../ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";+import { clamp } from "@/utils";+import { useAuth } from "@/context/auth";++const MIN_RES = 1 / TIMELINE_RESOLUTION_RANGE[1];+const MAX_RES = 1 / TIMELINE_RESOLUTION_RANGE[0];+const LOG_MIN = Math.log(MIN_RES);+const LOG_MAX = Math.log(MAX_RES);++function resToSlider(resolution: number): number {+ const clamped = Math.max(MIN_RES, Math.min(MAX_RES, resolution));+ return ((Math.log(clamped) - LOG_MIN) / (LOG_MAX - LOG_MIN)) * 100;+}++function sliderToRes(value: number): number {+ return Math.exp(LOG_MIN + (value / 100) * (LOG_MAX - LOG_MIN));+}++export function Footer() {+ const { world } = useEngine();+ const auth = useAuth();++ const c = world.components;++ const [value, setValue] = createSignal(25);++ createEffect(() => {+ const sid = world.timelineIndex().root;+ if (sid === null) return;+ setValue(resToSlider(c.Timeline.resolution[sid] ?? DEFAULT_TIMELINE_RESOLUTION));+ });++ createEffect(() => {+ const sid = world.timelineIndex().root;+ if (sid === null) return;++ const oldResolution = c.Timeline.resolution[sid] || DEFAULT_TIMELINE_RESOLUTION;+ const newResolution = sliderToRes(value());+ if (oldResolution === newResolution) return;++ // Zoom towards the playhead by adjusting scrollX+ const scrollX = c.Timeline.scrollX[sid] ?? 0;+ const playheadFrame = world.components.Computed.localTime[sid];+ const focalPixelX = (playheadFrame - scrollX) * oldResolution;++ let newScrollX = scrollX + focalPixelX / oldResolution - focalPixelX / newResolution;+ const minScrollX = -TIMELINE_PADDING_LEFT / newResolution;+ newScrollX = Math.max(minScrollX, newScrollX);++ c.Timeline.resolution[sid] = newResolution;+ c.Timeline.scrollX[sid] = newScrollX;+ }, { defer: true });++ const handleValueChange = (values: number[]) => setValue(clamp(values[0]!, 0, 100));++ return (+ <div class="bg-background flex items-center gap-px h-full col-full">+ {/* Left - Logo */}+ <div class="flex items-center gap-2 px-2 w-[264px] shrink-0">+ <div class="w-6 flex items-center justify-center">+ <Icon name="ds-mark-vector" class="size-3 text-muted-foreground" />+ </div>+ <span class="text-muted-foreground text-xs">+ {auth.isPro() ? "Diffusion Studio Pro" : "Diffusion Studio"}+ </span>+ </div>++ <div class="flex items-center gap-1.5 px-2">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ variant="ghost"+ size="icon"+ class="size-3 flex items-center justify-center rounded-[2px]"+ onClick={() => handleValueChange([value() - 10])}+ >+ <Icon name="small-timeline" class="size-3 text-muted-foreground shrink-0" />+ </TooltipTrigger>+ <TooltipContent>Zoom out timeline</TooltipContent>+ </Tooltip>++ <Slider value={[value()]} step={1} maxValue={100} class="w-[120px]" onChange={handleValueChange}>+ <SliderTrack>+ <SliderFill />+ <SliderThumb />+ </SliderTrack>+ </Slider>++ <Tooltip>+ <TooltipTrigger+ as={Button}+ variant="ghost"+ size="icon"+ class="size-3 flex items-center justify-center rounded-[2px]"+ onClick={() => handleValueChange([value() + 10])}+ >+ <Icon name="large-timeline" class="size-3 text-muted-foreground shrink-0" />+ </TooltipTrigger>+ <TooltipContent>Zoom in timeline</TooltipContent>+ </Tooltip>+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/genai/action-bar.tsx b/apps/web/src/components/genai/action-bar.tsxnew file mode 100644index 00000000..8ee688d3--- /dev/null+++ b/apps/web/src/components/genai/action-bar.tsx@@ -0,0 +1,283 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { Separator } from "@/components/ui/separator";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import {+ Dialog,+ DialogContent,+ DialogHeader,+ DialogPortal,+ DialogTitle,+} from "@/components/ui/dialog";+import { createMemo, Show } from "solid-js";+import { PaintType, isScene as isSceneEntity, isAudio } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { useRemoveBackground } from "./use-remove-background";+import { useUpscaleImage } from "./use-upscale-image";+import { useUpscaleVideo } from "./use-upscale-video";+import { useAddAudioToVideo } from "./use-add-audio-to-video";+import { useGenerationRecords } from "./use-generation-records";+import { useGenerateImage } from "./use-generate-image";+import { useGenerateVideo } from "./use-generate-video";+import { useGenerateVoice } from "./use-generate-voice";+import { useGenerateAudio } from "./use-generate-audio";+import { useAutoCaptions } from "./use-auto-captions";+import { createDefaultConfig } from "./prompt-input";+import { toast } from "somoto";+import { useECS } from "@/context/ecs";++import type { EngineWorld } from "@/components/engine";++import type { GenerationConfig } from "@/components/engine/db";++function getNodeMediaType(world: EngineWorld, eid: number) {+ const c = world.components;+ if (isAudio(world, eid)) {+ return "AUDIO";+ }+ for (const fid of c.Cache.fills[eid]) {+ if (c.Paint[fid] === PaintType.VIDEO) {+ return "VIDEO";+ }+ if (c.Paint[fid] === PaintType.IMAGE) {+ return "IMAGE";+ }+ }+ return null;+}++interface ActionBarProps {+ openPromptInput?(config: GenerationConfig): void;+}++export function ActionBar(props: ActionBarProps) {+ const { world } = useEngine();+ const { selectedNodes } = useECS();++ const { generate: upscaleImage } = useUpscaleImage();+ const { generate: upscaleVideo } = useUpscaleVideo();+ const { generate: addAudioToVideo } = useAddAudioToVideo();+ const { generate: removeBackground } = useRemoveBackground();+ const { generate: generateImage } = useGenerateImage();+ const { generate: generateVideo } = useGenerateVideo();+ const { generate: generateVoice } = useGenerateVoice();+ const { generate: generateAudio } = useGenerateAudio();+ const { generate: autoCaptions, status: autoCaptionsStatus } = useAutoCaptions();+ const { isGenerated, totalCredits, firstConfig } = useGenerationRecords();++ const autoCaptionsStatusText = createMemo(() => {+ switch (autoCaptionsStatus()) {+ case "encoding": return "Encoding audio…";+ case "uploading": return "Uploading audio…";+ case "transcribing": return "Transcribing audio…";+ default: return "";+ }+ });++ const isImage = createMemo(() => {+ return Array.from(selectedNodes()).some(eid => {+ const mediaType = getNodeMediaType(world, eid);+ return mediaType === "IMAGE";+ });+ });++ const isVideo = createMemo(() => {+ return Array.from(selectedNodes()).some(eid => {+ const mediaType = getNodeMediaType(world, eid);+ return mediaType === "VIDEO";+ });+ });++ const isScene = createMemo(() => {+ return Array.from(selectedNodes()).some(eid => isSceneEntity(world, eid));+ });++ const visible = createMemo(() => {+ return isImage() || isVideo() || isScene();+ })++ const handleRerun = () => {+ const config = firstConfig();+ if (!config) {+ toast("No generation config found", { description: "This asset wasn't generated with a prompt." });+ return;+ }++ const promise = (() => {+ switch (config.mode) {+ case "IMAGE":+ return generateImage(config);+ case "VIDEO":+ return generateVideo(config);+ case "VOICE":+ return generateVoice(config);+ case "AUDIO":+ return generateAudio(config);+ }+ })();++ promise.catch((err) => {+ toast("Rerun failed", {+ description: err instanceof Error ? err.message : String(err),+ });+ });+ };++ const handleEditWithPrompt = () => {+ props.openPromptInput?.(createDefaultConfig("IMAGE"));+ };++ const handleMakeVideo = () => {+ props.openPromptInput?.(createDefaultConfig("VIDEO"));+ };++ const handleReuse = () => {+ const config = firstConfig();+ if (!config) {+ toast("No generation config found", { description: "This asset wasn't generated with a prompt." });+ return;+ }+ props.openPromptInput?.(config);+ };++ const handleAutoCaptions = async () => {+ for (const eid of selectedNodes()) {+ if (isSceneEntity(world, eid)) {+ await autoCaptions(eid);+ }+ }+ };++ return (+ <>+ <Dialog open={autoCaptionsStatus() !== null}>+ <DialogPortal>+ <DialogContent class="sm:max-w-sm">+ <DialogHeader>+ <DialogTitle>Auto-Captions</DialogTitle>+ </DialogHeader>+ <div class="flex items-center gap-2 text-sm text-muted-foreground">+ <Icon name="spinner-loader" class="size-6 animate-spin" />+ {autoCaptionsStatusText()}+ </div>+ </DialogContent>+ </DialogPortal>+ </Dialog>+ <Show when={visible()}>+ <div class="absolute bottom-16 left-1/2 -translate-x-1/2 z-10 rounded-xl p-1 bg-background border border-border flex gap-1 items-center">+ <Show when={isScene()}>+ <Button variant="ghost" class="gap-0 pl-0.5 text-muted-foreground" onClick={handleAutoCaptions}>+ <Icon name="captions" />+ Auto-Captions+ </Button>+ </Show>+ <Show when={isImage()}>+ <div class="flex gap-1 items-center">+ <Button variant="ghost" class="gap-0 pl-0.5 text-muted-foreground" onClick={removeBackground}>+ <Icon name="ai-generate" />+ Remove background+ </Button>+ <Button variant="ghost" class="gap-0 pl-0.5 text-muted-foreground" onClick={upscaleImage}>+ <Icon name="arrow-scale" />+ Upscale+ </Button>+ </div>+ <Separator orientation="vertical" class="min-h-5" />+ <div class="flex gap-1 items-center">+ <Button variant="ghost" class="gap-0 pl-0.5 text-muted-foreground" onClick={handleEditWithPrompt}>+ <Icon name="ai-generate" />+ Edit with prompt+ </Button>+ <Show when={isGenerated()}>+ <DropdownMenu placement="right">+ <DropdownMenuTrigger<typeof Button>+ as={(triggerProps) => (+ <Button {...triggerProps} variant="ghost" class="gap-0 pr-0.5 text-muted-foreground">+ More+ <Icon name="chevron-down" />+ </Button>+ )}+ />+ <DropdownMenuPortal>+ <DropdownMenuContent>+ <div class="flex items-center gap-1 px-0 pr-2 h-7">+ <Icon name="ai-generate" class="size-6 text-muted-foreground" />+ <span class="text-xs text-muted-foreground">{totalCredits()} AI credits used</span>+ </div>+ <Separator class="my-1" />+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleMakeVideo}>+ <Icon name="film-video-export" class="size-6 mr-2 text-foreground" />+ Make video+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={handleRerun}>+ <Icon name="rerun" class="size-6 mr-2 text-foreground" />+ Rerun+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={handleReuse}>+ <Icon name="reuse-settings" class="size-6 mr-2 text-foreground" />+ Reuse+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </Show>+ </div>+ </Show>+ <Show when={isVideo()}>+ <div class="flex gap-1 items-center">+ <Button variant="ghost" class="gap-0 pl-0.5 text-muted-foreground" onClick={addAudioToVideo}>+ <Icon name="generate-audio" />+ Add audio+ </Button>+ <Button variant="ghost" class="gap-0 pl-0.5 text-muted-foreground" onClick={upscaleVideo}>+ <Icon name="arrow-scale" />+ Upscale+ </Button>+ <Show when={isGenerated()}>+ <Separator orientation="vertical" class="min-h-5" />+ <DropdownMenu placement="right">+ <DropdownMenuTrigger<typeof Button>+ as={(triggerProps) => (+ <Button {...triggerProps} variant="ghost" class="gap-0 pr-0.5 text-muted-foreground">+ More+ <Icon name="chevron-down" />+ </Button>+ )}+ />+ <DropdownMenuPortal>+ <DropdownMenuContent>+ <div class="flex items-center gap-1 px-0 pr-2 h-7">+ <Icon name="ai-generate" class="size-6 text-muted-foreground" />+ <span class="text-xs text-muted-foreground">{totalCredits()} AI credits used</span>+ </div>+ <Separator class="my-1" />+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleRerun}>+ <Icon name="rerun" class="size-6 mr-2 text-foreground" />+ Rerun+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </Show>+ </div>+ </Show>+ </div>+ </Show>+ </>+ );+}diff --git a/apps/web/src/components/genai/config.ts b/apps/web/src/components/genai/config.tsnew file mode 100644index 00000000..c1deb1c6--- /dev/null+++ b/apps/web/src/components/genai/config.ts@@ -0,0 +1,355 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export const PROMPT_INPUT_MODE_OPTIONS = [+ { value: "IMAGE", label: "Image", icon: "image" },+ { value: "VIDEO", label: "Video", icon: "film-video-export" },+ { value: "VOICE", label: "Voice", icon: "voice" },+ { value: "AUDIO", label: "Audio", icon: "audio" },+];++export const PROMPT_INPUT_IMAGE_ASPECT_RATIO_OPTIONS = [+ { value: "16:9", label: "16:9 \u00B7 Wide", triggerLabel: "16:9", icon: "aspect-ratio-16-9" },+ { value: "9:16", label: "9:16 \u00B7 Vertical", triggerLabel: "9:16", icon: "aspect-ratio-9-16" },+ { value: "1:1", label: "1:1 \u00B7 Square", triggerLabel: "1:1", icon: "aspect-ratio-1-1" },+ { value: "4:3", label: "4:3 \u00B7 Classic", triggerLabel: "4:3", icon: "aspect-ratio-4-3" },+ { value: "3:4", label: "3:4 \u00B7 Tall", triggerLabel: "3:4", icon: "aspect-ratio-3-4" },+];++export const ALL_VIDEO_ASPECT_RATIO_OPTIONS = [+ { value: "16:9", label: "16:9 \u00B7 Wide", triggerLabel: "16:9", icon: "aspect-ratio-16-9" },+ { value: "9:16", label: "9:16 \u00B7 Vertical", triggerLabel: "9:16", icon: "aspect-ratio-9-16" },+ { value: "1:1", label: "1:1 \u00B7 Square", triggerLabel: "1:1", icon: "aspect-ratio-1-1" },+ { value: "4:3", label: "4:3 \u00B7 Classic", triggerLabel: "4:3", icon: "aspect-ratio-4-3" },+ { value: "3:4", label: "3:4 \u00B7 Tall", triggerLabel: "3:4", icon: "aspect-ratio-3-4" },+];++export const PROMPT_INPUT_VARIANT_COUNT_OPTIONS = [+ { value: "1", label: "1" },+ { value: "2", label: "2" },+ { value: "3", label: "3" },+ { value: "4", label: "4" },+];++export const ALL_DURATION_OPTIONS = [+ { value: "3s", label: "3s" },+ { value: "4s", label: "4s" },+ { value: "5s", label: "5s" },+ { value: "6s", label: "6s" },+ { value: "7s", label: "7s" },+ { value: "8s", label: "8s" },+ { value: "9s", label: "9s" },+ { value: "10s", label: "10s" },+ { value: "11s", label: "11s" },+ { value: "12s", label: "12s" },+ { value: "13s", label: "13s" },+ { value: "14s", label: "14s" },+ { value: "15s", label: "15s" },+];++export const PROMPT_INPUT_RESOLUTION_OPTIONS = [+ { value: "4K", label: "4K" },+ { value: "1440p", label: "1440p" },+ { value: "1080p", label: "1080p" },+ { value: "720p", label: "720p" },+];++export const PROMPT_INPUT_IMAGE_MODEL_OPTIONS = [+ {+ name: "FLUX.2 [DEV] Turbo",+ id: "flux-2-turbo",+ icon: "large-bfl",+ description: "Low budget, high quality, fast turbo mode.",+ },+ {+ name: "GPT Image 2",+ id: "gpt-image-2",+ icon: "large-openai",+ description: "Flexible sizes up to 4K, true aspect ratios.",+ },+ {+ name: "Nano Banana 2",+ id: "nano-banana-2",+ icon: "large-google",+ description: "Fast, high quality, flexible edits.",+ },+ {+ name: "Nano Banana Pro",+ id: "nano-banana-pro",+ icon: "large-google",+ description: "Pro control, readable text, ultra consistent.",+ },+ {+ name: "Seedream 4.5",+ id: "seedream-4.5",+ icon: "large-bytedance",+ description: "Up to 4K, multi image edits, strong text.",+ },+];++export type VideoModelFeature = "start-frame" | "end-frame" | "audio";++export type VideoModelOption = {+ name: string;+ id: string;+ icon: string;+ description: string;+ features: VideoModelFeature[];+ durations: string[];+ aspectRatios: string[];+};++export const PROMPT_INPUT_VIDEO_MODEL_OPTIONS: VideoModelOption[] = [+ {+ name: "Kling 3.0",+ id: "kling-3-pro",+ icon: "large-kling",+ description: "Cinematic motion with built-in audio.",+ features: ["start-frame", "end-frame", "audio"],+ durations: ["3s", "4s", "5s", "6s", "7s", "8s", "9s", "10s", "11s", "12s", "13s", "14s", "15s"],+ aspectRatios: ["16:9", "9:16", "1:1"],+ },+ {+ name: "Kling 3.0 Omni",+ id: "kling-o3-pro",+ icon: "large-kling",+ description: "Multi-modal reasoning, strong scenes.",+ features: ["start-frame", "end-frame", "audio"],+ durations: ["3s", "4s", "5s", "6s", "7s", "8s", "9s", "10s", "11s", "12s", "13s", "14s", "15s"],+ aspectRatios: ["16:9", "9:16", "1:1"],+ },+ {+ name: "Kling 2.5 Turbo",+ id: "kling-2.5-turbo",+ icon: "large-kling",+ description: "Fast and affordable for quick iterations.",+ features: ["start-frame", "end-frame", "audio"],+ durations: ["5s", "10s"],+ aspectRatios: ["16:9", "9:16", "1:1"],+ },+ {+ name: "Seedance 2.0",+ id: "seedance-2.0",+ icon: "large-bytedance",+ description: "Rich motion, lip-synced audio and SFX.",+ features: ["start-frame", "end-frame", "audio"],+ durations: ["4s", "5s", "6s", "7s", "8s", "9s", "10s", "11s", "12s", "13s", "14s", "15s"],+ aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"],+ },+ {+ name: "Veo 3.1",+ id: "veo-3.1",+ icon: "large-google",+ description: "Realistic physics, complex scenes.",+ features: ["start-frame", "end-frame"],+ durations: ["4s", "6s", "8s"],+ aspectRatios: ["16:9", "9:16"],+ },+ {+ name: "Veo 3.1 Fast",+ id: "veo-3.1-fast",+ icon: "large-google",+ description: "Same Veo engine, lower cost.",+ features: ["start-frame", "end-frame"],+ durations: ["4s", "6s", "8s"],+ aspectRatios: ["16:9", "9:16"],+ },+ {+ name: "Wan 2.6",+ id: "wan-2.6",+ icon: "large-wan",+ description: "Expressive motion, stylized aesthetics.",+ features: ["start-frame"],+ durations: ["5s", "10s", "15s"],+ aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"],+ },+ {+ name: "Hailuo 2.3",+ id: "hailuo-2.3",+ icon: "large-hailuo",+ description: "Smooth motion, cinematic lighting.",+ features: ["start-frame"],+ durations: ["5s"],+ aspectRatios: ["16:9"],+ },+];++export const PROMPT_INPUT_VOICE_OPTIONS = [+ {+ value: "CwhRBWXzGAHq8TQ4Fs17",+ label: "Roger",+ thumbnail: new URL("@/assets/images/voice-thumbnails/0.png", import.meta.url).href,+ description: "Laid-back, casual, resonant.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/CwhRBWXzGAHq8TQ4Fs17/58ee3ff5-f6f2-4628-93b8-e38eb31806b0.mp3",+ },+ {+ value: "EXAVITQu4vr4xnSDxMaL",+ label: "Sarah",+ thumbnail: new URL("@/assets/images/voice-thumbnails/1.png", import.meta.url).href,+ description: "Mature, reassuring, confident.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/EXAVITQu4vr4xnSDxMaL/01a3e33c-6e99-4ee7-8543-ff2216a32186.mp3",+ },+ {+ value: "FGY2WhTYpPnrIDTdsKH5",+ label: "Laura",+ thumbnail: new URL("@/assets/images/voice-thumbnails/2.png", import.meta.url).href,+ description: "Enthusiast, quirky attitude.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/FGY2WhTYpPnrIDTdsKH5/67341759-ad08-41a5-be6e-de12fe448618.mp3",+ },+ {+ value: "IKne3meq5aSn9XLyUdCD",+ label: "Charlie",+ thumbnail: new URL("@/assets/images/voice-thumbnails/3.png", import.meta.url).href,+ description: "Deep, confident, energetic.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/IKne3meq5aSn9XLyUdCD/102de6f2-22ed-43e0-a1f1-111fa75c5481.mp3",+ },+ {+ value: "JBFqnCBsd6RMkjVDRZzb",+ label: "George",+ thumbnail: new URL("@/assets/images/voice-thumbnails/4.png", import.meta.url).href,+ description: "Warm, captivating storyteller.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/JBFqnCBsd6RMkjVDRZzb/e6206d1a-0721-4787-aafb-06a6e705cac5.mp3",+ },+ {+ value: "N2lVS1w4EtoT3dr4eOWO",+ label: "Callum",+ thumbnail: new URL("@/assets/images/voice-thumbnails/5.png", import.meta.url).href,+ description: "Husky trickster.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/N2lVS1w4EtoT3dr4eOWO/ac833bd8-ffda-4938-9ebc-b0f99ca25481.mp3",+ },+ {+ value: "SAz9YHcvj6GT2YYXdXww",+ label: "River",+ thumbnail: new URL("@/assets/images/voice-thumbnails/6.png", import.meta.url).href,+ description: "Relaxed, neutral, informative.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/SAz9YHcvj6GT2YYXdXww/e6c95f0b-2227-491a-b3d7-2249240decb7.mp3",+ },+ {+ value: "SOYHLrjzK2X1ezoPC6cr",+ label: "Harry",+ thumbnail: new URL("@/assets/images/voice-thumbnails/7.png", import.meta.url).href,+ description: "Fierce warrior.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/SOYHLrjzK2X1ezoPC6cr/86d178f6-f4b6-4e0e-85be-3de19f490794.mp3",+ },+ {+ value: "TX3LPaxmHKxFdv7VOQHJ",+ label: "Liam",+ thumbnail: new URL("@/assets/images/voice-thumbnails/8.png", import.meta.url).href,+ description: "Energetic, social media creator.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/TX3LPaxmHKxFdv7VOQHJ/63148076-6363-42db-aea8-31424308b92c.mp3",+ },+ {+ value: "Xb7hH8MSUJpSbSDYk0k2",+ label: "Alice",+ thumbnail: new URL("@/assets/images/voice-thumbnails/9.png", import.meta.url).href,+ description: "Clear, engaging educator.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/Xb7hH8MSUJpSbSDYk0k2/d10f7534-11f6-41fe-a012-2de1e482d336.mp3",+ },+ {+ value: "XrExE9yKIg1WjnnlVkGX",+ label: "Matilda",+ thumbnail: new URL("@/assets/images/voice-thumbnails/10.png", import.meta.url).href,+ description: "Knowledgeable, professional.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/XrExE9yKIg1WjnnlVkGX/b930e18d-6b4d-466e-bab2-0ae97c6d8535.mp3",+ },+ {+ value: "bIHbv24MWmeRgasZH58o",+ label: "Will",+ thumbnail: new URL("@/assets/images/voice-thumbnails/11.png", import.meta.url).href,+ description: "Relaxed optimist.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/bIHbv24MWmeRgasZH58o/8caf8f3d-ad29-4980-af41-53f20c72d7a4.mp3",+ },+ {+ value: "cgSgspJ2msm6clMCkdW9",+ label: "Jessica",+ thumbnail: new URL("@/assets/images/voice-thumbnails/12.png", import.meta.url).href,+ description: "Playful, bright, warm.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/cgSgspJ2msm6clMCkdW9/56a97bf8-b69b-448f-846c-c3a11683d45a.mp3",+ },+ {+ value: "cjVigY5qzO86Huf0OWal",+ label: "Eric",+ thumbnail: new URL("@/assets/images/voice-thumbnails/13.png", import.meta.url).href,+ description: "Smooth, trustworthy.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/cjVigY5qzO86Huf0OWal/d098fda0-6456-4030-b3d8-63aa048c9070.mp3",+ },+ {+ value: "hpp4J3VqNfWAUOO0d1Us",+ label: "Bella",+ thumbnail: new URL("@/assets/images/voice-thumbnails/14.png", import.meta.url).href,+ description: "Professional, bright, warm.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/hpp4J3VqNfWAUOO0d1Us/dab0f5ba-3aa4-48a8-9fad-f138fea1126d.mp3",+ },+ {+ value: "iP95p4xoKVk53GoZ742B",+ label: "Chris",+ thumbnail: new URL("@/assets/images/voice-thumbnails/15.png", import.meta.url).href,+ description: "Charming, down-to-earth.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/iP95p4xoKVk53GoZ742B/3f4bde72-cc48-40dd-829f-57fbf906f4d7.mp3",+ },+ {+ value: "nPczCjzI2devNBz1zQrb",+ label: "Brian",+ thumbnail: new URL("@/assets/images/voice-thumbnails/16.png", import.meta.url).href,+ description: "Deep, resonant, comforting.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/nPczCjzI2devNBz1zQrb/2dd3e72c-4fd3-42f1-93ea-abc5d4e5aa1d.mp3",+ },+ {+ value: "onwK4e9ZLuTAKqWW03F9",+ label: "Daniel",+ thumbnail: new URL("@/assets/images/voice-thumbnails/17.png", import.meta.url).href,+ description: "Steady broadcaster.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/onwK4e9ZLuTAKqWW03F9/7eee0236-1a72-4b86-b303-5dcadc007ba9.mp3",+ },+ {+ value: "pFZP5JQG7iQjIQuC4Bku",+ label: "Lily",+ thumbnail: new URL("@/assets/images/voice-thumbnails/0.png", import.meta.url).href,+ description: "Velvety actress.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/pFZP5JQG7iQjIQuC4Bku/89b68b35-b3dd-4348-a84a-a3c13a3c2b30.mp3",+ },+ {+ value: "pNInz6obpgDQGcFmaJgB",+ label: "Adam",+ thumbnail: new URL("@/assets/images/voice-thumbnails/1.png", import.meta.url).href,+ description: "Dominant, firm.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/pNInz6obpgDQGcFmaJgB/d6905d7a-dd26-4187-bfff-1bd3a5ea7cac.mp3",+ },+ {+ value: "pqHfZKP75CvOlQylNhV4",+ label: "Bill",+ thumbnail: new URL("@/assets/images/voice-thumbnails/2.png", import.meta.url).href,+ description: "Wise, mature, balanced.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/premade/voices/pqHfZKP75CvOlQylNhV4/d782b3ff-84ba-4029-848c-acf01285524d.mp3",+ },+ {+ value: "wBXNqKUATyqu0RtYt25i",+ label: "Adam",+ thumbnail: new URL("@/assets/images/voice-thumbnails/3.png", import.meta.url).href,+ description: "Natural, versatile narrator.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/database/workspace/1b0aef06ad1848988df4847a8d377baf/voices/wBXNqKUATyqu0RtYt25i/92f83238-5f85-4793-ba6b-dc2cdc482735.mp3",+ },+ {+ value: "YtJ0uNlI0V9EhriZURew",+ label: "Lyle",+ thumbnail: new URL("@/assets/images/voice-thumbnails/4.png", import.meta.url).href,+ description: "Smooth, laid-back storyteller.",+ previewUrl: "https://storage.googleapis.com/eleven-public-prod/a6rzPVLi6gZYAP7IeBh5vjiIy2m2/voices/j7glXIoxefnytpNmZKtl/6dda088e-7fbd-44b0-a26b-60cf4618dbf6.mp3",+ },+];++export const PROMPT_INPUT_AUDIO_MODEL_OPTIONS = [+ {+ name: "ElevenLabs Music",+ id: "elevenlabs-music",+ icon: "large-elevenlabs",+ description: "Full compositions, stems, and lyrics.",+ },+ {+ name: "ElevenLabs SFX",+ id: "elevenlabs-sfx",+ icon: "large-elevenlabs",+ description: "Sound effects up to 30s, seamless looping.",+ },+];diff --git a/apps/web/src/components/genai/index.ts b/apps/web/src/components/genai/index.tsnew file mode 100644index 00000000..6021e1f4--- /dev/null+++ b/apps/web/src/components/genai/index.ts@@ -0,0 +1,6 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from "./action-bar";+export * from "./prompt-input";\ No newline at end of filediff --git a/apps/web/src/components/genai/prompt-input-actions.tsx b/apps/web/src/components/genai/prompt-input-actions.tsxnew file mode 100644index 00000000..e0ce85a3--- /dev/null+++ b/apps/web/src/components/genai/prompt-input-actions.tsx@@ -0,0 +1,176 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { Separator } from "@/components/ui/separator";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { createMemo, Show } from "solid-js";+import { toast } from "somoto";++import { PaintType } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { useUpscaleImage } from "./use-upscale-image";+import { useUpscaleVideo } from "./use-upscale-video";+import { useAddAudioToVideo } from "./use-add-audio-to-video";+import { useRemoveBackground } from "./use-remove-background";+import { useGenerationRecords } from "./use-generation-records";+import { useGenerateImage } from "./use-generate-image";+import { useGenerateVideo } from "./use-generate-video";+import { useGenerateVoice } from "./use-generate-voice";+import { useGenerateAudio } from "./use-generate-audio";+import { useECS } from "@/context/ecs";++export function PromptInputActions() {+ const { world } = useEngine();+ const { selectedNodes } = useECS();+ const { isGenerated, totalCredits, firstConfig } = useGenerationRecords();++ const { generate: upscaleImage } = useUpscaleImage();+ const { generate: upscaleVideo } = useUpscaleVideo();+ const { generate: addAudioToVideo } = useAddAudioToVideo();+ const { generate: removeBackground } = useRemoveBackground();+ const { generate: generateImage } = useGenerateImage();+ const { generate: generateVideo } = useGenerateVideo();+ const { generate: generateVoice } = useGenerateVoice();+ const { generate: generateAudio } = useGenerateAudio();++ const hasImageSelection = createMemo(() => {+ const Fills = world.components.Cache.fills;+ const Paint = world.components.Paint;+ for (const eid of selectedNodes()) {+ for (const fid of Fills[eid] ?? []) {+ if (Paint[fid] === PaintType.IMAGE) return true;+ }+ }+ return false;+ });++ const hasVideoSelection = createMemo(() => {+ const Fills = world.components.Cache.fills;+ const Paint = world.components.Paint;+ for (const eid of selectedNodes()) {+ for (const fid of Fills[eid] ?? []) {+ if (Paint[fid] === PaintType.VIDEO) return true;+ }+ }+ return false;+ });++ const handleRerun = () => {+ const config = firstConfig();+ if (!config) {+ toast("No generation config found", {+ description: "This asset wasn't generated with a prompt.",+ });+ return;+ }++ const promise = (() => {+ switch (config.mode) {+ case "IMAGE":+ return generateImage(config);+ case "VIDEO":+ return generateVideo(config);+ case "VOICE":+ return generateVoice(config);+ case "AUDIO":+ return generateAudio(config);+ }+ })();++ promise.catch((err) => {+ toast("Rerun failed", {+ description: err instanceof Error ? err.message : String(err),+ });+ });+ };++ return (+ <Show when={hasImageSelection() || hasVideoSelection()}>+ <div class="flex w-full items-center justify-end gap-1 absolute top-2 right-2">+ <Show when={isGenerated()}>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ variant="ghost"+ size="icon"+ class="text-muted-foreground"+ onClick={handleRerun}+ >+ <Icon name="rerun" />+ </TooltipTrigger>+ <TooltipContent>Rerun</TooltipContent>+ </Tooltip>+ <Separator orientation="vertical" class="min-h-5" />+ </Show>+ <DropdownMenu placement="right-start">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ {...buttonProps}+ variant="ghost"+ size="icon"+ class="text-muted-foreground"+ >+ <Icon name="chevron-down" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>More options</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent>+ <Show when={isGenerated()}>+ <div class="flex items-center gap-1 px-0 pr-2 h-7">+ <Icon name="ai-generate" class="text-muted-foreground" />+ <span class="text-xs text-muted-foreground">+ {totalCredits()} AI credits used+ </span>+ </div>+ <Separator class="my-1" />+ </Show>+ <DropdownMenuGroup>+ <Show when={hasImageSelection()}>+ <DropdownMenuItem onSelect={upscaleImage}>+ <Icon name="arrow-scale" class="mr-2 text-foreground" />+ Upscale+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={removeBackground}>+ <Icon name="ai-generate" class="mr-2 text-foreground" />+ Remove background+ </DropdownMenuItem>+ </Show>+ <Show when={hasVideoSelection()}>+ <DropdownMenuItem onSelect={upscaleVideo}>+ <Icon name="arrow-scale" class="mr-2 text-foreground" />+ Upscale+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={addAudioToVideo}>+ <Icon name="audio-on" class="mr-2 text-foreground" />+ Add audio+ </DropdownMenuItem>+ </Show>+ </DropdownMenuGroup>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </div>+ </Show>+ );+}diff --git a/apps/web/src/components/genai/prompt-input.tsx b/apps/web/src/components/genai/prompt-input.tsxnew file mode 100644index 00000000..ebd0b344--- /dev/null+++ b/apps/web/src/components/genai/prompt-input.tsx@@ -0,0 +1,1120 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { Icon } from "@/components/ui/icon";+import { SearchInput } from "@/components/ui/search-input";+import { Button } from "@/components/ui/button";+import { Popover, PopoverContent, PopoverPortal, PopoverTrigger } from "@/components/ui/popover";+import { Separator } from "@/components/ui/separator";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { cx } from "@/lib/cva";+import {+ For,+ Show,+ Match,+ Switch,+ createMemo,+ createSignal,+ onCleanup,+ type Accessor,+} from "solid-js";++import {+ PROMPT_INPUT_IMAGE_MODEL_OPTIONS,+ PROMPT_INPUT_VIDEO_MODEL_OPTIONS,+ PROMPT_INPUT_VOICE_OPTIONS,+ PROMPT_INPUT_MODE_OPTIONS,+ PROMPT_INPUT_IMAGE_ASPECT_RATIO_OPTIONS,+ PROMPT_INPUT_VARIANT_COUNT_OPTIONS,+ ALL_VIDEO_ASPECT_RATIO_OPTIONS,+ ALL_DURATION_OPTIONS,+ PROMPT_INPUT_AUDIO_MODEL_OPTIONS,+ // PROMPT_INPUT_RESOLUTION_OPTIONS+} from "./config";+import { createStoredSignal } from "@/lib/store";+import { store } from "@/init";+import { toast } from "somoto";+import { useGenerateImage } from "./use-generate-image";+import { useGenerateVideo } from "./use-generate-video";+import { useGenerateVoice } from "./use-generate-voice";+import { useGenerateAudio } from "./use-generate-audio";+import { PromptInputActions } from "./prompt-input-actions";+import { useEngine } from "@/context/engine";+import { showFileDialog } from "@/utils";+import type {+ Asset,+ AspectRatio,+ GenerationConfig,+ ImageGenerationConfig,+ VideoGenerationConfig,+ VoiceGenerationConfig,+ AudioGenerationConfig,+} from "@/components/engine/db";+import { AssetThumbnail } from "@/components/ui/asset-thumbnail";+import { ChildOf, PaintType, removeComponent } from "@/components/engine";+import { useAssets, loadAsset } from "@/components/engine";+import { useECS } from "@/context/ecs";+import { Not, query } from 'bitecs';++export type PromptInputMode = "IMAGE" | "VIDEO" | "VOICE" | "AUDIO";++const DEFAULT_BUTTON_CLASS = "text-muted-foreground gap-0 pr-2 pl-0";+const MAX_IMAGE_REFERENCES = 5;++type GenerationConfgs = {+ IMAGE: ImageGenerationConfig;+ VIDEO: VideoGenerationConfig;+ VOICE: VoiceGenerationConfig;+ AUDIO: AudioGenerationConfig;+};++export function createDefaultConfig<K extends keyof GenerationConfgs>(mode: K, prompt = ""): GenerationConfgs[K] {+ switch (mode) {+ case "IMAGE":+ return {+ mode: "IMAGE",+ model: PROMPT_INPUT_IMAGE_MODEL_OPTIONS[0].id,+ prompt,+ aspectRatio: "16:9",+ count: 1,+ } as GenerationConfgs[K];+ case "VIDEO":+ return {+ mode: "VIDEO",+ model: PROMPT_INPUT_VIDEO_MODEL_OPTIONS[0].id,+ prompt,+ aspectRatio: "16:9",+ duration: 6,+ generateAudio: true,+ } as GenerationConfgs[K];+ case "VOICE":+ return {+ mode: "VOICE",+ model: "elevenlabs-v3",+ prompt,+ voice: PROMPT_INPUT_VOICE_OPTIONS[0].value,+ } as GenerationConfgs[K];+ case "AUDIO":+ return {+ mode: "AUDIO",+ model: PROMPT_INPUT_AUDIO_MODEL_OPTIONS[0].id,+ prompt,+ } as GenerationConfgs[K];+ }+}++export interface PromptInputProps {+ initialConfig?: GenerationConfig;+}++export function PromptInput(props: PromptInputProps) {+ const { world } = useEngine();+ const assets = useAssets(world);+ const { selectedNodes } = useECS();+ const c = world.components;+ const { generate: generateImage } = useGenerateImage();+ const { generate: generateVideo } = useGenerateVideo();+ const { generate: generateVoice } = useGenerateVoice();+ const { generate: generateAudio } = useGenerateAudio();++ let textareaRef!: HTMLTextAreaElement;+ let dragCounter = 0;+ const [isDragging, setIsDragging] = createSignal(false);++ const [config, setConfig] = createSignal<GenerationConfig>(+ props.initialConfig ?? createDefaultConfig("IMAGE"),+ );++ /** Shallow-merge updates into the current config. */+ const patch = (updates: Partial<GenerationConfig>) => {+ setConfig((prev) => ({ ...prev, ...updates }) as GenerationConfig);+ };++ const mode = () => config().mode;+ const prompt = () => config().prompt;++ // These are only read inside their matching <Match when={mode() === …}>+ // blocks, so the narrowing is sound.+ const imageConfig = () => {+ const c = config();+ return c.mode === "IMAGE" ? c : undefined;+ };+ const videoConfig = () => {+ const c = config();+ return c.mode === "VIDEO" ? c : undefined;+ };+ const voiceConfig = () => {+ const c = config();+ return c.mode === "VOICE" ? c : undefined;+ };++ const currentVideoModel = createMemo(() =>+ PROMPT_INPUT_VIDEO_MODEL_OPTIONS.find((m) => m.id === config().model),+ );++ const videoDurationOptions = createMemo(() => {+ const model = currentVideoModel();+ return model ? ALL_DURATION_OPTIONS.filter((o) => model.durations.includes(o.value)) : [];+ });++ const videoAspectRatioOptions = createMemo(() => {+ const model = currentVideoModel();+ return model ? ALL_VIDEO_ASPECT_RATIO_OPTIONS.filter((o) => model.aspectRatios.includes(o.value)) : [];+ });++ const selectedImageEntries = createMemo(() => {+ const entries: { assetId: string; eid: number }[] = [];+ const AssetId = world.components.AssetId;+ for (const eid of selectedNodes()) {+ for (const fid of query(world, [c.Paint, ChildOf(eid), Not(c.Deleted), Not(c.Hidden)])) {+ if (c.Paint[fid] === PaintType.IMAGE) {+ const assetId = AssetId[fid];+ if (!assetId) continue;+ entries.push({ assetId, eid });+ break; // we just need the first image fill+ }+ }+ }+ return entries;+ });++ const selectedImageIds = createMemo(() =>+ selectedImageEntries().map((e) => e.assetId),+ );++ const effectiveImageRefIds = createMemo(() => {+ const local = imageConfig()?.imageRefIds ?? [];+ const selected = selectedImageIds().filter((id) => !local.includes(id));+ return [...local, ...selected]+ .filter((id) => assets.get(id))+ .slice(0, MAX_IMAGE_REFERENCES);+ });++ const effectiveStartFrameId = createMemo(() => {+ const id = videoConfig()?.startFrameImageId ?? selectedImageIds()[0] ?? null;+ return id && assets.get(id) ? id : null;+ });++ const effectiveEndFrameId = createMemo(() => {+ const id = videoConfig()?.endFrameImageId ?? selectedImageIds()[1] ?? null;+ return id && assets.get(id) ? id : null;+ });++ const [recentPrompts, setRecentPrompts] = createStoredSignal(+ store.define<string[]>("prompt-input.recent-prompts", []),+ );+ const [slashMenuDismissed, setSlashMenuDismissed] = createSignal(false);+ const [slashMenuIndex, setSlashMenuIndex] = createSignal(-1);+ const [settingsVisible, setSettingsVisible] = createStoredSignal(+ store.define("prompt-input.settings-visible", false),+ );++ const hasPromptText = () => prompt().trim().length > 0;+ const showSlashMenu = () =>+ prompt().startsWith("/") && !slashMenuDismissed() && recentPrompts().length > 0;++ const handlePromptInput = (event: InputEvent & { currentTarget: HTMLTextAreaElement }) => {+ patch({ prompt: event.currentTarget.value });+ setSlashMenuDismissed(false);+ setSlashMenuIndex(-1);+ resizeTextarea();+ };++ const handleModeChange = (value: string) => {+ const newMode = value as PromptInputMode;+ if (newMode === mode()) return;+ setConfig(createDefaultConfig(newMode, prompt()));+ };++ const removeImageReference = (assetId: string) => {+ const refs = imageConfig()?.imageRefIds ?? [];+ if (refs.includes(assetId)) {+ patch({ imageRefIds: refs.filter((id) => id !== assetId) });+ return;+ }+ const entry = selectedImageEntries().find((e) => e.assetId === assetId);+ if (entry) {+ removeComponent(world, entry.eid, c.Selected, false);+ }+ };++ const openImageReferencesPicker = async () => {+ if (effectiveImageRefIds().length >= MAX_IMAGE_REFERENCES) return;+ const handles = await showFileDialog("image/*");+ if (handles.length === 0) return;++ try {+ const loadedAssets = await Promise.all(handles.map((handle) => loadAsset(world, handle)));+ const imageAssets = loadedAssets.filter((a) => a.type === "IMAGE");+ const current = imageConfig()?.imageRefIds ?? [];+ patch({+ imageRefIds: [...current, ...imageAssets.map((a) => a.id)].slice(0, MAX_IMAGE_REFERENCES),+ });+ } catch (e) {+ toast("Failed to import assets", {+ description: (e as Error).message,+ });+ }+ };++ const openVideoFramePicker = async (frame: "start" | "end") => {+ const handles = await showFileDialog("image/*", false);+ if (handles.length !== 1) return;++ try {+ const loadedAsset = await loadAsset(world, handles[0]!);+ if (loadedAsset.type !== "IMAGE") return;+ if (frame === "start") {+ patch({ startFrameImageId: loadedAsset.id });+ } else {+ patch({ endFrameImageId: loadedAsset.id });+ }+ } catch (e) {+ toast("Failed to import assets", {+ description: (e as Error).message,+ });+ }+ };++ const swapVideoFrameImages = () => {+ const c = videoConfig();+ patch({+ startFrameImageId: c?.endFrameImageId,+ endFrameImageId: c?.startFrameImageId,+ });+ };++ const clearVideoFrame = (frame: "start" | "end") => {+ const explicitId =+ frame === "start" ? videoConfig()?.startFrameImageId : videoConfig()?.endFrameImageId;+ if (explicitId) {+ patch(frame === "start" ? { startFrameImageId: undefined } : { endFrameImageId: undefined });+ return;+ }+ // The frame is being shown from a selected canvas entity, so clearing it+ // means deselecting that entity (mirrors removeImageReference).+ const entry = frame === "start" ? selectedImageEntries()[0] : selectedImageEntries()[1];+ if (entry) {+ removeComponent(world, entry.eid, c.Selected, false);+ }+ };++ const resizeTextarea = () => {+ textareaRef.style.height = "auto";+ textareaRef.style.height = `${textareaRef.scrollHeight}px`;+ };++ const handleSelectRecentPrompt = (prompt: string) => {+ patch({ prompt });+ setSlashMenuDismissed(true);+ resizeTextarea();+ };++ const handleClearHistory = () => {+ setRecentPrompts([]);+ };++ const handleSubmit = async () => {+ if (!hasPromptText()) return;++ const currentConfig = { ...config(), prompt: prompt().trim() };++ // Add to recent prompts+ const filtered = recentPrompts().filter((p) => p !== currentConfig.prompt);+ setRecentPrompts([currentConfig.prompt, ...filtered].slice(0, 10));++ patch({ prompt: "" });+ resizeTextarea();++ const promise = (() => {+ switch (currentConfig.mode) {+ case "IMAGE":+ return generateImage({+ ...currentConfig,+ imageRefIds: effectiveImageRefIds(),+ });+ case "VIDEO":+ return generateVideo({+ ...currentConfig,+ startFrameImageId: effectiveStartFrameId() || undefined,+ endFrameImageId: effectiveEndFrameId() || undefined,+ });+ case "VOICE":+ return generateVoice(currentConfig);+ case "AUDIO":+ return generateAudio(currentConfig);+ }+ })();++ promise.catch((err) => {+ toast("Generation failed", {+ description: err instanceof Error ? err.message : String(err),+ });+ });+ };++ const handleKeyDown = (e: KeyboardEvent) => {+ if (showSlashMenu()) {+ const count = recentPrompts().length;+ if (e.key === "ArrowUp") {+ e.preventDefault();+ setSlashMenuIndex((i) => (i <= 0 ? count - 1 : i - 1));+ } else if (e.key === "ArrowDown") {+ e.preventDefault();+ setSlashMenuIndex((i) => (i >= count - 1 ? 0 : i + 1));+ } else if (e.key === "Enter" && slashMenuIndex() >= 0) {+ e.preventDefault();+ handleSelectRecentPrompt(recentPrompts()[slashMenuIndex()]);+ } else if (e.key === "Escape") {+ e.preventDefault();+ setSlashMenuDismissed(true);+ }+ return;+ }+ if (e.key === "Enter" && !e.shiftKey) {+ e.preventDefault();+ handleSubmit();+ }+ };++ const handleDragOver = (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ };++ const handleDragEnter = (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ dragCounter++;+ setIsDragging(true);+ };++ const handleDragLeave = (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ dragCounter--;+ if (dragCounter <= 0) {+ dragCounter = 0;+ setIsDragging(false);+ }+ };++ const handleDrop = async (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ dragCounter = 0;+ setIsDragging(false);++ const assetIdData = event.dataTransfer?.getData("application/x-asset-id");+ const existingAssetIds = assetIdData?.split(",").filter(Boolean) ?? [];++ const fileItems = Array.from(event.dataTransfer?.items ?? []).filter(+ (item) => item.kind === "file" && item.type.startsWith("image/"),+ );++ if (existingAssetIds.length === 0 && fileItems.length === 0) return;++ try {+ let newAssetIds =+ existingAssetIds.length > 0+ ? existingAssetIds+ : (await Promise.all(fileItems.map((item) => loadAsset(world, item)))).map((a) => a.id);++ newAssetIds = newAssetIds.filter((id) => world.assets.get(id)?.type === "IMAGE");++ if (mode() === "VIDEO") {+ const c = videoConfig();+ if (!c?.startFrameImageId && newAssetIds[0]) {+ patch({ startFrameImageId: newAssetIds[0] });+ }+ if (!c?.endFrameImageId && newAssetIds[1]) {+ patch({ endFrameImageId: newAssetIds[1] });+ }+ } else {+ const current = imageConfig()?.imageRefIds ?? [];+ patch({+ imageRefIds: [...current, ...newAssetIds].slice(0, MAX_IMAGE_REFERENCES),+ });+ }+ } catch (e) {+ toast("Failed to import assets", {+ description: (e as Error).message,+ });+ }+ };++ const handleVideoModelChange = (id: string) => {+ const model = PROMPT_INPUT_VIDEO_MODEL_OPTIONS.find((m) => m.id === id);+ if (!model) return;++ const c = videoConfig() ?? createDefaultConfig("VIDEO");+ const durationStr = `${c.duration}s`;++ setConfig({+ ...c,+ model: id,+ endFrameImageId: model.features.includes("end-frame") ? c.endFrameImageId : undefined,+ generateAudio: model.features.includes("audio") ? c.generateAudio : true,+ duration: model.durations.includes(durationStr) ? c.duration : parseInt(model.durations[0], 10),+ aspectRatio: model.aspectRatios.includes(c.aspectRatio)+ ? c.aspectRatio+ : (model.aspectRatios[0] as AspectRatio),+ });+ };++ // ── Accessors for UI menus (string ↔ config conversions) ────────────+ const aspectRatioAccessor: Accessor<string> = () => videoConfig()?.aspectRatio ?? "16:9";+ const variantCountAccessor: Accessor<string> = () => String(imageConfig()?.count ?? 1);+ const durationAccessor: Accessor<string> = () => `${videoConfig()?.duration ?? 6}s`;+ const modelAccessor: Accessor<string> = () => config().model;+ const voiceAccessor: Accessor<string> = () => voiceConfig()?.voice ?? PROMPT_INPUT_VOICE_OPTIONS[0].value;+ const audioEnabledAccessor = () => videoConfig()?.generateAudio ?? true;++ return (+ <div+ class="absolute w-xl bottom-16 z-10 mx-auto left-1/2 -translate-x-1/2 flex flex-col gap-2 rounded-xl border border-border bg-background p-2"+ onDragOver={handleDragOver}+ onDragEnter={handleDragEnter}+ onDragLeave={handleDragLeave}+ onDrop={handleDrop}+ >+ <PromptInputActions />+ <Switch>+ <Match when={mode() === "IMAGE"}>+ <div class="flex w-full items-start gap-2 overflow-x-auto">+ <For each={effectiveImageRefIds()}>+ {(assetId) => (+ <PromptInputReferenceImageButton+ asset={assets.get(assetId)!}+ class="size-16"+ size={{ width: 64, height: 64 }}+ onRemove={() => removeImageReference(assetId)}+ />+ )}+ </For>+ <Show when={effectiveImageRefIds().length < MAX_IMAGE_REFERENCES}>+ <PromptInputAttachButton+ icon="attachment"+ label="Image references"+ class="w-36"+ onClick={openImageReferencesPicker}+ />+ </Show>+ </div>+ </Match>++ <Match when={mode() === "VIDEO"}>+ <div class="flex w-full items-center gap-2 overflow-x-auto">+ <Show when={currentVideoModel()?.features.includes("start-frame")}>+ <Show+ when={effectiveStartFrameId()}+ fallback={+ <PromptInputAttachButton+ icon="image"+ label="Start frame"+ class="w-28"+ onClick={() => openVideoFramePicker("start")}+ />+ }+ >+ {(src) => (+ <PromptInputReferenceImageButton+ asset={assets.get(src())!}+ class="h-16 w-28"+ size={{ width: 112, height: 64 }}+ onRemove={() => clearVideoFrame("start")}+ />+ )}+ </Show>+ </Show>+ <Show when={currentVideoModel()?.features.includes("end-frame")}>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ variant="ghost"+ size="icon-square"+ class="text-muted-foreground"+ onClick={swapVideoFrameImages}+ >+ <Icon name="switch-flip" class="size-6" />+ </TooltipTrigger>+ <TooltipContent>Swap frames</TooltipContent>+ </Tooltip>+ <Show+ when={effectiveEndFrameId()}+ fallback={+ <PromptInputAttachButton+ icon="image"+ label="End frame"+ class="w-28"+ onClick={() => openVideoFramePicker("end")}+ />+ }+ >+ {(src) => (+ <PromptInputReferenceImageButton+ asset={assets.get(src())!}+ class="h-16 w-28"+ size={{ width: 112, height: 64 }}+ onRemove={() => clearVideoFrame("end")}+ />+ )}+ </Show>+ </Show>+ </div>+ </Match>+ </Switch>++++ <div class="relative flex min-h-14 w-full items-start p-1">+ <Show when={showSlashMenu()}>+ <div class="absolute bottom-full left-0 w-96 max-w-full gap-1 pt-0 text-xs text-muted-foreground flex flex-col rounded-xl border border-border bg-background p-2">+ <div class="flex h-10 items-center justify-between border-b border-border px-1">+ <span class="font-450">Recents</span>+ <button+ type="button"+ class="hover:text-foreground"+ onClick={handleClearHistory}+ >+ Clear history+ </button>+ </div>+ <div class="flex flex-col">+ <For each={recentPrompts()}>+ {(prompt, index) => (+ <button+ type="button"+ class={cx(+ "flex h-8 w-full items-center rounded-md px-2 text-left hover:bg-input",+ slashMenuIndex() === index() && "bg-input",+ )}+ onClick={() => handleSelectRecentPrompt(prompt)}+ >+ <span class="truncate">{prompt}</span>+ </button>+ )}+ </For>+ </div>+ </div>+ </Show>+ <textarea+ ref={textareaRef}+ class="min-h-8 max-h-32 w-full resize-none overflow-y-auto bg-transparent px-1 py-1 text-xs text-foreground placeholder:text-muted-foreground outline-none"+ placeholder="Describe what you want to create. Type / to open prompt history."+ value={prompt()}+ onInput={handlePromptInput}+ onKeyDown={handleKeyDown}+ />+ </div>+ <div class="flex min-h-4 w-full items-center justify-between">+ <div class="flex min-w-0 items-center gap-1 overflow-x-auto pr-1">+ <PromptInputCompactMenu+ aria-label="Select prompt mode"+ menuLabel="Generate"+ value={() => mode()}+ options={PROMPT_INPUT_MODE_OPTIONS}+ onChange={handleModeChange}+ />+ <Tooltip>+ <TooltipTrigger+ as={Button}+ variant="ghost"+ size="icon-square"+ class="text-muted-foreground"+ onClick={() => setSettingsVisible(!settingsVisible())}+ >+ <Icon name="preferences-adjust" class="size-6" />+ </TooltipTrigger>+ <TooltipContent>Settings</TooltipContent>+ </Tooltip>+ <Show when={settingsVisible()}>+ <Separator orientation="vertical" class="min-h-5" />+ <Switch>+ <Match when={mode() === "IMAGE"}>+ <>+ <ModelMenu+ searchPlaceholder="Search in image models"+ options={PROMPT_INPUT_IMAGE_MODEL_OPTIONS}+ value={modelAccessor}+ onChange={(v) => patch({ model: v })}+ />+ <PromptInputCompactMenu+ aria-label="Select aspect ratio"+ menuLabel="Aspect ratio"+ value={aspectRatioAccessor}+ options={PROMPT_INPUT_IMAGE_ASPECT_RATIO_OPTIONS}+ onChange={(v) => patch({ aspectRatio: v as AspectRatio })}+ triggerIcon="aspect-ratio-16-9"+ />+ <PromptInputCompactMenu+ aria-label="Select amount of variants"+ menuLabel="Amount of variants"+ value={variantCountAccessor}+ options={PROMPT_INPUT_VARIANT_COUNT_OPTIONS}+ onChange={(v) => patch({ count: Number(v) })}+ triggerIcon="variants"+ />+ </>+ </Match>+ <Match when={mode() === "VIDEO"}>+ <>+ <ModelMenu+ searchPlaceholder="Search in video models"+ options={PROMPT_INPUT_VIDEO_MODEL_OPTIONS}+ value={modelAccessor}+ onChange={handleVideoModelChange}+ />+ <PromptInputCompactMenu+ aria-label="Select aspect ratio"+ menuLabel="Aspect ratio"+ value={aspectRatioAccessor}+ options={videoAspectRatioOptions()}+ onChange={(v) => patch({ aspectRatio: v as AspectRatio })}+ triggerIcon="aspect-ratio-16-9"+ />+ {/* <PromptInputCompactMenu+ aria-label="Select resolution"+ menuLabel="Resolution"+ value={resolution}+ options={PROMPT_INPUT_RESOLUTION_OPTIONS}+ onChange={setResolution}+ triggerIcon="resolution"+ /> */}+ <PromptInputCompactMenu+ aria-label="Select duration"+ menuLabel="Duration"+ value={durationAccessor}+ options={videoDurationOptions()}+ onChange={(v) => patch({ duration: parseInt(v) })}+ triggerIcon="duration"+ />+ <Show when={currentVideoModel()?.features.includes("audio")}>+ <Button+ variant="ghost"+ onClick={() => patch({ generateAudio: !audioEnabledAccessor() })}+ class={DEFAULT_BUTTON_CLASS}+ >+ <Icon+ name={audioEnabledAccessor() ? "audio-on" : "audio-off"}+ class="size-6"+ />+ {audioEnabledAccessor() ? "On" : "Off"}+ </Button>+ </Show>+ </>+ </Match>+ <Match when={mode() === "VOICE"}>+ <VoiceMenu+ options={PROMPT_INPUT_VOICE_OPTIONS}+ value={voiceAccessor}+ onChange={(v) => patch({ voice: v })}+ />+ </Match>+ <Match when={mode() === "AUDIO"}>+ <ModelMenu+ searchPlaceholder="Search in audio models"+ options={PROMPT_INPUT_AUDIO_MODEL_OPTIONS}+ value={modelAccessor}+ onChange={(v) => patch({ model: v })}+ />+ </Match>+ </Switch>+ </Show>+ </div>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ variant="default"+ size="icon-square"+ disabled={!hasPromptText()}+ onClick={handleSubmit}+ >+ <Icon name="arrow-right" class="-rotate-90 size-6" />+ </TooltipTrigger>+ <TooltipContent shortcut="↵">Generate</TooltipContent>+ </Tooltip>+ </div>+ <Show when={isDragging()}>+ <div class="absolute inset-0 z-20 rounded-xl bg-background border border-primary p-2 overflow-hidden">+ <div class="absolute inset-0 bg-accent/40 rounded-xl" />+ <div class="flex size-full items-center justify-center rounded-md border border-dashed border-border-input">+ <Icon name="attachment" class="size-6 text-muted-foreground" />+ <span class="text-xs font-450 text-muted-foreground">Drop images here</span>+ </div>+ </div>+ </Show>+ </div>+ );+}+++type PromptInputCompactMenuProps = {+ menuLabel: string;+ value: Accessor<string>;+ options: { value: string; label: string; triggerLabel?: string; icon?: string }[];+ onChange: (value: string) => void;+ triggerIcon?: string;+}++function PromptInputCompactMenu(props: PromptInputCompactMenuProps) {+ const selectedOption = () =>+ props.options.find((option) => option.value === props.value()) ?? props.options[0];+ const selectedIcon = () => selectedOption()?.icon ?? props.triggerIcon ?? "chevron-down";+ const selectedLabel = () => selectedOption()?.triggerLabel ?? selectedOption()?.label ?? "";++ return (+ <DropdownMenu placement="top-start">+ <DropdownMenuTrigger<typeof Button>+ as={(triggerProps) => (+ <Button+ {...triggerProps}+ variant="ghost"+ class={DEFAULT_BUTTON_CLASS}+ >+ <Icon name={selectedIcon()} class="size-6" />+ {selectedLabel()}+ </Button>+ )}+ />+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-40 gap-0 p-2">+ <div class="flex h-8 items-center px-1 text-xs text-muted-foreground">+ {props.menuLabel}+ </div>+ <DropdownMenuGroup>+ <For each={props.options}>+ {(option) => {+ const selected = () => props.value() === option.value;++ return (+ <DropdownMenuItem+ tone="neutral"+ class="h-8 px-0 data-highlighted:bg-input"+ onSelect={() => props.onChange(option.value)}+ >+ <Show when={option.icon}>+ {(icon) => (+ <span class="grid h-7 w-7 shrink-0 place-items-center overflow-clip">+ <Icon name={icon()} class="size-6 text-muted-foreground" />+ </span>+ )}+ </Show>+ <span+ class={cx(+ "min-w-0 flex-1 truncate",+ selected() ? "text-foreground" : "text-muted-foreground",+ !option.icon && "pl-2",+ )}+ >+ {option.label}+ </span>+ <span class="grid h-7 w-7 shrink-0 place-items-center overflow-clip">+ <Show when={selected()}>+ <Icon name="confirm-check" class="size-6 text-foreground" />+ </Show>+ </span>+ </DropdownMenuItem>+ );+ }}+ </For>+ </DropdownMenuGroup>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ );+}++type ModelMenuProps = {+ searchPlaceholder: string;+ options: { id: string; name: string; description: string; icon: string }[];+ value: Accessor<string>;+ onChange(value: string): void;+}++function ModelMenu(props: ModelMenuProps) {+ const [query, setQuery] = createSignal("");++ const filteredOptions = createMemo(() => {+ const q = query().trim().toLowerCase();+ if (!q) return props.options;+ return props.options.filter(+ (o) => o.name.toLowerCase().includes(q) || o.description.toLowerCase().includes(q),+ );+ });++ const handleOpenChange = (open: boolean) => {+ if (!open) setQuery("");+ };++ const icon = createMemo(() => {+ const option = props.options.find((o) => o.id === props.value());+ return option?.icon ?? props.options[0].icon;+ });++ const name = createMemo(() => {+ const option = props.options.find((o) => o.id === props.value());+ return option?.name ?? props.options[0].name;+ });++ return (+ <DropdownMenu placement="top-start" onOpenChange={handleOpenChange}>+ <DropdownMenuTrigger<typeof Button>+ as={(triggerProps) => (+ <Button+ {...triggerProps}+ variant="ghost"+ class={DEFAULT_BUTTON_CLASS}+ >+ <Icon name={icon()} class="size-6" />+ {name()}+ </Button>+ )}+ />+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-[340px] p-0">+ <SearchInput+ placeholder={props.searchPlaceholder}+ value={query()}+ onValue={setQuery}+ />+ <div class="flex flex-col gap-2 px-2 py-1">+ <For each={filteredOptions()}>+ {(option) => {+ const selected = props.value() === option.id;++ return (+ <DropdownMenuItem+ tone="neutral"+ class="h-[42px] gap-2 rounded-md px-1 py-1 group"+ onSelect={() => props.onChange(option.id)}+ classList={{+ "data-highlighted:bg-muted": selected,+ }}+ >+ <div class="grid size-8 shrink-0 place-items-center overflow-hidden rounded-sm" >+ <Icon name={option.icon!} class="size-6 text-muted-foreground" />+ </div>+ <div class="min-w-0 flex-1 text-muted-foreground">+ <div class="truncate font-450 group-hover:text-foreground" classList={{ "text-foreground": selected }}>{option.name}</div>+ <div class="truncate">{option.description}</div>+ </div>+ <span class="grid size-7 place-items-center">+ <Show when={selected}>+ <Icon name="confirm-check" class="size-6 text-foreground" />+ </Show>+ </span>+ </DropdownMenuItem>+ )+ }}+ </For>+ </div>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ );+}+++type VoiceMenuProps = {+ options: { value: string; label: string; thumbnail: string; description: string; previewUrl: string }[];+ value: Accessor<string>;+ onChange(value: string): void;+}++function VoiceMenu(props: VoiceMenuProps) {+ const [open, setOpen] = createSignal(false);+ const [query, setQuery] = createSignal("");+ const [playingVoice, setPlayingVoice] = createSignal<string | null>(null);++ let audioRef: HTMLAudioElement | undefined;++ const selectedLabel = () =>+ props.options.find((o) => o.value === props.value())?.label ?? props.value();++ const filteredOptions = createMemo(() => {+ const q = query().trim().toLowerCase();+ if (!q) return props.options;+ return props.options.filter(+ (o) => o.label.toLowerCase().includes(q) || o.description.toLowerCase().includes(q),+ );+ });++ const stopPlayback = () => {+ if (audioRef) {+ audioRef.pause();+ audioRef.src = "";+ audioRef = undefined;+ }+ setPlayingVoice(null);+ };++ const togglePreview = (voiceId: string) => {+ if (playingVoice() === voiceId) {+ stopPlayback();+ return;+ }++ stopPlayback();+ const url = props.options.find((o) => o.value === voiceId)?.previewUrl;+ if (!url) return;++ audioRef = new Audio(url);+ audioRef.addEventListener("ended", () => setPlayingVoice(null));+ audioRef.play();+ setPlayingVoice(voiceId);+ };++ const selectVoice = (voiceId: string) => {+ props.onChange(voiceId);+ setOpen(false);+ };++ const handleOpenChange = (isOpen: boolean) => {+ setOpen(isOpen);+ if (!isOpen) {+ setQuery("");+ stopPlayback();+ }+ };++ onCleanup(stopPlayback);++ return (+ <Popover placement="top-start" open={open()} onOpenChange={handleOpenChange}>+ <PopoverTrigger<typeof Button>+ as={(triggerProps) => (+ <Button+ {...triggerProps}+ variant="ghost"+ class={DEFAULT_BUTTON_CLASS}+ >+ <Icon name="user" class="size-6" />+ {selectedLabel()}+ </Button>+ )}+ />+ <PopoverPortal>+ <PopoverContent class="w-[340px] p-0 rounded-xl">+ <SearchInput+ placeholder="Search in voices"+ value={query()}+ onValue={setQuery}+ />+ <div class="flex flex-col gap-2 p-2 max-h-[320px] overflow-y-auto">+ <For each={filteredOptions()}>+ {(option) => {+ const selected = () => props.value() === option.value;+ const isPlaying = () => playingVoice() === option.value;++ return (+ <button+ type="button"+ class="flex items-center gap-2 rounded-md px-1 py-1 h-[42px] w-full text-left group hover:bg-accent transition-colors"+ classList={{ "bg-muted": selected() }}+ onClick={() => selectVoice(option.value)}+ >+ <div+ class="group/thumb relative grid size-8 rounded-full overflow-hidden shrink-0 place-items-center"+ onClick={(e) => {+ e.stopPropagation();+ togglePreview(option.value);+ }}+ >+ <img src={option.thumbnail} alt={option.label} class="w-full h-full object-cover" />+ <div+ class="absolute inset-0 grid place-items-center rounded-full bg-black/0 transition-colors group-hover/thumb:bg-black/60"+ classList={{ "bg-black/60": isPlaying() }}+ >+ <Icon+ name={isPlaying() ? "pause" : "play"}+ class={cx("size-6 text-white transition-opacity group-hover/thumb:opacity-100", isPlaying() ? "opacity-100" : "opacity-0")}+ />+ </div>+ </div>+ <div class="min-w-0 flex-1 text-muted-foreground">+ <div+ class="truncate text-base font-450 group-hover:text-foreground"+ classList={{ "text-foreground": selected() }}+ >+ {option.label}+ </div>+ <div class="truncate text-base">{option.description}</div>+ </div>+ <span class="grid size-7 place-items-center shrink-0">+ <Show when={selected()}>+ <Icon name="confirm-check" class="size-6 text-foreground" />+ </Show>+ </span>+ </button>+ )+ }}+ </For>+ </div>+ </PopoverContent>+ </PopoverPortal>+ </Popover>+ );+}++type PromptInputReferenceImageButtonProps = {+ asset: Asset;+ class?: string;+ size?: { width: number; height: number };+ onRemove(): void;+}++function PromptInputReferenceImageButton(props: PromptInputReferenceImageButtonProps) {+ return (+ <div class={cx("group relative shrink-0", props.class)}>+ <div class="size-full overflow-hidden rounded-md bg-input outline-none">+ <AssetThumbnail asset={props.asset} class="size-full" size={props.size} />+ </div>+ <Show when={props.onRemove}>+ <button+ type="button"+ class="absolute right-0 top-0 z-10 grid size-8 place-items-center opacity-0 transition-opacity group-hover:opacity-100"+ onClick={props.onRemove}+ >+ <div class="size-5 flex items-center justify-center overflow-hidden rounded-full border border-border bg-background">+ <Icon name="close-remove-small" class="size-6 min-w-6 min-h-6" />+ </div>+ </button>+ </Show>+ </div>+ );+}++type PromptInputAttachButtonProps = {+ icon: string;+ label: string;+ class?: string;+ onClick(): void;+}++export function PromptInputAttachButton(props: PromptInputAttachButtonProps) {+ return (+ <button+ type="button"+ class={cx(+ "flex h-16 shrink-0 items-center justify-center gap-1 overflow-clip rounded-md bg-secondary active:bg-secondary-pressing pl-3 pr-4 py-2 text-muted-foreground transition-colors hover:bg-muted",+ props.class,+ )}+ onClick={props.onClick}+ >+ <Icon name={props.icon} class="size-6" />+ <span class="whitespace-nowrap text-xs">+ {props.label}+ </span>+ </button>+ );+}diff --git a/apps/web/src/components/genai/use-add-audio-to-video.ts b/apps/web/src/components/genai/use-add-audio-to-video.tsnew file mode 100644index 00000000..a413dbf8--- /dev/null+++ b/apps/web/src/components/genai/use-add-audio-to-video.ts@@ -0,0 +1,75 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Not, Or, query } from 'bitecs';+import { PaintType, ChildOf, createEntity, addComponent, appendChild, removeComponent, setComponent } from "@/components/engine";+import { loadAsset, uploadAsset } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { assert } from "@/utils";+import { toast } from "somoto";++import type { EngineWorld } from "@/components/engine";++function findVideoFill(world: EngineWorld, eid: number): number | null {+ const c = world.components;++ for (const fid of query(world, [c.Paint, ChildOf(eid), Not(c.Deleted), Not(c.Hidden)])) {+ if (c.Paint[fid] === PaintType.VIDEO) {+ return fid;+ }+ }+ return null;+}++export function useAddAudioToVideo() {+ const { world } = useEngine();+ const c = world.components;++ const generate = async () => {+ const nodes = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];++ for (const nid of nodes) {+ const fid = findVideoFill(world, nid);+ if (!fid) continue;++ const assetId = c.AssetId[fid];+ if (!assetId) continue;++ const asset = world.assets.get(assetId);+ if (!asset) continue;++ try {+ addComponent(world, nid, c.Generating);++ const fileRef = await uploadAsset(world, assetId);+ if (!fileRef) throw new Error("Failed to upload asset");++ const { url, generationId } = await trpc.addAudioToVideo.mutate({ video: fileRef });++ const dot = asset.name.lastIndexOf(".");+ const name = dot > 0+ ? asset.name.slice(0, dot) + " (With audio)" + asset.name.slice(dot)+ : asset.name + " (With audio)";+ const newAsset = await loadAsset(world, url, { name, generationId });++ assert(newAsset.type === "VIDEO", "New asset is not a video");++ addComponent(world, fid, c.Hidden);++ const newFid = createEntity(world);+ setComponent(world, newFid, c.Paint, PaintType.VIDEO);+ setComponent(world, newFid, c.AssetId, newAsset.id);+ appendChild(world, newFid, nid);+ } catch (err) {+ console.error("Add audio failed:", err);+ toast.error("Failed to add audio to video");+ } finally {+ removeComponent(world, nid, c.Generating);+ }+ }+ };++ return { generate };+}diff --git a/apps/web/src/components/genai/use-auto-captions.ts b/apps/web/src/components/genai/use-auto-captions.tsnew file mode 100644index 00000000..990f3078--- /dev/null+++ b/apps/web/src/components/genai/use-auto-captions.ts@@ -0,0 +1,42 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { GeometryType, createEntity, appendChild, setComponent, transcribeScene } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { createSignal } from "solid-js";+import { toast } from "somoto";++import type { TranscribeStatus } from "@/components/engine";++export type AutoCaptionsStatus = TranscribeStatus | null;++export function useAutoCaptions() {+ const engine = useEngine();+ const world = engine.world;+ const c = world.components;++ const [status, setStatus] = createSignal<AutoCaptionsStatus>(null);++ const generate = async (sceneEid: number) => {+ try {+ const { asset, trim } = await transcribeScene(engine, sceneEid, setStatus);++ const eid = createEntity(world);+ setComponent(world, eid, c.Geometry, GeometryType.TEXT);+ setComponent(world, eid, c.Caption, {});+ setComponent(world, eid, c.AssetId, asset.id);+ setComponent(world, eid, c.Trim, trim);+ appendChild(world, eid, sceneEid);+ } catch (error) {+ console.error("Auto-captions failed:", error);+ toast.error("Failed to generate captions", {+ description: error instanceof Error ? error.message : String(error),+ });+ } finally {+ setStatus(null);+ }+ };++ return { generate, status };+}diff --git a/apps/web/src/components/genai/use-generate-audio.ts b/apps/web/src/components/genai/use-generate-audio.tsnew file mode 100644index 00000000..e20c3172--- /dev/null+++ b/apps/web/src/components/genai/use-generate-audio.ts@@ -0,0 +1,90 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { track } from "@/lib/analytics";+import { findEmptyPlacement, recordGeneration, addWaveformFill, ensureGenerationFolder } from "@/utils/genai";+import { assert } from "@/utils";++import { GeometryType, createEntity, deleteEntity, addComponent, removeComponent, setComponent, resizeEntity } from "@/components/engine";+import { loadAsset } from "@/components/engine";++import type { AudioGenerationConfig } from "@/components/engine/db";+++export function useGenerateAudio() {+ const { world } = useEngine();+ const c = world.components;++ const generate = async (config: AudioGenerationConfig) => {+ let eid: number | undefined;+ const startedAt = performance.now();+ try {+ track('generation_started', {+ mode: 'audio',+ model: config.model,+ prompt_length: config.prompt.length,+ });++ const placement = findEmptyPlacement(world, 400, 100, 40);++ // In-flight placeholder is transient UI — build it untracked so it never+ // reaches the undo stack. The whole generation is recorded as one step below.+ world.history.untrack(() => {+ eid = createEntity(world);+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ addComponent(world, eid, c.Audio);+ setComponent(world, eid, c.Playback, {});+ setComponent(world, eid, c.Position, {+ x: Math.round(placement.x - 200),+ y: Math.round(placement.y - 50),+ });+ resizeEntity(world, eid, {+ width: 400,+ height: 100,+ });+ addComponent(world, eid, c.Generating);+ });++ const { results, name, generationId } = await trpc.generateSound.mutate({+ model: config.model,+ prompt: config.prompt,+ });++ assert(results.length > 0, "No results returned from the model");+ const folderId = await ensureGenerationFolder(world, name, results.length);+ const asset = await loadAsset(world, results[0].url, { name, generationId, folderId });++ assert(asset.type === "AUDIO", "Asset is not an audio");++ world.history.untrack(() => {+ setComponent(world, eid!, c.Name, name);+ setComponent(world, eid!, c.AssetId, asset.id);+ addWaveformFill(world, eid!, asset.id);+ removeComponent(world, eid!, c.Generating);+ });++ recordGeneration(world, 'Generate audio', [eid!]);++ track('generation_completed', {+ mode: 'audio',+ model: config.model,+ duration_ms: Math.round(performance.now() - startedAt),+ });+ } catch (err) {+ if (eid !== undefined) world.history.untrack(() => deleteEntity(world, eid!));+ console.error(err);+ track('generation_failed', {+ mode: 'audio',+ model: config.model,+ duration_ms: Math.round(performance.now() - startedAt),+ error: err instanceof Error ? err.message.slice(0, 200) : 'unknown',+ });+ throw err;+ }+ };++ return { generate } as const;+}diff --git a/apps/web/src/components/genai/use-generate-image.ts b/apps/web/src/components/genai/use-generate-image.tsnew file mode 100644index 00000000..8b743c1b--- /dev/null+++ b/apps/web/src/components/genai/use-generate-image.ts@@ -0,0 +1,123 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { track } from "@/lib/analytics";+import { ASPECT_RATIO_DIMENSIONS, findEmptyPlacement, recordGeneration, ensureGenerationFolder } from "@/utils/genai";+import { GeometryType, PaintType, createEntity, deleteEntity, addComponent, appendChild, removeComponent, setComponent, resizeEntity } from "@/components/engine";+import { loadAsset, uploadAssets } from "@/components/engine";++import type { ImageGenerationConfig } from "@/components/engine/db";++const IMAGE_GAP = 40;++export function useGenerateImage() {+ const { world } = useEngine();+ const c = world.components;++ const generate = async (config: ImageGenerationConfig) => {+ let placeholders: number[] = [];+ const startedAt = performance.now();+ try {+ track('generation_started', {+ mode: 'image',+ model: config.model,+ aspect_ratio: config.aspectRatio,+ count: config.count,+ prompt_length: config.prompt.length,+ reference_count: config.imageRefIds?.length ?? 0,+ });++ // 1. Find a slot for the whole batch, then place placeholder rectangles with the+ // Generating tag. In-flight placeholders are transient UI — build them untracked so+ // they never reach the undo stack. The whole batch is recorded as one step below.+ const dims = ASPECT_RATIO_DIMENSIONS[config.aspectRatio] ?? { width: 1920, height: 1080 };+ const totalWidth = config.count * dims.width + (config.count - 1) * IMAGE_GAP;+ const center = findEmptyPlacement(world, totalWidth, dims.height, IMAGE_GAP);++ world.history.untrack(() => {+ placeholders = Array.from({ length: config.count }).map(() => createEntity(world));++ for (const [index, eid] of placeholders.entries()) {+ // When generating multiple variants, offset each horizontally so they+ // don't stack on top of each other.+ const offsetX = index * (dims.width + IMAGE_GAP) - totalWidth / 2 + dims.width / 2;++ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ setComponent(world, eid, c.Position, {+ x: Math.round(center.x + offsetX - dims.width / 2),+ y: Math.round(center.y - dims.height / 2),+ });+ resizeEntity(world, eid, {+ width: dims.width,+ height: dims.height,+ });+ setComponent(world, eid, c.KeepAspectRatio, {+ width: dims.width,+ height: dims.height,+ });+ addComponent(world, eid, c.Generating);+ }+ });++ const { name, results, generationId } = await trpc.generateImage.mutate({+ model: config.model,+ prompt: config.prompt,+ aspectRatio: config.aspectRatio,+ count: config.count,+ images: await uploadAssets(world, config.imageRefIds),+ });++ // 2. Apply image fills and remove Generating tag+ const folderId = await ensureGenerationFolder(world, name, results.length);+ await Promise.all(+ results.map(async (result, i) => {+ const eid = placeholders[i];+ const imgName = results.length > 1 ? `${name} (${i + 1})` : name;+ const asset = await loadAsset(world, result.url, { name: imgName, generationId, folderId });++ world.history.untrack(() => {+ setComponent(world, eid, c.Name, imgName);++ const fid = createEntity(world);+ setComponent(world, fid, c.Paint, PaintType.IMAGE);+ setComponent(world, fid, c.AssetId, asset.id);+ appendChild(world, fid, eid);++ removeComponent(world, eid, c.Generating);+ });+ }),+ );++ recordGeneration(world, 'Generate image', placeholders);++ track('generation_completed', {+ mode: 'image',+ model: config.model,+ aspect_ratio: config.aspectRatio,+ count: results.length,+ duration_ms: Math.round(performance.now() - startedAt),+ });+ } catch (err) {+ // On failure, delete the placeholders so the shimmer stops. Untracked —+ // a failed generation leaves no trace on the undo stack.+ world.history.untrack(() => {+ for (const eid of placeholders) {+ deleteEntity(world, eid);+ }+ });+ console.error(err);+ track('generation_failed', {+ mode: 'image',+ model: config.model,+ duration_ms: Math.round(performance.now() - startedAt),+ error: err instanceof Error ? err.message.slice(0, 200) : 'unknown',+ });+ throw err;+ }+ };++ return { generate } as const;+}diff --git a/apps/web/src/components/genai/use-generate-video.ts b/apps/web/src/components/genai/use-generate-video.tsnew file mode 100644index 00000000..aef56326--- /dev/null+++ b/apps/web/src/components/genai/use-generate-video.ts@@ -0,0 +1,111 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { track } from "@/lib/analytics";+import { ASPECT_RATIO_DIMENSIONS, findEmptyPlacement, recordGeneration, ensureGenerationFolder } from "@/utils/genai";++import { GeometryType, PaintType, createEntity, deleteEntity, addComponent, appendChild, removeComponent, setComponent, resizeEntity } from "@/components/engine";+import { loadAsset, uploadAsset } from "@/components/engine";+import { assert } from "@/utils";++import type { VideoGenerationConfig } from "@/components/engine/db";++export function useGenerateVideo() {+ const { world } = useEngine();+ const c = world.components;++ const generate = async (config: VideoGenerationConfig) => {+ let eid: number | undefined;+ const startedAt = performance.now();+ try {+ track('generation_started', {+ mode: 'video',+ model: config.model,+ aspect_ratio: config.aspectRatio,+ duration: config.duration,+ generate_audio: config.generateAudio,+ has_start_frame: !!config.startFrameImageId,+ has_end_frame: !!config.endFrameImageId,+ prompt_length: config.prompt.length,+ });++ const dims = ASPECT_RATIO_DIMENSIONS[config.aspectRatio] ?? { width: 1920, height: 1080 };+ const placement = findEmptyPlacement(world, dims.width, dims.height, 40);++ // In-flight placeholder is transient UI — build it untracked so it never+ // reaches the undo stack. The whole generation is recorded as one step below.+ world.history.untrack(() => {+ eid = createEntity(world);+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ setComponent(world, eid, c.Position, {+ x: Math.round(placement.x - dims.width / 2),+ y: Math.round(placement.y - dims.height / 2),+ });+ resizeEntity(world, eid, {+ width: dims.width,+ height: dims.height,+ });+ setComponent(world, eid, c.KeepAspectRatio, {+ width: dims.width,+ height: dims.height,+ });+ addComponent(world, eid, c.Generating);+ });++ const [startFrame, endFrame] = await Promise.all([+ config.startFrameImageId ? uploadAsset(world, config.startFrameImageId) : undefined,+ config.endFrameImageId ? uploadAsset(world, config.endFrameImageId) : undefined,+ ]);++ const { results, name, generationId } = await trpc.generateVideo.mutate({+ model: config.model,+ prompt: config.prompt,+ aspectRatio: config.aspectRatio,+ duration: config.duration,+ generateAudio: config.generateAudio,+ startFrame: startFrame ?? undefined,+ endFrame: endFrame ?? undefined,+ });++ assert(results.length > 0, "No results returned from the model");+ const folderId = await ensureGenerationFolder(world, name, results.length);+ const asset = await loadAsset(world, results[0].url, { name, generationId, folderId });++ world.history.untrack(() => {+ setComponent(world, eid!, c.Name, name);+ removeComponent(world, eid!, c.Generating);++ const fid = createEntity(world);+ setComponent(world, fid, c.Paint, PaintType.VIDEO);+ setComponent(world, fid, c.AssetId, asset.id);+ appendChild(world, fid, eid!);++ setComponent(world, eid!, c.Playback, {});+ });++ recordGeneration(world, 'Generate video', [eid!]);++ track('generation_completed', {+ mode: 'video',+ model: config.model,+ aspect_ratio: config.aspectRatio,+ duration_ms: Math.round(performance.now() - startedAt),+ });+ } catch (err) {+ if (eid !== undefined) world.history.untrack(() => deleteEntity(world, eid!));+ console.error(err);+ track('generation_failed', {+ mode: 'video',+ model: config.model,+ duration_ms: Math.round(performance.now() - startedAt),+ error: err instanceof Error ? err.message.slice(0, 200) : 'unknown',+ });+ throw err;+ }+ };++ return { generate } as const;+}diff --git a/apps/web/src/components/genai/use-generate-voice.ts b/apps/web/src/components/genai/use-generate-voice.tsnew file mode 100644index 00000000..7236938b--- /dev/null+++ b/apps/web/src/components/genai/use-generate-voice.ts@@ -0,0 +1,89 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */+++import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { track } from "@/lib/analytics";+import { findEmptyPlacement, recordGeneration, addWaveformFill, ensureGenerationFolder } from "@/utils/genai";+import { GeometryType, createEntity, deleteEntity, addComponent, removeComponent, setComponent, resizeEntity } from "@/components/engine";+import { loadAsset } from "@/components/engine";++import type { VoiceGenerationConfig } from "@/components/engine/db";++export function useGenerateVoice() {+ const { world } = useEngine();+ const c = world.components;+++ const generate = async (config: VoiceGenerationConfig) => {+ let eid: number | undefined;+ const startedAt = performance.now();+ try {+ track('generation_started', {+ mode: 'voice',+ model: config.model,+ voice: config.voice,+ prompt_length: config.prompt.length,+ });++ const placement = findEmptyPlacement(world, 400, 100, 40);+ // In-flight placeholder is transient UI — build it untracked so it never+ // reaches the undo stack. The whole generation is recorded as one step below.+ world.history.untrack(() => {+ eid = createEntity(world);+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ addComponent(world, eid, c.Audio);+ setComponent(world, eid, c.Playback, {});+ setComponent(world, eid, c.Position, {+ x: Math.round(placement.x - 200),+ y: Math.round(placement.y - 50),+ });+ resizeEntity(world, eid, {+ width: 400,+ height: 100,+ });+ addComponent(world, eid, c.Generating);+ });++ const { results, name, generationId } = await trpc.textToSpeech.mutate({+ model: config.model,+ prompt: config.prompt,+ voice: config.voice,+ });++ if (results.length > 0) {+ const folderId = await ensureGenerationFolder(world, name, results.length);+ const asset = await loadAsset(world, results[0].url, { name, generationId, folderId });++ world.history.untrack(() => {+ setComponent(world, eid!, c.Name, name);+ setComponent(world, eid!, c.AssetId, asset.id);+ addWaveformFill(world, eid!, asset.id);+ removeComponent(world, eid!, c.Generating);+ });++ recordGeneration(world, 'Generate voice', [eid!]);+ }++ track('generation_completed', {+ mode: 'voice',+ model: config.model,+ duration_ms: Math.round(performance.now() - startedAt),+ });+ } catch (err) {+ if (eid !== undefined) world.history.untrack(() => deleteEntity(world, eid!));+ console.error(err);+ track('generation_failed', {+ mode: 'voice',+ model: config.model,+ duration_ms: Math.round(performance.now() - startedAt),+ error: err instanceof Error ? err.message.slice(0, 200) : 'unknown',+ });+ throw err;+ }+ };++ return { generate } as const;+}diff --git a/apps/web/src/components/genai/use-generation-records.ts b/apps/web/src/components/genai/use-generation-records.tsnew file mode 100644index 00000000..1e013c38--- /dev/null+++ b/apps/web/src/components/genai/use-generation-records.ts@@ -0,0 +1,119 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, createResource } from "solid-js";+import { hasComponent } from "bitecs";+import { PaintType } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { supabase } from "@/lib/supabase";+import { generationConfigSchema, type GenerationConfig } from "@/components/engine/db";++import type { EngineWorld } from "@/components/engine";+import { useECS } from "@/context/ecs";++/**+ * The stored `usage_records.config` IS the server-side adapter input, which+ * shares its schema with the client's `GenerationConfig` — except that media+ * fields carry `fileRef`s with embedded `assetId`s instead of raw asset IDs.+ * This normalizes those fields so the object validates as a `GenerationConfig`.+ */+export function toClientConfig(stored: unknown): GenerationConfig | undefined {+ if (!stored || typeof stored !== "object") return undefined;+ const c = stored as Record<string, unknown> & {+ images?: Array<{ assetId?: string }>;+ startFrame?: { assetId?: string };+ endFrame?: { assetId?: string };+ };++ const candidate: Record<string, unknown> = { ...c };++ if (c.images) {+ const imageRefIds = c.images+ .map((r) => r.assetId)+ .filter((id): id is string => typeof id === "string");+ delete candidate.images;+ if (imageRefIds.length > 0) candidate.imageRefIds = imageRefIds;+ }+ if (c.startFrame?.assetId) {+ candidate.startFrameImageId = c.startFrame.assetId;+ }+ delete candidate.startFrame;+ if (c.endFrame?.assetId) {+ candidate.endFrameImageId = c.endFrame.assetId;+ }+ delete candidate.endFrame;++ const parsed = generationConfigSchema.safeParse(candidate);+ return parsed.success ? parsed.data : undefined;+}++function getNodeAssetId(world: EngineWorld, eid: number): string | undefined {+ const c = world.components;+ if (hasComponent(world, eid, c.Audio)) {+ return c.AssetId[eid];+ }+ for (const fid of c.Cache.fills[eid]) {+ if (hasComponent(world, fid, c.Hidden)) continue;+ if (c.Paint[fid] === PaintType.VIDEO || c.Paint[fid] === PaintType.IMAGE) {+ return c.AssetId[fid];+ }+ }+ return undefined;+}++export function useGenerationRecords() {+ const { selectedNodes } = useECS();+ const { world } = useEngine();++ const generationIds = createMemo(() => {+ const ids = new Set<string>();+ for (const eid of selectedNodes()) {+ const assetId = getNodeAssetId(world, eid);+ if (!assetId) {+ continue;+ }++ const asset = world.assets.get(assetId);+ if (asset?.generationId) {+ ids.add(asset.generationId);+ }+ }+ return [...ids];+ });++ const [records] = createResource(() => generationIds(), async (ids) => {+ if (ids.length === 0 || !supabase) return [];+ const { data, error } = await supabase+ .from("usage_records")+ .select("id,credits,config")+ .in("id", ids);++ if (error) {+ console.error("[credits] Failed to load usage records", error);+ return [];+ }++ return (data ?? []).map((row) => ({+ id: row.id as string,+ credits: (row.credits as number | null) ?? 0,+ config: row.config as unknown,+ }));+ },+ );++ const totalCredits = createMemo(() => {+ return (records() ?? []).reduce((sum, r) => sum + r.credits, 0);+ });++ const isGenerated = createMemo(() => generationIds().length > 0);++ const firstConfig = (): GenerationConfig | undefined => {+ const ids = generationIds();+ if (ids.length === 0) return undefined;+ const record = (records() ?? []).find((r) => r.id === ids[0]);+ return toClientConfig(record?.config);+ };++ return { isGenerated, totalCredits, firstConfig };+}diff --git a/apps/web/src/components/genai/use-remove-background.ts b/apps/web/src/components/genai/use-remove-background.tsnew file mode 100644index 00000000..f98877c5--- /dev/null+++ b/apps/web/src/components/genai/use-remove-background.ts@@ -0,0 +1,77 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Not, Or, query } from 'bitecs';+import { PaintType, ChildOf, createEntity, addComponent, appendChild, removeComponent, setComponent } from "@/components/engine";+import { loadAsset, uploadAsset } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { toast } from "somoto";++import type { EngineWorld } from "@/components/engine";++/**+ * For a given shape entity, find the first image fill and its index.+ */+function findImageFill(world: EngineWorld, eid: number): number | null {+ const c = world.components;++ for (const fid of query(world, [c.Paint, ChildOf(eid), Not(c.Deleted), Not(c.Hidden)])) {+ if (c.Paint[fid] === PaintType.IMAGE) {+ return fid;+ }+ }+ return null;+}++export function useRemoveBackground() {+ const { world } = useEngine();+ const c = world.components;++ const generate = async () => {+ const nodes = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];++ for (const nid of nodes) {+ const fid = findImageFill(world, nid);+ if (!fid) continue;++ const assetId = world.components.AssetId[fid];+ if (!assetId) continue;++ const asset = world.assets.get(assetId);+ if (!asset) continue;++ try {+ // Show shimmer+ addComponent(world, nid, world.components.Generating);++ // Upload asset and call API+ const fileRef = await uploadAsset(world, assetId);+ if (!fileRef) throw new Error("Failed to upload asset");++ const { url, generationId } = await trpc.removeBackground.mutate({ image: fileRef });++ // Load result as new asset+ const newAsset = await loadAsset(world, url, {+ name: asset.name + " (Background removed)",+ generationId,+ });++ addComponent(world, fid, c.Hidden);++ const newFid = createEntity(world);+ setComponent(world, newFid, c.Paint, PaintType.IMAGE);+ setComponent(world, newFid, c.AssetId, newAsset.id);+ appendChild(world, newFid, nid);+ } catch (err) {+ console.error("Background removal failed:", err);+ toast.error("Failed to remove background");+ } finally {+ removeComponent(world, nid, c.Generating);+ }+ }+ };++ return { generate };+}diff --git a/apps/web/src/components/genai/use-upscale-image.ts b/apps/web/src/components/genai/use-upscale-image.tsnew file mode 100644index 00000000..3db6e767--- /dev/null+++ b/apps/web/src/components/genai/use-upscale-image.ts@@ -0,0 +1,78 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Not, Or, query } from 'bitecs';+import { PaintType, ChildOf, createEntity, addComponent, appendChild, removeComponent, setComponent, resizeEntity } from "@/components/engine";+import { loadAsset, uploadAsset } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { assert } from "@/utils";+import { toast } from "somoto";++import type { EngineWorld } from "@/components/engine";++function findImageFill(world: EngineWorld, eid: number): number | null {+ const c = world.components;++ for (const fid of query(world, [c.Paint, ChildOf(eid), Not(c.Deleted), Not(c.Hidden)])) {+ if (c.Paint[fid] === PaintType.IMAGE) {+ return fid;+ }+ }+ return null;+}++export function useUpscaleImage() {+ const { world } = useEngine();+ const c = world.components;++ const generate = async () => {+ const nodes = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];++ for (const nid of nodes) {+ const fid = findImageFill(world, nid);+ if (!fid) continue;++ const assetId = world.components.AssetId[fid];+ if (!assetId) continue;++ const asset = world.assets.get(assetId);+ if (!asset) continue;++ try {+ // Show shimmer+ addComponent(world, nid, c.Generating);++ const fileRef = await uploadAsset(world, assetId);+ if (!fileRef) throw new Error("Failed to upload asset");++ const { url, generationId } = await trpc.upscaleImage.mutate({ image: fileRef });++ const dot = asset.name.lastIndexOf(".");+ const name = dot > 0+ ? asset.name.slice(0, dot) + " (Upscaled)" + asset.name.slice(dot)+ : asset.name + " (Upscaled)";+ const newAsset = await loadAsset(world, url, { name, generationId });++ assert(newAsset.type === "IMAGE", "New asset is not an image");++ addComponent(world, fid, c.Hidden);+ setComponent(world, nid, c.KeepAspectRatio, { width: newAsset.width, height: newAsset.height });+ resizeEntity(world, nid, { width: newAsset.width, height: newAsset.height });++ const newFid = createEntity(world);+ setComponent(world, newFid, c.Paint, PaintType.IMAGE);+ setComponent(world, newFid, c.AssetId, newAsset.id);+ appendChild(world, newFid, nid);+ } catch (err) {+ console.error("Upscale failed:", err);+ toast.error("Failed to upscale image");+ } finally {+ removeComponent(world, nid, c.Generating);+ }+ }+ };++ return { generate };+}diff --git a/apps/web/src/components/genai/use-upscale-video.ts b/apps/web/src/components/genai/use-upscale-video.tsnew file mode 100644index 00000000..27530b40--- /dev/null+++ b/apps/web/src/components/genai/use-upscale-video.ts@@ -0,0 +1,77 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Not, Or, query } from 'bitecs';+import { PaintType, ChildOf, createEntity, addComponent, appendChild, removeComponent, setComponent, resizeEntity } from "@/components/engine";+import { loadAsset, uploadAsset } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { trpc } from "@/lib/trpc";+import { assert } from "@/utils";+import { toast } from "somoto";++import type { EngineWorld } from "@/components/engine";++function findVideoFill(world: EngineWorld, eid: number): number | null {+ const c = world.components;++ for (const fid of query(world, [c.Paint, ChildOf(eid), Not(c.Deleted), Not(c.Hidden)])) {+ if (c.Paint[fid] === PaintType.VIDEO) {+ return fid;+ }+ }+ return null;+}++export function useUpscaleVideo() {+ const { world } = useEngine();+ const c = world.components;++ const generate = async () => {+ const nodes = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];++ for (const nid of nodes) {+ const fid = findVideoFill(world, nid);+ if (!fid) continue;++ const assetId = world.components.AssetId[fid];+ if (!assetId) continue;++ const asset = world.assets.get(assetId);+ if (!asset) continue;++ try {+ addComponent(world, nid, c.Generating);++ const fileRef = await uploadAsset(world, assetId);+ if (!fileRef) throw new Error("Failed to upload asset");++ const { url, generationId } = await trpc.upscaleVideo.mutate({ video: fileRef });++ const dot = asset.name.lastIndexOf(".");+ const name = dot > 0+ ? asset.name.slice(0, dot) + " (Upscaled)" + asset.name.slice(dot)+ : asset.name + " (Upscaled)";+ const newAsset = await loadAsset(world, url, { name, generationId });++ assert(newAsset.type === "VIDEO", "New asset is not a video");++ addComponent(world, fid, c.Hidden);+ setComponent(world, nid, c.KeepAspectRatio, { width: newAsset.width, height: newAsset.height });+ resizeEntity(world, nid, { width: newAsset.width, height: newAsset.height });++ const newFid = createEntity(world);+ setComponent(world, newFid, c.Paint, PaintType.VIDEO);+ setComponent(world, newFid, c.AssetId, newAsset.id);+ appendChild(world, newFid, nid);+ } catch (err) {+ console.error("Upscale failed:", err);+ toast.error("Failed to upscale video");+ } finally {+ removeComponent(world, nid, c.Generating);+ }+ }+ };++ return { generate };+}diff --git a/apps/web/src/components/headless-indicator.tsx b/apps/web/src/components/headless-indicator.tsxnew file mode 100644index 00000000..f427b42b--- /dev/null+++ b/apps/web/src/components/headless-indicator.tsx@@ -0,0 +1,24 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show } from "solid-js";+import { useAuth } from "@/context/auth";++export function HeadlessIndicator() {+ const auth = useAuth();++ return (+ <Show when={auth.headless()}>+ <div+ class="pointer-events-none fixed top-3 left-1/2 z-[9999] flex -translate-x-1/2 items-center gap-2 rounded-full border border-border bg-background/90 px-3 py-1.5 shadow-md backdrop-blur"+ >+ <span class="relative flex size-2">+ <span class="absolute inline-flex size-full animate-ping rounded-full bg-primary opacity-75" />+ <span class="relative inline-flex size-2 rounded-full bg-primary" />+ </span>+ <span class="text-xs font-450 text-foreground">Remote controlled</span>+ </div>+ </Show>+ );+}diff --git a/apps/web/src/components/purchase-success.tsx b/apps/web/src/components/purchase-success.tsxnew file mode 100644index 00000000..6dd8e35e--- /dev/null+++ b/apps/web/src/components/purchase-success.tsx@@ -0,0 +1,33 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useSearchParams } from "@solidjs/router";+import { Show } from "solid-js";++import { Icon } from "@/components/ui/icon";++export function PurchaseSuccess() {+ const [params, setParams] = useSearchParams();++ const close = (e: MouseEvent) => {+ e.stopPropagation();+ e.preventDefault();+ setParams({ checkout: undefined }, { replace: true });+ };++ return (+ <Show when={params.checkout === "success"}>+ <div+ class="pointer-events-auto fixed inset-0 z-[999] flex flex-col items-center justify-center gap-2 bg-popover/30 backdrop-blur-3xl"+ onClick={close}+ >+ <Icon name="confirm-check" class="size-12 text-foreground" />+ <h4 class="text-2xl">Thank you for your purchase!</h4>+ <span class="text-[13px] text-foreground/70">+ You can click anywhere to close this window and continue using the app.+ </span>+ </div>+ </Show>+ );+}diff --git a/apps/web/src/components/screen-too-small.tsx b/apps/web/src/components/screen-too-small.tsxnew file mode 100644index 00000000..4deccf83--- /dev/null+++ b/apps/web/src/components/screen-too-small.tsx@@ -0,0 +1,21 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Icon } from "@/components/ui/icon";++export function ScreenTooSmall() {+ return (+ <div class="screen-too-small fixed inset-0 z-[100] hidden items-center justify-center bg-background p-6">+ <div class="flex max-w-sm flex-col items-center gap-3 text-center">+ <span class="text-muted-foreground">+ <Icon name="alert-warning" class="size-12" />+ </span>+ <h2 class="text-xl font-450 text-foreground">Your screen is too small</h2>+ <p class="text-xs text-muted-foreground">+ Diffusion Studio needs at least 1024×640 to work properly. Please resize your window or switch to a larger display.+ </p>+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-left/asset-item.tsx b/apps/web/src/components/sidebar-left/asset-item.tsxnew file mode 100644index 00000000..a7361f01--- /dev/null+++ b/apps/web/src/components/sidebar-left/asset-item.tsx@@ -0,0 +1,182 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal, onMount, onCleanup, Show, createMemo } from "solid-js";+import { toast } from "somoto";+import { downloadAsset } from "@/components/assets/actions";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuPortal,+ ContextMenuSeparator,+ ContextMenuShortcut,+ ContextMenuTrigger,+} from "../ui/context-menu";+import { AssetThumbnail } from "../ui/asset-thumbnail";+import { formatAssetDuration } from "@/utils";+import { useEngine } from "@/context/engine";+import { insertAssetInTimeline, replaceAssetHandle, removeAsset, saveAsset } from "@/components/engine";++import type { Asset } from "@/components/engine/db";+++export type LazyAssetItemProps = {+ asset: Asset;+ selected: boolean;+ onSelect(): void;+};++/**+ * A lazy loaded asset item. Clears the buffer when not visible.+ */+export function LazyAssetItem(props: LazyAssetItemProps) {+ const { world } = useEngine();++ const [isVisible, setIsVisible] = createSignal(false);+ const [isRenaming, setIsRenaming] = createSignal(false);+ const assetDuration = createMemo(() => formatAssetDuration(props.asset));++ let ref: HTMLDivElement | undefined;++ onMount(() => {+ if (!ref) return;++ const observer = new IntersectionObserver(+ ([entry]) => setIsVisible(entry.isIntersecting),+ { rootMargin: "100px" }+ );++ observer.observe(ref);+ onCleanup(() => observer.disconnect());+ });++ const handleDeleteAsset = async () => {+ try {+ await removeAsset(world, props.asset.id);+ } catch (e) {+ toast.error("Failed to delete", { description: (e as Error).message });+ }+ };++ const handleDragStart = (event: DragEvent) => {+ event.dataTransfer?.setData("application/x-asset-id", props.asset.id);+ };++ const handleRename = () => {+ setIsRenaming(true);+ };++ const commitRename = async (nextName: string) => {+ if (!isRenaming()) return;+ setIsRenaming(false);+ const trimmed = nextName.trim();+ if (!trimmed || trimmed === props.asset.name) return;+ try {+ await saveAsset(world, { ...props.asset, name: trimmed });+ } catch (e) {+ toast.error("Failed to rename", { description: (e as Error).message });+ }+ };++ const handleRenameKeyDown = (+ event: KeyboardEvent & { currentTarget: HTMLInputElement }+ ) => {+ event.stopPropagation();+ if (event.key === "Enter") {+ event.preventDefault();+ event.currentTarget.blur();+ } else if (event.key === "Escape") {+ event.preventDefault();+ setIsRenaming(false);+ }+ };++ const handleFocusElement = (el: HTMLInputElement) => {+ queueMicrotask(() => {+ el.focus();+ el.select();+ });+ };++ const handleDownloadMedia = () => downloadAsset(props.asset);+ const handleReplaceMedia = () => replaceAssetHandle(world, props.asset);+ const handleInsertToTimeline = () => insertAssetInTimeline(world, props.asset, 'playhead');++ return (+ <ContextMenu>+ <ContextMenuTrigger+ as="div"+ class="flex flex-col gap-1 text-left"+ data-asset-id={props.asset.id}+ draggable={true}+ onDragStart={handleDragStart}+ onClick={props.onSelect}+ onContextMenu={props.onSelect}>+ <div+ ref={ref}+ data-selected={props.selected}+ class="relative aspect-video w-full overflow-clip rounded bg-muted after:pointer-events-none after:absolute after:inset-0 after:rounded after:opacity-0 after:ring-2 after:ring-inset after:ring-ring after:z-10 data-[selected=true]:after:opacity-100"+ >+ <Show when={isVisible()}>+ <AssetThumbnail asset={props.asset} class="h-full w-full" />+ </Show>+ <Show when={assetDuration()}>+ {(duration) => (+ <div class="absolute left-1 top-1 z-20 flex h-4 items-center justify-center rounded bg-overlay px-1">+ <span class="text-xxs text-primary-foreground">+ {duration()}+ </span>+ </div>+ )}+ </Show>+ </div>+ <Show+ when={isRenaming()}+ fallback={+ <div class="text-xs text-muted-foreground truncate select-none">+ {props.asset.name}+ </div>+ }+ >+ <input+ ref={handleFocusElement}+ type="text"+ name="asset-name"+ autocomplete="off"+ value={props.asset.name}+ onKeyDown={handleRenameKeyDown}+ onBlur={(e) => commitRename(e.currentTarget.value)}+ onClick={(e) => e.stopPropagation()}+ onContextMenu={(e) => e.stopPropagation()}+ onPointerDown={(e) => e.stopPropagation()}+ class="text-xs text-foreground truncate bg-transparent rounded-sm outline-none ring-1 ring-primary px-0.5"+ />+ </Show>+ </ContextMenuTrigger>+ <ContextMenuPortal>+ <ContextMenuContent class="w-[180px]">+ <ContextMenuItem onSelect={handleInsertToTimeline}>+ Insert at playhead+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleRename}>+ Rename+ </ContextMenuItem>+ <ContextMenuItem onSelect={handleReplaceMedia}>+ Replace+ </ContextMenuItem>+ <ContextMenuItem onSelect={handleDownloadMedia}>+ Download+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleDeleteAsset}>+ Delete+ <ContextMenuShortcut>⌫</ContextMenuShortcut>+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-left/assets.tsx b/apps/web/src/components/sidebar-left/assets.tsxnew file mode 100644index 00000000..4523dd8c--- /dev/null+++ b/apps/web/src/components/sidebar-left/assets.tsx@@ -0,0 +1,656 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useEngine } from "@/context/engine";+import {+ useAssets,+ loadAsset,+ removeAsset,+ selectAsset,+ clearSelectedAssets,+ useFolders,+ openFolder,+ createFolder,+ assetFolderId,+ nextFolderName,+} from "@/components/engine";+import { usePromptInput } from "@/context/prompt-input";+import { createDefaultConfig } from "@/components/genai/prompt-input";+import { createEffect, createMemo, createSignal, For, onCleanup, onMount, Show } from "solid-js";+import { Button } from "../ui/button";+import { Icon } from "../ui/icon";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuShortcut,+ DropdownMenuTrigger,+} from "../ui/dropdown-menu";+import { showFileDialog } from "@/utils";+import { toast } from "somoto";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import {+ Breadcrumbs,+ BreadcrumbList,+ BreadcrumbsEllipsis,+ BreadcrumbsItem,+ BreadcrumbsLink,+ BreadcrumbsSeparator,+} from "../ui/breadcrumbs";+import { LazyAssetItem } from "./asset-item";+import { FolderItem, handleFolderDrop, ASSET_DRAG_TYPE, FOLDER_DRAG_TYPE } from "./folder-item";++import type { EngineWorld } from "@/components/engine";++export function Assets() {+ let root: HTMLDivElement | undefined;+ let dragCounter = 0;++ const { world } = useEngine();+ const assets = useAssets(world);+ const folders = useFolders(world);+ const { openPromptInput } = usePromptInput();+ const [query, setQuery] = createSignal("");+ const [assetFilter, setAssetFilter] = createSignal<AssetFilter>("ALL");+ const [isDragging, setIsDragging] = createSignal(false);+ const [renamingFolderId, setRenamingFolderId] = createSignal<string | null>(null);+++ const selectedAssetId = () => assets.selected().keys().next().value ?? null;++ const activeFilterLabel = () => {+ const value = assetFilter();+ if (value === "ALL") return null;+ return ASSET_FILTER_OPTIONS.find((option) => option.value === value)?.label ?? null;+ };++ const filteredAssets = createMemo(() => {+ const q = query().trim().toLowerCase();+ const list = assets.all();+ const selectedFilter = assetFilter();++ return list.filter((asset) => {+ if (selectedFilter !== "ALL" && asset.type !== selectedFilter) return false;+ if (q) return asset.name.toLowerCase().includes(q);+ return assetFolderId(world, asset) === folders.currentId();+ });+ });++ const visibleFolders = createMemo(() => {+ const q = query().trim().toLowerCase();+ if (q) {+ return folders+ .all()+ .filter((folder) => folder.name.toLowerCase().includes(q))+ .sort((a, b) => a.name.localeCompare(b.name));+ }+ return folders.childrenOf(folders.currentId());+ });++ const panelTitle = createMemo(() => folders.get(folders.currentId() ?? "")?.name ?? "Assets");+ const itemCount = createMemo(() => visibleFolders().length + filteredAssets().length);++ // Deep paths collapse like the breadcrumbs docs example:+ // All assets / … / parent / current, with the hidden folders in a dropdown.+ const collapsedFolders = createMemo(() => {+ const path = folders.path();+ return path.length > 2 ? path.slice(0, -2) : [];+ });+ const tailFolders = createMemo(() => {+ const path = folders.path();+ return path.length > 2 ? path.slice(-2) : path;+ });++ const handleGoToParent = () => {+ const id = folders.currentId();+ if (id === null) return;+ openFolder(world, folders.get(id)?.parentId ?? null);+ };++ const getAssetIdFromTarget = (target: EventTarget | null) => {+ const element = target instanceof Element ? target : null;+ return element?.closest("[data-asset-id]")?.getAttribute("data-asset-id") ?? null;+ };++ createEffect(() => {+ const selected = selectedAssetId();+ if (!selected) return;+ if (!assets.get(selected)) {+ clearSelectedAssets(world);+ }+ });++ const importAssets = async (handles: ReadonlyArray<File | FileSystemFileHandle | DataTransferItem>) => {+ if (handles.length === 0) return;++ try {+ await Promise.all(handles.map((handle) => {+ return loadAsset(world, handle, { folderId: folders.currentId() });+ }));+ } catch (e) {+ toast("Failed to import assets", {+ description: (e as Error).message,+ });+ }+ };++ const handleImportAssets = async () => {+ const files = await showFileDialog();+ await importAssets(files);+ };++ const handleDrop = async (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ dragCounter = 0;+ setIsDragging(false);++ document.body.style.cursor = "default";++ if (await handleFolderDrop(world, event, folders.currentId())) {+ return;+ }++ const items = Array.from(event.dataTransfer?.items ?? []).filter(+ (item) => item.kind === "file"+ );+ await importAssets(items);+ };++ const handleDragOver = (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ };++ const isExternalFileDrag = (event: DragEvent) => {+ const types = event.dataTransfer?.types ?? [];+ return (+ types.includes("Files") &&+ !types.includes(ASSET_DRAG_TYPE) &&+ !types.includes(FOLDER_DRAG_TYPE)+ );+ };++ const handleDragEnter = (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ if (!isExternalFileDrag(event)) return;+ dragCounter++;+ setIsDragging(true);+ };++ const handleDragLeave = (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();+ if (!isExternalFileDrag(event)) return;+ dragCounter--;+ if (dragCounter <= 0) {+ dragCounter = 0;+ setIsDragging(false);+ }+ };+++ const handleSelectAsset = (assetId: string) => {+ selectAsset(world, assetId);+ root?.focus();+ };++ const moveSelection = (delta: number) => {+ const items = Array.from(+ root?.querySelectorAll<HTMLElement>("[data-asset-id]") ?? []+ );+ if (items.length === 0) return;++ const currentId = selectedAssetId();+ const currentIndex = currentId+ ? items.findIndex(item => item.dataset.assetId === currentId)+ : -1;+ const baseIndex = currentIndex === -1 ? 0 : currentIndex;+ const nextIndex = Math.min(+ items.length - 1,+ Math.max(0, baseIndex + delta)+ );++ const nextItem = items[nextIndex];+ const nextId = nextItem?.dataset.assetId;+ if (!nextId) return;++ selectAsset(world, nextId);+ nextItem.scrollIntoView({ block: "nearest" });+ };++ const handleKeyDown = (event: KeyboardEvent) => {+ const target = event.target as HTMLElement | null;+ if (+ target instanceof HTMLInputElement ||+ target instanceof HTMLTextAreaElement ||+ target?.isContentEditable+ ) {+ return;+ }++ if (event.key === "Backspace" || event.key === "Delete") {+ const selectedAsset = selectedAssetId();+ if (selectedAsset) {+ event.preventDefault();+ event.stopPropagation();+ removeAsset(world, selectedAsset);+ return;+ }++ const selectedFolder = folders.currentId();+ if (selectedFolder) {+ event.preventDefault();+ openFolder(world, folders.get(selectedFolder)?.parentId ?? null);+ }++ return;+ }++ const columns = 2;+ const deltaByKey: Record<string, number> = {+ ArrowUp: -columns,+ ArrowDown: columns,+ ArrowLeft: -1,+ ArrowRight: 1,+ };+ const delta = deltaByKey[event.key];+ if (delta === undefined) return;++ event.preventDefault();+ moveSelection(delta);+ };++ const handleBackgroundClick = (event: MouseEvent) => {+ if (!getAssetIdFromTarget(event.target)) {+ clearSelectedAssets(world);+ }+ };++ const hasAssets = () => assets.all().length > 0;+ const hasContent = () => hasAssets() || folders.all().length > 0;+ const isFiltering = () => query().trim().length > 0 || assetFilter() !== "ALL";+ const isEmptyView = () => visibleFolders().length === 0 && filteredAssets().length === 0;++ const handleCreateFolder = async () => {+ try {+ const parentId = folders.currentId();+ const folder = await createFolder(world, nextFolderName(world, parentId), parentId);+ setRenamingFolderId(folder.id);+ } catch (e) {+ toast.error("Failed to create folder", { description: (e as Error).message });+ }+ };++ const handleOpenFolder = (folderId: string) => {+ setQuery("");+ openFolder(world, folderId);+ };++ onMount(() => {+ const onCreateFolder = () => handleCreateFolder();+ window.addEventListener("engine:create-folder", onCreateFolder);+ onCleanup(() => window.removeEventListener("engine:create-folder", onCreateFolder));+ });++ return (+ <div+ on:drop={handleDrop}+ on:dragover={handleDragOver}+ on:dragenter={handleDragEnter}+ on:dragleave={handleDragLeave}+ class="relative flex flex-col flex-1 min-h-0 bg-background text-foreground text-sm focus:outline-none"+ tabIndex={0}+ ref={root}+ onKeyDown={handleKeyDown}+ >+ <div class="h-12 shrink-0 flex items-center gap-2 px-4 border-y border-border">+ <div class="flex-1 min-w-0 flex items-center gap-0.5 text-[12px] leading-5 font-strong text-foreground">+ <Show when={folders.currentId() !== null}>+ <Button+ size="icon"+ variant="ghost"+ aria-label="Go to parent folder"+ onClick={handleGoToParent}+ >+ <Icon name="chevron-left" class="text-muted-foreground" />+ </Button>+ </Show>+ <span class="truncate">+ {panelTitle()}+ <span class="ml-1 text-muted-foreground">({itemCount()})</span>+ </span>+ </div>+ <div class="flex items-center gap-1 shrink-0">+ <Show when={hasAssets()}>+ <DropdownMenu placement="bottom-start">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ {...buttonProps}+ size="icon"+ variant="ghost"+ class="text-muted-foreground data-expanded:bg-accent data-expanded:text-foreground"+ >+ <Icon name="preferences-adjust" class="size-6" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Filter assets</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-32">+ <For each={ASSET_FILTER_OPTIONS}>+ {(option) => (+ <DropdownMenuItem+ tone="neutral"+ class="gap-1 px-0 pr-2"+ onSelect={() => setAssetFilter(option.value)}+ >+ <FilterIconStack+ icon={option.icon}+ selected={assetFilter() === option.value}+ />+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {option.label}+ </span>+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </Show>+ <DropdownMenu placement="bottom-start">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ {...buttonProps}+ size="icon"+ variant="ghost"+ aria-label="Add assets"+ class="text-muted-foreground data-expanded:bg-accent data-expanded:text-foreground"+ >+ <Icon name="plus-add" class="size-6" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent shortcut="⌘I">Import assets</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-40">+ <DropdownMenuItem tone="neutral" onSelect={handleImportAssets}>+ Import assets+ <DropdownMenuShortcut>⌘I</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem tone="neutral" onSelect={handleCreateFolder}>+ Create folder+ <DropdownMenuShortcut>⇧⌘N</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </div>+ </div>++ <Show when={hasContent() && !isDragging()}>+ <div class="shrink-0 px-4 pt-4 pb-1 flex flex-col gap-4">+ <Show when={folders.currentId() !== null}>+ <Breadcrumbs separator="/">+ <BreadcrumbList class="text-xs gap-1 sm:gap-1">+ <BreadcrumbCrumb world={world} label="All assets" folderId={null} />+ <Show when={collapsedFolders().length > 0}>+ <BreadcrumbsSeparator />+ <BreadcrumbsItem>+ <DropdownMenu placement="bottom-start">+ <DropdownMenuTrigger class="flex items-center gap-1 rounded outline-none focus-ring hover:text-foreground">+ <BreadcrumbsEllipsis class="size-4" />+ <span class="sr-only">Show parent folders</span>+ </DropdownMenuTrigger>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-40">+ <For each={collapsedFolders()}>+ {(folder) => (+ <DropdownMenuItem+ tone="neutral"+ onSelect={() => openFolder(world, folder.id)}+ >+ <span class="truncate">{folder.name}</span>+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </BreadcrumbsItem>+ </Show>+ <For each={tailFolders()}>+ {(folder) => (+ <>+ <BreadcrumbsSeparator />+ <BreadcrumbCrumb+ world={world}+ label={folder.name}+ folderId={folder.id}+ current={folder.id === folders.currentId()}+ />+ </>+ )}+ </For>+ </BreadcrumbList>+ </Breadcrumbs>+ </Show>+ <div class="relative">+ <div class="absolute left-1 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none">+ <Icon name="search" class="size-6" />+ </div>+ <input+ type="text"+ value={query()}+ onInput={(e) => setQuery(e.currentTarget.value)}+ placeholder="Search"+ class="w-full h-7 rounded-md bg-input pl-8 pr-0 text-xs text-foreground placeholder:text-muted-foreground outline-none focus-ring"+ />+ </div>+ <Show when={activeFilterLabel()} keyed>+ {(label) => (+ <div class="flex flex-wrap gap-2">+ <FilterBadge+ label={label}+ onRemove={() => setAssetFilter("ALL")}+ />+ </div>+ )}+ </Show>+ </div>+ </Show>++ <div class="relative flex-1 min-h-0 flex flex-col">+ <Show when={isDragging()}>+ <div class="absolute inset-x-2 bottom-2 top-0 z-50 p-2 bg-background rounded-xl border border-ring">+ <div class="absolute inset-0 bg-accent/20 rounded-xl" />+ <div class="size-full flex items-center justify-center rounded-md border border-dashed border-border-input">+ <Icon name="plus-add" class="size-6 text-muted-foreground" />+ <span class="text-xxs font-450 text-muted-foreground">Drop media here</span>+ </div>+ </div>+ </Show>+ <div+ class="flex-1 min-h-0 overflow-y-auto p-4 pt-3"+ onClick={handleBackgroundClick}+ >+ <Show when={isEmptyView() && !isFiltering()}>+ <div class="h-full flex flex-col items-center justify-center gap-4 px-6 pb-[88px] pt-4">+ <div class="flex flex-col items-center gap-1">+ <Icon name="navigation.folder" class="size-8 text-muted-foreground" />+ <span class="text-xs font-450 text-muted-foreground">+ Add media+ </span>+ <p class="text-xxs text-muted-foreground text-center">+ Drag here, import from your computer,{"\n"}+ or, generate something new with AI.+ </p>+ </div>+ <div class="flex flex-col gap-2 w-full">+ <Button variant="secondary" class="w-full" onClick={() => openPromptInput(createDefaultConfig("IMAGE"))}>+ Generate with AI+ </Button>+ <Button variant="default" class="w-full" onClick={handleImportAssets}>+ Import media+ </Button>+ </div>+ </div>+ </Show>+ <Show when={isEmptyView() && isFiltering()}>+ <div class="h-full flex items-center justify-center text-xs text-muted-foreground">+ No matching assets+ </div>+ </Show>+ <Show when={visibleFolders().length > 0 || filteredAssets().length > 0}>+ <div class="grid grid-cols-2 gap-x-2 gap-y-4">+ <For each={visibleFolders()}>+ {(folder) => (+ <FolderItem+ folder={folder}+ renaming={renamingFolderId() === folder.id}+ onRenameStart={() => setRenamingFolderId(folder.id)}+ onRenameEnd={() => setRenamingFolderId(null)}+ onOpen={() => handleOpenFolder(folder.id)}+ />+ )}+ </For>+ <For each={filteredAssets()}>+ {(asset) => (+ <LazyAssetItem+ asset={asset}+ selected={selectedAssetId() === asset.id}+ onSelect={() => handleSelectAsset(asset.id)}+ />+ )}+ </For>+ </div>+ </Show>+ </div>+ </div>+ </div>+ );+}++type AssetFilter = "ALL" | "VIDEO" | "IMAGE" | "AUDIO";++const ASSET_FILTER_OPTIONS: ReadonlyArray<{+ value: AssetFilter;+ label: string;+ icon: string;+}> = [+ { value: "ALL", label: "All", icon: "all-media-types" },+ { value: "VIDEO", label: "Video", icon: "video" },+ { value: "IMAGE", label: "Image", icon: "media-image" },+ { value: "AUDIO", label: "Audio", icon: "media-audio" },+ ];++type FilterIconStackProps = {+ icon: string;+ selected: boolean;+};++function FilterIconStack(props: FilterIconStackProps) {+ return (+ <div class="flex items-center">+ <span class="w-6 h-7 shrink-0 flex items-center justify-center">+ <Show when={props.selected}>+ <Icon name="confirm-check" class="size-6 text-popover-foreground" />+ </Show>+ </span>+ <span class="w-7 h-7 flex items-center justify-center">+ <Icon name={props.icon} class="size-6 text-popover-foreground" />+ </span>+ </div>+ );+}++type BreadcrumbCrumbProps = {+ world: EngineWorld;+ label: string;+ folderId: string | null;+ current?: boolean;+};++/**+ * One segment of the folder path. Clicking navigates there; assets and+ * folders can be dropped on it to move them to that level.+ */+function BreadcrumbCrumb(props: BreadcrumbCrumbProps) {+ const [isDropTarget, setIsDropTarget] = createSignal(false);++ const isInternalDrag = (event: DragEvent) => {+ const types = event.dataTransfer?.types ?? [];+ return types.includes(ASSET_DRAG_TYPE) || types.includes(FOLDER_DRAG_TYPE);+ };++ const handleDragOver = (event: DragEvent) => {+ if (!isInternalDrag(event)) return;+ event.preventDefault();+ event.stopPropagation();+ setIsDropTarget(true);+ };++ const handleDrop = async (event: DragEvent) => {+ if (!isInternalDrag(event)) return;+ event.preventDefault();+ event.stopPropagation();+ setIsDropTarget(false);+ await handleFolderDrop(props.world, event, props.folderId);+ };++ return (+ <BreadcrumbsItem>+ <BreadcrumbsLink+ as="button"+ current={props.current}+ data-drop-target={isDropTarget()}+ class="max-w-32 truncate rounded px-1 outline-none focus-ring data-[current]:text-muted-foreground hover:text-foreground data-[drop-target=true]:ring-2 data-[drop-target=true]:ring-inset data-[drop-target=true]:ring-ring"+ onClick={() => openFolder(props.world, props.folderId)}+ on:dragover={handleDragOver}+ on:dragleave={() => setIsDropTarget(false)}+ on:drop={handleDrop}+ >+ {props.label}+ </BreadcrumbsLink>+ </BreadcrumbsItem>+ );+}++type FilterBadgeProps = {+ label: string;+ onRemove: () => void;+};++function FilterBadge(props: FilterBadgeProps) {+ return (+ <button+ class="h-5 rounded bg-input pl-1 pr-0 inline-flex items-center gap-1 text-xxs text-foreground outline-none focus-ring"+ onClick={props.onRemove}+ >+ <span>{props.label}</span>+ <span class="relative w-4 h-5 flex items-center justify-center overflow-hidden">+ <Icon name="close-remove-small" class="absolute -left-1 -top-0.5 size-6" />+ </span>+ </button>+ );+}diff --git a/apps/web/src/components/sidebar-left/folder-item.tsx b/apps/web/src/components/sidebar-left/folder-item.tsxnew file mode 100644index 00000000..3d126682--- /dev/null+++ b/apps/web/src/components/sidebar-left/folder-item.tsx@@ -0,0 +1,211 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, createSignal, Show } from "solid-js";+import { toast } from "somoto";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuPortal,+ ContextMenuSeparator,+ ContextMenuTrigger,+} from "../ui/context-menu";+import { Icon } from "../ui/icon";+import { useEngine } from "@/context/engine";+import {+ renameFolder,+ deleteFolder,+ moveFolder,+ moveAssetsToFolder,+ useAssets,+ useFolders,+ assetFolderId,+} from "@/components/engine";++import type { Folder } from "@/components/engine/db";++export const ASSET_DRAG_TYPE = "application/x-asset-id";+export const FOLDER_DRAG_TYPE = "application/x-folder-id";++function isAssetOrFolderDrag(event: DragEvent): boolean {+ const types = event.dataTransfer?.types ?? [];+ return types.includes(ASSET_DRAG_TYPE) || types.includes(FOLDER_DRAG_TYPE);+}++/**+ * Handles a drop of an internal asset/folder drag onto the target folder+ * (null = root). Returns true when the event was an internal drag.+ */+export async function handleFolderDrop(+ world: ReturnType<typeof useEngine>["world"],+ event: DragEvent,+ targetFolderId: string | null,+): Promise<boolean> {+ const assetId = event.dataTransfer?.getData(ASSET_DRAG_TYPE);+ const folderId = event.dataTransfer?.getData(FOLDER_DRAG_TYPE);+ if (!assetId && !folderId) return false;++ if (assetId) {+ await moveAssetsToFolder(world, [assetId], targetFolderId);+ }+ if (folderId && folderId !== targetFolderId) {+ const moved = await moveFolder(world, folderId, targetFolderId);+ if (!moved) {+ toast("Cannot move a folder into itself");+ }+ }+ return true;+}++export type FolderItemProps = {+ folder: Folder;+ renaming: boolean;+ onRenameStart(): void;+ onRenameEnd(): void;+ onOpen(): void;+};++export function FolderItem(props: FolderItemProps) {+ const { world } = useEngine();+ const assets = useAssets(world);+ const folders = useFolders(world);++ const [isDropTarget, setIsDropTarget] = createSignal(false);++ const childCount = createMemo(() =>+ folders.childrenOf(props.folder.id).length ++ assets.all().filter((asset) => assetFolderId(world, asset) === props.folder.id).length+ );++ const handleDragStart = (event: DragEvent) => {+ event.dataTransfer?.setData(FOLDER_DRAG_TYPE, props.folder.id);+ };++ const handleDragOver = (event: DragEvent) => {+ if (!isAssetOrFolderDrag(event)) return;+ event.preventDefault();+ event.stopPropagation();+ setIsDropTarget(true);+ };++ const handleDragLeave = () => {+ setIsDropTarget(false);+ };++ const handleDrop = async (event: DragEvent) => {+ if (!isAssetOrFolderDrag(event)) return;+ event.preventDefault();+ event.stopPropagation();+ setIsDropTarget(false);+ await handleFolderDrop(world, event, props.folder.id);+ };++ const commitRename = async (nextName: string) => {+ if (!props.renaming) return;+ props.onRenameEnd();+ const trimmed = nextName.trim();+ if (!trimmed || trimmed === props.folder.name) return;+ try {+ await renameFolder(world, props.folder.id, trimmed);+ } catch (e) {+ toast.error("Failed to rename", { description: (e as Error).message });+ }+ };++ const handleRenameKeyDown = (+ event: KeyboardEvent & { currentTarget: HTMLInputElement }+ ) => {+ event.stopPropagation();+ if (event.key === "Enter") {+ event.preventDefault();+ event.currentTarget.blur();+ } else if (event.key === "Escape") {+ event.preventDefault();+ props.onRenameEnd();+ }+ };++ const handleFocusElement = (el: HTMLInputElement) => {+ queueMicrotask(() => {+ el.focus();+ el.select();+ });+ };++ const handleDelete = async () => {+ try {+ await deleteFolder(world, props.folder.id);+ } catch (e) {+ toast.error("Failed to delete", { description: (e as Error).message });+ }+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger+ as="div"+ class="flex flex-col gap-1 text-left"+ data-folder-id={props.folder.id}+ draggable={true}+ onDragStart={handleDragStart}+ on:dragover={handleDragOver}+ on:dragleave={handleDragLeave}+ on:drop={handleDrop}+ onClick={props.onOpen}+ >+ <div+ data-drop-target={isDropTarget()}+ class="relative aspect-video w-full overflow-clip rounded bg-muted flex items-center justify-center after:pointer-events-none after:absolute after:inset-0 after:rounded after:opacity-0 after:ring-2 after:ring-inset after:ring-ring after:z-10 data-[drop-target=true]:after:opacity-100"+ >+ <Icon name="folder-thumbnail" class="w-8 h-6 text-muted-foreground pointer-events-none" />+ <Show when={childCount() > 0}>+ <div class="absolute left-1 top-1 z-20 flex h-4 items-center justify-center rounded bg-overlay px-1">+ <span class="text-xxs text-primary-foreground">+ {childCount()}+ </span>+ </div>+ </Show>+ </div>+ <Show+ when={props.renaming}+ fallback={+ <div class="text-xs text-muted-foreground truncate select-none">+ {props.folder.name}+ </div>+ }+ >+ <input+ ref={handleFocusElement}+ type="text"+ name="folder-name"+ autocomplete="off"+ value={props.folder.name}+ onKeyDown={handleRenameKeyDown}+ onBlur={(e) => commitRename(e.currentTarget.value)}+ onClick={(e) => e.stopPropagation()}+ onContextMenu={(e) => e.stopPropagation()}+ onPointerDown={(e) => e.stopPropagation()}+ class="text-xs text-foreground truncate bg-transparent rounded-sm outline-none ring-1 ring-primary px-0.5"+ />+ </Show>+ </ContextMenuTrigger>+ <ContextMenuPortal>+ <ContextMenuContent class="w-[220px]">+ <ContextMenuItem onSelect={props.onOpen}>+ Open+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={props.onRenameStart}>+ Rename+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleDelete}>+ Delete+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-left/index.ts b/apps/web/src/components/sidebar-left/index.tsnew file mode 100644index 00000000..baf7b8ae--- /dev/null+++ b/apps/web/src/components/sidebar-left/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './sidebar-left';diff --git a/apps/web/src/components/sidebar-left/project-menu/ai-credits-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/ai-credits-menu.tsxnew file mode 100644index 00000000..6315903b--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/ai-credits-menu.tsx@@ -0,0 +1,74 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useSearchParams } from "@solidjs/router";+import {+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { useAuth } from "@/context/auth";++function formatCredits(value: number): string {+ return value.toLocaleString();+}++function progressWidth(used: number, total: number): string {+ if (total <= 0) return "0%";+ const percent = Math.min(100, Math.max(0, (used / total) * 100));+ return `${percent}%`;+}++export function AiCreditsMenu() {+ const auth = useAuth();+ const [, setParams] = useSearchParams();++ const isPro = () => auth.isPro();+ const total = () => auth.creditLimit();+ const remaining = () => auth.remainingCredits();+ const used = () => Math.max(0, total() - remaining());++ const usageLabel = () => `${formatCredits(used())} / ${formatCredits(total())}`;++ const footerLabel = () => {+ if (!isPro()) return "One time only";+ const reset = auth.nextCreditReset();+ if (!reset) return "Resets monthly";+ const days = Math.max(0, Math.ceil((reset.getTime() - Date.now()) / 86_400_000));+ return `Resets in ${days} ${days === 1 ? "day" : "days"}`;+ };++ const openAiCredits = () => {+ (document.activeElement as HTMLElement)?.blur?.();+ setParams({ dashboard: "billing" }, { replace: true });+ };++ return (+ <>+ <DropdownMenuGroup>+ <div class="h-7 flex items-center px-2 text-xs text-muted-foreground">+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ Usage+ </span>+ <span class="shrink-0 text-right">{usageLabel()}</span>+ </div>+ <div class="h-7 flex items-center px-2">+ <div class="w-full h-3 rounded-full bg-border overflow-hidden">+ <div+ class="h-full rounded-full bg-primary"+ style={{ width: progressWidth(used(), total()) }}+ />+ </div>+ </div>+ <div class="h-7 flex items-center px-2 text-xs text-muted-foreground">+ {footerLabel()}+ </div>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuItem onSelect={openAiCredits}>Buy credits</DropdownMenuItem>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/edit-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/edit-menu.tsxnew file mode 100644index 00000000..3e28b5ed--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/edit-menu.tsx@@ -0,0 +1,127 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { useEngine } from "@/context/engine";+import { copySelection, pasteClipboard, duplicateSelection, selectStageEntities, selectParentEntities, selectChildEntities, addComponent, removeComponent, clearComponent } from "@/components/engine";+import { useECS } from "@/context/ecs";+import { hasComponent, Or, query } from 'bitecs';++export function EditMenu() {+ const { world } = useEngine();+ const { selectedNodes } = useECS();+ const hasSelection = () => selectedNodes().size > 0;+ const c = world.components;++ const handleToggleHidden = () => {+ const eids = [...query(world, [c.Selected, Or(c.Geometry, c.Group)])];+ const anyVisible = Array.from(eids).some((eid) => !hasComponent(world, eid, c.Hidden));++ if (anyVisible) {+ eids.forEach(eid => addComponent(world, eid, c.Hidden));+ } else {+ eids.forEach(eid => removeComponent(world, eid, c.Hidden));+ }+ };++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem+ disabled={!world.history.canUndo}+ onSelect={() => world.history.undo()}+ >+ Undo+ <DropdownMenuShortcut>⌘Z</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={!world.history.canRedo}+ onSelect={() => world.history.redo()}+ >+ Redo+ <DropdownMenuShortcut>⇧⌘Z</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem+ disabled={!hasSelection()}+ onSelect={() => copySelection(world)}+ >+ Copy+ <DropdownMenuShortcut>⌘C</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => pasteClipboard(world)}>+ Paste+ <DropdownMenuShortcut>⌘V</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={!hasSelection()}+ onSelect={() => duplicateSelection(world)}+ >+ Duplicate+ <DropdownMenuShortcut>⌘D</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Delete+ <DropdownMenuShortcut>⌫</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem+ disabled={!hasSelection()}+ onSelect={handleToggleHidden}+ >+ Hide+ <DropdownMenuShortcut>⇧⌘H</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={() => selectStageEntities(world)}>+ Select all+ <DropdownMenuShortcut>⌘A</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={!hasSelection()}+ onSelect={() => selectParentEntities(world)}+ >+ Select parent+ <DropdownMenuShortcut>{"\\"}</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={!hasSelection()}+ onSelect={() => selectChildEntities(world)}+ >+ Select children+ <DropdownMenuShortcut>↩︎</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={!hasSelection()}+ onSelect={() => clearComponent(world, c.Selected, false)}+ >+ Deselect+ <DropdownMenuShortcut>Esc</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/file-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/file-menu.tsxnew file mode 100644index 00000000..efe0cf03--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/file-menu.tsx@@ -0,0 +1,377 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { useSearchParams } from "@solidjs/router";+import { getAllEntities } from "bitecs";+import { For, Show, createMemo } from "solid-js";+import { nanoid } from "nanoid";+import { toast } from "somoto";+import { deleteProject, duplicateProject, DEFAULT_PROJECT_ID } from "@/components/engine/db";+import { Not } from "bitecs";+import { ChildOf, isScene, useQuery, loadAsset, changeAssetDirectory, removeAsset } from "@/components/engine";+import { useProjectId } from "@/hooks/use-project-id";+import { useEngine } from "@/context/engine";+import { useExport } from "@/context/export";+import { getDefaultExportTemplate } from "@/components/sidebar-right/inspector/export-templates";+import { showFileDialog, mimeTypeToExtension } from "@/utils";++export function FileMenu() {+ const [, setParams] = useSearchParams();+ const projectId = useProjectId();+ const { world } = useEngine();++ const handleNewProject = () => {+ setParams({+ project: nanoid(),+ dashboard: undefined+ }, { replace: true });+ };++ const handleDuplicateProject = async () => {+ const currentId = projectId();+ if (currentId === DEFAULT_PROJECT_ID) return;++ try {+ const entry = await duplicateProject(currentId);+ if (!entry) return;+ setParams({+ project: entry.id,+ dashboard: undefined+ }, { replace: true });+ } catch {+ toast.error("Failed to duplicate project");+ }+ };++ const handleDeleteProject = async () => {+ const currentId = projectId();+ if (currentId === DEFAULT_PROJECT_ID) return;++ try {+ await deleteProject(currentId);+ setParams({+ project: undefined,+ dashboard: "projects",+ }, { replace: true });+ } catch {+ toast.error("Failed to delete project");+ }+ };++ const handleChangeProjectFolder = async () => {+ try {+ await changeAssetDirectory(world);+ } catch (e) {+ toast.error("Failed to change project folder", {+ description: (e as Error).message,+ });+ }+ };++ const handleImportFromComputer = async () => {+ try {+ const files = await showFileDialog();+ if (files.length === 0) return;+ await Promise.all(files.map((file) => loadAsset(world, file)));+ } catch (e) {+ toast.error("Failed to import assets", {+ description: (e as Error).message,+ });+ }+ };++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleNewProject}>+ New project+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={projectId() === DEFAULT_PROJECT_ID}+ onSelect={handleDuplicateProject}+ >+ Duplicate project+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleChangeProjectFolder}>+ Change project folder...+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleImportFromComputer}>+ Import from computer...+ <DropdownMenuShortcut>⌘I</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Asset</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <FileAssetMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Export</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[246px]">+ <FileExportMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem+ disabled={projectId() === DEFAULT_PROJECT_ID}+ onSelect={handleDeleteProject}+ >+ Delete project+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function FileAssetMenu() {+ const { world } = useEngine();++ const handleDownloadAll = async () => {+ const all = Array.from(world.assets.values());+ if (all.length === 0) {+ toast("No assets to download");+ return;+ }++ let destination: FileSystemDirectoryHandle;+ try {+ destination = await window.showDirectoryPicker({+ mode: "readwrite",+ startIn: "downloads",+ });+ } catch (e) {+ if ((e as Error).name === "AbortError") return;+ toast.error("Failed to download assets", {+ description: (e as Error).message,+ });+ return;+ }++ try {+ const usedNames = new Set<string>();+ await Promise.all(+ all.map(async (asset) => {+ const file = await asset.handle.getFile();+ const base = asset.name.match(/\.[^.]+$/)+ ? asset.name+ : asset.name + mimeTypeToExtension(asset.mimeType);++ let name = base;+ let i = 1;+ while (usedNames.has(name)) {+ const dot = base.lastIndexOf(".");+ name = dot === -1+ ? `${base} (${i})`+ : `${base.slice(0, dot)} (${i})${base.slice(dot)}`;+ i++;+ }+ usedNames.add(name);++ const fileHandle = await destination.getFileHandle(name, { create: true });+ const writable = await fileHandle.createWritable();+ try {+ await writable.write(file);+ } finally {+ await writable.close();+ }+ })+ );+ toast.success(`Downloaded ${all.length} asset${all.length === 1 ? "" : "s"}`);+ } catch (e) {+ toast.error("Failed to download assets", {+ description: (e as Error).message,+ });+ }+ };++ const handleRemoveDuplicates = async () => {+ const all = Array.from(world.assets.values());+ const byHash = new Map<string, typeof all>();+ for (const asset of all) {+ const list = byHash.get(asset.hash) ?? [];+ list.push(asset);+ byHash.set(asset.hash, list);+ }++ const toRemove: string[] = [];+ for (const list of byHash.values()) {+ if (list.length <= 1) continue;+ list.sort((a, b) => a.createdAt.localeCompare(b.createdAt));+ for (const asset of list.slice(1)) toRemove.push(asset.id);+ }++ if (toRemove.length === 0) {+ toast("No duplicated media found");+ return;+ }++ try {+ await removeAsset(world, ...toRemove);+ toast.success(+ `Removed ${toRemove.length} duplicate${toRemove.length === 1 ? "" : "s"}`+ );+ } catch (e) {+ toast.error("Failed to remove duplicated media", {+ description: (e as Error).message,+ });+ }+ };++ const handleRemoveUnused = async () => {+ const referenced = new Set<string>();+ const AssetId = world.components.AssetId;+ for (const eid of getAllEntities(world)) {+ const id = AssetId[eid];+ if (id) referenced.add(id);+ }++ const toRemove = Array.from(world.assets.values())+ .filter((asset) => !referenced.has(asset.id))+ .map((asset) => asset.id);++ if (toRemove.length === 0) {+ toast("No unused media found");+ return;+ }++ try {+ await removeAsset(world, ...toRemove);+ toast.success(+ `Removed ${toRemove.length} unused asset${toRemove.length === 1 ? "" : "s"}`+ );+ } catch (e) {+ toast.error("Failed to remove unused media", {+ description: (e as Error).message,+ });+ }+ };++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleDownloadAll}>+ Download all assets...+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleRemoveDuplicates}>+ Remove duplicated media...+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={handleRemoveUnused}>+ Remove unused media...+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function FileExportMenu() {+ const { world } = useEngine();+ const { exportScene, exportCurrentFrame } = useExport();++ const handleExportScene = async () => {+ const sceneEid = world.selection.scene;+ if (sceneEid === null) {+ toast("No active scene to export");+ return;+ }+ await exportScene(sceneEid, getDefaultExportTemplate());+ };++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleExportScene}>+ Export scene...+ <DropdownMenuShortcut>⌘E</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Export specific scene</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[172px]">+ <FileExportSpecificSceneMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={() => exportCurrentFrame()}>+ Export current frame as image+ <DropdownMenuShortcut>⇧⌘E</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function FileExportSpecificSceneMenu() {+ const { world } = useEngine();+ const { exportScene } = useExport();++ const c = world.components;+ const children = useQuery([c.Geometry, c.Playback, Not(ChildOf('*')), Not(c.Deleted)]);+ const scenes = createMemo(() => children().filter((eid) => isScene(world, eid)));++ const handleExport = async (sceneEid: number) => {+ await exportScene(sceneEid, getDefaultExportTemplate());+ };++ return (+ <DropdownMenuGroup>+ <Show+ when={scenes().length > 0}+ fallback={+ <DropdownMenuItem disabled>No scenes available</DropdownMenuItem>+ }+ >+ <For each={scenes()}>+ {(sceneEid, index) => (+ <DropdownMenuItem onSelect={() => handleExport(sceneEid)}>+ {world.components.Name[sceneEid] || `Scene ${index() + 1}`}+ </DropdownMenuItem>+ )}+ </For>+ </Show>+ </DropdownMenuGroup>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/help-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/help-menu.tsxnew file mode 100644index 00000000..4b379bfc--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/help-menu.tsx@@ -0,0 +1,52 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { toast } from "somoto";+import {+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { useAuth } from "@/context/auth";++export function HelpMenu() {+ const auth = useAuth();++ const copyUserId = async () => {+ const id = auth.user()?.id;+ if (!id) return;++ try {+ await navigator.clipboard.writeText(id);+ toast("Copied!", { description: "The user id has been copied to your clipboard." });+ } catch (error) {+ toast("Failed to copy", { description: error instanceof Error ? error.message : "Unknown error" });+ }+ };++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem as="a" href="https://www.diffusion.studio/updates" target="_blank">+ What’s new+ </DropdownMenuItem>+ <DropdownMenuItem as="a" href="https://discord.gg/AYySWDhgNK" target="_blank">+ Discord community+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem as="a" href="mailto:[email protected]" target="_blank">+ Report issue+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={copyUserId}>Copy user id</DropdownMenuItem>+ <DropdownMenuItem as="a" href="https://discord.gg/AYySWDhgNK" target="_blank">+ Contact support+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/index.tsx b/apps/web/src/components/sidebar-left/project-menu/index.tsxnew file mode 100644index 00000000..c76ba6cf--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/index.tsx@@ -0,0 +1,126 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Icon } from "@/components/ui/icon";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuTrigger,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { useSearchParams } from "@solidjs/router";+import { FileMenu } from "./file-menu";+import { EditMenu } from "./edit-menu";+import { ViewMenu } from "./view-menu";+import { ToolMenu } from "./tool-menu";+import { AiCreditsMenu } from "./ai-credits-menu";+import { HelpMenu } from "./help-menu";++export function ProjectMenu() {+ const [, setParams] = useSearchParams();++ const handleOpenDashboard = () => {+ (document.activeElement as HTMLElement)?.blur?.();+ setParams({ dashboard: "projects" }, { replace: true });+ };++ const handleOpenAccount = () => {+ (document.activeElement as HTMLElement)?.blur?.();+ setParams({ dashboard: "account" }, { replace: true });+ };++ return (+ <>+ <DropdownMenu placement="bottom-start">+ <DropdownMenuTrigger+ as="button"+ type="button"+ class="flex items-center gap-0 h-7 rounded-md text-muted-foreground outline-none focus-ring hover:text-foreground data-expanded:text-foreground"+ >+ <Icon name="diffusion-logo" class="size-6" />+ <Icon name="chevron-down" class="size-6" />+ </DropdownMenuTrigger>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-[188px]">+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={handleOpenDashboard}>+ Go to dashboard+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>File</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <FileMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>++ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Edit</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <EditMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>++ <DropdownMenuSub>+ <DropdownMenuSubTrigger>View</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[216px]">+ <ViewMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>++ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Tool</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[172px]">+ <ToolMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>AI credits</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[188px]">+ <AiCreditsMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>++ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Help</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[188px]">+ <HelpMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>++ <DropdownMenuItem onSelect={handleOpenAccount}>Account</DropdownMenuItem>+ </DropdownMenuGroup>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/object-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/object-menu.tsxnew file mode 100644index 00000000..904a3e24--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/object-menu.tsx@@ -0,0 +1,232 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";++export function ObjectMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>AI actions</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <ObjectAiMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Wrap in scene+ <DropdownMenuShortcut>⌘⌥↩︎</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Bring to front+ <DropdownMenuShortcut>]</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Bring forward+ <DropdownMenuShortcut>⌘]</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Send backward+ <DropdownMenuShortcut>⌘[</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Send to back+ <DropdownMenuShortcut>[</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Insert at playhead+ <DropdownMenuShortcut>’</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Insert on new track+ <DropdownMenuShortcut>⇧’</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Insert on canvas+ <DropdownMenuShortcut>⌥’</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Align</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <ObjectAlignMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Transform</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <ObjectTransformMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Set mask target+ <DropdownMenuShortcut>⌃⌥M</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Reveal in assets+ <DropdownMenuShortcut>⇧⌘O</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Reveal in finder+ <DropdownMenuShortcut>⌥⌘O</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Replace media...+ <DropdownMenuShortcut>⌥O</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Remove properties</DropdownMenuItem>+ <DropdownMenuItem>Remove effects</DropdownMenuItem>+ <DropdownMenuItem>Remove transitions</DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function ObjectAiMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>Remove background</DropdownMenuItem>+ <DropdownMenuItem>Upscale</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Remove silences</DropdownMenuItem>+ <DropdownMenuItem>Lip sync</DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function ObjectTransformMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>+ Scale+ <DropdownMenuShortcut>K</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Flip horizontal+ <DropdownMenuShortcut>⇧H</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Flip vertical+ <DropdownMenuShortcut>⇧V</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>Rotate 180°</DropdownMenuItem>+ <DropdownMenuItem>Rotate 90° left</DropdownMenuItem>+ <DropdownMenuItem>Rotate 90° right</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Reset transform</DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function ObjectAlignMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>+ Align left+ <DropdownMenuShortcut>⌥A</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Align horizontal centers+ <DropdownMenuShortcut>⌥H</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Align right+ <DropdownMenuShortcut>⌥D</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Align top+ <DropdownMenuShortcut>⌥W</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Align vertical centers+ <DropdownMenuShortcut>⌥V</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Align bottom+ <DropdownMenuShortcut>⌥S</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Distribute horizontally+ <DropdownMenuShortcut>⌃⌥H</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Distribute vertically+ <DropdownMenuShortcut>⌃⌥V</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/preferences-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/preferences-menu.tsxnew file mode 100644index 00000000..55c136dd--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/preferences-menu.tsx@@ -0,0 +1,187 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuCheckboxItem,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+ DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { COLOR_MODE_STORAGE_KEY, useColorMode } from "@kobalte/core";+import { createEffect, createSignal } from "solid-js";+import type { Theme } from "./types";++const getStoredThemePreference = (): Theme | undefined => {+ if (typeof window === "undefined") return undefined;++ try {+ const stored = window.localStorage.getItem(COLOR_MODE_STORAGE_KEY);+ if (stored === "light" || stored === "dark" || stored === "system") {+ return stored;+ }+ } catch {+ // ignore storage access errors and fall back to resolved color mode+ }++ return undefined;+};++export function PreferencesMenu() {+ const { colorMode, setColorMode } = useColorMode();++ const [snapToGeometry, setSnapToGeometry] = createSignal(true);+ const [snapToObjects, setSnapToObjects] = createSignal(true);+ const [showInfoTooltips, setShowInfoTooltips] = createSignal(true);+ const [useNumberKeysForOpacity, setUseNumberKeysForOpacity] =+ createSignal(true);+ const [invertedZoomDirection, setInvertedZoomDirection] =+ createSignal(false);+ const [timelineSnapping, setTimelineSnapping] = createSignal(true);+ const [showSeekIndicatorOnTimeline, setShowSeekIndicatorOnTimeline] =+ createSignal(false);+ const [onlyShowSelectedClipsKeyframes, setOnlyShowSelectedClipsKeyframes] =+ createSignal(false);+ const [theme, setThemePreference] = createSignal<Theme>("dark");++ createEffect(() => {+ const resolvedColorMode = colorMode();+ setThemePreference(getStoredThemePreference() ?? resolvedColorMode);+ });++ const setTheme = (nextTheme: Theme) => {+ setThemePreference(nextTheme);+ setColorMode(nextTheme);+ };++ const resetToDefaults = () => {+ setSnapToGeometry(true);+ setSnapToObjects(true);+ setShowInfoTooltips(true);+ setUseNumberKeysForOpacity(true);+ setInvertedZoomDirection(false);+ setTimelineSnapping(true);+ setShowSeekIndicatorOnTimeline(false);+ setOnlyShowSelectedClipsKeyframes(false);+ setTheme("dark");+ };++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>Files & permissions...</DropdownMenuItem>+ <DropdownMenuItem>Keyboard shortcuts...</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuCheckboxItem+ checked={snapToGeometry()}+ onChange={setSnapToGeometry}+ >+ Snap to geometry+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ checked={snapToObjects()}+ onChange={setSnapToObjects}+ >+ Snap to objects+ </DropdownMenuCheckboxItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuCheckboxItem+ checked={showInfoTooltips()}+ onChange={setShowInfoTooltips}+ >+ Show info tooltips+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ checked={useNumberKeysForOpacity()}+ onChange={setUseNumberKeysForOpacity}+ >+ Use number keys for opacity+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ checked={invertedZoomDirection()}+ onChange={setInvertedZoomDirection}+ >+ Inverted zoom direction+ </DropdownMenuCheckboxItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuCheckboxItem+ checked={timelineSnapping()}+ onChange={setTimelineSnapping}+ >+ Timeline snapping+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ checked={showSeekIndicatorOnTimeline()}+ onChange={setShowSeekIndicatorOnTimeline}+ >+ Show seek indicator on timeline+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ checked={onlyShowSelectedClipsKeyframes()}+ onChange={setOnlyShowSelectedClipsKeyframes}+ >+ Only show selected clips’ keyframes+ </DropdownMenuCheckboxItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Editor nudge amount...</DropdownMenuItem>+ <DropdownMenuItem>Timeline nudge amount...</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Theme</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[152px]">+ <DropdownMenuRadioGroup+ value={theme()}+ onChange={(value) => setTheme(value as Theme)}+ >+ <DropdownMenuRadioItem value="light">+ Light+ </DropdownMenuRadioItem>+ <DropdownMenuRadioItem value="dark">+ Dark+ </DropdownMenuRadioItem>+ <DropdownMenuRadioItem value="system">+ System theme+ </DropdownMenuRadioItem>+ </DropdownMenuRadioGroup>+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={resetToDefaults}>+ Reset all to default+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/text-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/text-menu.tsxnew file mode 100644index 00000000..7ce86ff1--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/text-menu.tsx@@ -0,0 +1,69 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";++export function TextMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>+ Bold+ <DropdownMenuShortcut>⌘B</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Italic+ <DropdownMenuShortcut>⌘I</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Underline+ <DropdownMenuShortcut>⌘U</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Strikethrough+ <DropdownMenuShortcut>⇧⌘X</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Text align left+ <DropdownMenuShortcut>⌥⌘L</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Text align center+ <DropdownMenuShortcut>⌥⌘T</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Text align right+ <DropdownMenuShortcut>⌥⌘R</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Text align justified+ <DropdownMenuShortcut>⌥⌘J</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Wrap in caption group+ <DropdownMenuShortcut>⇧⌥C</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Detach caption group+ <DropdownMenuShortcut>⌥⌘B</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/timeline-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/timeline-menu.tsxnew file mode 100644index 00000000..723bd99c--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/timeline-menu.tsx@@ -0,0 +1,294 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";++export function TimelineMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>Scene settings...</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Captions</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <TimelineCaptionsMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Select nearest+ <DropdownMenuShortcut>⌃V</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Select</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[236px]">+ <TimelineSelectMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Split at playhead+ <DropdownMenuShortcut>⌘B</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Track</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <TimelineTrackMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Clip</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[212px]">+ <TimelineClipMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Audio</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[196px]">+ <TimelineAudioMenu />+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Add marker+ <DropdownMenuShortcut>M</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Mark in / clear in+ <DropdownMenuShortcut>I</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Mark out / clear out+ <DropdownMenuShortcut>O</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Clear all markers+ <DropdownMenuShortcut>⌥M</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Add transition to both+ <DropdownMenuShortcut>⌘T</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Add video transition+ <DropdownMenuShortcut>⌥T</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Add audio transition+ <DropdownMenuShortcut>⇧T</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Toggle keyframes+ <DropdownMenuShortcut>U</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function TimelineSelectMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>Select videos</DropdownMenuItem>+ <DropdownMenuItem>Select audio</DropdownMenuItem>+ <DropdownMenuItem>Select texts</DropdownMenuItem>+ <DropdownMenuItem>Select images</DropdownMenuItem>+ <DropdownMenuItem>Select captions</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Select forward on track+ <DropdownMenuShortcut>Y</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Select forward on all tracks+ <DropdownMenuShortcut>⌥Y</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Select backward on track+ <DropdownMenuShortcut>⌘Y</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Select backward on all tracks+ <DropdownMenuShortcut>⌥⌘Y</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Select next+ <DropdownMenuShortcut>⌥⌘→</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Select previous+ <DropdownMenuShortcut>⌥⌘←</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Select above+ <DropdownMenuShortcut>⌥⌘↓</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ Select below+ <DropdownMenuShortcut>⌥⌘↑</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function TimelineCaptionsMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>Generate captions...</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Change caption preset...</DropdownMenuItem>+ <DropdownMenuItem>Change caption language...</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Export captions...</DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function TimelineClipMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>+ Change clip speed+ <DropdownMenuShortcut>R</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>Reset clip speed</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>+ Enable/disable clip+ <DropdownMenuShortcut>D</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function TimelineTrackMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>+ Enable/disable track+ <DropdownMenuShortcut>D</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>Mute/unmute track</DropdownMenuItem>+ <DropdownMenuItem>Toggle track solo</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Toggle magnetic track</DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}++export function TimelineAudioMenu() {+ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem>+ Mute/unmute audio+ <DropdownMenuShortcut>⌥M</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Increase audio by 1 dB</DropdownMenuItem>+ <DropdownMenuItem>Decrease audio by 1 dB</DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem>Increase audio by 3 dB</DropdownMenuItem>+ <DropdownMenuItem>Decrease audio by 3 dB</DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/tool-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/tool-menu.tsxnew file mode 100644index 00000000..6d3a6fc5--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/tool-menu.tsx@@ -0,0 +1,45 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { usePromptInput } from "@/context/prompt-input";+import { useEngine } from "@/context/engine";+import { ToolType } from "@/components/engine/components";++export function ToolMenu() {+ const { setPromptInputOpen } = usePromptInput();+ const { world } = useEngine();++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={() => setPromptInputOpen(true)}>+ Generate with AI...+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={() => (world.selection.tool = ToolType.SCENE)}>+ Scene+ <DropdownMenuShortcut>F</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => (world.selection.tool = ToolType.TEXT)}>+ Text+ <DropdownMenuShortcut>T</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => (world.selection.tool = ToolType.RECT)}>+ Rectangle+ <DropdownMenuShortcut>R</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/project-menu/types.ts b/apps/web/src/components/sidebar-left/project-menu/types.tsnew file mode 100644index 00000000..1497ce09--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/types.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export type Theme = "light" | "dark" | "system";diff --git a/apps/web/src/components/sidebar-left/project-menu/view-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/view-menu.tsxnew file mode 100644index 00000000..cce815af--- /dev/null+++ b/apps/web/src/components/sidebar-left/project-menu/view-menu.tsx@@ -0,0 +1,62 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuGroup,+} from "@/components/ui/dropdown-menu";+import { useEngine } from "@/context/engine";+import { useLayout } from "@/context/layout";+import { useECS } from "@/context/ecs";++export function ViewMenu() {+ const engine = useEngine();+ const layout = useLayout();+ const { selectedNodes } = useECS();++ const hasSelection = () => selectedNodes().size > 0;++ return (+ <>+ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={() => engine.camera.zoomBy(1.25)}>+ Zoom in+ <DropdownMenuShortcut>⌘+</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => engine.camera.zoomBy(0.8)}>+ Zoom out+ <DropdownMenuShortcut>⌘-</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => engine.camera.resetZoom()}>+ Zoom to 100%+ <DropdownMenuShortcut>⌘0</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => engine.camera.fitToActiveScene()}>+ Zoom to fit+ <DropdownMenuShortcut>⌘1</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem+ disabled={!hasSelection()}+ onSelect={() => engine.camera.fitToSelection()}+ >+ Zoom to selection+ <DropdownMenuShortcut>⌘2</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />++ <DropdownMenuGroup>+ <DropdownMenuItem onSelect={layout.toggleUI}>+ Toggle UI+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={layout.toggleTimeline}>+ Toggle timeline+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-left/sidebar-left.tsx b/apps/web/src/components/sidebar-left/sidebar-left.tsxnew file mode 100644index 00000000..7f4d0ba6--- /dev/null+++ b/apps/web/src/components/sidebar-left/sidebar-left.tsx@@ -0,0 +1,126 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Assets } from "./assets";+import { useLayout } from "@/context/layout";+import { useElectron } from "@/context/electron";+import { createSignal, Show } from "solid-js";+import { Button } from "../ui/button";+import { Icon } from "../ui/icon";+import { ProjectMenu } from "./project-menu";+import { useProjectId } from "@/hooks/use-project-id";+import { getProjectName, setProjectName } from "../engine/db";+import { createResource } from "solid-js";+import { Separator } from "@/components/ui/separator";+import { cx } from "@/lib/cva";++export function SidebarLeft() {+ return (+ <div class="flex flex-col h-full overflow-hidden">+ <ElectronHeader />+ <ProjectHeader />+ <Assets />+ </div>+ );+}++export function ElectronHeader() {+ const { isDesktop, isFullscreen } = useElectron();+ const { toggleTimeline, toggleUI } = useLayout();++ return (+ <Show when={isDesktop}>+ <div class="h-10 border-b border-border shrink-0 pr-4 pl-1.5 gap-1 relative flex items-center">+ <div class="flex-1 h-full data-[fullscreen=true]:flex-none transition-all duration-100 ease-out" data-fullscreen={isFullscreen()} />+ <div class="flex items-center gap-1 relative z-30" style="-webkit-app-region: no-drag;">+ <Button variant="ghost" size="icon" class="text-muted-foreground" onClick={toggleTimeline}>+ <Icon name="sidebar-timeline" />+ </Button>+ <Button variant="ghost" size="icon" class="text-muted-foreground" onClick={toggleUI}>+ <Icon name="sidebar" />+ </Button>+ </div>+ </div>+ </Show>+ )+}++type ProjectHeaderProps = {+ class?: string;+}++export function ProjectHeader(props: ProjectHeaderProps) {+ const projectId = useProjectId();+ const [projectNameDraft, setProjectNameDraft] = createSignal<string | null>(null);+ const [projectName, { refetch: refetchProjectName }] = createResource(() => getProjectName(projectId()));++ const handleProjectNameInput = (event: InputEvent & { currentTarget: HTMLInputElement }) => {+ setProjectNameDraft(event.currentTarget.value);+ };++ const handleFocusNameInput = (event: FocusEvent & { currentTarget: HTMLInputElement }) => {+ setProjectNameDraft(projectName() ?? null);+ event.currentTarget.select();+ };++ const handleBlurNameInput = () => {+ setProjectNameDraft(null);+ };++ const handleKeyDownNameInput = async (event: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (event.key === "Enter") {+ const input = event.currentTarget;+ const trimmedName = projectNameDraft()?.trim() ?? "";+ const currentName = projectName() ?? "";++ if (trimmedName.length > 0 && trimmedName !== currentName) {+ await setProjectName(projectId(), trimmedName);+ }++ refetchProjectName();+ setProjectNameDraft(null);+ input.blur();+ }++ if (event.key === "Escape") {+ event.currentTarget.blur();+ refetchProjectName();+ setProjectNameDraft(null);+ }+ };++ return (+ <div class={cx("h-12 shrink-0 flex items-center gap-2 pr-4 pl-2.5", props.class)}>+ <ProjectMenu />+ <Separator orientation="vertical" class="h-6 max-h-6" />+ <div class="flex items-center w-full">+ <input+ type="text"+ value={projectNameDraft() ?? projectName() ?? ""}+ onInput={handleProjectNameInput}+ onFocus={handleFocusNameInput}+ onBlur={handleBlurNameInput}+ onKeyDown={handleKeyDownNameInput}+ placeholder="Project name"+ class="w-full bg-transparent focus-ring px-1 h-5 ml-1 rounded text-xs text-muted-foreground font-strong outline-none"+ />+ </div>+ </div>+ )+}++export function FloatingProjectHeader() {+ const { isDesktop } = useElectron();+ const { toggleUI } = useLayout();++ return (+ <div data-desktop={isDesktop} class="h-10 rounded-lg border border-border shrink-0 flex items-center px-2 gap-1 fixed top-4 data-[desktop=true]:top-10 left-4 z-30 bg-background shadow-lg">+ <ProjectMenu />+ <span class="text-xs text-muted-foreground font-450">Diffusion Studio</span>+ <Button variant="ghost" size="icon" class="text-muted-foreground ml-2" onClick={toggleUI}>+ <Icon name="sidebar" />+ </Button>+ </div>+ )+}diff --git a/apps/web/src/components/sidebar-right/index.ts b/apps/web/src/components/sidebar-right/index.tsnew file mode 100644index 00000000..79909408--- /dev/null+++ b/apps/web/src/components/sidebar-right/index.ts@@ -0,0 +1,6 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './inspector';+export * from './soundboard';diff --git a/apps/web/src/components/sidebar-right/inspector/alignment.tsx b/apps/web/src/components/sidebar-right/inspector/alignment.tsxnew file mode 100644index 00000000..32b71785--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/alignment.tsx@@ -0,0 +1,289 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { For } from "solid-js";++import { Icon } from "@/components/ui/icon";+import { useEngine } from "@/context/engine";+import { isScene, setComponent } from "@/components/engine";+import { getParentEntity } from "@/components/engine/api";+import { invert2D, transformPoint } from "@/components/engine/math/aabb";+import { Or, query } from "bitecs";+++const ALIGNMENT_ACTIONS = [+ /** Horizontal alignment */+ {+ id: "align-left",+ icon: "horizontal-align-left",+ label: "Align left"+ },+ {+ id: "align-center-horizontal",+ icon: "horizontal-align-center",+ label: "Align center horizontally",+ },+ {+ id: "align-right",+ icon: "horizontal-align-right",+ label: "Align right"+ },+ /** Vertical alignment */+ {+ id: "align-top",+ icon: "vertical-align-top",+ label: "Align top"+ },+ {+ id: "align-center-vertical",+ icon: "vertical-align-center",+ label: "Align center vertically",+ },+ {+ id: "align-bottom",+ icon: "vertical-align-bottom",+ label: "Align bottom",+ },+ /** Distribute horizontally */+ {+ id: "distribute-horizontal",+ icon: "distribute-center-horizontal",+ label: "Distribute horizontally",+ },+ /** Distribute vertically */+ {+ id: "distribute-vertical",+ icon: "distribute-center-vertical",+ label: "Distribute vertically",+ },+] as const;++export type AlignmentAction = (typeof ALIGNMENT_ACTIONS)[number]["id"];++type Axis = "x" | "y";++type SelectionMask = {+ minX: number;+ minY: number;+ maxX: number;+ maxY: number;+ width: number;+ height: number;+ centerX: number;+ centerY: number;+};++export function Alignment() {+ const { world } = useEngine();+ const c = world.components;++ /**+ * Return selected entities that live directly inside a scene, plus top-level+ * entities (scenes themselves) which are parented to nothing / the root.+ */+ const getSelectedEids = () =>+ [...query(world, [c.Selected, Or(c.Geometry, c.Group)])].filter(+ (eid) => {+ const parentEid = getParentEntity(world, eid);+ return parentEid === null || isScene(world, parentEid);+ }+ );++ const getSelectionMask = (): SelectionMask | null => {+ const eids = getSelectedEids();+ if (eids.length === 0) return null;++ const minX = Math.min(...eids.map((eid) => c.WorldBounds.minX[eid]));+ const minY = Math.min(...eids.map((eid) => c.WorldBounds.minY[eid]));+ const maxX = Math.max(...eids.map((eid) => c.WorldBounds.maxX[eid]));+ const maxY = Math.max(...eids.map((eid) => c.WorldBounds.maxY[eid]));++ return {+ minX,+ minY,+ maxX,+ maxY,+ width: maxX - minX,+ height: maxY - minY,+ centerX: (minX + maxX) / 2,+ centerY: (minY + maxY) / 2,+ };+ };++ /** Convert a world-space delta into the parent's local space for the given entity. */+ const worldDeltaToParentLocal = (eid: number, dx: number, dy: number) => {+ const parentEid = getParentEntity(world, eid);++ const parentMat =+ parentEid !== null+ ? {+ a: c.WorldTransform.a[parentEid],+ b: c.WorldTransform.b[parentEid],+ c: c.WorldTransform.c[parentEid],+ d: c.WorldTransform.d[parentEid],+ e: c.WorldTransform.e[parentEid],+ f: c.WorldTransform.f[parentEid],+ }+ : {+ a: world.camera.a * world.resolution,+ b: world.camera.b * world.resolution,+ c: world.camera.c * world.resolution,+ d: world.camera.d * world.resolution,+ e: world.camera.e * world.resolution,+ f: world.camera.f * world.resolution,+ };++ const inv = invert2D(parentMat);+ const localOrigin = transformPoint(inv, 0, 0);+ const localDelta = transformPoint(inv, dx, dy);++ return {+ x: localDelta.x - localOrigin.x,+ y: localDelta.y - localOrigin.y,+ };+ };++ const moveNodeByWorldDelta = (eid: number, dx: number, dy: number) => {+ if (dx === 0 && dy === 0) return;++ const localDelta = worldDeltaToParentLocal(eid, dx, dy);+ if (!localDelta) return;++ setComponent(world, eid, c.Position, {+ x: c.Position.x[eid] + localDelta.x,+ y: c.Position.y[eid] + localDelta.y,+ });+ };++ /**+ * Align every selected item relative to the selection's bounding box.+ * A single selected item is a no-op (the selection bounds equal the item).+ */+ const alignSelection = (action: AlignmentAction) => {+ const eids = getSelectedEids();+ if (eids.length < 2) return;++ const mask = getSelectionMask();+ if (!mask) return;++ world.history.transaction("Align selection", () => {+ for (const eid of eids) {+ const boundsWidth = c.WorldBounds.maxX[eid] - c.WorldBounds.minX[eid];+ const boundsHeight = c.WorldBounds.maxY[eid] - c.WorldBounds.minY[eid];++ let targetMinX = c.WorldBounds.minX[eid];+ let targetMinY = c.WorldBounds.minY[eid];++ if (action === "align-left") {+ targetMinX = mask.minX;+ }+ if (action === "align-center-horizontal") {+ targetMinX = mask.centerX - boundsWidth / 2;+ }+ if (action === "align-right") {+ targetMinX = mask.maxX - boundsWidth;+ }+ if (action === "align-top") {+ targetMinY = mask.minY;+ }+ if (action === "align-center-vertical") {+ targetMinY = mask.centerY - boundsHeight / 2;+ }+ if (action === "align-bottom") {+ targetMinY = mask.maxY - boundsHeight;+ }++ moveNodeByWorldDelta(eid, targetMinX - c.WorldBounds.minX[eid], targetMinY - c.WorldBounds.minY[eid]);+ }+ });+ };++ const distributeSelection = (axis: Axis) => {+ const eids = getSelectedEids();+ if (eids.length < 3) return;++ const mask = getSelectionMask();+ if (!mask) return;++ const isHorizontal = axis === "x";+ const sorted = [...eids].sort((a, b) =>+ isHorizontal+ ? c.WorldBounds.minX[a] - c.WorldBounds.minX[b]+ : c.WorldBounds.minY[a] - c.WorldBounds.minY[b]+ );++ const totalSize = sorted.reduce(+ (sum, eid) =>+ sum ++ (isHorizontal+ ? c.WorldBounds.maxX[eid] - c.WorldBounds.minX[eid]+ : c.WorldBounds.maxY[eid] - c.WorldBounds.minY[eid]),+ 0+ );+ const maskSize = isHorizontal ? mask.width : mask.height;+ const gap = (maskSize - totalSize) / (sorted.length - 1);++ let cursor = isHorizontal ? mask.minX : mask.minY;++ world.history.transaction("Distribute entities", () => {+ for (const eid of sorted) {+ const currentMin = isHorizontal ? c.WorldBounds.minX[eid] : c.WorldBounds.minY[eid];+ const size = isHorizontal+ ? c.WorldBounds.maxX[eid] - c.WorldBounds.minX[eid]+ : c.WorldBounds.maxY[eid] - c.WorldBounds.minY[eid];+ const delta = cursor - currentMin;++ if (isHorizontal) {+ moveNodeByWorldDelta(eid, delta, 0);+ } else {+ moveNodeByWorldDelta(eid, 0, delta);+ }++ cursor += size + gap;+ }+ }+ );+ };++ const handleAction = (action: AlignmentAction) => {+ if (action === "distribute-horizontal") {+ distributeSelection("x");+ return;+ }++ if (action === "distribute-vertical") {+ distributeSelection("y");+ return;+ }++ alignSelection(action);+ };++ return (+ <div+ role="toolbar"+ aria-label="Alignment"+ class="flex h-12 items-center gap-2 border-t border-border px-4"+ >+ <For each={ALIGNMENT_ACTIONS}>+ {(item) => (+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground w-5.5 h-7"+ onClick={() => handleAction(item.id)}+ >+ <Icon name={item.icon} />+ </TooltipTrigger>+ <TooltipContent>{item.label}</TooltipContent>+ </Tooltip>+ )}+ </For>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/animations.tsx b/apps/web/src/components/sidebar-right/inspector/animations.tsxnew file mode 100644index 00000000..f9f36fa6--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/animations.tsx@@ -0,0 +1,359 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { ControlRow } from "@/components/ui/control-group";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuGroupLabel,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorSeparator,+} from "@/components/ui/floating-inspector";+import { Icon } from "@/components/ui/icon";+import { ItemRow } from "@/components/ui/item-row";+import { PanelSection } from "@/components/ui/panel-section";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { SliderInput } from "@/components/ui/slider-input";+import { For, Show, createMemo, createSignal } from "solid-js";++import { useEntityState, AnimationType, AnimationPhase, PaintType, createEntity, deleteEntity, isAudio, isText, appendChild, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { secondsToFrames } from "@/components/engine/utils/time";+++type AnimationsSettingsProps = {+ selection: Set<number>;+};++const ANIMATION_LABELS: Record<AnimationType, string> = {+ [AnimationType.FADE]: "Fade",+ [AnimationType.GAIN]: "Volume",+ [AnimationType.GROW]: "Grow",+ [AnimationType.SHRINK]: "Shrink",+ [AnimationType.BLUR]: "Blur",+ [AnimationType.SLIDE_LEFT]: "Slide left",+ [AnimationType.SLIDE_RIGHT]: "Slide right",+ [AnimationType.SLIDE_UP]: "Slide up",+ [AnimationType.SLIDE_DOWN]: "Slide down",+ [AnimationType.SPIN]: "Spin",+ [AnimationType.TWIST]: "Twist",+ [AnimationType.APPEAR_WORD]: "Appear word",+ [AnimationType.APPEAR_CHAR]: "Appear character",+ [AnimationType.SCRAMBLE]: "Scramble",+};++type AnimationGroupKind = "text" | "audio";++const ANIMATION_GROUPS: Array<{ label: string; types: AnimationType[]; kind?: AnimationGroupKind }> = [+ {+ label: "Fade",+ types: [+ AnimationType.FADE,+ AnimationType.SLIDE_LEFT,+ AnimationType.SLIDE_RIGHT,+ AnimationType.SLIDE_UP,+ AnimationType.SLIDE_DOWN,+ ],+ },+ {+ label: "Scale",+ types: [+ AnimationType.GROW,+ AnimationType.SHRINK,+ AnimationType.SPIN,+ AnimationType.TWIST,+ ],+ },+ {+ label: "Blur",+ types: [AnimationType.BLUR],+ },+ {+ label: "Text",+ kind: "text",+ types: [+ AnimationType.APPEAR_WORD,+ AnimationType.APPEAR_CHAR,+ AnimationType.SCRAMBLE,+ ],+ },+ {+ label: "Audio",+ kind: "audio",+ types: [AnimationType.GAIN],+ },+];++type AnimationRowProps = {+ animEid: number;+ onInspect(): void;+ onRemove(): void;+};++function AnimationRow(props: AnimationRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const animationType = useEntityState(c.Animation.type, props.animEid, 0);+ const animationPhase = useEntityState(c.Animation.phase, props.animEid, 0);++ const label = createMemo(() => ANIMATION_LABELS[animationType() as AnimationType]);+ const phaseLabel = createMemo(() => animationPhase() === AnimationPhase.OUT ? "OUT" : "IN");++ return (+ <ItemRow+ value={label()}+ label={phaseLabel()}+ icon={<Icon name="preferences-adjust" />}+ onClick={props.onInspect}+ >+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={props.onRemove}+ >+ <Icon name="close-remove-small" />+ </TooltipTrigger>+ <TooltipContent>Remove animation</TooltipContent>+ </Tooltip>+ </ItemRow>+ );+}++export function AnimationsSettings(props: AnimationsSettingsProps) {+ const { world } = useEngine();+ const c = world.components;++ const [inspectingAnimation, setInspectingAnimation] = createSignal<number>();++ let inspectorAnchorRef: HTMLDivElement | undefined;++ const eid = () => props.selection.values().next().value!;+ const animations = useEntityState(c.Cache.animations, eid, []);+ const fillEids = useEntityState(c.Cache.fills, eid, [] as number[]);++ const availableGroups = createMemo(() => {+ // Captions are also text-geometry, so isText covers both.+ const isTextNode = isText(world, eid());+ const isAudioNode = isAudio(world, eid());+ const hasVideoFill = fillEids().some(fid => c.Paint[fid] === PaintType.VIDEO);+ const hasAudio = isAudioNode || hasVideoFill;++ return ANIMATION_GROUPS.filter(group => {+ if (group.kind === "text") return isTextNode;+ if (group.kind === "audio") return hasAudio;+ return true;+ });+ });++ const inAnimEids = createMemo(() =>+ animations().filter(animEid => c.Animation.phase[animEid] !== AnimationPhase.OUT)+ );+ const outAnimEids = createMemo(() =>+ animations().filter(animEid => c.Animation.phase[animEid] === AnimationPhase.OUT)+ );++ const handleAddAnimation = (type: AnimationType) => {+ world.history.transaction('Add animation', () => {+ const animEid = createEntity(world);+ setComponent(world, animEid, c.Animation, {+ duration: world.frameRate,+ type,+ phase: AnimationPhase.IN,+ });+ appendChild(world, animEid, eid());+ });+ };++ const handleRemoveAnimation = (aid: number) => deleteEntity(world, aid);+ const handleInspectAnimation = (aid: number) => setInspectingAnimation(aid);++ // Read inspected animation's data reactively+ const inspectedPhase = useEntityState(c.Animation.phase, inspectingAnimation, 0);+ const inspectedDuration = useEntityState(c.Animation.duration, inspectingAnimation, world.frameRate);+ const inspectedDurationInSeconds = createMemo(() => inspectedDuration() / world.frameRate);+ const inspectedDelay = useEntityState(c.Animation.delay, inspectingAnimation, 0);+ const inspectedDelayInSeconds = createMemo(() => inspectedDelay() / world.frameRate);++ const handleDurationChange = (durationSec: number) => {+ const eid = inspectingAnimation();+ if (!eid) return;+ setComponent(world, eid, c.Animation, { duration: secondsToFrames(durationSec) });+ };++ const handleDelayChange = (delaySec: number) => {+ const eid = inspectingAnimation();+ if (!eid) return;+ setComponent(world, eid, c.Animation, { delay: secondsToFrames(delaySec) });+ };++ const handlePhaseChange = (phase: AnimationPhase) => {+ const eid = inspectingAnimation();+ if (!eid) return;+ setComponent(world, eid, c.Animation, { phase });+ };++ return (+ <>+ <PanelSection+ title="Animations"+ ref={inspectorAnchorRef}+ actions={+ <DropdownMenu placement="bottom-end" modal>+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ {...buttonProps}+ >+ <Icon name="plus-add" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Add animation</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent>+ <For each={availableGroups()}>+ {(group, index) => (+ <>+ <Show when={index() > 0}>+ <DropdownMenuSeparator />+ </Show>+ <DropdownMenuGroup>+ <DropdownMenuGroupLabel>{group.label}</DropdownMenuGroupLabel>+ <For each={group.types}>+ {(type) => (+ <DropdownMenuItem onSelect={() => handleAddAnimation(type)}>+ {ANIMATION_LABELS[type]}+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuGroup>+ </>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ }+ >+ <For each={inAnimEids()}>+ {(animEid) => (+ <AnimationRow+ animEid={animEid}+ onInspect={() => handleInspectAnimation(animEid)}+ onRemove={() => handleRemoveAnimation(animEid)}+ />+ )}+ </For>++ <For each={outAnimEids()}>+ {(animEid) => (+ <AnimationRow+ animEid={animEid}+ onInspect={() => handleInspectAnimation(animEid)}+ onRemove={() => handleRemoveAnimation(animEid)}+ />+ )}+ </For>+ </PanelSection>++ <Show when={inspectingAnimation()}>+ <FloatingInspector open anchorRef={inspectorAnchorRef} width={248}>+ <FloatingInspectorHeader class="items-center justify-between px-2">+ <Select+ value={inspectedPhase()}+ options={[AnimationPhase.IN, AnimationPhase.OUT]}+ onChange={(value) => value !== null && handlePhaseChange(value)}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {itemProps.item.rawValue === AnimationPhase.OUT ? "Out" : "In"}+ </SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>+ {inspectedPhase() === AnimationPhase.OUT ? "Out" : "In"}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => setInspectingAnimation(undefined)}+ >+ <Icon name="close-remove" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </FloatingInspectorHeader>+ <FloatingInspectorSeparator />++ <FloatingInspectorContent class="p-4 gap-2 flex flex-col">+ <ControlRow label="Duration">+ <SliderInput+ value={inspectedDurationInSeconds()}+ onChange={handleDurationChange}+ min={0.1}+ max={5}+ step={0.1}+ format={(v) => `${v.toFixed(1)}s`}+ onDragStart={() => world.history.startTransaction("Edit animation duration")}+ onDragEnd={() => world.history.commitTransaction()}+ />+ </ControlRow>+ <ControlRow label="Delay">+ <SliderInput+ value={inspectedDelayInSeconds()}+ onChange={handleDelayChange}+ min={0}+ max={5}+ step={0.1}+ format={(v) => `${v.toFixed(1)}s`}+ onDragStart={() => world.history.startTransaction("Edit animation delay")}+ onDragEnd={() => world.history.commitTransaction()}+ />+ </ControlRow>+ </FloatingInspectorContent>+ </FloatingInspector>+ </Show>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/appearance.tsx b/apps/web/src/components/sidebar-right/inspector/appearance.tsxnew file mode 100644index 00000000..149e02aa--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/appearance.tsx@@ -0,0 +1,316 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { ControlRow } from "@/components/ui/control-group";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import {+ Select,+ SelectContent,+ SelectIconTrigger,+ SelectItem,+ SelectPortal,+} from "@/components/ui/select";+import { SliderInput } from "@/components/ui/slider-input";+import { ControlledTextField } from "@/components/ui/text-field";+import { PanelSection } from "@/components/ui/panel-section";+import { Show, createMemo, createSignal } from "solid-js";+import { Icon } from "@/components/ui/icon";+import { SegmentedIconTabs } from "@/components/ui/segmented-icon-tabs";+import { useEntityState, useEntityTag, BlendMode, isRect, addComponent, removeComponent, setComponent, isAudio, removeKeyframeTrack } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { Keyframe } from "@/components/ui/keyframe";+import { hasComponent } from 'bitecs';+import { BLEND_MODE_ORDER, BLEND_MODE_SEPARATORS } from "./blend-mode-menu";++type AppearanceSettingsProps = {+ selection: Set<number>;+};++function capitalize(str: string) {+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();+}++function displayBlendMode(mode: string) {+ if (mode === String(BlendMode.SOURCE_OVER)) return "Normal";++ return capitalize(mode.replace("_", " "));+};++function round(v: number) {+ return Math.round(v * 100) / 100;+}++type RadiusMode = 'uniform' | 'separate';++const RADIUS_MODE_ITEMS = [+ {+ value: 'uniform' as RadiusMode,+ label: 'Uniform radius',+ icon: 'corner-radius-all-single',+ },+ {+ value: 'separate' as RadiusMode,+ label: 'Separate corner radii',+ icon: 'corner-radius-all-separate',+ },+] as const;++export function AppearanceSettings(props: AppearanceSettingsProps) {+ const { world } = useEngine();+ const c = world.components;+ const eid = () => props.selection.values().next().value!;++ const opacity = useEntityState(c.Computed.opacity, eid, 1);+ const blendMode = useEntityState(c.Appearance.blendMode, eid, 0);+ const hidden = useEntityTag(c.Hidden, eid);++ const vertexRadius = useEntityState(c.Computed.cornerRadius, eid, 0);+ const mixedTL = useEntityState(c.Computed.cornerRadiusTopLeft, eid, 0);+ const mixedTR = useEntityState(c.Computed.cornerRadiusTopRight, eid, 0);+ const mixedBR = useEntityState(c.Computed.cornerRadiusBottomRight, eid, 0);+ const mixedBL = useEntityState(c.Computed.cornerRadiusBottomLeft, eid, 0);++ const hasMixed = hasComponent(world, eid(), c.MixedCornerRadius);++ const [selectedBlendMode, setSelectedBlendMode] = createSignal(blendMode());+ const [radiusMode, setRadiusMode] = createSignal<RadiusMode>(hasMixed ? 'separate' : 'uniform');++ const handleOpacityChange = (v: number) => {+ setComponent(world, eid(), c.Appearance, { opacity: Math.round(v) / 100 });+ };++ const handleBlendModePointerEnter = (mode: number) => (c.Appearance.blendMode[eid()] = mode);++ const handleBlendModeSelect = (mode: number | null) => {+ if (mode === null) return;++ setSelectedBlendMode(mode);++ if (mode === blendMode()) return;++ setComponent(world, eid(), c.Appearance, { blendMode: mode });+ };++ const handleBlendModeOpenChange = (isOpen: boolean) => {+ if (isOpen) return;++ // Reset blend mode if it has not been changed.+ if (selectedBlendMode() !== blendMode()) {+ handleBlendModePointerEnter(selectedBlendMode());+ }+ };++ const handleVisibilityChange = () => {+ if (!hasComponent(world, eid(), c.Hidden)) {+ addComponent(world, eid(), c.Hidden);+ } else {+ removeComponent(world, eid(), c.Hidden);+ }+ }++ // Radius helpers+ const isRadiusDefault = createMemo(() => {+ if (radiusMode() === 'separate') {+ return mixedTL() === 0 && mixedTR() === 0 && mixedBR() === 0 && mixedBL() === 0;+ }+ return vertexRadius() === 0;+ });++ const handleUniformRadiusChange = (v: number) => {+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.topLeft');+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.topRight');+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.bottomRight');+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.bottomLeft');+ removeComponent(world, eid(), c.MixedCornerRadius);+ setComponent(world, eid(), c.CornerRadius, v);++ setRadiusMode('uniform');+ };++ const handleSeparateRadiusChange = (corner: 'topLeft' | 'topRight' | 'bottomRight' | 'bottomLeft', v: number) => {+ removeKeyframeTrack(world, eid(), 'vertexRadius');+ setComponent(world, eid(), c.MixedCornerRadius, { [corner]: v });+ };++ const handleRadiusModeChange = (value: RadiusMode) => {+ setRadiusMode(value);+ if (value === 'separate') {+ const r = vertexRadius();+ removeKeyframeTrack(world, eid(), 'vertexRadius');+ removeComponent(world, eid(), c.CornerRadius);+ setComponent(world, eid(), c.MixedCornerRadius, {+ topLeft: r,+ topRight: r,+ bottomRight: r,+ bottomLeft: r,+ });+ } else {+ const avg = mixedTL();+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.topLeft');+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.topRight');+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.bottomRight');+ removeKeyframeTrack(world, eid(), 'mixedVertexRadius.bottomLeft');+ removeComponent(world, eid(), c.MixedCornerRadius);+ setComponent(world, eid(), c.CornerRadius, avg);+ }+ };++ return (+ <PanelSection+ title="Appearance"+ actions={+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleVisibilityChange}+ >+ <Show when={!hidden()} fallback={<Icon name="eye-off" />}>+ <Icon name="eye-on" />+ </Show>+ </TooltipTrigger>+ <TooltipContent>{hidden() ? "Show" : "Hide"}</TooltipContent>+ </Tooltip>+ }+ >+ <ControlRow label="Opacity">+ <div class="flex gap-2 items-center">+ <SliderInput+ value={Math.round(opacity() * 100)}+ onChange={handleOpacityChange}+ format={(v) => `${v}%`}+ keyframe={<Keyframe target={eid()} property="opacity" />}+ />+ </div>+ </ControlRow>++ <ControlRow label="Blending">+ <div>+ <Select+ value={selectedBlendMode()}+ onChange={(value) => handleBlendModeSelect(value)}+ onOpenChange={handleBlendModeOpenChange}+ options={BLEND_MODE_ORDER}+ itemComponent={(itemProps) => (+ <>+ <Show when={BLEND_MODE_SEPARATORS.has(itemProps.item.rawValue)}>+ <hr class="bg-border h-px w-full border-0" />+ </Show>+ <SelectItem+ item={itemProps.item}+ onPointerEnter={() => handleBlendModePointerEnter(itemProps.item.rawValue)}+ >+ {displayBlendMode(BlendMode[itemProps.item.rawValue])}+ </SelectItem>+ </>+ )}+ >+ <SelectIconTrigger+ icon={<Icon name="blending-mode-default" class="size-5" />}+ valueClass="text-xxs flex-1"+ >+ {displayBlendMode(BlendMode[selectedBlendMode()])}+ </SelectIconTrigger>+ <SelectPortal>+ <SelectContent class="w-44 overscroll-contain" />+ </SelectPortal>+ </Select>+ </div>+ </ControlRow>++ <Show when={isRect(world, eid()) && !isAudio(world, eid())}>+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="Radius"+ contentClass="grid grid-cols-2 gap-2"+ >+ <ControlledTextField+ value={radiusMode() === 'separate' ? 'Mixed' : round(vertexRadius())}+ autoSelect+ step={1}+ min={0}+ onNumber={handleUniformRadiusChange}+ icon={<Icon name="corner-radius-all" />}+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={eid()} property="vertexRadius" />}+ />+ <SegmentedIconTabs+ value={() => radiusMode()}+ onChange={handleRadiusModeChange}+ items={RADIUS_MODE_ITEMS}+ />+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem+ disabled={isRadiusDefault()}+ onSelect={() => handleUniformRadiusChange(0)}+ >+ Reset to Default+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>++ <Show when={radiusMode() === 'separate'}>+ <ControlRow label="" contentClass="grid grid-cols-2 gap-2">+ <ControlledTextField+ icon={<Icon name="corner-radius-top-left" />}+ value={round(mixedTL())}+ autoSelect+ step={1}+ min={0}+ onNumber={(v) => handleSeparateRadiusChange('topLeft', v)}+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={eid()} property="mixedVertexRadius.topLeft" />}+ />+ <ControlledTextField+ icon={<Icon name="corner-radius-top-right" />}+ value={round(mixedTR())}+ autoSelect+ step={1}+ min={0}+ onNumber={(v) => handleSeparateRadiusChange('topRight', v)}+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={eid()} property="mixedVertexRadius.topRight" />}+ />+ <ControlledTextField+ icon={<Icon name="corner-radius-bottom-left" />}+ value={round(mixedBL())}+ autoSelect+ step={1}+ min={0}+ onNumber={(v) => handleSeparateRadiusChange('bottomLeft', v)}+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={eid()} property="mixedVertexRadius.bottomLeft" />}+ />+ <ControlledTextField+ icon={<Icon name="corner-radius-bottom-right" />}+ value={round(mixedBR())}+ autoSelect+ step={1}+ min={0}+ onNumber={(v) => handleSeparateRadiusChange('bottomRight', v)}+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={eid()} property="mixedVertexRadius.bottomRight" />}+ />+ </ControlRow>+ </Show>+ </Show>+ </PanelSection>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/asset-info-preview.tsx b/apps/web/src/components/sidebar-right/inspector/asset-info-preview.tsxnew file mode 100644index 00000000..10ff361f--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/asset-info-preview.tsx@@ -0,0 +1,206 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createMemo, createResource, createSignal, onCleanup } from 'solid-js';+import { ProgressSlider } from "@/components/ui/progress-slider";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { Icon } from "@/components/ui/icon";+import { formatDuration } from "@/utils/formatters";+import { getAudioPeaksAsync } from "@/components/engine/decoders/audio-peaks";+import { useEngine } from "@/context/engine";+import { assetsVersion } from "@/components/engine";++import type { Asset, AudioAsset, VideoAsset } from '@/components/engine/db';++type VisualAsset = Extract<Asset, { type: 'IMAGE' | 'VIDEO' }>;++export function AssetInfoPreview(props: { asset: Asset }) {+ const engine = useEngine();+ let mediaRef: HTMLMediaElement | undefined;+ let prevObjectUrl: string | undefined;++ const [objectUrl] = createResource(+ () => `${props.asset.id}:${assetsVersion(engine.world)}`,+ async () => {+ if (prevObjectUrl) {+ URL.revokeObjectURL(prevObjectUrl);+ prevObjectUrl = undefined;+ }++ try {+ const file = await props.asset.handle.getFile();+ prevObjectUrl = URL.createObjectURL(file);+ return prevObjectUrl;+ } catch {+ return undefined;+ }+ },+ );++ const [peaks] = createResource(+ () => props.asset.type === 'AUDIO'+ ? `${props.asset.id}:${assetsVersion(engine.world)}`+ : null,+ () => getAudioPeaksAsync(props.asset as AudioAsset | VideoAsset),+ );++ const [duration, setDuration] = createSignal(0);+ const [currentTime, setCurrentTime] = createSignal(0);+ const [playing, setPlaying] = createSignal(false);++ const isImage = createMemo(() => props.asset.type === 'IMAGE');+ const isVideo = createMemo(() => props.asset.type === 'VIDEO');+ const isAudio = createMemo(() => props.asset.type === 'AUDIO');+ const isTranscript = createMemo(() => props.asset.type === 'TRANSCRIPT');+ const canPlay = createMemo(() => isVideo() || isAudio());++ const showProgress = createMemo(() => props.asset.type !== 'IMAGE' && !isTranscript());++ const progress = createMemo(() => {+ const mediaDuration = duration();+ if (mediaDuration === 0) return 0;+ return (currentTime() / mediaDuration) * 100;+ });++ const setProgress = (value: number) => {+ const mediaDuration = duration();+ if (mediaDuration === 0 || !mediaRef) return;+ const nextTime = (value / 100) * mediaDuration;+ mediaRef.currentTime = nextTime;+ setCurrentTime(nextTime);+ };++ const togglePlayback = () => {+ if (!mediaRef) return;++ if (mediaRef.paused) {+ void mediaRef.play();+ return;+ }++ mediaRef.pause();+ };++ const timeLabel = createMemo(() => {+ return `${formatDuration(currentTime())} / ${formatDuration(duration())}`;+ });++ const aspectRatio = createMemo(() => {+ if (isAudio() || isTranscript()) return '16 / 9';++ const visualAsset = props.asset as VisualAsset;+ if (visualAsset.width > 0 && visualAsset.height > 0) {+ return `${visualAsset.width} / ${visualAsset.height}`;+ }++ return undefined;+ });++ onCleanup(() => {+ if (prevObjectUrl) {+ URL.revokeObjectURL(prevObjectUrl);+ prevObjectUrl = undefined;+ }+ });++ return (+ <div class="flex flex-col gap-2">+ <div+ class="group relative w-full overflow-clip rounded-md border border-border bg-accent"+ style={{ 'aspect-ratio': aspectRatio() }}+ >+ <Show when={isTranscript()}>+ <div class="absolute inset-0 bg-caption-background overflow-clip">+ <div class="absolute top-1 left-1 h-4 px-1 flex items-center bg-overlay rounded-sm">+ <span class="text-xxs leading text-white">Captions</span>+ </div>+ <div class="absolute top-[54%] bottom-1 left-1 right-0 flex items-center gap-0.5 overflow-clip">+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '74px', 'min-width': '16px' }} />+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '32px' }} />+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '72px', 'min-width': '16px' }} />+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '72px', 'min-width': '16px' }} />+ </div>+ </div>+ </Show>+ <Show when={objectUrl()}>+ {url => (+ <>+ <Show when={isVideo()}>+ <video+ class="size-full object-cover"+ ref={el => mediaRef = el}+ src={url()}+ controls={false}+ preload='metadata'+ playsinline+ onTimeUpdate={(e) => setCurrentTime(e.currentTarget.currentTime)}+ onLoadedMetadata={(e) => setDuration(e.currentTarget.duration)}+ onPlay={() => setPlaying(true)}+ onPause={() => setPlaying(false)}+ onEnded={() => setPlaying(false)}+ />+ </Show>+ <Show when={isAudio()}>+ <div class="absolute inset-0 py-2 bg-audio-background">+ <div class="flex items-center justify-center w-full h-full">+ <Show when={peaks()}>+ <For each={Array.from(peaks()!)}>+ {value => {+ const height = Math.min(Math.max(2, (value / 255) * 100), 98);+ return <div class="bg-audio-primary flex-1 rounded-sm" style={{ height: `${height}%` }} />;+ }}+ </For>+ </Show>+ </div>+ </div>+ <audio+ ref={el => mediaRef = el}+ src={url()}+ controls={false}+ preload='metadata'+ class="hidden"+ onTimeUpdate={(e) => setCurrentTime(e.currentTarget.currentTime)}+ onLoadedMetadata={(e) => setDuration(e.currentTarget.duration)}+ onPlay={() => setPlaying(true)}+ onPause={() => setPlaying(false)}+ onEnded={() => setPlaying(false)}+ />+ </Show>+ <Show when={isImage()}>+ <img class="size-full object-cover" src={url()} alt={props.asset.name} />+ </Show>+ </>+ )}+ </Show>+ <Show when={canPlay()}>+ <div class="absolute inset-0 bg-overlay opacity-0 transition-opacity group-hover:opacity-100 flex items-center justify-center">+ <div class="absolute left-1 top-1 z-10 flex h-4 items-center justify-center rounded-sm bg-overlay px-1">+ <span class="font-mono text-xxs text-foreground">+ {timeLabel()}+ </span>+ </div>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ type="button"+ size="icon-square"+ variant="default"+ onClick={togglePlayback}+ >+ <Icon name={playing() ? "controls-pause" : "controls-play"} class="size-6" />+ </TooltipTrigger>+ <TooltipContent>{playing() ? "Pause" : "Play"}</TooltipContent>+ </Tooltip>+ </div>+ </Show>+ </div>+ <Show when={showProgress()} fallback={<div class="h-3" />}>+ <div class="h-11 flex items-center">+ <ProgressSlider class="w-full" value={progress()} minValue={0} maxValue={100} onChange={setProgress} />+ </div>+ </Show>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/asset-info.tsx b/apps/web/src/components/sidebar-right/inspector/asset-info.tsxnew file mode 100644index 00000000..3cbbe954--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/asset-info.tsx@@ -0,0 +1,179 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { For, Show, Match, Switch, createMemo, createResource, createSignal, type Accessor } from "solid-js";+import {+ formatAspectRatio,+ formatBytes,+ formatChannels,+ formatDuration,+ formatMimeTypeLabel,+ formatAssetDate+} from "@/utils/formatters";+import { AssetInfoPreview } from "./asset-info-preview";+import { supabase } from "@/lib/supabase";+import { toClientConfig } from "@/components/genai/use-generation-records";+import { insertAssetInTimeline, replaceAssetHandle, useAssets } from "@/components/engine";+import { useEngine } from "@/context/engine";++import type { Asset } from "@/components/engine/db";+++export function AssetInfoPanel() {+ const { world } = useEngine();+ const assets = useAssets(world);++ const [nameExpanded, setNameExpanded] = createSignal(false);++ const selectedAsset = () => assets.selected().values().next().value;++ const handleReplace = () => {+ const asset = selectedAsset();+ if (!asset) return;+ replaceAssetHandle(world, asset);+ };++ const handleInsert = () => {+ const asset = selectedAsset();+ if (!asset) return;+ insertAssetInTimeline(world, asset, 'playhead');+ };++ const metadataRows = useAssetMetadataRows(selectedAsset);++ return (+ <div class="flex flex-col w-full px-4 border-t border-border">+ <div class="h-12 flex items-center justify-between">+ <span class="text-base font-strong">Information</span>+ {/* <Button class="text-muted-foreground" size="icon" variant="ghost">+ <Icon name="more-three-dots-small" />+ </Button> */}+ </div>+ <Show when={selectedAsset()}>+ {asset => <AssetInfoPreview asset={asset()} />}+ </Show>++ <div class="flex flex-col gap-2 my-2">+ <Button variant="default" class="w-full" onClick={handleInsert}>+ Insert at playhead+ </Button>+ <Button variant="secondary" class="w-full" onClick={handleReplace}>+ Replace source+ </Button>+ </div>++ <button+ type="button"+ onClick={() => setNameExpanded((v) => !v)}+ class="py-3 border-t border-b border-border mt-2 text-left outline-none"+ >+ <span+ class="text-xs leading-none block"+ classList={{+ "truncate": !nameExpanded(),+ "break-all": nameExpanded(),+ }}+ >+ {selectedAsset()?.name ?? 'Untitled'}+ </span>+ </button>+ <div class="flex flex-col gap-1 my-2">+ <For each={metadataRows().filter((row) => row.value != null)}>+ {(row) => (+ <Switch>+ <Match when={row.label === "Prompt"}>+ <div class="flex flex-col gap-2 py-1 text-xs text-muted-foreground">+ <span class="w-20 shrink-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {row.label}+ </span>+ <span class="min-w-0 text-left wrap-break-words">+ {row.value}+ </span>+ </div>+ </Match>+ <Match when={row.label !== "Prompt"}>+ <div class="flex h-7 items-center gap-2 text-xs text-muted-foreground">+ <span class="w-20 shrink-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {row.label}+ </span>+ <span class="min-w-0 flex-1 text-right overflow-hidden text-ellipsis whitespace-nowrap">+ {row.value}+ </span>+ </div>+ </Match>+ </Switch>+ )}+ </For>+ </div>+ </div>+ );+}++export function useAssetMetadataRows(asset: Accessor<Asset | undefined>) {+ const generationId = createMemo(() => asset()?.generationId ?? null);++ const [config] = createResource(() => generationId(), async (id) => {+ if (!id || !supabase) return undefined;+ const { data, error } = await supabase+ .from("usage_records")+ .select("config")+ .eq("id", id)+ .maybeSingle();+ if (error) {+ console.error("[asset-info] Failed to load generation record", error);+ return undefined;+ }+ return toClientConfig(data?.config);+ });++ return createMemo(() => {+ const a = asset();+ if (!a) return [];++ const dimensions =+ a.type === "IMAGE" || a.type === "VIDEO"+ ? `${a.width}\u00D7${a.height}`+ : null;+ const resolution = a.type === "VIDEO" ? `${a.height}p` : null;+ const aspectRatio =+ a.type === "IMAGE" || a.type === "VIDEO"+ ? formatAspectRatio(a.width, a.height)+ : null;+ const frameRate =+ a.type === "VIDEO"+ ? `${Math.round(a.frameRate)} FPS`+ : null;+ const duration =+ a.type === "VIDEO" || a.type === "AUDIO"+ ? formatDuration(a.duration)+ : null;+ const fileSize = a.size != null ? formatBytes(a.size) : null;+ const format = formatMimeTypeLabel(a.mimeType);+ const channels =+ a.type === "AUDIO" || a.type === "VIDEO"+ ? formatChannels(a.channels)+ : null;+ const imported = formatAssetDate(a.createdAt);+ const created = formatAssetDate(a.lastModified);+ const c = config();+ const prompt = c?.prompt ?? null;+ const model = c?.model ?? null;++ return [+ { label: "Dimensions", value: dimensions },+ { label: "Resolution", value: resolution },+ { label: "Aspect ratio", value: aspectRatio },+ { label: "Frame rate", value: frameRate },+ { label: "Duration", value: duration },+ { label: "File size", value: fileSize },+ { label: "Format", value: format },+ { label: "Channels", value: channels },+ { label: "Imported", value: imported },+ { label: "Created", value: created },+ { label: "Prompt", value: prompt },+ { label: "Model", value: model },+ ];+ });+}diff --git a/apps/web/src/components/sidebar-right/inspector/asset-picker.tsx b/apps/web/src/components/sidebar-right/inspector/asset-picker.tsxnew file mode 100644index 00000000..89fe7a83--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/asset-picker.tsx@@ -0,0 +1,331 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createMemo, createSignal, type JSX } from "solid-js";+import { toast } from "somoto";++import { downloadAsset } from "@/components/assets/actions";+import { AssetThumbnail } from "@/components/ui/asset-thumbnail";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuPortal,+ ContextMenuSeparator,+ ContextMenuShortcut,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { Icon } from "@/components/ui/icon";+import { useEngine } from "@/context/engine";+import { usePromptInput } from "@/context/prompt-input";+import { createDefaultConfig } from "@/components/genai/prompt-input";+import { showFileDialog } from "@/utils";+import { formatAssetDuration } from "@/utils/common";+import { Separator } from "@/components/ui/separator";+import { ChildOf, PaintType, isScene, useEntityState, type EngineWorld, removeComponent, setComponent } from "@/components/engine";+import { loadAsset, saveAsset, removeAsset, useAssets } from "@/components/engine";+import { query } from 'bitecs';++import type { Asset } from "@/components/engine/db";++type AssetFilter = "ALL" | "IMAGE" | "VIDEO";++const ASSET_FILTER_OPTIONS: ReadonlyArray<{+ value: AssetFilter;+ label: string;+ icon: string;+}> = [+ { value: "ALL", label: "All", icon: "all-media-types" },+ { value: "VIDEO", label: "Video", icon: "video" },+ { value: "IMAGE", label: "Image", icon: "media-image" },+ ];++export type AssetFillPickerProps = {+ nodeEid: number;+ fillEid: number;+};++export function AssetFillPicker(props: AssetFillPickerProps) {+ const { openPromptInput } = usePromptInput();+ const { world } = useEngine();+ const assets = useAssets(world);+ const c = world.components;++ const [query, setQuery] = createSignal("");+ const [assetFilter, setAssetFilter] = createSignal<AssetFilter>("ALL");++ const sceneSelected = createMemo(() => isScene(world, props.nodeEid));+ const filterOptions = createMemo(() => ASSET_FILTER_OPTIONS.filter((option) => option.value === "IMAGE" || !sceneSelected()));++ const availableAssets = createMemo(() =>+ assets.all()+ .filter((asset) => (asset.type === "IMAGE" || asset.type === "VIDEO" || asset.type === "SEQUENCE")));++ const filteredAssets = createMemo(() => {+ const normalizedQuery = query().trim().toLowerCase();+ const selectedFilter = assetFilter();+ return availableAssets().filter((asset) => {+ if (selectedFilter !== "ALL" && asset.type !== selectedFilter) return false;+ if (!normalizedQuery) return true;+ return asset.name.toLowerCase().includes(normalizedQuery);+ });+ });++ const handleImportAssets = async () => {+ const files = await showFileDialog();+ if (files.length === 0) return;+ try {+ await Promise.all(files.map((file) => loadAsset(world, file)));+ } catch (e) {+ toast("Failed to import assets", { description: (e as Error).message });+ }+ };++ const selectedAssetId = useEntityState(c.AssetId, props.fillEid);++ const selectAsset = (asset: Asset) => {+ if (asset.type !== "IMAGE" && asset.type !== "VIDEO") return;++ // Clear components from other fill types (solid/gradient) before assigning asset+ const paintType = PaintType[asset.type];+ clearColorStops(world, props.fillEid);+ removeComponent(world, props.fillEid, c.Color);+ setComponent(world, props.fillEid, c.AssetId, asset.id);+ setComponent(world, props.fillEid, c.Paint, paintType);+ };++ return (+ <div class="flex flex-col">+ <div class="px-2">+ <div class="relative h-11 flex items-center border-y border-border">+ <div class="w-6 h-7 flex items-center justify-center text-muted-foreground overflow-clip">+ <Icon name="search" />+ </div>+ <input+ type="text"+ value={query()}+ onInput={(event) => setQuery(event.currentTarget.value)}+ placeholder="Search in assets"+ class="flex-1 min-w-0 bg-transparent text-xs text-foreground placeholder:text-muted-foreground outline-none"+ />+ <DropdownMenu placement="bottom-end">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ {...buttonProps}+ size="icon"+ variant="ghost"+ class="text-muted-foreground data-expanded:bg-accent data-expanded:text-foreground"+ >+ <Icon name="preferences-adjust" class="size-6" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Filter assets</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-32">+ <For each={filterOptions()}>+ {(option) => (+ <DropdownMenuItem+ tone="neutral"+ class="gap-1 px-0 pr-2"+ onSelect={() => setAssetFilter(option.value)}+ >+ <div class="flex items-center">+ <span class="w-6 h-7 shrink-0 flex items-center justify-center">+ <Show when={assetFilter() === option.value}>+ <Icon name="confirm-check" class="size-6 text-popover-foreground" />+ </Show>+ </span>+ <span class="w-7 h-7 flex items-center justify-center">+ <Icon name={option.icon} class="size-6 text-popover-foreground" />+ </span>+ </div>+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {option.label}+ </span>+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </div>+ </div>++ <div class="grid grid-cols-2 gap-2 px-4 pt-4 overflow-y-auto max-h-96">+ <For each={filteredAssets()}>+ {(asset) => (+ <AssetCard+ asset={asset}+ selected={selectedAssetId() === asset.id}+ onSelect={() => selectAsset(asset)}+ />+ )}+ </For>+ <Separator class="col-span-2" />+ </div>++ <div class="flex flex-col gap-2 px-4 pb-4 pt-3">+ <Button+ variant="secondary"+ class="w-full"+ onClick={() => openPromptInput(createDefaultConfig("IMAGE"))}+ >+ Generate with AI+ </Button>+ <Button class="w-full" onClick={() => void handleImportAssets()}>+ Import from computer+ </Button>+ </div>+ </div>+ );+}++function clearColorStops(world: EngineWorld, fillEid: number) {+ const c = world.components;+ for (const eid of query(world, [ChildOf(fillEid)])) {+ removeComponent(world, eid, c.ColorStop);+ }+}++function MenuItemLabel(props: { children: JSX.Element }) {+ return (+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {props.children}+ </span>+ );+}++type AssetCardProps = {+ asset: Asset;+ selected: boolean;+ onSelect(): void;+};++function AssetCard(props: AssetCardProps) {+ const { world } = useEngine();++ const duration = createMemo(() => formatAssetDuration(props.asset));++ const handlePreview = () => {+ toast("Preview", { description: props.asset.name });+ };++ const handleRename = async () => {+ if (typeof window === "undefined") return;++ const nextName = window.prompt("Rename asset", props.asset.name);+ if (nextName == null) return;+ const trimmed = nextName.trim();+ if (!trimmed || trimmed === props.asset.name) return;++ try {+ await saveAsset(world, { ...props.asset, name: trimmed });+ } catch (e) {+ toast("Failed to rename", { description: (e as Error).message });+ }+ };++ const handleReplace = () => {+ toast("Replace media", { description: props.asset.name });+ };++ const handleDownload = async () => {+ await downloadAsset(props.asset);+ };++ const handleDelete = async () => {+ try {+ await removeAsset(world, props.asset.id);+ toast("Deleted", { description: props.asset.name });+ } catch (e) {+ toast("Failed to delete", { description: (e as Error).message });+ }+ };++ return (+ <ContextMenu modal={false}>+ <ContextMenuTrigger as="div" class="contents">+ <button+ type="button"+ class="group flex flex-col gap-1 text-left outline-none"+ aria-pressed={props.selected}+ data-asset-id={props.asset.id}+ onClick={props.onSelect}+ >+ <div+ class="relative w-full rounded-sm aspect-video"+ classList={{ "ring-2 ring-primary": props.selected }}+ >+ <AssetThumbnail+ asset={props.asset}+ class="absolute inset-0 rounded group-hover:brightness-70 overflow-hidden"+ />+ <Show when={duration()}>+ <div class="absolute left-1 top-1 z-20 flex h-4 items-center justify-center rounded-sm bg-overlay px-1">+ <span class="text-xxs text-primary-foreground">+ {duration()}+ </span>+ </div>+ </Show>+ </div>+ <span+ class="text-xs truncate"+ classList={{+ "text-foreground": props.selected,+ "text-muted-foreground": !props.selected,+ }}+ >+ {props.asset.name}+ </span>+ </button>+ </ContextMenuTrigger>+ <ContextMenuPortal>+ <ContextMenuContent class="w-[180px]">+ <ContextMenuItem onSelect={handlePreview}>+ <MenuItemLabel>Preview</MenuItemLabel>+ <ContextMenuShortcut>Space</ContextMenuShortcut>+ </ContextMenuItem>++ <ContextMenuSeparator />++ <ContextMenuItem onSelect={() => void handleRename()}>+ <MenuItemLabel>Rename</MenuItemLabel>+ <ContextMenuShortcut>⌘R</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuItem onSelect={handleReplace}>+ <MenuItemLabel>Replace</MenuItemLabel>+ </ContextMenuItem>+ <ContextMenuItem onSelect={() => void handleDownload()}>+ <MenuItemLabel>Download</MenuItemLabel>+ </ContextMenuItem>++ <ContextMenuSeparator />++ <ContextMenuItem onSelect={() => void handleDelete()}>+ <MenuItemLabel>Delete</MenuItemLabel>+ <ContextMenuShortcut>⌫</ContextMenuShortcut>+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/audio.tsx b/apps/web/src/components/sidebar-right/inspector/audio.tsxnew file mode 100644index 00000000..ed24459f--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/audio.tsx@@ -0,0 +1,368 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, onCleanup, Show, type JSX } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import { ControlledTextField } from "@/components/ui/text-field";+import { Keyframe } from "@/components/ui/keyframe";+import { useVolumeMeter, type ChannelLevels } from "@/hooks/use-volume-meter";+import { cx } from "@/lib/cva";++import { useEntityState, useEntityTag } from "../../engine/hooks";+import { addComponent, removeComponent, setComponent } from "../../engine";+import { useEngine } from "@/context/engine";+import { hasComponent } from 'bitecs';+++const MIN_DB = -60;+const MAX_DB = 12;+const KNOB_MAX_ANGLE = 135;+const METER_MAX_DB = 3;+const METER_GREEN_END = 60;+const METER_YELLOW_END = 80;++function normalizeDb(value: number): number {+ if (!Number.isFinite(value)) return MIN_DB;+ return Math.max(MIN_DB, Math.min(MAX_DB, value));+}++function amplitudeToMeterPct(amplitude: number): number {+ if (amplitude <= 0) return 0;++ const db = 20 * Math.log10(amplitude);+ if (db <= MIN_DB) return 0;+ if (db >= METER_MAX_DB) return 100;++ return ((db - MIN_DB) / (METER_MAX_DB - MIN_DB)) * 100;+}++type HorizontalMeterProps = {+ channel: number;+ levels: () => ChannelLevels[];+ class?: string;+};++function HorizontalMeter(props: HorizontalMeterProps) {+ const level = () => {+ const channel = props.levels()[props.channel];+ return channel ?? { rms: 0, peak: 0 };+ };++ const rmsPct = () => amplitudeToMeterPct(level().rms);+ const peakPct = () => amplitudeToMeterPct(level().peak);++ const indicatorClass = () => {+ const pct = peakPct();+ if (pct >= METER_YELLOW_END + (100 - METER_YELLOW_END) / 2) return "bg-meter-red";+ if (pct >= METER_GREEN_END) return "bg-meter-yellow";+ return "bg-meter-green";+ };++ return (+ <div class={cx("relative flex-1 h-[2px] bg-input rounded-sm overflow-visible", props.class)}>+ <div+ class="absolute inset-y-0 left-0 bg-meter-green"+ style={{ width: `${METER_GREEN_END}%` }}+ />+ <div+ class="absolute inset-y-0 bg-meter-yellow"+ style={{+ left: `${METER_GREEN_END}%`,+ width: `${METER_YELLOW_END - METER_GREEN_END}%`,+ }}+ />+ <div+ class="absolute inset-y-0 right-0 bg-meter-red"+ style={{ width: `${100 - METER_YELLOW_END}%` }}+ />++ <div+ class="absolute inset-y-0 right-0 bg-input transition-none"+ style={{ width: `${100 - rmsPct()}%` }}+ />++ <Show when={peakPct() > 0.5}>+ <div+ class={cx("absolute top-1/2 -translate-y-1/2 w-px h-[6px]", indicatorClass())}+ style={{ left: `${peakPct()}%` }}+ />+ </Show>+ </div>+ );+}++type VolumeKnobProps = {+ minDb: number;+ maxDb: number;+ disabled?: boolean;+ volume: number;+ onVolumeChange(val: number): void;+};++function VolumeKnob(props: VolumeKnobProps) {+ const isDragging = { current: false };+ const knobRef = { current: undefined as HTMLDivElement | undefined };++ const ARC_RADIUS = 13;+ const ARC_CIRCUMFERENCE = 2 * Math.PI * ARC_RADIUS;++ const knobAngle = () => {+ const value = normalizeDb(props.volume);++ if (value >= 0) {+ const t = Math.min(1, value / props.maxDb);+ return t * KNOB_MAX_ANGLE;+ }++ const t = Math.min(1, Math.abs(value) / Math.abs(props.minDb));+ return -t * KNOB_MAX_ANGLE;+ };++ const knobArcAngle = () => {+ const angle = Math.abs(knobAngle());+ if (angle < 0.5) return 0;+ return angle;+ };++ const knobArcDasharray = () => {+ const length = (knobArcAngle() / 360) * ARC_CIRCUMFERENCE;+ return `${length} ${ARC_CIRCUMFERENCE}`;+ };++ const shouldFlipArc = () => knobAngle() < 0;++ const angleToDb = (angle: number) => {+ const clamped = Math.max(-KNOB_MAX_ANGLE, Math.min(KNOB_MAX_ANGLE, angle));++ if (clamped >= 0) {+ const t = clamped / KNOB_MAX_ANGLE;+ return t * props.maxDb;+ }++ const t = Math.abs(clamped) / KNOB_MAX_ANGLE;+ return -t * Math.abs(props.minDb);+ };++ const updateFromPointer = (clientX: number, clientY: number) => {+ const root = knobRef.current;+ if (!root) return;++ const rect = root.getBoundingClientRect();+ const centerX = rect.left + rect.width / 2;+ const centerY = rect.top + rect.height / 2;++ let angle = (Math.atan2(clientY - centerY, clientX - centerX) * 180) / Math.PI + 90;+ if (angle > 180) angle -= 360;++ props.onVolumeChange(angleToDb(angle));+ };++ const handleWheel: JSX.EventHandler<HTMLDivElement, WheelEvent> = (e) => {+ if (props.disabled) return;++ e.preventDefault();+ const step = e.deltaY > 0 ? -1 : 1;+ props.onVolumeChange(props.volume + step);+ };++ const handleDragMove = (ev: PointerEvent) => {+ if (!isDragging.current || props.disabled) return;+ updateFromPointer(ev.clientX, ev.clientY);+ };++ const handleDragEnd = () => {+ if (!isDragging.current) return;++ isDragging.current = false;+ window.removeEventListener("pointermove", handleDragMove);+ window.removeEventListener("pointerup", handleDragEnd);+ };++ const handlePointerDown: JSX.EventHandler<HTMLDivElement, PointerEvent> = (e) => {+ if (props.disabled) return;++ e.preventDefault();+ isDragging.current = true;+ updateFromPointer(e.clientX, e.clientY);++ window.addEventListener("pointermove", handleDragMove);+ window.addEventListener("pointerup", handleDragEnd);+ };++ onCleanup(() => {+ window.removeEventListener("pointermove", handleDragMove);+ window.removeEventListener("pointerup", handleDragEnd);+ isDragging.current = false;+ });++ return (+ <div+ ref={(el) => {+ knobRef.current = el;+ }}+ class="flex-1 bg-input rounded-md h-full relative"+ classList={{ "opacity-50 pointer-events-none": props.disabled }}+ onWheel={handleWheel}+ onPointerDown={handlePointerDown}+ >+ <div class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[28px] h-[28px] bg-muted rounded-full">+ <svg+ aria-hidden="true"+ viewBox="0 0 28 28"+ class="absolute inset-0 text-primary"+ >+ <g transform={shouldFlipArc() ? "translate(28 0) scale(-1 1)" : undefined}>+ <circle+ cx="14"+ cy="14"+ r={ARC_RADIUS}+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-dasharray={knobArcDasharray()}+ transform="rotate(-90 14 14)"+ />+ </g>+ </svg>+ <div class="absolute inset-[2px] rounded-full bg-muted" />+ </div>++ <div class="absolute left-1/2 top-1/2 w-[51px] h-[51px] -translate-x-1/2 -translate-y-1/2 flex items-center justify-center pointer-events-none">+ <div class="flex-none" style={{ transform: `rotate(${knobAngle()}deg)` }}>+ <div class="relative w-9 h-9 text-foreground">+ <Icon name="vertical-knob-line" class="w-full h-full" />+ </div>+ </div>+ </div>+ </div>+ );+}++type AudioSettingsProps = {+ selection: Set<number>;+};++export function AudioSettings(props: AudioSettingsProps) {+ const { world } = useEngine();+ const c = world.components;+ const meter = useVolumeMeter();++ const eid = () => props.selection.values().next().value!;++ const volume = useEntityState(c.Computed.volume, eid, 0);+ const muted = useEntityTag(c.Muted, eid);+ const soloed = useEntityTag(c.Soloed, eid);+ const audioBus = useEntityState(c.AudioBus, eid);++ const toggleMuted = () => {+ if (hasComponent(world, eid(), c.Muted)) {+ removeComponent(world, eid(), c.Muted);+ } else {+ addComponent(world, eid(), c.Muted);+ }+ };++ const toggleSoloed = () => {+ if (hasComponent(world, eid(), c.Soloed)) {+ removeComponent(world, eid(), c.Soloed);+ } else {+ addComponent(world, eid(), c.Soloed);+ }+ };++ createEffect(() => {+ const bus = audioBus();+ if (bus) {+ meter.connect(bus.getGain());+ } else {+ meter.disconnect();+ }+ });++ onCleanup(() => meter.disconnect());++ const handleVolumeChange = (value: number | undefined) => {+ if (value === undefined) return;+ setComponent(world, eid(), c.Volume, normalizeDb(value));+ };++ return (+ <PanelSection title="Audio">+ <ControlRow+ label="Volume"+ class="items-start"+ labelClass="text-xxs pt-1.5"+ contentClass="h-16"+ >+ <div class="flex h-full gap-2">+ <div class="flex-1 flex flex-col gap-2 h-full">+ <ControlledTextField+ value={Math.round(normalizeDb(volume()))}+ onNumber={handleVolumeChange}+ min={MIN_DB}+ max={MAX_DB}+ step={1}+ unit="dB"+ showSign+ autoSelect+ keyframe={<Keyframe target={eid()} property="volume" />}+ />++ <div class="h-7 flex gap-px rounded-md overflow-hidden shrink-0">+ <button+ type="button"+ class="group flex-1 h-7 px-0 rounded-none bg-input hover:bg-input flex items-center justify-center"+ classList={{ "bg-muted": muted() }}+ onClick={toggleMuted}+ title="Mute"+ >+ <div+ class="group-hover:text-foreground"+ classList={{+ "text-foreground": muted(),+ "text-muted-foreground": !muted(),+ }}+ >+ <Icon name="prop-mute" />+ </div>+ </button>+ <button+ type="button"+ class="group flex-1 h-7 px-0 rounded-none bg-input hover:bg-input flex items-center justify-center"+ classList={{ "bg-muted": soloed() }}+ onClick={toggleSoloed}+ title="Solo"+ >+ <div+ class="group-hover:text-foreground"+ classList={{+ "text-foreground": soloed(),+ "text-muted-foreground": !soloed(),+ }}+ >+ <Icon name="prop-solo" />+ </div>+ </button>+ </div>+ </div>++ <VolumeKnob+ volume={Math.round(normalizeDb(volume()))}+ minDb={MIN_DB}+ maxDb={MAX_DB}+ onVolumeChange={handleVolumeChange}+ />+ </div>+ </ControlRow>+ <Show when={audioBus()}>+ <ControlRow label="" class="my-3">+ <HorizontalMeter channel={0} levels={meter.levels} />+ <HorizontalMeter channel={1} levels={meter.levels} class="mt-1" />+ </ControlRow>+ </Show>+ </PanelSection>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/background.tsx b/apps/web/src/components/sidebar-right/inspector/background.tsxnew file mode 100644index 00000000..705567ac--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/background.tsx@@ -0,0 +1,80 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ControlRow } from "@/components/ui/control-group";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorTitle,+} from "@/components/ui/floating-inspector";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import { ColorOpacityPicker } from "@/components/ui/color-opacity-picker";+import { ColorOpacityRow } from "@/components/ui/color-opacity-row";+import { useEngine } from "@/context/engine";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { createSignal } from "solid-js";+import { DEFAULT_BACKGROUND, persistWorldState, useWorldState } from "@/components/engine";++export function BackgroundSettings() {+ const { world } = useEngine();++ const [isPickerOpen, setIsPickerOpen] = createSignal(false);+ const color = useWorldState(w => w.background, DEFAULT_BACKGROUND);+++ let anchorRef: HTMLDivElement | undefined;++ const assignColor = (next: number) => {+ world.background = next;+ persistWorldState(world);+ };++ return (+ <PanelSection title="Background" ref={anchorRef}>+ <ControlRow label="Color">+ <ColorOpacityRow+ color={color()}+ onChangeColor={assignColor}+ onClick={() => setIsPickerOpen(true)}+ />+ </ControlRow>++ <FloatingInspector+ open={isPickerOpen}+ anchorRef={anchorRef}+ >+ <FloatingInspectorHeader>+ <FloatingInspectorTitle>Color</FloatingInspectorTitle>+ <div class="ml-auto">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => setIsPickerOpen(false)}+ >+ <Icon name="close-remove" class="size-6" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </div>+ </FloatingInspectorHeader>+ <FloatingInspectorContent class="p-0">+ <ColorOpacityPicker+ color={color()}+ opacity={1}+ onColorChange={assignColor}+ onBeginChange={(label) => world.history.startTransaction(label)}+ onEndChange={() => world.history.commitTransaction()}+ withoutOpacity+ />+ </FloatingInspectorContent>+ </FloatingInspector>+ </PanelSection>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/blend-mode-menu.tsx b/apps/web/src/components/sidebar-right/inspector/blend-mode-menu.tsxnew file mode 100644index 00000000..fbeb2015--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/blend-mode-menu.tsx@@ -0,0 +1,142 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal, For, Show } from 'solid-js';++import { Icon } from '@/components/ui/icon';+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from '@/components/ui/dropdown-menu';+import { Button } from '@/components/ui/button';+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';+import { useEngine } from '@/context/engine';+import { BlendMode, useEntityState, setComponent } from '@/components/engine';+++function capitalize(str: string) {+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();+}++function displayBlendMode(mode: string) {+ if (mode === String(BlendMode.SOURCE_OVER)) return "Normal";++ return capitalize(mode.replace("_", " "));+};++// Ordered to match Figma's blend mode menu groupings.+export const BLEND_MODE_ORDER: BlendMode[] = [+ BlendMode.SOURCE_OVER,+ BlendMode.DARKEN,+ BlendMode.MULTIPLY,+ BlendMode.COLOR_BURN,+ BlendMode.LIGHTEN,+ BlendMode.SCREEN,+ BlendMode.COLOR_DODGE,+ BlendMode.OVERLAY,+ BlendMode.SOFT_LIGHT,+ BlendMode.HARD_LIGHT,+ BlendMode.DIFFERENCE,+ BlendMode.EXCLUSION,+ BlendMode.HUE,+ BlendMode.SATURATION,+ BlendMode.COLOR,+ BlendMode.LUMINOSITY,+];++// Modes that begin a new group (separator goes before them).+export const BLEND_MODE_SEPARATORS = new Set<BlendMode>([+ BlendMode.DARKEN,+ BlendMode.LIGHTEN,+ BlendMode.OVERLAY,+ BlendMode.DIFFERENCE,+ BlendMode.HUE,+]);++type BlendModeMenuProps = {+ fillEid: number;+};++export function BlendModeMenu(props: BlendModeMenuProps) {+ const { world } = useEngine();+ const c = world.components;++ const blendMode = useEntityState(c.Appearance.blendMode, props.fillEid, 0);++ const [selected, setSelected] = createSignal(blendMode());++ const iconName = () =>+ selected() === BlendMode.SOURCE_OVER+ ? 'blending-mode-default'+ : 'blending-mode-set';++ const handlePointerEnter = (mode: number) => {+ setComponent(world, props.fillEid, c.Appearance, { blendMode: mode });+ }++ const handleSelect = (mode: number) => {+ setSelected(mode);+ setComponent(world, props.fillEid, c.Appearance, { blendMode: mode });+ }++ const handleOpenChange = (open: boolean) => {+ // Reset blend mode if it has not been changed+ if (!open && selected() !== blendMode()) {+ handlePointerEnter(selected());+ }+ }++ return (+ <DropdownMenu placement="bottom-end" onOpenChange={handleOpenChange}>+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ {...buttonProps}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ >+ <Icon name={iconName()} class="size-6" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Blend mode</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-44 overscroll-contain">+ <For each={BLEND_MODE_ORDER}>+ {(mode) => (+ <>+ <Show when={BLEND_MODE_SEPARATORS.has(mode)}>+ <DropdownMenuSeparator />+ </Show>+ <DropdownMenuItem+ onSelect={() => handleSelect(mode)}+ onPointerEnter={() => handlePointerEnter(mode)}+ >+ <Show when={selected() === mode} fallback={<div class="size-6" />}>+ <Icon name="confirm-check" class="size-6 text-primary-foreground" />+ </Show>+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {displayBlendMode(BlendMode[mode])}+ </span>+ </DropdownMenuItem>+ </>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/caption-settings.tsx b/apps/web/src/components/sidebar-right/inspector/caption-settings.tsxnew file mode 100644index 00000000..b723a657--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/caption-settings.tsx@@ -0,0 +1,228 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, createSignal, For, Show } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorTitle,+} from "@/components/ui/floating-inspector";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { ColorOpacityRow } from "@/components/ui/color-opacity-row";+import { ColorOpacityPicker } from "@/components/ui/color-opacity-picker";+import { CaptionType, useEntityState, ChildOf, deleteEntity, type EngineWorld, setComponent } from "../../engine";+import { useEngine } from "@/context/engine";+import { query } from 'bitecs';++type CaptionSettingsProps = {+ selection: Set<number>;+};++type CaptionColorSlot = {+ label: string;+ defaultColor: number;+};++type CaptionPreset = {+ value: CaptionType;+ label: string;+ slots: CaptionColorSlot[];+};++const CAPTION_PRESETS: CaptionPreset[] = [+ {+ value: CaptionType.CLASSIC,+ label: "Classic",+ slots: [],+ },+ {+ value: CaptionType.CASCADE,+ label: "Cascade",+ slots: [],+ },+ {+ value: CaptionType.SPOTLIGHT,+ label: "Spotlight",+ slots: [+ { label: 'Highlight', defaultColor: 0x24D5FF }+ ],+ },+ {+ value: CaptionType.WHISPER,+ label: "Whisper",+ slots: [],+ },+ {+ value: CaptionType.PAPER,+ label: "Paper",+ slots: []+ },+ {+ value: CaptionType.GUINEA,+ label: "Guinea",+ slots: [+ { label: 'Color 1', defaultColor: 0xF55353 },+ { label: 'Color 2', defaultColor: 0xFEB139 },+ { label: 'Color 3', defaultColor: 0xF6F54D },+ ],+ },+ {+ value: CaptionType.STARK,+ label: "Stark",+ slots: [],+ },+];++export function CaptionSettings(props: CaptionSettingsProps) {+ const { world } = useEngine();+ const c = world.components;++ const eid = () => props.selection.values().next().value!;+ const type = useEntityState<CaptionType>(c.Caption.type, eid, CaptionType.CLASSIC);+ const colors = useEntityState<number[]>(c.Caption.colors, eid, []);++ let anchorRef!: HTMLDivElement;++ const currentPreset = createMemo(+ () => CAPTION_PRESETS.find((p) => p.value === type()) ?? CAPTION_PRESETS[0]+ );++ const slots = createMemo(+ () => CAPTION_PRESETS.find((p) => p.value === type())?.slots ?? []+ );++ const [openSlot, setOpenSlot] = createSignal<number | null>(null);++ const handlePresetChange = (preset: CaptionPreset | null) => {+ if (!preset) return;++ clearText(world, eid());+ setOpenSlot(null);+ setComponent(world, eid(), c.Caption, { type: preset.value });+ };++ const getSlotColor = (index: number | null) => {+ const current = colors();+ const slot = slots()[index ?? 0];+ return current[index ?? 0] ?? slot.defaultColor;+ };++ const setSlotColor = (index: number | null, next: number) => {+ if (index === null) return;+ const max = slots().length;+ const current = colors();+ const nextColors = new Array<number>(max);+ for (let i = 0; i < max; i++) {+ nextColors[i] = current[i] ?? slots()[i].defaultColor;+ }+ nextColors[index] = next;+ setComponent(world, eid(), c.Caption, { colors: nextColors });+ };++ return (+ <PanelSection title="Caption" ref={anchorRef}>+ <ControlRow label="Preset">+ <Select<CaptionPreset>+ value={currentPreset()}+ onChange={handlePresetChange}+ options={CAPTION_PRESETS}+ optionValue="value"+ optionTextValue="label"+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {itemProps.item.rawValue.label}+ </SelectItem>+ )}+ >+ <SelectTrigger class="pl-1 gap-2">+ <div class="text-foreground size-5 rounded-sm flex items-center justify-center bg-primary overflow-clip shrink-0">+ <Icon name="captions" class="text-foreground" />+ </div>+ <SelectValue<CaptionPreset> class="text-xs">+ {(state) => state.selectedOption()?.label}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>++ <For each={slots()}>+ {(slot, index) => (+ <ControlRow label={slot.label}>+ <ColorOpacityRow+ color={getSlotColor(index())}+ onChangeColor={(next) => setSlotColor(index(), next)}+ onClick={() =>+ setOpenSlot(openSlot() === index() ? null : index())+ }+ />+ </ControlRow>+ )}+ </For>++ <Show when={openSlot() !== null}>+ <FloatingInspector+ open={() => openSlot() !== null}+ anchorRef={anchorRef}+ >+ <FloatingInspectorHeader>+ <FloatingInspectorTitle>+ {slots()[openSlot() as number]?.label ?? "Color"}+ </FloatingInspectorTitle>+ <div class="ml-auto">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => setOpenSlot(null)}+ >+ <Icon name="close-remove" class="size-6" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </div>+ </FloatingInspectorHeader>+ <FloatingInspectorContent class="p-0">+ <ColorOpacityPicker+ color={getSlotColor(openSlot())}+ opacity={1}+ onColorChange={(next) => setSlotColor(openSlot(), next)}+ onBeginChange={(label) => world.history.startTransaction(label)}+ onEndChange={() => world.history.commitTransaction()}+ withoutOpacity+ />+ </FloatingInspectorContent>+ </FloatingInspector>+ </Show>+ </PanelSection>+ );+}++export function clearText(world: EngineWorld, parentEid: number) {+ const c = world.components;++ for (const rid of query(world, [ChildOf(parentEid)])) {+ deleteEntity(world, rid);+ }++ c.Cache.textRanges[parentEid] = [];+ c.Caption.colors[parentEid] = [];+}diff --git a/apps/web/src/components/sidebar-right/inspector/effects-inspector.tsx b/apps/web/src/components/sidebar-right/inspector/effects-inspector.tsxnew file mode 100644index 00000000..bd81dd4b--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/effects-inspector.tsx@@ -0,0 +1,168 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { ControlRow } from "@/components/ui/control-group";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorSeparator,+ FloatingInspectorTitle,+} from "@/components/ui/floating-inspector";+import { Icon } from "@/components/ui/icon";+import { IncrementDecrementControl } from "@/components/ui/increment-decrement-control";+import { Keyframe } from "@/components/ui/keyframe";+import { SliderInput } from "@/components/ui/slider-input";+import { ControlledTextField } from "@/components/ui/text-field";+import { useEngine } from "@/context/engine";+import { useEntityState, useEntityTag, EffectType, addComponent, removeComponent, setComponent } from "@/components/engine";+import { hasComponent } from 'bitecs';++type EffectsInspectorProps = {+ anchorRef: HTMLElement;+ onClose(): void;+ effectEid: number;+ nodeEid: number;+};++type Effects = Exclude<EffectType, EffectType.DROP_SHADOW>;++export const EFFECT_DEFAULTS: Record<Effects, { label: string; value: number }> = {+ [EffectType.LAYER_BLUR]: { label: "Layer Blur", value: 8 },+ [EffectType.BRIGHTNESS]: { label: "Brightness", value: 0.8 },+ [EffectType.CONTRAST]: { label: "Contrast", value: 0.8 },+ [EffectType.GRAYSCALE]: { label: "Grayscale", value: 0.5 },+ [EffectType.HUE_ROTATION]: { label: "Hue Rotation", value: 100 },+ [EffectType.INVERT]: { label: "Invert", value: 0.5 },+ [EffectType.SATURATE]: { label: "Saturate", value: 0.8 },+ [EffectType.SEPIA]: { label: "Sepia", value: 0.5 },+};++const clampUnit = (value: number) => Math.min(1, Math.max(0, value));++const AMOUNT_EFFECTS: Effects[] = [+ EffectType.BRIGHTNESS,+ EffectType.CONTRAST,+ EffectType.GRAYSCALE,+ EffectType.INVERT,+ EffectType.SATURATE,+ EffectType.SEPIA,+];++export function EffectsInspector(props: EffectsInspectorProps) {+ const { world } = useEngine();+ const c = world.components;++ const effectValue = useEntityState(c.Computed.value, props.effectEid, 0);+ const hidden = useEntityTag(c.Hidden, props.effectEid);+ const type = useEntityState(c.Effect.type, props.effectEid, EffectType.BRIGHTNESS);++ const updateValue = (v: number) => {+ setComponent(world, props.effectEid, c.Effect, { value: v });+ };++ const toggleVisible = () => {+ if (hasComponent(world, props.effectEid, c.Hidden)) {+ removeComponent(world, props.effectEid, c.Hidden);+ } else {+ addComponent(world, props.effectEid, c.Hidden);+ }+ };++ const isAmountEffect = () => AMOUNT_EFFECTS.includes(type() ?? EffectType.BRIGHTNESS);+ const isBlurEffect = () => type() === EffectType.LAYER_BLUR;+ const isHueRotationEffect = () => type() === EffectType.HUE_ROTATION;+ const label = () => EFFECT_DEFAULTS[type() as Effects]?.label ?? "";++ return (+ <FloatingInspector open={true} anchorRef={props.anchorRef} width={248}>+ <FloatingInspectorHeader class="items-center justify-between">+ <FloatingInspectorTitle>{label()}</FloatingInspectorTitle>+ <div class="flex items-center gap-1">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={toggleVisible}+ >+ {!hidden() ? <Icon name="eye-on" /> : <Icon name="eye-off" />}+ </TooltipTrigger>+ <TooltipContent>{hidden() ? "Show effect" : "Hide effect"}</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={props.onClose}+ >+ <Icon name="close-remove" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </div>+ </FloatingInspectorHeader>+ <FloatingInspectorSeparator />+ <FloatingInspectorContent class="flex flex-col gap-2 p-4">+ {isAmountEffect() && (+ <ControlRow label="Amount">+ <SliderInput+ value={Math.round(clampUnit(effectValue()) * 100)}+ min={0}+ max={100}+ onChange={(v) => updateValue(clampUnit(v / 100))}+ onDragStart={() => world.history.startTransaction("Edit effect amount")}+ onDragEnd={() => world.history.commitTransaction()}+ format={(v) => `${v}%`}+ keyframe={<Keyframe target={props.effectEid} property="effect.value" />}+ />+ </ControlRow>+ )}++ {isBlurEffect() && (+ <ControlRow label="Radius">+ <div class="grid grid-cols-2 gap-2">+ <ControlledTextField+ value={effectValue()}+ onNumber={(v) => updateValue(Math.max(0, v))}+ min={0}+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.effectEid} property="effect.value" />}+ />+ <IncrementDecrementControl+ onDecrement={() => updateValue(Math.max(0, (effectValue() ?? 0) - 1))}+ onIncrement={() => updateValue((effectValue() ?? 0) + 1)}+ decrementLabel="Decrease blur radius"+ incrementLabel="Increase blur radius"+ />+ </div>+ </ControlRow>+ )}++ {isHueRotationEffect() && (+ <ControlRow label="Angle">+ <ControlledTextField+ icon={<Icon name="rotate-angle" class="size-6" />}+ value={effectValue()}+ onNumber={(v) => updateValue(v)}+ unit="deg"+ step={1}+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.effectEid} property="effect.value" />}+ />+ </ControlRow>+ )}+ </FloatingInspectorContent>+ </FloatingInspector>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/effects.tsx b/apps/web/src/components/sidebar-right/inspector/effects.tsxnew file mode 100644index 00000000..025ca388--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/effects.tsx@@ -0,0 +1,216 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { Icon } from "@/components/ui/icon";+import { ItemRow } from "@/components/ui/item-row";+import { PanelSection } from "@/components/ui/panel-section";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuSeparator,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import { For, Show, createMemo, createSignal } from "solid-js";+import { EFFECT_DEFAULTS, EffectsInspector } from "./effects-inspector";+import { useEntityState, useEntityTag, EffectType, createEntity, deleteEntity, getSiblingEntities, addComponent, appendChild, removeComponent, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { hasComponent } from 'bitecs';++type EffectsSettingsProps = {+ selection: Set<number>;+};++type Effects = Exclude<EffectType, EffectType.DROP_SHADOW>;++const EFFECT_TYPE_BUNDLES: Record<Effects, number> = {+ [EffectType.LAYER_BLUR]: EffectType.LAYER_BLUR,+ [EffectType.BRIGHTNESS]: EffectType.BRIGHTNESS,+ [EffectType.CONTRAST]: EffectType.CONTRAST,+ [EffectType.GRAYSCALE]: EffectType.GRAYSCALE,+ [EffectType.HUE_ROTATION]: EffectType.HUE_ROTATION,+ [EffectType.INVERT]: EffectType.INVERT,+ [EffectType.SATURATE]: EffectType.SATURATE,+ [EffectType.SEPIA]: EffectType.SEPIA,+};++type EffectRowProps = {+ effectEid: number;+ onInspect(): void;+ onRemove(): void;+ onMoveUp(): void;+ onMoveDown(): void;+}++function EffectRow(props: EffectRowProps) {+ const { world } = useEngine();+ const c = world.components;+ const type = useEntityState(c.Effect.type, props.effectEid, EffectType.BRIGHTNESS);+ const hidden = useEntityTag(c.Hidden, () => props.effectEid);++ const label = createMemo(() => (EFFECT_DEFAULTS[type() as Effects]?.label ?? ""));++ const toggleHidden = () => {+ if (hasComponent(world, props.effectEid, c.Hidden)) {+ removeComponent(world, props.effectEid, c.Hidden);+ } else {+ addComponent(world, props.effectEid, c.Hidden);+ }+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger>+ <ItemRow+ label="FX"+ value={label()}+ icon={<Icon name="fx" />}+ onClick={props.onInspect}+ disabled={hidden()}+ >+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={props.onRemove}+ >+ <Icon name="close-remove-small" />+ </TooltipTrigger>+ <TooltipContent>Remove effect</TooltipContent>+ </Tooltip>+ </ItemRow>+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem onSelect={props.onMoveUp}>+ Move Up+ </ContextMenuItem>+ <ContextMenuItem onSelect={props.onMoveDown}>+ Move Down+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={toggleHidden}>+ {hidden() ? "Unhide" : "Hide"}+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={props.onRemove}>+ Remove+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ );+}++export function EffectsSettings(props: EffectsSettingsProps) {+ const { world } = useEngine();+ const [inspectingEffect, setInspectingEffect] = createSignal<number>();+ const c = world.components;++ let anchorRef: HTMLDivElement | undefined;++ const eid = () => props.selection.values().next().value!;+ const effectEids = useEntityState(world.components.Cache.effects, eid, []);++ const handleAddEffect = (typeName: Effects) => {+ const defaults = EFFECT_DEFAULTS[typeName];++ world.history.transaction('Add effect', () => {+ const effectEid = createEntity(world);+ setComponent(world, effectEid, c.Effect, {+ type: EFFECT_TYPE_BUNDLES[typeName],+ value: defaults.value,+ });+ appendChild(world, effectEid, eid())+ });+ };++ const handleRemoveEffect = (effectEid: number) => deleteEntity(world, effectEid);+ const openInspector = (effectEid: number) => setInspectingEffect(effectEid);+ const handleReorderEffect = (effectEid: number, direction: number) => {+ const effects = getSiblingEntities(world, effectEid, c.Effect);+ const index = effects.indexOf(effectEid);+ const newIndex = index + direction;+ if (newIndex >= 0 && newIndex < effects.length) {+ effects.splice(newIndex, 0, effects.splice(index, 1)[0]);+ for (const [idx, eid] of effects.entries()) {+ setComponent(world, eid, c.ItemIndex, idx);+ }+ }+ };++ return (+ <>+ <PanelSection+ title="Effects"+ ref={anchorRef}+ actions={+ <DropdownMenu placement="bottom-end">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ {...buttonProps}+ >+ <Icon name="plus-add" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Add effect</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-44">+ <For each={Object.values(EffectType).filter((v): v is Effects => typeof v === 'number' && v !== EffectType.DROP_SHADOW)}>+ {(t) => (+ <DropdownMenuItem onSelect={() => handleAddEffect(t)}>+ {EFFECT_DEFAULTS[t].label}+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ }+ >+ <For each={effectEids().toReversed()}>+ {(effectEid) => (+ <EffectRow+ effectEid={effectEid}+ onInspect={() => openInspector(effectEid)}+ onRemove={() => handleRemoveEffect(effectEid)}+ onMoveUp={() => handleReorderEffect(effectEid, 1)}+ onMoveDown={() => handleReorderEffect(effectEid, -1)}+ />+ )}+ </For>+ </PanelSection>++ <Show when={inspectingEffect()}>+ <EffectsInspector+ onClose={() => setInspectingEffect(undefined)}+ anchorRef={anchorRef!}+ effectEid={inspectingEffect()!}+ nodeEid={eid()}+ />+ </Show>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/export-progress.tsx b/apps/web/src/components/sidebar-right/inspector/export-progress.tsxnew file mode 100644index 00000000..ab2045db--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/export-progress.tsx@@ -0,0 +1,119 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show, Portal } from "solid-js/web";+import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { formatDuration } from "@/utils/formatters";+import type { EncoderConfig } from "@/components/engine/encode/interfaces";++export type ExportConfig = Omit<EncoderConfig, "target" | "scene" | "onProgress">;++type ExportProgressProps = {+ open: boolean;+ progress: number;+ remaining?: { minutes: number; seconds: number };+ config?: ExportConfig;+ duration: number;+ onCancel: () => void;+};++export function ExportProgress(props: ExportProgressProps) {+ const cfg = () => props.config;++ const width = () => {+ const resolution = cfg()?.video?.resolution ?? 1080;+ return Math.round((resolution * 16) / 9 / 2) * 2;+ };++ const height = () => cfg()?.video?.resolution ?? 1080;+ const format = () => (cfg()?.format ?? "mp4").toUpperCase();+ const fps = () => cfg()?.video?.fps ?? 30;+ const videoCodec = () => cfg()?.video?.codec ?? "avc";+ const audioCodec = () => cfg()?.audio?.codec ?? "aac";+ const sampleRate = () =>+ Math.round((cfg()?.audio?.sampleRate ?? 48000) / 1000);+ const bitrate = () => {+ const bps = cfg()?.video?.bitrate ?? 10e6;+ return `${(bps / 1e6).toFixed(1)} Mbps`;+ };++ return (+ <Show when={props.open}>+ <Portal>+ <div class="fixed inset-0 z-50 bg-popover/30 backdrop-blur-3xl" />+ <div class="fixed inset-0 z-50 flex items-center justify-center">+ <div class="flex w-full max-w-md flex-col items-center px-6">+ <h4 class="text-lg">Exporting Composition</h4>++ <div class="mt-4 flex w-full flex-col gap-2">+ <div+ class="grid w-full auto-cols-auto grid-flow-col grid-rows-4 gap-y-2 rounded-lg border border-foreground/10 bg-foreground/5 px-3 py-3 text-xs+ [&>div]:w-2 [&>p]:text-foreground [&>span]:text-muted-foreground"+ >+ <span>Duration</span>+ <span>Resolution</span>+ <span>Bitrate</span>+ <span>Frame rate</span>++ <p>{formatDuration(props.duration)}</p>+ <p>+ {width()} x {height()}+ </p>+ <p>{bitrate()}</p>+ <p>{fps()} FPS</p>++ <div />+ <div />+ <div />+ <div />++ <span>Video Codec</span>+ <span>Container</span>+ <span>Audio Codec</span>+ <span>Sample Rate</span>++ <p>{videoCodec()}</p>+ <p>{format()}</p>+ <p>{audioCodec()}</p>+ <p>{sampleRate()} KHz</p>+ </div>++ <div>+ <div class="mt-2 mb-2 flex w-full justify-between text-sm">+ <p class="text-muted-foreground">Progress</p>+ <p>+ {props.progress}%+ <Show when={props.remaining}>+ {(r) => (+ <span>+ {" "}+ · {r().minutes}min {r().seconds}s+ </span>+ )}+ </Show>+ </p>+ </div>+ <div class="relative h-2 w-full overflow-hidden rounded-full bg-foreground/20">+ <div+ class="h-full bg-foreground rounded-full transition-all"+ style={{ width: `${props.progress}%` }}+ />+ </div>+ </div>+ </div>++ <Button+ class="mt-6 border-foreground/15 bg-foreground/10 shadow-none gap-0.5 pl-1 pr-3"+ onClick={props.onCancel}+ >+ <Icon name="spinner-loader" class="size-6 animate-spin" />+ Cancel+ </Button>+ </div>+ </div>+ </Portal>+ </Show>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/export-templates.ts b/apps/web/src/components/sidebar-right/inspector/export-templates.tsnew file mode 100644index 00000000..fa26a9a1--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/export-templates.ts@@ -0,0 +1,128 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { VideoCodec, AudioCodec } from "mediabunny";+import type { ContainerFormat } from "@/components/engine/encode/types";+import type { ExportConfig } from "./export-progress";++export type ExportTemplate = {+ id: string;+ name: string;+} & ExportConfig;++export type ExportTemplateGroup = {+ id: string;+ label: string;+ items: ExportTemplate[];+};++export const RESOLUTION_OPTIONS: number[] = [720, 1080, 1440, 2160];+export const VIDEO_CODEC_OPTIONS: VideoCodec[] = ["avc", "hevc", "vp9", "av1", "vp8"];+export const VIDEO_FORMAT_OPTIONS: ContainerFormat[] = ["mp4", "webm", "ogg", "mov"];+export const FRAME_RATE_OPTIONS: number[] = [24, 25, 29.97, 30, 48, 50, 59.94, 60];+export const AUDIO_CODEC_OPTIONS: AudioCodec[] = ["aac", "opus"];+export const SAMPLE_RATE_OPTIONS: number[] = [44100, 48000, 96000];++export const MIME_TYPES: Record<ContainerFormat, string> = {+ mp4: "video/mp4",+ webm: "video/webm",+ ogg: "audio/ogg",+ mov: "video/quicktime",+};++export const EXPORT_TEMPLATE_GROUPS: ExportTemplateGroup[] = [+ {+ id: "standard",+ label: "Standard",+ items: [+ {+ id: "h264-mp4-720p",+ name: "HD",+ format: "mp4",+ video: { bitrate: 7e6, codec: "avc", resolution: 720 },+ audio: { codec: "aac" },+ },+ {+ id: "h264-mp4-1080p",+ name: "Full HD",+ format: "mp4",+ video: { bitrate: 12e6, codec: "avc", resolution: 1080 },+ audio: { codec: "aac" },+ },+ {+ id: "h264-mp4-1440p",+ name: "2k Quad HD",+ format: "mp4",+ video: { bitrate: 24e6, codec: "avc", resolution: 1440 },+ audio: { codec: "aac" },+ },+ {+ id: "h264-mp4-2160p",+ name: "4K Ultra HD",+ format: "mp4",+ video: { bitrate: 64e6, codec: "avc", resolution: 2160 },+ audio: { codec: "aac" },+ },+ ],+ },+ {+ id: "social-media",+ label: "Social Media",+ items: [+ {+ id: "youtube-1080p",+ name: "YouTube Shorts",+ format: "mp4",+ video: { bitrate: 12e6, codec: "avc", resolution: 1080 },+ audio: { codec: "aac" },+ },+ {+ id: "youtube-4k",+ name: "YouTube 4k",+ format: "mp4",+ video: { bitrate: 64e6, codec: "avc", resolution: 2160 },+ audio: { codec: "aac" },+ },+ {+ id: "instagram-1080p",+ name: "Instagram Reels",+ format: "mp4",+ video: { bitrate: 12e6, codec: "avc", resolution: 1080 },+ audio: { codec: "aac" },+ },+ {+ id: "tiktok-1080p",+ name: "TikTok",+ format: "mp4",+ video: { bitrate: 12e6, codec: "avc", resolution: 1080 },+ audio: { codec: "aac" },+ },+ ],+ },+ {+ id: "web-embedding",+ label: "Web embedding",+ items: [+ {+ id: "web-embedding-720p",+ name: "HD",+ format: "webm",+ video: { bitrate: 3e6, codec: "vp9", resolution: 720 },+ audio: { codec: "opus" },+ },+ ],+ },+];++export const TEMPLATE_BY_ID = new Map<string, ExportTemplate>(+ EXPORT_TEMPLATE_GROUPS.flatMap((group) =>+ group.items.map((item) => [item.id, item] as const),+ ),+);++export const DEFAULT_EXPORT_TEMPLATE_ID = "h264-mp4-1080p";++export function getDefaultExportTemplate(): ExportTemplate {+ return TEMPLATE_BY_ID.get(DEFAULT_EXPORT_TEMPLATE_ID) ?? EXPORT_TEMPLATE_GROUPS[0].items[0];+}diff --git a/apps/web/src/components/sidebar-right/inspector/export.tsx b/apps/web/src/components/sidebar-right/inspector/export.tsxnew file mode 100644index 00000000..2dbd157f--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/export.tsx@@ -0,0 +1,641 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createEffect, createMemo, createSignal } from "solid-js";+import { PanelSection } from "@/components/ui/panel-section";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { ItemRow } from "@/components/ui/item-row";+import { ControlRow } from "@/components/ui/control-group";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuGroupLabel,+ DropdownMenuItem,+ DropdownMenuItemDetail,+ DropdownMenuPortal,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorSeparator,+} from "@/components/ui/floating-inspector";+import { Icon } from "@/components/ui/icon";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { Switch, SwitchControl, SwitchInput, SwitchThumb } from "@/components/ui/switch";++import { Separator } from "@/components/ui/separator";+import { SliderInput } from "@/components/ui/slider-input";+import { formatBytes, formatDuration } from "@/utils/formatters";+import { useEntityState, useEntityTag, setComponent, removeComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { useExport } from "@/context/export";+import { type ExportConfig } from "./export-progress";+import {+ EXPORT_TEMPLATE_GROUPS,+ TEMPLATE_BY_ID,+ RESOLUTION_OPTIONS,+ VIDEO_CODEC_OPTIONS,+ VIDEO_FORMAT_OPTIONS,+ FRAME_RATE_OPTIONS,+ AUDIO_CODEC_OPTIONS,+ SAMPLE_RATE_OPTIONS,+} from "./export-templates";++import type { EngineWorld } from "@/components/engine";+import type { ContainerFormat } from "@/components/engine/encode/types";+import type { VideoCodec, AudioCodec } from "mediabunny";++type ExportPanelProps = {+ selection: Set<number>;+};++export type ExportSettingsData = {+ templateId?: string | null;+ format?: ContainerFormat;+ videoEnabled?: boolean;+ videoCodec?: VideoCodec;+ videoBitrate?: number;+ videoFps?: number;+ videoResolution?: number;+ audioEnabled?: boolean;+ audioCodec?: AudioCodec;+ audioSampleRate?: number;+};++// Build the full export template payload — every field, so switching templates+// fully replaces the prior config (the observer clears fields a template omits).+function templatePayload(id: string): ExportSettingsData | null {+ const template = TEMPLATE_BY_ID.get(id);+ if (!template) return null;+ return {+ templateId: id,+ format: template.format,+ videoEnabled: template.video?.enabled,+ videoCodec: template.video?.codec,+ videoBitrate: template.video?.bitrate,+ videoFps: template.video?.fps,+ videoResolution: template.video?.resolution,+ audioEnabled: template.audio?.enabled,+ audioCodec: template.audio?.codec,+ audioSampleRate: template.audio?.sampleRate,+ };+}++// Read the export settings off the scene entity imperatively (no subscription).+function readConfig(world: EngineWorld, eid: number): ExportConfig | undefined {+ const s = world.components.ExportSettings;+ if (s.templateId[eid] == null) return undefined;+ return {+ format: s.format[eid],+ video: {+ enabled: s.videoEnabled[eid],+ codec: s.videoCodec[eid],+ bitrate: s.videoBitrate[eid],+ fps: s.videoFps[eid],+ resolution: s.videoResolution[eid],+ },+ audio: {+ enabled: s.audioEnabled[eid],+ codec: s.audioCodec[eid],+ sampleRate: s.audioSampleRate[eid],+ },+ };+}++export function ExportPanel(props: ExportPanelProps) {+ const { world } = useEngine();+ const { exportScene: runExport } = useExport();++ const c = world.components;++ const [search, setSearch] = createSignal("");+ const [config, setConfig] = createSignal<ExportConfig | undefined>();+ const [isInspectorOpen, setIsInspectorOpen] = createSignal(false);++ const eid = () => props.selection.values().next().value!;+ const duration = useEntityState(c.Computed.duration, eid, 0);+ const durationInSeconds = createMemo(() => duration() / world.frameRate);+ // Gate on component presence: removing a template removes the whole component,+ // but the SoA arrays aren't cleared, so the value subscription alone would+ // still report the old id.+ const hasSettings = useEntityTag(c.ExportSettings, eid);+ const templateId = useEntityState(c.ExportSettings.templateId, eid, null);+ const selectedTemplateId = () => (hasSettings() ? templateId() ?? null : null);++ const selectedTemplate = createMemo(() => {+ const id = selectedTemplateId();+ if (!id) return null;+ return TEMPLATE_BY_ID.get(id) ?? null;+ });++ createEffect(() => {+ setConfig(selectedTemplateId() ? readConfig(world, eid()) : undefined);+ });++ const writeSettings = (data: ExportSettingsData) => {+ setComponent(world, eid(), c.ExportSettings, data, false);+ };++ const setInspectorTemplate = (id?: string | null) => {+ if (!id) return;+ const payload = templatePayload(id);+ if (payload) writeSettings(payload);+ };++ const filteredTemplateGroups = createMemo(() => {+ const query = search().trim().toLowerCase();++ return EXPORT_TEMPLATE_GROUPS+ .map((group) => ({+ id: group.id,+ label: group.label,+ items: group.items.filter((item) => {+ if (!query) return true;+ return `${item.name} ${item.video?.resolution} ${group.label}`+ .toLowerCase()+ .includes(query);+ }),+ }))+ .filter((group) => group.items.length > 0);+ });++ const exportScene = async () => {+ const template = selectedTemplate();+ if (!template) return;++ await runExport(eid(), readConfig(world, eid()) ?? template);+ };++ const estimatedFileSize = createMemo(() => {+ return estimateFileSize(config(), durationInSeconds());+ });++ let inspectorAnchorRef: HTMLDivElement | undefined;++ return (+ <PanelSection+ title="Export"+ ref={inspectorAnchorRef}+ actions={+ <DropdownMenu+ placement="bottom-end"+ onOpenChange={(open) => {+ if (!open) setSearch("");+ }}+ >+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ {...buttonProps}+ >+ <Icon name="plus-add" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Add template</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-[208px]">+ <div class="flex h-7 w-full items-center rounded-md overflow-hidden">+ <div class="h-7 w-6 shrink-0 flex items-center justify-center text-muted-foreground">+ <Icon name="search" class="size-6" />+ </div>+ <input+ type="text"+ placeholder="Search"+ value={search()}+ onInput={(event) => setSearch(event.currentTarget.value)}+ onKeyDown={(event) => {+ if (event.key === "Escape") return;+ event.stopPropagation();+ }}+ class="flex-1 min-w-0 bg-transparent pl-2 text-xs text-foreground placeholder:text-muted-foreground outline-none"+ />+ </div>+ <DropdownMenuSeparator />+ <For each={filteredTemplateGroups()}>+ {(group, index) => (+ <>+ <Show when={index() > 0}>+ <DropdownMenuSeparator />+ </Show>+ <DropdownMenuGroup>+ <DropdownMenuGroupLabel>+ {group.label}+ </DropdownMenuGroupLabel>+ <For each={group.items}>+ {(item) => (+ <DropdownMenuItem+ tone="neutral"+ disabled={item.id === selectedTemplateId()}+ onSelect={() => setInspectorTemplate(item.id)}+ >+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {item.name}+ </span>+ <DropdownMenuItemDetail>+ {item.video?.resolution}p+ </DropdownMenuItemDetail>+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuGroup>+ </>+ )}+ </For>+ <Show when={filteredTemplateGroups().length === 0}>+ <div class="px-2 py-1.5 text-xs text-muted-foreground">+ No template found+ </div>+ </Show>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ }+ >+ <Show when={selectedTemplate()}>+ {(template) => (+ <>+ <ItemRow+ value={`${template().name} · ${template().video?.resolution}p`}+ icon={<Icon name="film-video-export" />}+ onClick={() => setIsInspectorOpen(true)}+ >+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => {+ removeComponent(world, eid(), c.ExportSettings, false);+ setIsInspectorOpen(false);+ }}+ >+ <Icon name="close-remove-small" />+ </TooltipTrigger>+ <TooltipContent>Remove template</TooltipContent>+ </Tooltip>+ </ItemRow>+ <Button class="w-full" onClick={exportScene}>+ Export+ </Button>+ <div class="flex justify-between items-center h-7">+ <span class="text-base text-muted-foreground">+ Duration {formatDuration(durationInSeconds())}+ </span>+ <span class="text-base text-muted-foreground">+ File size {formatBytes(estimatedFileSize())}+ </span>+ </div>+ </>+ )}+ </Show>+ <Show when={isInspectorOpen()}>+ <ExportInspector+ eid={eid}+ anchorRef={inspectorAnchorRef}+ onClose={() => setIsInspectorOpen(false)}+ onConfigChange={setConfig}+ onSelectTemplate={setInspectorTemplate}+ />+ </Show>+ </PanelSection>+ );+}++type ExportInspectorProps = {+ eid: () => number;+ anchorRef: HTMLDivElement | undefined;+ onClose: () => void;+ onConfigChange: (config: ExportConfig | undefined) => void;+ onSelectTemplate: (id: string) => void;+};++// The floating export-settings dialog. Kept as its own component so the per-field+// value subscriptions below only exist while the dialog is mounted (i.e. open).+function ExportInspector(props: ExportInspectorProps) {+ const { world } = useEngine();+ const c = world.components;++ const templateId = useEntityState(c.ExportSettings.templateId, props.eid, null);+ const format = useEntityState(c.ExportSettings.format, props.eid, undefined);+ const videoEnabled = useEntityState(c.ExportSettings.videoEnabled, props.eid, undefined);+ const videoCodec = useEntityState(c.ExportSettings.videoCodec, props.eid, undefined);+ const videoBitrate = useEntityState(c.ExportSettings.videoBitrate, props.eid, undefined);+ const videoFps = useEntityState(c.ExportSettings.videoFps, props.eid, undefined);+ const videoResolution = useEntityState(c.ExportSettings.videoResolution, props.eid, undefined);+ const audioEnabled = useEntityState(c.ExportSettings.audioEnabled, props.eid, undefined);+ const audioCodec = useEntityState(c.ExportSettings.audioCodec, props.eid, undefined);+ const audioSampleRate = useEntityState(c.ExportSettings.audioSampleRate, props.eid, undefined);++ const selectedTemplate = createMemo(() => {+ const id = templateId();+ if (!id) return null;+ return TEMPLATE_BY_ID.get(id) ?? null;+ });++ const config = createMemo<ExportConfig | undefined>(() => {+ if (templateId() == null) return undefined;+ return {+ format: format(),+ video: {+ enabled: videoEnabled(),+ codec: videoCodec(),+ bitrate: videoBitrate(),+ fps: videoFps(),+ resolution: videoResolution(),+ },+ audio: {+ enabled: audioEnabled(),+ codec: audioCodec(),+ sampleRate: audioSampleRate(),+ },+ };+ });++ // Keep the panel's file-size estimate in sync while the dialog is open; the+ // last value stays frozen in the panel once this component unmounts.+ createEffect(() => props.onConfigChange(config()));++ const writeSettings = (data: ExportSettingsData) => {+ setComponent(world, props.eid(), c.ExportSettings, data, false);+ };++ return (+ <FloatingInspector open anchorRef={props.anchorRef} width={272}>+ <FloatingInspectorHeader class="items-center justify-between px-2">+ <Select+ value={selectedTemplate()?.id ?? ""}+ options={Array.from(TEMPLATE_BY_ID.values()).map((template) => template.id)}+ onChange={(value) => value && props.onSelectTemplate(value)}+ itemComponent={(itemProps) => {+ const template = TEMPLATE_BY_ID.get(itemProps.item.rawValue);+ return <SelectItem item={itemProps.item}>{template?.name}</SelectItem>;+ }}+ >+ <SelectTrigger>+ <SelectValue>+ {selectedTemplate()?.name}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => props.onClose()}+ >+ <Icon name="close-remove" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </FloatingInspectorHeader>+ <FloatingInspectorSeparator />+ <FloatingInspectorContent class="p-4">+ <div class="flex flex-col gap-2">+ <ControlRow label="Video">+ <Switch+ checked={config()?.video?.enabled != false}+ onChange={(checked) => writeSettings({ videoEnabled: checked })}+ >+ <SwitchInput />+ <SwitchControl variant="compact">+ <SwitchThumb variant="compact" />+ </SwitchControl>+ </Switch>+ </ControlRow>+ <div+ class="flex flex-col gap-2 transition-opacity"+ classList={{+ "opacity-50": config()?.video?.enabled == false,+ "pointer-events-none": config()?.video?.enabled == false,+ }}+ >+ <ControlRow label="Resolution">+ <Select+ value={config()?.video?.resolution}+ options={[...RESOLUTION_OPTIONS]}+ onChange={(value) => writeSettings({ videoResolution: value ?? undefined })}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{itemProps.item.rawValue}p</SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>{config()?.video?.resolution + 'p'}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>+ <ControlRow label="Bitrate">+ <SliderInput+ value={((config()?.video?.bitrate ?? 10e6) / 1e6)}+ onChange={(value) => writeSettings({ videoBitrate: value * 1e6 })}+ min={0.1}+ max={120}+ step={1}+ />+ </ControlRow>+ <ControlRow label="Codec">+ <Select+ value={config()?.video?.codec ?? 'avc'}+ options={[...VIDEO_CODEC_OPTIONS]}+ onChange={(value) => writeSettings({ videoCodec: value ?? undefined })}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{itemProps.item.rawValue.toUpperCase()}</SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>{config()?.video?.codec?.toUpperCase() ?? 'AVC'}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>+ <ControlRow label="Format">+ <Select+ value={config()?.format ?? 'mp4'}+ options={[...VIDEO_FORMAT_OPTIONS]}+ onChange={(value) => writeSettings({ format: value ?? undefined })}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{itemProps.item.rawValue.toUpperCase()}</SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>{config()?.format?.toUpperCase() ?? 'MP4'}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>+ <ControlRow label="Frame rate">+ <Select+ value={config()?.video?.fps ?? 30}+ options={[...FRAME_RATE_OPTIONS]}+ onChange={(value) => writeSettings({ videoFps: value ?? undefined })}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{itemProps.item.rawValue} FPS</SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>{config()?.video?.fps ?? 30} FPS</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>+ </div>+ </div>++ <Separator class="my-3" />++ <div class="flex flex-col gap-2">+ <ControlRow label="Audio">+ <Switch+ checked={config()?.audio?.enabled != false}+ onChange={(checked) => writeSettings({ audioEnabled: checked })}+ >+ <SwitchInput />+ <SwitchControl variant="compact">+ <SwitchThumb variant="compact" />+ </SwitchControl>+ </Switch>+ </ControlRow>+ <div+ class="flex flex-col gap-2 transition-opacity"+ classList={{+ "opacity-50": config()?.audio?.enabled == false,+ "pointer-events-none": config()?.audio?.enabled == false,+ }}+ >+ <ControlRow label="Codec">+ <Select+ value={config()?.audio?.codec ?? 'aac'}+ options={[...AUDIO_CODEC_OPTIONS]}+ onChange={(value) => writeSettings({ audioCodec: value ?? undefined })}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{itemProps.item.rawValue.toUpperCase()}</SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>{config()?.audio?.codec?.toUpperCase() ?? 'AAC'}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>+ <ControlRow label="Sample rate">+ <Select+ value={config()?.audio?.sampleRate ?? 48000}+ options={[...SAMPLE_RATE_OPTIONS]}+ onChange={(value) => writeSettings({ audioSampleRate: value ?? undefined })}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{itemProps.item.rawValue / 1000} kHz</SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>{(config()?.audio?.sampleRate ?? 48000) / 1000} kHz</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>+ </div>+ </div>+ </FloatingInspectorContent>+ </FloatingInspector>+ );+}+++const DEFAULT_ESTIMATE_VIDEO_BITRATE = 10e6;+const DEFAULT_ESTIMATE_AUDIO_BITRATE = 128e3;+const DEFAULT_ESTIMATE_RESOLUTION = 1080;+const DEFAULT_ESTIMATE_FRAME_RATE = 30;++const VIDEO_CODEC_SIZE_FACTORS: Partial<Record<VideoCodec, number>> = {+ avc: 1,+ hevc: 0.72,+ vp9: 0.82,+ av1: 0.65,+ vp8: 1.15,+};++const AUDIO_CODEC_SIZE_FACTORS: Partial<Record<AudioCodec, number>> = {+ aac: 1,+ opus: 0.78,+};++const CONTAINER_SIZE_FACTORS: Record<ContainerFormat, number> = {+ mp4: 1,+ webm: 0.96,+ ogg: 0.93,+ mov: 1.03,+};++function estimateFileSize(config?: ExportConfig, duration?: number) {+ if (!duration || duration <= 0) return 0;++ const format = config?.format ?? "mp4";+ const videoEnabled = format === "ogg" ? false : config?.video?.enabled !== false;+ const audioEnabled = format === "ogg" ? true : config?.audio?.enabled !== false;++ const videoBitrate = config?.video?.bitrate ?? DEFAULT_ESTIMATE_VIDEO_BITRATE;+ const audioBitrate = config?.audio?.bitrate ?? DEFAULT_ESTIMATE_AUDIO_BITRATE;++ const resolution = Math.max(config?.video?.resolution ?? DEFAULT_ESTIMATE_RESOLUTION, 1);+ const fps = Math.max(config?.video?.fps ?? DEFAULT_ESTIMATE_FRAME_RATE, 1);++ const videoCodec = config?.video?.codec ?? "avc";+ const audioCodec = config?.audio?.codec ?? (format === "webm" || format === "ogg" ? "opus" : "aac");++ const videoCodecFactor = VIDEO_CODEC_SIZE_FACTORS[videoCodec] ?? 1;+ const audioCodecFactor = AUDIO_CODEC_SIZE_FACTORS[audioCodec] ?? 1;+ const containerFactor = CONTAINER_SIZE_FACTORS[format];++ const resolutionFactor = Math.pow(resolution / DEFAULT_ESTIMATE_RESOLUTION, 1.08);+ const frameRateFactor = fps / DEFAULT_ESTIMATE_FRAME_RATE;++ const effectiveVideoBitrate =+ videoBitrate * resolutionFactor * frameRateFactor * videoCodecFactor * containerFactor;+ const effectiveAudioBitrate = audioBitrate * audioCodecFactor * containerFactor;++ const totalBitrate =+ (videoEnabled ? effectiveVideoBitrate : 0) + (audioEnabled ? effectiveAudioBitrate : 0);++ return (duration * totalBitrate) / 8;+}diff --git a/apps/web/src/components/sidebar-right/inspector/fill-picker.tsx b/apps/web/src/components/sidebar-right/inspector/fill-picker.tsxnew file mode 100644index 00000000..a2d66792--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/fill-picker.tsx@@ -0,0 +1,225 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import {+ createSignal,+ createEffect,+ Show,+ For,+ createMemo,+} from "solid-js";+import { Icon } from "@/components/ui/icon";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { SegmentedIconTabs } from "@/components/ui/segmented-icon-tabs";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorTitle,+} from "@/components/ui/floating-inspector";+import { BlendModeMenu } from "./blend-mode-menu";+import { SolidFillPicker } from "./solid-picker";+import { GradientFillPicker } from "./gradient-picker";+import { AssetFillPicker } from "./asset-picker";+import { ScaleMode, PaintType, useEntityState, ChildOf, createEntity, deleteEntity, appendChild, removeComponent, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { query } from 'bitecs';++export type FillTab = "solid" | "gradient" | "asset";++const TABS = [+ { value: "solid", icon: "fill.solid-color", label: "Color" },+ { value: "gradient", icon: "fill.gradient", label: "Gradient" },+ { value: "asset", icon: "fill.media", label: "Asset" },+]++const SCALE_MODE_OPTIONS: ReadonlyArray<{ value: ScaleMode; label: string; }> = [+ { value: ScaleMode.FILL, label: "Fill", },+ { value: ScaleMode.FIT, label: "Fit", },+ { value: ScaleMode.COVER, label: "Cover", },+ { value: ScaleMode.NONE, label: "None", },+];++export type FillPickerProps = {+ anchorRef: HTMLElement;+ nodeEid: number;+ fillEid: number;+ open: boolean;+ onClose(): void;+ tabs?: FillTab[];+};++export function getFillTab(paintType: PaintType): FillTab {+ if (paintType === PaintType.SOLID) return "solid";+ if (paintType === PaintType.LINEAR_GRADIENT) return "gradient";+ if (paintType === PaintType.RADIAL_GRADIENT) return "gradient";+ if (paintType === PaintType.VIDEO) return "asset";+ return 'asset';+};++export function FillPicker(props: FillPickerProps) {+ const { world } = useEngine();+ const c = world.components;++ const scaleMode = useEntityState(c.ScaleMode, props.fillEid, ScaleMode.FILL);+ const type = useEntityState(c.Paint, props.fillEid, PaintType.SOLID);++ const [currentTab, setCurrentTab] = createSignal<FillTab>(getFillTab(type() ?? PaintType.SOLID));++ createEffect(() => {+ setCurrentTab(getFillTab(type() ?? PaintType.SOLID));+ });++ const seedStop = (position: number, color: number) => {+ const stopEid = createEntity(world);+ setComponent(world, stopEid, c.ColorStop, {+ offset: position,+ opacity: 1,+ color,+ });+ appendChild(world, stopEid, props.fillEid);+ };++ const clearPaint = () => {+ removeComponent(world, props.fillEid, c.Color);+ removeComponent(world, props.fillEid, c.AssetId);+ removeComponent(world, props.fillEid, c.ScaleMode);+ for (const eid of query(world, [ChildOf(props.fillEid)])) {+ deleteEntity(world, eid);+ }+ };++ const handleTabChange = (tab: FillTab) => {+ setCurrentTab(tab);++ world.history.transaction('Change fill type', () => {+ if (tab == "solid") {+ // Remove gradient/asset components, add solid+ clearPaint();+ setComponent(world, props.fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, props.fillEid, c.Color, 0xE0E0E0);+ } else if (tab == "gradient") {+ // Remove solid/asset components, seed two-stop gradient+ clearPaint();+ setComponent(world, props.fillEid, c.Paint, PaintType.LINEAR_GRADIENT);+ seedStop(0, 0xE0E0E0);+ seedStop(1, 0x000000);+ }+ });+ };++ const handleScaleModeChange = (mode: ScaleMode) => {+ setComponent(world, props.fillEid, c.ScaleMode, mode);+ };++ const availableTabs = createMemo(() => {+ if (props.tabs) {+ return TABS.filter((tab) => props.tabs?.includes(tab.value as FillTab));+ }++ return TABS;+ });++ return (+ <FloatingInspector+ open={props.open}+ anchorRef={props.anchorRef}+ >+ <FloatingInspectorHeader>+ <FloatingInspectorTitle>+ {TABS.find((mode) => mode.value === currentTab())?.label}+ </FloatingInspectorTitle>+ <div class="ml-auto flex items-center gap-1">+ <Show when={currentTab() === "asset"}>+ <DropdownMenu placement="bottom-end">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ {...buttonProps}+ size="icon"+ variant="ghost"+ class="text-muted-foreground hover:bg-accent data-expanded:bg-accent"+ >+ <Icon name="media-fit-type" class="size-6" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Fit mode</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-[180px]">+ <For each={SCALE_MODE_OPTIONS}>+ {(option) => (+ <DropdownMenuItem+ class="px-0 pr-2"+ onSelect={() => handleScaleModeChange(option.value)}+ >+ <span class="w-6 h-7 shrink-0 flex items-center justify-center overflow-clip">+ <Show when={scaleMode() === option.value}>+ <Icon name="confirm-check" class="text-popover-foreground" />+ </Show>+ </span>+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {option.label}+ </span>+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </Show>+ <BlendModeMenu fillEid={props.fillEid} />+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={props.onClose}+ >+ <Icon name="close-remove" class="size-6" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </div>+ </FloatingInspectorHeader>+ <FloatingInspectorContent class="p-0">+ <div class="flex flex-col">+ <div class="px-2 pb-3">+ <SegmentedIconTabs+ value={currentTab}+ onChange={(tab) => handleTabChange(tab as FillTab)}+ items={availableTabs()}+ />+ </div>++ <Show when={currentTab() === "solid"}>+ <SolidFillPicker nodeEid={props.nodeEid} fillEid={props.fillEid} />+ </Show>+ <Show when={currentTab() === "gradient"}>+ <GradientFillPicker nodeEid={props.nodeEid} fillEid={props.fillEid} />+ </Show>+ <Show when={currentTab() === "asset"}>+ <AssetFillPicker nodeEid={props.nodeEid} fillEid={props.fillEid} />+ </Show>+ </div>+ </FloatingInspectorContent>+ </FloatingInspector>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/fill-row.tsx b/apps/web/src/components/sidebar-right/inspector/fill-row.tsxnew file mode 100644index 00000000..9a65da0e--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/fill-row.tsx@@ -0,0 +1,85 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { FillItem } from "@/components/ui/fill-item";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuSeparator,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import { PaintType, useEntityState, useEntityTag, addComponent, removeComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { hasComponent } from 'bitecs';++type FillRowProps = {+ nodeEid: number;+ fillEid: number;+ onSelect(): void;+ onRemove(): void;+ onMoveUp?(): void;+ onMoveDown?(): void;+};++const FILL_TYPE_LABELS: Record<PaintType, string> = {+ [PaintType.SOLID]: 'Solid',+ [PaintType.IMAGE]: 'Image',+ [PaintType.VIDEO]: 'Video',+ [PaintType.SEQUENCE]: 'Sequence',+ [PaintType.LINEAR_GRADIENT]: 'Gradient',+ [PaintType.RADIAL_GRADIENT]: 'Gradient',+ [PaintType.WAVEFORM]: 'Waveform',+};++export function FillRow(props: FillRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const fillType = useEntityState(c.Paint, props.fillEid, PaintType.SOLID);+ const hidden = useEntityTag(c.Hidden, () => props.fillEid);++ const label = createMemo(() => (FILL_TYPE_LABELS[fillType() as PaintType] ?? 'Solid'));+ const toggleHidden = () => {+ if (hasComponent(world, props.fillEid, c.Hidden)) {+ removeComponent(world, props.fillEid, c.Hidden);+ } else {+ addComponent(world, props.fillEid, c.Hidden);+ }+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label={label()}+ class={hidden() ? "opacity-50" : undefined}+ >+ <FillItem+ nodeEid={props.nodeEid}+ fillEid={props.fillEid}+ onClick={props.onSelect}+ />+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem onSelect={props.onMoveUp}>+ Move Up+ </ContextMenuItem>+ <ContextMenuItem onSelect={props.onMoveDown}>+ Move Down+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={toggleHidden}>+ {hidden() ? "Unhide" : "Hide"}+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={props.onRemove}>+ Remove+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ )+}diff --git a/apps/web/src/components/sidebar-right/inspector/fills.tsx b/apps/web/src/components/sidebar-right/inspector/fills.tsxnew file mode 100644index 00000000..b724c841--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/fills.tsx@@ -0,0 +1,111 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ For,+ Show,+ createMemo,+ createSignal,+} from "solid-js";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";++import { FillPicker, type FillTab } from "./fill-picker";+import { useEntityState, createEntity, deleteEntity, getSiblingEntities, PaintType, isText, appendChild, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { FillRow } from "./fill-row";++type FillsSettingsProps = {+ selection: Set<number>;+};++export function FillsSettings(props: FillsSettingsProps) {+ const { world } = useEngine();++ const c = world.components;+ let anchorRef!: HTMLDivElement;++ const [selectedFill, setSelectedFill] = createSignal<number>();+ const eid = () => props.selection.values().next().value!;++ const fillEids = useEntityState(c.Cache.fills, eid, []);+ const tabs = createMemo<FillTab[] | undefined>(() => {+ return isText(world, eid())+ ? ['solid', 'gradient']+ : undefined;+ });++ const handleAppendFill = () => {+ world.history.transaction('Append fill', () => {+ const solidEid = createEntity(world);+ setComponent(world, solidEid, c.Paint, PaintType.SOLID);+ setComponent(world, solidEid, c.Color, 0xE0E0E0);+ appendChild(world, solidEid, eid());+ })+ };++ const handleClosePicker = () => setSelectedFill(undefined);+ const handleSelectFill = (fillEid: number) => setSelectedFill(fillEid);+ const handleRemoveFill = (fillEid: number) => deleteEntity(world, fillEid);++ const handleReorderFill = (fillEid: number, direction: number) => {+ const fills = getSiblingEntities(world, fillEid, c.Paint);+ const index = fills.indexOf(fillEid);+ const newIndex = index + direction;+ if (newIndex >= 0 && newIndex < fills.length) {+ fills.splice(newIndex, 0, fills.splice(index, 1)[0]);+ for (const [idx, eid] of fills.entries()) {+ setComponent(world, eid, c.ItemIndex, idx);+ }+ }+ };++ return (+ <>+ <PanelSection+ title="Fill"+ ref={anchorRef}+ actions={+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleAppendFill}+ >+ <Icon name="plus-add" />+ </TooltipTrigger>+ <TooltipContent>Add fill</TooltipContent>+ </Tooltip>+ }+ >+ <For each={fillEids().toReversed()}>+ {(fillEid) => (+ <FillRow+ nodeEid={eid()}+ fillEid={fillEid}+ onSelect={() => handleSelectFill(fillEid)}+ onRemove={() => handleRemoveFill(fillEid)}+ onMoveUp={() => handleReorderFill(fillEid, 1)}+ onMoveDown={() => handleReorderFill(fillEid, -1)}+ />+ )}+ </For>+ </PanelSection>+ <Show when={selectedFill()}>+ <FillPicker+ nodeEid={eid()}+ fillEid={selectedFill()!}+ anchorRef={anchorRef}+ open={!!selectedFill()}+ onClose={handleClosePicker}+ tabs={tabs()}+ />+ </Show>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/gradient-picker.tsx b/apps/web/src/components/sidebar-right/inspector/gradient-picker.tsxnew file mode 100644index 00000000..71307772--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/gradient-picker.tsx@@ -0,0 +1,710 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { For, Show, createEffect, createMemo, createSignal, onCleanup, onMount } from "solid-js";++import { Icon } from "@/components/ui/icon";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuPortal,+ ContextMenuSeparator,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { ControlledTextField } from "@/components/ui/text-field";+import { Keyframe } from "@/components/ui/keyframe";+import { OpacitySwatch } from "@/components/ui/opacity-swatch";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorTitle,+} from "@/components/ui/floating-inspector";+import { useDrag } from "@/hooks/use-drag";+import { clamp, mergeColorWithOpacity } from "@/utils";+import { colorToHex, parseColor } from "@/utils/color";+import { ColorOpacityPicker } from "@/components/ui/color-opacity-picker";+import { ChildOf, PaintType, useEntityState, useEntityStates, useQuery, createEntity, deleteEntity, appendChild, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { Not } from 'bitecs';++export type GradientPickerProps = {+ nodeEid: number;+ fillEid: number;+};++const GRADIENT_STYLE_OPTIONS = ["Linear", "Radial"] as const;+type GradientStyleOption = (typeof GRADIENT_STYLE_OPTIONS)[number];++function handleInitialInputPointerDown(e: PointerEvent & { currentTarget: HTMLInputElement }) {+ if (document.activeElement === e.currentTarget) return;+ e.preventDefault();+ e.currentTarget.focus();+ e.currentTarget.select();+};++function getSliderRatio(+ element: HTMLDivElement | undefined,+ pos: { x: number; y: number },+) {+ if (!element) return null;+ const rect = element.getBoundingClientRect();+ if (!rect.width) return null;+ return Math.round(clamp((pos.x - rect.left) / rect.width, 0, 1) * 100) / 100;+};++// Visual position of a stop on the track in [0, 1]. Offsets in [0, 1] map+// directly so the right edge stays at 100%; offsets > 1 wrap so cycling+// animations show the wrapped position.+function visualOffset(raw: number): number {+ if (raw <= 1) return Math.max(0, raw);+ return raw % 1;+}++function isPrimaryPointerButton(e: PointerEvent) {+ return e.button === 0 && !e.ctrlKey;+}++export function GradientFillPicker(props: GradientPickerProps) {+ const { world } = useEngine();+ const c = world.components;++ let rootRef: HTMLDivElement | undefined;+ let stopTrackRef: HTMLDivElement | undefined;+ let draggedStopEid: number | null = null;++ const [selectedStopEid, setSelectedStopEid] = createSignal<number | null>(null);+ const [colorPickerStopEid, setColorPickerStopEid] = createSignal<number | null>(null);++ const stopEids = useQuery([c.ColorStop, ChildOf(props.fillEid), Not(c.Deleted)]);+ const offsets = useEntityStates(c.Computed.stopOffset, stopEids, 0);+ const colors = useEntityStates(c.Computed.stopColor, stopEids, 0xFFFFFF);+ const opacities = useEntityStates(c.Computed.stopOpacity, stopEids, 1);++ const stops = createMemo(() => stopEids()+ .map((eid, idx) => ({+ eid,+ offset: offsets()[idx],+ color: colors()[idx],+ opacity: opacities()[idx],+ }))+ .toSorted((a, b) => a.offset - b.offset)+ );++ const rotation = useEntityState(c.Computed.rotation, props.fillEid, 0);+ const fillType = useEntityState(c.Paint, props.fillEid, PaintType.LINEAR_GRADIENT);++ const addStop = () => {+ const current = stops();+ const first = current[0];+ const second = current[1];++ const newPosition = 0;+ const adjustedFirstPosition = second+ ? clamp((second.offset ?? 0) / 2, 0, 1)+ : clamp((first?.offset ?? 0) / 2, 0, 1);++ const stopEid = world.history.transaction('Add gradient stop', () => {+ if (first) {+ setComponent(world, first.eid, c.ColorStop, { offset: adjustedFirstPosition });+ }++ const newStopEid = createEntity(world);+ setComponent(world, newStopEid, c.ColorStop, {+ offset: newPosition,+ color: first?.color ?? 0xFFFFFF,+ opacity: first?.opacity ?? 1,+ });+ appendChild(world, newStopEid, props.fillEid);+ return newStopEid;+ });++ setSelectedStopEid(stopEid);+ };++ const removeSelectedStop = () => {+ const eid = selectedStopEid();+ if (eid === null) return;+ if (stops().length <= 2) return;+ removeStopEid(eid);+ };++ const removeStopEid = (eid: number) => {+ deleteEntity(world, eid);+ if (selectedStopEid() === eid) setSelectedStopEid(null);+ if (colorPickerStopEid() === eid) setColorPickerStopEid(null);+ };++ const redistributeStopsEvenly = () => {+ if (stops().length <= 1) return;++ const denom = Math.max(stops().length - 1, 1);+ world.history.transaction('Redistribute gradient stops', () => {+ for (const [index, stop] of stops().entries()) {+ setComponent(world, stop.eid, c.ColorStop, { offset: index / denom });+ }+ });+ };++ const duplicateStop = (eid: number) => {+ const sorted = stops();+ const sourceIndex = sorted.findIndex(s => s.eid === eid);+ const source = sorted[sourceIndex];+ if (!source) return;++ const sourceOffset = clamp(source.offset, 0, 1);+ const prev = sorted[sourceIndex - 1];+ const next = sorted[sourceIndex + 1];++ let offset = sourceOffset;+ if (next) {+ offset = sourceOffset + (clamp(next.offset, 0, 1) - sourceOffset) / 2;+ } else if (prev) {+ offset = clamp(prev.offset, 0, 1) + (sourceOffset - clamp(prev.offset, 0, 1)) / 2;+ } else {+ offset = clamp(sourceOffset + 0.01, 0, 1);+ }+ if (offset === sourceOffset) {+ offset = clamp(sourceOffset + 0.01, 0, 1);+ }++ const stopEid = world.history.transaction('Duplicate gradient stop', () => {+ const newStopEid = createEntity(world);+ setComponent(world, newStopEid, c.ColorStop, { ...source, offset });+ appendChild(world, newStopEid, props.fillEid);+ return newStopEid;+ });+ setSelectedStopEid(stopEid);+ };++ const removeAllStops = () => {+ world.history.transaction('Remove all gradient stops', () => {+ for (const stop of stops()) {+ deleteEntity(world, stop.eid);+ }+ });+ setSelectedStopEid(null);+ setColorPickerStopEid(null);+ };++ const handleKeyDown = (e: KeyboardEvent) => {+ if (e.key !== "Backspace") return;+ const target = e.target as HTMLElement | null;+ if (+ target instanceof HTMLInputElement ||+ target instanceof HTMLTextAreaElement ||+ target?.isContentEditable+ ) {+ return;+ }+ if (selectedStopEid() === null) return;++ // Prevent the event from bubbling up to the document.+ // otherwise the selection would get deleted instead+ e.preventDefault();+ e.stopImmediatePropagation();+ removeSelectedStop();+ };++ // Capture is important here+ onMount(() => window.addEventListener("keydown", handleKeyDown, { capture: true }));+ onCleanup(() => window.removeEventListener("keydown", handleKeyDown, { capture: true }));++ // Clear stale selection if the selected stop was deleted.+ createEffect(() => {+ const eid = selectedStopEid();+ if (eid === null) return;+ if (!stopEids().includes(eid)) setSelectedStopEid(null);+ });++ createEffect(() => {+ const eid = colorPickerStopEid();+ if (eid === null) return;+ if (!stopEids().includes(eid)) setColorPickerStopEid(null);+ });++ const spawnColorPicker = (_anchor: HTMLElement, eid: number) => {+ setSelectedStopEid(eid);+ setColorPickerStopEid(eid);+ };++ const closeStopColorPicker = () => {+ setColorPickerStopEid(null);+ };++ const colorPickerStop = createMemo(() => {+ return stops().find(s => s.eid === colorPickerStopEid()) ?? null;+ });++ const insertStopAtRatio = (ratio: number): number => {+ const nearest = stops().slice().sort(+ (a, b) => Math.abs(a.offset - ratio) - Math.abs(b.offset - ratio),+ )[0];++ const stopEid = createEntity(world);+ setComponent(world, stopEid, c.ColorStop, {+ offset: ratio,+ color: nearest?.color ?? 0xFFFFFF,+ opacity: nearest?.opacity ?? 1,+ });+ appendChild(world, stopEid, props.fillEid);++ return stopEid;+ };++ const updateStopDragPosition = (pos: { x: number; y: number }) => {+ const ratio = getSliderRatio(stopTrackRef, pos);++ if (draggedStopEid && ratio !== null) {+ setComponent(world, draggedStopEid, c.ColorStop, { offset: ratio });+ }+ };++ const beginStopDrag = (eid: number, e: PointerEvent) => {+ if (!isPrimaryPointerButton(e)) return;+ draggedStopEid = eid;+ setSelectedStopEid(eid);+ stopDrag.onPointerDown(e);+ };++ const beginInsertAndDragStop = (e: PointerEvent & { currentTarget: HTMLDivElement }) => {+ if (!isPrimaryPointerButton(e)) return;+ const ratio = getSliderRatio(stopTrackRef, { x: e.clientX, y: e.clientY });+ if (ratio === null) return;++ let insertedEid: number | null = null;+ world.history.transaction("Insert gradient stop", () => {+ insertedEid = insertStopAtRatio(ratio);+ });+ if (insertedEid !== null) {+ beginStopDrag(insertedEid, e);+ }+ };++ const stopDrag = useDrag({+ onDragStart: updateStopDragPosition,+ onDragMove: updateStopDragPosition,+ onDragEnd: (pos) => {+ updateStopDragPosition(pos);+ draggedStopEid = null;+ },+ });++ const rotateGradient = () => {+ setComponent(world, props.fillEid, c.Rotation, (rotation() + 90) % 360);+ };++ const flipGradient = () => {+ world.history.transaction('Flip gradient', () => {+ for (const stop of stops()) {+ setComponent(world, stop.eid, c.ColorStop, { offset: 1 - stop.offset });+ }+ });+ };++ const handleGradientStyleChange = (style: GradientStyleOption | null) => {+ const value = style === "Radial" ? PaintType.RADIAL_GRADIENT : PaintType.LINEAR_GRADIENT;+ setComponent(world, props.fillEid, c.Paint, value);+ };++ const handleRotationChange = (value: number) => {+ value = Math.round(value * 100) / 100;+ setComponent(world, props.fillEid, c.Rotation, ((value % 360) + 360) % 360);+ };++ const gradientLabel = createMemo(() => {+ return fillType() === PaintType.RADIAL_GRADIENT ? "Radial" : "Linear";+ });++ const gradientBackground = createMemo(() => {+ const parts = stops().map(s => {+ const offset = clamp(s.offset * 100, 0, 100);+ return `${mergeColorWithOpacity(s.color, s.opacity)} ${offset}%`;+ });+ return `linear-gradient(90deg, ${parts.join(", ")})`;+ });++ const handleGradientBackgroundClick = () => {+ setSelectedStopEid(null);+ };++ return (+ <div ref={rootRef} class="flex flex-col gap-4 p-4" onClick={handleGradientBackgroundClick}>+ <div class="flex flex-col gap-4">+ <div class="flex items-center gap-2">+ <Select<GradientStyleOption>+ class="flex-1"+ value={fillType() === PaintType.RADIAL_GRADIENT ? "Radial" : "Linear"}+ options={[...GRADIENT_STYLE_OPTIONS]}+ onChange={handleGradientStyleChange}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {itemProps.item.rawValue}+ </SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue class="text-xs">{gradientLabel()}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ <ControlledTextField+ class="w-14 shrink-0"+ value={rotation()}+ step={1}+ unit="°"+ autoSelect+ limitEvents+ skipEmpty+ onNumber={handleRotationChange}+ />+ <div class="flex items-center gap-1">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={rotateGradient}+ >+ <Icon name="rotate-90" />+ </TooltipTrigger>+ <TooltipContent>Rotate 90°</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={flipGradient}+ >+ <Icon name="switch-flip" />+ </TooltipTrigger>+ <TooltipContent>Flip</TooltipContent>+ </Tooltip>+ </div>+ </div>++ <div class="flex flex-col gap-2 items-center">+ <ContextMenu modal={false}>+ <ContextMenuTrigger+ as="div"+ class="h-7 w-full touch-none rounded-md border border-border-input"+ style={{ "background-image": gradientBackground() }}+ onPointerDown={beginInsertAndDragStop}+ />+ <ContextMenuPortal>+ <ContextMenuContent>+ <ContextMenuItem+ disabled={stops().length <= 1}+ onSelect={redistributeStopsEvenly}+ >+ Redistribute stops evenly+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem+ disabled={stops().length === 0}+ onSelect={removeAllStops}+ >+ Delete all stops+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ <div ref={stopTrackRef} class="relative z-10 h-[14px] w-full overflow-visible">+ <For each={stops()}>+ {(stop) => (+ <ContextMenu modal={false}>+ <ContextMenuTrigger+ as="div"+ class="absolute top-0 touch-none"+ classList={{ "opacity-80": selectedStopEid() !== stop.eid }}+ style={{+ filter: "drop-shadow(0px 3px 3px rgba(0,0,0,0.48)) drop-shadow(0px 2px 1px rgba(0,0,0,0.48))",+ left: `${visualOffset(stop.offset) * 100}%`,+ transform: "translateX(-50%)",+ }}+ onPointerDown={(e) => beginStopDrag(stop.eid, e)}+ >+ <svg+ width="18"+ height="18"+ viewBox="0 0 18 18"+ fill="none"+ class="touch-none"+ >+ <path+ d="M7.48137 1.69753C8.27955 0.766245 9.72025 0.766211 10.5185 1.69746L13.5184 5.19738C13.8291 5.55987 13.9999 6.02154 13.9999 6.49896L13.9999 11.9258C13.9999 13.0304 13.1044 13.9258 11.9999 13.9258L5.99999 13.9258C4.89538 13.9258 3.99993 13.0303 3.99999 11.9257L4.0003 6.49885C4.00033 6.02149 4.17109 5.55989 4.48173 5.19745L7.48137 1.69753Z"+ fill={colorToHex(stop.color)}+ stroke={+ selectedStopEid() === stop.eid+ ? "var(--ring)"+ : "var(--border-input)"+ }+ stroke-width={selectedStopEid() === stop.eid ? 2 : 1}+ stroke-linejoin="round"+ />+ </svg>+ </ContextMenuTrigger>+ <ContextMenuPortal>+ <ContextMenuContent>+ <ContextMenuItem+ disabled={stops().length <= 1}+ onSelect={redistributeStopsEvenly}+ >+ Redistribute stops evenly+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={() => duplicateStop(stop.eid)}>+ Duplicate stop+ </ContextMenuItem>+ <ContextMenuItem+ disabled={stops().length <= 2}+ onSelect={() => removeStopEid(stop.eid)}+ >+ Delete stop+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem+ disabled={stops().length === 0}+ onSelect={removeAllStops}+ >+ Delete all stops+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ )}+ </For>+ </div>+ </div>+ </div>++ <div class="flex flex-col gap-0 border-t border-border">+ <div class="flex items-center h-10 gap-2">+ <span class="flex-1 text-xs text-foreground font-strong">+ Stops+ </span>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={addStop}+ >+ <Icon name="plus-add" />+ </TooltipTrigger>+ <TooltipContent>Add stop</TooltipContent>+ </Tooltip>+ </div>+ <div class="flex flex-col gap-3">+ <For each={stops()}>+ {(stop) => (+ <GradientStopRow+ eid={stop.eid}+ offset={stop.offset}+ color={stop.color}+ opacity={stop.opacity}+ selected={selectedStopEid() === stop.eid}+ spawnColorPicker={spawnColorPicker}+ />+ )}+ </For>+ </div>+ </div>++ <FloatingInspector+ open={colorPickerStopEid() !== null}+ anchorRef={rootRef}+ >+ <FloatingInspectorHeader>+ <FloatingInspectorTitle class="flex-1">Stop color</FloatingInspectorTitle>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={closeStopColorPicker}+ >+ <Icon name="close-remove" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </FloatingInspectorHeader>+ <FloatingInspectorContent class="p-0">+ <Show when={colorPickerStop()}>+ {(stop) => (+ <ColorOpacityPicker+ color={stop().color}+ opacity={stop().opacity}+ onColorChange={(next) => {+ setComponent(world, stop().eid, c.ColorStop, { color: next });+ }}+ onOpacityChange={(next) => {+ setComponent(world, stop().eid, c.ColorStop, { opacity: next });+ }}+ onBeginChange={(label) => world.history.startTransaction(label)}+ onEndChange={() => world.history.commitTransaction()}+ />+ )}+ </Show>+ </FloatingInspectorContent>+ </FloatingInspector>+ </div>+ );+}++type GradientStopRowProps = {+ eid: number;+ offset: number;+ color: number;+ opacity: number;+ selected: boolean;+ spawnColorPicker(anchor: HTMLElement, eid: number): void;+}++function GradientStopRow(props: GradientStopRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const colorText = createMemo(() => colorToHex(props.color).replace("#", ""));+ const [colorDraft, setColorDraft] = createSignal(colorText());++ createEffect(() => {+ setColorDraft(colorText());+ });++ const commitColor = () => {+ const nextColor = parseColor(colorDraft());+ if (nextColor === null) {+ setColorDraft(colorText());+ return;+ }++ setComponent(world, props.eid, c.ColorStop, { color: nextColor });+ };++ const handleColorInput = (event: InputEvent & { currentTarget: HTMLInputElement }) => {+ setColorDraft(event.currentTarget.value);+ };++ const handleColorKeyDown = (event: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (event.key === "Enter") {+ event.preventDefault();+ event.currentTarget.blur();+ return;+ }++ if (event.key !== "Escape") return;+ event.preventDefault();+ const next = colorText();+ setColorDraft(next);+ event.currentTarget.value = next;+ event.currentTarget.blur();+ };++ const handleColorBlur = (event: FocusEvent & { currentTarget: HTMLInputElement }) => {+ commitColor();+ event.currentTarget.value = colorText();+ };++ const handleOffsetChange = (value: number) => {+ setComponent(world, props.eid, c.ColorStop, { offset: Math.max(0, Math.round(value)) / 100 });+ };++ const handleOpacityChange = (value: number) => {+ setComponent(world, props.eid, c.ColorStop, { opacity: clamp(Math.round(value), 0, 100) / 100 });+ };++ const handleClickColorPicker = (e: MouseEvent & { currentTarget: HTMLButtonElement }) => {+ e.stopPropagation();+ props.spawnColorPicker(e.currentTarget, props.eid);+ };++ return (+ <div class="flex min-w-0 items-center gap-2">+ <ControlledTextField+ class="w-15 shrink-0"+ value={Math.round(props.offset * 100)}+ min={0}+ step={1}+ unit="%"+ limitEvents+ skipEmpty+ autoSelect+ onNumber={handleOffsetChange}+ inputClassName="transition-none"+ keyframe={<Keyframe target={props.eid} property="stop.offset" />}+ />++ <div+ class="relative flex min-w-0 flex-1 items-center gap-px after:rounded-md after:pointer-events-none after:absolute after:inset-0 after:opacity-0 after:ring-1 after:ring-inset after:ring-ring after:z-20"+ classList={{ "after:opacity-100": props.selected }}+ >++ <div class="h-7 min-w-0 flex-1 rounded-l-md border border-border-input bg-input pl-1 flex items-center gap-1.5 border-transparent focus-within:border-ring">+ <button+ class="size-5 min-w-5 overflow-hidden rounded-sm"+ type="button"+ onPointerDown={(e) => e.stopPropagation()}+ onFocusIn={(e) => e.stopPropagation()}+ onClick={handleClickColorPicker}+ >+ <OpacitySwatch color={props.color} opacity={props.opacity} />+ </button>++ <input+ data-paint-editable="true"+ type="text"+ value={colorDraft()}+ class="w-full min-w-0 truncate bg-transparent text-xxs outline-none"+ onInput={handleColorInput}+ onKeyDown={handleColorKeyDown}+ onBlur={handleColorBlur}+ onPointerDown={handleInitialInputPointerDown}+ />++ <div+ class="shrink-0"+ onPointerDown={(e) => e.stopPropagation()}+ onFocusIn={(e) => e.stopPropagation()}+ >+ <Keyframe target={props.eid} property="stop.color" />+ </div>+ </div>++ <ControlledTextField+ class="w-15 shrink-0"+ value={Math.round(props.opacity * 100)}+ min={0}+ max={100}+ step={1}+ unit="%"+ limitEvents+ skipEmpty+ autoSelect+ onNumber={handleOpacityChange}+ inputClassName="rounded-l-none"+ keyframe={<Keyframe target={props.eid} property="stop.opacity" />}+ />+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/index.ts b/apps/web/src/components/sidebar-right/inspector/index.tsnew file mode 100644index 00000000..047eb145--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './inspector';diff --git a/apps/web/src/components/sidebar-right/inspector/inspector-header.tsx b/apps/web/src/components/sidebar-right/inspector/inspector-header.tsxnew file mode 100644index 00000000..ef00663e--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/inspector-header.tsx@@ -0,0 +1,100 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo } from "solid-js";++import { Icon } from "@/components/ui/icon";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { Button } from "@/components/ui/button";+import { useWorldState } from "@/components/engine/hooks/use-ecs";+import { useEngine } from "@/context/engine";++export function InspectorHeader() {+ const { world, camera } = useEngine();++ const cameraA = useWorldState(w => w.camera.a, 1);+ const cameraB = useWorldState(w => w.camera.b, 0);++ const zoom = createMemo(() => {+ const scale = Math.hypot(cameraA(), cameraB());+ if (!Number.isFinite(scale)) return null;+ return scale * 100;+ });++ const zoomLabel = () => {+ const value = zoom();+ if (typeof value === "number" && Number.isFinite(value)) {+ return `${Math.round(value)}%`;+ }+ return "72%";+ };++ const getCanvasCenter = () => {+ const canvas = world.canvas;+ if (!(canvas instanceof HTMLCanvasElement)) return { x: 0, y: 0 };+ const rect = canvas.getBoundingClientRect();+ return { x: rect.width / 2, y: rect.height / 2 };+ };++ const zoomBy = (factor: number) => {+ const { x, y } = getCanvasCenter();+ camera.zoom(x, y, factor);+ };++ const zoomTo = (targetPercent: number) => {+ const currentScale = Math.hypot(world.camera.a, world.camera.b);+ if (!currentScale || !Number.isFinite(currentScale)) return;+ const factor = (targetPercent / 100) / currentScale;+ const { x, y } = getCanvasCenter();+ camera.zoom(x, y, factor);+ };++ return (+ <div class="h-12 shrink-0 flex items-center px-4">+ <span class="text-[12px] font-450 text-foreground">+ Editor+ </span>+ <DropdownMenu placement="bottom-end">+ <DropdownMenuTrigger<typeof Button>+ as={(triggerProps) => (+ <Button+ {...triggerProps}+ variant="link"+ class="ml-auto flex items-center gap-0 text-muted-foreground px-0 relative z-30"+ style="-webkit-app-region: no-drag;"+ >+ <span>{zoomLabel()}</span>+ <Icon name="chevron-down" class="size-6 shrink-0" />+ </Button>+ )}+ />+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-40">+ <DropdownMenuItem onSelect={() => zoomBy(1.25)}>+ Zoom in+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => zoomBy(0.8)}>+ Zoom out+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => zoomTo(50)}>+ Zoom to 50%+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => zoomTo(100)}>+ Zoom to 100%+ </DropdownMenuItem>+ <DropdownMenuItem onSelect={() => zoomTo(200)}>+ Zoom to 200%+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/inspector.tsx b/apps/web/src/components/sidebar-right/inspector/inspector.tsxnew file mode 100644index 00000000..b30a5c66--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/inspector.tsx@@ -0,0 +1,181 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ControlScrollArea } from "@/components/ui/control-scrollarea";+import { Show, createMemo } from "solid-js";+import { InspectorHeader } from "./inspector-header";+import { Alignment } from "./alignment";+import { AnimationsSettings } from "./animations";+import { AudioSettings } from "./audio";+import { LayoutPanel } from "./layout";+import { EffectsSettings } from "./effects";+import { ExportPanel } from "./export";+import { FillsSettings } from "./fills";+import { AppearanceSettings } from "./appearance";+import { ShadowsSettings } from "./shadows";+import { StrokesSettings } from "./strokes";+import { AssetInfoPanel } from "./asset-info";+import { TimeSettings } from "./time";+import { TransformSettings } from "./transform";+import { BackgroundSettings } from "./background";+import { TransitionSettings } from "./transition";+import { MasksSettings } from "./masks";+import { InterpolationSettings } from "./interpolation";+import { CaptionSettings } from "./caption-settings";+import { getParentEntity, isAdjustmentLayer, isAudio, isCaption, isGroup, isMask, isScene, isSequence, isShape, isText, ToolType, useAssets } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { SceneTemplatePanel } from "./scene-template";+import { TextPanel } from "./text";+import { useECS } from "@/context/ecs";++export function Inspector() {+ const { world } = useEngine();+ const assets = useAssets(world);+ const { selectedKeyframes, selectedTool, selectedNodes } = useECS();+++ const firstEid = createMemo(() => selectedNodes().values().next().value);+ const parentEid = createMemo(() => getParentEntity(world, firstEid()));+ const isNested = createMemo(() => parentEid() != null);++ const isSequenceChild = createMemo(() => {+ const eid = parentEid();+ if (eid && isSequence(world, eid)) {+ return true;+ }++ return false;+ });++ const selectionTarget = createMemo(() => {+ const eid = firstEid();++ if (selectedTool() === ToolType.SCENE) {+ return "scene-tool";+ }++ if (selectedKeyframes().size > 0) {+ return "keyframe";+ }++ if (assets.selected().size > 0) {+ return "asset";+ }++ if (selectedNodes().size === 1 && eid) {+ // Order matters: scene check before plain group/shape since scenes are RECT+Group+ClipsContent.+ if (isScene(world, eid)) return "scene";+ if (isMask(world, eid)) return "mask";+ if (isSequence(world, eid)) return "sequence";+ if (isCaption(world, eid)) return "caption";+ if (isAudio(world, eid)) return "audio";+ if (isAdjustmentLayer(world, eid)) return "adjustment";+ if (isText(world, eid)) return "text";+ if (isShape(world, eid)) return "shape";+ if (isGroup(world, eid)) return "group";+ }++ return "stage";+ });++ const selectionHash = createMemo(() => {+ const nodes = Array.from(selectedNodes());+ const keyframes = Array.from(selectedKeyframes());+ return [...nodes, ...keyframes].join(',') + selectionTarget();+ });++ const includesTarget = (...targets: ReturnType<typeof selectionTarget>[]) => {+ return targets.includes(selectionTarget());+ };++ return (+ <div class="h-full min-h-0 flex flex-col" data-right-sidebar>+ <InspectorHeader />+ <Show when={selectionHash()} keyed>+ <ControlScrollArea class="flex-1 min-h-0">+ <Show when={includesTarget("scene-tool")}>+ <SceneTemplatePanel />+ </Show>++ <Show when={selectedNodes().size > 1}>+ <Alignment />+ </Show>++ <Show when={includesTarget("scene") && !isNested()}>+ <ExportPanel selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("stage")}>+ <BackgroundSettings />+ </Show>++ <Show when={includesTarget("shape", "text", "audio", "scene", "caption", "group", "mask", "adjustment")}>+ <TimeSettings selection={selectedNodes()} />+ </Show>+++ <Show when={includesTarget("shape", "text", "audio", "scene", "caption", "group", "mask", "adjustment")}>+ <TransformSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "audio", "scene", "caption", "mask")}>+ <LayoutPanel selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "scene", "caption", "group", "audio", "mask")}>+ <AppearanceSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("caption")}>+ <CaptionSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("text", "caption")}>+ <TextPanel selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "scene", "caption")}>+ <FillsSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "scene", "caption")}>+ <StrokesSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "scene", "caption")}>+ <ShadowsSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "scene", "caption")}>+ <EffectsSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "caption", "group", "mask")}>+ <AnimationsSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape") && isSequenceChild()}>+ <TransitionSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "text", "caption", "group")}>+ <MasksSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("shape", "audio", "group")}>+ <AudioSettings selection={selectedNodes()} />+ </Show>++ <Show when={includesTarget("asset")}>+ <AssetInfoPanel />+ </Show>++ <Show when={includesTarget("keyframe")}>+ <InterpolationSettings />+ </Show>+ </ControlScrollArea>+ </Show>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/interpolation.tsx b/apps/web/src/components/sidebar-right/inspector/interpolation.tsxnew file mode 100644index 00000000..8e5c262c--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/interpolation.tsx@@ -0,0 +1,1009 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, createSignal, createEffect, onCleanup, Show } from "solid-js";+import { cubicBezier, spring } from "animejs";+import { PanelSection } from "@/components/ui/panel-section";+import { ControlRow } from "@/components/ui/control-group";+import { ControlledTextField } from "@/components/ui/text-field";+import { IncrementDecrementControl } from "@/components/ui/increment-decrement-control";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { SegmentedIconTabs } from "@/components/ui/segmented-icon-tabs";+import { useEngine } from "@/context/engine";+import { useECS } from "@/context/ecs";+++import { setComponent } from '@/components/engine';+type InterpolationType = "hold" | "ease" | "spring";++type EasePreset = {+ label: string;+ value: string;+};++const EASE_PRESETS: EasePreset[] = [+ { label: "Linear", value: "" },+ { label: "Ease In", value: "cubicBezier(0.42,0,1,1)" },+ { label: "Ease Out", value: "cubicBezier(0,0,0.58,1)" },+ { label: "Ease In & Out", value: "cubicBezier(0.42,0,0.58,1)" },+];++function getEasingType(easing: string): InterpolationType {+ if (easing.startsWith("steps(")) return "hold";+ if (easing.startsWith("spring(")) return "spring";+ return "ease";+}++function parseSteps(easing: string): number {+ const match = easing.match(/steps\((\d+)\)/);+ return match ? parseInt(match[1], 10) : 1;+}++function parseBezier(+ easing: string,+): [number, number, number, number] {+ const match = easing.match(+ /cubicBezier\(([\d.-]+),([\d.-]+),([\d.-]+),([\d.-]+)\)/,+ );+ if (!match) return [0, 0, 1, 1]; // linear+ return [+ parseFloat(match[1]),+ parseFloat(match[2]),+ parseFloat(match[3]),+ parseFloat(match[4]),+ ];+}++function parseSpring(easing: string): { bounce: number; duration: number } {+ const match = easing.match(/spring\(([\d.-]+),([\d.-]+)\)/);+ if (!match) return { bounce: 0.5, duration: 500 };+ return { bounce: parseFloat(match[1]), duration: parseFloat(match[2]) };+}++type SpringPreset = {+ label: string;+ value: { bounce: number; duration: number };+};++const SPRING_PRESETS: SpringPreset[] = [+ { label: "Gentle", value: { bounce: 0.5, duration: 628 } },+ { label: "Snappy", value: { bounce: 0.15, duration: 300 } },+ { label: "Bouncy", value: { bounce: 0.4, duration: 500 } },+ { label: "Strong", value: { bounce: 0.65, duration: 400 } },+];++function springToString(bounce: number, duration: number): string {+ return `spring(${bounce},${duration})`;+}++function findSpringPreset(+ bounce: number,+ duration: number,+): SpringPreset | undefined {+ return SPRING_PRESETS.find(+ (p) => p.value.bounce === bounce && p.value.duration === duration,+ );+}++function formatBezier(points: [number, number, number, number]): string {+ return points.map((p) => p.toFixed(2)).join(", ");+}++function findPreset(easing: string): EasePreset | undefined {+ return EASE_PRESETS.find((p) => p.value === easing);+}++export function InterpolationSettings() {+ const { world } = useEngine();+ const { selectedKeyframes } = useECS();+ const c = world.components;++ // Bump to force currentEasing memo to re-read ECS after local mutations+ const [easingVersion, setEasingVersion] = createSignal(0);++ const currentEasing = createMemo(() => {+ easingVersion(); // reactive dependency on local mutations+ const set = selectedKeyframes();+ const kid = set.values().next().value;+ return world.components.Keyframe.easing[kid ?? -1] ?? "";+ });++ const activeTab = createMemo(() => getEasingType(currentEasing()));+ const bezierPoints = createMemo(() => parseBezier(currentEasing()));+ const stepsCount = createMemo(() => parseSteps(currentEasing()));+ const currentPreset = createMemo(() => findPreset(currentEasing()) ?? null);++ const springParams = createMemo(() => parseSpring(currentEasing()));+ const currentSpringPreset = createMemo(+ () => findSpringPreset(springParams().bounce, springParams().duration) ?? null,+ );++ const setSpringBounce = (bounce: number) =>+ setEasingForAll(springToString(Math.max(BOUNCE_MIN, Math.min(BOUNCE_MAX, Math.round(bounce * 100) / 100)), springParams().duration));+ const setSpringDuration = (duration: number) =>+ setEasingForAll(springToString(springParams().bounce, Math.max(DURATION_MIN, Math.min(DURATION_MAX, Math.round(duration)))));++ const handleSpringPresetChange = (preset: SpringPreset | null) => {+ if (!preset) return;+ setEasingForAll(springToString(preset.value.bounce, preset.value.duration));+ };++ const setEasingForAll = (easing: string) => {+ for (const kid of selectedKeyframes()) {+ setComponent(world, kid, c.Keyframe, { easing });+ }+ setEasingVersion((v) => v + 1);+ };++ const handleTabChange = (tab: InterpolationType) => {+ if (tab === activeTab()) return;+ switch (tab) {+ case "hold":+ setEasingForAll("steps(1)");+ break;+ case "ease":+ setEasingForAll("");+ break;+ case "spring":+ setEasingForAll("spring(0.5,628)");+ break;+ }+ };++ const handlePresetChange = (preset: EasePreset | null) => {+ if (!preset) return;+ setEasingForAll(preset.value);+ };++ const setBezierPoints = (points: [number, number, number, number]) => {+ const [x1, y1, x2, y2] = points;+ const isLinear = x1 === 0 && y1 === 0 && x2 === 1 && y2 === 1;+ const easing = isLinear ? "" : `cubicBezier(${x1},${y1},${x2},${y2})`;+ for (const kid of selectedKeyframes()) {+ setComponent(world, kid, c.Keyframe, { easing });+ }+ setEasingVersion((v) => v + 1);+ };++ const handleBezierInput = (raw: string) => {+ const parts = raw+ .split(",")+ .map((s) => parseFloat(s.trim()));+ if (parts.length !== 4 || parts.some((p) => isNaN(p))) return;+ const [x1, y1, x2, y2] = parts;+ const isLinear =+ x1 === 0 && y1 === 0 && x2 === 1 && y2 === 1;+ const easing = isLinear+ ? ""+ : `cubicBezier(${x1},${y1},${x2},${y2})`;+ setEasingForAll(easing);+ };++ const TAB_ITEMS = [+ { value: "hold" as const, label: "Hold" },+ { value: "ease" as const, label: "Ease" },+ { value: "spring" as const, label: "Spring" },+ ];++ return (+ <PanelSection title="Interpolation">+ <SegmentedIconTabs+ value={activeTab}+ onChange={handleTabChange}+ items={TAB_ITEMS}+ class="w-full"+ />++ {/* Hold tab content */}+ <Show when={activeTab() === "hold"}>+ <StepCurve+ steps={stepsCount()}+ onStepsChange={(n) => setEasingForAll(`steps(${n})`)}+ />++ <div class="flex flex-col gap-2 pt-1">+ <ControlRow label="Steps" contentClass="flex gap-2">+ <ControlledTextField+ value={String(stepsCount())}+ autoSelect+ class="flex-1"+ onChange={(e: Event) => {+ const val = parseInt((e.currentTarget as HTMLInputElement).value, 10);+ if (!isNaN(val) && val >= 1) setEasingForAll(`steps(${val})`);+ }}+ limitEvents+ />+ <IncrementDecrementControl+ class="flex-1"+ onDecrement={() => {+ const n = stepsCount();+ if (n > 1) setEasingForAll(`steps(${n - 1})`);+ }}+ onIncrement={() => {+ setEasingForAll(`steps(${stepsCount() + 1})`);+ }}+ />+ </ControlRow>++ <ControlRow label="Preview">+ <InterpolationPreview easing={`steps(${stepsCount()})`} />+ </ControlRow>+ </div>+ </Show>++ {/* Ease tab content */}+ <Show when={activeTab() === "ease"}>+ <BezierCurve+ points={bezierPoints()}+ setPoints={setBezierPoints}+ />++ <div class="flex flex-col gap-2 pt-1">+ <ControlRow label="Ease">+ <Select<EasePreset>+ value={currentPreset()}+ onChange={handlePresetChange}+ options={EASE_PRESETS}+ optionValue="value"+ optionTextValue="label"+ placeholder="Custom"+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {itemProps.item.rawValue.label}+ </SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue<EasePreset> class="text-xs">+ {(state) => state.selectedOption()?.label ?? "Custom"}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>++ <ControlRow label="Bezier">+ <ControlledTextField+ value={formatBezier(bezierPoints())}+ autoSelect+ onChange={(e: Event) =>+ handleBezierInput(+ (e.currentTarget as HTMLInputElement).value,+ )+ }+ limitEvents+ />+ </ControlRow>++ <ControlRow label="Preview">+ <InterpolationPreview easing={currentEasing()} />+ </ControlRow>+ </div>+ </Show>++ {/* Spring tab content */}+ <Show when={activeTab() === "spring"}>+ <SpringCurve+ bounce={springParams().bounce}+ duration={springParams().duration}+ onBounceChange={setSpringBounce}+ onDurationChange={setSpringDuration}+ />++ <div class="flex flex-col gap-2 pt-1">+ <ControlRow label="Spring">+ <Select<SpringPreset>+ value={currentSpringPreset()}+ onChange={handleSpringPresetChange}+ options={SPRING_PRESETS}+ optionValue="label"+ optionTextValue="label"+ placeholder="Custom"+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {itemProps.item.rawValue.label}+ </SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue<SpringPreset> class="text-xs">+ {(state) => state.selectedOption()?.label ?? "Custom"}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>++ <ControlRow label="Bounce">+ <ControlledTextField+ value={String(springParams().bounce)}+ autoSelect+ sliderEnabled+ step={0.01}+ min={0}+ max={1}+ onNumber={setSpringBounce}+ limitEvents+ />+ </ControlRow>++ <ControlRow label="Duration">+ <ControlledTextField+ value={String(springParams().duration)}+ autoSelect+ sliderEnabled+ step={10}+ min={10}+ max={2000}+ onNumber={setSpringDuration}+ limitEvents+ />+ </ControlRow>++ <ControlRow label="Preview">+ <InterpolationPreview easing={currentEasing()} />+ </ControlRow>+ </div>+ </Show>+ </PanelSection>+ );+}++/* ---------- Bezier curve visualisation ---------- */++const BEZIER_SIZE = 236;+const BEZIER_PAD_X = 12;+const BEZIER_PAD_Y = 20;+const BEZIER_W = BEZIER_SIZE - BEZIER_PAD_X * 2;+const BEZIER_H = BEZIER_SIZE - BEZIER_PAD_Y * 2;+const HANDLE_RADIUS = 4;+const HANDLE_RADIUS_HOVER = 5.5;++function toSvg(nx: number, ny: number) {+ return {+ x: BEZIER_PAD_X + nx * BEZIER_W,+ y: BEZIER_SIZE - BEZIER_PAD_Y - ny * BEZIER_H,+ };+}++function fromSvg(sx: number, sy: number) {+ return {+ x: (sx - BEZIER_PAD_X) / BEZIER_W,+ y: (BEZIER_SIZE - BEZIER_PAD_Y - sy) / BEZIER_H,+ };+}++function clampX(v: number) {+ return Math.max(0, Math.min(1, v));+}++function round3(v: number) {+ return Math.round(v * 1000) / 1000;+}++type DragHandle = "p1" | "p2" | null;++type BezierCurveProps = {+ points: [number, number, number, number];+ setPoints: (points: [number, number, number, number]) => void;+};++function BezierCurve(props: BezierCurveProps) {+ let svgRef!: SVGSVGElement;+ const [dragging, setDragging] = createSignal<DragHandle>(null);+ const [hovered, setHovered] = createSignal<DragHandle>(null);++ const p0 = () => toSvg(0, 0);+ const p1 = () => toSvg(props.points[0], props.points[1]);+ const p2 = () => toSvg(props.points[2], props.points[3]);+ const p3 = () => toSvg(1, 1);++ function eventToNorm(e: PointerEvent) {+ const rect = svgRef.getBoundingClientRect();+ const sx = ((e.clientX - rect.left) / rect.width) * BEZIER_SIZE;+ const sy = ((e.clientY - rect.top) / rect.height) * BEZIER_SIZE;+ return fromSvg(sx, sy);+ }++ function handlePointerDown(handle: DragHandle, e: PointerEvent) {+ e.preventDefault();+ (e.currentTarget as Element).setPointerCapture(e.pointerId);+ setDragging(handle);+ }++ function handlePointerMove(e: PointerEvent) {+ const handle = dragging();+ if (!handle) return;++ const norm = eventToNorm(e);+ const cx = round3(clampX(norm.x));+ const cy = round3(norm.y);++ const next = [...props.points] as [number, number, number, number];+ if (handle === "p1") {+ next[0] = cx;+ next[1] = cy;+ } else {+ next[2] = cx;+ next[3] = cy;+ }+ props.setPoints(next);+ }++ function handlePointerUp(e: PointerEvent) {+ if (!dragging()) return;+ (e.currentTarget as Element).releasePointerCapture(e.pointerId);+ setDragging(null);+ }++ return (+ <div class="w-full aspect-square bg-input rounded-md relative overflow-hidden">+ <svg+ ref={svgRef}+ viewBox={`0 0 ${BEZIER_SIZE} ${BEZIER_SIZE}`}+ class="w-full h-full"+ fill="none"+ >+ {/* Guide lines */}+ <line+ x1={0}+ y1={BEZIER_PAD_Y}+ x2={BEZIER_SIZE}+ y2={BEZIER_PAD_Y}+ stroke="currentColor"+ class="text-muted"+ stroke-opacity="0.4"+ />+ <line+ x1={0}+ y1={BEZIER_SIZE - BEZIER_PAD_Y}+ x2={BEZIER_SIZE}+ y2={BEZIER_SIZE - BEZIER_PAD_Y}+ stroke="currentColor"+ class="text-muted"+ stroke-opacity="0.4"+ />++ {/* Handle lines */}+ <line+ x1={p0().x}+ y1={p0().y}+ x2={p1().x}+ y2={p1().y}+ stroke="var(--color-primary)"+ stroke-width="1"+ />+ <line+ x1={p3().x}+ y1={p3().y}+ x2={p2().x}+ y2={p2().y}+ stroke="var(--color-primary)"+ stroke-width="1"+ />++ {/* Bezier curve */}+ <path+ d={`M ${p0().x} ${p0().y} C ${p1().x} ${p1().y}, ${p2().x} ${p2().y}, ${p3().x} ${p3().y}`}+ stroke="var(--color-primary)"+ stroke-width="2"+ />++ {/* Endpoint diamonds */}+ <rect+ x={p0().x - 4}+ y={p0().y - 4}+ width="8"+ height="8"+ rx="2"+ fill="var(--color-primary)"+ transform={`rotate(45 ${p0().x} ${p0().y})`}+ />+ <rect+ x={p3().x - 4}+ y={p3().y - 4}+ width="8"+ height="8"+ rx="2"+ fill="var(--color-primary)"+ transform={`rotate(45 ${p3().x} ${p3().y})`}+ />++ {/* Handle knob P1 (bottom-left control point) */}+ <circle+ cx={p1().x}+ cy={p1().y}+ r={hovered() === "p1" || dragging() === "p1" ? HANDLE_RADIUS_HOVER : HANDLE_RADIUS}+ fill="var(--color-primary)"+ classList={{ "cursor-grabbing": dragging() === "p1" }}+ onPointerEnter={() => setHovered("p1")}+ onPointerLeave={() => setHovered(null)}+ onPointerDown={[handlePointerDown, "p1"]}+ onPointerMove={handlePointerMove}+ onPointerUp={handlePointerUp}+ onPointerCancel={handlePointerUp}+ />++ {/* Handle knob P2 (top-right control point) */}+ <circle+ cx={p2().x}+ cy={p2().y}+ r={hovered() === "p2" || dragging() === "p2" ? HANDLE_RADIUS_HOVER : HANDLE_RADIUS}+ fill="var(--color-primary)"+ classList={{ "cursor-grabbing": dragging() === "p2" }}+ onPointerEnter={() => setHovered("p2")}+ onPointerLeave={() => setHovered(null)}+ onPointerDown={[handlePointerDown, "p2"]}+ onPointerMove={handlePointerMove}+ onPointerUp={handlePointerUp}+ onPointerCancel={handlePointerUp}+ />+ </svg>+ </div>+ );+}++/* ---------- Interpolation preview ---------- */++const PREVIEW_DURATION = 1000;+const KNOB_SIZE = 8;++function InterpolationPreview(props: { easing: string }) {+ let trackRef!: HTMLDivElement;+ const [progress, setProgress] = createSignal(0);+ const [trackWidth, setTrackWidth] = createSignal(160);++ let easingFn: (t: number) => number = (t) => t;+ createEffect(() => {+ const e = props.easing;+ if (e.startsWith("steps(")) {+ const n = parseSteps(e);+ easingFn = (t) => Math.ceil(t * n) / n;+ } else if (e.startsWith("spring(")) {+ const { bounce, duration } = parseSpring(e);+ const s = spring({ bounce, duration });+ easingFn = (t: number) => s.ease(t);+ } else {+ const [x1, y1, x2, y2] = parseBezier(e);+ easingFn = cubicBezier(x1, y1, x2, y2);+ }+ });++ createEffect(() => {+ if (trackRef) setTrackWidth(trackRef.clientWidth);+ const ro = new ResizeObserver(() => {+ if (trackRef) setTrackWidth(trackRef.clientWidth);+ });+ ro.observe(trackRef);+ onCleanup(() => ro.disconnect());+ });++ let raf: number | undefined;+ let startTime: number | undefined;++ function tick(now: number) {+ if (startTime === undefined) startTime = now;+ const elapsed = now - startTime;+ const cycle = PREVIEW_DURATION * 2;+ const t = elapsed % cycle;++ if (t < PREVIEW_DURATION) {+ setProgress(easingFn(t / PREVIEW_DURATION));+ } else {+ setProgress(easingFn(1 - (t - PREVIEW_DURATION) / PREVIEW_DURATION));+ }++ raf = requestAnimationFrame(tick);+ }++ raf = requestAnimationFrame(tick);++ onCleanup(() => {+ if (raf !== undefined) cancelAnimationFrame(raf);+ });++ const PAD = 8;++ return (+ <div class="bg-input h-7 rounded-md relative overflow-hidden" ref={(el) => (trackRef = el)}>+ <div+ class="absolute top-1/2 -translate-y-1/2 rounded-full bg-muted-foreground"+ style={{+ width: `${KNOB_SIZE}px`,+ height: `${KNOB_SIZE}px`,+ left: `${PAD + progress() * (trackWidth() - 2 * PAD - KNOB_SIZE)}px`,+ }}+ />+ </div>+ );+}++/* ---------- Spring curve visualisation ---------- */++const SPRING_W = BEZIER_SIZE;+const SPRING_H = BEZIER_SIZE;+const SPRING_PAD = 20;+const SPRING_INNER_W = SPRING_W - SPRING_PAD * 2;+const SPRING_INNER_H = SPRING_H - SPRING_PAD * 2;++const DURATION_MIN = 10;+const DURATION_MAX = 2000;+const BOUNCE_MIN = 0;+const BOUNCE_MAX = 1;++const PILL_THICK = 7;+const PILL_LONG = 16;++type SpringCurveProps = {+ bounce: number;+ duration: number;+ onBounceChange: (bounce: number) => void;+ onDurationChange: (duration: number) => void;+};++function SpringCurve(props: SpringCurveProps) {+ let svgRef!: SVGSVGElement;+ const [dragging, setDragging] = createSignal<"duration" | "bounce" | null>(null);++ // Sample the curve via animejs spring+ const curveData = createMemo(() => {+ const s = spring({ bounce: props.bounce, duration: props.duration });+ // More oscillations at high bounce — scale samples to avoid aliasing+ const numSamples = Math.round(64 + props.bounce * 192);+ const samples: { t: number; v: number }[] = [];+ let yMin = Infinity;+ let yMax = -Infinity;++ for (let i = 0; i <= numSamples; i++) {+ const t = i / numSamples;+ const v = s.ease(t);+ samples.push({ t, v });+ yMin = Math.min(yMin, v);+ yMax = Math.max(yMax, v);+ }++ const above = yMax - 1;+ const below = 1 - yMin;+ const span = Math.max(above, below, 0.05) * 1.05;+ return { samples, yLo: 1 - span, yHi: 1 + span };+ });++ const toX = (t: number) => SPRING_PAD + t * (SPRING_W - SPRING_PAD);+ const toY = (v: number) => {+ const { yLo, yHi } = curveData();+ return SPRING_PAD + ((yHi - v) / (yHi - yLo)) * SPRING_INNER_H;+ };++ const buildPath = createMemo(() => {+ const { samples } = curveData();+ if (samples.length < 2) return "";++ const pts = samples.map((s) => ({ x: toX(s.t), y: toY(s.v) }));+ const n = pts.length;++ // Catmull-Rom → cubic bezier conversion (alpha = 0, uniform parameterisation)+ let d = `M ${pts[0].x.toFixed(1)} ${pts[0].y.toFixed(1)}`;+ for (let i = 0; i < n - 1; i++) {+ const p0 = pts[Math.max(i - 1, 0)];+ const p1 = pts[i];+ const p2 = pts[i + 1];+ const p3 = pts[Math.min(i + 2, n - 1)];++ const cp1x = p1.x + (p2.x - p0.x) / 6;+ const cp1y = p1.y + (p2.y - p0.y) / 6;+ const cp2x = p2.x - (p3.x - p1.x) / 6;+ const cp2y = p2.y - (p3.y - p1.y) / 6;++ d += ` C ${cp1x.toFixed(1)} ${cp1y.toFixed(1)}, ${cp2x.toFixed(1)} ${cp2y.toFixed(1)}, ${p2.x.toFixed(1)} ${p2.y.toFixed(1)}`;+ }+ return d;+ });++ // Duration pill: linear map [DURATION_MIN..DURATION_MAX] → x+ const durationX = createMemo(() => {+ const norm = (props.duration - DURATION_MIN) / (DURATION_MAX - DURATION_MIN);+ return SPRING_PAD + norm * SPRING_INNER_W;+ });++ // Bounce pill: linear map [BOUNCE_MAX..BOUNCE_MIN] → y (inverted: top = max bounce)+ const bounceY = createMemo(() => {+ const norm = (props.bounce - BOUNCE_MIN) / (BOUNCE_MAX - BOUNCE_MIN);+ return SPRING_PAD + (1 - norm) * SPRING_INNER_H;+ });++ function eventToSvg(e: PointerEvent) {+ const rect = svgRef.getBoundingClientRect();+ return {+ x: ((e.clientX - rect.left) / rect.width) * SPRING_W,+ y: ((e.clientY - rect.top) / rect.height) * SPRING_H,+ };+ }++ function handlePointerDown(knob: "duration" | "bounce", e: PointerEvent) {+ e.preventDefault();+ (e.currentTarget as Element).setPointerCapture(e.pointerId);+ setDragging(knob);+ }++ function handlePointerMove(e: PointerEvent) {+ const d = dragging();+ if (!d) return;+ const svg = eventToSvg(e);++ if (d === "duration") {+ const norm = Math.max(0, Math.min(1, (svg.x - SPRING_PAD) / SPRING_INNER_W));+ props.onDurationChange(Math.round(DURATION_MIN + norm * (DURATION_MAX - DURATION_MIN)));+ } else {+ const norm = 1 - Math.max(0, Math.min(1, (svg.y - SPRING_PAD) / SPRING_INNER_H));+ props.onBounceChange(Math.round(norm * 100) / 100);+ }+ }++ function handlePointerUp(e: PointerEvent) {+ if (!dragging()) return;+ (e.currentTarget as Element).releasePointerCapture(e.pointerId);+ setDragging(null);+ }++ return (+ <div+ class="w-full aspect-square bg-input rounded-md relative overflow-hidden"+ >+ <svg+ ref={svgRef}+ viewBox={`0 0 ${SPRING_W} ${SPRING_H}`}+ class="w-full h-full"+ fill="none"+ preserveAspectRatio="none"+ >+ {/* 4 inset corner diamonds defining the mapping range */}+ {[+ [SPRING_PAD, SPRING_PAD],+ [SPRING_PAD + SPRING_INNER_W, SPRING_PAD],+ [SPRING_PAD, SPRING_PAD + SPRING_INNER_H],+ [SPRING_PAD + SPRING_INNER_W, SPRING_PAD + SPRING_INNER_H],+ ].map(([cx, cy]) => (+ <circle+ cx={cx}+ cy={cy}+ r="2"+ fill="var(--muted-foreground)"+ />+ ))}++ {/* Duration handle guide line (vertical, full height) */}+ <line+ x1={durationX()}+ y1={0}+ x2={durationX()}+ y2={SPRING_H}+ stroke="currentColor"+ class="text-muted"+ stroke-opacity="0.4"+ />++ {/* Bounce handle guide line (horizontal, full width) */}+ <line+ x1={0}+ y1={bounceY()}+ x2={SPRING_W}+ y2={bounceY()}+ stroke="currentColor"+ class="text-muted"+ stroke-opacity="0.4"+ />++ {/* Spring response curve */}+ <path+ d={buildPath()}+ stroke="var(--color-primary)"+ stroke-width="2"+ fill="none"+ />++ {/* Duration pill (horizontal drag) — vertical bar */}+ <rect+ x={durationX() - PILL_THICK / 2}+ y={SPRING_H / 2 - PILL_LONG / 2}+ width={PILL_THICK}+ height={PILL_LONG}+ rx={PILL_THICK / 2}+ fill="white"+ stroke="var(--color-input)"+ stroke-width="2"+ class={dragging() === "duration" ? "cursor-grabbing" : "cursor-ew-resize"}+ onPointerDown={[handlePointerDown, "duration"]}+ onPointerMove={handlePointerMove}+ onPointerUp={handlePointerUp}+ onPointerCancel={handlePointerUp}+ />++ {/* Bounce pill (vertical drag) — horizontal bar */}+ <rect+ x={SPRING_W / 2 - PILL_LONG / 2}+ y={bounceY() - PILL_THICK / 2}+ width={PILL_LONG}+ height={PILL_THICK}+ rx={PILL_THICK / 2}+ fill="white"+ stroke="var(--color-input)"+ stroke-width="2"+ class={dragging() === "bounce" ? "cursor-grabbing" : "cursor-ns-resize"}+ onPointerDown={[handlePointerDown, "bounce"]}+ onPointerMove={handlePointerMove}+ onPointerUp={handlePointerUp}+ onPointerCancel={handlePointerUp}+ />+ </svg>+ </div>+ );+}++/* ---------- Step curve visualisation ---------- */++const STEP_KNOB_W = 16;+const STEP_KNOB_H = 8;+const STEP_MAX = 20;++type StepCurveProps = {+ steps: number;+ onStepsChange: (steps: number) => void;+};++function StepCurve(props: StepCurveProps) {+ let svgRef!: SVGSVGElement;+ const [dragging, setDragging] = createSignal(false);++ const buildPath = () => {+ const n = props.steps;+ const parts: string[] = [];++ const x0 = BEZIER_PAD_X;+ const y0 = BEZIER_SIZE - BEZIER_PAD_Y;+ parts.push(`M ${x0} ${y0}`);++ for (let i = 0; i < n; i++) {+ const xEnd = BEZIER_PAD_X + ((i + 1) / n) * BEZIER_W;+ const yHold = BEZIER_SIZE - BEZIER_PAD_Y - (i / n) * BEZIER_H;+ const yNext = BEZIER_SIZE - BEZIER_PAD_Y - ((i + 1) / n) * BEZIER_H;++ parts.push(`L ${xEnd} ${yHold}`);+ parts.push(`L ${xEnd} ${yNext}`);+ }++ return parts.join(" ");+ };++ // Linear slider: steps=1 at bottom, steps=STEP_MAX at top+ const stepsToY = (steps: number) =>+ BEZIER_SIZE - BEZIER_PAD_Y - ((steps - 1) / (STEP_MAX - 1)) * BEZIER_H;++ const knobX = () => BEZIER_SIZE / 2;+ const knobY = () => stepsToY(props.steps);+ const guideLine = () => knobY();++ function eventToSteps(e: PointerEvent) {+ const rect = svgRef.getBoundingClientRect();+ const sy = ((e.clientY - rect.top) / rect.height) * BEZIER_SIZE;+ const t = (BEZIER_SIZE - BEZIER_PAD_Y - sy) / BEZIER_H;+ return Math.max(1, Math.min(STEP_MAX, Math.round(t * (STEP_MAX - 1) + 1)));+ }++ function handlePointerDown(e: PointerEvent) {+ e.preventDefault();+ (e.currentTarget as Element).setPointerCapture(e.pointerId);+ setDragging(true);+ }++ function handlePointerMove(e: PointerEvent) {+ if (!dragging()) return;+ const newSteps = eventToSteps(e);+ if (newSteps !== props.steps) {+ props.onStepsChange(newSteps);+ }+ }++ function handlePointerUp(e: PointerEvent) {+ if (!dragging()) return;+ (e.currentTarget as Element).releasePointerCapture(e.pointerId);+ setDragging(false);+ }++ return (+ <div class="w-full aspect-square bg-input rounded-md relative overflow-hidden">+ <svg+ ref={svgRef}+ viewBox={`0 0 ${BEZIER_SIZE} ${BEZIER_SIZE}`}+ class="w-full h-full"+ fill="none"+ >+ {/* Guide lines */}+ <line+ x1={0}+ y1={BEZIER_PAD_Y}+ x2={BEZIER_SIZE}+ y2={BEZIER_PAD_Y}+ stroke="currentColor"+ class="text-muted"+ stroke-opacity="0.4"+ />+ <line+ x1={0}+ y1={BEZIER_SIZE - BEZIER_PAD_Y}+ x2={BEZIER_SIZE}+ y2={BEZIER_SIZE - BEZIER_PAD_Y}+ stroke="currentColor"+ class="text-muted"+ stroke-opacity="0.4"+ />+ {/* Dynamic guide line at step level */}+ <line+ x1={BEZIER_PAD_X}+ y1={guideLine()}+ x2={BEZIER_SIZE - BEZIER_PAD_X}+ y2={guideLine()}+ stroke="currentColor"+ class="text-border"+ stroke-opacity="0.4"+ />++ {/* Step curve */}+ <path+ d={buildPath()}+ stroke="var(--color-primary)"+ stroke-width="2"+ />++ {/* Endpoint diamonds */}+ <rect+ x={BEZIER_PAD_X - 4}+ y={BEZIER_SIZE - BEZIER_PAD_Y - 4}+ width="8"+ height="8"+ rx="2"+ fill="var(--color-primary)"+ transform={`rotate(45 ${BEZIER_PAD_X} ${BEZIER_SIZE - BEZIER_PAD_Y})`}+ />+ <rect+ x={BEZIER_PAD_X + BEZIER_W - 4}+ y={BEZIER_PAD_Y - 4}+ width="8"+ height="8"+ rx="2"+ fill="var(--color-primary)"+ transform={`rotate(45 ${BEZIER_PAD_X + BEZIER_W} ${BEZIER_PAD_Y})`}+ />++ {/* Draggable knob — pill shape */}+ <rect+ x={knobX() - STEP_KNOB_W / 2}+ y={knobY() - STEP_KNOB_H / 2}+ width={STEP_KNOB_W}+ height={STEP_KNOB_H}+ rx={STEP_KNOB_H / 2}+ fill="white"+ stroke="var(--color-input)"+ stroke-width="2"+ class={dragging() ? "cursor-grabbing" : "cursor-grab"}+ onPointerDown={handlePointerDown}+ onPointerMove={handlePointerMove}+ onPointerUp={handlePointerUp}+ onPointerCancel={handlePointerUp}+ />+ </svg>+ </div>+ );+}+diff --git a/apps/web/src/components/sidebar-right/inspector/layout.tsx b/apps/web/src/components/sidebar-right/inspector/layout.tsxnew file mode 100644index 00000000..1f07741c--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/layout.tsx@@ -0,0 +1,265 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { ControlRow } from "@/components/ui/control-group";+import { ControlledTextField } from "@/components/ui/text-field";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { Keyframe } from "@/components/ui/keyframe";+import { useEntityState, useEntityTag, isScene, addComponent, removeComponent, setComponent, resizeEntity } from "@/components/engine";+import {+ Checkbox,+ CheckboxControl,+ CheckboxInput,+ CheckboxLabel,+} from "@/components/ui/checkbox";+import { useEngine } from "@/context/engine";+import { createMemo, For, Show } from "solid-js";+import {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuGroupLabel,+ DropdownMenuItem,+ DropdownMenuItemDetail,+ DropdownMenuSeparator,+ DropdownMenuPortal,+} from "@/components/ui/dropdown-menu";++import { PRESET_CATEGORIES } from "@/lib/layout-presets";+++type LayoutPanelProps = {+ selection: Set<number>;+};++const DEFAULT_WIDTH = 1920;+const DEFAULT_HEIGHT = 1080;++export function LayoutPanel(props: LayoutPanelProps) {+ const { world } = useEngine();+ const c = world.components;++ const eid = () => props.selection.values().next().value!;+ const sceneSelected = createMemo(() => isScene(world, eid()));+ const width = useEntityState(c.Computed.width, eid, 0);+ const height = useEntityState(c.Computed.height, eid, 0);++ const keepAspectRatio = useEntityTag(c.KeepAspectRatio, eid);+ const clipsContent = useEntityTag(c.ClipsContent, eid);++ const toggleClipsContent = (checked: boolean) => {+ if (checked) {+ addComponent(world, eid(), c.ClipsContent);+ } else {+ removeComponent(world, eid(), c.ClipsContent);+ }+ };++ const orientation = createMemo<"square" | "horizontal" | "vertical">(() => {+ const currentWidth = width() ?? DEFAULT_WIDTH;+ const currentHeight = height() ?? DEFAULT_HEIGHT;++ if (currentWidth === currentHeight) return "square";+ return currentWidth > currentHeight ? "horizontal" : "vertical";+ });++ const handleWidthChange = (width: number) => {+ resizeEntity(world, eid(), { width });+ };++ const handleHeightChange = (height: number) => {+ resizeEntity(world, eid(), { height });+ };++ const toggleAspectRatio = () => {+ if (keepAspectRatio()) {+ removeComponent(world, eid(), c.KeepAspectRatio);+ return;+ }++ // Lock: snapshot current absolute dimensions+ const width = c.Computed.width[eid()];+ const height = c.Computed.height[eid()];++ if (width > 0 && height > 0) {+ setComponent(world, eid(), c.KeepAspectRatio, { width, height });+ }+ };++ const aspectIcon = () => {+ if (orientation() === "square") {+ return "aspect-ratio-1-1";+ }++ if (orientation() === "horizontal") {+ return "aspect-ratio-16-9";+ }++ return "aspect-ratio-9-16";+ };++ const aspectSwitchLabel = () => {+ if (orientation() === "horizontal") {+ return "Switch to vertical";+ }++ if (orientation() === "vertical") {+ return "Switch to horizontal";+ }++ return "Square";+ };++ const toggleAspectOrientation = () => {+ const currentWidth = width() ?? DEFAULT_WIDTH;+ const currentHeight = height() ?? DEFAULT_HEIGHT;++ setComponent(world, eid(), c.KeepAspectRatio, {+ width: currentHeight,+ height: currentWidth,+ });++ // Swap width and height+ resizeEntity(world, eid(), {+ width: currentHeight,+ height: currentWidth+ });+ };++ const handleResizeEntity = (width: number, height: number) => {+ resizeEntity(world, eid(), { width, height });+ }++ return (+ <PanelSection+ title={+ <Show when={sceneSelected()} fallback={<span class="text-xs font-450 text-foreground">Layout</span>}>+ <DropdownMenu placement="left">+ <DropdownMenuTrigger+ as="button"+ type="button"+ class="flex items-center text-xs font-450 text-foreground outline-none"+ >+ <span>Layout</span>+ <span class="relative h-6 w-4 shrink-0 overflow-clip">+ <Icon+ name="chevron-down"+ class="absolute -left-1 top-0 size-6 text-muted-foreground"+ />+ </span>+ </DropdownMenuTrigger>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-60">+ <For each={PRESET_CATEGORIES}>+ {(category, index) => (+ <>+ <Show when={index() > 0}>+ <DropdownMenuSeparator />+ </Show>+ <DropdownMenuGroup>+ <DropdownMenuGroupLabel>{category.label}</DropdownMenuGroupLabel>+ <For each={category.items}>{+ (item) => (+ <DropdownMenuItem {...item} onSelect={() => handleResizeEntity(item.width, item.height)}>+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {item.label}+ </span>+ <DropdownMenuItemDetail>+ {item.width}x{item.height}+ </DropdownMenuItemDetail>+ </DropdownMenuItem>+ )+ }</For>+ </DropdownMenuGroup>+ </>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ </Show>+ }+ actions={+ <div class="flex items-center gap-1">+ <Show when={sceneSelected()}>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={toggleAspectOrientation}+ >+ <Icon name={aspectIcon()} />+ </TooltipTrigger>+ <TooltipContent>+ {aspectSwitchLabel()}+ </TooltipContent>+ </Tooltip>+ </Show>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ title={`${keepAspectRatio() ? "Unlock" : "Lock"} aspect ratio`}+ onClick={toggleAspectRatio}+ >+ <Icon name={keepAspectRatio() ? "lock-closed" : "lock-open"} />+ </TooltipTrigger>+ <TooltipContent>+ {keepAspectRatio() ? "Unlock aspect ratio" : "Lock aspect ratio"}+ </TooltipContent>+ </Tooltip>+ </div>+ }+ >+ <ControlRow label="Size" contentClass="grid grid-cols-2 gap-2">+ <ControlledTextField+ class="group"+ icon={<Icon name="prop-width" />}+ value={width()}+ autoSelect+ step={1}+ onNumber={handleWidthChange}+ limitEvents+ skipEmpty+ sliderEnabled+ keyframe={<Keyframe target={eid()} property="width" />}+ />+ <ControlledTextField+ class="group"+ icon={<Icon name="prop-height" />}+ value={height()}+ autoSelect+ step={1}+ onNumber={handleHeightChange}+ limitEvents+ skipEmpty+ sliderEnabled+ keyframe={<Keyframe target={eid()} property="height" />}+ />+ </ControlRow>++ <Show when={sceneSelected()}>+ <Checkbox+ checked={clipsContent()}+ onChange={toggleClipsContent}+ class="flex items-center"+ >+ <CheckboxInput />+ <CheckboxControl />+ <CheckboxLabel>+ Clip content+ </CheckboxLabel>+ </Checkbox>+ </Show>+ </PanelSection>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/marker.tsx b/apps/web/src/components/sidebar-right/inspector/marker.tsxnew file mode 100644index 00000000..d52d19c5--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/marker.tsx@@ -0,0 +1,100 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { createSignal } from 'solid-js';+import { ControlRow } from '@/components/ui/control-group';+import { Icon } from '@/components/ui/icon';+import { PanelSection } from '@/components/ui/panel-section';+import { ControlledTextField } from '@/components/ui/text-field';+import {+ Select,+ SelectValue,+ SelectTrigger,+ SelectContent,+ SelectItem,+ SelectPortal,+} from '@/components/ui/select';++const MARKER_COLORS = [+ { value: 'yellow', label: 'Yellow', hex: '#F59E0B' },+ { value: 'blue', label: 'Blue', hex: '#3B82F6' },+ { value: 'green', label: 'Green', hex: '#10B981' },+ { value: 'pink', label: 'Pink', hex: '#EC4899' },+ { value: 'purple', label: 'Purple', hex: '#A855F7' },+ { value: 'orange', label: 'Orange', hex: '#F97316' },+ { value: 'cyan', label: 'Cyan', hex: '#06B6D4' },+ { value: 'red', label: 'Red', hex: '#EF4444' },+] as const;++export function MarkerPanel() {+ const [timecode, setTimecode] = createSignal('00:00:07');+ const [color, setColor] = createSignal<string>('pink');++ const selectedColor = () => MARKER_COLORS.find((c) => c.value === color());++ return (+ <PanelSection+ title="Marker"+ actions={+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ >+ <Icon name="plus-add" />+ </TooltipTrigger>+ <TooltipContent>Add marker</TooltipContent>+ </Tooltip>+ }+ >+ <ControlRow label="Marker" contentClass="grid grid-cols-2 gap-2">+ <ControlledTextField+ value={timecode()}+ onChange={(e) => setTimecode(e.currentTarget.value)}+ />+ <Select+ value={color()}+ onChange={(v) => setColor(v ?? 'pink')}+ options={MARKER_COLORS.map((c) => c.value)}+ itemComponent={(itemProps) => {+ const itemColor = () =>+ MARKER_COLORS.find((c) => c.value === itemProps.item.rawValue);+ return (+ <SelectItem item={itemProps.item}>+ <div class="flex items-center gap-2">+ <div+ class="w-1.5 h-1.5 rounded-full shrink-0"+ style={{ "background-color": itemColor()?.hex }}+ />+ <span>{itemColor()?.label}</span>+ </div>+ </SelectItem>+ );+ }}+ >+ <SelectTrigger>+ <SelectValue class="text-xxs">+ {() => (+ <div class="flex items-center gap-2">+ <div+ class="w-1.5 h-1.5 rounded-full shrink-0"+ style={{ "background-color": selectedColor()?.hex }}+ />+ <span>{selectedColor()?.label}</span>+ </div>+ )}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </ControlRow>+ </PanelSection>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/masks.tsx b/apps/web/src/components/sidebar-right/inspector/masks.tsxnew file mode 100644index 00000000..c451e6d8--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/masks.tsx@@ -0,0 +1,105 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { Icon } from '@/components/ui/icon';+import { ItemRow } from "@/components/ui/item-row";+import { PanelSection } from '@/components/ui/panel-section';+import { For } from "solid-js";++import { useEntityState, getNextName, createEntity, deleteEntity, GeometryType, PaintType, type EngineWorld, addComponent, appendChild, setComponent, resizeEntity, clearComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";++type MasksSettingsProps = {+ selection: Set<number>;+};++export function MasksSettings(props: MasksSettingsProps) {+ const { world } = useEngine();++ const eid = () => props.selection.values().next().value!;+ const maskEids = useEntityState(world.components.Cache.masks, eid, []);+ const handleAddMask = () => createMask(world, eid());+ const handleRemoveMask = (maskEid: number) => deleteEntity(world, maskEid);++ return (+ <PanelSection+ title="Masks"+ actions={+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleAddMask}+ >+ <Icon name="plus-add" />+ </TooltipTrigger>+ <TooltipContent>Add mask</TooltipContent>+ </Tooltip>+ }+ >+ <For each={maskEids()}>+ {(maskEid: number) => {+ const name = useEntityState(world.components.Name, maskEid, '');+ return (+ <ItemRow+ label="Mask"+ value={name()}+ icon={<Icon name="mask-small" />}+ class="text-foreground"+ >+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => handleRemoveMask(maskEid)}+ >+ <Icon name="close-remove-small" />+ </TooltipTrigger>+ <TooltipContent>Remove mask</TooltipContent>+ </Tooltip>+ </ItemRow>+ );+ }}+ </For>+ </PanelSection>+ );+}++function createMask(world: EngineWorld, targetEid: number) {+ const c = world.components;++ world.history.transaction('Add mask', () => {+ const width = c.Computed.width[targetEid] ?? 0;+ const height = c.Computed.height[targetEid] ?? 0;++ const parentDelay = c.Computed.delay[targetEid] ?? 0;+ const parentStart = c.Computed.start[targetEid] ?? parentDelay;+ const parentEnd = c.Computed.end[targetEid] ?? parentDelay;++ const maskEid = createEntity(world);+ setComponent(world, maskEid, c.Geometry, GeometryType.RECT);+ setComponent(world, maskEid, c.Name, `${getNextName(world, 'Mask')} [Mask Shape]`);+ setComponent(world, maskEid, c.Position, { x: 20, y: 20 });+ setComponent(world, maskEid, c.Trim, { start: parentStart - parentDelay, end: parentEnd - parentDelay });+ resizeEntity(world, maskEid, { width, height });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0xFFFFFF);+ appendChild(world, fillEid, maskEid);++ addComponent(world, maskEid, c.IsMask);+ appendChild(world, maskEid, targetEid);+ addComponent(world, targetEid, c.Expanded);++ clearComponent(world, c.Selected);+ addComponent(world, maskEid, c.Selected);+ });+}diff --git a/apps/web/src/components/sidebar-right/inspector/scene-template.tsx b/apps/web/src/components/sidebar-right/inspector/scene-template.tsxnew file mode 100644index 00000000..c87e1e2a--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/scene-template.tsx@@ -0,0 +1,103 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createSignal } from "solid-js";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import { useEngine } from "@/context/engine";+import { PaintType, GeometryType, ToolType, createEntity, switchActiveScene, addComponent, appendChild, setComponent, resizeEntity } from "@/components/engine";+import { screenToWorld } from "@/components/engine";+import { getNextName } from "@/components/engine";++import { PRESET_CATEGORIES, type LayoutPresetCategory, type LayoutPreset } from "@/lib/layout-presets";+++export function SceneTemplatePanel() {+ const { world } = useEngine();+ const c = world.components;++ const createScene = (preset: LayoutPreset) => {+ // Place scene near center of viewport+ const centerX = window.innerWidth / 2;+ const centerY = window.innerHeight / 2;+ const worldCenter = screenToWorld(world, centerX, centerY);+ const sceneName = getNextName(world, "Scene");+ const sceneX = Math.round(worldCenter.x - preset.width / 2);+ const sceneY = Math.round(worldCenter.y - preset.height / 2);++ const eid = world.history.transaction('Add scene', () => {+ const sceneEid = createEntity(world);+ setComponent(world, sceneEid, c.Geometry, GeometryType.RECT);+ addComponent(world, sceneEid, c.Scene);+ addComponent(world, sceneEid, c.ClipsContent);+ setComponent(world, sceneEid, c.Playback, {});+ setComponent(world, sceneEid, c.Name, sceneName);+ setComponent(world, sceneEid, c.Position, { x: sceneX, y: sceneY });+ resizeEntity(world, sceneEid, { width: preset.width, height: preset.height });++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0x000000);+ appendChild(world, fillEid, sceneEid);+ return sceneEid;+ });++ switchActiveScene(world, eid);+ world.selection.tool = ToolType.MOVE;+ };++ return (+ <PanelSection title="Scene" class="px-0 pt-0 pb-0 gap-0">+ <For each={PRESET_CATEGORIES}>+ {(category) => <PresetGroup category={category} onSelect={createScene} />}+ </For>+ </PanelSection>+ );+}++type PresetGroupProps = {+ category: LayoutPresetCategory;+ onSelect: (preset: LayoutPreset) => void;+};++function PresetGroup(props: PresetGroupProps) {+ const [open, setOpen] = createSignal(true);++ return (+ <div class="flex flex-col w-full">+ <button+ class="flex items-center text-muted-foreground h-8 w-full px-4 hover:bg-muted/50 transition-transform"+ onClick={() => setOpen(!open())}+ >+ <div classList={{ "-rotate-90": !open() }} class="flex items-center justify-center size-4 overflow-clip">+ <Icon name="chevron-down" class="min-h-6 min-w-6" />+ </div>+ <div class="flex items-center justify-center size-4 overflow-clip ml-0.5">+ <Icon name={props.category.icon} class="min-h-6 min-w-6" />+ </div>+ <span class="text-xs truncate ml-1.5">+ {props.category.label}+ </span>+ </button>+ <Show when={open()}>+ <For each={props.category.items}>+ {(preset) => (+ <button+ class="flex items-center gap-1 h-8 w-full pl-2 pr-4 hover:bg-muted/50"+ onClick={() => props.onSelect(preset)}+ >+ <div class="size-6 shrink-0" />+ <span class="flex-1 text-[11px] text-muted-foreground truncate text-left">+ {preset.label}+ </span>+ <span class="text-[11px] text-muted-foreground/55 shrink-0">+ {preset.width}×{preset.height}+ </span>+ </button>+ )}+ </For>+ </Show>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/shadow-inspector.tsx b/apps/web/src/components/sidebar-right/inspector/shadow-inspector.tsxnew file mode 100644index 00000000..591b400e--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/shadow-inspector.tsx@@ -0,0 +1,187 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal } from 'solid-js';+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { Icon } from "@/components/ui/icon";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorTitle,+ FloatingInspectorSeparator,+} from "@/components/ui/floating-inspector";+import { ControlRow } from "@/components/ui/control-group";+import { ColorOpacityRow } from "@/components/ui/color-opacity-row";+import { ColorOpacityPicker } from "@/components/ui/color-opacity-picker";+import { ControlledTextField } from "@/components/ui/text-field";+import { IncrementDecrementControl } from "@/components/ui/increment-decrement-control";+import { useEntityState, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { Keyframe } from "@/components/ui/keyframe";+++type ShadowInspectorProps = {+ onClose(): void;+ anchorRef: HTMLElement;+ nodeEid: number;+ shadowEid: number;+};++export function ShadowInspector(props: ShadowInspectorProps) {+ let colorRowRef: HTMLDivElement | undefined;++ const { world } = useEngine();+ const c = world.components;++ const [isColorPickerOpen, setIsColorPickerOpen] = createSignal(false);++ const color = useEntityState(c.Computed.color, props.shadowEid, 0x000000);+ const opacity = useEntityState(c.Computed.opacity, props.shadowEid, 0.25);+ const offsetX = useEntityState(c.Computed.offsetX, props.shadowEid, 0);+ const offsetY = useEntityState(c.Computed.offsetY, props.shadowEid, 4);+ const blur = useEntityState(c.Computed.blur, props.shadowEid, 0);++ const updateColor = (color: number) => {+ setComponent(world, props.shadowEid, c.Color, color);+ };+ const updateOpacity = (opacity: number) => {+ setComponent(world, props.shadowEid, c.Appearance, { opacity });+ };+ const updateOffsetX = (x: number) => {+ setComponent(world, props.shadowEid, c.Offset, { x });+ };+ const updateOffsetY = (y: number) => {+ setComponent(world, props.shadowEid, c.Offset, { y });+ };+ const updateBlur = (blur: number) => {+ setComponent(world, props.shadowEid, c.Blur, blur);+ };++ const handleClose = () => {+ setIsColorPickerOpen(false);+ props.onClose();+ };+++ return (+ <>+ <FloatingInspector+ open={true}+ anchorRef={props.anchorRef}+ width={248}+ >+ <FloatingInspectorHeader class="items-center justify-between">+ <FloatingInspectorTitle>+ Drop Shadow+ </FloatingInspectorTitle>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleClose}+ >+ <Icon name="close-remove" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </FloatingInspectorHeader>+ <FloatingInspectorSeparator />+ <FloatingInspectorContent class="flex flex-col gap-2 p-4">+ <ControlRow label="Color" ref={colorRowRef}>+ <ColorOpacityRow+ color={color()}+ onChangeColor={updateColor}+ opacity={opacity()}+ onChangeOpacity={updateOpacity}+ onStartTransaction={() => world.history.startTransaction("Edit shadow opacity")}+ onEndTransaction={() => world.history.commitTransaction()}+ onClick={() => setIsColorPickerOpen(true)}+ />+ </ControlRow>++ <ControlRow label="Position">+ <div class="grid grid-cols-2 gap-2">+ <ControlledTextField+ icon={<Icon name="prop-x-position" class="size-6" />}+ value={offsetX()}+ onNumber={updateOffsetX}+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.shadowEid} property="offset.x" />}+ />+ <ControlledTextField+ icon={<Icon name="prop-y-position" class="size-6" />}+ value={offsetY()}+ onNumber={updateOffsetY}+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.shadowEid} property="offset.y" />}+ />+ </div>+ </ControlRow>++ <ControlRow label="Blur">+ <div class="grid grid-cols-2 gap-2">+ <ControlledTextField+ value={blur()}+ onNumber={updateBlur}+ min={0}+ autoSelect+ limitEvents+ keyframe={<Keyframe target={props.shadowEid} property="blur" />}+ />+ <IncrementDecrementControl+ onDecrement={() => updateBlur(Math.max(0, blur() - 1))}+ onIncrement={() => updateBlur(blur() + 1)}+ decrementLabel="Decrease blur"+ incrementLabel="Increase blur"+ />+ </div>+ </ControlRow>+ </FloatingInspectorContent>+ </FloatingInspector>++ <FloatingInspector+ open={isColorPickerOpen}+ anchorRef={() => colorRowRef}+ offset={26}+ >+ <FloatingInspectorHeader>+ <FloatingInspectorTitle>Color</FloatingInspectorTitle>+ <div class="ml-auto">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => setIsColorPickerOpen(false)}+ >+ <Icon name="close-remove" class="size-6" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </div>+ </FloatingInspectorHeader>+ <FloatingInspectorContent class="p-0">+ <ColorOpacityPicker+ color={color()}+ opacity={opacity()}+ onColorChange={updateColor}+ onOpacityChange={updateOpacity}+ onBeginChange={(label) => world.history.startTransaction(label)}+ onEndChange={() => world.history.commitTransaction()}+ keyframeTarget={props.shadowEid}+ />+ </FloatingInspectorContent>+ </FloatingInspector>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/shadows.tsx b/apps/web/src/components/sidebar-right/inspector/shadows.tsxnew file mode 100644index 00000000..7832409a--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/shadows.tsx@@ -0,0 +1,183 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { For, Show, createSignal } from 'solid-js';+import { Icon } from '@/components/ui/icon';+import { ItemRow } from "@/components/ui/item-row";+import { PanelSection } from '@/components/ui/panel-section';+import { ShadowInspector } from './shadow-inspector';+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuSeparator,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import { getSiblingEntities, useEntityState, useEntityTag, createEntity, deleteEntity, type EngineWorld, addComponent, appendChild, removeComponent, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { colorToHex } from "@/utils/color";+import { hasComponent } from 'bitecs';++const DEFAULT_SHADOW = {+ color: 0x000000,+ opacity: 0.25,+ blur: 4,+ offsetX: 0,+ offsetY: 4,+};++type ShadowRowProps = {+ nodeEid: number;+ shadowEid: number;+ onInspectorChange(shadowEid: number | null): void;+}++function ShadowRow(props: ShadowRowProps) {+ const { world } = useEngine();+ const c = world.components;+ const colorNum = useEntityState(c.Computed.color, props.shadowEid, 0x000000);+ const hidden = useEntityTag(c.Hidden, props.shadowEid);++ const color = () => colorToHex(colorNum()).replace('#', '');+ const toggleHidden = () => {+ if (hasComponent(world, props.shadowEid, c.Hidden)) {+ removeComponent(world, props.shadowEid, c.Hidden);+ } else {+ addComponent(world, props.shadowEid, c.Hidden);+ }+ };++ const handleRemoveShadow = () => {+ deleteEntity(world, props.shadowEid);+ props.onInspectorChange(null);+ };++ const handleOpenInspector = () => props.onInspectorChange(props.shadowEid);++ const reorderShadow = (world: EngineWorld, direction: number) => {+ const shadows = getSiblingEntities(world, props.shadowEid, c.Shadow);+ const index = shadows.indexOf(props.shadowEid);+ const newIndex = index + direction;+ if (newIndex >= 0 && newIndex < shadows.length) {+ shadows.splice(newIndex, 0, shadows.splice(index, 1)[0]);+ for (const [index, eid] of shadows.entries()) {+ setComponent(world, eid, c.ItemIndex, index);+ }+ }+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger>+ <ItemRow+ label="Shadow"+ value={color()}+ icon={<Icon name="color-grade" />}+ onClick={handleOpenInspector}+ disabled={hidden()}+ >+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleRemoveShadow}+ >+ <Icon name="close-remove-small" />+ </TooltipTrigger>+ <TooltipContent>Remove shadow</TooltipContent>+ </Tooltip>+ </ItemRow>+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem onSelect={() => reorderShadow(world, 1)}>+ Move Up+ </ContextMenuItem>+ <ContextMenuItem onSelect={() => reorderShadow(world, -1)}>+ Move Down+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={toggleHidden}>+ {hidden() ? "Unhide" : "Hide"}+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleRemoveShadow}>+ Remove+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ );+}++type ShadowSettingsProps = {+ selection: Set<number>;+};++export function ShadowsSettings(props: ShadowSettingsProps) {+ const { world } = useEngine();+ const c = world.components;++ const [inspectingShadow, setInspectingShadow] = createSignal<number | null>(null);++ let anchorRef: HTMLDivElement | undefined;++ const eid = () => props.selection.values().next().value!;+ const shadows = useEntityState(c.Cache.shadows, eid, []);++ const handleAddShadow = () => {+ world.history.transaction('Add shadow', () => {+ const shadowEid = createEntity(world);+ addComponent(world, shadowEid, c.Shadow);+ setComponent(world, shadowEid, c.Color, DEFAULT_SHADOW.color);+ setComponent(world, shadowEid, c.Appearance, { opacity: DEFAULT_SHADOW.opacity });+ setComponent(world, shadowEid, c.Blur, DEFAULT_SHADOW.blur);+ setComponent(world, shadowEid, c.Offset, { x: DEFAULT_SHADOW.offsetX, y: DEFAULT_SHADOW.offsetY });+ appendChild(world, shadowEid, eid());+ });+ };++ return (+ <>+ <PanelSection+ title="Shadow"+ ref={anchorRef}+ actions={+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleAddShadow}+ >+ <Icon name="plus-add" />+ </TooltipTrigger>+ <TooltipContent>Add shadow</TooltipContent>+ </Tooltip>+ }+ >+ <For each={shadows().toReversed()}>+ {(shadowEid: number) => (+ <ShadowRow+ shadowEid={shadowEid}+ nodeEid={eid()}+ onInspectorChange={setInspectingShadow}+ />+ )}+ </For>+ </PanelSection>+ <Show when={inspectingShadow()}>+ <ShadowInspector+ onClose={() => setInspectingShadow(null)}+ anchorRef={anchorRef!}+ nodeEid={eid()}+ shadowEid={inspectingShadow()!}+ />+ </Show>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/solid-picker.tsx b/apps/web/src/components/sidebar-right/inspector/solid-picker.tsxnew file mode 100644index 00000000..1f491348--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/solid-picker.tsx@@ -0,0 +1,41 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ColorOpacityPicker } from "@/components/ui/color-opacity-picker";+import { useEntityState, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+++export type SolidColorPickerProps = {+ nodeEid: number;+ fillEid: number;+};++export function SolidFillPicker(props: SolidColorPickerProps) {+ const { world } = useEngine();+ const c = world.components;++ const color = useEntityState(c.Computed.color, props.fillEid, 0xE0E0E0);+ const opacity = useEntityState(c.Computed.opacity, props.fillEid, 1);++ const updateColor = (color: number) => {+ setComponent(world, props.fillEid, c.Color, color);+ };++ const updateOpacity = (opacity: number) => {+ setComponent(world, props.fillEid, c.Appearance, { opacity });+ };++ return (+ <ColorOpacityPicker+ color={color()}+ opacity={opacity()}+ onColorChange={updateColor}+ onOpacityChange={updateOpacity}+ onBeginChange={(label) => world.history.startTransaction(label)}+ onEndChange={() => world.history.commitTransaction()}+ keyframeTarget={props.fillEid}+ />+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/strokes.tsx b/apps/web/src/components/sidebar-right/inspector/strokes.tsxnew file mode 100644index 00000000..539fd107--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/strokes.tsx@@ -0,0 +1,162 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, createMemo, createSignal, Show } from "solid-js";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import { ControlledTextField } from "@/components/ui/text-field";+import { SegmentedIconTabs } from "@/components/ui/segmented-icon-tabs";+import { Keyframe } from "@/components/ui/keyframe";+import { useEngine } from "@/context/engine";+import { StrokeJoin, useEntityState, createEntity, deleteEntity, getSiblingEntities, addComponent, appendChild, setComponent } from "@/components/engine";+import { FillRow } from "./fill-row";+import { FillPicker } from "./fill-picker";+++const STROKE_JOIN_SEGMENTS = [+ { value: String(StrokeJoin.MITER), icon: 'line-join-miter', label: "Miter" },+ { value: String(StrokeJoin.BEVEL), icon: 'line-join-bevel', label: "Bevel" },+ { value: String(StrokeJoin.ROUND), icon: 'line-join-round', label: "Round" },+];++type StrokesSettingsProps = {+ selection: Set<number>;+};++export function StrokesSettings(props: StrokesSettingsProps) {+ const { world } = useEngine();+ const c = world.components;+ let anchorRef!: HTMLDivElement;++ const eid = () => props.selection.values().next().value!;++ const strokeEids = useEntityState(c.Cache.strokes, eid, []);+ const lineJoinId = useEntityState(c.StrokeStyle.join, eid, 0);+ const strokeWidth = useEntityState(c.Computed.strokeWidth, eid, 1);+ const strokeMiterLimit = useEntityState(c.StrokeStyle.miterLimit, eid, 3);+ const [selectedStroke, setSelectedStroke] = createSignal<number>();++ const lineJoin = createMemo(() => String(lineJoinId()));++ const handleAppendStroke = () => {+ world.history.transaction('Append stroke', () => {+ const solid = createEntity(world);+ addComponent(world, solid, c.Stroke);+ setComponent(world, solid, c.Color, 0x000000);+ appendChild(world, solid, eid());+ });+ };++ const handleStrokeWidthChange = (value: number) => {+ setComponent(world, eid(), c.StrokeStyle, { width: value });+ };++ const handleLineJoinChange = (value: string) => {+ setComponent(world, eid(), c.StrokeStyle, { join: Number(value) });+ };++ const handleMiterLimitChange = (value: number) => {+ setComponent(world, eid(), c.StrokeStyle, { miterLimit: value });+ };++ const handleClosePicker = () => setSelectedStroke(undefined);+ const handleSelectStroke = (strokeEid: number) => setSelectedStroke(strokeEid);+ const handleRemoveStroke = (strokeEid: number) => deleteEntity(world, strokeEid);++ const handleReorderStroke = (strokeEid: number, direction: number) => {+ const strokes = getSiblingEntities(world, strokeEid, c.Stroke);+ const index = strokes.indexOf(strokeEid);+ const newIndex = index + direction;+ if (newIndex >= 0 && newIndex < strokes.length) {+ strokes.splice(newIndex, 0, strokes.splice(index, 1)[0]);+ for (const [idx, eid] of strokes.entries()) {+ setComponent(world, eid, c.ItemIndex, idx);+ }+ }+ };++ return (+ <>+ <PanelSection+ title="Stroke"+ ref={anchorRef}+ actions={+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleAppendStroke}+ >+ <Icon name="plus-add" />+ </TooltipTrigger>+ <TooltipContent>Add stroke</TooltipContent>+ </Tooltip>+ }+ >+ <For each={strokeEids().toReversed()}>+ {(strokeEid) => (+ <FillRow+ nodeEid={eid()}+ fillEid={strokeEid}+ onSelect={() => handleSelectStroke(strokeEid)}+ onRemove={() => handleRemoveStroke(strokeEid)}+ onMoveUp={() => handleReorderStroke(strokeEid, 1)}+ onMoveDown={() => handleReorderStroke(strokeEid, -1)}+ />+ )}+ </For>++ <Show when={strokeEids().length > 0}>+ <ControlRow label="Weight">+ <ControlledTextField+ value={strokeWidth()}+ onNumber={handleStrokeWidthChange}+ step={1}+ min={0}+ autoSelect+ limitEvents+ keyframe={<Keyframe target={eid()} property="stroke.width" />}+ />+ </ControlRow>++ <ControlRow label="Join">+ <SegmentedIconTabs+ value={lineJoin}+ onChange={handleLineJoinChange}+ items={STROKE_JOIN_SEGMENTS}+ buttonClass="transition-colors"+ iconClass="size-3.5 text-muted-foreground"+ />+ </ControlRow>++ <ControlRow label="Miter">+ <ControlledTextField+ value={strokeMiterLimit()}+ onNumber={handleMiterLimitChange}+ step={1}+ min={1}+ autoSelect+ limitEvents+ />+ </ControlRow>+ </Show>+ </PanelSection>+ <Show when={selectedStroke()}>+ <FillPicker+ nodeEid={eid()}+ fillEid={selectedStroke()!}+ anchorRef={anchorRef}+ open={!!selectedStroke()}+ onClose={handleClosePicker}+ tabs={['solid', 'gradient']}+ />+ </Show>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/styles-modal.tsx b/apps/web/src/components/sidebar-right/inspector/styles-modal.tsxnew file mode 100644index 00000000..046f5f56--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/styles-modal.tsx@@ -0,0 +1,150 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, onMount, type Accessor } from "solid-js";++import { Icon } from "@/components/ui/icon";+import { SearchPlaceholder } from "@/components/ui/search-placeholder";+import { useControlledSelection } from "@/hooks/use-controlled-selection";++export type StyleItem = {+ id: string;+ name: string;+ color: string;+ border?: boolean;+};++const BRAND_STYLES: StyleItem[] = [+ { id: "brand-primary", name: "Brand Primary", color: "#008CFF" },+ { id: "brand-olive", name: "Soft Olive", color: "#999E08" },+ { id: "brand-clay", name: "Clay", color: "#CC5233" },+];++const GRAY_STYLES: StyleItem[] = [+ { id: "gray-black", name: "Black", color: "#171717", border: true },+ { id: "gray-dark", name: "Dark Gray", color: "#262626", border: true },+ { id: "gray", name: "Gray", color: "#666666" },+ { id: "gray-light", name: "Light Gray", color: "#9E9E9E" },+ { id: "white", name: "White", color: "#FFFFFF" },+];++export const DEFAULT_STYLE_ID = BRAND_STYLES[0].id;++function StyleChip(props: { color: string; border?: boolean }) {+ return (+ <div+ class="size-4 rounded-sm"+ classList={{ "border border-border/60": props.border }}+ style={{+ "background-color": props.color,+ }}+ />+ );+}++function StyleRow(props: {+ item: StyleItem;+ selected: boolean;+ onSelect: () => void;+}) {+ return (+ <div class="h-8 flex items-center w-full shrink-0">+ <div+ class="flex items-center h-7 w-full rounded-md gap-1 cursor-pointer"+ classList={{+ "bg-muted": props.selected,+ "bg-background": !props.selected,+ "hover:bg-input/80": !props.selected,+ "pr-1": !props.selected,+ }}+ onPointerDown={() => props.onSelect()}+ >+ <div class="size-7 flex items-center justify-center">+ <StyleChip color={props.item.color} border={props.item.border} />+ </div>+ <span class="flex-1 min-w-0 text-xs text-foreground truncate">+ {props.item.name}+ </span>+ <Show when={props.selected}>+ <div class="size-7 flex items-center justify-center text-foreground">+ <Icon name="confirm-check" />+ </div>+ </Show>+ </div>+ </div>+ );+}++function StyleSection(props: {+ title: string;+ items: StyleItem[];+ selectedId: Accessor<string>;+ onSelect: (item: StyleItem) => void;+}) {+ return (+ <div class="flex flex-col w-full">+ <div class="h-7 flex items-center px-1">+ <span class="text-xs text-muted-foreground font-strong">+ {props.title}+ </span>+ </div>+ <div class="flex flex-col">+ <For each={props.items}>+ {(item) => (+ <StyleRow+ item={item}+ selected={props.selectedId() === item.id}+ onSelect={() => props.onSelect(item)}+ />+ )}+ </For>+ </div>+ </div>+ );+}++export type StylesModalProps = {+ value?: Accessor<string | undefined>;+ onChange?: (style: StyleItem) => void;+};++export function StylesModal(props: StylesModalProps = {}) {+ const [selectedStyleId, selectStyle] = useControlledSelection<StyleItem, string>(+ {+ value: props.value,+ defaultValue: DEFAULT_STYLE_ID,+ getValue: (style) => style.id,+ onChange: props.onChange,+ },+ );++ onMount(() => {+ const id = selectedStyleId();+ const style =+ BRAND_STYLES.find((item) => item.id === id) ??+ GRAY_STYLES.find((item) => item.id === id);+ if (style) props.onChange?.(style);+ });++ return (+ <div class="flex flex-col">+ <SearchPlaceholder text="Search in styles" />++ <div class="flex flex-col gap-2 px-4 pt-2 pb-4">+ <StyleSection+ title="Brand"+ items={BRAND_STYLES}+ selectedId={selectedStyleId}+ onSelect={selectStyle}+ />+ <StyleSection+ title="Grays"+ items={GRAY_STYLES}+ selectedId={selectedStyleId}+ onSelect={selectStyle}+ />+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/text.tsx b/apps/web/src/components/sidebar-right/inspector/text.tsxnew file mode 100644index 00000000..99395dac--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/text.tsx@@ -0,0 +1,507 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createMemo, createResource, createSignal, For, Show, onMount, onCleanup } from 'solid-js';+import { ControlRow } from '@/components/ui/control-group';+import { Icon } from '@/components/ui/icon';+import { PanelSection } from '@/components/ui/panel-section';+import { SegmentedIconTabs } from '@/components/ui/segmented-icon-tabs';+import {+ Select,+ SelectValue,+ SelectTrigger,+ SelectContent,+ SelectItem,+ SelectPortal,+} from '@/components/ui/select';+import { ControlledTextField } from '@/components/ui/text-field';+import { getLocalFonts, getWebFonts, loadWebFont, WebFonts, FONT_WEIGHTS } from '../../engine/font';+import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger } from '../../ui/dropdown-menu';+import { cx } from '@/lib/cva';+import { Button } from '../../ui/button';+import { toast } from 'somoto';+import { usePermissionState } from '@/hooks/use-permission';+import { useEntityState, TextAlign, TextBaseline, useEntityTag, isText, isCaption, ToolType, addComponent, removeComponent, setComponent } from '@/components/engine';+import { useEngine } from '@/context/engine';+import { useECS } from '@/context/ecs';+++type TextPanelProps = {+ selection: Set<number>;+};++const RESIZE_MODE_ITEMS = [+ {+ value: 'auto' as const,+ label: 'Auto width',+ icon: 'grow-auto-width',+ },+ {+ value: 'fixed' as const,+ label: 'Fixed size',+ icon: 'grow-fixed-size',+ },+] as const;++export function TextPanel(props: TextPanelProps) {+ const { world } = useEngine();+ const { selectedTool } = useECS();+ const c = world.components;+ const eid = () => props.selection.values().next().value!;++ const [fontWeight, setFontWeight] = createSignal(c.TextStyle.fontWeight[eid()] ?? '400');+ const [fontFamily, setFontFamily] = createSignal(c.TextStyle.fontFamily[eid()] ?? 'Inter');+ const [availableWeights, setAvailableWeights] = createSignal<string[]>([]);++ const textContent = useEntityState(c.Chars, eid, 'Text');+ const fontSize = useEntityState(c.TextStyle.fontSize, eid, 16);+ const leading = useEntityState(c.TextStyle.leading, eid, 1);+ const textAlign = useEntityState(c.TextStyle.textAlign, eid, TextAlign.LEFT);+ const textBaseline = useEntityState(c.TextStyle.textBaseline, eid, TextBaseline.TOP);+ const letterSpacing = useEntityState(c.TextStyle.letterSpacing, eid, 0);+ const sizeTag = useEntityTag(c.Size, eid);++ const resizeMode = createMemo(() => sizeTag() ? 'fixed' : 'auto');+ const textSelected = createMemo(() => isText(world, eid()) && !isCaption(world, eid()));++ const handleFontFamilyChange = (family: string) => {+ setComponent(world, eid(), c.TextStyle, { fontFamily: family });+ setFontFamily(c.TextStyle.fontFamily[eid()] ?? 'Inter');++ if (family in WebFonts) {+ loadWebFont(world, family as keyof typeof WebFonts);+ }+ };++ const handleFontWeightChange = (weight: string) => {+ setComponent(world, eid(), c.TextStyle, { fontWeight: weight });+ setFontWeight(c.TextStyle.fontWeight[eid()] ?? '400');+ };++ const weightOptions = createMemo(() => {+ const weights = availableWeights();+ if (!weights.length) return ALL_FONT_WEIGHTS;+ return ALL_FONT_WEIGHTS.filter(w => weights.includes(w.value));+ });++ const handleResizeModeChange = (mode: 'auto' | 'fixed') => {+ if (mode === 'fixed') addComponent(world, eid(), c.Size);+ else removeComponent(world, eid(), c.Size);+ };++ return (+ <PanelSection title="Typography">+ <Show when={textSelected()}>+ <ControlRow label="Content" contentClass="flex flex-col">+ <GrowingTextArea+ value={textContent()}+ maxRows={8}+ onInput={(v) => setComponent(world, eid(), c.Chars, v)}+ focused={selectedTool() === ToolType.TEXT_EDIT}+ onFocus={() => (world.selection.tool = ToolType.TEXT_EDIT)}+ onBlur={() => (world.selection.tool = ToolType.MOVE)}+ />+ </ControlRow>+ </Show>++ <ControlRow label="Font">+ <FontDropdown+ eid={eid()}+ family={fontFamily()}+ onFamilyChange={handleFontFamilyChange}+ onWeightsChange={setAvailableWeights}+ />+ </ControlRow>++ <ControlRow label="Sizing" contentClass="flex gap-2 items-center">+ <Select+ class="flex-1 min-w-0"+ value={fontWeight()}+ onChange={v => handleFontWeightChange(v ?? '400')}+ options={weightOptions().map(w => w.value)}+ itemComponent={itemProps => (+ <SelectItem+ item={itemProps.item}+ onPointerEnter={() => (c.TextStyle.fontWeight[eid()] = itemProps.item.rawValue)}+ >+ {weightOptions().find(w => w.value === itemProps.item.rawValue)?.label}+ </SelectItem>+ )}+ >+ <SelectTrigger>+ <SelectValue>+ {weightOptions().find(w => w.value === fontWeight())?.label}+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent onCloseAutoFocus={() => (c.TextStyle.fontWeight[eid()] = fontWeight())} />+ </SelectPortal>+ </Select>++ <ControlledTextField+ class="flex-1"+ value={fontSize()}+ onNumber={(v) => setComponent(world, eid(), c.TextStyle, { fontSize: v })}+ step={1}+ min={1}+ autoSelect+ limitEvents+ />+ </ControlRow>++ <ControlRow+ label="Flow"+ labelClass="opacity-0"+ contentClass="grid grid-cols-2 gap-2"+ >+ <ControlledTextField+ icon={<Icon name="text.line-height" />}+ value={Math.round(leading() * 100)}+ onNumber={(v) => setComponent(world, eid(), c.TextStyle, { leading: v / 100 })}+ unit="%"+ step={1}+ min={0}+ max={1200}+ autoSelect+ sliderEnabled+ limitEvents+ />+ <ControlledTextField+ icon={<Icon name="text.letter-spacing" />}+ value={Math.round(letterSpacing() * 100)}+ onNumber={(v) => setComponent(world, eid(), c.TextStyle, { letterSpacing: v / 100 })}+ unit="%"+ step={1}+ min={-1200}+ max={1200}+ autoSelect+ sliderEnabled+ limitEvents+ />+ </ControlRow>++ <ControlRow label="Grow">+ <SegmentedIconTabs+ value={resizeMode}+ onChange={handleResizeModeChange}+ items={RESIZE_MODE_ITEMS}+ />+ </ControlRow>++ <ControlRow label="Align" contentClass="flex gap-2">+ <SegmentedIconTabs+ class="flex-1"+ value={() => HORIZONTAL_ALIGN_TABS[textAlign() ?? TextAlign.LEFT]?.value ?? 'left'}+ onChange={(v) => setComponent(world, eid(), c.TextStyle, { textAlign: HORIZONTAL_ALIGN_MAP[v as any] })}+ items={HORIZONTAL_ALIGN_TABS}+ />+ <SegmentedIconTabs+ class="flex-1"+ value={() => VERTICAL_ALIGN_TABS[textBaseline() ?? TextBaseline.TOP]?.value ?? 'top'}+ onChange={(v) => setComponent(world, eid(), c.TextStyle, { textBaseline: VERTICAL_ALIGN_MAP[v as any] })}+ items={VERTICAL_ALIGN_TABS}+ />+ </ControlRow>+ </PanelSection>+ );+}++type FontDropdownProps = {+ eid: number;+ family: string;+ onFamilyChange(family: string): void;+ onWeightsChange(weights: string[]): void;+};++function FontDropdown(props: FontDropdownProps) {+ const { world } = useEngine();+ const c = world.components;++ const [webfonts] = createSignal(getWebFonts());+ const [fontQuery, setFontQuery] = createSignal('');+ const fontsPermission = usePermissionState('local-fonts');++ // Preload web fonts for preview+ onMount(() => {+ if (document.visibilityState !== 'visible') return;+ for (const family of Object.keys(WebFonts)) {+ const config = WebFonts[family as keyof typeof WebFonts];+ const face = new FontFace(family, `url(${config.url})`, { weight: '400' });+ face.load().then((f) => document.fonts.add(f)).catch(() => { });+ }+ });++ const [localFonts, { refetch }] = createResource(fontsPermission, async (state) => {+ if (state !== 'granted') return [];+ try {+ return await getLocalFonts();+ } catch {+ toast.error('Failed to access local fonts, please configure the browser to allow access');+ return [];+ }+ });++ // Report available weights whenever the family changes+ const allFonts = createMemo(() => [...webfonts(), ...(localFonts.latest ?? [])]);++ createEffect(() => {+ const match = allFonts().find(f => f.family === props.family);+ const weights = match?.variants.map(v => v.weight).filter((w): w is string => !!w) ?? [];+ props.onWeightsChange([...new Set(weights)]);+ });++ const filteredWebFonts = createMemo(() => {+ const q = fontQuery().trim().toLowerCase();+ if (!q) return webfonts();+ return webfonts().filter((f) => f.family.toLowerCase().includes(q));+ });++ const filteredLocalFonts = createMemo(() => {+ const q = fontQuery().trim().toLowerCase();+ const fonts = localFonts.latest;+ if (!fonts?.length) return [];+ if (!q) return fonts;+ return fonts.filter((f) => f.family.toLowerCase().includes(q));+ });++ const handlePointerEnter = (family: string) => {+ setComponent(world, props.eid, c.TextStyle, { fontFamily: family });+ };++ const handleSelect = (family: string) => {+ props.onFamilyChange(family);+ };++ const handleOpenChange = () => {+ setFontQuery('');++ setComponent(world, props.eid, c.TextStyle, { fontFamily: props.family });+ };++ const handleGrantAccess = async () => {+ if (typeof window.queryLocalFonts !== 'function') {+ toast.error('Local fonts are not supported in this browser');+ return;+ }+ try {+ await window.queryLocalFonts();+ refetch();+ } catch {+ toast.error('Failed to access local fonts, please configure the browser to allow access');+ }+ };++ return (+ <DropdownMenu onOpenChange={handleOpenChange} placement="left" sameWidth gutter={8}>+ <DropdownMenuTrigger+ class={cx(+ "bg-input h-7 hover:bg-input/80 text-foreground data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full items-center gap-0 rounded-md pl-2 pr-0 text-xs whitespace-nowrap transition-colors outline-none disabled:cursor-not-allowed disabled:opacity-50",+ "relative overflow-hidden after:pointer-events-none after:absolute after:inset-0 after:rounded-md after:opacity-0 after:ring-1 after:ring-inset after:ring-ring after:z-20 focus-visible:after:opacity-100 justify-between",+ "*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:flex-1 *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",+ )}+ >+ {props.family}+ <Icon name="chevron-down" class="size-6 text-muted-foreground" />+ </DropdownMenuTrigger>+ <DropdownMenuPortal>+ <DropdownMenuContent class="max-h-[700px] w-58 flex flex-col">+ <div class="relative flex h-7 items-center shrink-0">+ <Icon name="search" class="size-6 text-muted-foreground" />+ <input+ type="text"+ value={fontQuery()}+ onInput={(e) => setFontQuery(e.currentTarget.value)}+ onKeyDown={(e) => {+ if (e.key === 'Escape') return;+ e.stopPropagation();+ }}+ placeholder="Search"+ aria-label="Search fonts"+ autocomplete="off"+ class="min-w-0 flex-1 bg-transparent text-xs text-foreground placeholder:text-muted-foreground outline-none"+ />+ </div>+ <DropdownMenuSeparator />+ <div class="overflow-y-auto flex-1 flex flex-col gap-2">+ <DropdownMenuGroup>+ <DropdownMenuGroupLabel>Web Fonts</DropdownMenuGroupLabel>+ <For each={filteredWebFonts()}>+ {(font) => (+ <LazyFontItem+ family={font.family}+ checked={props.family === font.family}+ onPointerEnter={handlePointerEnter}+ onSelect={handleSelect}+ >+ {font.family}+ </LazyFontItem>+ )}+ </For>+ </DropdownMenuGroup>++ <DropdownMenuSeparator />+ <DropdownMenuGroup>+ <DropdownMenuGroupLabel>System Fonts</DropdownMenuGroupLabel>+ <Show when={!localFonts.latest?.length}>+ <Button+ variant="secondary"+ class="text-foreground gap-0"+ onClick={handleGrantAccess}+ >+ <Icon name="lock-closed-small" class="size-6" />+ <span class="mr-3">Grant Access</span>+ </Button>+ </Show>+ <Show when={filteredLocalFonts().length}>+ <For each={filteredLocalFonts()}>+ {(font) => (+ <LazyFontItem+ family={font.family}+ checked={props.family === font.family}+ onPointerEnter={handlePointerEnter}+ onSelect={handleSelect}+ >+ {font.family}+ </LazyFontItem>+ )}+ </For>+ </Show>+ </DropdownMenuGroup>+ </div>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ );+}++type GrowingTextAreaProps = {+ value: string;+ onInput(value: string): void;+ maxRows?: number;+ focused?: boolean;+ onBlur?(): void;+ onFocus?(): void;+};++function GrowingTextArea(props: GrowingTextAreaProps) {+ let ref!: HTMLTextAreaElement;+ const lineHeight = 18; // matches text-xs leading+ const maxRows = () => props.maxRows ?? 8;++ const resize = () => {+ if (!ref) return;+ ref.style.height = 'auto';+ const max = lineHeight * maxRows() + 8; // 8px for py-1+ ref.style.height = `${Math.min(ref.scrollHeight, max)}px`;+ };++ // Resize when value changes externally (e.g. undo/redo, selection change)+ createEffect(() => {+ props.value;+ resize();+ });++ createEffect(() => {+ if (props.focused) {+ ref.focus();+ ref.select();+ }+ });++ const handleInput = (e: InputEvent & { currentTarget: HTMLTextAreaElement }) => {+ props.onInput(e.currentTarget.value);+ resize();+ };++ const handleKeyDown = (e: KeyboardEvent) => {+ if (e.key === 'Enter' && !e.shiftKey) {+ e.preventDefault();+ ref.blur();+ }+ if (e.key === 'Escape') {+ e.preventDefault();+ ref.blur();+ }+ };++ return (+ <textarea+ ref={ref!}+ value={props.value}+ onInput={handleInput}+ onKeyDown={handleKeyDown}+ onFocus={props.onFocus}+ onBlur={props.onBlur}+ rows={1}+ class="bg-input h-7 rounded-md px-2 py-1 text-xxs text-foreground placeholder:text-muted-foreground outline-none resize-none w-full focus-ring overflow-y-auto"+ style={{ 'line-height': `${lineHeight}px` }}+ />+ );+}++type LazyFontItemProps = {+ family: string;+ checked: boolean;+ onPointerEnter: (family: string) => void;+ onSelect: (family: string) => void;+ children: string;+};++function LazyFontItem(props: LazyFontItemProps) {+ let ref!: HTMLDivElement;+ const [visible, setVisible] = createSignal(false);++ onMount(() => {+ const observer = new IntersectionObserver(+ ([entry]) => {+ if (entry.isIntersecting) {+ setVisible(true);+ observer.disconnect();+ }+ },+ { threshold: 0 },+ );+ observer.observe(ref);+ onCleanup(() => observer.disconnect());+ });++ return (+ <DropdownMenuCheckboxItem+ ref={ref}+ checked={props.checked}+ closeOnSelect+ onSelect={() => props.onSelect(props.family)}+ onPointerEnter={() => props.onPointerEnter(props.family)}+ style={visible() ? { 'font-family': `'${props.family}', Inter` } : undefined}+ >+ <span class="truncate leading-none">{props.children}</span>+ </DropdownMenuCheckboxItem>+ );+}++const ALL_FONT_WEIGHTS = Object.entries(FONT_WEIGHTS).map(([value, label]) => ({ value, label }));++const HORIZONTAL_ALIGN_TABS = [+ { value: 'left', label: 'Align left', icon: 'text.align-left' },+ { value: 'center', label: 'Align center', icon: 'text.align-center' },+ { value: 'right', label: 'Align right', icon: 'text.align-right' },+] as const;++const HORIZONTAL_ALIGN_MAP: Record<string, TextAlign> = {+ left: TextAlign.LEFT,+ center: TextAlign.CENTER,+ right: TextAlign.RIGHT,+};++const VERTICAL_ALIGN_TABS = [+ { value: 'top', label: 'Align top', icon: 'text.align-top' },+ { value: 'middle', label: 'Align middle', icon: 'text.align-middle' },+ { value: 'bottom', label: 'Align bottom', icon: 'text.align-bottom' },+] as const;++const VERTICAL_ALIGN_MAP: Record<string, TextBaseline> = {+ top: TextBaseline.TOP,+ middle: TextBaseline.MIDDLE,+ bottom: TextBaseline.BOTTOM,+};diff --git a/apps/web/src/components/sidebar-right/inspector/time.tsx b/apps/web/src/components/sidebar-right/inspector/time.tsxnew file mode 100644index 00000000..67fac7fc--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/time.tsx@@ -0,0 +1,388 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { createMemo, Show } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import { ControlledTextField } from "@/components/ui/text-field";+import { useEngine } from "@/context/engine";+import {+ useEntityState,+ useEntityTag,+ PaintType,+ computeTrimStart,+ computeTrimEnd,+ setComponent,+ removeComponent,+ isScene,+ isGroup,+ resolveSequentialOverlaps,+ useAssets,+ saveAsset,+} from "@/components/engine";+import { secondsToFrames } from "@/components/engine/utils/time";+import {+ Checkbox,+ CheckboxControl,+ CheckboxInput,+ CheckboxLabel,+} from "@/components/ui/checkbox";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuTrigger,+} from "@/components/ui/context-menu";+import { createStoredSignal } from "@/lib/store";+import { store } from "@/init";+import { hasComponent } from "bitecs";+++type TimeAddon = "inOut" | "playbackRate";+type TimeAddons = Partial<Record<TimeAddon, boolean>>;++function formatAsTimecode(seconds: number) {+ if (!Number.isFinite(seconds)) return "00:00:00";++ const totalSeconds = Math.max(0, Math.floor(seconds));+ const hours = Math.floor(totalSeconds / 3600);+ const minutes = Math.floor((totalSeconds % 3600) / 60);+ const remaining = totalSeconds % 60;++ return `${hours.toString().padStart(2, "0")}:${minutes+ .toString()+ .padStart(2, "0")}:${remaining.toString().padStart(2, "0")}`;+}++function parseTimeInput(value: string) {+ const input = value.trim();+ if (!input) return null;++ if (!input.includes(":")) {+ const seconds = Number.parseFloat(input);+ if (!Number.isFinite(seconds) || seconds < 0) return null;+ return seconds;+ }++ const parts = input.split(":").map((part) => part.trim());+ if (parts.length !== 2 && parts.length !== 3) return null;+ if (parts.some((part) => part.length === 0)) return null;++ const numbers = parts.map((part) => Number.parseFloat(part));+ if (numbers.some((part) => !Number.isFinite(part) || part < 0)) return null;++ if (parts.length === 2) {+ const [minutes, seconds] = numbers;+ return minutes * 60 + seconds;+ }++ const [hours, minutes, seconds] = numbers;+ return hours * 3600 + minutes * 60 + seconds;+}++type TimeSettingsProps = {+ selection: Set<number>;+};++export function TimeSettings(props: TimeSettingsProps) {+ const { world } = useEngine();+ const assets = useAssets(world);+ const c = world.components;+ const eid = () => props.selection.values().next().value!;++ const [addons, setAddons] = createStoredSignal(+ store.define<TimeAddons>("time.addons", {})+ );++ const playbackRate = useEntityState(c.PlaybackRate, eid, 1);+ const trimStart = useEntityState(c.Trim.start, eid, 0);+ const start = useEntityState(c.Computed.start, eid, 0);+ const end = useEntityState(c.Computed.end, eid, 0);+ const fillEids = useEntityState(c.Cache.fills, eid, []);++ const isContainer = createMemo(() => isScene(world, eid()) || isGroup(world, eid()));+ const hasTrim = useEntityTag(c.Trim, eid);++ const playbackRatePercent = createMemo(() => Math.round(playbackRate() * 100));++ const startSeconds = createMemo(() => start() / world.frameRate);+ const endSeconds = createMemo(() => end() / world.frameRate);+ const durationSeconds = createMemo(() => endSeconds() - startSeconds());++ const supportsPlaybackRate = createMemo(() => hasComponent(world, eid(), c.Geometry) && !isScene(world, eid()));++ const sequenceAsset = createMemo(() => {+ for (const fid of fillEids() ?? []) {+ if (c.Paint[fid] !== PaintType.SEQUENCE) continue;+ const id = c.AssetId[fid];+ if (!id) continue;+ const asset = assets.get(id);+ if (asset?.type === 'SEQUENCE') return asset;+ }+ return null;+ });++ const handleAddAddon = (addon: TimeAddon) => setAddons({ ...addons(), [addon]: true });+ const handleRemoveAddon = (addon: TimeAddon) => setAddons({ ...addons(), [addon]: false });++ // Apply a timing edit as one undo step, then trim/remove/split any sibling it+ // now overlaps inside a Sequential container (no-op elsewhere).+ const commitTimeChange = (label: string, mutate: () => void) => {+ world.history.transaction(label, () => {+ mutate();+ resolveSequentialOverlaps(world, [eid()]);+ });+ };++ const assignPlaybackRate = (newRate: number) => {+ const newDelay = Math.round(start() - trimStart() / newRate);++ commitTimeChange("Set speed", () => {+ setComponent(world, eid(), c.PlaybackRate, newRate);+ setComponent(world, eid(), c.Delay, newDelay);+ });+ };++ const handleInChange = (event: Event & { currentTarget: HTMLInputElement }) => {+ const parsed = parseTimeInput(event.currentTarget.value);+ if (parsed === null) return;++ const parsedFrame = secondsToFrames(parsed);+ const start = computeTrimStart(world, eid(), parsedFrame);+ commitTimeChange("Set in point", () => setComponent(world, eid(), c.Trim, { start }));+ };++ const handleOutChange = (event: Event & { currentTarget: HTMLInputElement }) => {+ const parsed = parseTimeInput(event.currentTarget.value);+ if (parsed === null) return;++ const parsedFrame = secondsToFrames(parsed);+ const end = computeTrimEnd(world, eid(), parsedFrame);+ commitTimeChange("Set out point", () => setComponent(world, eid(), c.Trim, { end }));+ };++ const handleLengthChange = (durationSec: number) => {+ const newEnd = start() + secondsToFrames(durationSec);++ const end = computeTrimEnd(world, eid(), newEnd);+ commitTimeChange("Set length", () => setComponent(world, eid(), c.Trim, { end }));+ }++ const toggleTrim = (checked: boolean) => {+ commitTimeChange("Toggle trim", () => {+ if (checked) {+ // Seed the explicit window with the current computed bounds so enabling+ // the trim doesn't visibly resize the container.+ const trimStart = computeTrimStart(world, eid(), start());+ const trimEnd = computeTrimEnd(world, eid(), end());+ setComponent(world, eid(), c.Trim, { start: trimStart, end: trimEnd });+ } else {+ removeComponent(world, eid(), c.Trim);+ }+ });+ };++ const handleFrameRateChange = (newRate: number) => {+ const asset = sequenceAsset();+ if (!asset) return;++ const clamped = Math.max(1, Math.min(240, Math.round(newRate)));+ if (clamped === asset.frameRate) return;++ // The persisted asset stores duration + fps; the frame count is implied.+ // Re-derive it so the new duration covers exactly the same frames.+ const frameCount = Math.max(1, Math.round(asset.duration * asset.frameRate));+ const newDurationInSeconds = frameCount / clamped;++ saveAsset(world, { ...asset, frameRate: clamped, duration: newDurationInSeconds });++ const newDuration = secondsToFrames(newDurationInSeconds);+ if ((c.Trim.end[eid()] ?? 0) > newDuration) {+ commitTimeChange("Set frame rate", () => setComponent(world, eid(), c.Trim, { end: newDuration }));+ }+ };++ return (+ <PanelSection+ title="Time"+ actions={+ <Show when={!addons().inOut || !addons().playbackRate}>+ <DropdownMenu placement="bottom-end">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button size="icon" variant="ghost" class="text-muted-foreground" {...buttonProps}>+ <Icon name="plus-add" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Add option</TooltipContent>+ </Tooltip>+ <DropdownMenuContent>+ <Show when={!addons().inOut}>+ <DropdownMenuItem onSelect={() => handleAddAddon("inOut")}>+ In & Out+ </DropdownMenuItem>+ </Show>+ <Show when={!addons().playbackRate && supportsPlaybackRate()}>+ <DropdownMenuItem onSelect={() => handleAddAddon("playbackRate")}>+ Playback rate+ </DropdownMenuItem>+ </Show>+ </DropdownMenuContent>+ </DropdownMenu>+ </Show>+ }+ >+ <ControlRow+ label="Length"+ contentClass="grid grid-cols-2 gap-2 min-w-0"+ >+ <ControlledTextField+ value={Math.round(durationSeconds() * 10) / 10}+ min={0}+ step={0.1}+ unit="s"+ autoSelect+ limitEvents+ onNumber={handleLengthChange}+ />+ <div class="flex gap-px rounded-md overflow-hidden">+ <button+ type="button"+ title="Decrease length"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 active:bg-muted-foreground/20 text-muted-foreground"+ onClick={() => handleLengthChange(Math.max(0.1, durationSeconds() - 0.1))}+ >+ <Icon name="minus" />+ </button>+ <button+ type="button"+ title="Increase length"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 active:bg-muted-foreground/20 text-muted-foreground"+ onClick={() => handleLengthChange(durationSeconds() + 0.1)}+ >+ <Icon name="plus-add" />+ </button>+ </div>+ </ControlRow>++ <Show when={supportsPlaybackRate() && addons().playbackRate}>+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="Speed"+ contentClass="grid grid-cols-2 gap-2 min-w-0"+ >+ <ControlledTextField+ value={playbackRatePercent()}+ min={1}+ step={5}+ unit="%"+ autoSelect+ limitEvents+ onNumber={(value) => assignPlaybackRate(value / 100)}+ />+ <div class="flex gap-px rounded-md overflow-hidden">+ <button+ type="button"+ title="Decrease speed"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 active:bg-muted-foreground/20 text-muted-foreground"+ onClick={() => assignPlaybackRate(Math.max(1, Math.round(playbackRatePercent() - 10)) / 100)}+ >+ <Icon name="minus" />+ </button>+ <button+ type="button"+ title="Increase speed"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 active:bg-muted-foreground/20 text-muted-foreground"+ onClick={() => assignPlaybackRate(Math.round(playbackRatePercent() + 10) / 100)}+ >+ <Icon name="plus-add" />+ </button>+ </div>+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem onSelect={() => handleRemoveAddon("playbackRate")}>+ Remove row+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ </Show>++++ <Show when={addons().inOut}>+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="In & Out"+ contentClass="grid grid-cols-2 gap-2 min-w-0"+ >+ <ControlledTextField+ value={formatAsTimecode(startSeconds())}+ autoSelect+ onChange={handleInChange}+ />+ <ControlledTextField+ value={formatAsTimecode(endSeconds())}+ autoSelect+ onChange={handleOutChange}+ />+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem onSelect={() => handleRemoveAddon("inOut")}>+ Remove row+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ </Show>++ <Show when={sequenceAsset()}>+ {(asset) => (+ <ControlRow label="Frame Rate">+ <ControlledTextField+ value={Math.round(asset().frameRate)}+ min={1}+ max={240}+ step={1}+ unit="FPS"+ autoSelect+ limitEvents+ onNumber={handleFrameRateChange}+ />+ </ControlRow>+ )}+ </Show>++ <Show when={isContainer()}>+ <Checkbox+ checked={hasTrim()}+ onChange={toggleTrim}+ class="flex items-center"+ >+ <CheckboxInput />+ <CheckboxControl />+ <CheckboxLabel>+ Trim content+ </CheckboxLabel>+ </Checkbox>+ </Show>+ </PanelSection>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/anchor-picker.tsx b/apps/web/src/components/sidebar-right/inspector/transform/anchor-picker.tsxnew file mode 100644index 00000000..a1f694e7--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/anchor-picker.tsx@@ -0,0 +1,74 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal, For, Show } from 'solid-js';+import { Icon } from '@/components/ui/icon';+import { anchorPositions } from './constants';+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';+import { useEngine } from '@/context/engine';+import { useEntityState, setComponent } from '@/components/engine';+++import type { AnchorPosition } from './constants';++export type AnchorPointPickerProps = {+ nodeEid: number;+};++export function AnchorPointPicker(props: AnchorPointPickerProps) {+ const { world } = useEngine();+ const c = world.components;+ const [hoveredIndex, setHoveredIndex] = createSignal<number | null>(null);++ const anchorX = useEntityState(c.Anchor.x, props.nodeEid, 0.5);+ const anchorY = useEntityState(c.Anchor.y, props.nodeEid, 0.5);++ const isActive = (pos: AnchorPosition) => {+ const ax = anchorX();+ const ay = anchorY();+ if (ax === undefined || ay === undefined) return false;++ return Math.abs(ax - pos.x) < 0.01 && Math.abs(ay - pos.y) < 0.01;+ };++ const assignAnchor = (x: number, y: number) => {+ setComponent(world, props.nodeEid, c.Anchor, { x, y });+ };++ return (+ <div class="flex-1 h-16 bg-input rounded-md overflow-hidden grid grid-cols-3 grid-rows-3">+ <For each={anchorPositions}>+ {(pos, index) => {+ const active = () => isActive(pos);+ const hovered = () => hoveredIndex() === index();++ return (+ <Tooltip>+ <TooltipTrigger+ as="button"+ type="button"+ class="w-full h-full relative rounded-md transition-colors flex items-center justify-center"+ onMouseEnter={() => setHoveredIndex(index())}+ onMouseLeave={() => setHoveredIndex(null)}+ onClick={() => assignAnchor(pos.x, pos.y)}+ >+ <Show+ when={active() || hovered()}+ fallback={+ <div class="size-0.5 rounded-full bg-muted-foreground" />+ }+ >+ <div classList={{ "text-primary": active(), "text-muted-foreground": !active() }}>+ <Icon name={pos.icon} />+ </div>+ </Show>+ </TooltipTrigger>+ <TooltipContent>{pos.tooltip}</TooltipContent>+ </Tooltip>+ );+ }}+ </For>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/anchor-row.tsx b/apps/web/src/components/sidebar-right/inspector/transform/anchor-row.tsxnew file mode 100644index 00000000..3c52becd--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/anchor-row.tsx@@ -0,0 +1,84 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { ControlledTextField } from "@/components/ui/text-field";+import {+ ContextMenu,+ ContextMenuTrigger,+ ContextMenuContent,+ ContextMenuItem,+} from "@/components/ui/context-menu";+import { AnchorPointPicker } from "./anchor-picker";+import { useEngine } from "@/context/engine";+import { useEntityState, setComponent } from "@/components/engine";+++export type AnchorRowProps = {+ nodeEid: number;+ onRemoveAddon(): void;+};++export function AnchorRow(props: AnchorRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const anchorX = useEntityState(c.Anchor.x, props.nodeEid, 0.5);+ const anchorY = useEntityState(c.Anchor.y, props.nodeEid, 0.5);++ const isDefault = createMemo(() => (anchorX() === 0.5 && anchorY() === 0.5));++ const assignAnchor = (x: number | undefined, y: number | undefined) => {+ setComponent(world, props.nodeEid, c.Anchor, { x, y });+ };++ const handleResetToDefault = () => assignAnchor(0.5, 0.5);++ return (+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="Anchor"+ class="items-start"+ labelClass="pt-1.5"+ contentClass="flex gap-2 items-center"+ >+ <div class="flex flex-col gap-2 flex-1 min-w-0">+ <ControlledTextField+ icon={<Icon name="prop-x-position" />}+ value={Math.round(anchorX() * 100)}+ onNumber={(value) => assignAnchor(value / 100, undefined)}+ step={1}+ unit="%"+ autoSelect+ sliderEnabled+ />+ <ControlledTextField+ icon={<Icon name="prop-y-position" />}+ value={Math.round(anchorY() * 100)}+ onNumber={(value) => assignAnchor(undefined, value / 100)}+ step={1}+ unit="%"+ autoSelect+ sliderEnabled+ />+ </div>+ <AnchorPointPicker nodeEid={props.nodeEid} />+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem+ disabled={isDefault()}+ onSelect={handleResetToDefault}+ >+ Reset to Default+ </ContextMenuItem>+ <ContextMenuItem onSelect={props.onRemoveAddon}>+ Remove row+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/constants.ts b/apps/web/src/components/sidebar-right/inspector/transform/constants.tsnew file mode 100644index 00000000..2e7f8301--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/constants.ts@@ -0,0 +1,45 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ConstraintType } from "@/components/engine";++export type Constraint = {+ key: ConstraintType;+ label: string;+};++export type AnchorPosition = {+ x: number;+ y: number;+ icon: string;+ tooltip: string;+};++export const anchorPositions: AnchorPosition[] = [+ { x: 0, y: 0, icon: 'anchor-align-top-left', tooltip: 'Align top left' },+ { x: 0.5, y: 0, icon: 'anchor-align-top-center', tooltip: 'Align top center' },+ { x: 1, y: 0, icon: 'anchor-align-top-right', tooltip: 'Align top right' },+ { x: 0, y: 0.5, icon: 'anchor-align-left', tooltip: 'Align left' },+ { x: 0.5, y: 0.5, icon: 'anchor-align-center', tooltip: 'Align center' },+ { x: 1, y: 0.5, icon: 'anchor-align-right', tooltip: 'Align right' },+ { x: 0, y: 1, icon: 'anchor-align-bottom-left', tooltip: 'Align bottom left' },+ { x: 0.5, y: 1, icon: 'anchor-align-bottom-center', tooltip: 'Align bottom center' },+ { x: 1, y: 1, icon: 'anchor-align-bottom-right', tooltip: 'Align bottom right' },+];++export const horizontalConstraints: Constraint[] = [+ { key: ConstraintType.MIN, label: 'Left' },+ { key: ConstraintType.MAX, label: 'Right' },+ { key: ConstraintType.CENTER, label: 'Center' },+ { key: ConstraintType.STRETCH, label: 'Left & right' },+ { key: ConstraintType.SCALE, label: 'Scale' },+];++export const verticalConstraints: Constraint[] = [+ { key: ConstraintType.MIN, label: 'Top' },+ { key: ConstraintType.MAX, label: 'Bottom' },+ { key: ConstraintType.CENTER, label: 'Center' },+ { key: ConstraintType.STRETCH, label: 'Top & bottom' },+ { key: ConstraintType.SCALE, label: 'Scale' },+];diff --git a/apps/web/src/components/sidebar-right/inspector/transform/constraints-row.tsx b/apps/web/src/components/sidebar-right/inspector/transform/constraints-row.tsxnew file mode 100644index 00000000..cc722cf3--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/constraints-row.tsx@@ -0,0 +1,184 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import {+ Select,+ SelectContent,+ SelectIconTrigger,+ SelectItem,+ SelectPortal,+} from "@/components/ui/select";+import { horizontalConstraints, verticalConstraints } from "./constants";+import { useEngine } from "@/context/engine";+import { ConstraintType, useEntityState, setComponent } from "@/components/engine";+++type ConstraintsRowProps = {+ nodeEid: number;+};++export function ConstraintsRow(props: ConstraintsRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const h = useEntityState(c.Constraint.horizontal, props.nodeEid, 0);+ const w = useEntityState(c.Constraint.vertical, props.nodeEid, 0);++ const assignHorizontalConstraint = (value: ConstraintType | null) => {+ if (value == null) return;+ setComponent(world, props.nodeEid, c.Constraint, { horizontal: value });+ };+ const assignVerticalConstraint = (value: ConstraintType | null) => {+ if (value == null) return;+ setComponent(world, props.nodeEid, c.Constraint, { vertical: value });+ };+++ return (+ <ControlRow+ label=""+ labelClass="opacity-0"+ class="items-start"+ contentClass="grid grid-cols-2 gap-2"+ >+ <div class="flex flex-col gap-2 min-w-0">+ <Select<ConstraintType>+ value={h()}+ onChange={(value) => assignHorizontalConstraint(value)}+ options={horizontalConstraints.map((c) => c.key)}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {horizontalConstraints.find((c) => c.key === itemProps.item.rawValue)?.label}+ </SelectItem>+ )}+ >+ <SelectIconTrigger<ConstraintType>+ icon={<Icon name="pin-left-right" />}+ valueClass="text-xs"+ >+ {(state) =>+ horizontalConstraints.find((c) => c.key === state.selectedOption())?.label+ }+ </SelectIconTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>++ <Select<ConstraintType>+ value={w()}+ onChange={(value) => assignVerticalConstraint(value)}+ options={verticalConstraints.map((c) => c.key)}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {verticalConstraints.find((c) => c.key === itemProps.item.rawValue)?.label}+ </SelectItem>+ )}+ >+ <SelectIconTrigger<ConstraintType>+ icon={<Icon name="pin-top-bottom" />}+ valueClass="text-xs"+ >+ {(state) =>+ verticalConstraints.find((c) => c.key === state.selectedOption())?.label+ }+ </SelectIconTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </div>++ <div class="h-16 bg-input rounded-md relative min-w-0">+ <div class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 size-7 bg-muted rounded-sm overflow-hidden flex items-center justify-center">+ <div class="size-6 overflow-hidden flex items-center justify-center text-muted-foreground">+ <Icon name="plus-add" />+ </div>+ </div>++ <div+ class="absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 -ml-[23px] cursor-pointer py-1"+ onClick={() => assignHorizontalConstraint(ConstraintType.MIN)}+ >+ <div+ class="w-2.5 h-0.5 rounded-sm"+ classList={{+ "bg-primary": h() === ConstraintType.MIN || h() === ConstraintType.STRETCH,+ "bg-muted-foreground/40": h() !== ConstraintType.MIN && h() !== ConstraintType.STRETCH+ }}+ />+ </div>++ <div+ class="absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 ml-[23px] cursor-pointer py-1"+ onClick={() => assignHorizontalConstraint(ConstraintType.MAX)}+ >+ <div+ class="w-2.5 h-0.5 rounded-sm"+ classList={{+ "bg-primary": h() === ConstraintType.MAX || h() === ConstraintType.STRETCH,+ "bg-muted-foreground/40": h() !== ConstraintType.MAX && h() !== ConstraintType.STRETCH+ }}+ />+ </div>++ <div+ class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 -mt-[23px] cursor-pointer px-1"+ onClick={() => assignVerticalConstraint(ConstraintType.MIN)}+ >+ <div+ class="w-0.5 h-2.5 rounded-sm"+ classList={{+ "bg-primary": w() === ConstraintType.MIN || w() === ConstraintType.STRETCH,+ "bg-muted-foreground/40": w() !== ConstraintType.MIN && w() !== ConstraintType.STRETCH+ }}+ />+ </div>++ <div+ class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 mt-[23px] cursor-pointer px-1"+ onClick={() => assignVerticalConstraint(ConstraintType.MAX)}+ >+ <div+ class="w-0.5 h-2.5 rounded-sm"+ classList={{+ "bg-primary": w() === ConstraintType.MAX || w() === ConstraintType.STRETCH,+ "bg-muted-foreground/40": w() !== ConstraintType.MAX && w() !== ConstraintType.STRETCH+ }}+ />+ </div>++ <div+ class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 cursor-pointer px-0.5"+ onClick={() => assignHorizontalConstraint(ConstraintType.CENTER)}+ classList={{ "pointer-events-none": h() === ConstraintType.CENTER }}+ >+ <div+ class="w-2.5 h-0.5 rounded-sm"+ classList={{+ "bg-primary": h() === ConstraintType.CENTER,+ "bg-transparent": h() !== ConstraintType.CENTER+ }}+ />+ </div>++ <div+ class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 cursor-pointer py-0.5"+ onClick={() => assignVerticalConstraint(ConstraintType.CENTER)}+ classList={{ "pointer-events-none": w() === ConstraintType.CENTER }}+ >+ <div+ class="w-0.5 h-2.5 rounded-sm"+ classList={{+ "bg-primary": w() === ConstraintType.CENTER,+ "bg-transparent": w() !== ConstraintType.CENTER+ }}+ />+ </div>+ </div>+ </ControlRow>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/index.ts b/apps/web/src/components/sidebar-right/inspector/transform/index.tsnew file mode 100644index 00000000..ad7732c4--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './transform-settings';diff --git a/apps/web/src/components/sidebar-right/inspector/transform/offset-row.tsx b/apps/web/src/components/sidebar-right/inspector/transform/offset-row.tsxnew file mode 100644index 00000000..f2ad14ac--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/offset-row.tsx@@ -0,0 +1,88 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { ControlledTextField } from "@/components/ui/text-field";+import {+ ContextMenu,+ ContextMenuTrigger,+ ContextMenuContent,+ ContextMenuItem,+} from "@/components/ui/context-menu";+import { useEngine } from "@/context/engine";+import { useEntityState, addComponent, setComponent } from "@/components/engine";+import { Keyframe } from "@/components/ui/keyframe";+++export type OffsetRowProps = {+ nodeEid: number;+ onRemoveAddon(): void;+};++export function OffsetRow(props: OffsetRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const offsetX = useEntityState(c.Computed.offsetX, props.nodeEid, 0);+ const offsetY = useEntityState(c.Computed.offsetY, props.nodeEid, 0);++ const isDefault = createMemo(() => (offsetX() === 0 && offsetY() === 0));++ const updateOffsetX = (x: number) => {+ addComponent(world, props.nodeEid, c.Offset);+ setComponent(world, props.nodeEid, c.Offset, { x });+ };++ const updateOffsetY = (y: number) => {+ addComponent(world, props.nodeEid, c.Offset);+ setComponent(world, props.nodeEid, c.Offset, { y });+ };++ const handleResetToDefault = () => {+ updateOffsetX(0);+ updateOffsetY(0);+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="Offset"+ contentClass="grid grid-cols-2 gap-2"+ >+ <ControlledTextField+ icon={<Icon name="prop-x-position" />}+ value={offsetX()}+ onNumber={updateOffsetX}+ step={1}+ autoSelect+ sliderEnabled+ keyframe={<Keyframe target={props.nodeEid} property="offset.x" />}+ />+ <ControlledTextField+ icon={<Icon name="prop-y-position" />}+ value={offsetY()}+ onNumber={updateOffsetY}+ step={1}+ autoSelect+ sliderEnabled+ keyframe={<Keyframe target={props.nodeEid} property="offset.y" />}+ />+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem+ disabled={isDefault()}+ onSelect={handleResetToDefault}+ >+ Reset to Default+ </ContextMenuItem>+ <ContextMenuItem onSelect={props.onRemoveAddon}>+ Remove row+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/rotate-row.tsx b/apps/web/src/components/sidebar-right/inspector/transform/rotate-row.tsxnew file mode 100644index 00000000..fd35cce8--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/rotate-row.tsx@@ -0,0 +1,121 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo } from 'solid-js';+import { ControlRow } from '@/components/ui/control-group';+import { Icon } from '@/components/ui/icon';+import { ControlledTextField } from '@/components/ui/text-field';+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuTrigger,+} from '@/components/ui/context-menu';+import { useEngine } from '@/context/engine';+import { useEntityState, setComponent } from '@/components/engine';+import { Keyframe } from '@/components/ui/keyframe';+++type RotateRowProps = {+ nodeEid: number;+ onRemoveAddon(): void;+};++export function RotateRow(props: RotateRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const rotation = useEntityState(c.Computed.rotation, props.nodeEid, 0);+ const flipX = useEntityState(c.Flip.x, props.nodeEid, 1);+ const flipY = useEntityState(c.Flip.y, props.nodeEid, 1);++ const isDefault = createMemo(() => (rotation() === 0 && flipX() === 1 && flipY() === 1));++ const updateRotation = (value: number) => {+ setComponent(world, props.nodeEid, c.Rotation, value);+ };++ const toggleFlipX = () => {+ setComponent(world, props.nodeEid, c.Flip, { x: flipX() === 1 ? -1 : 1 });+ };++ const toggleFlipY = () => {+ setComponent(world, props.nodeEid, c.Flip, { y: flipY() === 1 ? -1 : 1 });+ };++ const handleResetToDefault = () => {+ updateRotation(0);+ setComponent(world, props.nodeEid, c.Flip, { x: 1, y: 1 });+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="Rotate"+ contentClass="flex gap-2 items-center"+ >+ <ControlledTextField+ class="flex-1"+ icon={<Icon name="rotate-angle" />}+ value={rotation()}+ onNumber={updateRotation}+ unit={'\u00B0'}+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.nodeEid} property="rotation" />}+ />+ <div class="flex flex-1 gap-px rounded-md overflow-hidden">+ <Tooltip>+ <TooltipTrigger+ as="button"+ type="button"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 text-foreground"+ onClick={() => updateRotation((rotation() ?? 0) + 90)}+ >+ <Icon name="rotate-90" class="size-5" />+ </TooltipTrigger>+ <TooltipContent>Rotate 90</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ as="button"+ type="button"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 text-foreground"+ onClick={toggleFlipX}+ >+ <Icon name="flip-horizontal" class="size-5" />+ </TooltipTrigger>+ <TooltipContent>Flip Horizontal</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ as="button"+ type="button"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 text-foreground"+ onClick={toggleFlipY}+ >+ <Icon name="flip-vertical" class="size-5" />+ </TooltipTrigger>+ <TooltipContent>Flip Vertical</TooltipContent>+ </Tooltip>+ </div>+ </ContextMenuTrigger>++ <ContextMenuContent>+ <ContextMenuItem+ disabled={isDefault()}+ onSelect={handleResetToDefault}+ >+ Reset to Default+ </ContextMenuItem>+ <ContextMenuItem onSelect={props.onRemoveAddon}>+ Remove row+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/scale-row.tsx b/apps/web/src/components/sidebar-right/inspector/transform/scale-row.tsxnew file mode 100644index 00000000..a1037d13--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/scale-row.tsx@@ -0,0 +1,154 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, Show } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { ControlledTextField } from "@/components/ui/text-field";+import {+ ContextMenu,+ ContextMenuTrigger,+ ContextMenuContent,+ ContextMenuItem,+} from "@/components/ui/context-menu";+import { useEngine } from "@/context/engine";+import { useEntityState, setComponent, useEntityTag, removeComponent, removeKeyframeTrack } from "@/components/engine";+import { Keyframe } from "@/components/ui/keyframe";+import { SegmentedIconTabs } from "@/components/ui/segmented-icon-tabs";+import { hasComponent } from "bitecs";++export type ScaleRowProps = {+ nodeEid: number;+ onRemoveAddon(): void;+};++type ScaleMode = 'uniform' | 'separate';++const SCALE_MODE_ITEMS = [+ {+ value: 'uniform' as ScaleMode,+ label: 'Uniform scale',+ icon: 'unified-values',+ },+ {+ value: 'separate' as ScaleMode,+ label: 'Separate scale',+ icon: 'scale-individual-axes',+ },+] as const;++export function ScaleRow(props: ScaleRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const eid = () => props.nodeEid;+ const mixedScale = useEntityTag(c.Scale, eid);++ const scaleX = useEntityState(c.Computed.scaleX, eid, 1);+ const scaleY = useEntityState(c.Computed.scaleY, eid, 1);+ const scaleMode = createMemo(() => mixedScale() ? 'separate' : 'uniform');++ const isDefault = createMemo(() => (scaleX() === 1 && scaleY() === 1));++ const scale = createMemo(() => {+ if (scaleY() !== scaleX()) {+ return "Mixed";+ }+ return Math.round(scaleX() * 100);+ });++ const updateScaleX = (x: number) => setComponent(world, props.nodeEid, c.Scale, { x });+ const updateScaleY = (y: number) => setComponent(world, props.nodeEid, c.Scale, { y });+ const updateScale = (scale: number) => {+ if (hasComponent(world, props.nodeEid, c.UniformScale)) {+ setComponent(world, props.nodeEid, c.UniformScale, scale)+ } else {+ setComponent(world, props.nodeEid, c.Scale, { x: scale, y: scale });+ }+ };++ const handleScaleModeChange = (mode: ScaleMode) => {+ if (mode === 'uniform') {+ world.history.transaction('Change scale mode to uniform', () => {+ removeComponent(world, props.nodeEid, c.Scale);+ setComponent(world, props.nodeEid, c.UniformScale, scaleX());+ removeKeyframeTrack(world, props.nodeEid, 'scale.x');+ removeKeyframeTrack(world, props.nodeEid, 'scale.y');+ });+ }++ if (mode === 'separate') {+ world.history.transaction('Change scale mode to separate', () => {+ removeComponent(world, props.nodeEid, c.UniformScale);+ setComponent(world, props.nodeEid, c.Scale, { x: scaleX(), y: scaleY() });+ removeKeyframeTrack(world, props.nodeEid, 'scale');+ });+ }+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="Scale"+ contentClass="grid grid-cols-2 gap-2"+ >+ <ControlledTextField+ icon={<Icon name="scale-size" />}+ value={scale()}+ onNumber={(value) => updateScale(value / 100)}+ step={1}+ unit="%"+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.nodeEid} property="scale" />}+ />+ <SegmentedIconTabs+ value={() => scaleMode()}+ onChange={handleScaleModeChange}+ items={SCALE_MODE_ITEMS}+ />+ <Show when={mixedScale()}>+ <ControlledTextField+ icon={<Icon name="prop-x-position" />}+ value={Math.round(scaleX() * 100)}+ onNumber={(value) => updateScaleX(value / 100)}+ step={1}+ unit="%"+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.nodeEid} property="scale.x" />}+ />+ <ControlledTextField+ icon={<Icon name="prop-y-position" />}+ value={Math.round(scaleY() * 100)}+ onNumber={(value) => updateScaleY(value / 100)}+ step={1}+ unit="%"+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.nodeEid} property="scale.y" />}+ />+ </Show>+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem+ disabled={isDefault()}+ onSelect={() => {+ updateScaleX(1);+ updateScaleY(1);+ }}+ >+ Reset to Default+ </ContextMenuItem>+ <ContextMenuItem onSelect={props.onRemoveAddon}>+ Remove row+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/skew-row.tsx b/apps/web/src/components/sidebar-right/inspector/transform/skew-row.tsxnew file mode 100644index 00000000..848aa184--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/skew-row.tsx@@ -0,0 +1,88 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { ControlledTextField } from "@/components/ui/text-field";+import {+ ContextMenu,+ ContextMenuTrigger,+ ContextMenuContent,+ ContextMenuItem,+} from "@/components/ui/context-menu";+import { useEngine } from "@/context/engine";+import { useEntityState, setComponent } from "@/components/engine";+import { Keyframe } from "@/components/ui/keyframe";+++export type SkewRowProps = {+ nodeEid: number;+ onRemoveAddon(): void;+};++export function SkewRow(props: SkewRowProps) {+ const { world } = useEngine();+ const c = world.components;++ const skewX = useEntityState(c.Computed.skewX, props.nodeEid, 0);+ const skewY = useEntityState(c.Computed.skewY, props.nodeEid, 0);++ const isDefault = createMemo(() => (skewX() === 0 && skewY() === 0));++ const updateSkewX = (x: number) => {+ setComponent(world, props.nodeEid, c.Skew, { x });+ };++ const updateSkewY = (y: number) => {+ setComponent(world, props.nodeEid, c.Skew, { y });+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger<typeof ControlRow>+ as={ControlRow}+ label="Skew"+ contentClass="grid grid-cols-2 gap-2"+ >+ <ControlledTextField+ icon={<Icon name="prop-x-position" />}+ value={skewX()}+ onNumber={updateSkewX}+ step={1}+ unit="°"+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.nodeEid} property="skew.x" />}+ />+ <ControlledTextField+ icon={<Icon name="prop-y-position" />}+ value={skewY()}+ onNumber={updateSkewY}+ step={1}+ unit="°"+ autoSelect+ sliderEnabled+ limitEvents+ keyframe={<Keyframe target={props.nodeEid} property="skew.y" />}+ />+ </ContextMenuTrigger>+ <ContextMenuContent>+ <ContextMenuItem+ disabled={isDefault()}+ onSelect={() => {+ updateSkewX(0);+ updateSkewY(0);+ }}+ >+ Reset to Default+ </ContextMenuItem>+ <ContextMenuItem onSelect={props.onRemoveAddon}>+ Remove row+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenu>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transform/transform-settings.tsx b/apps/web/src/components/sidebar-right/inspector/transform/transform-settings.tsxnew file mode 100644index 00000000..fc15c396--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transform/transform-settings.tsx@@ -0,0 +1,192 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { createMemo, Show } from "solid-js";+import { ControlRow } from "@/components/ui/control-group";+import { Icon } from "@/components/ui/icon";+import { PanelSection } from "@/components/ui/panel-section";+import { ControlledTextField } from "@/components/ui/text-field";+import {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuContent,+ DropdownMenuItem,+} from "@/components/ui/dropdown-menu";+import { RotateRow } from "./rotate-row";+import { AnchorRow } from "./anchor-row";+import { OffsetRow } from "./offset-row";+import { ScaleRow } from "./scale-row";+import { SkewRow } from "./skew-row";+import { ConstraintsRow } from "./constraints-row";+import { useEngine } from "@/context/engine";+import { useEntityState, getParentEntity, setComponent } from "@/components/engine";+import { createStoredSignal } from "@/lib/store";+import { store } from "@/init";+import { Keyframe } from "@/components/ui/keyframe";+import { hasComponent } from "bitecs";+++type TransformSettingsProps = {+ selection: Set<number>;+};++type TransformAddon = 'rotate' | 'anchor' | 'offset' | 'scale' | 'skew' | 'constraints';+type TransformAddons = Partial<Record<TransformAddon, boolean>>;++export function TransformSettings(props: TransformSettingsProps) {+ const { world } = useEngine();+ const c = world.components;++ const eid = () => props.selection.values().next().value!;++ const [addons, setAddons] = createStoredSignal(+ store.define<TransformAddons>('transform.addons', {})+ );++ const posX = useEntityState(c.Computed.positionX, eid, 0);+ const posY = useEntityState(c.Computed.positionY, eid, 0);++ const updatePosX = (x: number) => {+ setComponent(world, eid(), c.Position, { x });+ };++ const updatePosY = (y: number) => {+ setComponent(world, eid(), c.Position, { y });+ };++ const supportsConstraints = createMemo(() => {+ const parentEid = getParentEntity(world, eid());+ if (parentEid === null) return false;++ const parentIsScene = hasComponent(world, parentEid, c.Scene);+ const isAdjustmentLayer = hasComponent(world, eid(), c.AdjustmentLayer);++ return parentIsScene && !isAdjustmentLayer;+ });++ return (+ <PanelSection+ title="Transform"+ actions={+ <Show when={!addons().rotate || !addons().anchor || !addons().offset || !addons().scale || !addons().skew || !addons().constraints}>+ <DropdownMenu placement="bottom-end">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button size="icon" variant="ghost" class="text-muted-foreground" {...buttonProps}>+ <Icon name="plus-add" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Add transform</TooltipContent>+ </Tooltip>+ <DropdownMenuContent>+ <Show when={!addons().rotate}>+ <DropdownMenuItem onSelect={() => setAddons({ ...addons(), rotate: true })}>+ Rotate+ </DropdownMenuItem>+ </Show>+ <Show when={!addons().constraints}>+ <DropdownMenuItem onSelect={() => setAddons({ ...addons(), constraints: true })}>+ Constraints+ </DropdownMenuItem>+ </Show>+ <Show when={!addons().anchor}>+ <DropdownMenuItem onSelect={() => setAddons({ ...addons(), anchor: true })}>+ Anchor+ </DropdownMenuItem>+ </Show>+ <Show when={!addons().offset}>+ <DropdownMenuItem onSelect={() => setAddons({ ...addons(), offset: true })}>+ Offset+ </DropdownMenuItem>+ </Show>+ <Show when={!addons().scale}>+ <DropdownMenuItem onSelect={() => setAddons({ ...addons(), scale: true })}>+ Scale+ </DropdownMenuItem>+ </Show>+ <Show when={!addons().skew}>+ <DropdownMenuItem onSelect={() => setAddons({ ...addons(), skew: true })}>+ Skew+ </DropdownMenuItem>+ </Show>+ </DropdownMenuContent>+ </DropdownMenu>+ </Show>+ }+ >+ <ControlRow label="Position">+ <div class="grid grid-cols-2 gap-2">+ <ControlledTextField+ icon={<Icon name="prop-x-position" />}+ keyframe={<Keyframe target={eid()} property="position.x" />}+ value={posX()}+ onNumber={updatePosX}+ step={1}+ autoSelect+ sliderEnabled+ limitEvents+ />+ <ControlledTextField+ icon={<Icon name="prop-y-position" />}+ keyframe={<Keyframe target={eid()} property="position.y" />}+ value={posY()}+ onNumber={updatePosY}+ step={1}+ autoSelect+ sliderEnabled+ limitEvents+ />+ </div>+ </ControlRow>++ <Show when={addons().constraints && supportsConstraints()}>+ <ConstraintsRow nodeEid={eid()} />+ </Show>++ <Show when={addons().rotate}>+ <RotateRow+ nodeEid={eid()}+ onRemoveAddon={() => setAddons({ ...addons(), rotate: false })}+ />+ </Show>++ <Show when={addons().anchor}>+ <AnchorRow+ nodeEid={eid()}+ onRemoveAddon={() => setAddons({ ...addons(), anchor: false })}+ />+ </Show>++ <Show when={addons().offset}>+ <OffsetRow+ nodeEid={eid()}+ onRemoveAddon={() => setAddons({ ...addons(), offset: false })}+ />+ </Show>++ <Show when={addons().scale}>+ <ScaleRow+ nodeEid={eid()}+ onRemoveAddon={() => setAddons({ ...addons(), scale: false })}+ />+ </Show>++ <Show when={addons().skew}>+ <SkewRow+ nodeEid={eid()}+ onRemoveAddon={() => setAddons({ ...addons(), skew: false })}+ />+ </Show>+ </PanelSection>+ );+}diff --git a/apps/web/src/components/sidebar-right/inspector/transition.tsx b/apps/web/src/components/sidebar-right/inspector/transition.tsxnew file mode 100644index 00000000..b997c7b1--- /dev/null+++ b/apps/web/src/components/sidebar-right/inspector/transition.tsx@@ -0,0 +1,192 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { ControlRow } from "@/components/ui/control-group";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import {+ FloatingInspector,+ FloatingInspectorContent,+ FloatingInspectorHeader,+ FloatingInspectorSeparator,+ FloatingInspectorTitle,+} from "@/components/ui/floating-inspector";+import { Icon } from "@/components/ui/icon";+import { ItemRow } from "@/components/ui/item-row";+import { PanelSection } from "@/components/ui/panel-section";+import { SliderInput } from "@/components/ui/slider-input";+import { For, Show, createMemo, createSignal } from "solid-js";++import { useEntityState, useEntityTag, TransitionType, removeComponent, setComponent } from "@/components/engine";+import { useEngine } from "@/context/engine";+import { secondsToFrames } from "@/components/engine/utils/time";+++type TransitionSettingsProps = {+ selection: Set<number>;+};++const TRANSITION_OPTIONS = Object.values(TransitionType).filter(+ (v): v is TransitionType => typeof v === "number",+);++const TRANSITION_LABELS: Record<TransitionType, string> = {+ [TransitionType.DISSOLVE]: "Dissolve",+ [TransitionType.SLIDE_FROM_RIGHT]: "Slide From Right",+ [TransitionType.SLIDE_FROM_LEFT]: "Slide From Left",+ [TransitionType.FADE_TO_BLACK]: "Fade To Black",+ [TransitionType.FADE_TO_WHITE]: "Fade To White",+};++export function TransitionSettings(props: TransitionSettingsProps) {+ const { world } = useEngine();+ const [isInspectorOpen, setIsInspectorOpen] = createSignal(false);++ const c = world.components;+ let anchorRef: HTMLDivElement | undefined;++ const eid = () => props.selection.values().next().value!;++ const hasTransition = useEntityTag(c.Transition, eid);+ const transitionType = useEntityState(c.Transition.type, eid, TransitionType.DISSOLVE);+ const transitionDuration = useEntityState(c.Transition.duration, eid, world.frameRate);+ const transitionDurationInSeconds = createMemo(() => transitionDuration() / world.frameRate);++ const transitionLabel = createMemo(() => {+ if (!hasTransition()) return "";+ return TRANSITION_LABELS[transitionType() as TransitionType] ?? "Dissolve";+ });++ const handleSetTransition = (type: TransitionType) => {+ setComponent(world, eid(), c.Transition, {+ duration: world.frameRate,+ type,+ });+ };++ const handleRemoveTransition = () => {+ removeComponent(world, eid(), c.Transition);+ setIsInspectorOpen(false);+ };++ const handleSetDuration = (durationSec: number) => {+ setComponent(world, eid(), c.Transition, {+ duration: secondsToFrames(durationSec),+ });+ };++ const openInspector = () => {+ if (!hasTransition()) return;+ setIsInspectorOpen(true);+ };++ return (+ <>+ <PanelSection+ title="Transition"+ ref={anchorRef}+ actions={+ <DropdownMenu placement="bottom-end">+ <Tooltip>+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ disabled={!eid()}+ {...buttonProps}+ >+ <Icon name="plus-add" />+ </Button>+ )}+ />+ )}+ />+ <TooltipContent>Add transition</TooltipContent>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-44">+ <For each={TRANSITION_OPTIONS}>+ {(type) => (+ <DropdownMenuItem onSelect={() => handleSetTransition(type)}>+ {TRANSITION_LABELS[type]}+ </DropdownMenuItem>+ )}+ </For>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ }+ >+ <Show when={hasTransition()}>+ <ItemRow+ label="Type"+ value={transitionLabel()}+ icon={<Icon name="video-transition" />}+ onClick={() => openInspector()}+ >+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleRemoveTransition}+ >+ <Icon name="close-remove-small" />+ </TooltipTrigger>+ <TooltipContent>Remove transition</TooltipContent>+ </Tooltip>+ </ItemRow>+ </Show>+ </PanelSection>++ <Show when={isInspectorOpen() && hasTransition()}>+ <FloatingInspector open={true} anchorRef={() => anchorRef} width={248}>+ <FloatingInspectorHeader class="items-center justify-between">+ <FloatingInspectorTitle>{transitionLabel()}</FloatingInspectorTitle>+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon"+ variant="ghost"+ class="text-muted-foreground"+ onClick={() => setIsInspectorOpen(false)}+ >+ <Icon name="close-remove" />+ </TooltipTrigger>+ <TooltipContent>Close</TooltipContent>+ </Tooltip>+ </FloatingInspectorHeader>+ <FloatingInspectorSeparator />+ <FloatingInspectorContent class="p-4">+ <ControlRow label="Duration">+ <SliderInput+ value={transitionDurationInSeconds()}+ min={0.1}+ max={10}+ step={0.1}+ format={(v) => `${v.toFixed(1)}s`}+ onDragStart={() => world.history.startTransaction("Edit transition duration")}+ onDragEnd={() => world.history.commitTransaction()}+ onChange={handleSetDuration}+ />+ </ControlRow>+ </FloatingInspectorContent>+ </FloatingInspector>+ </Show>+ </>+ );+}diff --git a/apps/web/src/components/sidebar-right/soundboard/index.ts b/apps/web/src/components/sidebar-right/soundboard/index.tsnew file mode 100644index 00000000..8d65b8ab--- /dev/null+++ b/apps/web/src/components/sidebar-right/soundboard/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './soundboard';diff --git a/apps/web/src/components/sidebar-right/soundboard/soundboard.tsx b/apps/web/src/components/sidebar-right/soundboard/soundboard.tsxnew file mode 100644index 00000000..f615c97d--- /dev/null+++ b/apps/web/src/components/sidebar-right/soundboard/soundboard.tsx@@ -0,0 +1,198 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { MeterScale, VolumeControl, VolumeMeter } from './volume-meter';+import { useEntityState, setComponent } from '@/components/engine';+import { useEngine } from '@/context/engine';+import { createEffect, createMemo, createSignal, Show } from 'solid-js';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from '@/components/ui/select';+import { useECS } from '@/context/ecs';+import { hasComponent } from 'bitecs';++export function Soundboard() {+ const { world } = useEngine();+ const { playing } = useECS();++ const c = world.components;+ const scene = () => world.timelineIndex().root;+ const masterVolume = useEntityState(c.Volume, scene, 0);++ // Only audio-bearing clips can be metered.+ const audioLayers = createMemo(() =>+ world+ .timelineIndex()+ .layers+ .map((layer) => layer.eid)+ .filter((eid) => hasComponent(world, eid, c.AudioBus) || hasComponent(world, eid, c.Volume))+ );++ const [leftMeterEid, setLeftMeterEid] = createSignal<number | undefined>(audioLayers()[1]);+ const [rightMeterEid, setRightMeterEid] = createSignal<number | undefined>(audioLayers()[0]);++ const leftOptions = () => audioLayers().filter((eid) => eid !== rightMeterEid());+ const rightOptions = () => audioLayers().filter((eid) => eid !== leftMeterEid());++ createEffect(() => {+ const list = audioLayers();+ let left = leftMeterEid();+ let right = rightMeterEid();++ // Drop selections whose layer no longer exists.+ if (left !== undefined && !list.includes(left)) left = undefined;+ if (right !== undefined && !list.includes(right)) right = undefined;++ // Auto-fill empty slots, preferring a layer not already shown in the sibling+ // so the two meters never collapse onto the same layer.+ if (right === undefined) right = list.find((eid) => eid !== left);+ if (left === undefined) left = list.find((eid) => eid !== right);++ setRightMeterEid(right);+ setLeftMeterEid(left);+ }, { defer: true });++ const masterBus = createMemo(() => {+ playing();+ const sceneEid = scene();+ return c.AudioBus[sceneEid ?? -1];+ });++ const leftMeterNode = createMemo(() => {+ playing();+ scene();+ const eid = leftMeterEid();+ if (eid === undefined) return;+ return c.AudioBus[eid]?.getGain();+ });++ const leftMeterVolume = useEntityState(c.Volume, leftMeterEid, 0);++ const rightMeterNode = createMemo(() => {+ playing();+ scene();+ const eid = rightMeterEid();+ if (eid === undefined) return;+ return c.AudioBus[eid]?.getGain();+ });++ const rightMeterVolume = useEntityState(c.Volume, rightMeterEid, 0);++ const masterNode = createMemo(() => {+ playing();+ scene();++ return masterBus()?.getGain();+ });++ const handleMasterVolumeChange = (volume: number) => {+ const sceneEid = scene();+ if (sceneEid === null) return;+ setComponent(world, sceneEid, c.Volume, volume);+ };++ const handleLeftMeterVolumeChange = (volume: number) => {+ const eid = leftMeterEid();+ if (eid === undefined) return;+ setComponent(world, eid, c.Volume, volume);+ };++ const handleRightMeterVolumeChange = (volume: number) => {+ const eid = rightMeterEid();+ if (eid === undefined) return;+ setComponent(world, eid, c.Volume, volume);+ };++ const handleLeftMeterLayerChange = (eid: number | null) => {+ if (eid === null) return;+ if (audioLayers().includes(eid)) setLeftMeterEid(eid);+ }++ const handleRightMeterLayerChange = (eid: number | null) => {+ if (eid === null) return;+ if (audioLayers().includes(eid)) setRightMeterEid(eid);+ }++ const layerName = (eid: number) => c.Name[eid] ?? `Layer ${eid}`;++ return (+ <div class="flex items-center h-full w-full justify-between p-4">+ <div class="flex h-full relative">+ <VolumeControl+ volume={leftMeterVolume()}+ disabled={!leftMeterNode()}+ onVolumeChange={handleLeftMeterVolumeChange}+ />+ <VolumeMeter audioNode={leftMeterNode()} />+ <MeterScale />+ <div class="absolute inset-x-0 -bottom-4 h-8 translate-y-full flex items-center justify-center">+ <Show when={leftMeterEid() !== undefined}>+ <Select<number>+ value={leftMeterEid()}+ onChange={handleLeftMeterLayerChange}+ options={leftOptions()}+ disabled={leftOptions().length <= 1}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{layerName(itemProps.item.rawValue)}</SelectItem>+ )}+ >+ <SelectTrigger class="text-xs text-muted-foreground hover:text-foreground bg-transparent hover:bg-transparent w-20 focus-visible:after:opacity-0">+ <SelectValue<number>>{(state) => layerName(state.selectedOption() ?? -1)}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </Show>+ </div>+ </div>+ <div class="flex h-full relative">+ <VolumeControl+ volume={rightMeterVolume()}+ disabled={!rightMeterNode()}+ onVolumeChange={handleRightMeterVolumeChange}+ />+ <VolumeMeter audioNode={rightMeterNode()} />+ <MeterScale />+ <div class="absolute inset-x-0 -bottom-4 h-8 translate-y-full flex items-center justify-center">+ <Show when={rightMeterEid() !== undefined}>+ <Select<number>+ value={rightMeterEid()}+ onChange={handleRightMeterLayerChange}+ options={rightOptions()}+ disabled={rightOptions().length <= 1}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{layerName(itemProps.item.rawValue)}</SelectItem>+ )}+ >+ <SelectTrigger class="text-xs text-muted-foreground hover:text-foreground bg-transparent hover:bg-transparent w-20 focus-visible:after:opacity-0">+ <SelectValue<number>>{(state) => layerName(state.selectedOption() ?? -1)}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>+ </Show>+ </div>+ </div>+ <div class="flex h-full relative">+ <VolumeControl+ volume={masterVolume()}+ disabled={!masterNode()}+ onVolumeChange={handleMasterVolumeChange}+ />+ <VolumeMeter audioNode={masterNode()} />+ <MeterScale />+ <div class="absolute inset-x-0 -bottom-4 h-8 translate-y-full flex items-center justify-center">+ <span class="text-base text-muted-foreground">Master</span>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/sidebar-right/soundboard/volume-meter.tsx b/apps/web/src/components/sidebar-right/soundboard/volume-meter.tsxnew file mode 100644index 00000000..44beacc3--- /dev/null+++ b/apps/web/src/components/sidebar-right/soundboard/volume-meter.tsx@@ -0,0 +1,237 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createMemo, For, onCleanup, Show } from 'solid-js';+import { useVolumeMeter, type ChannelLevels } from '@/hooks/use-volume-meter';+import { cx } from '@/lib/cva';++const MIN_DB = -60;+const MAX_DB = 3;++/** Maps a linear amplitude (0–1+) to a meter percentage (0–100). */+function amplitudeToMeterPct(amplitude: number): number {+ if (amplitude <= 0) return 0;++ const db = 20 * Math.log10(amplitude);++ if (db <= MIN_DB) return 0;+ if (db >= MAX_DB) return 100;++ return ((db - MIN_DB) / (MAX_DB - MIN_DB)) * 100;+}++/**+ * Color stop thresholds (as percentage of meter height):+ * 0–60% green+ * 60–85% yellow+ * 85–100% red+ */+const GREEN_END = 60;+const YELLOW_END = 80;++const SCALE_LABELS = ['0', '-3', '-6', '-12', '-24', 'dB'];++const MINOR_TICKS_PER_SEGMENT = 3;++type VolumeMeterProps = {+ audioNode?: GainNode;+};++export function VolumeMeter(props: VolumeMeterProps) {+ const meter = useVolumeMeter();++ createEffect(() => {+ if (props.audioNode) {+ meter.connect(props.audioNode);+ } else {+ meter.disconnect();+ }+ });++ onCleanup(() => meter.disconnect());++ return (+ <div class="flex gap-px w-5 overflow-hidden rounded-sm">+ <VerticalMeter channel={0} levels={meter.levels} />+ <VerticalMeter channel={1} levels={meter.levels} />+ </div>+ );+}++type VerticalMeterProps = {+ channel: number;+ levels: () => ChannelLevels[];+};++function VerticalMeter(props: VerticalMeterProps) {+ const level = () => {+ const ch = props.levels()[props.channel];+ return ch ?? { rms: 0, peak: 0 };+ };++ const rmsPct = () => amplitudeToMeterPct(level().rms);+ const peakPct = () => amplitudeToMeterPct(level().peak);++ const indicatorOffset = () => `${peakPct()}%`;+ const indicatorClass = () => {+ const pct = peakPct();+ if (pct >= YELLOW_END + (100 - YELLOW_END) / 2) return "bg-meter-red";+ if (pct >= GREEN_END) return "bg-meter-yellow";+ return "bg-meter-green";+ };++ return (+ <div class="h-full relative w-full">+ {/* Segmented background (bottom=green, mid=yellow, top=red) */}+ <MeterSegments />++ {/* Dark overlay that reveals from top — covers unfilled portion */}+ <div+ class="absolute inset-x-0 top-0 bg-canvas transition-none"+ style={{ height: `${100 - rmsPct()}%` }}+ />++ {/* Peak indicator line */}+ <Show when={peakPct() > 0.5}>+ <div+ class={cx("absolute inset-x-0 h-px", indicatorClass())}+ style={{ bottom: indicatorOffset() }}+ />+ </Show>+ </div>+ );+}++function MeterSegments() {+ return (+ <>+ {/* Green: bottom 60% */}+ <div+ class="absolute inset-x-0 bottom-0 bg-meter-green"+ style={{ height: `${GREEN_END}%` }}+ />+ {/* Yellow: 60–85% */}+ <div+ class="absolute inset-x-0 bg-meter-yellow"+ style={{+ bottom: `${GREEN_END}%`,+ height: `${YELLOW_END - GREEN_END}%`,+ }}+ />+ {/* Red: 85–100% */}+ <div+ class="absolute inset-x-0 top-0 bg-meter-red"+ style={{ height: `${100 - YELLOW_END}%` }}+ />+ </>+ );+}++/**+ * 0 dB (unity) sits at 50% (middle of the track).+ * Top = SLIDER_MAX_DB, bottom = SLIDER_MIN_DB.+ */+const SLIDER_MAX_DB = -MIN_DB; // +60 dB at top (symmetric around 0)+const SLIDER_MIN_DB = MIN_DB; // -60 dB at bottom++/** Maps a dB value to a slider percentage (0%=top, 100%=bottom). */+function dbToSliderPct(db: number): number {+ const clamped = Math.max(SLIDER_MIN_DB, Math.min(SLIDER_MAX_DB, db));+ return ((SLIDER_MAX_DB - clamped) / (SLIDER_MAX_DB - SLIDER_MIN_DB)) * 100;+}++/** Maps a slider percentage (0%=top, 100%=bottom) to a dB value. */+function sliderPctToDb(pct: number): number {+ const clamped = Math.max(0, Math.min(100, pct));+ return SLIDER_MAX_DB - (clamped / 100) * (SLIDER_MAX_DB - SLIDER_MIN_DB);+}++type VolumeControlProps = {+ volume: number;+ onVolumeChange(volume: number): void;+ disabled?: boolean;+};++export function VolumeControl(props: VolumeControlProps) {+ const segments = SCALE_LABELS.length - 1;+ const totalMinor = segments * (MINOR_TICKS_PER_SEGMENT + 1);++ const knobPct = createMemo(() => dbToSliderPct(props.volume));++ let trackRef!: HTMLDivElement;++ const handlePointerDown = (e: PointerEvent) => {+ e.preventDefault();+ (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);++ const update = (clientY: number) => {+ const rect = trackRef.getBoundingClientRect();+ const pct = ((clientY - rect.top) / rect.height) * 100;+ const db = sliderPctToDb(pct);+ props.onVolumeChange(db);+ };++ update(e.clientY);++ const onMove = (ev: PointerEvent) => update(ev.clientY);+ const onUp = () => {+ window.removeEventListener('pointermove', onMove);+ window.removeEventListener('pointerup', onUp);+ };++ window.addEventListener('pointermove', onMove);+ window.addEventListener('pointerup', onUp);+ };++ return (+ <div+ ref={trackRef}+ class="relative w-3 h-full mr-3 flex flex-col justify-between items-end"+ classList={{ 'opacity-50 pointer-events-none': props.disabled }}+ onPointerDown={handlePointerDown}+ >+ <For each={Array.from({ length: totalMinor + 1 }, (_, i) => i)}>+ {(i) => {+ const isMajor = i % (MINOR_TICKS_PER_SEGMENT + 1) === 0;++ return (+ <div+ class="h-px pointer-events-none"+ classList={{+ 'bg-disabled-foreground': isMajor,+ 'bg-disabled-foreground/50': !isMajor,+ 'w-full': isMajor,+ 'w-1/2': !isMajor,+ }}+ />+ );+ }}+ </For>+ <div+ class="w-4.5 -translate-y-1/2 h-2 flex justify-center items-center absolute -left-0.75 bg-foreground rounded-xs pointer-events-none"+ style={{ top: `${knobPct()}%` }}+ >+ <div class="w-3 h-px bg-background" />+ </div>+ </div>+ );+}++export function MeterScale() {+ return (+ <div class="relative flex flex-col justify-between h-full ml-1">+ <For each={SCALE_LABELS}>+ {(label) => {+ const needsPad = !label.startsWith('-');+ return (+ <span class="text-xxs leading-none font-mono text-disabled-foreground">+ {needsPad && <span class="invisible">-</span>}+ {label}+ </span>+ );+ }}+ </For>+ </div>+ );+}diff --git a/apps/web/src/components/timeline/index.ts b/apps/web/src/components/timeline/index.tsnew file mode 100644index 00000000..e2b2a402--- /dev/null+++ b/apps/web/src/components/timeline/index.ts@@ -0,0 +1,6 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './layers';+export * from './timeline';diff --git a/apps/web/src/components/timeline/layers/config.ts b/apps/web/src/components/timeline/layers/config.tsnew file mode 100644index 00000000..65ddad14--- /dev/null+++ b/apps/web/src/components/timeline/layers/config.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export const NESTED_INDENT_PX = 20;diff --git a/apps/web/src/components/timeline/layers/context.tsx b/apps/web/src/components/timeline/layers/context.tsxnew file mode 100644index 00000000..f0422419--- /dev/null+++ b/apps/web/src/components/timeline/layers/context.tsx@@ -0,0 +1,38 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createContext, createSignal, useContext, type JSX, type Signal } from "solid-js";++export type DropPosition = 'above' | 'below' | 'inside';++export type LayerDragState = {+ targetEid: number | null;+ position: DropPosition | null;+};++type LayerContextValue = {+ resizedId: Signal<number | null>;+ dragState: Signal<LayerDragState | null>;+}++const LayerContext = createContext<LayerContextValue>();++export function LayerContextProvider(props: { children: JSX.Element }) {+ const resizedId = createSignal<number | null>(null);+ const dragState = createSignal<LayerDragState | null>(null);++ return (+ <LayerContext.Provider value={{ resizedId, dragState }}>+ {props.children}+ </LayerContext.Provider>+ );+}++export function useLayerContext() {+ const context = useContext(LayerContext);+ if (!context) {+ throw new Error('useLayerContext must be used within a LayerContextProvider');+ }+ return context;+}diff --git a/apps/web/src/components/timeline/layers/index.ts b/apps/web/src/components/timeline/layers/index.tsnew file mode 100644index 00000000..1d349f72--- /dev/null+++ b/apps/web/src/components/timeline/layers/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './layers';diff --git a/apps/web/src/components/timeline/layers/keyframe.tsx b/apps/web/src/components/timeline/layers/keyframe.tsxnew file mode 100644index 00000000..18704054--- /dev/null+++ b/apps/web/src/components/timeline/layers/keyframe.tsx@@ -0,0 +1,186 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, Show } from 'solid-js';+import { Button } from '@/components/ui/button';+import { Icon } from '@/components/ui/icon';+import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from '@/components/ui/tooltip';+import { Keyframe } from '@/components/ui/keyframe';+import { useEngine } from '@/context/engine';+import { useECS } from '@/context/ecs';+import { KEYFRAME_TRACK_HEIGHT } from '@/components/engine/timeline/config';+import { NESTED_INDENT_PX } from './config';++import { addComponent, removeComponent, useEntityTag, getParentEntity, type PropertyPath, type TimelineNode } from '@/components/engine';+import { findClosestParentGeometry } from '@/components/engine/api/utils';++type KeyframeLayerProps = {+ depth: number;+ layer: TimelineNode;+ ancestorSelected: boolean;+}++export function KeyframeLayer(props: KeyframeLayerProps) {+ const { world } = useEngine();+ const { now } = useECS();+ const c = world.components;++ const eid = () => props.layer.eid;++ const property = createMemo(() => c.KeyframeTrack.property[eid()]);+ const targetEid = createMemo(() => getParentEntity(world, eid()));+ const clipEid = createMemo(() => findClosestParentGeometry(world, eid()));+ const hovering = useEntityTag(c.Hovering, eid);+ const selected = useEntityTag(c.Selected, eid);++ const hasPrev = createMemo(() => {+ const cid = clipEid();+ if (cid === null) return false;+ const delay = c.Computed.delay[cid];+ const localNowFrame = now() - delay;+ return (c.Cache.keyframes[props.layer.eid] ?? []).some(kf => c.Keyframe.time[kf] < localNowFrame);+ });++ const handlePrev = () => {+ const sceneEid = world.selection.scene;+ const fps = world.frameRate;+ const cid = clipEid();+ if (sceneEid === null || cid === null) return;+ const delay = c.Computed.delay[cid];+ const nowFrame = c.Computed.localTime[sceneEid];+ const frames = (c.Cache.keyframes[props.layer.eid] ?? [])+ .map(kf => c.Keyframe.time[kf])+ .sort((a: number, b: number) => b - a);++ for (const frame of frames) {+ const absoluteFrame = delay + frame;+ if (absoluteFrame < nowFrame) {+ c.Computed.localTimeInSeconds[sceneEid] = absoluteFrame / fps;+ c.Computed.localTime[sceneEid] = absoluteFrame;+ break;+ }+ }+ }++ const hasNext = createMemo(() => {+ const cid = clipEid();+ if (cid === null) return false;+ const delay = c.Computed.delay[cid];+ const localNowFrame = now() - delay;+ return (c.Cache.keyframes[props.layer.eid] ?? []).some(kf => c.Keyframe.time[kf] > localNowFrame);+ });++ const handleNext = () => {+ const sceneEid = world.selection.scene;+ const fps = world.frameRate;+ const cid = clipEid();+ if (sceneEid === null || cid === null) return;+ const delay = c.Computed.delay[cid];+ const nowFrame = c.Computed.localTime[sceneEid];+ const frames = (c.Cache.keyframes[props.layer.eid] ?? [])+ .map(kf => c.Keyframe.time[kf])+ .sort((a: number, b: number) => a - b);++ for (const frame of frames) {+ const absoluteFrame = delay + frame;+ if (absoluteFrame > nowFrame) {+ c.Computed.localTimeInSeconds[sceneEid] = absoluteFrame / fps;+ c.Computed.localTime[sceneEid] = absoluteFrame;+ break;+ }+ }+ }++ const handlePointerEnter = () => addComponent(world, props.layer.eid, c.Hovering, false);+ const handlePointerLeave = () => removeComponent(world, props.layer.eid, c.Hovering, false);++ return (+ <div+ class="w-full flex items-center text-muted-foreground justify-between pl-0.5 pr-2"+ classList={{+ 'bg-accent': selected(),+ 'bg-accent/70': !selected() && hovering(),+ 'bg-accent/40': !selected() && !hovering() && props.ancestorSelected,+ }}+ onPointerEnter={handlePointerEnter}+ onPointerLeave={handlePointerLeave}+ style={{ height: KEYFRAME_TRACK_HEIGHT + 'px' }}+ >+ <div data-layer-label class="flex-1 min-w-0 overflow-hidden">+ <div+ class="flex items-center gap-0.5 w-max"+ style={{+ 'padding-left': `${props.depth * NESTED_INDENT_PX}px`,+ transform: 'translateX(calc(var(--layer-x, 0px) * -1))',+ }}+ >+ <div class="size-4 shrink-0 mr-0.5 flex items-center justify-center overflow-clip">+ <Icon name="keyframe-indicator-default" class="size-6" />+ </div>+ <span class="text-xs px-0.5 shrink-0 whitespace-nowrap">+ {formatProperty(c.KeyframeTrack.property[props.layer.eid])}+ </span>+ </div>+ </div>+ <div class="flex items-center gap-0.5 shrink-0">+ <Tooltip placement="top">+ <TooltipTrigger as={Button} variant="ghost" size="icon" disabled={!hasPrev()} onClick={handlePrev}>+ <Icon name="caret-left" class="size-6" />+ </TooltipTrigger>+ <TooltipPortal>+ <TooltipContent>Previous keyframe</TooltipContent>+ </TooltipPortal>+ </Tooltip>+ <Show when={targetEid()}>+ {(target) => <Keyframe property={property() as PropertyPath} target={target()} />}+ </Show>+ <Tooltip placement="top">+ <TooltipTrigger as={Button} variant="ghost" size="icon" disabled={!hasNext()} onClick={handleNext}>+ <Icon name="caret-right" class="size-6" />+ </TooltipTrigger>+ <TooltipPortal>+ <TooltipContent>Next keyframe</TooltipContent>+ </TooltipPortal>+ </Tooltip>+ </div>+ </div>+ )+}++const PATH_NAMES: Record<PropertyPath, string> = {+ 'position.x': 'Position X',+ 'position.y': 'Position Y',+ 'offset.x': 'Offset X',+ 'offset.y': 'Offset Y',+ 'scale.x': 'Scale X',+ 'scale.y': 'Scale Y',+ 'scale': 'Scale',+ 'rotation': 'Rotation',+ 'skew.x': 'Skew X',+ 'skew.y': 'Skew Y',+ 'opacity': 'Opacity',+ 'color': 'Color',+ 'blur': 'Blur',+ 'volume': 'Volume',+ 'effect.value': 'Value',+ 'width': 'Width',+ 'height': 'Height',+ 'stroke.width': 'Stroke Width',+ 'vertexRadius': 'Radius',+ 'mixedVertexRadius.topLeft': 'Radius TL',+ 'mixedVertexRadius.topRight': 'Radius TR',+ 'mixedVertexRadius.bottomRight': 'Radius BR',+ 'mixedVertexRadius.bottomLeft': 'Radius BL',+ 'stop.offset': 'Offset',+ 'stop.color': 'Color',+ 'stop.opacity': 'Opacity',+ 'chars': 'Text',+};++export function formatProperty(property: string): string {+ return PATH_NAMES[property as PropertyPath]+ ?.split('.')+ ?.map(s => s.charAt(0).toUpperCase() + s.slice(1))+ ?.join(' ') ?? '';+}diff --git a/apps/web/src/components/timeline/layers/layer.tsx b/apps/web/src/components/timeline/layers/layer.tsxnew file mode 100644index 00000000..c5ea2aa4--- /dev/null+++ b/apps/web/src/components/timeline/layers/layer.tsx@@ -0,0 +1,59 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Index } from 'solid-js';+import { Dynamic } from 'solid-js/web';+import { useEngine } from '@/context/engine';+import { useEntityTag } from '@/components/engine';+import { KeyframeLayer } from './keyframe';+import { NodeLayer } from './node';+import { SubItemLayer } from './sub-item';++import type { Component } from 'solid-js';+import type { TimelineNode, TimelineNodeKind } from '@/components/engine/api/timeline-index';++type LayerProps = {+ layer: TimelineNode;+ depth?: number;+ ancestorSelected?: boolean;+}++type LayerRowProps = {+ layer: TimelineNode;+ depth: number;+ expanded: boolean;+ ancestorSelected: boolean;+}++const LAYER_ROWS: Record<TimelineNodeKind, Component<LayerRowProps>> = {+ 'geometry': NodeLayer,+ 'sub-item': SubItemLayer,+ 'keyframe-track': KeyframeLayer,+};++export function Layer(props: LayerProps) {+ const { world } = useEngine();++ const c = world.components;+ const eid = () => props.layer.eid;++ const depth = () => props.depth ?? 0;+ const ancestorSelected = () => props.ancestorSelected ?? false;+ const selected = useEntityTag(c.Selected, eid);++ return (+ <>+ <Dynamic+ component={LAYER_ROWS[props.layer.kind]}+ layer={props.layer}+ depth={depth()}+ expanded={props.layer.expanded}+ ancestorSelected={ancestorSelected()}+ />+ <Index each={props.layer.children}>+ {(child) => <Layer layer={child()} depth={depth() + 1} ancestorSelected={ancestorSelected() || selected()} />}+ </Index>+ </>+ )+}diff --git a/apps/web/src/components/timeline/layers/layers.tsx b/apps/web/src/components/timeline/layers/layers.tsxnew file mode 100644index 00000000..7980146c--- /dev/null+++ b/apps/web/src/components/timeline/layers/layers.tsx@@ -0,0 +1,297 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createMemo, createSignal, Index, onCleanup, onMount, Show } from 'solid-js';+import { Button } from '@/components/ui/button';+import { Icon } from '@/components/ui/icon';+import {+ DropdownMenu,+ DropdownMenuCheckboxItem,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuPortal,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+ DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuTrigger,+} from '@/components/ui/dropdown-menu';+import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from '@/components/ui/tooltip';+import { DEFAULT_CLIP_HEIGHT, RULER_HEIGHT } from '@/components/engine/timeline/config';+import { useTimeline } from '@/context/timeline';+import { useEngine } from '@/context/engine';+import { togglePlayback, splitAtPlayhead, setComponent, clearComponent } from '@/components/engine';+import { useECS } from '@/context/ecs';+import { store } from '@/init';+import { createStoredSignal } from '@/lib/store';+import { Layer } from './layer';+import { LayerContextProvider } from './context';+import { formatFrames, TIME_FORMAT_OPTIONS, type TimeFormat } from '../time-format';+import { createEntity, addComponent, getNextName, appendChild, resizeEntity, reorderEntity } from '@/components/engine';+import { DEFAULT_DURATION_FRAMES } from '@/components/engine/constants';++import type { EngineWorld } from '@/components/engine';+import type { TimelineNode } from '@/components/engine';++export function Layers() {+ const timeline = useTimeline();+ const { world } = useEngine();+ const { now, playing, looping } = useECS();++ const c = world.components;+ const timelineIndex = world.timelineIndex;++ const layers = createMemo(() => timelineIndex().layers);+ const [commonLayerHeight, setCommonLayerHeight] = createSignal(DEFAULT_CLIP_HEIGHT);+ const [timeFormat, setTimeFormat] = createStoredSignal(+ store.define<TimeFormat>('timeline.timeFormat', 'standard'),+ );++ const clock = createMemo(() => formatFrames(now(), world.frameRate, timeFormat()));++ createEffect(() => {+ let sum = 0;+ let count = 0;++ forEachGeometryLayer(layers(), (eid) => {+ sum += (c.ClipHeight[eid] ?? DEFAULT_CLIP_HEIGHT);+ count++;+ });++ if (count === 0) return;++ setCommonLayerHeight(sum / count);+ });++ const handleCommonClipHeightChange = (height: number) => {+ world.history.transaction('Set layer height', () => {+ forEachGeometryLayer(layers(), (eid) => {+ setComponent(world, eid, c.ClipHeight, height);+ });+ });++ setCommonLayerHeight(height);+ }++ const addAdjustmentLayer = () => createAdjustmentLayer(world);++ const toggleLooping = () => {+ const sceneEid = timelineIndex().root;+ if (sceneEid === null) return;++ // Will toggle between 0 and 1+ const currentLoop = c.Playback.loop[sceneEid] ?? 0;+ setComponent(world, sceneEid, c.Playback, { loop: 1 - currentLoop }, false);+ }++ const handlePointerDown = (e: PointerEvent) => {+ if (e.button !== 0 || e.target !== e.currentTarget) return;+ clearComponent(world, c.Selected, false);+ }++ onMount(timeline.mount);+ onCleanup(timeline.unmount);++ return (+ <div class="relative size-full">+ <div+ class="grid grid-cols-1 h-full absolute inset-0 overflow-hidden"+ on:wheel={timeline.scroll}+ style={{ 'grid-template-rows': `${RULER_HEIGHT}px 1fr` }}+ data-timeline-layers-container+ >+ <div class="w-full z-10 flex flex-row gap-1 pl-2 pr-3 items-center text-muted-foreground bg-background">+ <Tooltip placement="top">+ <TooltipTrigger<typeof Button>+ as={(triggerProps) => (+ <Button {...triggerProps} variant="ghost" size="icon" onClick={() => togglePlayback(world)}>+ <Show when={playing()} fallback={<Icon name="play" class="size-6" />}>+ <Icon name="pause" class="size-6" />+ </Show>+ </Button>+ )}+ />+ <TooltipPortal>+ <TooltipContent shortcut="Space">+ {playing() ? 'Pause' : 'Play'}+ </TooltipContent>+ </TooltipPortal>+ </Tooltip>+ <Tooltip placement="top">+ <TooltipTrigger<typeof Button>+ as={(triggerProps) => (+ <Button {...triggerProps} variant="ghost" size="icon" onClick={toggleLooping}>+ <Show when={looping() === 1} fallback={<Icon name="controls-no-loop" />}>+ <Icon name="controls-loop" />+ </Show>+ </Button>+ )}+ />+ <TooltipPortal>+ <TooltipContent>+ {looping() === 1 ? 'Disable loop' : 'Enable loop'}+ </TooltipContent>+ </TooltipPortal>+ </Tooltip>+ <Tooltip placement="top">+ <TooltipTrigger<typeof Button>+ as={(triggerProps) => (+ <Button {...triggerProps} variant="ghost" size="icon" onClick={() => splitAtPlayhead(world)}>+ <Icon name="split" class="size-6" />+ </Button>+ )}+ />+ <TooltipPortal>+ <TooltipContent shortcut="⌘B">Split at playhead</TooltipContent>+ </TooltipPortal>+ </Tooltip>+ <DropdownMenu>+ <Tooltip placement="top">+ <TooltipTrigger<typeof DropdownMenuTrigger>+ as={(triggerProps: object) => (+ <DropdownMenuTrigger<typeof Button>+ {...triggerProps}+ as={(buttonProps) => (+ <Button {...buttonProps} variant="ghost" size="icon">+ <Icon name="more-three-dots" class="size-6" />+ </Button>+ )}+ />+ )}+ />+ <TooltipPortal>+ <TooltipContent>More options</TooltipContent>+ </TooltipPortal>+ </Tooltip>+ <DropdownMenuPortal>+ <DropdownMenuContent class="w-[180px]">+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Layer height</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[140px]">+ <DropdownMenuCheckboxItem+ onSelect={() => handleCommonClipHeightChange(28)}+ checked={commonLayerHeight() === 28}+ >+ Tight+ <span class="text-xxs text-muted-foreground ml-auto">28</span>+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ onSelect={() => handleCommonClipHeightChange(32)}+ checked={commonLayerHeight() === 32}+ >+ Snug+ <span class="text-xxs text-muted-foreground ml-auto">32</span>+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ onSelect={() => handleCommonClipHeightChange(40)}+ checked={commonLayerHeight() === 40}+ >+ Normal+ <span class="text-xxs text-muted-foreground ml-auto">40</span>+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ onSelect={() => handleCommonClipHeightChange(64)}+ checked={commonLayerHeight() === 64}+ >+ Relaxed+ <span class="text-xxs text-muted-foreground ml-auto">64</span>+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ onSelect={() => handleCommonClipHeightChange(116)}+ checked={commonLayerHeight() === 116}+ >+ Loose+ <span class="text-xxs text-muted-foreground ml-auto">116</span>+ </DropdownMenuCheckboxItem>+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ <DropdownMenuSeparator />+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>Time format</DropdownMenuSubTrigger>+ <DropdownMenuPortal>+ <DropdownMenuSubContent class="w-[200px]">+ <DropdownMenuRadioGroup+ value={timeFormat()}+ onChange={(value) => setTimeFormat(value as TimeFormat)}+ >+ <Index each={TIME_FORMAT_OPTIONS}>+ {(option) => (+ <DropdownMenuRadioItem value={option().value}>+ {option().label}+ <span class="text-xxs text-muted-foreground ml-auto">+ {option().example}+ </span>+ </DropdownMenuRadioItem>+ )}+ </Index>+ </DropdownMenuRadioGroup>+ </DropdownMenuSubContent>+ </DropdownMenuPortal>+ </DropdownMenuSub>+ <DropdownMenuSeparator />+ <DropdownMenuItem onSelect={addAdjustmentLayer}>+ Add adjustment layer+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>+ <span class="text-xs font-mono font-thin ml-auto select-none">+ {clock()}+ </span>+ </div>+ <div+ data-timeline-layers+ class="relative h-full z-0 group/layers flex flex-col pb-0.5"+ onPointerDown={handlePointerDown}+ >+ <LayerContextProvider>+ <Index each={layers()}>+ {(layer) => <Layer layer={layer()} />}+ </Index>+ </LayerContextProvider>+ </div>+ </div>+ </div>+ );+}++function forEachGeometryLayer(nodes: TimelineNode[], fn: (eid: number) => void) {+ for (const node of nodes) {+ if (node.kind === 'geometry') {+ fn(node.eid);+ }+ forEachGeometryLayer(node.children, fn);+ }+};++function createAdjustmentLayer(world: EngineWorld): number | null {+ const c = world.components;+ const sceneEid = world.selection.scene;+ if (sceneEid === null) return null;++ const width = Math.max(1, Math.round(c.Computed.width[sceneEid] ?? 0));+ const height = Math.max(1, Math.round(c.Computed.height[sceneEid] ?? 0));++ return world.history.transaction('Add adjustment layer', () => {+ const eid = createEntity(world);+ addComponent(world, eid, c.AdjustmentLayer);+ setComponent(world, eid, c.Name, getNextName(world, 'Adjustment Layer'));+ setComponent(world, eid, c.Position, { x: 0, y: 0 });++ setComponent(world, eid, c.Trim, { start: 0, end: DEFAULT_DURATION_FRAMES });+ appendChild(world, eid, sceneEid);+ resizeEntity(world, eid, { width, height });++ reorderEntity(world, eid, 'front');++ clearComponent(world, c.Selected, false);+ addComponent(world, eid, c.Selected, false);++ return eid;+ });+}diff --git a/apps/web/src/components/timeline/layers/node.tsx b/apps/web/src/components/timeline/layers/node.tsxnew file mode 100644index 00000000..7199ab67--- /dev/null+++ b/apps/web/src/components/timeline/layers/node.tsx@@ -0,0 +1,643 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, createSignal, Show } from 'solid-js';+import { hasComponent, Not, Or, query } from 'bitecs';+import { Button } from '@/components/ui/button';+import { Icon } from '@/components/ui/icon';+import {+ ContextMenu,+ ContextMenuContent,+ ContextMenuItem,+ ContextMenuPortal,+ ContextMenuSeparator,+ ContextMenuShortcut,+ ContextMenuTrigger,+} from '@/components/ui/context-menu';+import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from '@/components/ui/tooltip';+import { DEFAULT_CLIP_HEIGHT, MAX_CLIP_HEIGHT, MIN_CLIP_HEIGHT } from '@/components/engine/timeline/config';+import { useEngine } from '@/context/engine';+import {+ useEntityState,+ useEntityTag,+ deleteEntity,+ addComponent,+ removeComponent,+ setComponent,+ reorderEntity,+ getParentEntity,+ getEntityTree,+ appendChild,+ removeChild,+ sortByItemIndex,+ ChildOf,+ type EngineWorld,+ isScene,+ isGroup,+ findGeometryAsset,+ clearComponent,+ isMask,+ isCaption,+ isText,+ isAdjustmentLayer,+ isSequence,+} from '@/components/engine';+import { NESTED_INDENT_PX } from './config';+import { useLayerContext, type DropPosition, type LayerDragState } from './context';++import type { TimelineNode } from '@/components/engine/api/timeline-index';++type NodeLayerProps = {+ layer: TimelineNode;+ depth?: number;+ expanded: boolean;+ ancestorSelected: boolean;+}++const DRAG_THRESHOLD_PX = 4;++export function NodeLayer(props: NodeLayerProps) {+ const { world } = useEngine();++ const c = world.components;++ const depth = () => props.depth ?? 0;++ const eid = () => props.layer.eid;+++ const height = useEntityState(c.ClipHeight, eid, DEFAULT_CLIP_HEIGHT);++ const muted = useEntityTag(c.Muted, eid);+ const soloed = useEntityTag(c.Soloed, eid);+ const hidden = useEntityTag(c.Hidden, eid);+ const hovering = useEntityTag(c.Hovering, eid);+ const selected = useEntityTag(c.Selected, eid);+ const controlsVisible = createMemo(() => hovering() || muted() || soloed() || hidden());++ const [resizedId, setResizedId] = useLayerContext().resizedId;+ const [dragState, setDragState] = useLayerContext().dragState;++ const [editing, setEditing] = createSignal(false);+ let originalName = '';++ const canExpand = () => props.layer.expandable;+ const nameState = useEntityState(c.Name, eid);+ const name = createMemo(() => nameState() ?? `Layer ${eid()}`);+ const icon = createMemo(() => getLayerIcon(world, props.layer));++ const dropPosition = createMemo(() => {+ if (dragState()?.targetEid === props.layer.eid) {+ return dragState()?.position ?? null;+ }+ return null;+ });++ const toggleTag = (tag: typeof c.Muted) => {+ const eid = props.layer.eid;+ if (hasComponent(world, eid, tag)) {+ removeComponent(world, eid, tag);+ } else {+ addComponent(world, eid, tag);+ }+ }++ const toggleMuted = (e?: Event) => {+ e?.stopPropagation();+ toggleTag(c.Muted);+ };+ const toggleHidden = (e?: Event) => {+ e?.stopPropagation();+ toggleTag(c.Hidden);+ };+ const toggleExpanded = (e?: Event) => {+ e?.stopPropagation();+ toggleTag(c.Expanded);+ };++ const toggleSoloed = (e?: Event) => {+ e?.stopPropagation();+ const eid = props.layer.eid;++ const wasSoloed = hasComponent(world, eid, c.Soloed);++ clearComponent(world, c.Soloed, false);+ if (!wasSoloed) {+ addComponent(world, eid, c.Soloed);+ }+ }++ const handleSelect = (e: { shiftKey: boolean }) => {+ if (e.shiftKey) {+ addComponent(world, props.layer.eid, c.Selected, false);+ } else {+ clearComponent(world, c.Selected, false);+ addComponent(world, props.layer.eid, c.Selected, false);+ }+ }++ const handleRowPointerDown = (e: PointerEvent) => {+ if (e.button !== 0) return;+ if (resizedId() != null) return;+ if ((e.target as HTMLElement | null)?.closest('button')) return;++ handleSelect(e);++ const startX = e.clientX;+ const startY = e.clientY;+ let dragging = false;++ const onMove = (ev: PointerEvent) => {+ const deltaX = Math.abs(ev.clientX - startX);+ const deltaY = Math.abs(ev.clientY - startY);++ if (!dragging && (deltaX > DRAG_THRESHOLD_PX || deltaY > DRAG_THRESHOLD_PX)) {+ dragging = true;+ }++ if (dragging) {+ setDragState(findClosestLayer(world, ev));+ }+ };++ const onUp = (ev: PointerEvent) => {+ document.removeEventListener('pointermove', onMove);+ document.removeEventListener('pointerup', onUp);++ if (!dragging) return;++ dropSelection(world, findClosestLayer(world, ev));++ setDragState(null);+ clearComponent(world, c.Selected, false);+ };++ document.addEventListener('pointermove', onMove);+ document.addEventListener('pointerup', onUp);+ };++ let startY = 0;+ let startHeight = 0;++ const handleResizeStart = (e: PointerEvent) => {+ e.preventDefault();+ e.stopPropagation();+ startY = e.clientY;+ startHeight = height();+ setResizedId(props.layer.eid);++ document.addEventListener('pointermove', handleResizeMove);+ document.addEventListener('pointerup', handleResizeEnd);+ }++ const handleResizeMove = (e: PointerEvent) => {+ const deltaY = e.clientY - startY;+ const newHeight = Math.max(MIN_CLIP_HEIGHT, Math.min(MAX_CLIP_HEIGHT, startHeight + deltaY));+ setComponent(world, props.layer.eid, c.ClipHeight, newHeight);+ }++ const handleResizeEnd = () => {+ setResizedId(null);+ document.removeEventListener('pointermove', handleResizeMove);+ document.removeEventListener('pointerup', handleResizeEnd);+ }++ const handleRemove = () => deleteEntity(world, props.layer.eid);+ const handleReorder = (target: 'front' | 'back') => reorderEntity(world, props.layer.eid, target);++ const handlePointerEnter = () => {+ clearComponent(world, c.Hovering, false);+ addComponent(world, props.layer.eid, c.Hovering, false);+ }+ const handlePointerLeave = () => {+ clearComponent(world, c.Hovering, false);+ removeComponent(world, props.layer.eid, c.Hovering, false);+ }++ const startEditing = () => {+ originalName = c.Name[eid()] ?? '';+ world.history.startTransaction('Rename layer');+ setEditing(true);+ };++ const finishEditing = (input: HTMLInputElement) => {+ if (!editing()) return;+ if (!input.value.trim()) {+ setComponent(world, eid(), c.Name, originalName);+ }+ world.history.commitTransaction();+ setEditing(false);+ };++ const handleNameInput = (e: InputEvent) => {+ const input = e.currentTarget as HTMLInputElement;+ setComponent(world, eid(), c.Name, input.value ?? '');+ };++ const handleNameKeyDown = (e: KeyboardEvent) => {+ e.stopPropagation();+ const input = e.currentTarget as HTMLInputElement;+ if (e.key === 'Escape') {+ setComponent(world, eid(), c.Name, originalName);+ input.blur();+ } else if (e.key === 'Enter') {+ input.blur();+ }+ };++ const mountNameInput = (input: HTMLInputElement) => {+ queueMicrotask(() => {+ input.focus();+ input.select();+ });+ };++ return (+ <ContextMenu>+ <ContextMenuTrigger+ as="div"+ class="w-full text-muted-foreground group relative select-none"+ data-layer-eid={props.layer.eid}+ onPointerEnter={handlePointerEnter}+ onPointerLeave={handlePointerLeave}+ onPointerDown={handleRowPointerDown}+ classList={{+ 'bg-accent': selected(),+ 'bg-accent/70': !selected() && hovering() && resizedId() == null,+ 'bg-accent/40': !selected() && !(hovering() && resizedId() == null) && props.ancestorSelected,+ }}+ style={{ height: height() + 'px' }}+ >+ <div class="w-full pl-0.5 pr-2 flex items-center justify-between h-full">+ <div+ data-layer-label+ class="flex-1 min-w-0 overflow-hidden"+ style={{+ 'mask-image': controlsVisible() && !editing() ? 'linear-gradient(to right, #000 calc(100% - 1.25rem), transparent)' : undefined,+ '-webkit-mask-image': controlsVisible() && !editing() ? 'linear-gradient(to right, #000 calc(100% - 1.25rem), transparent)' : undefined,+ }}+ >+ <div+ class="flex items-center gap-0.5 w-max"+ style={{+ 'padding-left': `${depth() * NESTED_INDENT_PX}px`,+ transform: editing() ? 'none' : 'translateX(calc(var(--layer-x, 0px) * -1))',+ }}+ >+ <button+ disabled={!canExpand()}+ onClick={toggleExpanded}+ class="size-4 shrink-0 flex items-center justify-center overflow-clip invisible group-hover/layers:visible focus-ring rounded-sm">+ <Show when={canExpand()}>+ <Icon name={props.expanded ? "chevron-down" : "chevron-right"} class="size-6 hover:text-foreground" />+ </Show>+ </button>+ <div class="size-4 shrink-0 flex items-center justify-center overflow-clip mr-0.5">+ <Icon name={icon()} class="size-6" />+ </div>+ <Show+ when={editing()}+ fallback={+ <span class="text-xs px-0.5 shrink-0 whitespace-nowrap" onDblClick={startEditing}>+ {name()}+ </span>+ }+ >+ <input+ ref={mountNameInput}+ type="text"+ class="text-xs bg-input border border-primary rounded-sm outline-none px-0.5 w-32"+ value={name()}+ onInput={handleNameInput}+ onKeyDown={handleNameKeyDown}+ onBlur={(e) => finishEditing(e.currentTarget)}+ onPointerDown={(e) => e.stopPropagation()}+ onDblClick={(e) => e.stopPropagation()}+ />+ </Show>+ </div>+ </div>++ <div+ class="items-center flex gap-0.5 shrink-0 overflow-hidden group-hover:w-auto"+ classList={{+ 'hidden': resizedId() != null,+ 'w-0': !(muted() || soloed() || hidden()),+ 'w-auto': muted() || soloed() || hidden(),+ }}+ >+ <Tooltip placement="bottom">+ <TooltipTrigger+ as={Button}+ variant={muted() ? "on" : "ghost"}+ size="icon"+ class="invisible group-hover:visible"+ style={{ visibility: muted() ? 'visible' : undefined }}+ onClick={toggleMuted}+ >+ <Icon name="mute" class="size-6" />+ </TooltipTrigger>+ <TooltipPortal>+ <TooltipContent>{muted() ? "Unmute" : "Mute"}</TooltipContent>+ </TooltipPortal>+ </Tooltip>+ <Tooltip placement="bottom">+ <TooltipTrigger+ as={Button}+ variant={soloed() ? "on" : "ghost"}+ size="icon"+ class="invisible group-hover:visible"+ style={{ visibility: soloed() ? 'visible' : undefined }}+ onClick={toggleSoloed}+ >+ <Icon name="solo" class="size-6" />+ </TooltipTrigger>+ <TooltipPortal>+ <TooltipContent>{soloed() ? "Unsolo" : "Solo"}</TooltipContent>+ </TooltipPortal>+ </Tooltip>+ <Tooltip placement="bottom">+ <TooltipTrigger+ as={Button}+ variant="ghost"+ size="icon"+ class="invisible group-hover:visible"+ onClick={toggleHidden}+ style={{ visibility: hidden() ? 'visible' : undefined }}+ >+ <Show when={!hidden()} fallback={<Icon name="eye-off" class="size-6" />}>+ <Icon name="eye-on" class="size-6" />+ </Show>+ </TooltipTrigger>+ <TooltipPortal>+ <TooltipContent>{hidden() ? "Show" : "Hide"}</TooltipContent>+ </TooltipPortal>+ </Tooltip>+ </div>+ </div>++ {/* Resize handle at the bottom */}+ <div+ class="absolute bottom-0 left-0 right-0 h-[3px] cursor-ns-resize translate-y-0.5 z-20 group/resize"+ classList={{ 'hidden': dragState() !== null }}+ onPointerDown={handleResizeStart}+ >+ <div+ class="absolute left-0 right-0 top-px h-px transition-colors group-hover/resize:bg-primary"+ classList={{ 'bg-primary': resizedId() === props.layer.eid }}+ />+ </div>++ {/* Drag-to-reparent drop indicators */}+ <Show when={dropPosition() === 'above'}>+ <div class="pointer-events-none absolute top-0 left-0 right-0 h-[2px] bg-primary z-30" />+ </Show>+ <Show when={dropPosition() === 'below'}>+ <div class="pointer-events-none absolute bottom-0 left-0 right-0 h-[2px] bg-primary z-30" />+ </Show>+ <Show when={dropPosition() === 'inside'}>+ <div class="pointer-events-none absolute inset-0 ring-2 ring-inset ring-primary z-30" />+ </Show>+ </ContextMenuTrigger>+ <ContextMenuPortal>+ <ContextMenuContent class="w-[160px]">+ <ContextMenuItem onSelect={toggleMuted}>+ {muted() ? 'Unmute' : 'Mute'}+ </ContextMenuItem>+ <ContextMenuItem onSelect={toggleSoloed}>+ {soloed() ? 'Unsolo' : 'Solo'}+ </ContextMenuItem>+ <ContextMenuItem onSelect={toggleHidden}>+ {hidden() ? 'Unhide' : 'Hide'}+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={() => handleReorder('front')}>+ Bring to front+ <ContextMenuShortcut>]</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuItem onSelect={() => handleReorder('back')}>+ Send to back+ <ContextMenuShortcut>[</ContextMenuShortcut>+ </ContextMenuItem>+ <ContextMenuSeparator />+ <ContextMenuItem onSelect={handleRemove}>+ Remove+ </ContextMenuItem>+ </ContextMenuContent>+ </ContextMenuPortal>+ </ContextMenu>+ )+}++export function findClosestLayer(world: EngineWorld, ev: PointerEvent): LayerDragState | null {+ const c = world.components;++ const el = document.elementFromPoint(ev.clientX, ev.clientY) as HTMLElement | null;+ const match = el?.closest('[data-layer-eid]') as HTMLElement | null;+ if (!match) return null;++ const targetEid = Number(match.dataset.layerEid);+ if (!Number.isFinite(targetEid)) return null;++ // Never drop relative to a row that is itself part of the dragged selection.+ if (hasComponent(world, targetEid, c.Selected)) return null;++ const rect = match.getBoundingClientRect();+ const relY = ev.clientY - rect.top;++ // Groups are containers, so their middle band is an `inside` (reparent-as-+ // child) zone — regardless of whether they're currently expanded. Everything+ // else only gets `above`/`below` sibling zones.+ let position: DropPosition;+ if (isGroup(world, targetEid)) {+ if (relY < rect.height * 0.25) position = 'above';+ else if (relY > rect.height * 0.75) position = 'below';+ else position = 'inside';+ } else {+ position = relY < rect.height * 0.5 ? 'above' : 'below';+ }++ if (position === 'below') {+ const next = nextDroppableRow(world, match);+ if (next !== null) {+ return { position: 'above', targetEid: next };+ }+ }++ return { position, targetEid };+}++/**+ * The eid of the first non-selected geometry/group row that follows `row` in+ * visual order, or null if `row` is the last droppable row. Sub-item and+ * keyframe rows don't carry `data-layer-eid` and are skipped.+ */+function nextDroppableRow(world: EngineWorld, row: HTMLElement): number | null {+ const c = world.components;+ const rows = Array.from(document.querySelectorAll<HTMLElement>('[data-layer-eid]'));+ const idx = rows.indexOf(row);+ if (idx === -1) return null;++ for (let i = idx + 1; i < rows.length; i++) {+ const eid = Number(rows[i].dataset.layerEid);+ if (!Number.isFinite(eid)) continue;+ // Skip rows being dragged — they aren't valid drop anchors.+ if (hasComponent(world, eid, c.Selected)) continue;+ return eid;+ }++ return null;+}++/**+ * Reparent the entire geometry selection relative to a drop target.+ * - `inside` — selection becomes the last children of the target.+ * - `above` / `below` — selection becomes siblings of the target, in order.+ *+ * The selection's DFS order from the timeline index is preserved; descendants+ * of already-selected items are dropped (they move with the ancestor). The+ * operation is a no-op if the target sits inside the dragged subtree.+ */+function dropSelection(world: EngineWorld, target: LayerDragState | null) {+ if (!target || target.targetEid === null || target.position === null) return;++ const c = world.components;+ const targetEid = target.targetEid;+ const position = target.position;++ const newParent = position === 'inside'+ ? targetEid+ : getParentEntity(world, targetEid);+ if (newParent === null) return;++ // Collect the selection in DFS order, skipping descendants of items whose+ // ancestor is already selected — those move with their ancestor.+ const selection = new Set(query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(c.Deleted)]));+ if (selection.size === 0) return;++ const ordered: number[] = [];+ const walk = (nodes: TimelineNode[]) => {+ for (const node of nodes) {+ if (selection.has(node.eid)) {+ ordered.push(node.eid);+ continue;+ }+ walk(node.children);+ }+ };+ walk(world.timelineIndex().layers);+ if (ordered.length === 0) return;++ // Block cycles: target cannot lie inside any dragged entity's subtree.+ for (const eid of ordered) {+ if (getEntityTree(world, eid).includes(targetEid)) return;+ }++ world.history.transaction('Reparent layers', () => {+ // Dropping into a collapsed group would hide the moved items — expand it so+ // the result is visible.+ if (position === 'inside' && !hasComponent(world, newParent, c.Expanded)) {+ addComponent(world, newParent, c.Expanded);+ }++ // Reparent items whose current parent differs from the new parent.+ let reparented = false;+ for (const eid of ordered) {+ const currentParent = getParentEntity(world, eid);+ if (currentParent === newParent) continue;+ if (currentParent !== null) removeChild(world, eid, currentParent);+ appendChild(world, eid, newParent);+ reparented = true;+ }++ // Rebuild ItemIndex on the new parent's geometry siblings, inserting the+ // moved set at the position resolved from the drop target.+ //+ // The layers panel renders siblings top-to-bottom in *descending* ItemIndex+ // (the index builder sorts ascending then reverses), so all reasoning here+ // is done in that same top-to-bottom display order — `ordered` is already+ // collected top-to-bottom — and the indices are written back descending so+ // they survive the round-trip through the index builder.+ const siblings = [...query(world, [ChildOf(newParent), Not(c.Deleted), Or(c.Geometry, c.Group, c.AdjustmentLayer)])];+ siblings.sort(sortByItemIndex(world)).reverse();++ const movedSet = new Set(ordered);+ const rest = siblings.filter(eid => !movedSet.has(eid));++ let insertIndex: number;+ if (position === 'inside') {+ // Drop at the top of the target's children, directly beneath its row.+ insertIndex = 0;+ } else {+ const anchorPos = rest.indexOf(targetEid);+ if (anchorPos === -1) return;+ insertIndex = position === 'above' ? anchorPos : anchorPos + 1;+ }++ const newOrder = [...rest.slice(0, insertIndex), ...ordered, ...rest.slice(insertIndex)];++ // A reparent already pushed history and left the moved items carrying a+ // stale ItemIndex from their old parent, so their position in `siblings`+ // (sorted by that stale value) is meaningless — always rewrite indices in+ // that case. The order-equality check is only a valid no-op guard for a+ // pure same-parent reorder.+ let changed = reparented || newOrder.length !== siblings.length;+ for (let i = 0; !changed && i < newOrder.length; i++) {+ if (newOrder[i] !== siblings[i]) changed = true;+ }+ if (!changed) return;++ // Top of the display list gets the highest ItemIndex.+ const top = newOrder.length - 1;+ for (const [idx, sib] of newOrder.entries()) {+ setComponent(world, sib, c.ItemIndex, top - idx);+ }+ });+}++function getLayerIcon(world: EngineWorld, layer: TimelineNode) {+ if (isMask(world, layer.eid)) {+ return "mask-small"+ }++ if (isAdjustmentLayer(world, layer.eid)) {+ return "adjustment-layer"+ }++ if (isScene(world, layer.eid)) {+ return "scene-frame-small"+ }++ if (isSequence(world, layer.eid)) {+ return "timeline-sequence-small"+ }++ if (isGroup(world, layer.eid)) {+ return "group"+ }++ if (isCaption(world, layer.eid)) {+ return "captions-small"+ }++ if (isText(world, layer.eid)) {+ return "text-small"+ }++ const asset = findGeometryAsset(world, layer.eid);++ if (asset?.type === 'IMAGE') {+ return "image-small"+ }++ if (asset?.type === 'VIDEO') {+ return "video-small"+ }++ if (asset?.type === 'AUDIO') {+ return "audio-small"+ }++ return "rectangle-small"+}\ No newline at end of filediff --git a/apps/web/src/components/timeline/layers/sub-item.tsx b/apps/web/src/components/timeline/layers/sub-item.tsxnew file mode 100644index 00000000..1849111f--- /dev/null+++ b/apps/web/src/components/timeline/layers/sub-item.tsx@@ -0,0 +1,109 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, Show } from 'solid-js';+import { hasComponent } from 'bitecs';+import { Icon } from '@/components/ui/icon';+import { useEngine } from '@/context/engine';+import { addComponent, clearComponent, removeComponent, useEntityTag, EffectType, PaintType } from '@/components/engine';+import { EFFECT_DEFAULTS } from '@/components/sidebar-right/inspector/effects-inspector';+import { NESTED_INDENT_PX } from './config';++import type { TimelineNode } from '@/components/engine/api/timeline-index';+import { KEYFRAME_TRACK_HEIGHT } from '@/components/engine/timeline/config';++type SubItemLayerProps = {+ layer: TimelineNode;+ depth?: number;+ expanded: boolean;+ ancestorSelected: boolean;+}++export function SubItemLayer(props: SubItemLayerProps) {+ const { world } = useEngine();++ const c = world.components;++ const eid = () => props.layer.eid;++ const depth = () => props.depth ?? 0;+ const canExpand = () => props.layer.expandable;+ const hovering = useEntityTag(c.Hovering, eid);+ const selected = useEntityTag(c.Selected, eid);+ const name = createMemo(() => {+ if (c.Name[eid()]) return c.Name[eid()];+ if (hasComponent(world, eid(), c.Stroke)) return 'Stroke';+ if (hasComponent(world, eid(), c.Shadow)) return 'Shadow';+ if (hasComponent(world, eid(), c.Paint)) {+ if (c.Paint[eid()] === PaintType.LINEAR_GRADIENT) return 'Gradient';+ if (c.Paint[eid()] === PaintType.RADIAL_GRADIENT) return 'Gradient';+ if (c.Paint[eid()] === PaintType.SOLID) return 'Solid';+ if (c.Paint[eid()] === PaintType.IMAGE) return 'Image';+ if (c.Paint[eid()] === PaintType.VIDEO) return 'Video';+ if (c.Paint[eid()] === PaintType.SEQUENCE) return 'Sequence';+ if (c.Paint[eid()] === PaintType.WAVEFORM) return 'Waveform';+ return 'Fill';+ }+ if (hasComponent(world, eid(), c.ColorStop)) return 'Stop';+ if (hasComponent(world, eid(), c.Effect)) {+ const type = c.Effect.type[eid()] as Exclude<EffectType, EffectType.DROP_SHADOW>;+ return EFFECT_DEFAULTS[type]?.label ?? `Sub-item ${eid()}`;+ }+ return `Sub-item ${eid()}`;+ });++ const toggleExpanded = () => {+ const eid = props.layer.eid;+ if (hasComponent(world, eid, c.Expanded)) {+ removeComponent(world, eid, c.Expanded);+ } else {+ addComponent(world, eid, c.Expanded);+ }+ }++ const handlePointerEnter = () => {+ clearComponent(world, c.Hovering, false);+ addComponent(world, props.layer.eid, c.Hovering, false);+ }+ const handlePointerLeave = () => {+ clearComponent(world, c.Hovering, false);+ removeComponent(world, props.layer.eid, c.Hovering, false);+ }++ return (+ <div+ class="w-full pl-0.5 pr-2 flex items-center text-muted-foreground justify-between"+ classList={{+ 'bg-accent': selected(),+ 'bg-accent/70': !selected() && hovering(),+ 'bg-accent/40': !selected() && !hovering() && props.ancestorSelected,+ }}+ onPointerEnter={handlePointerEnter}+ onPointerLeave={handlePointerLeave}+ style={{ height: KEYFRAME_TRACK_HEIGHT + 'px' }}+ >+ <div data-layer-label class="flex-1 min-w-0 overflow-hidden">+ <div+ class="flex items-center gap-0.5 w-max"+ style={{+ 'padding-left': `${depth() * NESTED_INDENT_PX}px`,+ transform: 'translateX(calc(var(--layer-x, 0px) * -1))',+ }}+ >+ <button+ disabled={!canExpand()}+ onClick={toggleExpanded}+ class="size-4 shrink-0 flex items-center justify-center overflow-clip invisible group-hover/layers:visible focus-ring rounded-sm mr-0.5">+ <Show when={canExpand()}>+ <Icon name={props.expanded ? "chevron-down" : "chevron-right"} class="size-6 hover:text-foreground" />+ </Show>+ </button>+ <span class="text-xs px-0.5 shrink-0 whitespace-nowrap">+ {name()}+ </span>+ </div>+ </div>+ </div>+ )+}diff --git a/apps/web/src/components/timeline/time-format.ts b/apps/web/src/components/timeline/time-format.tsnew file mode 100644index 00000000..4906ad52--- /dev/null+++ b/apps/web/src/components/timeline/time-format.ts@@ -0,0 +1,49 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export type TimeFormat = 'standard' | 'timecode' | 'frames';++export const TIME_FORMAT_OPTIONS: { value: TimeFormat; label: string; example: string }[] = [+ { value: 'standard', label: 'Standard', example: 'MM:SS:CS' },+ { value: 'timecode', label: 'Timecode', example: 'HH:MM:SS:FF' },+ { value: 'frames', label: 'Frames', example: '30f' },+];++function pad(value: number) {+ return Math.floor(value).toString().padStart(2, '0');+}++/**+ * Formats a frame position into a display string according to the+ * selected {@link TimeFormat}.+ *+ * - `standard`: minutes, seconds and centiseconds (`MM:SS:CS`)+ * - `timecode`: hours, minutes, seconds and frames (`HH:MM:SS:FF`)+ * - `frames`: the raw frame count (e.g. `30f`)+ */+export function formatFrames(frame: number, fps: number, format: TimeFormat) {+ const safeFps = Number.isFinite(fps) && fps > 0 ? fps : 30;+ const safeFrame = Number.isFinite(frame) ? Math.max(0, frame) : 0;++ switch (format) {+ case 'frames':+ return `${Math.round(safeFrame)}f`;+ case 'timecode': {+ const totalSeconds = Math.floor(safeFrame / safeFps);+ const hours = Math.floor(totalSeconds / 3600);+ const minutes = Math.floor((totalSeconds % 3600) / 60);+ const seconds = totalSeconds % 60;+ const frames = Math.floor(safeFrame % safeFps);+ return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}:${pad(frames)}`;+ }+ case 'standard':+ default: {+ const t = safeFrame / safeFps;+ const minutes = Math.floor(t / 60);+ const seconds = Math.floor(t % 60);+ const centiseconds = Math.floor((t % 1) * 100);+ return `${pad(minutes)}:${pad(seconds)}:${pad(centiseconds)}`;+ }+ }+}diff --git a/apps/web/src/components/timeline/timeline.tsx b/apps/web/src/components/timeline/timeline.tsxnew file mode 100644index 00000000..3c156e4f--- /dev/null+++ b/apps/web/src/components/timeline/timeline.tsx@@ -0,0 +1,183 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */+++import { onCleanup, onMount } from 'solid-js';+import { toast } from 'somoto';+import { useEngine } from '@/context/engine';+import { secondsToFrames, getNextName, GeometryType, PaintType, createEntity, switchActiveScene, addComponent, appendChild, setComponent, resizeEntity } from '@/components/engine';+import { loadAsset } from "@/components/engine";+import { useTimeline } from '@/context/timeline';++import type { Asset } from '@/components/engine/db';+import type { Transcript } from '@diffusionstudio/api-contract';++export function Timeline() {+ const timeline = useTimeline();+ const { world, camera } = useEngine();+++ const c = world.components;++ let root!: HTMLDivElement;+++ onMount(() => {+ timeline.attachCanvas();+ });++ onCleanup(() => {+ timeline.detachCanvas();+ });++ const handleDropEvent = async (event: DragEvent) => {+ event.preventDefault();+ event.stopPropagation();++ const dropFrame = Math.max(0, timeline.clientToFrame(event.clientX));++ const droppedAssets: Asset[] = [];+ const assetIds = event.dataTransfer?.getData('application/x-asset-id')?.split(',').filter(Boolean);+ if (assetIds && assetIds.length > 0) {+ for (const id of assetIds) {+ const asset = world.assets.get(id);+ if (asset) droppedAssets.push(asset);+ }+ } else {+ const items = Array.from(event.dataTransfer?.items ?? []).filter(item => item.kind === 'file');+ for (const item of items) {+ try {+ droppedAssets.push(await loadAsset(world, item));+ } catch (e) {+ toast('Failed to import assets', {+ description: (e as Error).message,+ });+ }+ }+ }++ if (droppedAssets.length === 0) return;++ let activeScene = world.timelineIndex().root;+ if (activeScene === null) {+ const sized = droppedAssets.find(a => a.type === 'IMAGE' || a.type === 'VIDEO' || a.type === 'SEQUENCE');+ const sceneWidth = sized ? Math.round(sized.width) : 1920;+ const sceneHeight = sized ? Math.round(sized.height) : 1080;+ const worldX = Math.round(-sceneWidth / 2);+ const worldY = Math.round(-sceneHeight / 2);++ const sid = world.history.transaction('Add scene', () => {+ const sceneEid = createEntity(world);+ setComponent(world, sceneEid, c.Geometry, GeometryType.RECT);+ addComponent(world, sceneEid, c.Scene);+ addComponent(world, sceneEid, c.ClipsContent);+ setComponent(world, sceneEid, c.Playback, {});+ setComponent(world, sceneEid, c.Name, getNextName(world, 'Scene'));+ setComponent(world, sceneEid, c.Position, { x: worldX, y: worldY });+ resizeEntity(world, sceneEid, { width: sceneWidth, height: sceneHeight });+ setComponent(world, sceneEid, c.Color, 0x000000);++ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.SOLID);+ setComponent(world, fillEid, c.Color, 0x000000);+ appendChild(world, fillEid, sceneEid);+ return sceneEid;+ });++ switchActiveScene(world, sid);+ camera.centerRect({ x: worldX, y: worldY, width: sceneWidth, height: sceneHeight });+ activeScene = sid;+ }++ const sceneEid = activeScene;+ const delay = dropFrame;++ const placeAsset = async (asset: Asset) => {+ // Resolve async transcript data before opening the transaction so the+ // mutations stay synchronous — concurrent placeAsset calls (Promise.all)+ // must not interleave inside a shared transaction.+ let transcriptTrim: { start: number; end: number } | null = null;+ if (asset.type === 'TRANSCRIPT') {+ const file = await asset.handle.getFile();+ const transcript = JSON.parse(await file.text()) as Transcript;+ const lastWord = transcript.at(-1)?.words.at(-1);+ const firstWord = transcript.at(0)?.words.at(0);+ transcriptTrim = {+ start: secondsToFrames(firstWord?.start),+ end: secondsToFrames(lastWord?.end),+ };+ }++ world.history.transaction('Add clip', () => {+ const eid = createEntity(world);+ setComponent(world, eid, c.Name, asset.name);+ setComponent(world, eid, c.Delay, delay);++ if (asset.type === 'IMAGE' || asset.type === 'VIDEO' || asset.type === 'SEQUENCE') {+ // Author dimensions from the source media; spatial layout is centered by+ // the transform system since no Position is set here.+ const width = Math.round(asset.width);+ const height = Math.round(asset.height);+ resizeEntity(world, eid, { width, height });+ setComponent(world, eid, c.KeepAspectRatio, { width, height });+ }++ if (asset.type === 'TRANSCRIPT') {+ setComponent(world, eid, c.Geometry, GeometryType.TEXT);+ setComponent(world, eid, c.Caption, {});+ if (transcriptTrim) setComponent(world, eid, c.Trim, transcriptTrim);+ } else {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);++ // Other assets need a paint component+ let paint = PaintType.IMAGE;+ if (asset.type === 'SEQUENCE') paint = PaintType.SEQUENCE;+ if (asset.type === 'VIDEO') paint = PaintType.VIDEO;+ if (asset.type === 'AUDIO') paint = PaintType.WAVEFORM;+ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, paint);+ setComponent(world, fillEid, c.AssetId, asset.id);++ if (asset.type === 'AUDIO') {+ addComponent(world, fillEid, c.Hidden);+ }++ appendChild(world, fillEid, eid);+ }++ if (asset.type === 'AUDIO') {+ addComponent(world, eid, c.Audio);+ resizeEntity(world, eid, { width: 500, height: 150 });+ }++ if (asset.type === 'AUDIO' || asset.type === 'TRANSCRIPT') {+ setComponent(world, eid, c.AssetId, asset.id);+ }++ appendChild(world, eid, sceneEid);+ });+ };++ await Promise.all(droppedAssets.map(asset => placeAsset(asset)));+ }++ const handleDragOver = (event: DragEvent) => {+ event.preventDefault();+ event.dataTransfer!.dropEffect = 'copy';+ }++ return (+ <div+ ref={root}+ class="relative size-full"+ >+ <canvas+ class="absolute inset-0"+ id="timeline-canvas"+ on:drop={handleDropEvent}+ on:dragover={handleDragOver}+ />+ </div>+ );+}diff --git a/apps/web/src/components/ui/adopt-node.tsx b/apps/web/src/components/ui/adopt-node.tsxnew file mode 100644index 00000000..7935fab3--- /dev/null+++ b/apps/web/src/components/ui/adopt-node.tsx@@ -0,0 +1,22 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { onMount, type JSX } from "solid-js";+import { insert } from "solid-js/web";++type AdoptNodeProps = {+ node: Node;+ class?: string;+ children?: JSX.Element;+};++export function AdoptNode(props: AdoptNodeProps) {+ let anchor!: HTMLDivElement;++ onMount(() => {+ insert(anchor, props.node);+ });++ return <div ref={anchor} class={props.class}>{props.children}</div>;+}diff --git a/apps/web/src/components/ui/alert-dialog.tsx b/apps/web/src/components/ui/alert-dialog.tsxnew file mode 100644index 00000000..be984b40--- /dev/null+++ b/apps/web/src/components/ui/alert-dialog.tsx@@ -0,0 +1,177 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/alert-dialog++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { AlertDialog as AlertDialogPrimitive } from "@kobalte/core/alert-dialog"++import { cx } from "@/lib/cva"++import { buttonVariants } from "./button"++export const AlertDialogPortal = AlertDialogPrimitive.Portal++export type AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive>++export const AlertDialog = (props: AlertDialogProps) => {+ return <AlertDialogPrimitive data-slot="alert-dialog" {...props} />+}++export type AlertDialogTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof AlertDialogPrimitive.Trigger<T>>++export const AlertDialogTrigger = <T extends ValidComponent = "button">(+ props: AlertDialogTriggerProps<T>,+) => {+ return (+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />+ )+}++export type AlertDialogOverlayProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof AlertDialogPrimitive.Overlay<T>>++export const AlertDialogOverlay = <T extends ValidComponent = "div">(+ props: AlertDialogOverlayProps<T>,+) => {+ const [, rest] = splitProps(props as AlertDialogOverlayProps, ["class"])++ return (+ <AlertDialogPrimitive.Overlay+ data-slot="alert-dialog-overlay"+ class={cx(+ "data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 fixed inset-0 z-50 bg-overlay",+ props.class,+ )}+ {...rest}+ />+ )+}++export type AlertDialogContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof AlertDialogPrimitive.Content<T>>++export const AlertDialogContent = <T extends ValidComponent = "div">(+ props: AlertDialogContentProps<T>,+) => {+ const [, rest] = splitProps(props as AlertDialogContentProps, ["class"])++ return (+ <>+ <AlertDialogOverlay />+ <AlertDialogPrimitive.Content+ data-slot="alert-dialog-content"+ class={cx(+ "bg-background data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",+ props.class,+ )}+ {...rest}+ />+ </>+ )+}++export type AlertDialogHeaderProps = ComponentProps<"div">++export const AlertDialogHeader = (props: AlertDialogHeaderProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="alert-dialog-header"+ class={cx("flex flex-col gap-2 text-center sm:text-left", props.class)}+ {...rest}+ />+ )+}++export type AlertDialogFooterProps = ComponentProps<"div">++export const AlertDialogFooter = (props: AlertDialogFooterProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="alert-dialog-footer"+ class={cx(+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",+ props.class,+ )}+ {...rest}+ />+ )+}++export type AlertDialogTitleProps<T extends ValidComponent = "h2"> =+ ComponentProps<typeof AlertDialogPrimitive.Title<T>>++export const AlertDialogTitle = <T extends ValidComponent = "h2">(+ props: AlertDialogTitleProps<T>,+) => {+ const [, rest] = splitProps(props as AlertDialogTitleProps, ["class"])++ return (+ <AlertDialogPrimitive.Title+ data-slot="alert-dialog-title"+ class={cx("text-lg font-semibold", props.class)}+ {...rest}+ />+ )+}++export type AlertDialogDescriptionProps<T extends ValidComponent = "p"> =+ ComponentProps<typeof AlertDialogPrimitive.Description<T>>++export const AlertDialogDescription = <T extends ValidComponent = "p">(+ props: AlertDialogDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as AlertDialogDescriptionProps, ["class"])++ return (+ <AlertDialogPrimitive.Description+ data-slot="alert-dialog-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}++export type AlertDialogActionProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof AlertDialogPrimitive.CloseButton<T>>++export const AlertDialogAction = <T extends ValidComponent = "button">(+ props: AlertDialogActionProps<T>,+) => {+ const [, rest] = splitProps(props as AlertDialogActionProps, ["class"])++ return (+ <AlertDialogPrimitive.CloseButton+ class={buttonVariants({+ class: props.class,+ })}+ {...rest}+ />+ )+}++export type AlertDialogCancelProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof AlertDialogPrimitive.CloseButton<T>>++export const AlertDialogCancel = <T extends ValidComponent = "button">(+ props: AlertDialogCancelProps<T>,+) => {+ const [, rest] = splitProps(props as AlertDialogCancelProps, ["class"])++ return (+ <AlertDialogPrimitive.CloseButton+ class={buttonVariants({+ class: props.class,+ variant: "outline",+ })}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/alert.tsx b/apps/web/src/components/ui/alert.tsxnew file mode 100644index 00000000..cf9a72b6--- /dev/null+++ b/apps/web/src/components/ui/alert.tsx@@ -0,0 +1,82 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/alert++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { Alert as AlertPrimitive } from "@kobalte/core/alert"+import type { VariantProps } from "cva"++import { cva, cx } from "@/lib/cva"++export const alertVariants = cva({+ base: "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",+ variants: {+ variant: {+ default: "bg-card text-card-foreground",+ destructive:+ "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",+ },+ },+ defaultVariants: {+ variant: "default",+ },+})++export type AlertProps<T extends ValidComponent = "button"> = ComponentProps<+ typeof AlertPrimitive<T>+> &+ VariantProps<typeof alertVariants>++export const Alert = <T extends ValidComponent = "button">(+ props: AlertProps<T>,+) => {+ const [, rest] = splitProps(props as AlertProps, ["class", "variant"])++ return (+ <AlertPrimitive+ data-slot="alert"+ class={alertVariants({+ variant: props.variant,+ class: props.class,+ })}+ {...rest}+ />+ )+}++export type AlertTitleProps = ComponentProps<"div">++export const AlertTitle = (props: AlertTitleProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="alert-title"+ class={cx(+ "col-start-2 line-clamp-1 min-h-4 font-450 tracking-tight",+ props.class,+ )}+ {...rest}+ />+ )+}++export type AlertDescriptionProps = ComponentProps<"div">++export const AlertDescription = (props: AlertDescriptionProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="alert-description"+ class={cx(+ "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/asset-thumbnail.tsx b/apps/web/src/components/ui/asset-thumbnail.tsxnew file mode 100644index 00000000..8d82014d--- /dev/null+++ b/apps/web/src/components/ui/asset-thumbnail.tsx@@ -0,0 +1,196 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ALL_FORMATS, BlobSource, CanvasSink, Input } from 'mediabunny';+import { Show, For, createResource } from 'solid-js';+import { cx } from '@/lib/cva';+import { getAudioPeaksAsync } from '@/components/engine/decoders/audio-peaks';+import { useEngine } from '@/context/engine';+import { assetsVersion } from '@/components/engine';++import type { AudioAsset, ImageAsset, VideoAsset } from '@/components/engine/db';+import type { Asset } from '@/components/engine/db';++const DEFAULT_THUMBNAIL_SIZE = {+ width: 300,+ height: 168,+} as const;++type ThumbnailSize = {+ width: number;+ height: number;+};++function ImageThumbnail(props: { asset: Asset; size: ThumbnailSize }) {+ const engine = useEngine();+ const [url] = createResource(+ () => `${props.asset.id}:${assetsVersion(engine.world)}`,+ async () => {+ const objectUrl = URL.createObjectURL(await props.asset.handle.getFile());+ try {+ const image = await new Promise<HTMLImageElement>((resolve, reject) => {+ const img = new Image();+ img.onload = () => resolve(img);+ img.onerror = () => reject(new Error('Failed to load image'));+ img.src = objectUrl;+ });++ const canvas = document.createElement('canvas');+ canvas.width = props.size.width;+ canvas.height = props.size.height;+ const ctx = canvas.getContext('2d')!;++ const asset = props.asset as ImageAsset;+ const imgW = image.naturalWidth || asset.width;+ const imgH = image.naturalHeight || asset.height;+ const scale = Math.max(props.size.width / imgW, props.size.height / imgH);+ const scaledW = imgW * scale;+ const scaledH = imgH * scale;+ const dx = (props.size.width - scaledW) / 2;+ const dy = (props.size.height - scaledH) / 2;++ ctx.drawImage(image, dx, dy, scaledW, scaledH);+ const url = canvas.toDataURL('image/webp', 0.7);++ canvas.width = 0;+ canvas.height = 0;++ return url;+ } catch {+ return undefined;+ } finally {+ URL.revokeObjectURL(objectUrl);+ }+ }+ );++ return (+ <Show when={url()}>+ <img+ src={url()!}+ alt={props.asset.name}+ class="w-full h-full object-cover select-none"+ />+ </Show>+ );+}++function VideoThumbnail(props: { asset: Asset; size: ThumbnailSize }) {+ const engine = useEngine();+ const [src] = createResource(+ () => `${props.asset.id}:${assetsVersion(engine.world)}`,+ async () => {+ try {+ const file = await props.asset.handle.getFile();++ const input = new Input({+ formats: ALL_FORMATS,+ source: new BlobSource(file),+ });++ const track = await input.getPrimaryVideoTrack();+ if (!track) return;++ const sink = new CanvasSink(track, {+ width: props.size.width,+ height: props.size.height,+ fit: 'cover',+ });++ const ts = await track.getFirstTimestamp();+ const wrappedCanvas = await sink.getCanvas(ts + 0.3);+ if (!wrappedCanvas) return;++ const canvas = document.createElement('canvas');+ canvas.width = wrappedCanvas.canvas.width;+ canvas.height = wrappedCanvas.canvas.height;+ canvas.getContext('2d')?.drawImage(wrappedCanvas.canvas, 0, 0);+ const url = canvas.toDataURL('image/webp', 0.7);+ canvas.width = 0;+ canvas.height = 0;+ return url;+ } catch {+ return undefined;+ }+ }+ );++ return (+ <Show when={src()}>+ <img+ src={src()!}+ alt={props.asset.name}+ class="w-full h-full object-cover select-none"+ />+ </Show>+ );+}++function TranscriptThumbnail() {+ return (+ <div class="absolute inset-0 bg-caption-background overflow-clip rounded-sm">+ <div class="absolute top-1 left-1 h-4 px-1 flex items-center bg-overlay rounded-sm">+ <span class="text-xxs text-foreground">Captions</span>+ </div>+ <div class="absolute top-9 left-1 right-0 bottom-1 flex items-center gap-0.5 overflow-clip">+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '37px', 'min-width': '16px' }} />+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '16px' }} />+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '36px', 'min-width': '16px' }} />+ <div class="bg-caption-accent h-full rounded-sm shrink-0" style={{ width: '37px', 'min-width': '16px' }} />+ </div>+ </div>+ );+}++function AudioThumbnail(props: { asset: Asset }) {+ const engine = useEngine();+ const [bins] = createResource(+ () => `${props.asset.id}:${assetsVersion(engine.world)}`,+ () => getAudioPeaksAsync(props.asset as AudioAsset | VideoAsset),+ );++ return (+ <div class="absolute inset-0 pt-7 pb-1 bg-audio-background">+ <div class="flex items-center justify-center w-full h-full">+ <Show when={bins()}>+ <For each={Array.from(bins()!)}>+ {value => {+ const height = Math.min(Math.max(2, (value / 255) * 100), 98);+ return <div class="bg-audio-primary flex-1 rounded-sm" style={{ height: `${height}%` }} />;+ }}+ </For>+ </Show>+ </div>+ </div>+ );+}++type AssetThumbnailProps = {+ asset: Asset;+ class?: string;+ draggable?: boolean;+ size?: ThumbnailSize;+}++export function AssetThumbnail(props: AssetThumbnailProps) {+ const size = () => props.size ?? DEFAULT_THUMBNAIL_SIZE;++ return (+ <div class={cx(props.class, 'relative')} draggable={props.draggable}>+ <Show when={props.asset.mimeType.startsWith('image')}>+ <ImageThumbnail asset={props.asset} size={size()} />+ </Show>+ <Show when={props.asset.mimeType.startsWith('video')}>+ <VideoThumbnail asset={props.asset} size={size()} />+ </Show>+ <Show when={props.asset.mimeType.startsWith('audio')}>+ <AudioThumbnail asset={props.asset} />+ </Show>+ <Show when={props.asset.type === 'TRANSCRIPT'}>+ <TranscriptThumbnail />+ </Show>+ <div class="absolute inset-0 bg-transparent" />+ </div>+ );+}diff --git a/apps/web/src/components/ui/badge.tsx b/apps/web/src/components/ui/badge.tsxnew file mode 100644index 00000000..a213a406--- /dev/null+++ b/apps/web/src/components/ui/badge.tsx@@ -0,0 +1,60 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/badge++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { Badge as BadgePrimitive } from "@kobalte/core/badge"+import type { VariantProps } from "cva"++import { cva } from "@/lib/cva"+import { tw } from "@/lib/tw"++const invoiceStatusBadgeBase = tw`border-transparent rounded-full px-2 py-[2px] text-xs font-normal`++export const badgeVariants = cva({+ base: tw`inline-flex items-center justify-center border px-1.5 rounded-sm text-xs w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden`,+ variants: {+ variant: {+ base:+ tw`${invoiceStatusBadgeBase} bg-input text-foreground`,+ default:+ tw`border-transparent bg-primary text-background dark:text-foreground [a&]:hover:bg-primary/90`,+ secondary:+ tw`border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,+ destructive:+ tw`${invoiceStatusBadgeBase} bg-destructive-accent text-destructive-accent-foreground`,+ success:+ tw`${invoiceStatusBadgeBase} bg-success-accent text-success-accent-foreground`,+ outline:+ tw`text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,+ },+ },+ defaultVariants: {+ variant: "default",+ },+})++export type BadgeProps<T extends ValidComponent = "span"> = ComponentProps<+ typeof BadgePrimitive<T>+> &+ VariantProps<typeof badgeVariants>++export const Badge = <T extends ValidComponent = "span">(+ props: BadgeProps<T>,+) => {+ const [, rest] = splitProps(props as BadgeProps, ["class", "variant"])++ return (+ <BadgePrimitive+ data-slot="badge"+ class={badgeVariants({+ variant: props.variant,+ class: props.class,+ })}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/breadcrumbs.tsx b/apps/web/src/components/ui/breadcrumbs.tsxnew file mode 100644index 00000000..a78a40f4--- /dev/null+++ b/apps/web/src/components/ui/breadcrumbs.tsx@@ -0,0 +1,142 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { VoidProps } from "solid-js"+import { splitProps, type ComponentProps, type ValidComponent } from "solid-js"+import { Breadcrumbs as BreadcrumbsPrimitive } from "@kobalte/core/breadcrumbs"+import { cx } from "@/lib/cva"++export type BreadcrumbsProps<T extends ValidComponent = "nav"> = ComponentProps<+ typeof BreadcrumbsPrimitive<T>+>++export const Breadcrumbs = <T extends ValidComponent = "nav">(+ props: BreadcrumbsProps<T>,+) => {+ return (+ <BreadcrumbsPrimitive+ data-slot="breadcrumbs"+ separator={+ <svg+ xmlns="http://www.w3.org/2000/svg"+ class="size-4"+ viewBox="0 0 24 24"+ >+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="m9 18l6-6l-6-6"+ />+ </svg>+ }+ {...props}+ />+ )+}++export type BreadcrumbListProps = ComponentProps<"ol">++export const BreadcrumbList = (props: BreadcrumbListProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <ol+ data-slot="breadcrumb-list"+ class={cx(+ "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",+ props.class,+ )}+ {...rest}+ />+ )+}++export type BreadcrumbsItemProps = ComponentProps<"li">++export const BreadcrumbsItem = (props: BreadcrumbsItemProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <li+ data-slot="breadcrumb-item"+ class={cx("inline-flex items-center gap-1.5", props.class)}+ {...rest}+ />+ )+}++export type BreadcrumbsLinkProps<T extends ValidComponent = "a"> =+ ComponentProps<typeof BreadcrumbsPrimitive.Link<T>>++export const BreadcrumbsLink = <T extends ValidComponent = "a">(+ props: BreadcrumbsLinkProps<T>,+) => {+ const [, rest] = splitProps(props as BreadcrumbsLinkProps, ["class"])++ return (+ <BreadcrumbsPrimitive.Link+ data-slot="breadcrumb-link"+ class={cx(+ "hover:text-foreground data-[current]:text-foreground transition-colors data-[current]:font-normal",+ props.class,+ )}+ {...rest}+ />+ )+}++export type BreadcrumbsSeparatorProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof BreadcrumbsPrimitive.Separator<T>>++export const BreadcrumbsSeparator = <T extends ValidComponent = "span">(+ props: BreadcrumbsSeparatorProps<T>,+) => {+ const [, rest] = splitProps(props as BreadcrumbsSeparatorProps, ["class"])++ return (+ <BreadcrumbsPrimitive.Separator+ data-slot="breadcrumb-separator"+ class={cx("[&>svg]:size-3.5", props.class)}+ {...rest}+ />+ )+}++export type BreadcrumbsEllipsisProps = VoidProps<ComponentProps<"span">>++export const BreadcrumbsEllipsis = (props: BreadcrumbsEllipsisProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <span+ data-slot="breadcrumb-ellipsis"+ role="presentation"+ aria-hidden="true"+ class={cx("flex size-9 items-center justify-center", props.class)}+ {...rest}+ >+ <svg+ xmlns="http://www.w3.org/2000/svg"+ class="size-4"+ viewBox="0 0 24 24"+ >+ <g+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ >+ <circle cx="12" cy="12" r="1" />+ <circle cx="19" cy="12" r="1" />+ <circle cx="5" cy="12" r="1" />+ </g>+ </svg>+ <span class="sr-only">More</span>+ </span>+ )+}diff --git a/apps/web/src/components/ui/button.tsx b/apps/web/src/components/ui/button.tsxnew file mode 100644index 00000000..67da10b7--- /dev/null+++ b/apps/web/src/components/ui/button.tsx@@ -0,0 +1,74 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/button++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { Root as ButtonPrimitive } from "@kobalte/core/button"+import type { VariantProps } from "cva"++import { cva } from "@/lib/cva"+import { tw } from "@/lib/tw"++export const buttonVariants = cva({+ base: [+ tw`inline-flex items-center justify-center gap-0 whitespace-nowrap rounded-md font-450 text-xs transition-all shrink-0 outline-none`,+ tw`disabled:pointer-events-none disabled:opacity-50`,+ tw`[&_svg]:pointer-events-none [&_svg]:shrink-0`,+ tw`focus-visible:border-ring focus-visible:ring-primary focus-visible:ring-[1px]`,+ tw`aria-[invalid]:ring-destructive/20 aria-[invalid]:dark:ring-destructive/40 aria-[invalid]:border-destructive`,+ ],++ variants: {+ variant: {+ default: tw`bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-pressing data-[expanded]:bg-primary-hover`,+ secondary: tw`bg-secondary text-foreground hover:bg-secondary-hover active:bg-secondary-pressing data-[expanded]:bg-secondary-hover`,+ on: tw`bg-tertiary text-tertiary-foreground hover:bg-tertiary-hover active:bg-tertiary-pressing data-[expanded]:bg-tertiary-hover`,+ ghost: tw`hover:bg-accent active:bg-muted data-[expanded]:bg-accent`,+ link: tw`px-0 bg-transparent text-muted-foreground hover:text-foreground active:text-foreground data-[expanded]:text-foreground`,+ destructive:+ tw`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 focus-visible:dark:ring-destructive/40 hover:bg-destructive-hover active:bg-destructive-pressing data-[expanded]:bg-destructive-hover`,+ outline: tw`bg-transparent border border-border-input text-foreground hover:bg-input`,+ },+ size: {+ default: tw`h-7 px-2`,+ small: tw`h-5 px-1 text-xxs font-normal rounded`,+ icon: tw`w-6 h-7 p-0`,+ "icon-square": tw`w-7 h-7 p-0`,+ "icon-select": tw`w-4 h-7 p-0`,+ },+ },+ defaultVariants: {+ variant: "default",+ size: "default",+ },+})++export type ButtonProps<T extends ValidComponent = "button"> = ComponentProps<+ typeof ButtonPrimitive<T>+> &+ VariantProps<typeof buttonVariants>++export const Button = <T extends ValidComponent = "button">(+ props: ButtonProps<T>,+) => {+ const [, rest] = splitProps(props as ButtonProps, [+ "class",+ "variant",+ "size",+ ])++ return (+ <ButtonPrimitive+ data-slot="button"+ class={buttonVariants({+ variant: props.variant,+ size: props.size,+ class: props.class,+ })}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/card.tsx b/apps/web/src/components/ui/card.tsxnew file mode 100644index 00000000..2c288c9a--- /dev/null+++ b/apps/web/src/components/ui/card.tsx@@ -0,0 +1,113 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/card++import type { ComponentProps } from "solid-js"+import { splitProps } from "solid-js"++import { cx } from "@/lib/cva"++export type CardProps = ComponentProps<"div">++export const Card = (props: CardProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="card"+ class={cx(+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CardHeaderProps = ComponentProps<"div">++export const CardHeader = (props: CardHeaderProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="card-header"+ class={cx(+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CardTitleProps = ComponentProps<"div">++export const CardTitle = (props: CardTitleProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="card-title"+ class={cx("leading-none font-semibold", props.class)}+ {...rest}+ />+ )+}++export type CardDescriptionProps = ComponentProps<"div">++export const CardDescription = (props: CardDescriptionProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="card-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}++export type CardActionProps = ComponentProps<"div">++export const CardAction = (props: CardActionProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="card-action"+ class={cx(+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CardContentProps = ComponentProps<"div">++export const CardContent = (props: CardContentProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div data-slot="card-content" class={cx("px-6", props.class)} {...rest} />+ )+}++export type CardFooterProps = ComponentProps<"div">++export const CardFooter = (props: CardFooterProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="card-footer"+ class={cx("flex items-center px-6 [.border-t]:pt-6", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/centered-select-menu.tsx b/apps/web/src/components/ui/centered-select-menu.tsxnew file mode 100644index 00000000..994036d9--- /dev/null+++ b/apps/web/src/components/ui/centered-select-menu.tsx@@ -0,0 +1,143 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { Accessor } from "solid-js"+import { createMemo, createSignal } from "solid-js"+import { Listbox } from "@kobalte/core/listbox"+import { Popover as PopoverPrimitive } from "@kobalte/core/popover"++import { Popover, PopoverPortal, PopoverTrigger } from "@/components/ui/popover"+import { Icon } from "@/components/ui/icon"+import { cx } from "@/lib/cva"++export type CenteredSelectMenuOption<Value extends string> = {+ value: Value+ label: string+ disabled?: boolean+}++export type CenteredSelectMenuProps<Value extends string> = {+ value: Accessor<Value>+ onChange: (nextValue: Value) => void+ options: readonly CenteredSelectMenuOption<Value>[]+ "aria-label": string+ triggerClass?: string+ contentClass?: string+ maxVisibleItems?: number+}++export const CenteredSelectMenu = <Value extends string>(+ props: CenteredSelectMenuProps<Value>,+) => {+ const [open, setOpen] = createSignal(false)++ const selectedOption = createMemo(() => {+ const value = props.value()+ return props.options.find((option) => option.value === value)+ })++ const selectedIndex = createMemo(() => {+ const value = props.value()+ const index = props.options.findIndex((option) => option.value === value)+ return Math.max(0, index)+ })++ const visibleItems = createMemo(() => {+ const max = Math.max(1, props.maxVisibleItems ?? 7)+ return Math.max(1, Math.min(props.options.length || 1, max))+ })++ const centerIndex = createMemo(() => Math.floor(visibleItems() / 2))++ const menuOptions = createMemo(() => {+ const options = props.options+ if (!options.length) return []++ const startIndex =+ (selectedIndex() - centerIndex() + options.length) % options.length++ return [...options.slice(startIndex), ...options.slice(0, startIndex)]+ })++ const gutter = createMemo(() => -(28 + 8 + centerIndex() * 28))++ return (+ <Popover+ placement="bottom"+ gutter={gutter()}+ open={open()}+ onOpenChange={setOpen}+ >+ <PopoverTrigger+ as="button"+ type="button"+ aria-label={props["aria-label"]}+ class={cx(+ "flex h-7 items-center rounded-md bg-input pl-2 pr-0 text-xs text-foreground outline-none transition-[box-shadow,border-color]",+ "border border-transparent",+ "focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",+ "data-[expanded]:border-ring data-[expanded]:ring-1 data-[expanded]:ring-inset data-[expanded]:ring-ring",+ props.triggerClass,+ )}+ >+ <span class="min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap py-[2px]">+ {selectedOption()?.label ?? ""}+ </span>+ <span class="grid h-7 w-6 place-items-center overflow-clip text-muted-foreground">+ <Icon name="chevron-down" class="size-6" />+ </span>+ </PopoverTrigger>++ <PopoverPortal>+ <PopoverPrimitive.Content+ data-slot="centered-select-menu-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-[10000] origin-center overflow-hidden flex flex-col gap-0 rounded-xl border border-border p-2 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12),0px_12px_16px_0px_rgba(0,0,0,0.16)] outline-none",+ props.contentClass,+ )}+ >+ <Listbox<CenteredSelectMenuOption<Value>>+ options={menuOptions()}+ optionValue="value"+ optionTextValue="label"+ optionDisabled="disabled"+ value={[props.value()]}+ shouldFocusOnHover+ class="flex w-full flex-col gap-0 overflow-y-auto outline-none"+ style={{ height: `${visibleItems() * 28}px` }}+ onChange={(nextValue: Set<string>) => {+ setOpen(false)++ const selected = nextValue.values().next().value as Value | undefined+ if (!selected) return++ props.onChange(selected)+ }}+ renderItem={(item) => (+ <Listbox.Item+ item={item}+ class={cx(+ "group relative flex h-7 w-full cursor-default items-center gap-1 rounded-md bg-popover px-0 pr-2 py-0 text-xs outline-none select-none",+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",+ "data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground",+ "data-[selected]:bg-primary data-[selected]:text-primary-foreground",+ "data-[highlighted]:[&_svg]:text-primary-foreground data-[selected]:[&_svg]:text-primary-foreground",+ )}+ >+ <span class="flex h-7 w-6 shrink-0 items-center justify-center overflow-clip">+ <Listbox.ItemIndicator>+ <Icon name="confirm-check" class="size-6" />+ </Listbox.ItemIndicator>+ </span>+ <span class="min-w-0 flex-1 truncate text-xs">+ {item.rawValue.label}+ </span>+ </Listbox.Item>+ )}+ />+ </PopoverPrimitive.Content>+ </PopoverPortal>+ </Popover>+ )+}diff --git a/apps/web/src/components/ui/checkbox.tsx b/apps/web/src/components/ui/checkbox.tsxnew file mode 100644index 00000000..2adf15ae--- /dev/null+++ b/apps/web/src/components/ui/checkbox.tsx@@ -0,0 +1,122 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/checkbox++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { Checkbox as CheckboxPrimitive } from "@kobalte/core/checkbox"++import { cx } from "@/lib/cva"++export type CheckboxProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof CheckboxPrimitive<T>+>++export const Checkbox = <T extends ValidComponent = "div">(+ props: CheckboxProps<T>,+) => {+ return <CheckboxPrimitive data-slot="checkbox" {...props} />+}++export type CheckboxLabelProps<T extends ValidComponent = "label"> =+ ComponentProps<typeof CheckboxPrimitive.Label<T>>++export const CheckboxLabel = <T extends ValidComponent = "label">(+ props: CheckboxLabelProps<T>,+) => {+ const [, rest] = splitProps(props as CheckboxLabelProps, ["class"])++ return (+ <CheckboxPrimitive.Label+ data-slot="checkbox-label"+ class={cx(+ "flex items-center gap-2 text-xs leading-none font-450 ml-2 select-none data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",+ "data-[invalid]:text-destructive",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CheckboxDescriptionProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof CheckboxPrimitive.Description<T>>++export const CheckboxDescription = <T extends ValidComponent = "div">(+ props: CheckboxDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as CheckboxDescriptionProps, ["class"])++ return (+ <CheckboxPrimitive.Description+ data-slot="checkbox-description"+ class={cx(+ "text-muted-foreground text-sm data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CheckboxInputProps<T extends ValidComponent = "input"> =+ ComponentProps<typeof CheckboxPrimitive.Input<T>>++export const CheckboxInput = <T extends ValidComponent = "input">(+ props: CheckboxInputProps<T>,+) => {+ const [, rest] = splitProps(props as CheckboxInputProps, ["class"])++ return (+ <CheckboxPrimitive.Input+ data-slot="checkbox-input"+ class={cx(+ "[&:focus-visible+div]:ring-ring/50 peer [&:focus-visible+div]:ring-[3px]",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CheckboxControlProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof CheckboxPrimitive.Control<T>>++export const CheckboxControl = <T extends ValidComponent = "div">(+ props: CheckboxControlProps<T>,+) => {+ const [, rest] = splitProps(props as CheckboxControlProps, ["class"])++ return (+ <CheckboxPrimitive.Control+ data-slot="checkbox-control"+ class={cx(+ "peer-focus-visible:border-ring border-muted dark:bg-input/30 data-[checked]:bg-primary data-[checked]:text-primary-foreground dark:data-[checked]:bg-primary data-[checked]:border-primary data-[invalid]:ring-destructive/20 dark:data-[invalid]:ring-destructive/40 data-[invalid]:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ >+ <CheckboxPrimitive.Indicator+ data-slot="checkbox-indicator"+ class="flex size-full items-center justify-center text-current transition-none"+ >+ <svg+ xmlns="http://www.w3.org/2000/svg"+ class="size-3.5"+ viewBox="0 0 24 24"+ >+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M20 6L9 17l-5-5"+ />+ </svg>+ </CheckboxPrimitive.Indicator>+ </CheckboxPrimitive.Control>+ )+}diff --git a/apps/web/src/components/ui/color-opacity-picker.tsx b/apps/web/src/components/ui/color-opacity-picker.tsxnew file mode 100644index 00000000..f87c3fff--- /dev/null+++ b/apps/web/src/components/ui/color-opacity-picker.tsx@@ -0,0 +1,630 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Button } from "@/components/ui/button";+import { Icon } from "@/components/ui/icon";+import { Keyframe } from "@/components/ui/keyframe";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import { checkerboardStyle } from "@/components/ui/opacity-swatch";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { useDrag } from "@/hooks/use-drag";+import { assert, clamp, colorToHex, colorToRgb, hslToRgb, hsvToRgb, parseColor, pickScreenColor, rgbToColor, rgbToHsl, rgbToHsv } from "@/utils";+import {+ batch,+ createEffect,+ createMemo,+ createSignal,+ For,+ Match,+ Show,+ Switch,+ untrack,+ type Accessor,+ type Setter,+} from "solid-js";+import { useEngine } from "@/context/engine";+import { useQuery } from "@/components/engine/hooks";+import { toast } from "somoto";++const COLOR_TYPES = ["Hex", "HSL", "RGB"] as const;+type ColorType = (typeof COLOR_TYPES)[number];+const OPACITY_INPUT_MAX = 100;++export type ColorOpacityPickerValue = {+ color: number;+ opacity: number;+};++export type ColorOpacityPickerProps = {+ color: number;+ opacity: number;+ onColorChange(next: number): void;+ onOpacityChange?(next: number): void;+ onBeginChange?(label: string): void;+ onEndChange?(): void;+ withoutOpacity?: boolean;+ keyframeTarget?: number;+};++function getSliderRatio(+ element: HTMLDivElement | undefined,+ pos: { x: number; y: number },+) {+ if (!element) return null;+ const rect = element.getBoundingClientRect();+ if (!rect.width) return null;+ return clamp((pos.x - rect.left) / rect.width, 0, 1);+}++function handleInitialInputPointerDown(e: PointerEvent & { currentTarget: HTMLInputElement }) {+ if (document.activeElement === e.currentTarget) return;+ e.preventDefault();+ e.currentTarget.focus();+ e.currentTarget.select();+}++export function ColorOpacityPicker(props: ColorOpacityPickerProps) {+ let colorAreaRef: HTMLDivElement | undefined;+ let hueRef: HTMLDivElement | undefined;+ let opacityRef: HTMLDivElement | undefined;++ const { world } = useEngine();+ const c = world.components;++ const colorEntities = useQuery([c.Color]);++ const documentColors = createMemo(() => {+ const colors = new Set<number>();+ for (const eid of colorEntities()) {+ colors.add(c.Color[eid] ?? 0x171717); // fallback is background color+ if (colors.size >= 36) break;+ }+ return Array.from(colors);+ });++ const [colorType, setColorType] = createSignal<ColorType>("Hex");+ const [isEyeDropperOpen, setIsEyeDropperOpen] = createSignal(false);+ const [isDraggingColorArea, setIsDraggingColorArea] = createSignal(false);++ const opacity = createMemo(() => clamp(props.opacity, 0, 1));++ const [opacityDraft, setOpacityDraft] = createSignal(0);+ createEffect(() => setOpacityDraft(opacity()));++ const initialRgb = colorToRgb(props.color);+ const [hexDraft, setHexDraft] = createSignal(colorToHex(props.color).replace("#", ""));+ const [rgbDraft, setRgbDraft] = createSignal(initialRgb);+ const [hslDraft, setHslDraft] = createSignal({ h: 0, s: 0, l: 0 });+ const [hsvDraft, setHsvDraft] = createSignal(rgbToHsv(initialRgb.r, initialRgb.g, initialRgb.b));++ createEffect(() => {+ if (isDraggingColorArea()) return;++ const rgb = colorToRgb(props.color);+ const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);+ const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);++ let hue = hsv.h;+ if (hsv.s === 0 || hsv.v === 0) {+ hue = untrack(() => hsvDraft().h);+ }++ batch(() => {+ setHexDraft(colorToHex(props.color).replace("#", ""));+ setRgbDraft(rgb);+ setHslDraft({ ...hsl, h: hsl.s === 0 ? hue : hsl.h });+ setHsvDraft({ ...hsv, h: hue });+ });+ });++ const assignOpacity = (next: number | null) => {+ if (next == null) return;+ props.onOpacityChange?.(Math.round(clamp(next, 0, 1) * 100) / 100);+ };++ const handleEyeDropper = async () => {+ if (isEyeDropperOpen()) return;++ setIsEyeDropperOpen(true);+ try {+ const pickedHex = await pickScreenColor();+ assert(pickedHex, "Picked color is null");+ const parsed = parseColor(pickedHex);+ assert(parsed !== null, "Picked color is invalid");+ props.onColorChange(parsed);+ } catch (error) {+ console.error(error);+ toast.error("Failed to pick color from screen");+ } finally {+ setIsEyeDropperOpen(false);+ }+ };++ const updateSaturationDraft = (pos: { x: number; y: number }) => {+ const currentRect = colorAreaRef?.getBoundingClientRect();+ if (!currentRect) return;++ const x = clamp((pos.x - currentRect.left) / currentRect.width, 0, 1);+ const y = clamp((pos.y - currentRect.top) / currentRect.height, 0, 1);+ const hue = hsvDraft().h;+ const nextHsv = {+ h: hue,+ s: x * 100,+ v: (1 - y) * 100,+ };+ const nextRgb = hsvToRgb(nextHsv.h, nextHsv.s, nextHsv.v);+ const nextHsl = rgbToHsl(nextRgb.r, nextRgb.g, nextRgb.b);++ batch(() => {+ setHsvDraft(nextHsv);+ setRgbDraft(nextRgb);+ setHslDraft({ ...nextHsl, h: hue });+ });+ props.onColorChange(rgbToColor(nextRgb.r, nextRgb.g, nextRgb.b));+ };++ const commitSaturationDraft = () => {+ const nextRgb = hsvToRgb(hsvDraft().h, hsvDraft().s, hsvDraft().v);+ props.onColorChange(rgbToColor(nextRgb.r, nextRgb.g, nextRgb.b));+ };++ const updateHue = (pos: { x: number; y: number }) => {+ const ratio = getSliderRatio(hueRef, pos);+ if (ratio === null) return;+ const hue = Math.round(ratio * 360);+ const nextHsv = { ...hsvDraft(), h: hue };+ const nextRgb = hsvToRgb(nextHsv.h, nextHsv.s, nextHsv.v);+ const nextHsl = rgbToHsl(nextRgb.r, nextRgb.g, nextRgb.b);+ batch(() => {+ setHsvDraft(nextHsv);+ setRgbDraft(nextRgb);+ setHslDraft({ ...nextHsl, h: hue });+ });+ props.onColorChange(rgbToColor(nextRgb.r, nextRgb.g, nextRgb.b));+ };++ const updateOpacity = (pos: { x: number; y: number }) => {+ const ratio = getSliderRatio(opacityRef, pos);+ if (ratio === null) return;+ assignOpacity(ratio);+ };++ const colorAreaDrag = useDrag({+ onDragStart: (pos) => {+ props.onBeginChange?.("Update saturation");+ setIsDraggingColorArea(true);+ updateSaturationDraft(pos);+ },+ onDragMove: (pos) => updateSaturationDraft(pos),+ onDragEnd: (pos) => {+ updateSaturationDraft(pos);+ commitSaturationDraft();+ setIsDraggingColorArea(false);+ props.onEndChange?.();+ },+ });++ const hueDrag = useDrag({+ onDragStart: (pos) => {+ props.onBeginChange?.("Update hue");+ updateHue(pos);+ },+ onDragMove: updateHue,+ onDragEnd: (pos) => {+ updateHue(pos);+ props.onEndChange?.();+ },+ });++ const opacityDrag = useDrag({+ onDragStart: (pos) => {+ props.onBeginChange?.("Update opacity");+ updateOpacity(pos);+ },+ onDragMove: updateOpacity,+ onDragEnd: (pos) => {+ updateOpacity(pos);+ props.onEndChange?.();+ },+ });++ const onOpacityInput = (e: InputEvent & { currentTarget: HTMLInputElement }) => {+ const nextValue = Number.parseFloat(e.currentTarget.value);+ if (Number.isFinite(nextValue)) {+ setOpacityDraft(clamp(nextValue / OPACITY_INPUT_MAX, 0, 1));+ }+ };++ const onOpacityKeyDown = (e: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (e.key === "Enter") {+ assignOpacity(opacityDraft());+ e.currentTarget.blur();+ }+ if (e.key === "Escape") {+ setOpacityDraft(opacity());+ e.currentTarget.blur();+ }+ };++ const commitHslDraft = () => {+ const { h, s, l } = hslDraft();+ const { r, g, b } = hslToRgb(h, s, l);+ props.onColorChange(rgbToColor(r, g, b));+ };++ const commitRgbDraft = () => {+ const { r, g, b } = rgbDraft();+ props.onColorChange(rgbToColor(r, g, b));+ };++ const commitHexDraft = (next: string) => {+ const parsed = parseColor(next);+ if (parsed !== null) {+ props.onColorChange(parsed);+ }+ };++ return (+ <>+ <div class="px-2">+ <div+ ref={colorAreaRef}+ class="relative aspect-square w-full rounded-md overflow-hidden touch-none"+ onPointerDown={colorAreaDrag.onPointerDown}+ >+ <div+ class="absolute inset-0"+ style={{ "background-color": `hsl(${hslDraft().h}, 100%, 50%)` }}+ />+ <div+ class="absolute inset-0"+ style={{+ "background-image":+ "linear-gradient(90deg, #FFFFFF 0%, rgba(255,255,255,0) 100%)",+ }}+ />+ <div+ class="absolute inset-0"+ style={{+ "background-image":+ "linear-gradient(180deg, rgba(0,0,0,0) 0%, #000000 100%)",+ }}+ />+ <div+ class="absolute size-3.5 rounded-full border-[3px] border-foreground shadow-[0_2px_7px_rgba(0,0,0,0.4)] pointer-events-none"+ style={{+ left: `${hsvDraft().s}%`,+ top: `${100 - hsvDraft().v}%`,+ transform: "translate(-50%, -50%)",+ "background-color": `hsl(${hslDraft().h}, ${hslDraft().s}%, ${hslDraft().l}%)`,+ }}+ />+ </div>+ </div>++ <div class="flex flex-col gap-3 px-4 pt-3 pb-4">+ <div class="flex items-center gap-2.5">+ <Tooltip>+ <TooltipTrigger+ as={Button}+ size="icon-square"+ variant="ghost"+ class="text-muted-foreground"+ onClick={handleEyeDropper}+ disabled={isEyeDropperOpen() || !("EyeDropper" in window)}+ >+ <Icon name="tool.color-picker" class="size-6" />+ </TooltipTrigger>+ <TooltipContent>Pick color from screen</TooltipContent>+ </Tooltip>+ <div class="flex flex-1 flex-col gap-2">+ <div class="flex items-center gap-3">+ <Show when={props.keyframeTarget !== undefined}>+ <Keyframe target={props.keyframeTarget!} property="color" class="size-3" />+ </Show>+ <div+ ref={hueRef}+ class="relative h-3 flex-1 rounded-full"+ style={{+ "background-image":+ "linear-gradient(90deg, #FF0000 0%, #FFFF00 17%, #00FF00 33%, #00FFFF 50%, #0000FF 67%, #FF00FF 83%, #FF0000 100%)",+ }}+ onPointerDown={hueDrag.onPointerDown}+ >+ <div+ class="absolute top-1/2 size-3.5 rounded-full border-[3px] border-foreground shadow-sm pointer-events-none"+ style={{+ left: `${(hslDraft().h / 360) * 100}%`,+ transform: "translate(-50%, -50%)",+ "background-color": `hsl(${hslDraft().h}, 100%, 50%)`,+ }}+ />+ </div>++ </div>+ <Show when={!props.withoutOpacity}>+ <div class="flex items-center gap-3">+ <Show when={props.keyframeTarget !== undefined}>+ <Keyframe target={props.keyframeTarget!} property="opacity" class="size-3" />+ </Show>+ <div+ ref={opacityRef}+ class="relative h-3 flex-1 rounded-full"+ onPointerDown={opacityDrag.onPointerDown}+ >+ <div class="absolute inset-0 rounded-full" style={checkerboardStyle(6)} />+ <div+ class="absolute inset-0 rounded-full"+ style={{+ "background-image": `linear-gradient(90deg, rgba(${rgbDraft().r}, ${rgbDraft().g}, ${rgbDraft().b}, 0) 0%, rgba(${rgbDraft().r}, ${rgbDraft().g}, ${rgbDraft().b}, 1) 100%)`,+ }}+ />+ <div+ class="absolute top-1/2 size-3.5 rounded-full border-[3px] border-foreground shadow-sm pointer-events-none"+ style={{+ left: `${opacity() * 100}%`,+ transform: "translate(-50%, -50%)",+ "background-color": `rgba(${rgbDraft().r}, ${rgbDraft().g}, ${rgbDraft().b}, ${opacityDraft()})`,+ }}+ />+ </div>++ </div>+ </Show>+ </div>+ </div>++ <div class="flex flex-col gap-3">+ <div class="flex gap-px items-center overflow-clip rounded-md">+ <Select+ value={colorType()}+ onChange={setColorType}+ options={[...COLOR_TYPES]}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>{itemProps.item.rawValue}</SelectItem>+ )}+ >+ <SelectTrigger class="w-14 shrink-0 rounded-l-md rounded-r-none after:rounded-l-md after:rounded-r-none">+ <SelectValue>{colorType()}</SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>++ <Switch>+ <Match when={colorType() === "Hex"}>+ <HexColorInput+ value={hexDraft}+ setValue={setHexDraft}+ onCommit={commitHexDraft}+ onReset={() => setHexDraft(colorToHex(props.color))}+ />+ </Match>+ <Match when={colorType() === "HSL"}>+ <HslColorInput+ value={hslDraft}+ setValue={setHslDraft}+ onCommit={commitHslDraft}+ onReset={() => setHslDraft(rgbToHsl(rgbDraft().r, rgbDraft().g, rgbDraft().b))}+ />+ </Match>+ <Match when={colorType() === "RGB"}>+ <RgbColorInput+ value={rgbDraft}+ setValue={setRgbDraft}+ onCommit={commitRgbDraft}+ onReset={() => setRgbDraft(colorToRgb(props.color))}+ />+ </Match>+ </Switch>++ <Show when={!props.withoutOpacity}>+ <div class="w-14 h-7 shrink-0 rounded-r-md rounded-l-none bg-input flex items-center focus-within:ring-1 focus-within:ring-inset focus-within:ring-ring">+ <input+ type="text"+ inputMode="numeric"+ class="flex-1 min-w-0 bg-transparent pl-2 pr-0 text-sm text-foreground text-left focus:outline-none"+ value={opacityDraft() * 100}+ onPointerDown={handleInitialInputPointerDown}+ onInput={onOpacityInput}+ onKeyDown={onOpacityKeyDown}+ maxLength={3}+ />+ <div class="w-6 h-7 flex items-center justify-center text-muted-foreground text-sm">+ %+ </div>+ </div>+ </Show>+ </div>++ <div class="h-px bg-border" />++ <div class="flex flex-col gap-3">+ <p class="text-xs font-450 text-muted-foreground">+ Document colors+ </p>+ <div class="flex flex-wrap gap-2">+ <For each={documentColors()}>+ {(swatch) => (+ <button+ type="button"+ class="size-4.5 rounded-sm"+ style={{ "background-color": colorToHex(swatch) }}+ onClick={() => props.onColorChange(swatch)}+ />+ )}+ </For>+ </div>+ </div>+ </div>+ </div>+ </>+ );+}++type NumberFieldProps = {+ min: number;+ max: number;+ value: Accessor<number>;+ onInput(next: number): void;+ onCommit?(): void;+ onReset?(): void;+};++function NumberField(props: NumberFieldProps) {+ const handleInputChange = (e: InputEvent) => {+ const nextValue = (e.currentTarget as HTMLInputElement).valueAsNumber;+ if (Number.isFinite(nextValue)) {+ props.onInput(nextValue);+ }+ };++ const handleKeyDown = (e: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (e.key === "Enter") {+ props.onCommit?.();+ e.currentTarget.blur();+ }+ if (e.key === "Escape") {+ props.onReset?.();+ e.currentTarget.blur();+ }+ };++ return (+ <div class="flex-1 min-w-0 h-7 rounded-none bg-input flex items-center focus-within:ring-1 focus-within:ring-inset focus-within:ring-ring">+ <input+ type="number"+ class="w-full bg-transparent px-2 text-sm text-foreground focus:outline-none"+ value={props.value()}+ min={props.min}+ max={props.max}+ onPointerDown={handleInitialInputPointerDown}+ onInput={handleInputChange}+ onKeyDown={handleKeyDown}+ />+ </div>+ );+}++type HexColorInputProps = {+ value: Accessor<string>;+ setValue: Setter<string>;+ onCommit(next: string): void;+ onReset(): void;+};++function HexColorInput(props: HexColorInputProps) {+ const handleInput = (e: InputEvent & { currentTarget: HTMLInputElement }) => {+ props.setValue(e.currentTarget.value);+ };++ const handleKeyDown = (e: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (e.key === "Enter") {+ e.currentTarget.blur();+ props.onCommit(props.value());+ }+ if (e.key === "Escape") {+ props.onReset();+ }+ };++ return (+ <div class="flex-1 min-w-0 h-7 rounded-none bg-input flex items-center focus-within:ring-1 focus-within:ring-inset focus-within:ring-ring">+ <input+ type="text"+ class="flex-1 min-w-0 bg-transparent px-2 text-sm text-foreground focus:outline-none selection:bg-selection selection:text-selection-foreground"+ value={props.value()}+ onPointerDown={handleInitialInputPointerDown}+ onInput={handleInput}+ onKeyDown={handleKeyDown}+ />+ </div>+ );+}++type HslColorInputProps = {+ value: Accessor<{ h: number; s: number; l: number }>;+ setValue: Setter<{ h: number; s: number; l: number }>;+ onCommit(): void;+ onReset(): void;+};++function HslColorInput(props: HslColorInputProps) {+ return (+ <>+ <NumberField+ value={() => props.value().h}+ min={0}+ max={360}+ onInput={(next) => props.setValue((prev) => ({ ...prev, h: next }))}+ onCommit={props.onCommit}+ onReset={props.onReset}+ />+ <NumberField+ value={() => props.value().s}+ min={0}+ max={100}+ onInput={(next) => props.setValue((prev) => ({ ...prev, s: next }))}+ onCommit={props.onCommit}+ onReset={props.onReset}+ />+ <NumberField+ value={() => props.value().l}+ min={0}+ max={100}+ onInput={(next) => props.setValue((prev) => ({ ...prev, l: next }))}+ onCommit={props.onCommit}+ onReset={props.onReset}+ />+ </>+ );+}++type RgbColorInputProps = {+ value: Accessor<{ r: number; g: number; b: number }>;+ setValue: Setter<{ r: number; g: number; b: number }>;+ onCommit(): void;+ onReset(): void;+};++function RgbColorInput(props: RgbColorInputProps) {+ return (+ <>+ <NumberField+ value={() => props.value().r}+ min={0}+ max={255}+ onInput={(next) => props.setValue((prev) => ({ ...prev, r: next }))}+ onCommit={props.onCommit}+ onReset={props.onReset}+ />+ <NumberField+ value={() => props.value().g}+ min={0}+ max={255}+ onInput={(next) => props.setValue((prev) => ({ ...prev, g: next }))}+ onCommit={props.onCommit}+ onReset={props.onReset}+ />+ <NumberField+ value={() => props.value().b}+ min={0}+ max={255}+ onInput={(next) => props.setValue((prev) => ({ ...prev, b: next }))}+ onCommit={props.onCommit}+ onReset={props.onReset}+ />+ </>+ );+}++diff --git a/apps/web/src/components/ui/color-opacity-row.tsx b/apps/web/src/components/ui/color-opacity-row.tsxnew file mode 100644index 00000000..9f3d478b--- /dev/null+++ b/apps/web/src/components/ui/color-opacity-row.tsx@@ -0,0 +1,283 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createMemo, createSignal, onCleanup, Show, type JSX } from "solid-js";+import { OpacitySwatch } from "@/components/ui/opacity-swatch";+import { colorToHex, parseColor } from "@/utils/color";++type ColorOpacityRowProps = {+ color: number;+ onChangeColor?(color: number): void;+ opacity?: number | null;+ onChangeOpacity?(opacity: number): void;+ onStartTransaction?(): void;+ onEndTransaction?(): void;+ onClick?: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>;+ keyframe?: JSX.Element;+};++const DRAG_THRESHOLD_PX = 3;++function handleInitialInputPointerDown(e: PointerEvent & { currentTarget: HTMLInputElement }) {+ if (document.activeElement === e.currentTarget) return;+ e.preventDefault();+ e.currentTarget.focus();+ e.currentTarget.select();+}++export function ColorOpacityRow(props: ColorOpacityRowProps) {+ const [isDraggingSlider, setIsDraggingSlider] = createSignal(false);+ const [isFocusWithin, setIsFocusWithin] = createSignal(false);+ const colorText = createMemo(() => colorToHex(props.color).replace("#", ""));+ const [colorDraft, setColorDraft] = createSignal(colorText());+ const [opacityDraft, setOpacityDraft] = createSignal(+ `${Math.round((props.opacity ?? 0) * 100)}%`,+ );++ let rootRef: HTMLDivElement | undefined;+ let pendingInputFocus: HTMLInputElement | null = null;+ let activePointerId: number | null = null;+ let dragStartX = 0;+ let dragMoved = false;+ let cancelColorCommit = false;+ let cancelOpacityCommit = false;++ const hasOpacity = createMemo(() => {+ return props.opacity !== undefined && props.opacity !== null;+ });+ const opacityPercent = createMemo(() => Math.round((props.opacity ?? 0) * 100));++ createEffect(() => {+ setColorDraft(colorText());+ });++ createEffect(() => {+ setOpacityDraft(`${opacityPercent()}%`);+ });++ const commitColor = () => {+ const nextColor = parseColor(colorDraft());+ if (nextColor === null) {+ setColorDraft(colorText());+ return;+ }+ if (nextColor === props.color) return;+ props.onChangeColor?.(nextColor);+ };++ const commitOpacity = () => {+ if (!hasOpacity()) return;++ const raw = opacityDraft().replace("%", "").trim();+ const parsed = Number.parseFloat(raw);+ if (!Number.isFinite(parsed)) {+ setOpacityDraft(`${opacityPercent()}%`);+ return;+ }++ const clamped = Math.max(0, Math.min(100, Math.round(parsed)));+ props.onChangeOpacity?.(clamped / 100);+ };++ const applyOpacityFromClientX = (clientX: number) => {+ if (!hasOpacity()) return;+ const root = rootRef;+ if (!root) return;++ const rect = root.getBoundingClientRect();+ if (rect.width <= 0) return;++ const ratio = (clientX - rect.left) / rect.width;+ const clamped = Math.max(0, Math.min(1, ratio));+ props.onChangeOpacity?.(clamped);+ };++ const handlePointerDown = (event: PointerEvent & { currentTarget: HTMLDivElement }) => {+ if (!hasOpacity()) return;+ if (event.button !== 0) return;+ if (activePointerId !== null) return;++ const target = event.target as HTMLElement | null;+ const editableInput = target?.closest("input[data-paint-editable='true']");++ if (editableInput instanceof HTMLInputElement) {+ pendingInputFocus = editableInput;+ event.preventDefault();+ } else {+ pendingInputFocus = null;+ }++ dragStartX = event.clientX;+ dragMoved = false;+ activePointerId = event.pointerId;+ event.currentTarget.setPointerCapture(event.pointerId);+ };++ const handlePointerMove = (event: PointerEvent) => {+ if (!hasOpacity()) return;+ if (activePointerId !== event.pointerId) return;++ const moved = Math.abs(event.clientX - dragStartX) >= DRAG_THRESHOLD_PX;+ if (!dragMoved && moved) {+ dragMoved = true;+ setIsDraggingSlider(true);+ pendingInputFocus = null;+ props.onStartTransaction?.();+ }++ if (!dragMoved) return;+ applyOpacityFromClientX(event.clientX);+ };++ const handlePointerEnd = () => {+ activePointerId = null;+ props.onEndTransaction?.();++ if (isDraggingSlider()) {+ setIsDraggingSlider(false);+ }++ if (!dragMoved && pendingInputFocus) {+ pendingInputFocus.focus();+ pendingInputFocus.select();+ }+ pendingInputFocus = null;+ };++ onCleanup(() => {+ activePointerId = null;+ props.onEndTransaction?.();+ setIsDraggingSlider(false);+ });++ return (+ <div+ ref={rootRef}+ class="relative h-7 w-full overflow-hidden rounded-md border bg-input text-foreground"+ classList={{+ "border-primary": isFocusWithin(),+ "border-transparent": !isFocusWithin(),+ }}+ onPointerDown={handlePointerDown}+ onPointerMove={handlePointerMove}+ onPointerUp={handlePointerEnd}+ onPointerCancel={handlePointerEnd}+ onLostPointerCapture={handlePointerEnd}+ onFocusIn={() => setIsFocusWithin(true)}+ onFocusOut={(event) => {+ const related = event.relatedTarget;+ if (related instanceof Node && event.currentTarget.contains(related)) return;+ setIsFocusWithin(false);+ }}+ >+ <Show when={hasOpacity()}>+ <div+ class="pointer-events-none absolute inset-y-0 left-0 rounded-sm bg-muted"+ style={{ width: `${opacityPercent()}%` }}+ >+ <div+ class="absolute inset-y-1 right-1 w-0.5 rounded-full bg-input"+ classList={{ hidden: !isDraggingSlider() }}+ />+ </div>+ </Show>++ <div class="relative z-10 flex h-full items-center justify-between pl-1">+ <div class="flex min-w-0 items-center gap-2">+ <button+ class="size-5 min-w-5 overflow-hidden rounded-sm"+ onClick={props.onClick}+ onPointerDown={(e) => e.stopPropagation()}+ onFocusIn={(e) => e.stopPropagation()}+ >+ <OpacitySwatch color={props.color} opacity={props.opacity ?? 1} />+ </button>++ <input+ data-paint-editable="true"+ type="text"+ value={colorDraft()}+ class="min-w-0 bg-transparent text-xxs outline-none"+ classList={{ "cursor-default": !isFocusWithin() }}+ onInput={(event) => setColorDraft(event.currentTarget.value)}+ onPointerDown={handleInitialInputPointerDown}+ onKeyDown={(event) => {+ if (event.key === "Enter") {+ event.preventDefault();+ event.currentTarget.blur();+ return;+ }+ if (event.key !== "Escape") return;++ event.preventDefault();+ cancelColorCommit = true;+ setColorDraft(colorText());+ event.currentTarget.value = colorText();+ event.currentTarget.blur();+ }}+ onBlur={(event) => {+ if (cancelColorCommit) {+ cancelColorCommit = false;+ event.currentTarget.value = colorText();+ return;+ }++ commitColor();+ event.currentTarget.value = colorText();+ }}+ />+ </div>++ <Show when={hasOpacity()}>+ <div class="flex items-center">+ <input+ data-paint-editable="true"+ type="text"+ value={opacityDraft()}+ class="w-10 text-right text-xxs outline-none"+ classList={{ "cursor-default": !isFocusWithin() }}+ onInput={(event) => setOpacityDraft(event.currentTarget.value)}+ onPointerDown={handleInitialInputPointerDown}+ onKeyDown={(event) => {+ if (event.key === "Enter") {+ event.preventDefault();+ event.currentTarget.blur();+ return;+ }+ if (event.key !== "Escape") return;++ event.preventDefault();+ cancelOpacityCommit = true;+ const next = `${opacityPercent()}%`;+ setOpacityDraft(next);+ event.currentTarget.value = next;+ event.currentTarget.blur();+ }}+ onBlur={(event) => {+ if (cancelOpacityCommit) {+ cancelOpacityCommit = false;+ setOpacityDraft(`${opacityPercent()}%`);+ event.currentTarget.value = opacityDraft();+ return;+ }++ commitOpacity();+ setOpacityDraft(`${opacityPercent()}%`);+ event.currentTarget.value = opacityDraft();+ }}+ />++ <div+ class="min-w-2 z-20"+ onPointerDown={(e) => e.stopPropagation()}+ onFocusIn={(e) => e.stopPropagation()}+ >+ {props.keyframe}+ </div>+ </div>+ </Show>+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/ui/combobox.tsx b/apps/web/src/components/ui/combobox.tsxnew file mode 100644index 00000000..a0125ff6--- /dev/null+++ b/apps/web/src/components/ui/combobox.tsx@@ -0,0 +1,265 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/combobox++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { Combobox as ComboboxPrimitive } from "@kobalte/core/combobox"++import { cx } from "@/lib/cva"++export const ComboboxPortal = ComboboxPrimitive.Portal++export type ComboboxProps<+ Option,+ Group = never,+ T extends ValidComponent = "div",+> = ComponentProps<typeof ComboboxPrimitive<Option, Group, T>>++export const Combobox = <+ Option,+ Group = never,+ T extends ValidComponent = "div",+>(+ props: ComboboxProps<Option, Group, T>,+) => {+ const [, rest] = splitProps(props as ComboboxProps<Option, Group>, ["class"])++ return (+ <ComboboxPrimitive+ data-slot="combobox"+ class={cx("space-y-2", props.class)}+ {...rest}+ />+ )+}++export type ComboboxInputProps<T extends ValidComponent = "input"> =+ ComponentProps<typeof ComboboxPrimitive.Input<T>>++export const ComboboxInput = <T extends ValidComponent = "input">(+ props: ComboboxInputProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxInputProps, ["class"])++ return (+ <ComboboxPrimitive.Input+ data-slot="combobox-input"+ class={cx(+ "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground pr-3 outline-none",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ComboboxTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof ComboboxPrimitive.Trigger<T>>++export const ComboboxTrigger = <T extends ValidComponent = "button">(+ props: ComboboxTriggerProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxTriggerProps, ["class"])++ return (+ <ComboboxPrimitive.Trigger+ data-slot="combobox-trigger"+ class={cx(props.class)}+ {...rest}+ >+ <ComboboxPrimitive.Icon+ as="svg"+ class="text-muted-foreground size-3.5"+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24"+ >+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="m7 15l5 5l5-5M7 9l5-5l5 5"+ />+ </ComboboxPrimitive.Icon>+ </ComboboxPrimitive.Trigger>+ )+}++export type ComboboxControlProps<+ Option,+ T extends ValidComponent = "div",+> = ComponentProps<typeof ComboboxPrimitive.Control<Option, T>>++export const ComboboxControl = <Option, T extends ValidComponent = "div">(+ props: ComboboxControlProps<Option, T>,+) => {+ const [, rest] = splitProps(props as ComboboxControlProps<Option>, ["class"])++ return (+ <ComboboxPrimitive.Control+ data-slot="combobox-control"+ class={cx(+ "dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 md:text-sm",+ "data-[invalid]:ring-destructive/20 dark:data-[invalid]:ring-destructive/40 data-[invalid]:border-destructive",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ComboboxContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ComboboxPrimitive.Content<T>>++export const ComboboxContent = <T extends ValidComponent = "div">(+ props: ComboboxContentProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxContentProps, ["class"])++ return (+ <ComboboxPrimitive.Content+ data-slot="combobox-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 relative z-50 min-w-[8rem] origin-(--kb-combobox-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=combobox-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=combobox-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=combobox-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=combobox-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ >+ <ComboboxPrimitive.Listbox data-slot="combobox-listbox" class="p-1" />+ </ComboboxPrimitive.Content>+ )+}++export type ComboboxItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ComboboxPrimitive.Item<T>>++export const ComboboxItem = <T extends ValidComponent = "div">(+ props: ComboboxItemProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxItemProps, ["class", "children"])++ return (+ <ComboboxPrimitive.Item+ data-slot="combobox-item"+ class={cx(+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ props.class,+ )}+ {...rest}+ >+ {props.children}+ <ComboboxPrimitive.ItemIndicator>+ <ComboboxPrimitive.Icon+ as="svg"+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24"+ >+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M20 6L9 17l-5-5"+ />+ </ComboboxPrimitive.Icon>+ </ComboboxPrimitive.ItemIndicator>+ </ComboboxPrimitive.Item>+ )+}++export type ComboboxItemLabelProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ComboboxPrimitive.ItemLabel<T>>++export const ComboboxItemLabel = <T extends ValidComponent = "div">(+ props: ComboboxItemLabelProps<T>,+) => {+ return (+ <ComboboxPrimitive.ItemLabel data-slot="combobox-itemlabel" {...props} />+ )+}++export type ComboboxDescriptionProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ComboboxPrimitive.Description<T>>++export const ComboboxDescription = <T extends ValidComponent = "div">(+ props: ComboboxDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxDescriptionProps, ["class"])++ return (+ <ComboboxPrimitive.Description+ data-slot="combobox-description"+ class={cx(+ "text-muted-foreground text-sm data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ComboboxLabelProps<T extends ValidComponent = "label"> =+ ComponentProps<typeof ComboboxPrimitive.Label<T>>++export const ComboboxLabel = <T extends ValidComponent = "label">(+ props: ComboboxLabelProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxLabelProps, ["class"])++ return (+ <ComboboxPrimitive.Label+ data-slot="combobox-label"+ class={cx(+ "flex items-center gap-2 text-sm leading-none font-450 select-none data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ComboboxErrorMessageProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ComboboxPrimitive.ErrorMessage<T>>++export const ComboboxErrorMessage = <T extends ValidComponent = "div">(+ props: ComboboxErrorMessageProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxErrorMessageProps, ["class"])++ return (+ <ComboboxPrimitive.ErrorMessage+ data-slot="combobox-errormessage"+ class={cx(+ "text-destructive text-sm data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ComboboxSectionProps<T extends ValidComponent = "li"> =+ ComponentProps<typeof ComboboxPrimitive.Section<T>>++export const ComboboxSection = <T extends ValidComponent = "li">(+ props: ComboboxSectionProps<T>,+) => {+ const [, rest] = splitProps(props as ComboboxSectionProps, ["class"])++ return (+ <ComboboxPrimitive.Section+ data-slot="combobox-section"+ class={cx(+ "text-muted-foreground px-2 py-1.5 text-xs not-first-of-type:mt-1",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/command.tsx b/apps/web/src/components/ui/command.tsxnew file mode 100644index 00000000..8535cc3f--- /dev/null+++ b/apps/web/src/components/ui/command.tsx@@ -0,0 +1,198 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/command++import type { ComponentProps } from "solid-js"+import { splitProps } from "solid-js"+import { Command as CommandPrimitive } from "cmdk-solid"++import { cx } from "@/lib/cva"++export type CommandProps = ComponentProps<typeof CommandPrimitive>++export const Command = (props: CommandProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <CommandPrimitive+ data-slot="command"+ class={cx(+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CommandDialogProps = ComponentProps<+ typeof CommandPrimitive.Dialog+> & {+ title?: string+ description?: string+}++export const CommandDialog = (props: CommandDialogProps) => {+ const [, rest] = splitProps(props, [+ "contentClassName",+ "overlayClassName",+ "class",+ ])++ return (+ <CommandPrimitive.Dialog+ data-slot="command-dialog"+ contentClassName={cx(+ "bg-popover data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg shadow-lg duration-200 sm:max-w-lg overflow-hidden",+ props.contentClassName,+ )}+ overlayClassName={cx(+ "data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 fixed inset-0 z-50 bg-overlay",+ props.overlayClassName,+ )}+ class={cx(+ "bg-popover text-popover-foreground [&_[cmdk-group-heading]]:text-muted-foreground flex h-full w-full flex-col overflow-hidden rounded-md **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-450 [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CommandInputProps = ComponentProps<typeof CommandPrimitive.Input>++export const CommandInput = (props: CommandInputProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="command-input-wrapper"+ class="flex h-9 items-center gap-2 border-b px-3"+ >+ <svg+ xmlns="http://www.w3.org/2000/svg"+ class="size-4 shrink-0 opacity-50"+ viewBox="0 0 24 24"+ >+ <g+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ >+ <circle cx="11" cy="11" r="8" />+ <path d="m21 21l-4.3-4.3" />+ </g>+ </svg>+ <CommandPrimitive.Input+ data-slot="command-input"+ class={cx(+ "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",+ props.class,+ )}+ {...rest}+ />+ </div>+ )+}++export type CommandListProps = ComponentProps<typeof CommandPrimitive.List>++export const CommandList = (props: CommandListProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <CommandPrimitive.List+ data-slot="command-list"+ class={cx(+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CommandEmptyProps = ComponentProps<typeof CommandPrimitive.Empty>++export const CommandEmpty = (props: CommandEmptyProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <CommandPrimitive.Empty+ data-slot="command-empty"+ class={cx("py-6 text-center text-sm", props.class)}+ {...rest}+ />+ )+}++export type CommandGroupProps = ComponentProps<typeof CommandPrimitive.Group>++export const CommandGroup = (props: CommandGroupProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <CommandPrimitive.Group+ data-slot="command-group"+ class={cx(+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-450",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CommandSeparatorProps = ComponentProps<+ typeof CommandPrimitive.Separator+>++export const CommandSeparator = (props: CommandSeparatorProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <CommandPrimitive.Separator+ data-slot="command-separator"+ class={cx("bg-border -mx-1 h-px", props.class)}+ {...rest}+ />+ )+}++export type CommandItemProps = ComponentProps<typeof CommandPrimitive.Item>++export const CommandItem = (props: CommandItemProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <CommandPrimitive.Item+ data-slot="command-item"+ class={cx(+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ props.class,+ )}+ {...rest}+ />+ )+}++export type CommandShortcutProps = ComponentProps<"span">++export const CommandShortcut = (props: CommandShortcutProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <span+ data-slot="command-shortcut"+ class={cx(+ "text-muted-foreground ml-auto text-xs tracking-widest",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/context-menu.tsx b/apps/web/src/components/ui/context-menu.tsxnew file mode 100644index 00000000..b4dd00ee--- /dev/null+++ b/apps/web/src/components/ui/context-menu.tsx@@ -0,0 +1,376 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/context-menu++import type { Accessor, ComponentProps, ValidComponent } from "solid-js"+import { createContext, splitProps, useContext } from "solid-js"+import { ContextMenu as ContextMenuPrimitive } from "@kobalte/core/context-menu"++import { cx } from "@/lib/cva"++export const ContextMenuPortal = ContextMenuPrimitive.Portal+const ContextMenuContentDisabledContext = createContext<Accessor<boolean>>()++const useContextMenuContentDisabled = () => {+ return useContext(ContextMenuContentDisabledContext) ?? (() => false)+}++export type ContextMenuProps = ComponentProps<typeof ContextMenuPrimitive>++export const ContextMenu = (props: ContextMenuProps) => {+ return <ContextMenuPrimitive data-slot="context-menu" {...props} />+}++export type ContextMenuTriggerProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.Trigger<T>>++export const ContextMenuTrigger = <T extends ValidComponent = "div">(+ props: ContextMenuTriggerProps<T>,+) => {+ return (+ <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />+ )+}++export type ContextMenuGroupProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.Group<T>>++export const ContextMenuGroup = <T extends ValidComponent = "div">(+ props: ContextMenuGroupProps<T>,+) => {+ return (+ <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />+ )+}++export type ContextMenuSubProps = ComponentProps<+ typeof ContextMenuPrimitive.Sub+>++export const ContextMenuSub = (props: ContextMenuSubProps) => {+ return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />+}++export type ContextMenuRadioGroupProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.RadioGroup<T>>++export const ContextMenuRadioGroup = <T extends ValidComponent = "div">(+ props: ContextMenuRadioGroupProps<T>,+) => {+ return (+ <ContextMenuPrimitive.RadioGroup+ data-slot="context-menu-radio-group"+ {...props}+ />+ )+}++export type ContextMenuSubTriggerProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.SubTrigger<T>> & {+ inset?: boolean+ }++export const ContextMenuSubTrigger = <T extends ValidComponent = "div">(+ props: ContextMenuSubTriggerProps<T>,+) => {+ const isContentDisabled = useContextMenuContentDisabled()+ const [local, rest] = splitProps(props as ContextMenuSubTriggerProps, [+ "class",+ "children",+ "inset",+ "disabled",+ ])++ return (+ <ContextMenuPrimitive.SubTrigger+ data-slot="context-menu-sub-trigger"+ data-inset={local.inset}+ disabled={local.disabled || isContentDisabled()}+ class={cx(+ "group data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground data-[expanded]:bg-primary data-[expanded]:text-primary-foreground flex cursor-default items-center gap-1 rounded-md bg-popover pl-2 pr-0 py-0 text-xs outline-hidden select-none data-[inset]:pl-8 data-[highlighted]:[&_svg]:text-primary-foreground data-[expanded]:[&_svg]:text-primary-foreground h-7 w-full",+ local.class,+ )}+ {...rest}+ >+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {local.children}+ </span>+ <span class="h-7 w-6 shrink-0 flex items-center justify-center text-muted-foreground">+ <svg xmlns="http://www.w3.org/2000/svg" class="size-4" viewBox="0 0 24 24">+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="m9 18l6-6l-6-6"+ />+ </svg>+ </span>+ </ContextMenuPrimitive.SubTrigger>+ )+}++export type ContextMenuSubContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.SubContent<T>>++export const ContextMenuSubContent = <T extends ValidComponent = "div">(+ props: ContextMenuSubContentProps<T>,+) => {+ const [, rest] = splitProps(props as ContextMenuSubContentProps, ["class"])++ return (+ <ContextMenuPrimitive.SubContent+ data-slot="context-menu-sub-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-[10000] min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-x-hidden overflow-y-auto flex flex-col gap-2 rounded-xl border border-border p-2 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12),0px_12px_16px_0px_rgba(0,0,0,0.16)] outline-none max-h-[var(--kb-popper-content-available-height)]",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=context-menu-sub-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=context-menu-sub-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=context-menu-sub-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=context-menu-sub-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ContextMenuContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.Content<T>> & {+ disabled?: boolean+ }++// Keep `ContextMenuContent` mounted while a menu may be open.+// Unmounting it from volatile app state (for example selection changes) can bypass close animations.+export const ContextMenuContent = <T extends ValidComponent = "div">(+ props: ContextMenuContentProps<T>,+) => {+ const [local, rest] = splitProps(props as ContextMenuContentProps, [+ "class",+ "disabled",+ ])++ return (+ <ContextMenuContentDisabledContext.Provider value={() => !!local.disabled}>+ <ContextMenuPrimitive.Content+ data-slot="context-menu-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-[10000] min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-x-hidden overflow-y-auto flex flex-col gap-2 rounded-xl border border-border p-2 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12),0px_12px_16px_0px_rgba(0,0,0,0.16)] outline-none max-h-[var(--kb-popper-content-available-height)]",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=context-menu-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=context-menu-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=context-menu-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=context-menu-content]]:slide-in-from-right-2",+ local.class,+ )}+ {...rest}+ />+ </ContextMenuContentDisabledContext.Provider>+ )+}++export type ContextMenuItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.Item<T>> & {+ inset?: boolean+ variant?: "default" | "destructive"+ }++export const ContextMenuItem = <T extends ValidComponent = "div">(+ props: ContextMenuItemProps<T>,+) => {+ const isContentDisabled = useContextMenuContentDisabled()+ const [local, rest] = splitProps(props as ContextMenuItemProps, [+ "class",+ "inset",+ "variant",+ "disabled",+ ])++ return (+ <ContextMenuPrimitive.Item+ data-slot="context-menu-item"+ data-inset={local.inset}+ data-variant={local.variant}+ disabled={local.disabled || isContentDisabled()}+ class={cx(+ "group data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground data-[disabled]:data-[highlighted]:bg-transparent data-[disabled]:data-[highlighted]:text-muted-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-1 rounded-md bg-popover px-2 py-0 text-xs outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 h-7 w-full data-[highlighted]:[&_svg]:text-primary-foreground",+ local.class,+ )}+ {...rest}+ />+ )+}++export type ContextMenuCheckboxItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.CheckboxItem<T>>++export const ContextMenuCheckboxItem = <T extends ValidComponent = "div">(+ props: ContextMenuCheckboxItemProps<T>,+) => {+ const isContentDisabled = useContextMenuContentDisabled()+ const [local, rest] = splitProps(props as ContextMenuCheckboxItemProps, [+ "class",+ "children",+ "disabled",+ ])++ return (+ <ContextMenuPrimitive.CheckboxItem+ data-slot="context-menu-checkbox-item"+ disabled={local.disabled || isContentDisabled()}+ class={cx(+ "group data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ local.class,+ )}+ {...rest}+ >+ <span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">+ <ContextMenuPrimitive.ItemIndicator+ as="svg"+ xmlns="http://www.w3.org/2000/svg"+ class="size-4"+ viewBox="0 0 24 24"+ >+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M20 6L9 17l-5-5"+ />+ </ContextMenuPrimitive.ItemIndicator>+ </span>+ {local.children}+ </ContextMenuPrimitive.CheckboxItem>+ )+}++export type ContextMenuRadioItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.RadioItem<T>>++export const ContextMenuRadioItem = <T extends ValidComponent = "div">(+ props: ContextMenuRadioItemProps<T>,+) => {+ const isContentDisabled = useContextMenuContentDisabled()+ const [local, rest] = splitProps(props as ContextMenuRadioItemProps, [+ "class",+ "children",+ "disabled",+ ])++ return (+ <ContextMenuPrimitive.RadioItem+ data-slot="context-menu-radio-item"+ disabled={local.disabled || isContentDisabled()}+ class={cx(+ "group data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ local.class,+ )}+ {...rest}+ >+ <span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">+ <ContextMenuPrimitive.ItemIndicator+ as="svg"+ xmlns="http://www.w3.org/2000/svg"+ class="size-2"+ viewBox="0 0 24 24"+ >+ <circle+ cx="12"+ cy="12"+ r="10"+ fill="currentColor"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ />+ </ContextMenuPrimitive.ItemIndicator>+ </span>+ {local.children}+ </ContextMenuPrimitive.RadioItem>+ )+}++export type ContextMenuGroupLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof ContextMenuPrimitive.GroupLabel<T>> & {+ inset?: boolean+ }++export const ContextMenuGroupLabel = <T extends ValidComponent = "span">(+ props: ContextMenuGroupLabelProps<T>,+) => {+ const [, rest] = splitProps(props as ContextMenuGroupLabelProps, [+ "class",+ "inset",+ ])++ return (+ <ContextMenuPrimitive.GroupLabel+ as="div"+ data-slot="context-menu-group-label"+ data-inset={props.inset}+ class={cx(+ "text-foreground my-1.5 px-2 text-sm font-450 data-[inset]:pl-8",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ContextMenuItemLabelProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof ContextMenuPrimitive.ItemLabel<T>> & {+ inset?: boolean+ }++export const ContextMenuItemLabel = <T extends ValidComponent = "div">(+ props: ContextMenuItemLabelProps<T>,+) => {+ const [, rest] = splitProps(props as ContextMenuItemLabelProps, [+ "class",+ "inset",+ ])++ return (+ <ContextMenuPrimitive.ItemLabel+ data-slot="context-menu-item-label"+ data-inset={props.inset}+ class={cx(+ "text-foreground px-2 py-1.5 text-sm font-450 data-[inset]:pl-8",+ props.class,+ )}+ {...rest}+ />+ )+}++export type ContextMenuSeparatorProps<T extends ValidComponent = "hr"> =+ ComponentProps<typeof ContextMenuPrimitive.Separator<T>>++export const ContextMenuSeparator = <T extends ValidComponent = "hr">(+ props: ContextMenuSeparatorProps<T>,+) => {+ const [, rest] = splitProps(props as ContextMenuSeparatorProps, ["class"])++ return (+ <ContextMenuPrimitive.Separator+ data-slot="context-menu-separator"+ class={cx("bg-border h-px w-full", props.class)}+ {...rest}+ />+ )+}++export type ContextMenuShortcutProps = ComponentProps<"span">++export const ContextMenuShortcut = (props: ContextMenuShortcutProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <span+ data-slot="context-menu-shortcut"+ class={cx(+ "ml-auto min-w-5 text-right text-xxs text-muted-foreground group-[[data-highlighted]]:text-[inherit] group-[[data-expanded]]:text-[inherit]",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/control-group.tsx b/apps/web/src/components/ui/control-group.tsxnew file mode 100644index 00000000..7a95657b--- /dev/null+++ b/apps/web/src/components/ui/control-group.tsx@@ -0,0 +1,45 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { JSX } from "solid-js";+import { splitProps, Show } from "solid-js";+import { cx } from "@/lib/cva";++type DivProps = JSX.IntrinsicElements["div"];++type ControlRowProps = DivProps & {+ label?: string | JSX.Element;+ labelClass?: string;+ contentClass?: string;+ ref?: HTMLDivElement;+};++export function ControlRow(props: ControlRowProps) {+ const [local, others] = splitProps(props, [+ "class",+ "children",+ "label",+ "labelClass",+ "contentClass",+ "ref",+ ]);++ return (+ <div class={cx("flex items-center gap-2", local.class)} ref={local.ref} {...others}>+ <Show when={typeof local.label === "string"}>+ <span+ class={cx(+ "w-16 shrink-0 text-xs text-muted-foreground truncate",+ local.labelClass,+ )}+ >+ {local.label}+ </span>+ </Show>+ <div class={cx("flex-1 min-w-0", local.contentClass)}>+ {local.children}+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/ui/control-scrollarea.tsx b/apps/web/src/components/ui/control-scrollarea.tsxnew file mode 100644index 00000000..138298d0--- /dev/null+++ b/apps/web/src/components/ui/control-scrollarea.tsx@@ -0,0 +1,39 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { JSX } from 'solid-js';+import { splitProps, onCleanup, onMount } from 'solid-js';+import { cx } from '@/lib/cva';++export function ControlScrollArea(props: JSX.IntrinsicElements['div']) {+ const [local, others] = splitProps(props, ['class', 'children']);+ let scrollEl: HTMLDivElement | undefined;+ let borderEl: HTMLDivElement | undefined;++ const onScroll = () => {+ if (!scrollEl || !borderEl) return;+ borderEl.classList.toggle('hidden', scrollEl.scrollTop <= 0);+ };++ onMount(() => {+ scrollEl?.addEventListener('scroll', onScroll);+ });+ onCleanup(() => scrollEl?.removeEventListener('scroll', onScroll));++ return (+ <div class={cx('relative', local.class)} {...others}>+ <div+ ref={scrollEl}+ class="overflow-y-auto overflow-x-hidden absolute inset-0"+ >+ {local.children}+ </div>+ <div+ ref={borderEl}+ class="hidden absolute left-0 right-0 top-0 h-px bg-border"+ />+ </div>+ );+}+diff --git a/apps/web/src/components/ui/dialog.tsx b/apps/web/src/components/ui/dialog.tsxnew file mode 100644index 00000000..40634cb8--- /dev/null+++ b/apps/web/src/components/ui/dialog.tsx@@ -0,0 +1,165 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/dialog++import type { ComponentProps, ValidComponent } from "solid-js"+import { Show, mergeProps, splitProps } from "solid-js"+import { Dialog as DialogPrimitive } from "@kobalte/core/dialog"++import { cx } from "@/lib/cva"++export const DialogPortal = DialogPrimitive.Portal++export type DialogProps = ComponentProps<typeof DialogPrimitive>++export const Dialog = (props: DialogProps) => {+ return <DialogPrimitive data-slot="dialog" {...props} />+}++export type DialogTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof DialogPrimitive.Trigger<T>>++export const DialogTrigger = <T extends ValidComponent = "button">(+ props: DialogTriggerProps<T>,+) => {+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />+}++export type DialogCloseButtonProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof DialogPrimitive.CloseButton<T>>++export const DialogCloseButton = <T extends ValidComponent = "button">(+ props: DialogCloseButtonProps<T>,+) => {+ return <DialogPrimitive.CloseButton data-slot="dialog-close" {...props} />+}++export type DialogContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DialogPrimitive.Content<T>> & {+ showCloseButton?: boolean+ overlayClass?: string+ }++export const DialogContent = <T extends ValidComponent = "div">(+ props: DialogContentProps<T>,+) => {+ const merge = mergeProps(+ {+ showCloseButton: true,+ } as DialogContentProps,+ props,+ )+ const [local, rest] = splitProps(merge, [+ "class",+ "children",+ "showCloseButton",+ "overlayClass",+ ])++ return (+ <>+ <DialogPrimitive.Overlay+ data-slot="dialog-overlay"+ class={cx(+ "data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 fixed inset-0 z-50 bg-overlay",+ local.overlayClass,+ )}+ />+ <DialogPrimitive.Content+ data-slot="dialog-content"+ class={cx(+ "bg-background focus-visible:ring-none data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",+ local.class,+ )}+ {...rest}+ >+ {local.children}+ <Show when={local.showCloseButton}>+ <DialogPrimitive.CloseButton+ aria-label="Close"+ class="focus-visible:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-[opacity,box-shadow] duration-200 hover:opacity-100 focus-visible:ring-2 focus-visible:outline-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"+ >+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M18 6L6 18M6 6l12 12"+ />+ </svg>+ </DialogPrimitive.CloseButton>+ </Show>+ </DialogPrimitive.Content>+ </>+ )+}++export type DialogHeaderProps = ComponentProps<"div">++export const DialogHeader = (props: DialogHeaderProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="dialog-header"+ class={cx("flex flex-col gap-2 text-center sm:text-left", props.class)}+ {...rest}+ />+ )+}++export type DialogFooterProps = ComponentProps<"div">++export const DialogFooter = (props: DialogFooterProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="dialog-footer"+ class={cx(+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",+ props.class,+ )}+ {...rest}+ />+ )+}++export type DialogTitleProps<T extends ValidComponent = "h2"> = ComponentProps<+ typeof DialogPrimitive.Title<T>+>++export const DialogTitle = <T extends ValidComponent = "h2">(+ props: DialogTitleProps<T>,+) => {+ const [, rest] = splitProps(props as DialogTitleProps, ["class"])++ return (+ <DialogPrimitive.Title+ data-slot="dialog-title"+ class={cx("leading-none text-[12px] font-450", props.class)}+ {...rest}+ />+ )+}++export type DialogDescriptionProps<T extends ValidComponent = "p"> =+ ComponentProps<typeof DialogPrimitive.Description<T>>++export const DialogDescription = <T extends ValidComponent = "p">(+ props: DialogDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as DialogDescriptionProps, ["class"])++ return (+ <DialogPrimitive.Description+ data-slot="dialog-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/dropdown-menu.tsx b/apps/web/src/components/ui/dropdown-menu.tsxnew file mode 100644index 00000000..fc3654e6--- /dev/null+++ b/apps/web/src/components/ui/dropdown-menu.tsx@@ -0,0 +1,370 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/dropdown-menu++import type { ComponentProps, ValidComponent } from "solid-js"+import { mergeProps, splitProps } from "solid-js"+import { DropdownMenu as DropdownMenuPrimitive } from "@kobalte/core/dropdown-menu"++import { cx } from "@/lib/cva"+import { Icon } from "@/components/ui/icon"++export const DropdownMenuPortal = DropdownMenuPrimitive.Portal++export type DropdownMenuProps = ComponentProps<typeof DropdownMenuPrimitive>++export const DropdownMenu = (props: DropdownMenuProps) => {+ const merge = mergeProps<DropdownMenuProps[]>(+ {+ gutter: 4,+ modal: false,+ },+ props,+ )++ return <DropdownMenuPrimitive data-slot="dropdown-menu" {...merge} />+}++export type DropdownMenuTriggerProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.Trigger<T>>++export const DropdownMenuTrigger = <T extends ValidComponent = "div">(+ props: DropdownMenuTriggerProps<T>,+) => {+ return (+ <DropdownMenuPrimitive.Trigger+ data-slot="dropdown-menu-trigger"+ {...props}+ />+ )+}++export type DropdownMenuGroupProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.Group<T>>++export const DropdownMenuGroup = <T extends ValidComponent = "div">(+ props: DropdownMenuGroupProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuGroupProps, ["class"])++ return (+ <DropdownMenuPrimitive.Group+ data-slot="dropdown-menu-group"+ class={cx("flex flex-col gap-0 w-full", props.class)}+ {...rest}+ />+ )+}++export type DropdownMenuSubProps = ComponentProps<+ typeof DropdownMenuPrimitive.Sub+>++export const DropdownMenuSub = (props: DropdownMenuSubProps) => {+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />+}++export type DropdownMenuRadioGroupProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.RadioGroup<T>>++export const DropdownMenuRadioGroup = <T extends ValidComponent = "div">(+ props: DropdownMenuRadioGroupProps<T>,+) => {+ return (+ <DropdownMenuPrimitive.RadioGroup+ data-slot="dropdown-menu-radio-group"+ {...props}+ />+ )+}++export type DropdownMenuSubTriggerProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.SubTrigger<T>> & {+ inset?: boolean+ }++export const DropdownMenuSubTrigger = <T extends ValidComponent = "div">(+ props: DropdownMenuSubTriggerProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuSubTriggerProps, [+ "class",+ "children",+ "inset",+ ])++ return (+ <DropdownMenuPrimitive.SubTrigger+ data-slot="dropdown-menu-sub-trigger"+ data-inset={props.inset}+ class={cx(+ "group data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground data-[expanded]:bg-primary data-[expanded]:text-primary-foreground flex cursor-default items-center gap-1 rounded-md bg-popover pl-2 pr-0 py-0 text-xs outline-hidden select-none data-[inset]:pl-8 data-[highlighted]:[&_svg]:text-primary-foreground data-[expanded]:[&_svg]:text-primary-foreground h-7 w-full",+ props.class,+ )}+ {...rest}+ >+ <span class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {props.children}+ </span>+ <span class="h-7 w-6 shrink-0 flex items-center justify-center text-muted-foreground">+ <Icon name="chevron-right" />+ </span>+ </DropdownMenuPrimitive.SubTrigger>+ )+}++export type DropdownMenuSubContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.SubContent<T>>++export const DropdownMenuSubContent = <T extends ValidComponent = "div">(+ props: DropdownMenuSubContentProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuSubContentProps, ["class"])++ return (+ <DropdownMenuPrimitive.SubContent+ data-slot="dropdown-menu-sub-content"+ class={cx(+ "bg-popover translate-x-2.5 -translate-y-2 text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-[10000] min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-x-hidden overflow-y-auto flex flex-col gap-2 rounded-xl border border-border p-2 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12),0px_12px_16px_0px_rgba(0,0,0,0.16)] outline-none max-h-[var(--kb-popper-content-available-height)]",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=dropdown-menu-sub-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=dropdown-menu-sub-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=dropdown-menu-sub-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=dropdown-menu-sub-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ />+ )+}++export type DropdownMenuContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.Content<T>>++export const DropdownMenuContent = <T extends ValidComponent = "div">(+ props: DropdownMenuContentProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuContentProps, ["class"])++ return (+ <DropdownMenuPrimitive.Content+ data-slot="dropdown-menu-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-[10000] min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-x-hidden overflow-y-auto flex flex-col gap-2 rounded-xl border border-border p-2 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12),0px_12px_16px_0px_rgba(0,0,0,0.16)] outline-none max-h-[var(--kb-popper-content-available-height)]",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=dropdown-menu-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=dropdown-menu-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=dropdown-menu-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=dropdown-menu-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ />+ )+}++export type DropdownMenuItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.Item<T>> & {+ inset?: boolean+ tone?: "primary" | "neutral"+ variant?: "default" | "destructive"+ }++export const DropdownMenuItem = <T extends ValidComponent = "div">(+ props: DropdownMenuItemProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuItemProps, [+ "class",+ "inset",+ "tone",+ "variant",+ ])++ return (+ <DropdownMenuPrimitive.Item+ data-slot="dropdown-menu-item"+ data-inset={props.inset}+ data-variant={props.variant}+ class={cx(+ "group [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-1 rounded-md bg-popover px-2 py-0 text-xs outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 h-7 min-h-7 w-full",+ props.tone === "neutral"+ ? "data-[highlighted]:bg-input data-[highlighted]:text-foreground data-[highlighted]:[&_svg]:text-foreground"+ : "data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground data-[highlighted]:[&_svg]:text-primary-foreground",+ "data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive",+ props.class,+ )}+ {...rest}+ />+ )+}++export type DropdownMenuCheckboxItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem<T>>++export const DropdownMenuCheckboxItem = <T extends ValidComponent = "div">(+ props: DropdownMenuCheckboxItemProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuCheckboxItemProps, [+ "class",+ "children",+ ])++ return (+ <DropdownMenuPrimitive.CheckboxItem+ data-slot="dropdown-menu-checkbox-item"+ class={cx(+ "h-7 group data-highlighted:bg-primary data-highlighted:text-foreground relative flex cursor-default items-center gap-0 rounded-sm py-1.5 pr-2 pl-7 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-6",+ props.class,+ )}+ {...rest}+ >+ <span class="pointer-events-none absolute left-0 flex size-6 items-center justify-center">+ <DropdownMenuPrimitive.ItemIndicator>+ <Icon name="confirm-check" class="size-6 text-foreground" />+ </DropdownMenuPrimitive.ItemIndicator>+ </span>+ {props.children}+ </DropdownMenuPrimitive.CheckboxItem>+ )+}++export type DropdownMenuRadioItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.RadioItem<T>>++export const DropdownMenuRadioItem = <T extends ValidComponent = "div">(+ props: DropdownMenuRadioItemProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuRadioItemProps, [+ "class",+ "children",+ ])++ return (+ <DropdownMenuPrimitive.RadioItem+ data-slot="dropdown-menu-radio-item"+ class={cx(+ "group data-[highlighted]:bg-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ props.class,+ )}+ {...rest}+ >+ <span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">+ <DropdownMenuPrimitive.ItemIndicator+ as="svg"+ xmlns="http://www.w3.org/2000/svg"+ class="size-1"+ viewBox="0 0 24 24"+ >+ <circle+ cx="12"+ cy="12"+ r="10"+ fill="currentColor"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ />+ </DropdownMenuPrimitive.ItemIndicator>+ </span>+ {props.children}+ </DropdownMenuPrimitive.RadioItem>+ )+}++export type DropdownMenuGroupLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof DropdownMenuPrimitive.GroupLabel<T>> & {+ inset?: boolean+ }++export const DropdownMenuGroupLabel = <T extends ValidComponent = "span">(+ props: DropdownMenuGroupLabelProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuGroupLabelProps, [+ "class",+ "inset",+ ])++ return (+ <DropdownMenuPrimitive.GroupLabel+ as="div"+ data-slot="dropdown-menu-group-label"+ data-inset={props.inset}+ class={cx(+ "text-muted-foreground my-1.5 px-2 text-xs font-normal data-[inset]:pl-8",+ props.class,+ )}+ {...rest}+ />+ )+}++export type DropdownMenuItemLabelProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof DropdownMenuPrimitive.ItemLabel<T>> & {+ inset?: boolean+ }++export const DropdownMenuItemLabel = <T extends ValidComponent = "div">(+ props: DropdownMenuItemLabelProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuItemLabelProps, [+ "class",+ "inset",+ ])++ return (+ <DropdownMenuPrimitive.ItemLabel+ data-slot="dropdown-menu-item-label"+ data-inset={props.inset}+ class={cx(+ "text-foreground px-2 py-1.5 text-sm font-450 data-[inset]:pl-8",+ props.class,+ )}+ {...rest}+ />+ )+}++export type DropdownMenuSeparatorProps<T extends ValidComponent = "hr"> =+ ComponentProps<typeof DropdownMenuPrimitive.Separator<T>>++export const DropdownMenuSeparator = <T extends ValidComponent = "hr">(+ props: DropdownMenuSeparatorProps<T>,+) => {+ const [, rest] = splitProps(props as DropdownMenuSeparatorProps, ["class"])++ return (+ <DropdownMenuPrimitive.Separator+ data-slot="dropdown-menu-separator"+ class={cx("bg-border h-px w-full", props.class)}+ {...rest}+ />+ )+}++export type DropdownMenuShortcutProps = ComponentProps<"span">++export const DropdownMenuShortcut = (props: DropdownMenuShortcutProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <span+ data-slot="dropdown-menu-shortcut"+ class={cx(+ "text-muted-foreground ml-auto text-xs tracking-widest group-[[data-highlighted]]:text-[inherit] group-[[data-expanded]]:text-[inherit]",+ props.class,+ )}+ {...rest}+ />+ )+}++export type DropdownMenuItemDetailProps = ComponentProps<"span">++export const DropdownMenuItemDetail = (props: DropdownMenuItemDetailProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <span+ data-slot="dropdown-menu-item-detail"+ class={cx(+ "min-w-5 text-right text-xxs text-muted-foreground group-[[data-highlighted]]:text-[inherit] group-[[data-expanded]]:text-[inherit]",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/fill-item.tsx b/apps/web/src/components/ui/fill-item.tsxnew file mode 100644index 00000000..3731b088--- /dev/null+++ b/apps/web/src/components/ui/fill-item.tsx@@ -0,0 +1,463 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createMemo, createSignal, onCleanup, Show } from "solid-js";+import { AssetThumbnail } from "@/components/ui/asset-thumbnail";+import { Keyframe } from "@/components/ui/keyframe";+import { OpacitySwatch } from "@/components/ui/opacity-swatch";+import { useEngine } from "@/context/engine";+import { mergeColorWithOpacity } from "@/utils";+import { colorToHex, parseColor } from "@/utils/color";+import { ChildOf, PaintType, useEntityState, useEntityStates, useQuery, setComponent } from "../engine";+import { Not } from 'bitecs';++const DRAG_THRESHOLD_PX = 3;++type FillItemProps = {+ nodeEid: number;+ fillEid: number;+ onClick?(event: MouseEvent): void;+};++export function FillItem(props: FillItemProps) {+ const { world } = useEngine();+ const c = world.components;++ const [isDraggingSlider, setIsDraggingSlider] = createSignal(false);++ const [colorDraft, setColorDraft] = createSignal("");+ const [opacityDraft, setOpacityDraft] = createSignal("");+ const [isFocusWithin, setIsFocusWithin] = createSignal(false);++ let rootRef: HTMLDivElement | undefined;+ let activePointerId: number | null = null;+ let pointerStart: { x: number; y: number } | null = null;+ let pointerStartTarget: HTMLElement | null = null;+ let dragStarted = false;++ let cancelColorCommit = false;+ let cancelOpacityCommit = false;++ const color = useEntityState(c.Computed.color, props.fillEid, 0xE0E0E0);+ const opacity = useEntityState(c.Computed.opacity, props.fillEid, 1);++ const updateColor = (color: number) => {+ setComponent(world, props.fillEid, c.Color, color);+ };++ const updateOpacity = (opacity: number) => {+ setComponent(world, props.fillEid, c.Appearance, {+ opacity: Math.round(opacity * 100) / 100,+ });+ };++ const fillType = useEntityState(c.Paint, props.fillEid, PaintType.SOLID);+ const isSolidFill = createMemo(() => fillType() === PaintType.SOLID);++ const colorText = createMemo(() => colorToHex(color()).replace("#", ""));++ createEffect(() => {+ setColorDraft(colorText());+ });++ const opacityPercent = createMemo(() => Math.round(opacity() * 100));+ createEffect(() => {+ setOpacityDraft(`${opacityPercent()}%`);+ });++ const applyOpacityFromClientX = (clientX: number) => {+ const root = rootRef;+ if (!root) return;++ const rect = root.getBoundingClientRect();+ if (rect.width <= 0) return;++ const ratio = (clientX - rect.left) / rect.width;+ const clamped = Math.max(0, Math.min(1, ratio));++ updateOpacity(clamped);+ };++ const commitColor = () => {+ const nextColor = parseColor(colorDraft());+ if (nextColor === null) {+ setColorDraft(colorText());+ return;+ }++ if (nextColor === color()) return;++ updateColor(nextColor);+ };++ const commitOpacity = () => {+ const raw = opacityDraft().replace("%", "").trim();+ const parsed = Number.parseFloat(raw);+ if (!Number.isFinite(parsed)) {+ setOpacityDraft(`${opacityPercent()}%`);+ return;+ }++ const clamped = Math.max(0, Math.min(100, Math.round(parsed)));+ const nextOpacity = clamped / 100;++ updateOpacity(nextOpacity);+ };++ const resetPointerState = () => {+ activePointerId = null;+ pointerStart = null;+ dragStarted = false;+ };++ const removeWindowListeners = () => {+ window.removeEventListener("pointermove", handlePointerMove);+ window.removeEventListener("pointerup", handlePointerUp);+ window.removeEventListener("pointercancel", handlePointerUp);+ };++ const handlePointerMove = (event: PointerEvent) => {+ if (activePointerId === null || event.pointerId !== activePointerId) return;+ if (!pointerStart) return;++ const moved = Math.abs(event.clientX - pointerStart.x) >= DRAG_THRESHOLD_PX;+ if (!dragStarted && moved) {+ dragStarted = true;+ setIsDraggingSlider(true);+ const active = document.activeElement;+ if (active instanceof HTMLElement && rootRef?.contains(active)) {+ active.blur();+ }+ world.history.startTransaction("Edit paint opacity");+ }++ if (dragStarted) {+ applyOpacityFromClientX(event.clientX);+ }+ };++ const handlePointerUp = (event: PointerEvent) => {+ if (activePointerId === null || event.pointerId !== activePointerId) return;++ const wasDragging = dragStarted;+ const startTarget = pointerStartTarget;++ removeWindowListeners();++ if (wasDragging) {+ world.history.commitTransaction();+ setIsDraggingSlider(false);+ resetPointerState();+ pointerStartTarget = null;+ return;+ }++ resetPointerState();+ pointerStartTarget = null;++ if (startTarget && rootRef?.contains(startTarget)) {+ if (startTarget instanceof HTMLInputElement) {+ startTarget.focus();+ startTarget.select();+ return;+ }++ const interactive = startTarget.closest(+ "button, [role='button'], a, input, select, textarea",+ );+ if (+ interactive instanceof HTMLElement &&+ interactive !== rootRef &&+ rootRef.contains(interactive)+ ) {+ interactive.dispatchEvent(+ new MouseEvent("click", {+ bubbles: true,+ cancelable: true,+ clientX: event.clientX,+ clientY: event.clientY,+ view: window,+ }),+ );+ }+ }+ };++ const handlePointerDown = (event: PointerEvent) => {+ if (event.button !== 0) return;+ if (activePointerId !== null) return;+ event.preventDefault();++ pointerStart = { x: event.clientX, y: event.clientY };+ pointerStartTarget = event.target instanceof HTMLElement ? event.target : null;+ activePointerId = event.pointerId;+ dragStarted = false;+ rootRef?.setPointerCapture?.(event.pointerId);++ window.addEventListener("pointermove", handlePointerMove);+ window.addEventListener("pointerup", handlePointerUp);+ window.addEventListener("pointercancel", handlePointerUp);+ };++ onCleanup(() => {+ if (dragStarted) world.history.commitTransaction();+ removeWindowListeners();+ setIsDraggingSlider(false);+ resetPointerState();+ });++ const handleFocusIn = () => {+ setIsFocusWithin(true);+ };++ const handleFocusOut = (event: FocusEvent & { currentTarget: HTMLDivElement }) => {+ const related = event.relatedTarget;+ if (related instanceof Node && event.currentTarget.contains(related)) return;+ setIsFocusWithin(false);+ };++ const handleColorInput = (event: InputEvent & { currentTarget: HTMLInputElement }) => {+ setColorDraft(event.currentTarget.value);+ };++ const handleColorKeyDown = (event: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (event.key === "Enter") {+ event.preventDefault();+ event.currentTarget.blur();+ return;+ }++ if (event.key !== "Escape") return;+ event.preventDefault();+ cancelColorCommit = true;+ setColorDraft(colorText());+ event.currentTarget.value = colorText();+ event.currentTarget.blur();+ };++ const handleColorBlur = (event: FocusEvent & { currentTarget: HTMLInputElement }) => {+ if (cancelColorCommit) {+ cancelColorCommit = false;+ event.currentTarget.value = colorText();+ return;+ }++ commitColor();+ event.currentTarget.value = colorText();+ };++ const handleOpacityInput = (event: InputEvent & { currentTarget: HTMLInputElement }) => {+ setOpacityDraft(event.currentTarget.value);+ };++ const handleOpacityKeyDown = (event: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (event.key === "Enter") {+ event.preventDefault();+ event.currentTarget.blur();+ return;+ }++ if (event.key !== "Escape") return;+ event.preventDefault();+ cancelOpacityCommit = true;+ const next = `${opacityPercent()}%`;+ setOpacityDraft(next);+ event.currentTarget.value = next;+ event.currentTarget.blur();+ };++ const handleOpacityBlur = (event: FocusEvent & { currentTarget: HTMLInputElement }) => {+ if (cancelOpacityCommit) {+ cancelOpacityCommit = false;+ setOpacityDraft(`${opacityPercent()}%`);+ event.currentTarget.value = opacityDraft();+ return;+ }++ commitOpacity();+ setOpacityDraft(`${opacityPercent()}%`);+ event.currentTarget.value = opacityDraft();+ };++ return (+ <div+ ref={rootRef}+ class="relative h-7 w-full overflow-hidden rounded-md border bg-input text-foreground select-none"+ classList={{+ "border-primary": isFocusWithin(),+ "border-transparent": !isFocusWithin(),+ }}+ onPointerDown={handlePointerDown}+ onFocusIn={handleFocusIn}+ onFocusOut={handleFocusOut}+ >+ <div+ class="pointer-events-none absolute inset-y-0 left-0 rounded-sm bg-muted"+ style={{ width: `${opacityPercent()}%` }}+ >+ <div+ class="absolute inset-y-1 right-1 w-0.5 rounded-full bg-input"+ classList={{ hidden: !isDraggingSlider() }}+ />+ </div>++ <div class="relative z-0 flex h-full items-center justify-between pl-1">+ <div class="flex min-w-0 items-center gap-2">+ <button+ class="size-5 min-w-5 overflow-hidden rounded-sm"+ onFocusIn={(e) => e.stopPropagation()}+ onClick={props.onClick}+ >+ <PaintItemIcon fill={props.fillEid} />+ </button>++ <Show when={isSolidFill()}>+ <input+ data-paint-editable="true"+ type="text"+ value={colorDraft()}+ class="w-[7ch] bg-transparent text-xxs outline-none"+ classList={{ "cursor-default": !isFocusWithin() }}+ onInput={handleColorInput}+ onKeyDown={handleColorKeyDown}+ onBlur={handleColorBlur}+ />+ </Show>++ <Show when={!isSolidFill()}>+ <FillLabel fill={props.fillEid} />+ </Show>++ </div>++ <div class="flex items-center">+ <input+ data-paint-editable="true"+ type="text"+ value={opacityDraft()}+ class="w-10 text-right text-xxs outline-none"+ classList={{ "cursor-default": !isFocusWithin() }}+ onInput={handleOpacityInput}+ onKeyDown={handleOpacityKeyDown}+ onBlur={handleOpacityBlur}+ />++ <div+ class="z-20 min-w-2"+ onFocusIn={(e) => e.stopPropagation()}+ >+ <Keyframe property="opacity" target={props.fillEid} />+ </div>+ </div>+ </div>+ </div>+ );+}++type PaintItemIconProps = {+ fill: number;+};++function PaintItemIcon(props: PaintItemIconProps) {+ const { world } = useEngine();+ const c = world.components;+ const assets = world.assets;++ const assetId = useEntityState(c.AssetId, props.fill);+ const stopEids = useQuery([c.ColorStop, ChildOf(props.fill), Not(c.Deleted)]);+ const color = useEntityState(c.Computed.color, props.fill);+ const opacity = useEntityState(c.Computed.opacity, props.fill, 1);+ const type = useEntityState(c.Paint, props.fill, PaintType.SOLID);++ const offsets = useEntityStates(c.Computed.stopOffset, stopEids, 0);+ const colors = useEntityStates(c.Computed.stopColor, stopEids, 0xFFFFFF);+ const opacities = useEntityStates(c.Computed.stopOpacity, stopEids, 1);++ const sortedStops = createMemo(() => stopEids()+ .map((_, idx) => ({+ offset: offsets()[idx],+ color: colors()[idx],+ opacity: opacities()[idx],+ }))+ .toSorted((a, b) => a.offset - b.offset)+ );++ const asset = createMemo(() => assets.get(assetId() ?? ""));++ return (+ <>+ <Show when={asset() && (type() === PaintType.VIDEO || type() === PaintType.IMAGE || type() === PaintType.SEQUENCE)}>+ <AssetThumbnail+ asset={asset()!}+ class="size-full"+ size={{ width: 50, height: 50 }}+ />+ </Show>++ <Show when={type() === PaintType.LINEAR_GRADIENT || type() === PaintType.RADIAL_GRADIENT}>+ <div+ class="size-full"+ style={{ "background-image": getGradientBackground(sortedStops(), type()) }}+ />+ </Show>++ <Show when={color() !== undefined && type() === PaintType.SOLID}>+ <OpacitySwatch color={color()!} opacity={opacity()} />+ </Show>+ </>+ );+}++type FillLabelProps = {+ fill: number;+};++function FillLabel(props: FillLabelProps) {+ const { world } = useEngine();+ const c = world.components;+ const assets = world.assets;++ const type = useEntityState(c.Paint, props.fill, PaintType.SOLID);+ const assetId = useEntityState(c.AssetId, props.fill);++ const label = createMemo(() => {+ if (type() === PaintType.SOLID) {+ return "Solid";+ } else if (type() === PaintType.LINEAR_GRADIENT) {+ return "Linear";+ } else if (type() === PaintType.RADIAL_GRADIENT) {+ return "Radial";+ } else {+ const asset = assets.get(assetId() ?? "");+ return asset?.name ?? "Unknown";+ }+ })++ return (+ <span class="min-w-0 truncate text-xxs select-none">+ {label()}+ </span>+ )+}++type GradientStop = {+ offset: number;+ color: number;+ opacity: number;+};++function getGradientBackground(stops: GradientStop[], style: PaintType) {+ const parts: string[] = [];+ for (let i = 0; i < stops.length; i++) {+ const color = mergeColorWithOpacity(stops[i].color, stops[i].opacity);+ const offset = (i / (stops.length - 1)) * 100;+ parts.push(`${color} ${offset}%`);+ }++ if (style === PaintType.RADIAL_GRADIENT) {+ return `radial-gradient(circle, ${parts.join(", ")})`;+ }++ return `linear-gradient(90deg, ${parts.join(", ")})`;+}diff --git a/apps/web/src/components/ui/floating-inspector.tsx b/apps/web/src/components/ui/floating-inspector.tsxnew file mode 100644index 00000000..88e27142--- /dev/null+++ b/apps/web/src/components/ui/floating-inspector.tsx@@ -0,0 +1,343 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ createContext,+ createEffect,+ createMemo,+ createSignal,+ Show,+ mergeProps,+ onCleanup,+ onMount,+ splitProps,+ useContext,+ type Accessor,+ type Component,+ type ComponentProps,+} from "solid-js"++import { cx } from "@/lib/cva"+import { clamp } from "@/utils"+import { Separator } from "./separator"++type MaybeAccessor<T> = T | Accessor<T>++type FloatingInspectorContextValue = {+ registerDragHandle: (el: HTMLElement | null) => void+}++type FloatingInspectorTopContextValue = {+ top: Accessor<number>+}++const FloatingInspectorContext = createContext<FloatingInspectorContextValue>()+const FloatingInspectorTopContext = createContext<FloatingInspectorTopContextValue>()++const DRAG_HANDLE_SELECTOR = "[data-slot='floating-inspector-header']"+const NON_DRAG_INTERACTIVE_SELECTOR = [+ "button",+ "a",+ "input",+ "select",+ "textarea",+ "[role='button']",+ "[data-no-drag='true']",+].join(",")+const VIEWPORT_PADDING = 8+const DEFAULT_OFFSET = 8+const DEFAULT_WIDTH = 264++const toValue = <T,>(value: MaybeAccessor<T>): T => {+ return typeof value === "function" ? (value as Accessor<T>)() : value+}++const getAvailableTop = (preferredTop: number, inspectorHeight: number): number => {+ const maxTop = Math.max(VIEWPORT_PADDING, window.innerHeight - inspectorHeight - VIEWPORT_PADDING)+ return clamp(preferredTop, VIEWPORT_PADDING, maxTop)+}++export type FloatingInspectorProps = ComponentProps<"div"> & {+ anchorRef: MaybeAccessor<HTMLElement | null | undefined>+ width?: number+ offset?: MaybeAccessor<number>+ open?: MaybeAccessor<boolean>+}++export const FloatingInspector = (props: FloatingInspectorProps) => {+ const merge = mergeProps(+ {+ open: true,+ offset: DEFAULT_OFFSET,+ width: DEFAULT_WIDTH,+ },+ props,+ )++ const [local, rest] = splitProps(merge, [+ "class",+ "anchorRef",+ "width",+ "offset",+ "open",+ "children",+ ])++ const parentTopContext = useContext(FloatingInspectorTopContext)++ let rootRef: HTMLDivElement | undefined+ let dragHandleRef: HTMLElement | null = null++ const [position, setPosition] = createSignal({ left: VIEWPORT_PADDING, top: VIEWPORT_PADDING })+ const [isDragging, setIsDragging] = createSignal(false)+ const [isPositionInitialized, setIsPositionInitialized] = createSignal(false)++ let dragOffsetX = 0+ let dragOffsetY = 0+ let activePointerId: number | null = null++ const width = createMemo(() => Math.max(0, Number(local.width) || DEFAULT_WIDTH))+ const offset = createMemo(() => Math.max(0, Number(toValue(local.offset)) || DEFAULT_OFFSET))+ const isOpen = createMemo(() => Boolean(toValue(local.open)))++ const updateInitialPosition = () => {+ if (isPositionInitialized()) return++ const anchor = toValue(local.anchorRef)+ const root = rootRef+ if (!anchor || !root) return++ const anchorRect = anchor.getBoundingClientRect()+ const inspectorRect = root.getBoundingClientRect()++ const preferredTop = parentTopContext?.top() ?? anchorRect.top+ const top = getAvailableTop(preferredTop, inspectorRect.height)++ const preferredLeft = anchorRect.left - width() - offset()+ const maxLeft = Math.max(VIEWPORT_PADDING, window.innerWidth - width() - VIEWPORT_PADDING)+ const left = clamp(preferredLeft, VIEWPORT_PADDING, maxLeft)++ setPosition({ left, top })+ setIsPositionInitialized(true)+ }++ const onPointerMove = (event: PointerEvent) => {+ if (!isDragging()) return+ if (activePointerId !== null && event.pointerId !== activePointerId) return++ const root = rootRef+ if (!root) return++ const rect = root.getBoundingClientRect()+ const maxLeft = Math.max(VIEWPORT_PADDING, window.innerWidth - rect.width - VIEWPORT_PADDING)+ const maxTop = Math.max(VIEWPORT_PADDING, window.innerHeight - rect.height - VIEWPORT_PADDING)++ const left = clamp(event.clientX - dragOffsetX, VIEWPORT_PADDING, maxLeft)+ const top = clamp(event.clientY - dragOffsetY, VIEWPORT_PADDING, maxTop)++ setPosition({ left, top })+ }++ const cleanupDrag = () => {+ window.removeEventListener("pointermove", onPointerMove)+ window.removeEventListener("pointerup", onPointerUp)+ window.removeEventListener("pointercancel", onPointerUp)+ setIsDragging(false)+ activePointerId = null+ }++ const onPointerUp = (event: PointerEvent) => {+ if (activePointerId !== null && event.pointerId !== activePointerId) return+ cleanupDrag()+ }++ const onPointerDown = (event: PointerEvent) => {+ if (event.button !== 0) return+ const target = event.target as HTMLElement | null+ if (target?.closest(NON_DRAG_INTERACTIVE_SELECTOR)) return++ const root = rootRef+ if (!root) return++ const rect = root.getBoundingClientRect()++ dragOffsetX = event.clientX - rect.left+ dragOffsetY = event.clientY - rect.top++ activePointerId = event.pointerId+ setIsDragging(true)++ dragHandleRef?.setPointerCapture?.(event.pointerId)++ window.addEventListener("pointermove", onPointerMove)+ window.addEventListener("pointerup", onPointerUp)+ window.addEventListener("pointercancel", onPointerUp)++ event.preventDefault()+ }++ const setDragHandle = (el: HTMLElement | null) => {+ if (dragHandleRef) {+ dragHandleRef.removeEventListener("pointerdown", onPointerDown)+ }++ dragHandleRef = el++ if (dragHandleRef) {+ dragHandleRef.style.cursor = "grab"+ dragHandleRef.addEventListener("pointerdown", onPointerDown)+ }+ }++ createEffect(() => {+ if (!isOpen()) return+ toValue(local.anchorRef)+ width()+ offset()+ setIsPositionInitialized(false)+ queueMicrotask(updateInitialPosition)+ })++ onMount(() => {+ queueMicrotask(() => {+ updateInitialPosition()+ if (!dragHandleRef && rootRef) {+ const fallbackHandle = rootRef.querySelector<HTMLElement>(DRAG_HANDLE_SELECTOR)+ setDragHandle(fallbackHandle)+ }+ })++ const onResize = () => {+ const root = rootRef+ if (!root) return++ setPosition((current) => {+ const rect = root.getBoundingClientRect()+ const maxLeft = Math.max(VIEWPORT_PADDING, window.innerWidth - rect.width - VIEWPORT_PADDING)+ const maxTop = Math.max(VIEWPORT_PADDING, window.innerHeight - rect.height - VIEWPORT_PADDING)++ return {+ left: clamp(current.left, VIEWPORT_PADDING, maxLeft),+ top: clamp(current.top, VIEWPORT_PADDING, maxTop),+ }+ })+ }++ window.addEventListener("resize", onResize)++ onCleanup(() => {+ window.removeEventListener("resize", onResize)+ cleanupDrag()+ setDragHandle(null)+ })+ })++ const contextValue: FloatingInspectorContextValue = {+ registerDragHandle: setDragHandle,+ }++ return (+ <Show when={isOpen()}>+ <FloatingInspectorTopContext.Provider value={{ top: () => position().top }}>+ <FloatingInspectorContext.Provider value={contextValue}>+ <div+ ref={rootRef}+ data-slot="floating-inspector"+ class={cx(+ "bg-background border-border fixed z-50 w-[264px] overflow-hidden rounded-xl border",+ "shadow-[0_12px_24px_rgba(0,0,0,0.24)]",+ local.class,+ )}+ style={{+ left: `${position().left}px`,+ top: `${position().top}px`,+ width: `${width()}px`,+ }}+ {...rest}+ >+ {local.children}+ </div>+ </FloatingInspectorContext.Provider>+ </FloatingInspectorTopContext.Provider>+ </Show>+ )+}++export type FloatingInspectorHeaderProps = ComponentProps<"div">++export const FloatingInspectorHeader: Component<FloatingInspectorHeaderProps> = (+ props,+) => {+ const context = useContext(FloatingInspectorContext)+ const [local, rest] = splitProps(props, ["class", "ref"])++ const mergedRef = (el: HTMLDivElement) => {+ context?.registerDragHandle(el)++ const ref = local.ref+ if (typeof ref === "function") {+ ref(el)+ return+ }++ if (ref && typeof ref === "object") {+ ; (ref as { current?: HTMLElement | null }).current = el+ }+ }++ return (+ <div+ ref={mergedRef}+ data-slot="floating-inspector-header"+ class={cx("flex h-11 items-center p-2 pl-[15px] text-base", local.class)}+ {...rest}+ />+ )+}++export type FloatingInspectorContentProps = ComponentProps<"div">++export const FloatingInspectorContent: Component<FloatingInspectorContentProps> = (+ props,+) => {+ const [local, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="floating-inspector-content"+ class={cx("p-2", local.class)}+ {...rest}+ />+ )+}++export type FloatingInspectorTitleProps = ComponentProps<"span">++export const FloatingInspectorTitle: Component<FloatingInspectorTitleProps> = (+ props,+) => {+ const [local, rest] = splitProps(props, ["class"])++ return (+ <span+ data-slot="floating-inspector-title"+ class={cx("text-foreground", local.class)}+ {...rest}+ />+ )+}++export type FloatingInspectorSeparatorProps = ComponentProps<"div">++export const FloatingInspectorSeparator: Component<FloatingInspectorSeparatorProps> = (+ props,+) => {+ const [local, rest] = splitProps(props, ["class"])++ return (+ <div class={cx("mx-2", local.class)} {...rest}>+ <Separator />+ </div>+ )+}diff --git a/apps/web/src/components/ui/hover-card.tsx b/apps/web/src/components/ui/hover-card.tsxnew file mode 100644index 00000000..ae27fdf7--- /dev/null+++ b/apps/web/src/components/ui/hover-card.tsx@@ -0,0 +1,51 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/hover-card++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { HoverCard as HoverCardPrimitive } from "@kobalte/core/hover-card"++import { cx } from "@/lib/cva"++export const HoverCardPortal = HoverCardPrimitive.Portal++export type HoverCardProps = ComponentProps<typeof HoverCardPrimitive>++export const HoverCard = (props: HoverCardProps) => {+ return <HoverCardPrimitive data-slot="hover-card" {...props} />+}++export type HoverCardTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof HoverCardPrimitive.Trigger<T>>++export const HoverCardTrigger = <T extends ValidComponent = "button">(+ props: HoverCardTriggerProps<T>,+) => {+ return (+ <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />+ )+}++export type HoverCardContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof HoverCardPrimitive.Content<T>>++export const HoverCardContent = <T extends ValidComponent = "div">(+ props: HoverCardContentProps<T>,+) => {+ const [, rest] = splitProps(props as HoverCardContentProps, ["class"])++ return (+ <HoverCardPrimitive.Content+ data-slot="hover-card-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-50 w-64 origin-(--kb-hovercard-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=hover-card-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=hover-card-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=hover-card-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=hover-card-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/icon.tsx b/apps/web/src/components/ui/icon.tsxnew file mode 100644index 00000000..074e60bb--- /dev/null+++ b/apps/web/src/components/ui/icon.tsx@@ -0,0 +1,33 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { cx } from "@/lib/cva";+import type { Component, JSX } from "solid-js";++// Eagerly load all icons as components+const icons = import.meta.glob<{ default: Component<JSX.SvgSVGAttributes<SVGSVGElement>> }>(+ '/src/assets/icons/*.svg',+ { eager: true }+);++type IconProps = {+ name: string;+ class?: string+}++export function Icon(props: IconProps) {+ const getIcon = () => {+ const path = `/src/assets/icons/${props.name}.svg`;+ return icons[path]?.default;+ };++ return (+ <>+ {(() => {+ const IconComponent = getIcon();+ return IconComponent ? <IconComponent class={cx("size-6 shrink-0", props.class)} /> : null;+ })()}+ </>+ )+}diff --git a/apps/web/src/components/ui/increment-decrement-control.tsx b/apps/web/src/components/ui/increment-decrement-control.tsxnew file mode 100644index 00000000..d9071b79--- /dev/null+++ b/apps/web/src/components/ui/increment-decrement-control.tsx@@ -0,0 +1,37 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Icon } from "@/components/ui/icon";+import { cx } from "@/lib/cva";++type IncrementDecrementControlProps = {+ class?: string;+ onDecrement: () => void;+ onIncrement: () => void;+ decrementLabel?: string;+ incrementLabel?: string;+};++export function IncrementDecrementControl(props: IncrementDecrementControlProps) {+ return (+ <div class={cx("grid grid-cols-2 gap-px rounded-md overflow-hidden", props.class)}>+ <button+ type="button"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 active:bg-muted-foreground/20 text-muted-foreground"+ onClick={props.onDecrement}+ aria-label={props.decrementLabel ?? "Decrease"}+ >+ <Icon name="minus" />+ </button>+ <button+ type="button"+ class="flex-1 h-7 bg-input flex items-center justify-center hover:bg-input/80 active:bg-muted-foreground/20 text-muted-foreground"+ onClick={props.onIncrement}+ aria-label={props.incrementLabel ?? "Increase"}+ >+ <Icon name="plus-add" />+ </button>+ </div>+ );+}diff --git a/apps/web/src/components/ui/item-row.tsx b/apps/web/src/components/ui/item-row.tsxnew file mode 100644index 00000000..acc063b5--- /dev/null+++ b/apps/web/src/components/ui/item-row.tsx@@ -0,0 +1,68 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { JSX } from 'solid-js';+import { Show, splitProps } from 'solid-js';+import { cx } from '@/lib/cva';+import { callHandler } from '@/lib/call-handler';++export type ItemRowProps = JSX.HTMLAttributes<HTMLDivElement> & {+ value: string;+ label?: string;+ icon?: JSX.Element;+ disabled?: boolean;+ children?: JSX.Element;+};++/**+ * Reusable row component for settings panels.+ * Pattern: [Label 64px] + [Icon Wrapper 24x28] + [Text (flex-1)] + [Action 24x28]+ */+export function ItemRow(props: ItemRowProps) {+ const [local, others] = splitProps(props, [+ "value",+ "label",+ "icon",+ "class",+ "disabled",+ "onClick",+ "children",+ ]);++ const handleClick: JSX.EventHandlerUnion<HTMLDivElement, MouseEvent> = (e) => {+ if (local.disabled) return;+ if (e.target instanceof Element && e.target.closest('button')) return;+ callHandler(e, local.onClick);+ };++ return (+ <div+ class={cx("flex items-center gap-2", local.class)}+ classList={{ "opacity-50": local.disabled }}+ {...others}+ >+ <Show when={local.label}>+ <span class="w-16 shrink-0 text-xs text-muted-foreground truncate">+ {local.label}+ </span>+ </Show>+ <div+ class="bg-input flex-1 min-w-0 h-7 rounded-md p-1 pr-0 flex items-center gap-2 hover:bg-input/80 transition-colors relative cursor-default overflow-clip"+ onClick={handleClick}+ >+ <Show when={local.icon}>+ <div class="text-foreground size-5 rounded-sm flex items-center justify-center bg-primary overflow-clip">+ {local.icon}+ </div>+ </Show>++ <span class="flex-1 min-w-0 text-xs text-foreground truncate">+ {local.value}+ </span>++ {local.children}+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/ui/kbd.tsx b/apps/web/src/components/ui/kbd.tsxnew file mode 100644index 00000000..07e2b0d6--- /dev/null+++ b/apps/web/src/components/ui/kbd.tsx@@ -0,0 +1,42 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/kbd++import { splitProps, type ComponentProps } from "solid-js"++import { cx } from "@/lib/cva"++export type KbdProps = ComponentProps<"kbd">++export const Kbd = (props: KbdProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <kbd+ data-slot="kbd"+ class={cx(+ "bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-450 select-none",+ "[&_svg:not([class*='size-'])]:size-3",+ "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",+ props.class,+ )}+ {...rest}+ />+ )+}++export type KbdGroupProps = ComponentProps<"div">++export const KbdGroup = (props: KbdGroupProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="kbd-group"+ class={cx("inline-flex items-center gap-1", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/keyframe.tsx b/apps/web/src/components/ui/keyframe.tsxnew file mode 100644index 00000000..949767a1--- /dev/null+++ b/apps/web/src/components/ui/keyframe.tsx@@ -0,0 +1,74 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { useEngine } from "@/context/engine";+import { findKeyframeTargetNode } from "@/components/engine/api";+import { cx } from "@/lib/cva";+import { createMemo, Show } from "solid-js";+import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip";+import { getParentEntity, toggleKeyframeTrack, useEntityState, type PropertyPath } from "../engine";++type KeyframeProps = {+ target: number;+ property: PropertyPath;+ disabled?: boolean;+ class?: string;+};++export function Keyframe(props: KeyframeProps) {+ const { world } = useEngine();+ const c = world.components;++ const nodeEid = createMemo(() => findKeyframeTargetNode(world, props.target));+ const isAvailable = createMemo(() => getParentEntity(world, props.target) !== null && nodeEid() !== null);++ const tracks = useEntityState(c.Cache.keyframeTracks, nodeEid, []);+ const localFrame = useEntityState(c.Computed.localTime, nodeEid, 0);++ const matchedTrack = createMemo(() => {+ for (const tid of tracks()) {+ if (c.KeyframeTrack.property[tid] !== props.property) continue;+ if (c.KeyframeTrack.target[tid] !== props.target) continue;+ return tid;+ }+ return null;+ });++ const hasTrack = createMemo(() => matchedTrack() !== null);++ const keyframes = useEntityState(c.Cache.keyframes, matchedTrack, []);++ const isActive = createMemo(() => {+ return keyframes().some(kf => Math.round(c.Keyframe.time[kf]) === localFrame());+ });++ const toggleKeyframe = () => toggleKeyframeTrack(world, props.target, props.property);++ return (+ <Show when={isAvailable()}>+ <Tooltip openDelay={600} disabled={props.disabled}>+ <TooltipTrigger+ as="button"+ type="button"+ class={cx("flex items-center size-6 justify-center transition-colors group disabled:cursor-not-allowed disabled:opacity-50", props.class)}+ onClick={toggleKeyframe}+ disabled={props.disabled}+ >+ <div+ class={cx(+ "size-1.5 rotate-45 border transition-colors",+ isActive()+ ? "bg-primary"+ : "bg-transparent group-hover:border-foreground",+ hasTrack()+ ? "border-primary"+ : "border-muted-foreground"+ )}+ />+ </TooltipTrigger>+ <TooltipContent>{isActive() ? "Remove keyframe" : "Add keyframe"}</TooltipContent>+ </Tooltip>+ </Show>+ )+}diff --git a/apps/web/src/components/ui/menubar.tsx b/apps/web/src/components/ui/menubar.tsxnew file mode 100644index 00000000..e11cc84a--- /dev/null+++ b/apps/web/src/components/ui/menubar.tsx@@ -0,0 +1,387 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/menubar++import {+ mergeProps,+ splitProps,+ type ComponentProps,+ type ValidComponent,+} from "solid-js"+import { Menubar as MenubarPrimitive } from "@kobalte/core/menubar"++import { cx } from "@/lib/cva"++export const MenubarPortal = MenubarPrimitive.Portal++export type MenubarProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof MenubarPrimitive<T>+>++export const Menubar = <T extends ValidComponent = "div">(+ props: MenubarProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarProps, ["class"])++ return (+ <MenubarPrimitive+ data-slot="menubar"+ class={cx(+ "bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",+ props.class,+ )}+ {...rest}+ />+ )+}++export type MenubarMenuProps = ComponentProps<typeof MenubarPrimitive.Menu>++export const MenubarMenu = (props: MenubarMenuProps) => {+ const merge = mergeProps<MenubarMenuProps[]>(+ {+ gutter: 8,+ },+ props,+ )++ return <MenubarPrimitive.Menu data-slot="menubar-menu" {...merge} />+}++export type MenubarGroupProps = ComponentProps<typeof MenubarPrimitive.Group>++export const MenubarGroup = (props: MenubarGroupProps) => {+ return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />+}++export type MenubarRadioGroupProps = ComponentProps<+ typeof MenubarPrimitive.RadioGroup+>++export const MenubarRadioGroup = (props: MenubarRadioGroupProps) => {+ return (+ <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />+ )+}++export type MenubarTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof MenubarPrimitive.Trigger<T>>++export const MenubarTrigger = <T extends ValidComponent = "button">(+ props: MenubarTriggerProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarTriggerProps, ["class"])++ return (+ <MenubarPrimitive.Trigger+ data-slot="menubar-trigger"+ class={cx(+ "focus:bg-accent focus:text-accent-foreground data-[expanded]:bg-accent data-[expanded]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-450 outline-hidden select-none",+ props.class,+ )}+ {...rest}+ />+ )+}++export type MenubarContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof MenubarPrimitive.Content<T>>++export const MenubarContent = <T extends ValidComponent = "div">(+ props: MenubarContentProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarContentProps, ["class"])++ return (+ <MenubarPrimitive.Content+ data-slot="menubar-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-50 min-w-[12rem] origin-(--kb-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md focus-visible:outline-none",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=menubar-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=menubar-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=menubar-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=menubar-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ />+ )+}++export type MenubarItemProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof MenubarPrimitive.Item<T>+> & {+ inset?: boolean+ variant?: "default" | "destructive"+}++export const MenubarItem = <T extends ValidComponent = "div">(+ props: MenubarItemProps<T>,+) => {+ const merge = mergeProps(+ {+ variant: "default",+ } as MenubarItemProps,+ props,+ )+ const [, rest] = splitProps(merge, ["class", "inset", "variant"])++ return (+ <MenubarPrimitive.Item+ data-slot="menubar-item"+ data-inset={props.inset}+ data-variant={props.variant}+ class={cx(+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ "data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive",+ props.class,+ )}+ {...rest}+ />+ )+}++export type MenubarCheckboxItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof MenubarPrimitive.CheckboxItem<T>>++export const MenubarCheckboxItem = <T extends ValidComponent = "div">(+ props: MenubarCheckboxItemProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarCheckboxItemProps, [+ "class",+ "children",+ ])++ return (+ <MenubarPrimitive.CheckboxItem+ data-slot="menubar-checkbox-item"+ class={cx(+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ props.class,+ )}+ {...rest}+ >+ <span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">+ <MenubarPrimitive.ItemIndicator>+ <svg+ xmlns="http://www.w3.org/2000/svg"+ class="size-4"+ viewBox="0 0 24 24"+ >+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M20 6L9 17l-5-5"+ />+ </svg>+ </MenubarPrimitive.ItemIndicator>+ </span>+ {props.children}+ </MenubarPrimitive.CheckboxItem>+ )+}++export type MenubarRadioItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof MenubarPrimitive.RadioItem<T>>++export const MenubarRadioItem = <T extends ValidComponent = "div">(+ props: MenubarRadioItemProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarRadioItemProps, [+ "class",+ "children",+ ])++ return (+ <MenubarPrimitive.RadioItem+ data-slot="menubar-radio-item"+ class={cx(+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ props.class,+ )}+ {...rest}+ >+ <span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">+ <MenubarPrimitive.ItemIndicator>+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24"+ class="size-2"+ >+ <g+ fill="none"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ >+ <path d="M0 0h24v24H0z" />+ <path+ fill="currentColor"+ d="M7 3.34a10 10 0 1 1-4.995 8.984L2 12l.005-.324A10 10 0 0 1 7 3.34"+ />+ </g>+ </svg>+ </MenubarPrimitive.ItemIndicator>+ </span>+ {props.children}+ </MenubarPrimitive.RadioItem>+ )+}++export type MenubarGroupLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof MenubarPrimitive.GroupLabel<T>> & {+ inset?: boolean+ }++export const MenubarGroupLabel = <T extends ValidComponent = "span">(+ props: MenubarGroupLabelProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarGroupLabelProps, [+ "class",+ "inset",+ ])++ return (+ <MenubarPrimitive.GroupLabel+ data-slot="menubar-group-label"+ data-inset={props.inset}+ class={cx(+ "px-2 py-1.5 text-sm font-450 data-[inset]:pl-8",+ props.class,+ )}+ {...rest}+ />+ )+}++export type MenubarItemLabelProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof MenubarPrimitive.ItemLabel<T>> & {+ inset?: boolean+ }++export const MenubarItemLabel = <T extends ValidComponent = "div">(+ props: MenubarItemLabelProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarItemLabelProps, [+ "class",+ "inset",+ ])++ return (+ <MenubarPrimitive.ItemLabel+ data-slot="menubar-item-label"+ data-inset={props.inset}+ class={cx(+ "px-2 py-1.5 text-sm font-450 data-[inset]:pl-8",+ props.class,+ )}+ {...rest}+ />+ )+}++export type MenubarSeparatorProps<T extends ValidComponent = "hr"> =+ ComponentProps<typeof MenubarPrimitive.Separator<T>>++export const MenubarSeparator = <T extends ValidComponent = "hr">(+ props: MenubarSeparatorProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarSeparatorProps, ["class"])++ return (+ <MenubarPrimitive.Separator+ data-slot="menubar-separator"+ class={cx("bg-border -mx-1 my-1 h-px", props.class)}+ {...rest}+ />+ )+}++export type MenubarShortcut = ComponentProps<"span">++export const MenubarShortcut = (props: MenubarShortcut) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <span+ data-slot="menubar-shortcut"+ class={cx(+ "text-muted-foreground ml-auto text-xs tracking-widest",+ props.class,+ )}+ {...rest}+ />+ )+}++export type MenubarSubProps = ComponentProps<typeof MenubarPrimitive.Sub>++export const MenubarSub = (props: MenubarSubProps) => {+ return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />+}++export type MenubarSubTriggerProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof MenubarPrimitive.SubTrigger<T>> & {+ inset?: boolean+ }++export const MenubarSubTrigger = <T extends ValidComponent = "div">(+ props: MenubarSubTriggerProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarSubTriggerProps, [+ "class",+ "inset",+ "children",+ ])++ return (+ <MenubarPrimitive.SubTrigger+ data-slot="menubar-sub-trigger"+ data-inset={props.inset}+ class={cx(+ "focus:bg-accent focus:text-accent-foreground data-[expanded]:bg-accent data-[expanded]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8",+ props.class,+ )}+ {...rest}+ >+ {props.children}+ <svg+ xmlns="http://www.w3.org/2000/svg"+ class="ml-auto size-4"+ viewBox="0 0 24 24"+ >+ <path+ fill="none"+ stroke="currentColor"+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="m9 18l6-6l-6-6"+ />+ </svg>+ </MenubarPrimitive.SubTrigger>+ )+}++export type MenubarSubContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof MenubarPrimitive.SubContent<T>>++export const MenubarSubContent = <T extends ValidComponent = "div">(+ props: MenubarSubContentProps<T>,+) => {+ const [, rest] = splitProps(props as MenubarSubContentProps, ["class"])++ return (+ <MenubarPrimitive.SubContent+ data-slot="menubar-sub-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 z-50 min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg focus-visible:outline-none",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=menubar-sub-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=menubar-sub-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=menubar-sub-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=menubar-sub-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/opacity-swatch.tsx b/apps/web/src/components/ui/opacity-swatch.tsxnew file mode 100644index 00000000..b0f780c9--- /dev/null+++ b/apps/web/src/components/ui/opacity-swatch.tsx@@ -0,0 +1,43 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { JSX } from "solid-js";+import { colorToHex } from "@/utils/color";++const CHECKERBOARD_SIZE = 8;++export function checkerboardStyle(checkerboardSize: number = CHECKERBOARD_SIZE): JSX.CSSProperties {+ const tileSize = Math.max(2, Math.round(checkerboardSize));+ const offset = tileSize / 2;++ return {+ "background-image":+ "linear-gradient(45deg, #666 25%, transparent 25%), linear-gradient(-45deg, #666 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #666 75%), linear-gradient(-45deg, transparent 75%, #666 75%)",+ "background-size": `${tileSize}px ${tileSize}px`,+ "background-position": `0 0, 0 ${offset}px, ${offset}px -${offset}px, -${offset}px 0px`,+ };+}++type OpacitySwatchProps = {+ color: number;+ opacity?: number;+};++export function OpacitySwatch(props: OpacitySwatchProps) {+ return (+ <div+ class="relative w-full h-full"+ style={checkerboardStyle()}+ >+ <div+ class="absolute left-0 top-0 w-1/2 bottom-0"+ style={{ "background-color": colorToHex(props.color) }}+ />+ <div+ class="absolute right-0 top-0 w-1/2 bottom-0"+ style={{ "background-color": colorToHex(props.color), opacity: props.opacity ?? 1 }}+ />+ </div>+ );+}diff --git a/apps/web/src/components/ui/panel-section.tsx b/apps/web/src/components/ui/panel-section.tsxnew file mode 100644index 00000000..bc7ad2c3--- /dev/null+++ b/apps/web/src/components/ui/panel-section.tsx@@ -0,0 +1,55 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { JSX } from "solid-js";+import { Show, splitProps } from "solid-js";+import { cx } from "@/lib/cva";++type PanelSectionProps = {+ title: string | JSX.Element;+ subtitle?: JSX.Element;+ actions?: JSX.Element;+ children?: JSX.Element;+ class?: string;+ ref?: HTMLDivElement;+};++export function PanelSection(props: PanelSectionProps) {+ const [local] = splitProps(props, [+ "title",+ "subtitle",+ "actions",+ "children",+ "ref",+ "class",+ ]);++ return (+ <>+ <div class="flex items-center justify-between h-10 border-t border-border px-4" ref={local.ref}>+ <div class="flex items-center gap-1 text-xs font-450">+ <Show+ when={typeof local.title === "string"}+ fallback={local.title}+ >+ {local.title}+ </Show>+ {local.subtitle}+ </div>+ <Show when={local.actions != null}>+ <div class="flex items-center gap-1">{local.actions}</div>+ </Show>+ </div>++ <div+ class={cx(+ "[&:has(>*)]:pb-3 gap-2 w-full max-w-full min-w-0 px-4 flex flex-col data-[grid=true]:grid *:min-w-0 grid-cols-[1fr_1fr]",+ local.class+ )}+ >+ {local.children}+ </div>+ </>+ );+}diff --git a/apps/web/src/components/ui/popover.tsx b/apps/web/src/components/ui/popover.tsxnew file mode 100644index 00000000..8de88bbf--- /dev/null+++ b/apps/web/src/components/ui/popover.tsx@@ -0,0 +1,60 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/popover++import {+ mergeProps,+ splitProps,+ type ComponentProps,+ type ValidComponent,+} from "solid-js"+import { Popover as PopoverPrimitive } from "@kobalte/core/popover"++import { cx } from "@/lib/cva"++export const PopoverPortal = PopoverPrimitive.Portal++export type PopoverProps = ComponentProps<typeof PopoverPrimitive>++export const Popover = (props: PopoverProps) => {+ const merge = mergeProps<PopoverProps[]>(+ {+ gutter: 4,+ },+ props,+ )++ return <PopoverPrimitive data-slot="popover" {...merge} />+}++export type PopoverTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof PopoverPrimitive.Trigger<T>>++export const PopoverTrigger = <T extends ValidComponent = "button">(+ props: PopoverTriggerProps<T>,+) => {+ return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />+}++export type PopoverContentProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof PopoverPrimitive.Content<T>>++export const PopoverContent = <T extends ValidComponent = "div">(+ props: PopoverContentProps<T>,+) => {+ const [, rest] = splitProps(props as PopoverContentProps, ["class"])++ return (+ <PopoverPrimitive.Content+ data-slot="popover-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-50 w-72 origin-(--kb-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=popover-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=popover-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=popover-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=popover-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/progress-slider.tsx b/apps/web/src/components/ui/progress-slider.tsxnew file mode 100644index 00000000..aad358cf--- /dev/null+++ b/apps/web/src/components/ui/progress-slider.tsx@@ -0,0 +1,92 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, splitProps, type ComponentProps } from "solid-js"+import { Slider as SliderPrimitive } from "@kobalte/core/slider"++import { cx } from "@/lib/cva"+import { clamp } from "@/utils"++type SliderPrimitiveProps = ComponentProps<typeof SliderPrimitive>++export type ProgressSliderProps = Omit<+ SliderPrimitiveProps,+ "value" | "defaultValue" | "onChange"+> & {+ value: number+ onChange(value: number): void+ trackClass?: string+ fillClass?: string+ thumbClass?: string+}++export function ProgressSlider(props: ProgressSliderProps) {+ const [local, rest] = splitProps(props, [+ "class",+ "value",+ "onChange",+ "minValue",+ "maxValue",+ "trackClass",+ "fillClass",+ "thumbClass",+ "step",+ "disabled",+ ])++ const minValue = () => local.minValue ?? 0+ const maxValue = () => local.maxValue ?? 100+ const step = () => local.step ?? 1++ const currentValue = createMemo(() => clamp(local.value, minValue(), maxValue()))+ const hasProgress = createMemo(() => currentValue() > minValue())++ const handleChange = (values: number[]) => {+ local.onChange(clamp(values[0] ?? minValue(), minValue(), maxValue()))+ }++ return (+ <SliderPrimitive+ data-slot="progress-slider"+ class={cx(+ "relative flex w-full touch-none select-none items-center data-disabled:opacity-50",+ local.class,+ )}+ minValue={minValue()}+ maxValue={maxValue()}+ step={step()}+ value={[currentValue()]}+ defaultValue={[currentValue()]}+ onChange={handleChange}+ disabled={local.disabled}+ {...rest}+ >+ <SliderPrimitive.Track+ data-slot="progress-slider-track"+ class={cx(+ "bg-input relative h-3 w-full rounded-full",+ local.trackClass,+ )}+ >+ <SliderPrimitive.Fill+ data-slot="progress-slider-fill"+ class={cx(+ "bg-primary absolute inset-y-0 left-0 rounded-full",+ local.fillClass,+ )}+ />+ <SliderPrimitive.Thumb+ data-slot="progress-slider-thumb"+ class={cx(+ "border-primary-foreground -translate-y-px size-3.5 rounded-full border-[3px] shadow-sm transition-[color,box-shadow] focus-visible:ring-none focus-visible:outline-hidden disabled:pointer-events-none",+ hasProgress() ? "bg-primary" : "bg-input",+ local.thumbClass,+ )}+ >+ <SliderPrimitive.Input />+ </SliderPrimitive.Thumb>+ </SliderPrimitive.Track>+ </SliderPrimitive>+ )+}diff --git a/apps/web/src/components/ui/progress.tsx b/apps/web/src/components/ui/progress.tsxnew file mode 100644index 00000000..149fdfbc--- /dev/null+++ b/apps/web/src/components/ui/progress.tsx@@ -0,0 +1,87 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/progress++import { splitProps, type ComponentProps, type ValidComponent } from "solid-js"+import { Progress as ProgressPrimitive } from "@kobalte/core/progress"++import { cx } from "@/lib/cva"++export type ProgressProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof ProgressPrimitive<T>+>++export const Progress = <T extends ValidComponent = "div">(+ props: ProgressProps<T>,+) => {+ const [, rest] = splitProps(props as ProgressProps, ["class", "children"])++ return (+ <ProgressPrimitive+ data-slot="progress"+ class={cx("flex w-full flex-col gap-3", props.class)}+ {...rest}+ >+ {props.children}+ <ProgressPrimitive.Track+ data-slot="progress-track"+ class="bg-primary/20 relative h-2 w-full overflow-hidden rounded-full"+ >+ <ProgressPrimitive.Fill+ data-slot="progress-fill"+ class="bg-primary h-full w-(--kb-progress-fill-width) transition-all"+ />+ </ProgressPrimitive.Track>+ </ProgressPrimitive>+ )+}++export type ProgressGroupProps = ComponentProps<"div">++export const ProgressGroup = (props: ProgressGroupProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="progress-group"+ class={cx("flex justify-between", props.class)}+ {...rest}+ />+ )+}++export type ProgressLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof ProgressPrimitive.Label<T>>++export const ProgressLabel = <T extends ValidComponent = "span">(+ props: ProgressLabelProps<T>,+) => {+ const [, rest] = splitProps(props as ProgressLabelProps, ["class"])++ return (+ <ProgressPrimitive.Label+ data-slot="progress-label"+ class={cx("text-sm font-450 select-none", props.class)}+ {...rest}+ />+ )+}++export type ProgressValueLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof ProgressPrimitive.ValueLabel<T>>++export const ProgressValueLabel = <T extends ValidComponent = "span">(+ props: ProgressValueLabelProps<T>,+) => {+ const [, rest] = splitProps(props as ProgressValueLabelProps, ["class"])++ return (+ <ProgressPrimitive.ValueLabel+ data-slot="progress-value-label"+ class={cx("text-sm font-450 select-none", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/radio-group.tsx b/apps/web/src/components/ui/radio-group.tsxnew file mode 100644index 00000000..ed587f12--- /dev/null+++ b/apps/web/src/components/ui/radio-group.tsx@@ -0,0 +1,198 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/radio-group++import type { VoidProps } from "solid-js"+import { splitProps, type ComponentProps, type ValidComponent } from "solid-js"+import { RadioGroup as RadioGroupPrimitive } from "@kobalte/core/radio-group"++import { cx } from "@/lib/cva"++export type RadioGroupProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof RadioGroupPrimitive<T>+>++export const RadioGroup = <T extends ValidComponent = "div">(+ props: RadioGroupProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupProps, ["class"])++ return (+ <RadioGroupPrimitive+ data-slot="radio-group"+ class={cx("grid gap-3", props.class)}+ {...rest}+ />+ )+}++export type RadioGroupItemsProps = ComponentProps<"div">++export const RadioGroupItems = (props: RadioGroupItemsProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ role="presentation"+ data-slot="radio-group-items"+ class={cx("flex gap-3", props.class)}+ {...rest}+ />+ )+}++export type RadioGroupItemInputProps<T extends ValidComponent = "input"> =+ ComponentProps<typeof RadioGroupPrimitive.ItemInput<T>>++export const RadioGroupItemInput = <T extends ValidComponent = "input">(+ props: RadioGroupItemInputProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupItemInputProps, ["class"])++ return (+ <RadioGroupPrimitive.ItemInput+ data-slot="radio-group-item-input"+ class={cx("peer/radio-group", props.class)}+ {...rest}+ />+ )+}++export type RadioGroupItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof RadioGroupPrimitive.Item<T>>++export const RadioGroupItem = <T extends ValidComponent = "div">(+ props: RadioGroupItemProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupItemProps, [+ "class",+ "children",+ ])++ return (+ <RadioGroupPrimitive.Item+ data-slot="radio-group-item"+ class={cx("flex items-center gap-3", props.class)}+ {...rest}+ >+ {props.children}+ </RadioGroupPrimitive.Item>+ )+}++export type RadioGroupItemControlProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof RadioGroupPrimitive.ItemControl<T>>++export const RadioGroupItemControl = <T extends ValidComponent = "div">(+ props: RadioGroupItemControlProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupItemControlProps, ["class"])++ return (+ <RadioGroupPrimitive.ItemControl+ data-slot="radio-group-item-control"+ class={cx(+ "border-input dark:bg-input/30 flex size-4 items-center justify-center rounded-full border shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50",+ "data-[invalid]:ring-destructive/20 dark:data-[invalid]:ring-destructive/40 data-[invalid]:border-destructive",+ "peer-focus-visible/radio-group:ring-ring/50 peer-focus-visible/radio-group:border-ring peer-focus-visible/radio-group:ring-[3px]",+ props.class,+ )}+ {...rest}+ />+ )+}++export type RadioGroupItemIndicatorProps<T extends ValidComponent = "div"> =+ VoidProps<ComponentProps<typeof RadioGroupPrimitive.ItemIndicator<T>>>++export const RadioGroupItemIndicator = <T extends ValidComponent = "div">(+ props: RadioGroupItemIndicatorProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupItemIndicatorProps, ["class"])++ return (+ <RadioGroupPrimitive.ItemIndicator+ forceMount+ data-slot="radio-group-item-indicator"+ class={cx("data-[checked]:bg-primary size-2 rounded-full", props.class)}+ {...rest}+ />+ )+}++export type RadioGroupLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof RadioGroupPrimitive.Label<T>>++export const RadioGroupLabel = <T extends ValidComponent = "span">(+ props: RadioGroupLabelProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupLabelProps, ["class"])++ return (+ <RadioGroupPrimitive.Label+ forceMount+ data-slot="radio-group-label"+ class={cx("text-sm font-450 select-none", props.class)}+ {...rest}+ />+ )+}++export type RadioGroupItemLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof RadioGroupPrimitive.ItemLabel<T>>++export const RadioGroupItemLabel = <T extends ValidComponent = "span">(+ props: RadioGroupItemLabelProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupItemLabelProps, ["class"])++ return (+ <RadioGroupPrimitive.ItemLabel+ forceMount+ data-slot="radio-group-item-label"+ class={cx(+ "data-[invalid]:text-destructive text-sm font-450 select-none",+ props.class,+ )}+ {...rest}+ />+ )+}++export type RadioGroupDescriptionProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof RadioGroupPrimitive.Label<T>>++export const RadioGroupDescription = <T extends ValidComponent = "span">(+ props: RadioGroupDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupDescriptionProps, ["class"])++ return (+ <RadioGroupPrimitive.Description+ forceMount+ data-slot="radio-group-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}++export type RadioGroupErrorMessageProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof RadioGroupPrimitive.ErrorMessage<T>>++export const RadioGroupErrorMessage = <T extends ValidComponent = "span">(+ props: RadioGroupErrorMessageProps<T>,+) => {+ const [, rest] = splitProps(props as RadioGroupErrorMessageProps, ["class"])++ return (+ <RadioGroupPrimitive.ErrorMessage+ forceMount+ data-slot="radio-group-error-message"+ class={cx("text-destructive text-sm", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/search-input.tsx b/apps/web/src/components/ui/search-input.tsxnew file mode 100644index 00000000..9b80cf39--- /dev/null+++ b/apps/web/src/components/ui/search-input.tsx@@ -0,0 +1,32 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Icon } from "@/components/ui/icon";++export type SearchInputProps = {+ placeholder: string;+ value: string;+ onValue: (value: string) => void;+};++export function SearchInput(props: SearchInputProps) {+ return (+ <div class="mx-2 relative flex h-11 items-center border-b border-border">+ <Icon name="search" class="text-muted-foreground" />+ <input+ type="text"+ value={props.value}+ onInput={(e) => props.onValue(e.currentTarget.value)}+ onKeyDown={(e) => {+ if (e.key === "Escape") return;+ e.stopPropagation();+ }}+ placeholder={props.placeholder}+ aria-label={props.placeholder}+ autocomplete="off"+ class="min-w-0 flex-1 bg-transparent text-xs text-foreground placeholder:text-muted-foreground outline-none"+ />+ </div>+ );+}diff --git a/apps/web/src/components/ui/search-placeholder.tsx b/apps/web/src/components/ui/search-placeholder.tsxnew file mode 100644index 00000000..5ff811a8--- /dev/null+++ b/apps/web/src/components/ui/search-placeholder.tsx@@ -0,0 +1,30 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show, type JSX } from "solid-js";++import { Icon } from "@/components/ui/icon";++export type SearchPlaceholderProps = {+ text: string;+ trailing?: JSX.Element;+};++export function SearchPlaceholder(props: SearchPlaceholderProps) {+ return (+ <div class="px-2">+ <div class="relative h-11 flex items-center border-y border-border">+ <div class="w-6 h-7 flex items-center justify-center text-muted-foreground overflow-clip">+ <Icon name="search" />+ </div>+ <span class="flex-1 min-w-0 text-xs text-muted-foreground">+ {props.text}+ </span>+ <Show when={props.trailing}>{props.trailing}</Show>+ <div class="absolute left-6 top-1/2 -translate-y-1/2 w-px h-4 bg-foreground" />+ </div>+ </div>+ );+}+diff --git a/apps/web/src/components/ui/segmented-control.tsx b/apps/web/src/components/ui/segmented-control.tsxnew file mode 100644index 00000000..9a5d518f--- /dev/null+++ b/apps/web/src/components/ui/segmented-control.tsx@@ -0,0 +1,230 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/segmented-control++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { SegmentedControl as SegmentedControlPrimitive } from "@kobalte/core/segmented-control"++import { cx } from "@/lib/cva"++export type SegmentedControlProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SegmentedControlPrimitive<T>>++export const SegmentedControl = <T extends ValidComponent = "div">(+ props: SegmentedControlProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlProps, ["class"])++ return (+ <SegmentedControlPrimitive+ data-slot="segmented-control"+ class={cx("group/segmented-control flex flex-col gap-2", props.class)}+ {...rest}+ />+ )+}++export type SegmentedControlItemInputProps<T extends ValidComponent = "input"> =+ ComponentProps<typeof SegmentedControlPrimitive.ItemInput<T>>++export const SegmentedControlItemInput = <T extends ValidComponent = "input">(+ props: SegmentedControlItemInputProps<T>,+) => {+ return (+ <SegmentedControlPrimitive.ItemInput+ data-slot="segmented-control-item-input"+ {...props}+ />+ )+}++export type SegmentedControlItemLabelProps<T extends ValidComponent = "label"> =+ ComponentProps<typeof SegmentedControlPrimitive.ItemLabel<T>>++export const SegmentedControlItemLabel = <T extends ValidComponent = "label">(+ props: SegmentedControlItemLabelProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlItemLabelProps, [+ "class",+ ])++ return (+ <SegmentedControlPrimitive.ItemLabel+ data-slot="segmented-control-item-label"+ class={cx(+ "text-foreground dark:text-muted-foreground dark:data-[checked]:text-foreground relative flex flex-nowrap place-content-center px-2 py-1 text-sm font-450 whitespace-nowrap transition-[color,opacity] select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SegmentedControlIndicatorProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SegmentedControlPrimitive.Indicator<T>>++export const SegmentedControlIndicator = <T extends ValidComponent = "div">(+ props: SegmentedControlIndicatorProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlIndicatorProps, [+ "class",+ ])++ return (+ <SegmentedControlPrimitive.Indicator+ data-slot="segmented-control-indicator"+ class={cx(+ "bg-background dark:border-input dark:bg-input/30 absolute top-[3px] left-[3px] rounded-md border border-transparent shadow-sm transition-[width,height,transform]",+ "group-[[data-invalid]]/segmented-control:border-destructive dark:group-[[data-invalid]]/segmented-control:border-destructive",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SegmentedControlItemProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SegmentedControlPrimitive.Item<T>>++export const SegmentedControlItem = <T extends ValidComponent = "div">(+ props: SegmentedControlItemProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlItemProps, ["class"])++ return (+ <SegmentedControlPrimitive.Item+ data-slot="segmented-control-item"+ class={cx(+ "relative",+ "not-first-of-type:before:bg-input not-first-of-type:before:absolute not-first-of-type:before:inset-0 not-first-of-type:before:transition-opacity not-first-of-type:before:duration-200 not-first-of-type:before:content-['']",+ "group-[[aria-orientation=horizontal]]/segmented-control:not-first-of-type:before:inset-x-0 group-[[aria-orientation=horizontal]]/segmented-control:not-first-of-type:before:inset-y-2 group-[[aria-orientation=horizontal]]/segmented-control:not-first-of-type:before:w-px group-[[aria-orientation=horizontal]]/segmented-control:not-first-of-type:before:translate-x-[calc(-1*1px/2)]",+ "group-[[aria-orientation=vertical]]/segmented-control:not-first-of-type:before:inset-x-2 group-[[aria-orientation=vertical]]/segmented-control:not-first-of-type:before:inset-y-0 group-[[aria-orientation=vertical]]/segmented-control:not-first-of-type:before:h-px group-[[aria-orientation=vertical]]/segmented-control:not-first-of-type:before:translate-y-[calc(-1*1px/2)]",+ "has-[[data-slot=segmented-control-item-input]:checked]:before:opacity-0 has-[[data-slot=segmented-control-item-input]:checked]:[&+::before]:opacity-0",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SegmentedControlListProps = ComponentProps<"div">++export const SegmentedControlList = (props: SegmentedControlListProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="segmented-control-list"+ role="presentation"+ class={cx(+ "bg-muted text-muted-foreground relative h-full w-fit rounded-lg",+ "has-[[data-slot=segmented-control-item-input]:focus-visible]:[&_[data-slot=segmented-control-indicator]]:ring-ring/50 has-[[data-slot=segmented-control-item-input]:focus-visible]:[&_[data-slot=segmented-control-indicator]]:outline-ring has-[[data-slot=segmented-control-item-input]:focus-visible]:[&_[data-slot=segmented-control-indicator]]:ring-[3px] has-[[data-slot=segmented-control-item-input]:focus-visible]:[&_[data-slot=segmented-control-indicator]]:outline-1",+ "group-[[data-invalid]]/segmented-control:has-[[data-slot=segmented-control-item-input]:focus-visible]:[&_[data-slot=segmented-control-indicator]]:ring-destructive/20 dark:group-[[data-invalid]]/segmented-control:has-[[data-slot=segmented-control-item-input]:focus-visible]:[&_[data-slot=segmented-control-indicator]]:ring-destructive/40",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SegmentedControlItemsProps = ComponentProps<"div">++export const SegmentedControlItems = (props: SegmentedControlItemsProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="segmented-control-items"+ role="presentation"+ class={cx(+ "inline-flex list-none p-[3px] group-[[aria-orientation=vertical]]/segmented-control:flex-col",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SegmentedControlLabelProps<T extends ValidComponent = "span"> =+ ComponentProps<typeof SegmentedControlPrimitive.Label<T>>++export const SegmentedControlLabel = <T extends ValidComponent = "span">(+ props: SegmentedControlLabelProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlLabelProps, ["class"])++ return (+ <SegmentedControlPrimitive.Label+ data-slot="segmented-control-label"+ class={cx(+ "data-[invalid]:text-destructive text-sm font-450 select-none",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SegmentedControlDescriptionProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SegmentedControlPrimitive.Description<T>>++export const SegmentedControlDescription = <T extends ValidComponent = "div">(+ props: SegmentedControlDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlDescriptionProps, [+ "class",+ ])++ return (+ <SegmentedControlPrimitive.Description+ data-slot="segmented-control-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}++export type SegmentedControlItemDescriptionProps<+ T extends ValidComponent = "div",+> = ComponentProps<typeof SegmentedControlPrimitive.ItemDescription<T>>++export const SegmentedControlItemDescription = <+ T extends ValidComponent = "div",+>(+ props: SegmentedControlItemDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlItemDescriptionProps, [+ "class",+ ])++ return (+ <SegmentedControlPrimitive.ItemDescription+ data-slot="segmented-control-item-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}++export type SegmentedControlErrorMessageProps<+ T extends ValidComponent = "div",+> = ComponentProps<typeof SegmentedControlPrimitive.ErrorMessage<T>>++export const SegmentedControlErrorMessage = <T extends ValidComponent = "div">(+ props: SegmentedControlErrorMessageProps<T>,+) => {+ const [, rest] = splitProps(props as SegmentedControlErrorMessageProps, [+ "class",+ ])++ return (+ <SegmentedControlPrimitive.ErrorMessage+ data-slot="segmented-control-error-message"+ class={cx("text-destructive text-sm", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/segmented-icon-tabs.tsx b/apps/web/src/components/ui/segmented-icon-tabs.tsxnew file mode 100644index 00000000..144fbbed--- /dev/null+++ b/apps/web/src/components/ui/segmented-icon-tabs.tsx@@ -0,0 +1,74 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Match, Switch, type Accessor, type JSX } from "solid-js";++import { cx } from "@/lib/cva";+import { Icon } from "@/components/ui/icon";++export type SegmentedIconTab<T extends string = string> = {+ value: T;+ label: string;+ icon?: string | JSX.Element;+ iconClass?: string;+ disabled?: boolean;+};++export type SegmentedIconTabsProps<T extends string = string> = {+ value: Accessor<T>;+ onChange?: (value: T) => void;+ items: readonly SegmentedIconTab<T>[] | Accessor<readonly SegmentedIconTab<T>[]>;+ class?: string;+ buttonClass?: string;+ iconClass?: string;+ disabled?: boolean;+};++export function SegmentedIconTabs<T extends string = string>(+ props: SegmentedIconTabsProps<T>,+) {+ const items = () =>+ typeof props.items === "function" ? props.items() : props.items;++ return (+ <div class={cx("flex gap-px items-center overflow-clip rounded-md", props.class)}>+ <For each={items()}>+ {(item) => {+ const isActive = () => props.value() === item.value;+ const isDisabled = () =>+ props.disabled || item.disabled;++ return (+ <button+ type="button"+ class={cx(+ "flex-1 h-7 flex items-center justify-center",+ props.buttonClass,+ isActive()+ ? "bg-inset text-foreground"+ : "bg-input text-muted-foreground",+ )}+ disabled={isDisabled()}+ onClick={() => props.onChange?.(item.value)}+ title={item.label}+ aria-label={item.label}+ >+ <Switch>+ <Match when={!item.icon}>+ <span class="text-xs font-450">{item.label}</span>+ </Match>+ <Match when={typeof item.icon === "string"}>+ <Icon name={item.icon as string} class={cx("size-6", props.iconClass)} />+ </Match>+ <Match when={typeof item.icon === "object" && item.icon != null}>+ {item.icon}+ </Match>+ </Switch>+ </button>+ );+ }}+ </For>+ </div>+ );+}diff --git a/apps/web/src/components/ui/select.tsx b/apps/web/src/components/ui/select.tsxnew file mode 100644index 00000000..1ffe350c--- /dev/null+++ b/apps/web/src/components/ui/select.tsx@@ -0,0 +1,260 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/select++import type { ComponentProps, JSX, ValidComponent, VoidProps } from "solid-js"+import { mergeProps, splitProps } from "solid-js"+import { Select as SelectPrimitive } from "@kobalte/core/select"++import { Icon } from "@/components/ui/icon"+import { cx } from "@/lib/cva"++export const SelectPortal = SelectPrimitive.Portal+export const HiddenSelect = SelectPrimitive.HiddenSelect++export type SelectProps<+ Option,+ OptGroup = never,+ T extends ValidComponent = "div",+> = ComponentProps<typeof SelectPrimitive<Option, OptGroup, T>>++export const Select = <+ Option,+ OptGroup = never,+ T extends ValidComponent = "div",+>(+ props: SelectProps<Option, OptGroup, T>,+) => {+ const [, rest] = splitProps(props as SelectProps<Option, OptGroup>, ["class"])++ return (+ <SelectPrimitive+ data-slot="select"+ class={cx("space-y-2", props.class)}+ {...rest}+ />+ )+}++export type SelectValueProps<+ Options,+ T extends ValidComponent = "span",+> = ComponentProps<typeof SelectPrimitive.Value<Options, T>>++export const SelectValue = <Options, T extends ValidComponent = "span">(+ props: SelectValueProps<Options, T>,+) => {+ return <SelectPrimitive.Value data-slot="select-value" {...props} />+}++export type SelectTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof SelectPrimitive.Trigger<T>> & {+ size?: "sm" | "default"+ }++export const SelectTrigger = <T extends ValidComponent = "button">(+ props: SelectTriggerProps<T>,+) => {+ const merge = mergeProps({ size: "default" } as SelectTriggerProps, props)+ const [local, rest] = splitProps(merge, ["class", "size", "children"])++ return (+ <SelectPrimitive.Trigger+ data-slot="select-trigger"+ data-size={local.size}+ class={cx(+ "bg-input hover:bg-input/80 text-foreground data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full items-center gap-0 rounded-md pl-2 pr-0 text-xs whitespace-nowrap transition-colors outline-none disabled:cursor-not-allowed disabled:opacity-50",+ "relative overflow-hidden after:pointer-events-none after:absolute after:inset-0 after:rounded-md after:opacity-0 after:ring-1 after:ring-inset after:ring-ring after:z-20 focus-visible:after:opacity-100",+ "data-[size=default]:h-7 data-[size=sm]:h-6",+ "*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:flex-1 *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",+ local.class,+ )}+ {...rest}+ >+ {local.children}+ <SelectPrimitive.Icon<ValidComponent>+ class="w-6 h-full shrink-0 text-muted-foreground"+ as={(props) => {+ const [local, rest] = splitProps(props, ["class"])+ return (+ <div+ {...rest}+ class={cx(+ "w-6 h-full shrink-0 text-muted-foreground flex items-center justify-center overflow-clip",+ local.class,+ )}+ >+ <Icon name="chevron-down" class="size-6" />+ </div>+ )+ }}+ />+ </SelectPrimitive.Trigger>+ )+}++export type SelectIconTriggerProps<+ Option,+> = Omit<SelectTriggerProps, "children"> & {+ icon: JSX.Element+ valueClass?: string+ children?: SelectValueProps<Option>["children"]+}++export const SelectIconTrigger = <Option,>(+ props: SelectIconTriggerProps<Option>,+) => {+ const [local, rest] = splitProps(props, ["class", "icon", "valueClass", "children"])++ return (+ <SelectTrigger+ class={cx(+ "!w-full !px-0 !grid !grid-cols-[24px_minmax(0,1fr)_24px] !items-center !justify-normal !gap-0",+ local.class,+ )}+ {...rest}+ >+ <div+ class="w-6 h-7 flex items-center justify-center shrink-0 overflow-clip text-muted-foreground"+ >+ {local.icon}+ </div>+ <SelectValue<Option> class={cx("min-w-0", local.valueClass)}>+ {local.children}+ </SelectValue>+ </SelectTrigger>+ )+}++export type SelectContentProps<T extends ValidComponent = "div"> = VoidProps<+ ComponentProps<typeof SelectPrimitive.Content<T>>+>++export const SelectContent = <T extends ValidComponent = "div">(+ props: SelectContentProps<T>,+) => {+ const [, rest] = splitProps(props as SelectContentProps, ["class"])++ return (+ <SelectPrimitive.Content+ data-slot="select-content"+ class={cx(+ "bg-popover text-popover-foreground data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 z-[10000] min-w-[8rem] origin-(--kb-select-content-transform-origin) overflow-x-hidden overflow-y-auto flex flex-col gap-2 rounded-xl border border-border p-2 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12),0px_12px_16px_0px_rgba(0,0,0,0.16)] outline-none max-h-[var(--kb-popper-content-available-height)]",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=select-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=select-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=select-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=select-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ >+ <SelectPrimitive.Listbox class="outline-none flex flex-col gap-0" />+ </SelectPrimitive.Content>+ )+}++export type SelectItemProps<T extends ValidComponent = "li"> = ComponentProps<+ typeof SelectPrimitive.Item<T>+>++export const SelectItem = <T extends ValidComponent = "li">(+ props: SelectItemProps<T>,+) => {+ const [, rest] = splitProps(props as SelectItemProps, ["class", "children"])++ return (+ <SelectPrimitive.Item+ data-slot="select-item"+ class={cx(+ "group [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center rounded-md bg-popover px-2 py-0 text-xs outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 h-7 min-h-7 w-full data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground data-[highlighted]:[&_svg]:text-primary-foreground",+ props.class,+ )}+ {...rest}+ >+ <span class="size-6 shrink-0 flex items-center justify-center overflow-clip">+ <SelectPrimitive.ItemIndicator>+ <Icon name="confirm-check" class="size-6 text-foreground" />+ </SelectPrimitive.ItemIndicator>+ </span>+ <SelectPrimitive.ItemLabel class="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap">+ {(props as SelectItemProps).children}+ </SelectPrimitive.ItemLabel>+ </SelectPrimitive.Item>+ )+}++export type SelectSectionProps<T extends ValidComponent = "li"> =+ ComponentProps<typeof SelectPrimitive.Section<T>>++export const SelectSection = <T extends ValidComponent = "li">(+ props: SelectSectionProps<T>,+) => {+ const [, rest] = splitProps(props as SelectSectionProps, ["class"])++ return (+ <SelectPrimitive.Section+ data-slot="select-section"+ class={cx("text-muted-foreground px-2 py-1.5 text-xs", props.class)}+ {...rest}+ />+ )+}++export type SelectDescriptionProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SelectPrimitive.Description<T>>++export const SelectDescription = <T extends ValidComponent = "div">(+ props: SelectDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as SelectDescriptionProps, ["class"])++ return (+ <SelectPrimitive.Description+ data-slot="select-description"+ class={cx(+ "text-muted-foreground text-sm data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SelectLabelProps<T extends ValidComponent = "label"> =+ ComponentProps<typeof SelectPrimitive.Label<T>>++export const SelectLabel = <T extends ValidComponent = "label">(+ props: SelectLabelProps<T>,+) => {+ const [, rest] = splitProps(props as SelectLabelProps, ["class"])++ return (+ <SelectPrimitive.Label+ data-slot="select-label"+ class={cx(+ "flex items-center gap-2 text-sm leading-none font-450 select-none data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SelectErrorMessageProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SelectPrimitive.ErrorMessage<T>>++export const SelectErrorMessage = <T extends ValidComponent = "div">(+ props: SelectErrorMessageProps<T>,+) => {+ const [, rest] = splitProps(props as SelectErrorMessageProps, ["class"])++ return (+ <SelectPrimitive.ErrorMessage+ data-slot="select-errormessage"+ class={cx(+ "text-destructive text-sm data-[disabled]:opacity-50",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/separator.tsx b/apps/web/src/components/ui/separator.tsxnew file mode 100644index 00000000..56e72060--- /dev/null+++ b/apps/web/src/components/ui/separator.tsx@@ -0,0 +1,32 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/separator++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { Root as SeparatorPrimitive } from "@kobalte/core/separator"++import { cx } from "@/lib/cva"++export type SeparatorProps<T extends ValidComponent = "hr"> = ComponentProps<+ typeof SeparatorPrimitive<T>+>++export const Separator = <T extends ValidComponent = "hr">(+ props: SeparatorProps<T>,+) => {+ const [, rest] = splitProps(props as SeparatorProps, ["class"])++ return (+ <SeparatorPrimitive+ data-slot="separator"+ class={cx(+ "bg-border shrink-0 border-none data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/slider-input.tsx b/apps/web/src/components/ui/slider-input.tsxnew file mode 100644index 00000000..4b52f08c--- /dev/null+++ b/apps/web/src/components/ui/slider-input.tsx@@ -0,0 +1,292 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show, createEffect, createSignal, untrack, type JSX } from "solid-js";+import { cx } from "@/lib/cva";++export type SliderInputProps = {+ value: number;+ onChange?(value: number): void;+ onDragStart?(value: number): void;+ onDragEnd?(value: number): void;+ min?: number;+ max?: number;+ step?: number;+ format?(value: number): string;+ class?: string;+ disabled?: boolean;+ keyframe?: JSX.Element;+};++const TRACK_INSET_PX = 8;+const DRAG_THRESHOLD = 4;++const parseNumber = (input: string) => {+ const parsed = Number.parseFloat(input.replace(/[^0-9.-]/g, ""));+ return Number.isFinite(parsed) ? parsed : undefined;+};++const defaultFormat = (value: number) => String(Math.round(value));++export function SliderInput(props: SliderInputProps) {+ const min = () => props.min ?? 0;+ const max = () => props.max ?? 100;+ const step = () => {+ const raw = props.step ?? 1;+ return Number.isFinite(raw) && raw > 0 ? raw : 1;+ };+ const range = () => max() - min();+ const safeRange = () => (range() === 0 ? 1 : range());+ const clamp = (value: number) => Math.max(min(), Math.min(max(), value));+ const currentValue = () => clamp(props.value);+ const formatValue = (value: number) => props.format?.(value) ?? defaultFormat(value);++ const [internal, setInternal] = createSignal(untrack(() => formatValue(currentValue())));+ const [displayValue, setDisplayValue] = createSignal(untrack(() => currentValue()));+ const [isEditing, setIsEditing] = createSignal(false);+ const fillRatio = () => (clamp(displayValue()) - min()) / safeRange();++ let lastEmittedValue = untrack(() => currentValue());+ let containerEl: HTMLDivElement | undefined;+ let inputEl: HTMLInputElement | undefined;+ let dragRect: DOMRect | undefined;+ let pointerStart: { x: number; y: number } | null = null;+ let pointerStartTarget: HTMLElement | null = null;+ let activePointerId: number | null = null;+ let dragStarted = false;+ let skipBlurCommit = false;++ createEffect(() => {+ const nextValue = currentValue();+ if (nextValue !== untrack(displayValue)) setDisplayValue(nextValue);++ if (!untrack(isEditing)) {+ const nextLabel = formatValue(nextValue);+ if (nextLabel !== untrack(internal)) setInternal(nextLabel);+ }++ lastEmittedValue = nextValue;+ });++ const emitChange = (nextValue: number) => {+ const clamped = clamp(nextValue);+ lastEmittedValue = clamped;+ setDisplayValue(clamped);+ props.onChange?.(clamped);++ if (!untrack(isEditing)) {+ setInternal(formatValue(clamped));+ }+ };++ const valueFromClientX = (clientX: number) => {+ const rect = dragRect ?? containerEl?.getBoundingClientRect();+ if (!rect) return untrack(displayValue);++ const left = rect.left + TRACK_INSET_PX;+ const width = rect.width - TRACK_INSET_PX;+ if (width <= 0) return min();++ const ratio = (clientX - left) / width;+ const clampedRatio = Math.max(0, Math.min(1, ratio));+ const rawValue = min() + clampedRatio * range();+ const sliderStep = step();+ const snapped = Math.round(rawValue / sliderStep) * sliderStep;+ const stepDecimals = (sliderStep.toString().split(".")[1] || "").length;+ const normalized = stepDecimals === 0 ? snapped : Number(snapped.toFixed(stepDecimals));+ return clamp(normalized);+ };++ const resetPointerState = () => {+ pointerStart = null;+ activePointerId = null;+ dragRect = undefined;+ dragStarted = false;+ };++ const handlePointerMove = (event: PointerEvent) => {+ if (activePointerId === null || event.pointerId !== activePointerId) return;+ if (!pointerStart) return;++ const dx = event.clientX - pointerStart.x;+ const dy = event.clientY - pointerStart.y;++ if (!dragStarted && Math.hypot(dx, dy) >= DRAG_THRESHOLD) {+ dragStarted = true;+ if (inputEl && document.activeElement === inputEl) {+ inputEl.blur();+ }+ const startValue = valueFromClientX(event.clientX);+ emitChange(startValue);+ props.onDragStart?.(startValue);+ return;+ }++ if (dragStarted) {+ emitChange(valueFromClientX(event.clientX));+ }+ };++ const handlePointerUp = (event: PointerEvent) => {+ if (activePointerId === null || event.pointerId !== activePointerId) return;++ const wasDragging = dragStarted;+ const endX = event.clientX;+ const startTarget = pointerStartTarget;++ window.removeEventListener("pointermove", handlePointerMove);+ window.removeEventListener("pointerup", handlePointerUp);+ window.removeEventListener("pointercancel", handlePointerUp);++ if (wasDragging) {+ const finalValue = valueFromClientX(endX);+ if (finalValue !== lastEmittedValue) emitChange(finalValue);+ resetPointerState();+ pointerStartTarget = null;+ props.onDragEnd?.(finalValue);+ return;+ }++ resetPointerState();+ pointerStartTarget = null;++ if (startTarget && containerEl?.contains(startTarget)) {+ if (startTarget instanceof HTMLInputElement) {+ startTarget.focus();+ return;+ }++ const interactive = startTarget.closest(+ "button, [role='button'], a, input, select, textarea",+ );+ if (+ interactive instanceof HTMLElement &&+ interactive !== containerEl &&+ containerEl.contains(interactive)+ ) {+ interactive.dispatchEvent(+ new MouseEvent("click", {+ bubbles: true,+ cancelable: true,+ clientX: event.clientX,+ clientY: event.clientY,+ view: window,+ }),+ );+ }+ }+ };++ const handlePointerDown = (event: PointerEvent) => {+ if (props.disabled ?? false) return;+ event.preventDefault();++ dragRect = containerEl?.getBoundingClientRect();+ pointerStart = { x: event.clientX, y: event.clientY };+ pointerStartTarget = event.target instanceof HTMLElement ? event.target : null;+ activePointerId = event.pointerId;+ dragStarted = false;+ containerEl?.setPointerCapture?.(event.pointerId);++ window.addEventListener("pointermove", handlePointerMove);+ window.addEventListener("pointerup", handlePointerUp);+ window.addEventListener("pointercancel", handlePointerUp);+ };++ const handleInputFocus = (event: FocusEvent & { currentTarget: HTMLInputElement }) => {+ setIsEditing(true);+ event.currentTarget.select();+ };++ const handleInputBlur = (event: FocusEvent & { currentTarget: HTMLInputElement }) => {+ setIsEditing(false);++ if (skipBlurCommit) {+ skipBlurCommit = false;+ setInternal(formatValue(currentValue()));+ setDisplayValue(currentValue());+ return;+ }++ const parsed = parseNumber(event.currentTarget.value);+ if (parsed !== undefined) {+ const clamped = clamp(parsed);+ emitChange(clamped);+ props.onDragEnd?.(clamped);+ return;+ }++ setInternal(formatValue(currentValue()));+ setDisplayValue(currentValue());+ };++ const handleInputKeyDown = (event: KeyboardEvent & { currentTarget: HTMLInputElement }) => {+ if (event.key === "Enter") {+ event.currentTarget.blur();+ return;+ }++ if (event.key === "Escape") {+ skipBlurCommit = true;+ setIsEditing(false);+ setInternal(formatValue(currentValue()));+ setDisplayValue(currentValue());+ event.currentTarget.blur();+ }+ };++ return (+ <div+ ref={containerEl}+ class={cx(+ "group/slider-input relative flex-1 min-w-0 h-7 bg-input rounded-md overflow-hidden border-none outline-none touch-none after:pointer-events-none after:absolute after:inset-0 after:rounded-md after:opacity-0 after:ring-1 after:ring-inset after:ring-ring after:z-20",+ props.class,+ )}+ classList={{+ "opacity-50": props.disabled,+ "after:opacity-100": isEditing(),+ "cursor-not-allowed": props.disabled,+ }}+ onPointerDown={handlePointerDown}+ >+ <div+ class="absolute left-0 top-0 bottom-0 bg-muted rounded-l-md pointer-events-none"+ classList={{+ "rounded-r-md": fillRatio() >= 1,+ "rounded-r-sm": fillRatio() < 1,+ }}+ style={{+ width: `calc(${TRACK_INSET_PX}px + ${fillRatio()} * (100% - ${TRACK_INSET_PX}px))`,+ }}+ >+ <Show when={!props.disabled}>+ <div class="absolute right-1 top-1/2 -translate-y-1/2 w-0.5 rounded-xs bg-input transition-all duration-75 opacity-0 h-3 group-hover/slider-input:opacity-70 group-focus-within/slider-input:opacity-70 group-data-[dragging=true]/slider-input:opacity-100 group-data-[dragging=true]/slider-input:h-4" />+ </Show>+ </div>+ <div class="relative z-0 flex items-center h-full justify-between pl-2">+ <div class="relative inline-block">+ <span class="invisible pointer-events-none whitespace-pre text-xxs text-foreground">+ {internal().length === 0 ? "0" : internal()}+ </span>+ <input+ ref={inputEl}+ class="absolute inset-0 w-full h-full cursor-default bg-transparent text-xxs text-foreground focus:outline-none disabled:cursor-not-allowed border-none outline-none p-0"+ type="text"+ value={internal()}+ onInput={(event) => setInternal(event.currentTarget.value)}+ onFocus={handleInputFocus}+ onBlur={handleInputBlur}+ onKeyDown={handleInputKeyDown}+ disabled={props.disabled}+ />+ </div>+ <Show when={props.keyframe}>+ <div class="flex items-center justify-center shrink-0">+ {props.keyframe}+ </div>+ </Show>+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/ui/slider.tsx b/apps/web/src/components/ui/slider.tsxnew file mode 100644index 00000000..18aaeb9d--- /dev/null+++ b/apps/web/src/components/ui/slider.tsx@@ -0,0 +1,179 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/slider++import type { VoidProps } from "solid-js"+import { splitProps, type ComponentProps, type ValidComponent } from "solid-js"+import { Slider as SliderPrimitive } from "@kobalte/core/slider"++import { cx } from "@/lib/cva"++export type SliderProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof SliderPrimitive<T>+>++export const Slider = <T extends ValidComponent = "div">(+ props: SliderProps<T>,+) => {+ const [, rest] = splitProps(props as SliderProps, ["class"])++ return (+ <SliderPrimitive+ data-slot="slider"+ class={cx(+ "relative flex w-full touch-none flex-col items-center gap-2 select-none data-disabled:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SliderTrackProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof SliderPrimitive.Track<T>+>++export const SliderTrack = <T extends ValidComponent = "div">(+ props: SliderTrackProps<T>,+) => {+ const [, rest] = splitProps(props as SliderTrackProps, ["class"])++ return (+ <SliderPrimitive.Track+ data-slot="slider-track"+ class={cx(+ "bg-muted relative rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-[inherit] data-[orientation=vertical]:min-h-[inherit] data-[orientation=vertical]:w-1",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SliderFillProps<T extends ValidComponent = "div"> = VoidProps<+ ComponentProps<typeof SliderPrimitive.Fill<T>>+>++export const SliderFill = <T extends ValidComponent = "div">(+ props: SliderFillProps<T>,+) => {+ const [, rest] = splitProps(props as SliderFillProps, ["class"])++ return (+ <SliderPrimitive.Fill+ data-slot="slider-fill"+ class={cx(+ "bg-primary absolute rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SliderThumbProps<T extends ValidComponent = "span"> = VoidProps<+ ComponentProps<typeof SliderPrimitive.Thumb<T>>+>++export const SliderThumb = <T extends ValidComponent = "span">(+ props: SliderThumbProps<T>,+) => {+ const [, rest] = splitProps(props as SliderThumbProps, ["class"])++ return (+ <SliderPrimitive.Thumb+ data-slot="slider-thumb"+ class={cx(+ "border border-background bg-foreground ring-foreground/20 size-3 rounded-full shadow-sm transition-[color,box-shadow] hover:ring-3 hover:border-none focus-visible:ring-3 focus-visible:border-none focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 data-[orientation=horizontal]:-top-1 data-[orientation=vertical]:-left-1",+ props.class,+ )}+ {...rest}+ >+ <SliderPrimitive.Input />+ </SliderPrimitive.Thumb>+ )+}++export type SliderGroupProps = ComponentProps<"div">++export const SliderGroup = (props: SliderGroupProps) => {+ const [, rest] = splitProps(props, ["class"])++ return (+ <div+ data-slot="slider-group"+ class={cx("flex w-full justify-between", props.class)}+ {...rest}+ />+ )+}++export type SliderLabelProps<T extends ValidComponent = "label"> =+ ComponentProps<typeof SliderPrimitive.Label<T>>++export const SliderLabel = <T extends ValidComponent = "label">(+ props: SliderLabelProps<T>,+) => {+ const [, rest] = splitProps(props as SliderLabelProps, ["class"])++ return (+ <SliderPrimitive.Label+ data-slot="slider-label"+ class={cx("text-sm font-450 select-none", props.class)}+ {...rest}+ />+ )+}++export type SliderValueLabelProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SliderPrimitive.ValueLabel<T>>++export const SliderValueLabel = <T extends ValidComponent = "div">(+ props: SliderValueLabelProps<T>,+) => {+ const [, rest] = splitProps(props as SliderValueLabelProps, ["class"])++ return (+ <SliderPrimitive.ValueLabel+ data-slot="slider-value-label"+ class={cx("text-sm font-450 select-none", props.class)}+ {...rest}+ />+ )+}++export type SliderDescriptionProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SliderPrimitive.Description<T>>++export const SliderDescription = <T extends ValidComponent = "div">(+ props: SliderDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as SliderDescriptionProps, ["class"])++ return (+ <SliderPrimitive.Description+ data-slot="slider-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}++export type SliderErrorMessageProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SliderPrimitive.ErrorMessage<T>>++export const SliderErrorMessage = <T extends ValidComponent = "div">(+ props: SliderErrorMessageProps<T>,+) => {+ const [, rest] = splitProps(props as SliderErrorMessageProps, ["class"])++ return (+ <SliderPrimitive.ErrorMessage+ data-slot="slider-ErrorMessage"+ class={cx("text-destructive text-sm", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/sonner.tsx b/apps/web/src/components/ui/sonner.tsxnew file mode 100644index 00000000..a520432b--- /dev/null+++ b/apps/web/src/components/ui/sonner.tsx@@ -0,0 +1,43 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/sonner++import { useColorMode } from "@kobalte/core"+import { Toaster as Sonner } from "somoto"+import { Icon } from "./icon"++export const Toaster = (props: Parameters<typeof Sonner>[0]) => {+ const { colorMode } = useColorMode()++ return (+ <Sonner+ position="top-center"+ theme={colorMode()}++ icons={{+ success: <Icon name="confirm-check" />,+ info: <Icon name="alert-warning" />,+ warning: <Icon name="info" />,+ error: <Icon name="ban" />,+ loading: <Icon name="spinner-loader" class="animate-spin" />,+ }}+ toastOptions={{+ unstyled: true,+ classNames: {+ toast: "p-4 w-[350px] gap-2 border border-border rounded-lg bg-background text-foreground",+ title: 'font-450 text-xs',+ description: 'text-xs',+ content: 'flex gap-0.5',+ icon: 'size-6 mb-1',++ // actionButton: 'bg-zinc-400',+ // cancelButton: 'bg-orange-400',+ // closeButton: 'bg-lime-400',+ },+ }}+ {...props}+ />+ )+}diff --git a/apps/web/src/components/ui/switch.tsx b/apps/web/src/components/ui/switch.tsxnew file mode 100644index 00000000..9c94f31f--- /dev/null+++ b/apps/web/src/components/ui/switch.tsx@@ -0,0 +1,194 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/switch++import { splitProps, type ComponentProps, type ValidComponent } from "solid-js"+import { Switch as SwitchPrimitive } from "@kobalte/core/switch"+import { mergeRefs } from "@kobalte/utils"+import type { VariantProps } from "cva"++import { cva, cx } from "@/lib/cva"++export type SwitchProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof SwitchPrimitive<T>+>++export const Switch = <T extends ValidComponent = "div">(+ props: SwitchProps<T>,+) => {+ const [, rest] = splitProps(props as SwitchProps, ["class"])++ return (+ <SwitchPrimitive+ data-slot="switch"+ class={cx("relative", props.class)}+ {...rest}+ />+ )+}++export const switchControlVariants = cva({+ base: [+ "inline-flex items-center rounded-full border border-transparent transition-all",+ "data-[checked]:bg-primary",+ "peer-focus-visible/switch-input:border-ring peer-focus-visible/switch-input:ring-ring/50 peer-focus-visible/switch-input:ring-[3px]",+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",+ ],+ variants: {+ variant: {+ default: "bg-input h-4.5 w-8 shadow-xs",+ compact: "h-3.5 w-6 bg-muted p-[2px] shadow-none",+ },+ },+ defaultVariants: {+ variant: "default",+ },+})++export type SwitchControlProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SwitchPrimitive.Control<T>> &+ VariantProps<typeof switchControlVariants>++export const SwitchControl = <T extends ValidComponent = "div">(+ props: SwitchControlProps<T>,+) => {+ const [, rest] = splitProps(props as SwitchControlProps, ["class", "variant"])++ return (+ <SwitchPrimitive.Control+ data-slot="switch-control"+ class={switchControlVariants(+ {+ variant: props.variant,+ class: props.class,+ },+ )}+ {...rest}+ />+ )+}++export const switchThumbVariants = cva({+ base: "pointer-events-none rounded-full transition-transform",+ variants: {+ variant: {+ default:+ "size-4 bg-background dark:bg-foreground data-[checked]:translate-x-[calc(100%-2px)] dark:data-[checked]:bg-primary-foreground",+ compact:+ "size-2.5 bg-muted-foreground data-[checked]:bg-primary-foreground data-[checked]:translate-x-full",+ },+ },+ defaultVariants: {+ variant: "default",+ },+})++export type SwitchThumbProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof SwitchPrimitive.Thumb<T>+> &+ VariantProps<typeof switchThumbVariants>++export const SwitchThumb = <T extends ValidComponent = "div">(+ props: SwitchThumbProps<T>,+) => {+ const [, rest] = splitProps(props as SwitchThumbProps, ["class", "variant"])++ return (+ <SwitchPrimitive.Thumb+ data-slot="switch-thumb"+ class={switchThumbVariants(+ {+ variant: props.variant,+ class: props.class,+ },+ )}+ {...rest}+ />+ )+}++export type SwitchInputProps<T extends ValidComponent = "input"> =+ ComponentProps<typeof SwitchPrimitive.Input<T>>++export const SwitchInput = <T extends ValidComponent = "input">(+ props: SwitchInputProps<T>,+) => {+ const [local, rest] = splitProps(props as SwitchInputProps, ["class", "ref"])++ const setRef = (element: HTMLInputElement) => {+ const nativeFocus = element.focus.bind(element)+ element.focus = ((options?: FocusOptions) => {+ nativeFocus({+ ...options,+ preventScroll: options?.preventScroll ?? true,+ })+ }) as typeof element.focus+ }++ return (+ <SwitchPrimitive.Input+ data-slot="switch-input"+ class={cx("peer/switch-input", local.class)}+ ref={mergeRefs(setRef, local.ref)}+ {...rest}+ />+ )+}++export type SwitchLabelProps<T extends ValidComponent = "label"> =+ ComponentProps<typeof SwitchPrimitive.Label<T>>++export const SwitchLabel = <T extends ValidComponent = "label">(+ props: SwitchLabelProps<T>,+) => {+ const [, rest] = splitProps(props as SwitchLabelProps, ["class"])++ return (+ <SwitchPrimitive.Label+ data-slot="switch-label"+ class={cx(+ "text-sm font-450 select-none",+ "data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",+ "data-[invalid]:text-destructive",+ props.class,+ )}+ {...rest}+ />+ )+}++export type SwitchErrorMessageProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SwitchPrimitive.ErrorMessage<T>>++export const SwitchErrorMessage = <T extends ValidComponent = "div">(+ props: SwitchErrorMessageProps<T>,+) => {+ const [, rest] = splitProps(props as SwitchErrorMessageProps, ["class"])++ return (+ <SwitchPrimitive.ErrorMessage+ data-slot="switch-error-message"+ class={cx("text-destructive text-sm", props.class)}+ {...rest}+ />+ )+}++export type SwitchDescriptionProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof SwitchPrimitive.Description<T>>++export const SwitchDescription = <T extends ValidComponent = "div">(+ props: SwitchDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as SwitchDescriptionProps, ["class"])++ return (+ <SwitchPrimitive.Description+ data-slot="switch-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/tabs.tsx b/apps/web/src/components/ui/tabs.tsxnew file mode 100644index 00000000..a2cebe1e--- /dev/null+++ b/apps/web/src/components/ui/tabs.tsx@@ -0,0 +1,111 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/tabs++import type { ComponentProps, ValidComponent } from "solid-js"+import { splitProps } from "solid-js"+import { Tabs as TabsPrimitive } from "@kobalte/core/tabs"++import { cx } from "@/lib/cva"++export type TabsProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof TabsPrimitive<T>+>++export const Tabs = <T extends ValidComponent = "div">(props: TabsProps<T>) => {+ const [, rest] = splitProps(props as TabsProps, ["class"])++ return (+ <TabsPrimitive+ data-slot="tabs"+ class={cx(+ "flex flex-col gap-2",+ "data-[orientation=vertical]:flex-row",+ props.class,+ )}+ {...rest}+ />+ )+}++export type TabsListProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof TabsPrimitive.List<T>+>++export const TabsList = <T extends ValidComponent = "div">(+ props: TabsListProps<T>,+) => {+ const [, rest] = splitProps(props as TabsListProps, ["class"])++ return (+ <TabsPrimitive.List+ data-slot="tabs-list"+ class={cx(+ "bg-muted text-muted-foreground ring-muted relative flex h-[calc(var(--spacing)*7.5)] w-fit items-center justify-center rounded-lg ring-[3px]",+ "data-[orientation=vertical]:mt-[3px] data-[orientation=vertical]:size-full data-[orientation=vertical]:flex-col",+ props.class,+ )}+ {...rest}+ />+ )+}++export type TabsTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof TabsPrimitive.Trigger<T>>++export const TabsTrigger = <T extends ValidComponent = "button">(+ props: TabsTriggerProps<T>,+) => {+ const [, rest] = splitProps(props as TabsTriggerProps, ["class"])++ return (+ <TabsPrimitive.Trigger+ data-slot="tabs-trigger"+ class={cx(+ "text-foreground dark:text-muted-foreground dark:data-[selected]:text-foreground peer relative z-10 inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 px-2 py-1 text-sm font-450 whitespace-nowrap transition-[color] focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ props.class,+ )}+ {...rest}+ />+ )+}++export type TabsContentProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof TabsPrimitive.Content<T>+>++export const TabsContent = <T extends ValidComponent = "div">(+ props: TabsContentProps<T>,+) => {+ const [, rest] = splitProps(props as TabsContentProps, ["class"])++ return (+ <TabsPrimitive.Content+ data-slot="tabs-content"+ class={cx("flex-1 outline-none", props.class)}+ {...rest}+ />+ )+}++export type TabsIndicatorProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof TabsPrimitive.Indicator<T>>++export const TabsIndicator = <T extends ValidComponent = "div">(+ props: TabsIndicatorProps<T>,+) => {+ const [, rest] = splitProps(props as TabsIndicatorProps, ["class"])++ return (+ <TabsPrimitive.Indicator+ data-slot="tabs-indicator"+ class={cx(+ "bg-background dark:bg-input/30 dark:border-input peer-focus-visible:border-ring peer-focus-visible:ring-ring/50 peer-focus-visible:outline-ring absolute inset-0 rounded-lg border border-transparent shadow-sm transition-[box-shadow,transform,width,height] duration-200 peer-focus-visible:ring-[3px] peer-focus-visible:outline-1",+ props.class,+ )}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/text-field.tsx b/apps/web/src/components/ui/text-field.tsxnew file mode 100644index 00000000..410702bd--- /dev/null+++ b/apps/web/src/components/ui/text-field.tsx@@ -0,0 +1,482 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/text-field++import type { ComponentProps, ValidComponent } from "solid-js";+import {+ For,+ Match,+ Show,+ Switch,+ createMemo,+ createSignal,+ splitProps,+} from "solid-js";+import { TextField as TextFieldPrimitive } from "@kobalte/core/text-field";+import { callHandler } from "@/lib/call-handler";+import { cx } from "@/lib/cva";+import { tw } from "@/lib/tw";+import { assert } from "@/utils";++import type { JSX } from "solid-js";++export type TextFieldProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof TextFieldPrimitive<T>+>;++export const TextField = <T extends ValidComponent = "div">(+ props: TextFieldProps<T>,+) => {+ const [, rest] = splitProps(props as TextFieldProps, ["class"]);++ return (+ <TextFieldPrimitive+ data-slot="text-field"+ class={cx("grid w-full gap-2", props.class)}+ {...rest}+ />+ );+};++export type TextFieldInputProps<T extends ValidComponent = "input"> =+ ComponentProps<typeof TextFieldPrimitive.Input<T>> & {+ uiSize?: "default" | "compact";+ };++export const TextFieldInput = <T extends ValidComponent = "input">(+ props: TextFieldInputProps<T>,+) => {+ const [local, rest] = splitProps(props as TextFieldInputProps, [+ "class",+ "uiSize",+ ]);++ return (+ <TextFieldPrimitive.Input+ data-slot="text-field-input"+ class={cx(+ tw`placeholder:text-muted-foreground selection:bg-selection selection:text-selection-foreground bg-input h-7 rounded-md px-2 py-1 text-base font-normal transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-ring`,+ tw`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,+ tw`file:text-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-450`,+ local.uiSize === "compact" && "text-xs",+ local.class,+ )}+ {...rest}+ />+ );+};++export type TextFieldTextAreaProps<T extends ValidComponent = "textarea"> =+ ComponentProps<typeof TextFieldPrimitive.TextArea<T>>;++export const TextFieldTextArea = <T extends ValidComponent = "textarea">(+ props: TextFieldTextAreaProps<T>,+) => {+ const [, rest] = splitProps(props as TextFieldTextAreaProps, ["class"]);++ return (+ <TextFieldPrimitive.TextArea+ data-slot="text-field-textarea"+ class={cx(+ "placeholder:text-muted-foreground selection:bg-selection selection:text-selection-foreground dark:bg-input/30 border-input flex min-h-16 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-ring",+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",+ props.class,+ )}+ {...rest}+ />+ );+};++export type TextFieldLabelProps<T extends ValidComponent = "label"> =+ ComponentProps<typeof TextFieldPrimitive.Label<T>> & {+ uiSize?: "default" | "compact";+ };++export const TextFieldLabel = <T extends ValidComponent = "label">(+ props: TextFieldLabelProps<T>,+) => {+ const [local, rest] = splitProps(props as TextFieldLabelProps, [+ "class",+ "uiSize",+ ]);++ return (+ <TextFieldPrimitive.Label+ data-slot="text-field-label"+ class={cx(+ "text-sm font-450 select-none",+ local.uiSize === "compact" &&+ "text-xs font-normal",+ "data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",+ "data-invalid:text-destructive",+ local.class,+ )}+ {...rest}+ />+ );+};++export type TextFieldErrorMessageProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof TextFieldPrimitive.ErrorMessage<T>> & {+ errors?: ({ message?: string } | undefined)[];+ };++export const TextFieldErrorMessage = <T extends ValidComponent = "div">(+ props: TextFieldErrorMessageProps<T>,+) => {+ const [, rest] = splitProps(props as TextFieldErrorMessageProps, [+ "class",+ "errors",+ "children",+ ]);++ const uniqueErrors = () => [+ ...new Map(props.errors?.map((error) => [error?.message, error])).values(),+ ];++ return (+ <TextFieldPrimitive.ErrorMessage+ data-slot="text-field-error-message"+ class={cx("text-destructive text-sm", props.class)}+ {...rest}+ >+ <Switch+ fallback={+ <ul class="ml-4 flex list-disc flex-col gap-1">+ <For each={uniqueErrors()}>+ {(error) => <li>{error?.message}</li>}+ </For>+ </ul>+ }+ >+ <Match when={props.children}>{props.children}</Match>+ <Match when={!props.errors?.length}>{null}</Match>+ <Match when={uniqueErrors().length == 1}>+ {uniqueErrors()[0]?.message}+ </Match>+ </Switch>+ </TextFieldPrimitive.ErrorMessage>+ );+};++export type TextFieldDescriptionProps<T extends ValidComponent = "div"> =+ ComponentProps<typeof TextFieldPrimitive.Description<T>>;++export const TextFieldDescription = <T extends ValidComponent = "div">(+ props: TextFieldDescriptionProps<T>,+) => {+ const [, rest] = splitProps(props as TextFieldDescriptionProps, ["class"]);++ return (+ <TextFieldPrimitive.Description+ data-slot="text-field-description"+ class={cx("text-muted-foreground text-sm", props.class)}+ {...rest}+ />+ );+};++export type ControlledTextFieldProps<T extends ValidComponent = "input"> = Omit<+ ComponentProps<typeof TextFieldPrimitive.Input<T>>,+ "type"+> & {+ icon?: JSX.Element;+ keyframe?: JSX.Element;+ autoSelect?: boolean;+ showSign?: boolean;+ inputClassName?: string;+ unit?: string;+ skipEmpty?: boolean;+ limitEvents?: boolean;+ sliderEnabled?: boolean;+ onUnitChange?: (value: string) => void;+ onNumber?: (value: number) => void;+};++const SLIDER_STEP_FACTOR = 3;++export const ControlledTextField = <T extends ValidComponent = "input">(+ props: ControlledTextFieldProps<T>,+) => {+ const [local, rest] = splitProps(props as ControlledTextFieldProps, [+ "class",+ "icon",+ "autoSelect",+ "value",+ "showSign",+ "inputClassName",+ "unit",+ "skipEmpty",+ "limitEvents",+ "keyframe",+ "onNumber",+ "step",+ "min",+ "max",+ "onChange",+ "onInput",+ "onUnitChange",+ "sliderEnabled",+ ]);+ let inputRef!: HTMLInputElement;++ const [internalValue, setInternalValue] = createSignal<string>();+ const [isControlled, setIsControlled] = createSignal(false);++ const numericEnabled = () => Boolean(local.onNumber);++ const applyStepAndClamp = (value: number) => {+ let next = value;++ if (local.step !== undefined) {+ const step = Number(local.step);+ assert(step > 0, "Step must be greater than 0");++ next = Math.round(next / step) * step;+ const decimals = (step.toString().split(".")[1] || "").length;+ next = Number(next.toFixed(decimals));+ }++ if (local.min !== undefined) next = Math.max(Number(local.min), next);+ if (local.max !== undefined) next = Math.min(Number(local.max), next);++ return next;+ };++ const emitValue = (rawValue: string) => {+ const trimmed = rawValue.trim();++ if (!trimmed) {+ if (local.skipEmpty) return;++ local.onNumber?.(applyStepAndClamp(0));+ return;+ }++ const parsed = parseFloat(trimmed);+ if (Number.isNaN(parsed)) return;++ local.onNumber?.(applyStepAndClamp(parsed));+ };++ const displayValue = createMemo(() => {+ if (isControlled()) {+ return internalValue();+ }++ let value = String(local.value ?? "");++ if (local.showSign && !value.match(/^(\+|-)/)) {+ const asNumber = Number(value);+ if (!Number.isNaN(asNumber)) {+ value = asNumber > 0 ? "+" + value : value;+ }+ }++ if (local.unit && !value.endsWith(local.unit)) {+ value = value + local.unit;+ }++ return value;+ });++ const handleInput: JSX.EventHandler<HTMLInputElement, InputEvent> = (e) => {+ const rawValue = e.currentTarget.value;+ setInternalValue(rawValue);+ setIsControlled(true);+ callHandler(e, local.onInput);++ if (!local.limitEvents && numericEnabled()) emitValue(rawValue);+ };++ const handleChange: JSX.EventHandler<HTMLInputElement, Event> = (e) => {+ const rawValue = e.currentTarget.value;+ setInternalValue(rawValue);+ callHandler(+ e,+ local.onChange as JSX.EventHandlerUnion<HTMLInputElement, Event>,+ );++ if (local.onUnitChange) {+ // Extract unit from string (non-numeric suffix after the number)+ const unitMatch = rawValue.match(/^[+-]?[\d.]*(.*)$/);+ const extractedUnit = unitMatch?.[1]?.trim() ?? "";++ if (extractedUnit !== (local.unit ?? "").trim()) {+ local.onUnitChange(extractedUnit);+ }+ }++ if (numericEnabled()) emitValue(rawValue);+ setIsControlled(false);+ };++ const handleKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (+ e,+ ) => {+ if (e.key === "Enter") {+ (e.currentTarget as HTMLInputElement).blur();+ return;+ }++ if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;+ if (!numericEnabled()) return;++ const rawValue = e.currentTarget.value;++ // Parse value: optional sign, number, optional unit+ const match = rawValue.match(/^([+-]?)([\d.]*)(.*?)$/);+ if (!match) return;++ const [, sign, numStr] = match;+ let num = parseFloat((sign || "") + (numStr || "0"));++ if (Number.isNaN(num)) num = 0;++ e.preventDefault();++ // Calculate step: use prop step or default to 1, multiply by 10 if shift+ let step = local.step !== undefined ? Number(local.step) : 1;+ if (e.shiftKey) {+ step *= 10;+ }++ // Apply increment/decrement+ if (e.key === "ArrowUp") {+ num += step;+ } else {+ num -= step;+ }++ // Fix floating point precision issues+ const stepDecimals = (step.toString().split(".")[1] || "").length;+ num = Number(num.toFixed(stepDecimals));++ // Clamp to min/max if supplied+ if (local.min !== undefined) {+ num = Math.max(Number(local.min), num);+ }+ if (local.max !== undefined) {+ num = Math.min(Number(local.max), num);+ }++ local.onNumber?.(num);++ setIsControlled(false);+ };++ // Slider drag state+ let isDragging = false;+ let dragStartX = 0;+ let dragStartValue = 0;++ const getCurrentNumericValue = (): number => {+ if (isControlled()) {+ const rawInternalValue = internalValue();+ if (rawInternalValue !== undefined) {+ const num = parseFloat(rawInternalValue.trim());+ if (!Number.isNaN(num)) return num;+ }+ }++ const rawValue = String(local.value ?? "0");+ const num = parseFloat(rawValue);+ return Number.isNaN(num) ? 0 : num;+ };++ const stopDrag = () => {+ if (!isDragging) return;+ isDragging = false;++ document.removeEventListener("pointermove", handleSliderPointerMove);+ document.removeEventListener("pointerup", handleSliderPointerUp);+ document.removeEventListener("pointercancel", handleSliderPointerUp);+ };++ const handleSliderPointerDown = (e: PointerEvent) => {+ if (!local.sliderEnabled || !numericEnabled()) return;++ e.preventDefault();+ isDragging = true;+ dragStartX = e.clientX;+ dragStartValue = getCurrentNumericValue();++ document.addEventListener("pointermove", handleSliderPointerMove);+ document.addEventListener("pointerup", handleSliderPointerUp);+ document.addEventListener("pointercancel", handleSliderPointerUp);+ };++ const handleSliderPointerMove = (e: PointerEvent) => {+ if (!isDragging) return;++ const delta = e.clientX - dragStartX;++ // Calculate step: use prop step or default to 1, multiply by 10 if shift+ let step = local.step !== undefined ? Number(local.step) : 1;+ if (e.shiftKey) {+ step *= 10;+ }++ // Apply delta (1 pixel = 1 step unit)+ let num = dragStartValue + (delta * step * SLIDER_STEP_FACTOR);++ // Fix floating point precision issues+ const stepDecimals = (step.toString().split(".")[1] || "").length;+ num = Number(num.toFixed(stepDecimals));++ // Clamp to min/max if supplied+ if (local.min !== undefined) {+ num = Math.max(Number(local.min), num);+ }+ if (local.max !== undefined) {+ num = Math.min(Number(local.max), num);+ }++ local.onNumber?.(num);++ setIsControlled(false);+ };++ const handleSliderPointerUp = () => stopDrag();++ return (+ <TextField class={cx("relative w-full min-w-0 group", local.class)}>+ <Show when={local.icon}>+ <div+ class="absolute flex items-center justify-center w-6 left-0 inset-y-0 text-muted-foreground group-hover:text-foreground transition-colors"+ classList={{+ "cursor-ew-resize": local.sliderEnabled,+ "pointer-events-none": !local.sliderEnabled,+ }}+ onPointerDown={handleSliderPointerDown}+ >+ {local.icon}+ </div>+ </Show>+ <TextFieldInput+ {...rest}+ ref={inputRef}+ type="text"+ class={cx(+ "w-full min-w-0 text-xxs",+ local.inputClassName,+ local.icon && "pl-6",+ local.keyframe && "pr-6",+ )}+ inputMode="text"+ value={displayValue()}+ onInput={handleInput}+ onChange={handleChange}+ onKeyDown={handleKeyDown}+ on:focus={() => local.autoSelect && inputRef?.select()}+ />+ <Show when={local.keyframe}>+ <div class="absolute flex items-center justify-center w-6 h-7 right-0 inset-y-0">+ {local.keyframe}+ </div>+ </Show>+ </TextField>+ );+};diff --git a/apps/web/src/components/ui/toggle-button.tsx b/apps/web/src/components/ui/toggle-button.tsxnew file mode 100644index 00000000..a1774fff--- /dev/null+++ b/apps/web/src/components/ui/toggle-button.tsx@@ -0,0 +1,57 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/toggle-button++import { splitProps, type ComponentProps, type ValidComponent } from "solid-js"+import { ToggleButton as ToggleButtonPrimitive } from "@kobalte/core/toggle-button"+import type { VariantProps } from "cva"++import { cva } from "@/lib/cva"++export const toggleButtonVariants = cva({+ base: "inline-flex items-center justify-center gap-2 rounded-md text-sm font-450 hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[pressed]:bg-accent data-[pressed]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,background-color,box-shadow] whitespace-nowrap",+ variants: {+ variant: {+ default: "bg-transparent",+ outline:+ "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",+ },+ size: {+ default: "h-9 px-2 min-w-9",+ sm: "h-8 px-1.5 min-w-8",+ lg: "h-10 px-2.5 min-w-10",+ },+ },+ defaultVariants: {+ variant: "default",+ size: "default",+ },+})++export type ToggleButtonProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof ToggleButtonPrimitive<T>> &+ VariantProps<typeof toggleButtonVariants>++export const ToggleButton = <T extends ValidComponent = "button">(+ props: ToggleButtonProps<T>,+) => {+ const [, rest] = splitProps(props as ToggleButtonProps, [+ "class",+ "variant",+ "size",+ ])++ return (+ <ToggleButtonPrimitive+ data-slot="toggle"+ class={toggleButtonVariants({+ variant: props.variant,+ size: props.size,+ class: props.class,+ })}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/toggle-group.tsx b/apps/web/src/components/ui/toggle-group.tsxnew file mode 100644index 00000000..bf5c7a2a--- /dev/null+++ b/apps/web/src/components/ui/toggle-group.tsx@@ -0,0 +1,91 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/toggle-group++import type { ComponentProps, ValidComponent } from "solid-js"+import { createContext, splitProps, useContext } from "solid-js"+import { ToggleGroup as ToggleGroupPrimitive } from "@kobalte/core/toggle-group"+import type { VariantProps } from "cva"++import { cx } from "@/lib/cva"++import { toggleButtonVariants } from "./toggle-button"++const ToggleGroupContext =+ createContext<VariantProps<typeof toggleButtonVariants>>()++export type ToggleGroupProps<T extends ValidComponent = "div"> = ComponentProps<+ typeof ToggleGroupPrimitive<T>+> &+ VariantProps<typeof toggleButtonVariants>++export const ToggleGroup = <T extends ValidComponent = "div">(+ props: ToggleGroupProps<T>,+) => {+ const [, rest] = splitProps(props as ToggleGroupProps, [+ "class",+ "variant",+ "size",+ "children",+ ])++ return (+ <ToggleGroupPrimitive+ data-slot="toggle-group"+ data-variant={props.variant}+ data-size={props.size}+ class={cx(+ "group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",+ props.class,+ )}+ {...rest}+ >+ <ToggleGroupContext.Provider+ value={{+ get size() {+ return props.size+ },+ get variant() {+ return props.variant+ },+ }}+ >+ {props.children}+ </ToggleGroupContext.Provider>+ </ToggleGroupPrimitive>+ )+}++export type ToggleGroupItemProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof ToggleGroupPrimitive.Item<T>> &+ VariantProps<typeof toggleButtonVariants>++export const ToggleGroupItem = <T extends ValidComponent = "button">(+ props: ToggleGroupItemProps<T>,+) => {+ const [, rest] = splitProps(props as ToggleGroupItemProps, [+ "class",+ "variant",+ "size",+ ])+ const context = useContext(ToggleGroupContext)++ return (+ <ToggleGroupPrimitive.Item+ data-slot="toggle-group-item"+ data-variant={context?.variant ?? props.variant}+ data-size={context?.size ?? props.size}+ class={toggleButtonVariants({+ variant: context?.variant ?? props.variant,+ size: context?.size ?? props.size,+ class: [+ "min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",+ props.class,+ ],+ })}+ {...rest}+ />+ )+}diff --git a/apps/web/src/components/ui/tooltip.tsx b/apps/web/src/components/ui/tooltip.tsxnew file mode 100644index 00000000..e444dae9--- /dev/null+++ b/apps/web/src/components/ui/tooltip.tsx@@ -0,0 +1,79 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Copied from https://shadcn-solid.netlify.app/docs/components/tooltip++import type { ComponentProps, ValidComponent, Accessor } from "solid-js";+import { createMemo, mergeProps, Show, splitProps } from "solid-js";+import { Tooltip as TooltipPrimitive } from "@kobalte/core/tooltip";++import { cx } from "@/lib/cva";++export type TooltipProps = ComponentProps<typeof TooltipPrimitive>;++export const TooltipPortal = TooltipPrimitive.Portal;++export const Tooltip = (props: TooltipProps) => {+ const merge = mergeProps<TooltipProps[]>(+ {+ closeDelay: 0,+ openDelay: 0,+ placement: "top",+ gutter: 8,+ },+ props,+ );++ return <TooltipPrimitive data-slot="tooltip" {...merge} />;+};++export type TooltipTriggerProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof TooltipPrimitive.Trigger<T>>;++export const TooltipTrigger = <T extends ValidComponent = "button">(+ props: TooltipTriggerProps<T>,+) => {+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;+};++export type TooltipContentProps<T extends ValidComponent = "button"> =+ ComponentProps<typeof TooltipPrimitive.Content<T>> & {+ shortcut?: Accessor<string> | string;+ };++export const TooltipContent = <T extends ValidComponent = "button">(+ props: TooltipContentProps<T>,+) => {+ const [, rest] = splitProps(props as TooltipContentProps, [+ "class",+ "children",+ "shortcut",+ ]);++ const shortcut = createMemo(() => {+ if (typeof props.shortcut === 'string') {+ return props.shortcut;+ }+ return props.shortcut?.();+ });++ return (+ <TooltipPrimitive.Content+ data-slot="tooltip-content"+ class={cx(+ "bg-background text-foreground rounded-md px-2 py-1 text-xs font-450 text-balance shadow-md flex items-center animate-in border border-border fade-in-0 zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-[10000] w-fit origin-(--kb-tooltip-content-transform-origin)",+ "[[data-popper-positioner][style*='--kb-popper-content-transform-origin:_top']>[data-slot=tooltip-content]]:slide-in-from-top-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_bottom']>[data-slot=tooltip-content]]:slide-in-from-bottom-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_left']>[data-slot=tooltip-content]]:slide-in-from-left-2 [[data-popper-positioner][style*='--kb-popper-content-transform-origin:_right']>[data-slot=tooltip-content]]:slide-in-from-right-2",+ props.class,+ )}+ {...rest}+ >+ {props.children}+ <Show when={shortcut()?.length}>+ <span class="text-muted-foreground text-xs ml-1">+ {shortcut()}+ </span>+ </Show>+ </TooltipPrimitive.Content>+ );+};diff --git a/apps/web/src/components/unsupported-browser.tsx b/apps/web/src/components/unsupported-browser.tsxnew file mode 100644index 00000000..b29edcdc--- /dev/null+++ b/apps/web/src/components/unsupported-browser.tsx@@ -0,0 +1,31 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show } from "solid-js";+import { isServer } from "solid-js/web";+import { Icon } from "@/components/ui/icon";++function isChromium() {+ if (isServer) return true;+ const uaData = (navigator as { userAgentData?: { brands: { brand: string }[] } }).userAgentData;+ return uaData?.brands?.some((b) => b.brand === "Chromium") ?? false;+}++export function UnsupportedBrowser() {+ return (+ <Show when={!isChromium()}>+ <div class="fixed inset-0 z-[100] flex items-center justify-center bg-background p-6">+ <div class="flex max-w-sm flex-col items-center gap-3 text-center">+ <span class="text-muted-foreground">+ <Icon name="alert-warning" class="size-12" />+ </span>+ <h2 class="text-xl font-450 text-foreground">Unsupported browser</h2>+ <p class="text-xs text-muted-foreground">+ Diffusion Studio requires a Chromium-based browser. Please switch to Google Chrome, Microsoft Edge, Brave, or Arc.+ </p>+ </div>+ </div>+ </Show>+ );+}diff --git a/apps/web/src/components/upgrade-dialog.tsx b/apps/web/src/components/upgrade-dialog.tsxnew file mode 100644index 00000000..1b060735--- /dev/null+++ b/apps/web/src/components/upgrade-dialog.tsx@@ -0,0 +1,230 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { For, Show, createSignal, onMount } from "solid-js";+import type { SubscriptionCredits, TopupCredits } from "@diffusionstudio/api-contract";++import { Button } from "@/components/ui/button";+import { Dialog, DialogContent, DialogPortal } from "@/components/ui/dialog";+import { Icon } from "@/components/ui/icon";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectPortal,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import {+ SwitchControl,+ SwitchInput,+ SwitchThumb,+ Switch as Toggle,+} from "@/components/ui/switch";+import { useAuth } from "@/context/auth";+import {+ SUBSCRIPTION_CREDIT_TIERS,+ SUBSCRIPTION_VOLUME_DISCOUNT,+ TOPUP_CREDIT_TIERS,+ getSubscriptionPrice,+ getTopupPrice,+ startSubscriptionCheckout,+ startTopupCheckout,+} from "@/lib/checkout";+import { track } from "@/lib/analytics";++const [open, setOpen] = createSignal(false);++export function showUpgradeDialog() {+ setOpen(true);+}++function formatCredits(value: number): string {+ return value.toLocaleString();+}++function formatSubscriptionTier(tier: SubscriptionCredits): string {+ const credits = parseInt(tier.replace("_", ""), 10).toLocaleString();+ const discount = SUBSCRIPTION_VOLUME_DISCOUNT[tier];+ return discount > 0+ ? `${credits} credits (${Math.round(discount * 100)}% off)`+ : `${credits} credits`;+}++function parseTopupCredits(tier: TopupCredits): number {+ return parseInt(tier.replace("_", ""), 10);+}++function FeatureRow(props: { label: string }) {+ return (+ <div class="flex items-center gap-2">+ <span class="size-4 flex items-center justify-center text-primary">+ <Icon name="confirm-check" />+ </span>+ <p class="text-xs text-muted-foreground">{props.label}</p>+ </div>+ );+}++function ProUpgradeContent() {+ const [annualBilling, setAnnualBilling] = createSignal(true);+ const [creditTier, setCreditTier] = createSignal<SubscriptionCredits>("2_500");+ const [loading, setLoading] = createSignal(false);++ const billingPeriod = (): "month" | "year" => (annualBilling() ? "year" : "month");+ const price = () => getSubscriptionPrice(creditTier(), billingPeriod());++ const handleUpgrade = async () => {+ if (loading()) return;+ setLoading(true);+ track('subscription_checkout_started', {+ credit_tier: creditTier(),+ billing_period: billingPeriod(),+ });+ try {+ await startSubscriptionCheckout({+ creditQuantity: creditTier(),+ billingPeriod: billingPeriod(),+ });+ } finally {+ setLoading(false);+ }+ };++ onMount(() => {+ track('subscription_checkout_viewed');+ });++ return (+ <div class="flex flex-col gap-4">+ <div class="flex flex-col gap-1">+ <img src="/mark-macos-small.png" alt="Diffusion Studio Logo Mark" class="size-12" />+ <h2 class="mt-2 text-sm leading-5 font-450 text-foreground">+ Diffusion Studio Pro+ </h2>+ <div class="flex items-end gap-1 mt-2">+ <p class="text-lg leading-6 font-450 text-foreground">${price()}</p>+ <p class="text-xs leading-none text-muted-foreground translate-y-[-4px]">+ {annualBilling() ? "/month, billed annually" : "/month"}+ </p>+ </div>+ </div>++ <div class="flex items-center gap-2 text-xs">+ <Toggle checked={annualBilling()} onChange={setAnnualBilling}>+ <SwitchInput aria-label="Toggle annual billing" />+ <SwitchControl variant="compact">+ <SwitchThumb variant="compact" />+ </SwitchControl>+ </Toggle>+ <span class="text-muted-foreground">Yearly billing (save 24%)</span>+ </div>++ <Select<SubscriptionCredits>+ options={SUBSCRIPTION_CREDIT_TIERS}+ value={creditTier()}+ onChange={(value) => value && setCreditTier(value)}+ itemComponent={(itemProps) => (+ <SelectItem item={itemProps.item}>+ {formatSubscriptionTier(itemProps.item.rawValue)}+ </SelectItem>+ )}+ >+ <SelectTrigger aria-label="Select AI credits per month">+ <SelectValue<SubscriptionCredits>>+ {formatSubscriptionTier(creditTier())}+ <span class="text-xs text-muted-foreground">/mo</span>+ </SelectValue>+ </SelectTrigger>+ <SelectPortal>+ <SelectContent />+ </SelectPortal>+ </Select>++ <div class="flex flex-col gap-2">+ <FeatureRow label="Monthly credit refill" />+ <FeatureRow label="Top up credits anytime" />+ <FeatureRow label="Access to all pro models" />+ <FeatureRow label="Priority feedback channel" />+ </div>++ <Button class="w-full" disabled={loading()} onClick={handleUpgrade}>+ Continue with Pro+ </Button>+ </div>+ );+}++function TopupContent() {+ const [selected, setSelected] = createSignal<TopupCredits>();+ const [loading, setLoading] = createSignal(false);++ const handleCheckout = async () => {+ const tier = selected();+ if (!tier || loading()) return;+ setLoading(true);+ track('topup_checkout_started', { credit_tier: tier });+ try {+ await startTopupCheckout(tier);+ } finally {+ setLoading(false);+ }+ };++ onMount(() => {+ track('topup_checkout_viewed');+ });++ return (+ <div class="flex flex-col gap-4">+ <div class="flex flex-col gap-1">+ <h2 class="mt-2 text-[12px] leading-5 font-450 text-foreground">+ You're out of credits+ </h2>+ <p class="text-xs text-muted-foreground">+ Top up to keep creating without interruptions.+ </p>+ </div>++ <div class="flex flex-col gap-2">+ <For each={TOPUP_CREDIT_TIERS}>+ {(tier) => (+ <button+ class="rounded-md border border-input p-3 flex flex-col items-start gap-0.5 font-normal transition-colors hover:bg-accent data-checked:border-primary focus-ring"+ classList={{ "border-primary": selected() === tier }}+ onClick={() => setSelected(tier)}+ >+ <span class="text-xs text-foreground">+ {formatCredits(parseTopupCredits(tier))} credits+ </span>+ <span class="text-xs text-muted-foreground">+ ${getTopupPrice(tier)}+ </span>+ </button>+ )}+ </For>+ </div>++ <Button class="w-full" disabled={loading() || !selected()} onClick={handleCheckout}>+ Checkout+ </Button>+ </div>+ );+}++export function UpgradeDialog() {+ const auth = useAuth();++ return (+ <Dialog open={open()} onOpenChange={setOpen}>+ <DialogPortal>+ <DialogContent class="sm:max-w-sm">+ <Show when={auth.isPro()} fallback={<ProUpgradeContent />}>+ <TopupContent />+ </Show>+ </DialogContent>+ </DialogPortal>+ </Dialog>+ );+}diff --git a/apps/web/src/context/auth.tsx b/apps/web/src/context/auth.tsxnew file mode 100644index 00000000..6ed145f2--- /dev/null+++ b/apps/web/src/context/auth.tsx@@ -0,0 +1,357 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ createContext,+ createEffect,+ createResource,+ createSignal,+ onCleanup,+ onMount,+ useContext,+ type Accessor,+ type JSX,+} from 'solid-js';+import { toast } from 'somoto';+import type { Session, User } from '@supabase/supabase-js';+import { FREE_CREDITS_QUOTA, type UserData } from '@diffusionstudio/api-contract';+import { CLI_CHANNELS } from '@diffusionstudio/cli/channels';++import { supabase } from '@/lib/supabase';+import { trpc } from '@/lib/trpc';+import { identify, resetIdentity, track } from '@/lib/analytics';+import { cliBridge, mainBridge } from '@/lib/ipc';+import { MAIN_CHANNELS } from '@desktop/main-channels';+import { assert } from '@/utils';++type OAuthProvider = 'google' | 'apple' | 'github';++type AuthContextValue = {+ session: Accessor<Session | null>;+ user: Accessor<User | null>;+ isAuthenticated: Accessor<boolean>;+ headless: Accessor<boolean>;+ isLoading: Accessor<boolean>;+ accessLevel: Accessor<number>;+ remainingCredits: Accessor<number>;+ creditLimit: Accessor<number>;+ nextCreditReset: Accessor<Date | null>;+ isPro: Accessor<boolean>;+ hasStripeCustomer: Accessor<boolean>;+ productUpdatesEnabled: Accessor<boolean>;+ marketingAnnouncementsEnabled: Accessor<boolean>;+ signInWithOAuth: (provider: OAuthProvider) => Promise<void>;+ signInWithOtp: (email: string) => Promise<{ error: string | null }>;+ signOut: () => Promise<void>;+ deleteAccount: () => Promise<{ error: string | null }>;+ refreshSession: () => Promise<void>;+};++const AuthContext = createContext<AuthContextValue>();++type UserDataSubset = Pick<+ UserData,+ | 'lifetime_credit_balance'+ | 'monthly_credit_balance'+ | 'monthly_credit_quota'+ | 'access_level'+ | 'stripe_customer_id'+ | 'last_credit_reset_at'+ | 'product_updates_enabled'+ | 'marketing_announcements_enabled'+>;++const ELECTRON_AUTH_REDIRECT = 'https://app.diffusion.studio/auth/electron-callback.html';+const USER_DATA_QUERY = "lifetime_credit_balance,monthly_credit_balance,monthly_credit_quota,access_level,stripe_customer_id,last_credit_reset_at,product_updates_enabled,marketing_announcements_enabled" as const;++export function AuthProvider(props: { children: JSX.Element }) {+ const [session, setSession] = createSignal<Session | null>(null);+ const [isLoading, setIsLoading] = createSignal(true);+ const [headless, setHeadless] = createSignal(false);++ onMount(() => {+ if (!window.desktop) return;++ mainBridge+ .call(MAIN_CHANNELS.HEADLESS_GET_MODE, undefined)+ .then(setHeadless)++ const unsubscribe = mainBridge.handle(+ MAIN_CHANNELS.HEADLESS_MODE,+ ({ active }) => setHeadless(active)+ );+ onCleanup(unsubscribe);+ });++ onMount(() => {+ if (!supabase) {+ setIsLoading(false);+ return;+ }++ void supabase.auth.getSession().then(({ data }) => {+ setSession(data.session);+ setIsLoading(false);+ });++ const { data: { subscription } } = supabase.auth.onAuthStateChange((event, newSession) => {+ setSession(newSession);+ if (event === 'SIGNED_IN' && newSession?.user) {+ const provider = newSession.user.app_metadata?.provider ?? 'unknown';+ identify(newSession.user.id, { provider });+ track('sign_in', { provider });+ } else if (event === 'SIGNED_OUT') {+ track('sign_out');+ resetIdentity();+ }+ });++ onCleanup(() => {+ subscription.unsubscribe();+ });+ });++++ const [userData, { mutate: mutateUserData }] = createResource<UserDataSubset | null, string>(+ () => session()?.user.id,+ async (userId) => {+ if (!supabase) return null;++ const { data, error } = await supabase+ .from('user_data')+ .select(USER_DATA_QUERY)+ .eq('id', userId)+ .single();++ if (error) {+ console.error('[auth] Failed to fetch user_data', error);+ return null;+ }++ return data as UserDataSubset;+ },+ );++ onMount(() => {+ if (!window.desktop) return;+ // Can't be moved to engine provider otherwise the handler+ // would not be present if the user is signed out.+ const unsubscribe = cliBridge.handle(CLI_CHANNELS.WHOAMI, () => {+ const user = session()?.user;+ if (!user) return null;+ return {+ id: user.id,+ email: user.email ?? "",+ provider: user.app_metadata?.provider ?? "unknown",+ };+ });+ onCleanup(unsubscribe);+ });++ onMount(() => {+ if (!window.desktop) return;+ // Must live in AuthProvider — ElectronProvider only mounts after sign-in,+ // but the OAuth deep link arrives while the user is still signed out.+ const handleAuthCallbackUrl = async (url: string | null) => {+ if (!supabase || !url) return;++ let code: string | null = null;+ try {+ const parsed = new URL(url);+ code = parsed.searchParams.get('code') ?? new URLSearchParams(parsed.hash.replace(/^#/, '')).get('code');+ } catch {+ return;+ }++ if (!code) return;++ const { error } = await supabase.auth.exchangeCodeForSession(code);+ if (error) {+ toast.error(error.message);+ }+ };++ void mainBridge+ .call(MAIN_CHANNELS.AUTH_GET_PENDING_CALLBACK, undefined)+ .then(handleAuthCallbackUrl);++ const unsubscribe = mainBridge.handle(MAIN_CHANNELS.AUTH_CALLBACK, ({ url }) => {+ handleAuthCallbackUrl(url);+ });++ onCleanup(unsubscribe);+ });++ createEffect(() => {+ const userId = session()?.user.id;+ if (!userId || !supabase) return;++ const client = supabase;+ const channel = client+ .channel(`user-data-${userId}`)+ .on(+ 'postgres_changes',+ {+ event: 'UPDATE',+ schema: 'public',+ table: 'user_data',+ filter: `id=eq.${userId}`,+ },+ (payload) => mutateUserData(payload.new as UserDataSubset),+ )+ .subscribe();++ onCleanup(() => client.removeChannel(channel));+ });++ const accessLevel = () => userData()?.access_level ?? 1;+ const lifetimeCreditBalance = () => userData()?.lifetime_credit_balance ?? 0;+ const monthlyCreditBalance = () => userData()?.monthly_credit_balance ?? 0;+ const monthlyCreditQuota = () => userData()?.monthly_credit_quota ?? 0;++ const signInWithOAuth = async (provider: OAuthProvider) => {+ if (!supabase) return;++ track('sign_in_attempt', { method: 'oauth', provider });++ if (window.desktop) {+ const { data, error } = await supabase.auth.signInWithOAuth({+ provider,+ options: {+ redirectTo: ELECTRON_AUTH_REDIRECT,+ skipBrowserRedirect: true,+ },+ });++ if (error) {+ toast.error(error.message);+ return;+ }++ if (data.url) {+ await mainBridge.call(MAIN_CHANNELS.APP_OPEN_EXTERNAL, { url: data.url });+ }+ return;+ }++ const { error } = await supabase.auth.signInWithOAuth({+ provider,+ options: {+ redirectTo: window.location.origin,+ },+ });++ if (error) {+ toast.error(error.message);+ }+ };++ const signInWithOtp = async (email: string): Promise<{ error: string | null }> => {+ if (!supabase) return { error: 'Auth is not configured' };++ track('sign_in_attempt', { method: 'otp' });++ const emailRedirectTo = window.desktop ? ELECTRON_AUTH_REDIRECT : window.location.origin;+ const { error } = await supabase.auth.signInWithOtp({+ email,+ options: { emailRedirectTo },+ });++ if (error) {+ return { error: error.message };+ }++ return { error: null };+ };++ const signOut = async () => {+ if (!supabase) return;++ const { error } = await supabase.auth.signOut();++ if (error) {+ toast.error(error.message);+ }+ };++ const deleteAccount = async (): Promise<{ error: string | null }> => {+ if (!supabase || !session()) {+ return { error: 'Not authenticated' };+ }++ if (!trpc) {+ return { error: 'API is not configured' };+ }++ try {+ await trpc.deleteAccount.mutate();+ track('account_deleted');++ // Sign out locally after successful server-side deletion+ await supabase.auth.signOut();+ return { error: null };+ } catch (err) {+ const message = err instanceof Error ? err.message : 'Failed to delete account';+ return { error: message };+ }+ };++ const refreshSession = async () => {+ if (!supabase) return;++ const { data: { user } } = await supabase.auth.getUser();+ const current = session();+ if (current && user) {+ setSession({ ...current, user });+ }+ };++ const isPro = () => accessLevel() > 1;+ const hasStripeCustomer = () => !!userData()?.stripe_customer_id;+ const productUpdatesEnabled = () => userData()?.product_updates_enabled ?? true;+ const marketingAnnouncementsEnabled = () => userData()?.marketing_announcements_enabled ?? true;+ const remainingCredits = () => monthlyCreditBalance() + lifetimeCreditBalance();+ const creditLimit = () => (isPro() ? monthlyCreditQuota() : FREE_CREDITS_QUOTA);+ const nextCreditReset = (): Date | null => {+ const last = userData()?.last_credit_reset_at;+ if (!last) return null;+ const next = new Date(last);+ next.setMonth(next.getMonth() + 1);+ return next;+ };++ const ctx: AuthContextValue = {+ session,+ isPro,+ hasStripeCustomer,+ user: () => session()?.user ?? null,+ isAuthenticated: () => !!session(),+ headless,+ isLoading,+ accessLevel,+ remainingCredits,+ creditLimit,+ nextCreditReset,+ productUpdatesEnabled,+ marketingAnnouncementsEnabled,+ signInWithOAuth,+ signInWithOtp,+ signOut,+ deleteAccount,+ refreshSession,+ };++ return (+ <AuthContext.Provider value={ctx}>+ {props.children}+ </AuthContext.Provider>+ );+}++export function useAuth(): AuthContextValue {+ const ctx = useContext(AuthContext);+ assert(ctx, 'useAuth must be used within AuthProvider');+ return ctx;+}diff --git a/apps/web/src/context/ecs.tsx b/apps/web/src/context/ecs.tsxnew file mode 100644index 00000000..01d01313--- /dev/null+++ b/apps/web/src/context/ecs.tsx@@ -0,0 +1,69 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, Or } from 'bitecs';+import { createContext, createMemo, useContext, type Accessor, type JSX } from 'solid-js';+import { assert } from '@/utils';+import { useEntityState, useQuery, useWorldState } from '@/components/engine/hooks';+import { ToolType } from '@/components/engine';+import { useEngine } from './engine';++type ECSContextValue = {+ selectedTool: Accessor<ToolType>;+ selectedNodes: Accessor<Set<number>>;+ selectedKeyframes: Accessor<Set<number>>;+ now: Accessor<number>;+ playing: Accessor<number>;+ looping: Accessor<number>;+};++const ECSContext = createContext<ECSContextValue>();++export function ECSProvider(props: { children: JSX.Element }) {+ const { world } = useEngine();+ const c = world.components;++ const scene = () => world.timelineIndex().root;++ // Node selection: filter Selected to scene nodes — geometries or groups+ // (excludes selected keyframes).+ const selection = useQuery([c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer, c.Keyframe)]);++ const selectedNodes = createMemo(() => {+ const nodes = selection().filter(eid =>+ hasComponent(world, eid, c.Geometry)+ || hasComponent(world, eid, c.Group)+ || hasComponent(world, eid, c.AdjustmentLayer));+ return new Set(nodes);+ });+ const selectedKeyframes = createMemo(() => {+ const keyframes = selection().filter(eid => hasComponent(world, eid, c.Keyframe));+ return new Set(keyframes);+ });++ const selectedTool = useWorldState(w => w.selection.tool, ToolType.HAND);+ const now = useEntityState(c.Computed.localTime, scene, 0);+ const playing = useEntityState(c.Playback.playing, scene, 0);+ const looping = useEntityState(c.Playback.loop, scene, 0);++ return (+ <ECSContext.Provider+ value={{+ selectedTool,+ selectedNodes,+ selectedKeyframes,+ playing,+ looping,+ now,+ }}>+ {props.children}+ </ECSContext.Provider>+ );+}++export function useECS() {+ const ctx = useContext(ECSContext);+ assert(ctx, 'useECS must be used within ECSProvider');+ return ctx;+}diff --git a/apps/web/src/context/electron/assets.ts b/apps/web/src/context/electron/assets.tsnew file mode 100644index 00000000..2ccc4c59--- /dev/null+++ b/apps/web/src/context/electron/assets.ts@@ -0,0 +1,433 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { ALL_FORMATS, BlobSource, CanvasSink, Input } from 'mediabunny';+import { ElectronFileHandle } from '@/lib/electron-file-handle';+import { ElectronWritableFileHandle } from '@/lib/electron-file-writable';+import { trpc } from '@/lib/trpc';+import { uploadBlob, visualizeAsset, loadAsset, removeAsset, saveAsset } from '@/components/engine';+import { assert, mimeTypeToExtension } from '@/utils';+import {+ transcodeForTranscription,+ transcodeForAnalysis,+ startResumableSession,+ uploadResumableStream,+ computeAudioSyncOffset,+ assetFolderId,+ moveAssetsToFolder,+ useFolders,+} from '@/components/engine';++import type { Engine } from "@/components/engine";+import type { Asset } from "@/components/engine/db";+import type { AssetAnalyzeRequest, AssetAnalyzeResult, AssetExportResult, AssetMoveResult, AssetProbeRequest, AssetsExportRequest, AssetSyncRequest, AssetSyncResult, AssetTranscriptResult, AssetTreeEntry, AssetVisualizeRequest, AssetVisualizeResult } from "@diffusionstudio/cli/channels";+import type { Accessor } from "solid-js";++export function handleAssetsAdd(engine: Accessor<Engine>) {+ return async ({ paths, folderId }: { paths: string[]; folderId?: string }) => {+ const { world } = engine();+ if (folderId !== undefined) {+ assert(world.folders.has(folderId), `Folder ${folderId} not found.`);+ }+ const settled = await Promise.allSettled(+ paths.map((path) => loadAsset(world, new ElectronFileHandle(path), { folderId }))+ );++ const results = settled.map((r, i) =>+ r.status === 'rejected'+ ? { status: "rejected", path: paths[i], error: (r.reason as Error)?.message ?? String(r.reason) }+ : { status: "fulfilled", ...r.value }+ );+ return results;+ }+}++export function handleAssetsList(engine: Accessor<Engine>) {+ return async ({ folderId, depth }: { folderId?: string; depth?: number }): Promise<AssetTreeEntry[]> => {+ const { world } = engine();+ if (folderId !== undefined) {+ assert(world.folders.has(folderId), `Folder ${folderId} not found.`);+ }++ const { childrenOf } = useFolders(world);+ const assets = Array.from(world.assets.values());++ // Visited set guards against parentId cycles in corrupt data.+ const visited = new Set<string>();+ const entries = (parentId: string | null, remaining: number | undefined): AssetTreeEntry[] => {+ const folderEntries = childrenOf(parentId)+ .filter((folder) => !visited.has(folder.id))+ .map((folder) => {+ visited.add(folder.id);+ const next = remaining === undefined ? undefined : remaining - 1;+ return {+ id: folder.id,+ name: folder.name,+ type: "folder",+ children: next === undefined || next > 0 ? entries(folder.id, next) : [],+ };+ });+ const assetEntries = assets+ .filter((asset) => assetFolderId(world, asset) === parentId)+ .map((asset) => ({ id: asset.id, name: asset.name, type: asset.type, children: [] }));+ return [...folderEntries, ...assetEntries];+ };++ return entries(folderId ?? null, depth);+ }+}++export function handleAssetsMove(engine: Accessor<Engine>) {+ return async ({ ids, to }: { ids: string[]; to?: string }): Promise<AssetMoveResult[]> => {+ const { world } = engine();+ if (to !== undefined) {+ assert(world.folders.has(to), `Folder ${to} not found.`);+ }+ const folderId = to ?? null;+ const results: AssetMoveResult[] = ids.map((id) =>+ world.assets.has(id)+ ? { status: "fulfilled", id, folderId }+ : { status: "rejected", id, error: "Not found" });+ const foundIds = results.filter((r) => r.status === "fulfilled").map((r) => r.id);+ if (foundIds.length > 0) await moveAssetsToFolder(world, foundIds, folderId);+ return results;+ }+}++export function handleAssetsDelete(engine: Accessor<Engine>) {+ return async ({ ids }: { ids: string[] }) => {+ const { world } = engine();+ const results = ids.map((id) => {+ const asset = world.assets.get(id);+ return asset+ ? { status: "fulfilled", id, name: asset.name }+ : { status: "rejected", id, error: "Not found" };+ });+ const foundIds = results.filter((r) => r.status === "fulfilled").map((r) => r.id);+ if (foundIds.length > 0) await removeAsset(world, ...foundIds);+ return results;+ }+}++export function handleAssetsExport(engine: Accessor<Engine>) {+ return async ({ ids, output, isDir }: AssetsExportRequest): Promise<AssetExportResult[]> => {+ const { world } = engine();+ const results: AssetExportResult[] = [];+ for (const id of ids) {+ try {+ const asset = world.assets.get(id);+ assert(asset, `Asset ${id} not found.`);+ assert(asset.type !== "SEQUENCE", `Asset ${id} is an image sequence; export is not supported.`);+ const blob = await asset.handle.getFile();+ const path = isDir+ ? await streamBlobToDir(blob, output, exportFileName(asset))+ : await streamBlobToFile(blob, output);+ results.push({ status: "fulfilled", id, path });+ } catch (e) {+ results.push({ status: "rejected", id, error: (e as Error)?.message ?? String(e) });+ }+ }+ return results;+ };+}++/**+ * Strips characters that are path separators or invalid on Windows+ */+function exportFileName(asset: Asset): string {+ // eslint-disable-next-line no-control-regex -- control chars are stripped deliberately+ const sanitized = asset.name.replace(/[\\/:*?"<>|\u0000-\u001f]/g, "_").trim();+ const name = sanitized || asset.id;+ return /\.[^.\s]{1,8}$/.test(name) ? name : name + mimeTypeToExtension(asset.mimeType);+}++const MAX_UNIQUIFY = 1000;++async function streamBlobToDir(blob: Blob, dir: string, fileName: string): Promise<string> {+ // Joining with "/" is safe on Windows too — node's fs accepts it.+ const base = dir.replace(/[\\/]+$/, "");+ const dot = fileName.lastIndexOf(".");+ const stem = dot > 0 ? fileName.slice(0, dot) : fileName;+ const ext = dot > 0 ? fileName.slice(dot) : "";+ for (let n = 0; n < MAX_UNIQUIFY; n++) {+ const path = `${base}/${n === 0 ? fileName : `${stem} (${n})${ext}`}`;+ const handle = new ElectronWritableFileHandle(path);+ let writable: WritableStream;+ try {+ writable = await handle.createWritable({ exclusive: true });+ } catch (e) {+ if (/EEXIST/.test((e as Error)?.message ?? "")) continue; // name taken — try the next suffix+ throw e;+ }+ await pumpBlob(blob, writable, handle);+ return path;+ }+ throw new Error(`Could not find a free file name for "${fileName}" in ${base}.`);+}++async function streamBlobToFile(blob: Blob, path: string): Promise<string> {+ const handle = new ElectronWritableFileHandle(path);+ await pumpBlob(blob, await handle.createWritable(), handle);+ return path;+}++/**+ * Streams the blob chunk-by-chunk to the open writable+ */+async function pumpBlob(+ blob: Blob,+ writable: WritableStream,+ handle: ElectronWritableFileHandle,+): Promise<void> {+ const writer = writable.getWriter();+ const reader = blob.stream().getReader();+ let position = 0;+ try {+ for (;;) {+ const { done, value } = await reader.read();+ if (done) break;+ await writer.write({ type: "write", data: value, position });+ position += value.byteLength;+ }+ await writer.close();+ } catch (e) {+ await handle.dispose().catch(() => {});+ throw e;+ }+}++const PROBE_SAMPLE_PACKETS = 200;++export function handleAssetProbe(engine: Accessor<Engine>) {+ return async ({ id }: AssetProbeRequest): Promise<unknown> => {+ const { world } = engine();+ const asset = world.assets.get(id);+ assert(asset, `Asset ${id} not found.`);++ const blob = await asset.handle.getFile();+ const base = {+ id,+ name: asset.name,+ type: asset.type,+ mimeType: asset.mimeType,+ size: blob.size,+ ...("width" in asset && { width: asset.width, height: asset.height }),+ };++ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });+ try {+ const format = await input.getFormat();+ const mimeType = await input.getMimeType();+ const duration = await input.computeDuration();+ const { images, ...tags } = await input.getMetadataTags();+ delete tags.raw;++ const tracks: Array<Record<string, unknown>> = [];+ for (const track of await input.getTracks()) {+ const stats = await track.computePacketStats(PROBE_SAMPLE_PACKETS);+ tracks.push({+ id: track.id,+ type: track.type,+ codec: track.codec,+ language: track.languageCode,+ firstTimestamp: await track.getFirstTimestamp(),+ duration: await track.computeDuration(),+ ...stats,+ ...(track.isVideoTrack() && {+ codedWidth: track.codedWidth,+ codedHeight: track.codedHeight,+ displayWidth: track.displayWidth,+ displayHeight: track.displayHeight,+ rotation: track.rotation,+ }),+ ...(track.isAudioTrack() && {+ sampleRate: track.sampleRate,+ channels: track.numberOfChannels,+ }),+ });+ }++ return {+ ...base,+ format: format.name,+ mimeType,+ duration,+ tags: { ...tags, ...(images?.length && { attachedImages: images.length }) },+ tracks,+ };+ } catch {+ return { ...base, format: null, tracks: [] };+ } finally {+ input.dispose();+ }+ };+}++export function handleAssetFrame(engine: Accessor<Engine>) {+ return async ({ id, times }: { id: string; times?: number[] }) => {+ const { world } = engine();+ const asset = world.assets.get(id);+ assert(asset, `Asset ${id} not found.`);+ assert(asset.type === "VIDEO", `Asset ${id} is not a video.`);++ const requested = times && times.length ? times : [0];+ for (const t of requested) {+ assert(t <= asset.duration, `--time ${t}s is past the asset's duration (${asset.duration.toFixed(2)}s).`);+ }++ const blob = await asset.handle.getFile();+ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(blob) });+ try {+ const track = await input.getPrimaryVideoTrack();+ assert(track, `Asset ${id} has no video track.`);++ // Track timestamps may not start at 0; offset content time by the first.+ const firstTimestamp = (await track.getFirstTimestamp()) ?? 0;++ // Decode in ascending order (the sink's fast path), remember each+ // entry's original slot so output mirrors the requested order.+ const ordered = requested.map((time, index) => ({ time, index })).sort((a, b) => a.time - b.time);++ // No pool: each yielded canvas is fresh, so converting to PNG can't race+ // the generator's read-ahead reusing a pooled canvas.+ const sink = new CanvasSink(track);+ const timestamps = ordered.map(({ time }) => firstTimestamp + time);++ const result: Array<{ time: number; base64: string }> = new Array(requested.length);+ let i = 0;+ for await (const wrapped of sink.canvasesAtTimestamps(timestamps)) {+ const { time, index } = ordered[i++];+ assert(wrapped, `No frame found at ${time}s.`);+ result[index] = { time, base64: await canvasToPngBase64(wrapped.canvas) };+ }+ return result;+ } finally {+ input.dispose();+ }+ };+}++export function handleAssetTranscript(engine: Accessor<Engine>) {+ return async ({ id }: { id: string }): Promise<AssetTranscriptResult> => {+ const { world } = engine();+ const asset = world.assets.get(id);+ assert(asset, `Asset ${id} not found.`);+ assert(+ asset.type === "AUDIO" || asset.type === "VIDEO",+ `Asset ${id} is not a video or audio asset.`,+ );++ if (asset.transcript) {+ return { id, segments: asset.transcript };+ }++ const uploadId = crypto.randomUUID();+ const audioFile = await transcodeForTranscription(asset);+ const fileRef = await uploadBlob(audioFile, uploadId);+ if (!fileRef) throw new Error(`Failed to upload asset ${id} for transcription.`);++ const { results: transcript } = await trpc.transcribe.mutate({ audio: fileRef });+ if (!transcript.length || transcript.every((s) => s.words.length === 0)) {+ throw new Error("No speech detected. The audio does not appear to contain recognizable speech.");+ }++ await saveAsset(world, { ...asset, transcript });++ return { id, segments: transcript };+ };+}++export function handleAssetSync(engine: Accessor<Engine>) {+ return async ({ audioId, videoId }: AssetSyncRequest): Promise<AssetSyncResult> => {+ const { world } = engine();+ const audio = world.assets.get(audioId);+ assert(audio, `Asset ${audioId} not found.`);+ const video = world.assets.get(videoId);+ assert(video, `Asset ${videoId} not found.`);+ assert(+ audio.type === "AUDIO" || audio.type === "VIDEO",+ `Asset ${audioId} is not an audio or video asset.`,+ );+ assert(+ video.type === "AUDIO" || video.type === "VIDEO",+ `Asset ${videoId} is not an audio or video asset.`,+ );++ const { offsetSeconds, confidence } = await computeAudioSyncOffset(audio, video);+ return { audioId, videoId, offsetSeconds, confidence };+ };+}++export function handleAssetVisualize(engine: Accessor<Engine>) {+ return async (req: AssetVisualizeRequest): Promise<AssetVisualizeResult> => {+ const { world } = engine();+ const asset = world.assets.get(req.id);+ assert(asset, `Asset ${req.id} not found.`);+ const { dataUrl, ...rest } = await visualizeAsset(asset, { start: req.start, end: req.end, scale: req.scale });+ const base64 = dataUrl.slice(dataUrl.indexOf(",") + 1);+ return { base64, ...rest };+ };+}++export function handleAssetAnalyze(engine: Accessor<Engine>) {+ return async ({ id, prompt, start, end }: AssetAnalyzeRequest): Promise<AssetAnalyzeResult> => {+ const { world } = engine();+ const asset = world.assets.get(id);+ assert(asset, `Asset ${id} not found.`);+ assert(+ asset.type === "IMAGE" || asset.type === "AUDIO" || asset.type === "VIDEO",+ `Asset ${id} is not an image, audio, or video asset.`,+ );++ const hasWindow = start !== undefined || end !== undefined;++ let contentType = asset.mimeType;+ if (asset.type === "VIDEO") {+ contentType = "video/mp4";+ } else if (asset.type === "AUDIO") {+ contentType = "audio/ogg";+ }++ const window = hasWindow ? `-${start ?? 0}-${end ?? "end"}` : "";+ const uploadId = `${world.projectId}-${asset.id}-analyze${window}`;+ const { uploadUrl, fileRef } = await trpc.getUploadUrl.mutate({+ action: "resumable",+ id: uploadId,+ contentType,+ });++ // Transcoding pending+ if (uploadUrl) {+ const transcoder = await transcodeForAnalysis(asset, { start, end });+ const sessionUrl = await startResumableSession(uploadUrl, contentType);+ const uploadPromise = uploadResumableStream(transcoder.readable, sessionUrl);+ await transcoder.run?.();+ await uploadPromise;+ }++ const { analysis } = await trpc.analyze.mutate({ media: fileRef, prompt });++ return { id, analysis, start, end };+ };+}++async function canvasToPngBase64(canvas: HTMLCanvasElement | OffscreenCanvas): Promise<string> {+ if (canvas instanceof OffscreenCanvas) {+ const blob = await canvas.convertToBlob({ type: "image/png" });+ return base64FromArrayBuffer(await blob.arrayBuffer());+ }+ return canvas.toDataURL("image/png").split(",")[1] ?? "";+}++function base64FromArrayBuffer(buf: ArrayBuffer): string {+ const bytes = new Uint8Array(buf);+ let binary = "";+ const chunk = 0x8000;+ for (let i = 0; i < bytes.length; i += chunk) {+ binary += String.fromCharCode(...bytes.subarray(i, i + chunk));+ }+ return btoa(binary);+}++// hmr-probe-testdiff --git a/apps/web/src/context/electron/context.ts b/apps/web/src/context/electron/context.tsnew file mode 100644index 00000000..aebff6ef--- /dev/null+++ b/apps/web/src/context/electron/context.ts@@ -0,0 +1,41 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { getProjectName } from "@/components/engine/db/global-db";+import { ChildOf } from "@/components/engine/components";+import { getAllEntities, hasComponent, Not, query } from "bitecs";++import type { Engine } from "@/components/engine";+import type { Accessor } from "solid-js";++export function handleContextGet(engine: Accessor<Engine>) {+ return async () => {+ const { world } = engine();+ const c = world.components;++ const sceneEids = [...query(world, [c.Geometry, c.Scene, Not(ChildOf('*')), Not(c.Deleted)])];+ const scenes = sceneEids.map((eid) => ({+ id: eid,+ name: c.Name[eid] ?? '',+ size: { width: c.Size.width[eid] ?? 0, height: c.Size.height[eid] ?? 0 },+ }));++ const entityCount = getAllEntities(world).filter((eid) => !hasComponent(world, eid, c.Deleted)).length;+ const activeSceneId = world.selection.scene !== null ? world.selection.scene : null;+ const currentFrame = activeSceneId !== null ? (c.Computed.localTime[activeSceneId] ?? 0) : 0;+ const fontFamilies = [...new Set(world.fonts.map((f) => f.family))];+ const projectId = world.projectId;+ const projectName = await getProjectName(projectId);++ return {+ projectId,+ projectName,+ entityCount,+ scenes,+ activeSceneId,+ currentFrame,+ fontFamilies,+ };+ }+}diff --git a/apps/web/src/context/electron/electron.tsx b/apps/web/src/context/electron/electron.tsxnew file mode 100644index 00000000..7b1ea12f--- /dev/null+++ b/apps/web/src/context/electron/electron.tsx@@ -0,0 +1,155 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createContext, useContext, onCleanup, createResource } from "solid-js";+import { useSearchParams } from "@solidjs/router";+import { useEngine } from '@/context/engine';+import { useAuth } from '@/context/auth';++import { cliBridge, mainBridge } from '@/lib/ipc';+import { CLI_CHANNELS } from '@diffusionstudio/cli/channels';+import { MAIN_CHANNELS } from '@desktop/main-channels';+import { assert } from "@/utils/common";+import { handleContextGet } from "./context";+import { handleAssetsAdd, handleAssetsList, handleAssetsDelete, handleAssetsMove, handleAssetsExport, handleAssetProbe, handleAssetFrame, handleAssetTranscript, handleAssetVisualize, handleAssetAnalyze, handleAssetSync } from "./assets";+import { handleFoldersList, handleFolderCreate, handleFolderRename, handleFoldersMove, handleFoldersDelete } from "./folders";+import { handleSelectionFocus, handleSelectionList, handleSelectionSet } from "./selection";+import { handleNodeList, handleNodeTree, handleNodeGrep, handleNodeScreenshot, handleNodeDelete, handleNodePatch, handleNodeDuplicate, handleNodeExport } from "./node";+import { handleMount, handleNodeInsert } from "./mount";+import { handleProjectActive, handleProjectList, handleProjectCreate, handleProjectDelete, handleProjectOpen } from "./project";+import { handleModels } from "./models";+import { handleVoices } from "./voices";+import { handleGetFullscreenState, handleWindowFullscreenChange } from "./window";++import type { JSX, Accessor } from 'solid-js';+++type ElectronProviderProps = {+ children: JSX.Element;+};++type ElectronContextValue = {+ isFullscreen: Accessor<boolean>;+ isDesktop: boolean;+};++const ElectronContext = createContext<ElectronContextValue>();++export function ElectronProvider(props: ElectronProviderProps) {+ const engine = useEngine();+ const auth = useAuth();+ const [, setParams] = useSearchParams();+ const [isFullscreen, { mutate }] = createResource(handleGetFullscreenState, { initialValue: false });++ const requireAuth = <Args extends unknown[], R>(fn: (...args: Args) => Promise<R>) => {+ return (...args: Args) => {+ assert(auth.isAuthenticated(), "Sign in required: AI generation needs a Diffusion Studio account.");++ return fn(...args);+ };+ };++ createEffect(() => {+ if (!window.desktop) return;++ const engineRef = () => engine;+ const unsubContext = cliBridge.handle(CLI_CHANNELS.CONTEXT, handleContextGet(engineRef));+ const unsubAssetsAdd = cliBridge.handle(CLI_CHANNELS.ASSETS_ADD, handleAssetsAdd(engineRef));+ const unsubAssetsList = cliBridge.handle(CLI_CHANNELS.ASSETS_LIST, handleAssetsList(engineRef));+ const unsubAssetsDelete = cliBridge.handle(CLI_CHANNELS.ASSETS_DELETE, handleAssetsDelete(engineRef));+ const unsubAssetsMove = cliBridge.handle(CLI_CHANNELS.ASSETS_MOVE, handleAssetsMove(engineRef));+ const unsubAssetsExport = cliBridge.handle(CLI_CHANNELS.ASSETS_EXPORT, handleAssetsExport(engineRef));+ const unsubFoldersList = cliBridge.handle(CLI_CHANNELS.FOLDERS_LIST, handleFoldersList(engineRef));+ const unsubFolderCreate = cliBridge.handle(CLI_CHANNELS.FOLDER_CREATE, handleFolderCreate(engineRef));+ const unsubFolderRename = cliBridge.handle(CLI_CHANNELS.FOLDER_RENAME, handleFolderRename(engineRef));+ const unsubFoldersMove = cliBridge.handle(CLI_CHANNELS.FOLDERS_MOVE, handleFoldersMove(engineRef));+ const unsubFoldersDelete = cliBridge.handle(CLI_CHANNELS.FOLDERS_DELETE, handleFoldersDelete(engineRef));+ const unsubAssetProbe = cliBridge.handle(CLI_CHANNELS.ASSET_PROBE, handleAssetProbe(engineRef));+ const unsubAssetFrame = cliBridge.handle(CLI_CHANNELS.ASSET_FRAME, handleAssetFrame(engineRef));+ const unsubAssetTranscript = cliBridge.handle(CLI_CHANNELS.ASSET_TRANSCRIPT, handleAssetTranscript(engineRef));+ const unsubAssetVisualize = cliBridge.handle(CLI_CHANNELS.ASSET_VISUALIZE, handleAssetVisualize(engineRef));+ const unsubAssetAnalyze = cliBridge.handle(CLI_CHANNELS.ASSET_ANALYZE, requireAuth(handleAssetAnalyze(engineRef)));+ const unsubAssetSync = cliBridge.handle(CLI_CHANNELS.ASSET_SYNC, handleAssetSync(engineRef));+ const unsubSelectionList = cliBridge.handle(CLI_CHANNELS.SELECTION_LIST, handleSelectionList(engineRef));+ const unsubSelectionSet = cliBridge.handle(CLI_CHANNELS.SELECTION_SET, handleSelectionSet(engineRef));+ const unsubSelectionFocus = cliBridge.handle(CLI_CHANNELS.SELECTION_FOCUS, handleSelectionFocus(engineRef));+ const unsubNodeList = cliBridge.handle(CLI_CHANNELS.NODE_LIST, handleNodeList(engineRef));+ const unsubNodeTree = cliBridge.handle(CLI_CHANNELS.NODE_TREE, handleNodeTree(engineRef));+ const unsubNodeGrep = cliBridge.handle(CLI_CHANNELS.NODE_GREP, handleNodeGrep(engineRef));+ const unsubNodeScreenshot = cliBridge.handle(CLI_CHANNELS.NODE_SCREENSHOT, handleNodeScreenshot(engineRef));+ const unsubMount = cliBridge.handle(CLI_CHANNELS.MOUNT, handleMount(engineRef));+ const unsubNodeInsert = cliBridge.handle(CLI_CHANNELS.NODE_INSERT, handleNodeInsert(engineRef));+ const unsubNodeDelete = cliBridge.handle(CLI_CHANNELS.NODE_DELETE, handleNodeDelete(engineRef));+ const unsubNodePatch = cliBridge.handle(CLI_CHANNELS.NODE_PATCH, handleNodePatch(engineRef));+ const unsubNodeDuplicate = cliBridge.handle(CLI_CHANNELS.NODE_DUPLICATE, handleNodeDuplicate(engineRef));+ const unsubNodeExport = cliBridge.handle(CLI_CHANNELS.NODE_EXPORT, handleNodeExport(engineRef));+ const unsubProjectActive = cliBridge.handle(CLI_CHANNELS.PROJECT_ACTIVE, handleProjectActive(engineRef));+ const unsubProjectList = cliBridge.handle(CLI_CHANNELS.PROJECT_LIST, handleProjectList());+ const unsubProjectCreate = cliBridge.handle(CLI_CHANNELS.PROJECT_CREATE, handleProjectCreate(engineRef, setParams));+ const unsubProjectDelete = cliBridge.handle(CLI_CHANNELS.PROJECT_DELETE, handleProjectDelete(engineRef, setParams));+ const unsubProjectOpen = cliBridge.handle(CLI_CHANNELS.PROJECT_OPEN, handleProjectOpen(engineRef, setParams));+ const unsubModels = cliBridge.handle(CLI_CHANNELS.MODELS, handleModels());+ const unsubVoices = cliBridge.handle(CLI_CHANNELS.VOICES, handleVoices());+ const unsubScreenChange = mainBridge.handle(MAIN_CHANNELS.WINDOW_FULLSCREEN_CHANGE, handleWindowFullscreenChange(mutate));++ onCleanup(() => {+ unsubContext();+ unsubAssetsAdd();+ unsubAssetsList();+ unsubAssetsDelete();+ unsubAssetsMove();+ unsubAssetsExport();+ unsubFoldersList();+ unsubFolderCreate();+ unsubFolderRename();+ unsubFoldersMove();+ unsubFoldersDelete();+ unsubAssetProbe();+ unsubAssetFrame();+ unsubAssetTranscript();+ unsubAssetVisualize();+ unsubAssetAnalyze();+ unsubAssetSync();+ unsubSelectionList();+ unsubSelectionSet();+ unsubSelectionFocus();+ unsubNodeList();+ unsubNodeTree();+ unsubNodeGrep();+ unsubNodeScreenshot();+ unsubMount();+ unsubNodeInsert();+ unsubNodeDelete();+ unsubNodePatch();+ unsubNodeDuplicate();+ unsubNodeExport();+ unsubProjectActive();+ unsubProjectList();+ unsubProjectCreate();+ unsubProjectDelete();+ unsubProjectOpen();+ unsubModels();+ unsubVoices();+ unsubScreenChange();+ });+ });++ return (+ <ElectronContext.Provider+ value={{+ isFullscreen,+ isDesktop: !!window.desktop,+ }}+ >+ {props.children}+ </ElectronContext.Provider>+ );+}+++export function useElectron() {+ const ctx = useContext(ElectronContext);+ assert(ctx, "useElectron must be used within ElectronProvider");+ return ctx;+}diff --git a/apps/web/src/context/electron/folders.ts b/apps/web/src/context/electron/folders.tsnew file mode 100644index 00000000..268c1083--- /dev/null+++ b/apps/web/src/context/electron/folders.ts@@ -0,0 +1,90 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { assert } from '@/utils';+import {+ createFolder,+ deleteFolder,+ moveFolder,+ renameFolder,+ useFolders,+} from '@/components/engine';++import type { Engine } from "@/components/engine";+import type { FolderDeleteResult, FolderInfo, FolderMoveResult } from "@diffusionstudio/cli/channels";+import type { Accessor } from "solid-js";++const toWire = (folder: { id: string; name: string }): FolderInfo => ({+ id: folder.id,+ name: folder.name,+ type: "folder",+});++export function handleFoldersList(engine: Accessor<Engine>) {+ return async ({ parentId }: { parentId?: string }): Promise<FolderInfo[]> => {+ const { world } = engine();+ if (parentId !== undefined) {+ assert(world.folders.has(parentId), `Folder ${parentId} not found.`);+ }+ return useFolders(world).childrenOf(parentId ?? null).map(toWire);+ }+}++export function handleFolderCreate(engine: Accessor<Engine>) {+ return async ({ name, parentId }: { name: string; parentId?: string }): Promise<FolderInfo> => {+ const { world } = engine();+ if (parentId !== undefined) {+ assert(world.folders.has(parentId), `Folder ${parentId} not found.`);+ }+ const folder = await createFolder(world, name, parentId ?? null);+ return toWire(folder);+ }+}++export function handleFolderRename(engine: Accessor<Engine>) {+ return async ({ id, name }: { id: string; name: string }): Promise<FolderInfo> => {+ const { world } = engine();+ assert(world.folders.has(id), `Folder ${id} not found.`);+ await renameFolder(world, id, name);+ return toWire(world.folders.get(id)!);+ }+}++export function handleFoldersMove(engine: Accessor<Engine>) {+ return async ({ ids, to }: { ids: string[]; to?: string }): Promise<FolderMoveResult[]> => {+ const { world } = engine();+ if (to !== undefined) {+ assert(world.folders.has(to), `Folder ${to} not found.`);+ }+ const parentId = to ?? null;+ const results: FolderMoveResult[] = [];+ for (const id of ids) {+ if (!world.folders.has(id)) {+ results.push({ status: "rejected", id, error: "Not found" });+ continue;+ }+ const moved = await moveFolder(world, id, parentId);+ results.push(moved+ ? { status: "fulfilled", id, parentId }+ : { status: "rejected", id, error: "Cannot move a folder into itself or one of its descendants" });+ }+ return results;+ }+}++export function handleFoldersDelete(engine: Accessor<Engine>) {+ return async ({ ids }: { ids: string[] }): Promise<FolderDeleteResult[]> => {+ const { world } = engine();+ const results: FolderDeleteResult[] = [];+ for (const id of ids) {+ if (!world.folders.has(id)) {+ results.push({ status: "rejected", id, error: "Not found" });+ continue;+ }+ const { deletedFolders, deletedAssets } = await deleteFolder(world, id);+ results.push({ status: "fulfilled", id, deletedFolders, deletedAssets });+ }+ return results;+ }+}diff --git a/apps/web/src/context/electron/index.ts b/apps/web/src/context/electron/index.tsnew file mode 100644index 00000000..44cc87d1--- /dev/null+++ b/apps/web/src/context/electron/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './electron';diff --git a/apps/web/src/context/electron/models.ts b/apps/web/src/context/electron/models.tsnew file mode 100644index 00000000..9a63257e--- /dev/null+++ b/apps/web/src/context/electron/models.ts@@ -0,0 +1,47 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import {+ PROMPT_INPUT_IMAGE_MODEL_OPTIONS,+ PROMPT_INPUT_VIDEO_MODEL_OPTIONS,+ PROMPT_INPUT_AUDIO_MODEL_OPTIONS,+} from "@/components/genai/config";+import type { ModelsRequest, ModelInfo } from "@diffusionstudio/cli/channels";++export function handleModels() {+ return async (req: ModelsRequest) => {+ const out: ModelInfo[] = [];+ if (!req.type || req.type === "image") {+ for (const option of PROMPT_INPUT_IMAGE_MODEL_OPTIONS) {+ out.push({+ type: "image",+ id: option.id,+ name: option.name,+ });+ }+ }+ if (!req.type || req.type === "video") {+ for (const option of PROMPT_INPUT_VIDEO_MODEL_OPTIONS) {+ out.push({+ type: "video",+ id: option.id,+ name: option.name,+ durations: option.durations,+ aspectRatios: option.aspectRatios,+ features: option.features,+ });+ }+ }+ if (!req.type || req.type === "audio") {+ for (const option of PROMPT_INPUT_AUDIO_MODEL_OPTIONS) {+ out.push({+ type: "audio",+ id: option.id,+ name: option.name,+ });+ }+ }+ return out;+ };+}diff --git a/apps/web/src/context/electron/mount.ts b/apps/web/src/context/electron/mount.tsnew file mode 100644index 00000000..401b9cf8--- /dev/null+++ b/apps/web/src/context/electron/mount.ts@@ -0,0 +1,93 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { renderProject } from "@diffusionstudio/jsx";++import { reorderEntity, switchActiveScene } from "@/components/engine";+import { WorldDocument, importProjectModule } from "@/utils/jsx";+import { assert } from "@/utils";+import { resolveEntityEid } from "./node";+import { hasComponent } from "bitecs";++import type { Accessor } from "solid-js";+import type { MountRequest, NodeInsertRequest } from "@diffusionstudio/cli/channels";+import type { Engine } from "@/components/engine";++/**+ * `dapi mount` — evaluates a compiled project module and renders it directly into the ECS world+ */+export function handleMount(engine: Accessor<Engine>) {+ return async ({ code }: MountRequest): Promise<void> => {+ const e = engine();+ const world = e.world;+ const c = world.components;++ // Evaluate — top-level code (including top-level await) runs here.+ const module = await importProjectModule(code);+ const project = module.default as () => unknown;+ assert(typeof project === "function", "The project module must default-export a Solid component");++ const document = new WorldDocument(e);++ try {+ world.history.startTransaction("Render project");+ renderProject(project, document);+ world.history.commitTransaction();+ } catch (error) {+ world.history.rollbackTransaction();+ throw error;+ }++ try {+ world.history.startTransaction("Commit document");+ await document.commit();+ } finally {+ world.history.commitTransaction();+ }++ if (document.rootEid && hasComponent(world, document.rootEid, c.Scene)) {+ switchActiveScene(world, document.rootEid);+ }+ };+}++/**+ * `dapi node insert` — the mount pipeline, but rendered into an existing+ * parent entity instead of the document: roots take no key, nothing is+ * reconciled or deleted, every run inserts fresh entities. The parent may be+ * any live entity that takes children — a node, or a gradient paint for+ * `<colorStop>` roots.+ */+export function handleNodeInsert(engine: Accessor<Engine>) {+ return async ({ code, parentId, index }: NodeInsertRequest): Promise<void> => {+ const e = engine();+ const world = e.world;++ const parentEid = resolveEntityEid(world, parentId);+ const module = await importProjectModule(code);+ const project = module.default as () => unknown;+ assert(typeof project === "function", "The project module must default-export a Solid component");++ const document = new WorldDocument(e, { parentEid });++ try {+ world.history.startTransaction("Insert nodes");+ renderProject(project, document);+ if (index !== undefined && document.rootEid !== null) {+ reorderEntity(world, document.rootEid, index);+ }+ world.history.commitTransaction();+ } catch (error) {+ world.history.rollbackTransaction();+ throw error;+ }++ try {+ world.history.startTransaction("Commit document");+ await document.commit();+ } finally {+ world.history.commitTransaction();+ }+ };+}diff --git a/apps/web/src/context/electron/node.ts b/apps/web/src/context/electron/node.tsnew file mode 100644index 00000000..52f96db4--- /dev/null+++ b/apps/web/src/context/electron/node.ts@@ -0,0 +1,508 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { entityExists, hasComponent, query, Not, Or } from "bitecs";+import { PATCH_PROP_KEYS } from "@diffusionstudio/jsx";++import { createEncoder } from "@/components/engine/encode/encoder";+import { ElectronWritableFileHandle } from "@/lib/electron-file-writable";++import {+ deleteEntity,+ addComponent,+ removeComponent,+ getParentEntity,+ isText,+ isScene,+ switchActiveScene,+ getEntityTree,+ cloneSubtree,+ serializeEntity,+} from "@/components/engine";+import { ChildOf } from "@/components/engine/components";+import { WorldDocument } from "@/utils/jsx";+import { entityType } from "./selection";++import type { EngineWorld, Engine } from "@/components/engine";+import type {+ EntityRecord,+ NodeDeleteResult,+ NodeDuplicateResult,+ NodeGrepMatch,+ NodeGrepRequest,+ NodeGrepResult,+ NodeListResult,+ NodePatch,+ NodePatchResult,+ NodeRef,+ NodeTree,+ NodeExportRequest,+ NodeExportResult,+} from "@diffusionstudio/cli/channels";+import type { EncoderConfig } from "@/components/engine/encode/interfaces";+import type { Accessor } from "solid-js";++// Scenes are nodes too, so node ops accept them alongside geometry, groups,+// and adjustment layers.+export function isNode(world: EngineWorld, eid: number): boolean {+ const c = world.components;+ return (+ hasComponent(world, eid, c.Geometry) ||+ hasComponent(world, eid, c.Group) ||+ hasComponent(world, eid, c.AdjustmentLayer) ||+ hasComponent(world, eid, c.Scene)+ );+}++// Any live entity — `ls`, `tree`, `rm`, `patch`, and `insert` also target+// paints and color stops, which are sub-entities rather than nodes.+export function resolveEntityEid(world: EngineWorld, eid: number): number {+ if (+ !Number.isInteger(eid) ||+ !entityExists(world, eid) ||+ hasComponent(world, eid, world.components.Deleted)+ ) {+ throw new Error(`No such entity: ${eid}`);+ }+ return eid;+}++export function resolveNodeEid(world: EngineWorld, eid: number): number {+ resolveEntityEid(world, eid);+ if (!isNode(world, eid)) {+ throw new Error(`No such node: ${eid}`);+ }+ return eid;+}++export function handleNodeList(engine: Accessor<Engine>) {+ return async ({ ids }: { ids?: number[] }): Promise<NodeListResult[]> => {+ const { world } = engine();+ const c = world.components;++ // No ids → the root: top-level nodes+ if (ids === undefined || ids.length === 0) {+ const roots = [...query(world, [c.Geometry, Not(ChildOf("*")), Not(c.Deleted)])];+ return roots.map((eid) => ({+ status: "fulfilled",+ node: serializeEntity(world, eid) as EntityRecord,+ }));+ }++ return ids.map((id) => {+ try {+ return {+ status: "fulfilled",+ node: serializeEntity(world, resolveEntityEid(world, id)) as EntityRecord,+ };+ } catch (e) {+ return { status: "rejected", id, error: (e as Error).message };+ }+ });+ };+}++/**+ * Key characteristics of an entity, from whatever components it carries —+ * e.g. "hidden; size: 200x300; text: Hello World". Times print as seconds.+ */+function describeEntity(world: EngineWorld, eid: number): string {+ const c = world.components;+ const parts: string[] = [];+ const fmtTime = (frames: number) => `${Math.round((frames / world.frameRate) * 100) / 100}s`;+ const hex = (packed: number) => `#${((packed >>> 0) & 0xffffff).toString(16).padStart(6, "0")}`;++ if (hasComponent(world, eid, c.Hidden)) parts.push("hidden");+ if (hasComponent(world, eid, c.Size)) {+ parts.push(`size: ${c.Size.width[eid] ?? 0}x${c.Size.height[eid] ?? 0}`);+ }+ if (hasComponent(world, eid, c.Position)) {+ const x = c.Position.x[eid] ?? 0;+ const y = c.Position.y[eid] ?? 0;+ if (x !== 0 || y !== 0) parts.push(`pos: ${x},${y}`);+ }+ if (hasComponent(world, eid, c.Rotation) && c.Rotation[eid]) {+ parts.push(`rotation: ${c.Rotation[eid]}°`);+ }+ if (hasComponent(world, eid, c.CornerRadius) && c.CornerRadius[eid]) {+ parts.push(`cornerRadius: ${c.CornerRadius[eid]}`);+ }+ if (hasComponent(world, eid, c.Appearance)) {+ const opacity = c.Appearance.opacity[eid];+ if (opacity !== undefined && opacity !== 1) parts.push(`opacity: ${opacity}`);+ }+ const delay = hasComponent(world, eid, c.Delay) ? c.Delay[eid] ?? 0 : 0;+ if (delay !== 0) parts.push(`start: ${fmtTime(delay)}`);+ if (hasComponent(world, eid, c.Trim)) {+ const start = c.Trim.start[eid];+ const end = c.Trim.end[eid];+ if (start !== undefined) parts.push(`in: ${fmtTime(start + delay)}`);+ if (end !== undefined) parts.push(`out: ${fmtTime(end + delay)}`);+ }+ if (hasComponent(world, eid, c.Volume)) {+ const db = c.Volume[eid] ?? 0;+ parts.push(`volume: ${db === -Infinity ? 0 : Math.round(10 ** (db / 20) * 100) / 100}`);+ }+ if (hasComponent(world, eid, c.AssetId)) parts.push(`asset: ${c.AssetId[eid]}`);+ if (hasComponent(world, eid, c.TextStyle)) {+ const family = c.TextStyle.fontFamily[eid];+ const size = c.TextStyle.fontSize[eid];+ const font = [family, size !== undefined ? `${size}px` : undefined].filter(Boolean).join(" ");+ if (font) parts.push(`font: ${font}`);+ }+ if (hasComponent(world, eid, c.Color)) parts.push(`color: ${hex(c.Color[eid] ?? 0)}`);+ if (hasComponent(world, eid, c.ColorStop)) {+ const offset = c.ColorStop.offset[eid];+ const color = c.ColorStop.color[eid];+ const opacity = c.ColorStop.opacity[eid];+ if (offset !== undefined) parts.push(`offset: ${offset}`);+ if (color !== undefined) parts.push(`color: ${hex(color)}`);+ if (opacity !== undefined && opacity !== 1) parts.push(`opacity: ${opacity}`);+ }+ if (hasComponent(world, eid, c.StrokeStyle) && c.StrokeStyle.width[eid] !== undefined) {+ parts.push(`width: ${c.StrokeStyle.width[eid]}`);+ }+ if (hasComponent(world, eid, c.KeyframeTrack)) {+ parts.push(`property: ${c.KeyframeTrack.property[eid]}`);+ }+ if (hasComponent(world, eid, c.Keyframe)) {+ parts.push(`time: ${fmtTime(c.Keyframe.time[eid] ?? 0)}`, `value: ${c.Keyframe.value[eid]}`);+ if (c.Keyframe.easing[eid]) parts.push(`easing: ${c.Keyframe.easing[eid]}`);+ }+ if (hasComponent(world, eid, c.TextRange)) {+ parts.push(`range: ${c.TextRange.start[eid] ?? 0}–${c.TextRange.end[eid] ?? "end"}`);+ }+ if (isText(world, eid)) {+ const text = c.Chars[eid] ?? "";+ parts.push(`text: ${text.length > 80 ? `${text.slice(0, 79)}…` : text}`);+ }++ return parts.join("; ");+}++type TreeBucket = keyof Omit<NodeTree, keyof NodeRef | "description">;++// First match wins: masks carry IsMask + Geometry, shadows carry Shadow + Effect.+function childBucket(world: EngineWorld, eid: number): TreeBucket | null {+ const c = world.components;+ if (hasComponent(world, eid, c.IsMask)) return "masks";+ if (isNode(world, eid)) return "children";+ if (hasComponent(world, eid, c.ColorStop)) return "colorStops";+ if (hasComponent(world, eid, c.Paint)) return "paints";+ if (hasComponent(world, eid, c.Stroke)) return "strokes";+ if (hasComponent(world, eid, c.Shadow)) return "shadows";+ if (hasComponent(world, eid, c.Effect)) return "effects";+ if (hasComponent(world, eid, c.TextRange)) return "textRanges";+ if (hasComponent(world, eid, c.KeyframeTrack)) return "keyframeTracks";+ if (hasComponent(world, eid, c.Keyframe)) return "keyframes";+ if (hasComponent(world, eid, c.Animation)) return "animations";+ return null;+}++export function handleNodeTree(engine: Accessor<Engine>) {+ return async ({ id, depth }: { id?: number; depth?: number }): Promise<NodeTree[]> => {+ const { world } = engine();+ const c = world.components;++ // depth caps how many levels of descendants to descend into; the root is+ // level 0, so --depth 1 yields the root plus its immediate children.+ const build = (eid: number, level: number): NodeTree => {+ const node: NodeTree = {+ id: eid,+ name: c.Name[eid] ?? "",+ type: entityType(world, eid),+ description: describeEntity(world, eid),+ };+ if (depth !== undefined && level + 1 > depth) return node;+ for (const cid of query(world, [ChildOf(eid), Not(c.Deleted)])) {+ const bucket = childBucket(world, cid);+ if (bucket === null) continue;+ (node[bucket] ??= []).push(build(cid, level + 1));+ }+ return node;+ };++ if (id === undefined) {+ const roots = [...query(world, [c.Geometry, Not(ChildOf("*")), Not(c.Deleted)])];+ return roots.map((eid) => build(eid, 0));+ }++ return [build(resolveEntityEid(world, id), 0)];+ };+}++export function handleNodeGrep(engine: Accessor<Engine>) {+ return async ({+ pattern,+ ignoreCase,+ id,+ types,+ components,+ }: NodeGrepRequest): Promise<NodeGrepResult[]> => {+ const { world } = engine();+ const c = world.components;+ const re = new RegExp(pattern, ignoreCase ? "i" : "");++ // The corpus: the given entity's subtree, or every live entity.+ const eids =+ id !== undefined+ ? getEntityTree(world, resolveEntityEid(world, id))+ : [...query(world, [c.Geometry, Not(ChildOf("*")), Not(c.Deleted)])].flatMap((root) =>+ getEntityTree(world, root),+ );++ const results: NodeGrepResult[] = [];+ for (const eid of eids) {+ const type = entityType(world, eid);+ if (types !== undefined && types.length > 0 && !types.includes(type)) continue;++ const record = serializeEntity(world, eid);+ const matches: NodeGrepMatch[] = [];+ for (const [component, value] of Object.entries(record)) {+ if (component === "id" || component === "eid") continue;+ if (components !== undefined && components.length > 0 && !components.includes(component)) {+ continue;+ }+ const text = typeof value === "string" ? value : JSON.stringify(value);+ if (re.test(text)) matches.push({ component, value: text });+ }+ if (matches.length > 0) {+ results.push({ id: eid, name: c.Name[eid] ?? "", type, matches });+ }+ }+ return results;+ };+}++// Walk up from a node to the scene that owns it (a scene resolves to itself).+function sceneOfNode(world: EngineWorld, eid: number): number | null {+ let cur: number | null = eid;+ while (cur !== null) {+ if (isScene(world, cur)) return cur;+ cur = getParentEntity(world, cur);+ }+ return null;+}++export function handleNodeScreenshot(engine: Accessor<Engine>) {+ return async ({ id, frame }: { id?: number; frame?: number }): Promise<{ base64: string }> => {+ const e = engine();+ const w = e.world;+ const c = w.components;++ const eid = id !== undefined ? resolveNodeEid(w, id) : undefined;++ // Capture in the node's own scene so its timeline frame is meaningful.+ const sceneEid = eid !== undefined ? sceneOfNode(w, eid) : w.selection.scene;+ if (sceneEid !== null && sceneEid !== w.selection.scene) {+ switchActiveScene(w, sceneEid);+ }++ if (frame !== undefined && sceneEid !== null) {+ c.Playback.playing[sceneEid] = 0;+ c.Computed.localTime[sceneEid] = frame;+ c.Computed.localTimeInSeconds[sceneEid] = frame / w.frameRate;+ }++ // Select the captured node so the screenshot shows its bounds.+ if (eid !== undefined) {+ for (const sel of query(w, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer)])) {+ removeComponent(w, sel, c.Selected, false);+ }+ addComponent(w, eid, c.Selected, false);+ }++ if (eid !== undefined) {+ if (isScene(w, eid)) e.camera.fitToActiveScene();+ else e.camera.focusEntities([eid]);+ }++ // Realtime decoder seeks are fire-and-forget — give video paints time to+ // decode the new frame before capturing.+ await new Promise((resolve) => setTimeout(resolve, 2000));++ const canvas = w.canvas;+ if (!(canvas instanceof HTMLCanvasElement)) {+ throw new Error("Canvas is not ready");+ }+ const base64 = canvas.toDataURL("image/png").split(",")[1] ?? "";+ return { base64 };+ };+}++export function handleNodeExport(engine: Accessor<Engine>) {+ return async ({ id, output, config }: NodeExportRequest): Promise<NodeExportResult> => {+ const e = engine();+ const w = e.world;++ const sceneEid = id ?? w.selection.scene;+ if (sceneEid === null || sceneEid === undefined) {+ throw new Error("No active scene. Provide a scene id, or open a scene first.");+ }+ if (!entityExists(w, sceneEid) || !isScene(w, sceneEid)) {+ throw new Error(`Node ${sceneEid} is not a scene.`);+ }++ const target = new ElectronWritableFileHandle(output);+ e.stop();+ let result;+ try {+ const encoder = await createEncoder(w, {+ ...(config as Partial<EncoderConfig>),+ scene: sceneEid,+ target,+ });+ result = await encoder.render();+ } finally {+ e.start();+ }++ if (result.type !== "success") {+ // Clean up the partial file on cancel / error.+ await target.dispose().catch(() => { });+ if (result.type === "canceled") throw new Error("Export canceled");+ throw new Error(result.error?.message || "Export failed");+ }++ return { path: output };+ };+}++export function handleNodeDelete(engine: Accessor<Engine>) {+ return async ({ ids }: { ids: number[] }): Promise<NodeDeleteResult[]> => {+ const { world } = engine();+ const resolved = ids.map((id) => {+ try {+ return { id, eid: resolveEntityEid(world, id) };+ } catch (e) {+ return { id, error: (e as Error).message };+ }+ });++ const toDelete = resolved.filter((r): r is { id: number; eid: number } => "eid" in r);+ world.history.transaction("deleting nodes", () => {+ for (const { eid } of toDelete) {+ deleteEntity(world, eid);+ }+ });++ return resolved.map((r) =>+ "eid" in r+ ? { status: "fulfilled", id: r.id }+ : { status: "rejected", id: r.id, error: r.error },+ );+ };+}++export function handleNodeDuplicate(engine: Accessor<Engine>) {+ return async ({ ids }: { ids: number[] }): Promise<NodeDuplicateResult[]> => {+ const { world } = engine();+ const resolved = ids.map((id) => {+ try {+ const eid = resolveNodeEid(world, id);+ return { id, tree: getEntityTree(world, eid) };+ } catch (e) {+ return { id, error: (e as Error).message };+ }+ });++ const toClone = resolved.filter(+ (r): r is { id: number; tree: number[] } => "tree" in r,+ );++ const newRootEids = new Map<number, number>();+ if (toClone.length > 0) {+ world.history.transaction("duplicating nodes", () => {+ for (const { id, tree } of toClone) {+ newRootEids.set(id, cloneSubtree(world, tree).get(id)!);+ }+ });+ }++ return resolved.map((r) =>+ "tree" in r+ ? { status: "fulfilled", sourceId: r.id, newId: newRootEids.get(r.id)! }+ : { status: "rejected", sourceId: r.id, error: r.error },+ );+ };+}++const PATCH_KEYS: ReadonlySet<string> = new Set(PATCH_PROP_KEYS);++export function handleNodePatch(engine: Accessor<Engine>) {+ return async ({ patches }: { patches: NodePatch[] }): Promise<NodePatchResult[]> => {+ const e = engine();+ const world = e.world;+ const doc = new WorldDocument(e);++ // `src` mounts asynchronously and can't be rolled back, so a dry run only+ // performs its synchronous checks.+ const applyPatch = (eid: number, patch: NodePatch, dryRun: boolean) => {+ const node = doc.element(eid);+ for (const [key, value] of Object.entries(patch)) {+ if (key === "id") continue;+ if (!PATCH_KEYS.has(key)) throw new Error(`Unsupported property: ${key}`);+ if (dryRun && key === "src") {+ if (typeof value !== "string" || value.trim().length === 0)+ throw new Error("`src` must be a non-empty string");+ continue;+ }+ doc.setProperty(node, key, value);+ }+ };++ const resolved = patches.map((patch) => {+ try {+ const eid = resolveEntityEid(world, patch.id);+ world.history.startTransaction("vetting patch");+ try {+ applyPatch(eid, patch, true);+ } finally {+ world.history.rollbackTransaction();+ }+ return { patch, eid, promises: [] as Promise<void>[] };+ } catch (err) {+ return { patch, error: (err as Error).message };+ }+ });++ const toApply = resolved.filter(+ (r): r is { patch: NodePatch; eid: number; promises: Promise<void>[] } => "eid" in r,+ );+ if (toApply.length > 0) {+ world.history.transaction("patching nodes", () => {+ for (const entry of toApply) {+ const before = doc.promises.length;+ applyPatch(entry.eid, entry.patch, false);+ entry.promises = doc.promises.slice(before);+ }+ });+ }++ // Await async source mounts per patch so a failed `src` rejects the right+ // node; its synchronous props are applied at this point regardless.+ const srcErrors = new Map<NodePatch, string>();+ if (toApply.some((entry) => entry.promises.length > 0)) {+ world.history.startTransaction("Commit document");+ try {+ await Promise.all(toApply.map(async (entry) => {+ const settled = await Promise.allSettled(entry.promises);+ const failed = settled.find((s): s is PromiseRejectedResult => s.status === "rejected");+ if (failed === undefined) return;+ const reason = failed.reason;+ srcErrors.set(entry.patch, reason instanceof Error ? reason.message : String(reason));+ }));+ } finally {+ world.history.commitTransaction();+ }+ }++ return resolved.map((r) => {+ if (!("eid" in r)) return { status: "rejected", id: r.patch.id, error: r.error };+ const srcError = srcErrors.get(r.patch);+ if (srcError !== undefined) return { status: "rejected", id: r.patch.id, error: srcError };+ return { status: "fulfilled", id: r.patch.id };+ });+ };+}diff --git a/apps/web/src/context/electron/project.ts b/apps/web/src/context/electron/project.tsnew file mode 100644index 00000000..4712075c--- /dev/null+++ b/apps/web/src/context/electron/project.ts@@ -0,0 +1,63 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { Engine } from "@/components/engine";+import type { Accessor } from "solid-js";++import { createProject, deleteProject, getProject, getProjectName, listRecentProjects, DEFAULT_PROJECT_ID } from "@/components/engine/db";+import { useSearchParams } from "@solidjs/router";++export function handleProjectActive(engine: Accessor<Engine>) {+ return async () => {+ const { world } = engine();+ const id = world.projectId;+ if (!id || id === DEFAULT_PROJECT_ID) return null;+ const name = await getProjectName(id);+ return { id, name };+ }+}++export function handleProjectList() {+ return async () => {+ const entries = await listRecentProjects(Number.MAX_SAFE_INTEGER);+ return entries.map(({ id, name, createdAt, lastAccessedAt }) => ({+ id,+ name,+ createdAt,+ lastAccessedAt,+ }));+ }+}++export function handleProjectCreate(_engine: Accessor<Engine>, setParams: ReturnType<typeof useSearchParams>[1]) {+ return async ({ name }: { name?: string }) => {+ const entry = await createProject(name);+ setParams({ project: entry.id, dashboard: undefined }, { replace: true });+ return { id: entry.id, name: entry.name };+ }+}++export function handleProjectDelete(engine: Accessor<Engine>, setParams: ReturnType<typeof useSearchParams>[1]) {+ return async ({ id }: { id: string }) => {+ const { world } = engine();+ if (id === DEFAULT_PROJECT_ID) {+ throw new Error("Cannot delete the default project");+ }+ const name = await getProjectName(id);+ await deleteProject(id);+ if (world.projectId === id) {+ setParams({ project: undefined, dashboard: "projects" }, { replace: true });+ }+ return { id, name };+ }+}++export function handleProjectOpen(_engine: Accessor<Engine>, setParams: ReturnType<typeof useSearchParams>[1]) {+ return async ({ id }: { id: string }) => {+ const entry = await getProject(id);+ if (!entry) return null;+ setParams({ project: entry.id, dashboard: undefined }, { replace: true });+ return { id: entry.id, name: entry.name };+ }+}diff --git a/apps/web/src/context/electron/selection.ts b/apps/web/src/context/electron/selection.tsnew file mode 100644index 00000000..2f3298c4--- /dev/null+++ b/apps/web/src/context/electron/selection.ts@@ -0,0 +1,125 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { Accessor } from "solid-js";++import {+ addComponent,+ removeComponent,+ findGeometryAsset,+ isScene,+ isGroup,+ isText,+ isCaption,+ isAdjustmentLayer,+ PaintType,+} from "@/components/engine";+import { Not, Or, query, hasComponent, entityExists } from "bitecs";++import type { EngineWorld, Engine } from "@/components/engine";+import type { NodeRef } from "@diffusionstudio/cli/channels";++function resolveNodeEids(world: EngineWorld, ids: number[]): number[] {+ const c = world.components;+ return ids.map((eid) => {+ if (+ !Number.isInteger(eid) ||+ !entityExists(world, eid) ||+ hasComponent(world, eid, c.Deleted) ||+ !isNode(world, eid)+ ) {+ throw new Error(`No such node: ${eid}`);+ }+ return eid;+ });+}++function isNode(world: EngineWorld, eid: number): boolean {+ const c = world.components;+ return (+ hasComponent(world, eid, c.Geometry) ||+ hasComponent(world, eid, c.Group) ||+ hasComponent(world, eid, c.AdjustmentLayer)+ );+}++export function entityType(world: EngineWorld, eid: number): string {+ const c = world.components;+ if (hasComponent(world, eid, c.ColorStop)) return "colorStop";+ if (hasComponent(world, eid, c.Paint)) {+ switch (c.Paint[eid]) {+ case PaintType.SOLID: return "solidPaint";+ case PaintType.LINEAR_GRADIENT: return "linearGradientPaint";+ case PaintType.RADIAL_GRADIENT: return "radialGradientPaint";+ case PaintType.IMAGE: return "imagePaint";+ case PaintType.VIDEO: return "videoPaint";+ default: return "paint";+ }+ }+ if (hasComponent(world, eid, c.Stroke)) return "stroke";+ if (hasComponent(world, eid, c.Shadow)) return "shadow";+ if (hasComponent(world, eid, c.Effect)) return "effect";+ if (hasComponent(world, eid, c.TextRange)) return "textRange";+ if (hasComponent(world, eid, c.KeyframeTrack)) return "keyframeTrack";+ if (hasComponent(world, eid, c.Keyframe)) return "keyframe";+ if (hasComponent(world, eid, c.Animation)) return "animation";+ if (isScene(world, eid)) return "scene";+ if (isAdjustmentLayer(world, eid)) return "adjustmentLayer";+ if (isGroup(world, eid)) return "group";+ if (isCaption(world, eid)) return "caption";+ if (isText(world, eid)) return "text";++ const asset = findGeometryAsset(world, eid);+ if (asset?.type === "IMAGE") return "image";+ if (asset?.type === "VIDEO") return "video";+ if (asset?.type === "AUDIO") return "audio";++ return "rect";+}++function toNodeRef(world: EngineWorld, eid: number): NodeRef {+ const c = world.components;+ return {+ id: eid,+ name: c.Name[eid] ?? "",+ type: entityType(world, eid),+ };+}++function selectedNodes(world: EngineWorld): NodeRef[] {+ const c = world.components;+ const eids = query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(c.Deleted)]);+ return [...eids].map((eid) => toNodeRef(world, eid));+}++export function handleSelectionList(engine: Accessor<Engine>) {+ return async () => {+ const { world } = engine();+ return selectedNodes(world);+ }+}++export function handleSelectionSet(engine: Accessor<Engine>) {+ return async ({ ids }: { ids: number[] }) => {+ const { world } = engine();+ const c = world.components;+ const eids = resolveNodeEids(world, ids);+ // Scope clearing to nodes so a co-existing keyframe selection survives.+ for (const eid of query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer)])) {+ removeComponent(world, eid, c.Selected, false);+ }+ for (const eid of eids) addComponent(world, eid, c.Selected, false);+ return selectedNodes(world);+ }+}++export function handleSelectionFocus(engine: Accessor<Engine>) {+ return async () => {+ const { world, camera } = engine();+ const c = world.components;+ const eids = [...query(world, [c.Selected, Or(c.Geometry, c.Group, c.AdjustmentLayer), Not(c.Deleted)])];+ camera.focusEntities(eids);+ return selectedNodes(world);+ }+}diff --git a/apps/web/src/context/electron/voices.ts b/apps/web/src/context/electron/voices.tsnew file mode 100644index 00000000..9109a8d0--- /dev/null+++ b/apps/web/src/context/electron/voices.ts@@ -0,0 +1,15 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { PROMPT_INPUT_VOICE_OPTIONS } from "@/components/genai/config";++export function handleVoices() {+ return async () => {+ return PROMPT_INPUT_VOICE_OPTIONS.map((v) => ({+ id: v.value,+ label: v.label,+ description: v.description,+ }));+ }+}diff --git a/apps/web/src/context/electron/window.ts b/apps/web/src/context/electron/window.tsnew file mode 100644index 00000000..d431e1ff--- /dev/null+++ b/apps/web/src/context/electron/window.ts@@ -0,0 +1,14 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { mainBridge } from "@/lib/ipc";+import { MAIN_CHANNELS } from "@desktop/main-channels";++export function handleGetFullscreenState() {+ return mainBridge.call(MAIN_CHANNELS.WINDOW_IS_FULLSCREEN, undefined);+}++export function handleWindowFullscreenChange(mutate: (fullscreen: boolean) => void) {+ return ({ fullscreen }: { fullscreen: boolean }) => mutate(fullscreen);+}diff --git a/apps/web/src/context/engine.tsx b/apps/web/src/context/engine.tsxnew file mode 100644index 00000000..b44287d4--- /dev/null+++ b/apps/web/src/context/engine.tsx@@ -0,0 +1,170 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEngine, invalidateAssets } from '@/components/engine';+import { clearAudioPeaksCache, clearAudioTrackCache, clearVideoTrackCache } from '@/components/engine/decoders';+import { clearImageThumbnailCache } from '@/components/engine/timeline/render/image';+import { markProjectOpened, setProjectThumbnail } from '@/components/engine/db';+import { captureCanvasThumbnail } from '@/components/engine/thumbnail';+import { assert } from '@/utils';+import { createContext, onCleanup, onMount, useContext, createSignal, Show } from 'solid-js';+import { verifyHandlePermissions } from "@/utils/browser";+import { Button } from "@/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogPortal,+ DialogTitle,+} from "@/components/ui/dialog";+import { disposeDecoders } from '@/components/engine/api/utils';+import { getAllEntities } from 'bitecs';++import type { JSX } from 'solid-js';+import type { ElectronFileHandle } from '@/lib/electron-file-handle';++type EngineContextValue = ReturnType<typeof createEngine>;++const EngineContext = createContext<EngineContextValue>();++type EngineProviderProps = {+ children: JSX.Element;+ projectId: string;+};++type GrantableHandle = FileSystemDirectoryHandle | FileSystemFileHandle | ElectronFileHandle;;++export function EngineProvider(props: EngineProviderProps) {+ const engine = createEngine(props.projectId);+ const resizeObserver = new ResizeObserver(() => engine.resize());++ const [open, setOpen] = createSignal(false);+ const [handles, setHandles] = createSignal<GrantableHandle[]>([]);+ const [granting, setGranting] = createSignal(false);+ let resolveCurrent: (() => void) | null = null;++ const showGrantPermissionDialog = (pending: GrantableHandle[]) => {+ if (pending.length === 0) return Promise.resolve();+ // Resolve any prior pending call so callers don't deadlock if show()+ // is invoked again before the previous dialog closes.+ resolveCurrent?.();+ const { promise, resolve } = Promise.withResolvers<void>();+ resolveCurrent = resolve;+ setHandles(pending);+ setOpen(true);+ return promise;+ };++ const handleOpenChange = (next: boolean) => {+ setOpen(next);+ if (!next) {+ resolveCurrent?.();+ resolveCurrent = null;+ }+ };++ const handleGrant = async () => {+ if (granting()) return;+ setGranting(true);+ try {+ await verifyHandlePermissions(handles(), "read");+ } finally {+ setGranting(false);+ handleOpenChange(false);+ }+ };++ onMount(async () => {+ // Track project in global DB+ markProjectOpened(props.projectId);++ const canvas = document.getElementById('engine-canvas') as HTMLCanvasElement;+ resizeObserver.observe(canvas.parentElement!);++ await engine.init(canvas);++ // Detect filesystem handles whose permission was lost across reloads, then+ // open a dialog so the user can re-grant in a real click handler — the+ // requestPermission API requires a transient user activation.+ const pending: GrantableHandle[] = [];+ for (const asset of engine.world.assets.values()) {+ if (asset.handle) {+ const state = await asset.handle.queryPermission({ mode: 'read' });+ if (state !== 'granted') pending.push(asset.handle);+ }+ if (asset.type === 'SEQUENCE') {+ const state = await asset.directoryHandle.queryPermission({ mode: 'read' });+ if (state !== 'granted') pending.push(asset.directoryHandle);+ }+ }++ if (pending.length > 0) {+ await showGrantPermissionDialog(pending);++ // Permission re-granted (or dialog dismissed): drop cached decoders/tracks+ // so they refetch with the new permission, and bump the assets version to+ // retrigger resource consumers (thumbnails, sidebar previews, etc).+ clearAudioPeaksCache();+ clearAudioTrackCache();+ clearVideoTrackCache();+ clearImageThumbnailCache();++ for (const eid of getAllEntities(engine.world)) {+ disposeDecoders(engine.world, eid);+ }++ invalidateAssets(engine.world);+ }+ });++ onCleanup(() => {+ // Capture thumbnail before disposing the engine+ const canvas = engine.world.canvas;+ captureCanvasThumbnail(canvas).then((blob) => {+ if (blob) {+ setProjectThumbnail(props.projectId, blob);+ }+ });++ resizeObserver.disconnect();+ engine.dispose();+ });++ return (+ <EngineContext.Provider value={engine}>+ {props.children}+ <Dialog open={open()} onOpenChange={handleOpenChange}>+ <DialogPortal>+ <DialogContent class="sm:max-w-sm p-0 overflow-hidden" showCloseButton={false}>+ <img src="permission-dialog-header.png" alt="Restore access to your media" class="w-full h-auto" />+ <div class="px-4 pb-4">+ <DialogHeader>+ <DialogTitle class="text-[12px] font-450">Restore access to your files</DialogTitle>+ <DialogDescription class="text-xs text-muted-foreground leading-relaxed">+ This project references {handles().length} files from your filesystem. Grant access to load them. Enable <span class="font-450 text-foreground">Allow on every visit</span> in your browser settings to avoid this dialog in the future.+ </DialogDescription>+ </DialogHeader>+ <DialogFooter>+ <Button class="w-full mt-3" variant="secondary" disabled={granting()} onClick={handleGrant}>+ Grant access+ </Button>+ </DialogFooter>+ </div>+ </DialogContent>+ </DialogPortal>+ </Dialog>+ <Show when={!engine.initialized() && !open()}>+ <div class="fixed inset-0 z-50 bg-overlay animate-out fade-out-0 duration-200" />+ </Show>+ </EngineContext.Provider>+ );+}++export function useEngine() {+ const ctx = useContext(EngineContext);+ assert(ctx, 'useEngine must be used within EngineProvider');+ return ctx;+}diff --git a/apps/web/src/context/export.tsx b/apps/web/src/context/export.tsxnew file mode 100644index 00000000..901270c1--- /dev/null+++ b/apps/web/src/context/export.tsx@@ -0,0 +1,222 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createContext, useContext, createSignal, batch, onCleanup, onMount } from "solid-js";+import { toast } from "somoto";+import { assert, downloadObject } from "@/utils";+import { useEngine } from "@/context/engine";+import { useProjectId } from "@/hooks/use-project-id";+import { getProjectName } from "@/components/engine/db/global-db";+import { createEncoder } from "@/components/engine/encode/encoder";+import { track } from "@/lib/analytics";+import { ExportProgress, type ExportConfig } from "@/components/sidebar-right/inspector/export-progress";+import {+ MIME_TYPES,+ getDefaultExportTemplate,+} from "@/components/sidebar-right/inspector/export-templates";++import type { JSX, Accessor } from "solid-js";++type ExportContextValue = {+ exportScene: (sceneEid: number, config: ExportConfig) => Promise<void>;+ exportCurrentFrame: () => Promise<void>;+ exporting: Accessor<boolean>;+};++const ExportContext = createContext<ExportContextValue>();++export function ExportProvider(props: { children: JSX.Element }) {+ const engine = useEngine();+ const { world } = engine;+ const projectId = useProjectId();++ const [exporting, setExporting] = createSignal(false);+ const [progress, setProgress] = createSignal(0);+ const [remaining, setRemaining] = createSignal<{ minutes: number; seconds: number }>();+ const [activeConfig, setActiveConfig] = createSignal<ExportConfig>();+ const [duration, setDuration] = createSignal(0);++ let cancelExport: (() => void) | undefined;++ const exportScene: ExportContextValue["exportScene"] = async (sceneEid, config) => {+ if (!sceneEid) return;++ const format = config.format ?? "mp4";+ const mimeType = MIME_TYPES[format];++ const name = (await getProjectName(projectId()))+ .replace(/\s+/g, "-")+ .toLowerCase();++ let target: FileSystemFileHandle;+ try {+ target = await window.showSaveFilePicker({+ suggestedName: `${name}.${format}`,+ types: [+ {+ description: format,+ accept: {+ [mimeType]: [`.${format}`],+ } as Record<`${string}/${string}`, `.${string}`[]>,+ },+ ],+ });+ } catch (e) {+ if ((e as Error).name === "AbortError") return;+ toast.error("Failed to start export", {+ description: (e as Error).message,+ });+ return;+ }++ engine.stop();++ const sceneDuration = () => {+ const frameRate = world.frameRate;+ const Computed = world.components.Computed;+ return Computed.duration[sceneEid] / frameRate;+ };++ batch(() => {+ setExporting(true);+ setProgress(0);+ setRemaining(undefined);+ setActiveConfig(config);+ setDuration(sceneDuration());+ });++ track('export_started', {+ format,+ resolution: config.video?.resolution,+ fps: config.video?.fps,+ video_codec: config.video?.codec,+ audio_codec: config.audio?.codec,+ scene_duration_s: Math.round(sceneDuration()),+ });+ const startedAt = performance.now();++ try {+ const encoder = await createEncoder(world, {+ ...config,+ target,+ scene: sceneEid,+ onProgress(p) {+ const percent = Math.round((p.progress / p.total) * 100);+ const r = p.remaining;+ batch(() => {+ setProgress(percent);+ setRemaining({+ minutes: r.getUTCMinutes(),+ seconds: r.getUTCSeconds(),+ });+ });+ },+ });++ cancelExport = encoder.cancel;++ const result = await encoder.render();++ if (result.type === "error") {+ console.error("Export failed:", result.error);+ toast.error("Export failed", {+ description: (result.error as Error | undefined)?.message,+ });+ track('export_failed', {+ format,+ duration_ms: Math.round(performance.now() - startedAt),+ error: (result.error as Error | undefined)?.message?.slice(0, 200) ?? 'unknown',+ });+ } else {+ toast("Export complete", {+ description: "Your video has been successfully exported",+ });+ track('export_completed', {+ format,+ resolution: config.video?.resolution,+ fps: config.video?.fps,+ scene_duration_s: Math.round(sceneDuration()),+ duration_ms: Math.round(performance.now() - startedAt),+ });+ }+ } catch (e) {+ console.error("Export failed:", e);+ toast.error("Export failed", {+ description: (e as Error).message,+ });+ track('export_failed', {+ format,+ duration_ms: Math.round(performance.now() - startedAt),+ error: (e as Error).message?.slice(0, 200) ?? 'unknown',+ });+ } finally {+ cancelExport = undefined;+ setExporting(false);+ engine.start();+ }+ };++ const exportCurrentFrame: ExportContextValue["exportCurrentFrame"] = async () => {+ const canvas = engine.world.canvas;+ if (!(canvas instanceof HTMLCanvasElement)) {+ toast("Canvas is not ready");+ return;+ }++ const blob = await new Promise<Blob | null>((resolve) => {+ canvas.toBlob((b) => resolve(b), "image/png");+ });++ if (!blob) {+ toast.error("Failed to capture frame");+ return;+ }++ const projectName = (await getProjectName(projectId()))+ .replace(/\s+/g, "-")+ .toLowerCase();+ await downloadObject(blob, `${projectName}-frame.png`);+ };++ const handleExportSceneEvent = () => {+ const sid = world.selection.scene;+ if (sid === null) {+ return toast("No active scene to export");+ }+ exportScene(sid, getDefaultExportTemplate());+ };++ const handleExportFrameEvent = () => exportCurrentFrame();++ onMount(() => {+ // TODO: Event bus would be better here+ window.addEventListener("engine:export-scene", handleExportSceneEvent);+ window.addEventListener("engine:export-frame", handleExportFrameEvent);+ });++ onCleanup(() => {+ window.removeEventListener("engine:export-scene", handleExportSceneEvent);+ window.removeEventListener("engine:export-frame", handleExportFrameEvent);+ });++ return (+ <ExportContext.Provider value={{ exportScene, exportCurrentFrame, exporting }}>+ {props.children}+ <ExportProgress+ open={exporting()}+ progress={progress()}+ remaining={remaining()}+ config={activeConfig()}+ duration={duration()}+ onCancel={() => cancelExport?.()}+ />+ </ExportContext.Provider>+ );+}++export function useExport() {+ const ctx = useContext(ExportContext);+ assert(ctx, "useExport must be used within ExportProvider");+ return ctx;+}diff --git a/apps/web/src/context/index.ts b/apps/web/src/context/index.tsnew file mode 100644index 00000000..7097e491--- /dev/null+++ b/apps/web/src/context/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './auth';diff --git a/apps/web/src/context/layout.tsx b/apps/web/src/context/layout.tsxnew file mode 100644index 00000000..d5fd6d6b--- /dev/null+++ b/apps/web/src/context/layout.tsx@@ -0,0 +1,65 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createContext, useContext, type Accessor, type JSX } from 'solid-js';+import { assert } from '@/utils';+import { createStoredSignal } from '@/lib/store';+import { store } from '@/init';++type LayoutContextValue = {+ sidebarsVisible: Accessor<boolean>;+ timelineVisible: Accessor<boolean>;+ timelineHeight: Accessor<number>;+ setTimelineHeight(height: number): void;+ toggleUI(): void;+ toggleTimeline(): void;+};++const LayoutContext = createContext<LayoutContextValue>();++export const MIN_TIMELINE_HEIGHT = 120;+export const DEFAULT_TIMELINE_HEIGHT = 234;++export function LayoutProvider(props: { children: JSX.Element }) {+ const [sidebarsVisible, setSidebarsVisible] = createStoredSignal(+ store.define<boolean>('layout.sidebarsVisible', true),+ );++ const [timelinePreferred, setTimelinePreferred] = createStoredSignal(+ store.define<boolean>('layout.timelineVisible', true),+ );+ const [timelineHeight, setTimelineHeight] = createStoredSignal(+ store.define<number>('layout.timelineHeight', DEFAULT_TIMELINE_HEIGHT),+ );++ const timelineVisible = () => sidebarsVisible() && timelinePreferred();++ const toggleUI = () => {+ setSidebarsVisible(!sidebarsVisible());+ };++ const toggleTimeline = () => {+ setTimelinePreferred(!timelinePreferred());+ };++ return (+ <LayoutContext.Provider+ value={{+ sidebarsVisible,+ timelineVisible,+ timelineHeight,+ setTimelineHeight,+ toggleUI,+ toggleTimeline,+ }}>+ {props.children}+ </LayoutContext.Provider>+ );+}++export function useLayout() {+ const ctx = useContext(LayoutContext);+ assert(ctx, 'useLayout must be used within LayoutProvider');+ return ctx;+}diff --git a/apps/web/src/context/prompt-input.tsx b/apps/web/src/context/prompt-input.tsxnew file mode 100644index 00000000..148e830d--- /dev/null+++ b/apps/web/src/context/prompt-input.tsx@@ -0,0 +1,38 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createContext, createSignal, useContext } from "solid-js";+import type { JSX } from "solid-js";+import type { GenerationConfig } from "@/components/engine/db";++type PromptInputContextValue = {+ openPromptInput: (config: GenerationConfig) => void;+ promptInputOpen: () => boolean;+ setPromptInputOpen: (open: boolean) => void;+ promptInputConfig: () => GenerationConfig | undefined;+};++const PromptInputContext = createContext<PromptInputContextValue>();++export function PromptInputProvider(props: { children: JSX.Element }) {+ const [promptInputOpen, setPromptInputOpen] = createSignal(false);+ const [promptInputConfig, setPromptInputConfig] = createSignal<GenerationConfig | undefined>();++ const openPromptInput = (config: GenerationConfig) => {+ setPromptInputConfig(config);+ setPromptInputOpen(true);+ };++ return (+ <PromptInputContext.Provider value={{ openPromptInput, promptInputOpen, promptInputConfig, setPromptInputOpen }}>+ {props.children}+ </PromptInputContext.Provider>+ );+}++export function usePromptInput() {+ const context = useContext(PromptInputContext);+ if (!context) throw new Error("usePromptInput must be used within a PromptInputProvider");+ return context;+}diff --git a/apps/web/src/context/timeline.tsx b/apps/web/src/context/timeline.tsxnew file mode 100644index 00000000..cd19cd44--- /dev/null+++ b/apps/web/src/context/timeline.tsx@@ -0,0 +1,27 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createContext, useContext, type JSX } from 'solid-js';+import { assert } from '@/utils';+import { createTimeline } from '@/components/engine/timeline';++type TimelineContextValue = ReturnType<typeof createTimeline>;++const TimelineContext = createContext<TimelineContextValue>();++export function TimelineProvider(props: { children: JSX.Element }) {+ const timeline = createTimeline();++ return (+ <TimelineContext.Provider value={timeline}>+ {props.children}+ </TimelineContext.Provider>+ );+}++export function useTimeline() {+ const ctx = useContext(TimelineContext);+ assert(ctx, 'useTimeline must be used within TimelineProvider');+ return ctx;+}diff --git a/apps/web/src/hooks/use-avatar.ts b/apps/web/src/hooks/use-avatar.tsnew file mode 100644index 00000000..e6af7d3c--- /dev/null+++ b/apps/web/src/hooks/use-avatar.ts@@ -0,0 +1,50 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect, createSignal, onCleanup, type Accessor } from "solid-js";++import { supabase } from "@/lib/supabase";+import { useAuth } from "@/context";++/**+ * Resolves a user's avatar_url (either a direct HTTP URL from OAuth+ * or a Supabase Storage path) into a displayable image URL.+ */+export function useAvatar(): Accessor<string | null> {+ const auth = useAuth();+ const [displayUrl, setDisplayUrl] = createSignal<string | null>(null);++ createEffect(() => {+ const url = auth.user()?.user_metadata?.avatar_url as string | undefined;+ if (!url) {+ setDisplayUrl(null);+ return;+ }++ if (url.startsWith("http")) {+ setDisplayUrl(url);+ return;+ }++ // Storage path — download the blob+ if (!supabase) return;+ void supabase.storage+ .from("avatars")+ .download(url)+ .then(({ data }) => {+ if (data) {+ const prev = displayUrl();+ if (prev?.startsWith("blob:")) URL.revokeObjectURL(prev);+ setDisplayUrl(URL.createObjectURL(data));+ }+ });+ });++ onCleanup(() => {+ const url = displayUrl();+ if (url?.startsWith("blob:")) URL.revokeObjectURL(url);+ });++ return displayUrl;+}diff --git a/apps/web/src/hooks/use-click-position.ts b/apps/web/src/hooks/use-click-position.tsnew file mode 100644index 00000000..ab628262--- /dev/null+++ b/apps/web/src/hooks/use-click-position.ts@@ -0,0 +1,26 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal } from "solid-js";++type Point = { x: number; y: number };++type ClientPointEvent = {+ clientX: number;+ clientY: number;+};++export function useClickPosition() {+ const [position, setPosition] = createSignal<Point | undefined>();++ const setFromEvent = (event: ClientPointEvent) => {+ setPosition({ x: event.clientX, y: event.clientY });+ };++ return {+ position,+ setFromEvent,+ };+}+diff --git a/apps/web/src/hooks/use-controlled-selection.ts b/apps/web/src/hooks/use-controlled-selection.tsnew file mode 100644index 00000000..db61ccb1--- /dev/null+++ b/apps/web/src/hooks/use-controlled-selection.ts@@ -0,0 +1,28 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal, type Accessor } from "solid-js";++type ControlledSelectionOptions<Item, Value> = {+ value?: Accessor<Value | undefined>;+ defaultValue: Value;+ getValue: (item: Item) => Value;+ onChange?: (item: Item) => void;+};++export function useControlledSelection<Item, Value>(+ options: ControlledSelectionOptions<Item, Value>,+) {+ const [internalValue, setInternalValue] = createSignal<Value>(options.defaultValue);+ const selectedValue = () => options.value?.() ?? internalValue();++ const select = (item: Item) => {+ if (!options.value) {+ setInternalValue(() => options.getValue(item));+ }+ options.onChange?.(item);+ };++ return [selectedValue, select] as const;+}diff --git a/apps/web/src/hooks/use-cursor.ts b/apps/web/src/hooks/use-cursor.tsnew file mode 100644index 00000000..234d4562--- /dev/null+++ b/apps/web/src/hooks/use-cursor.ts@@ -0,0 +1,62 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++const CURSOR_CACHE = new Map<HTMLElement, string>();++const CORNER_SVG = `<path d='m19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill='%23fff'/><path d='m18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill='%23000'/>`+const EDGE_SVG = `<path d='m9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill='%23fff'/><path d='m17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill='%23000'/>`+const ROTATE_SVG = `<path d="M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill="black"/><path fill-rule="evenodd" clip-rule="evenodd" d="M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill="white"/>`++const TRIM_RIGHT_SVG = `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g filter="url(#filter0_d_8554_411488)"><mask id="path-1-outside-1_8554_411488" maskUnits="userSpaceOnUse" x="19.0004" y="11.9998" width="5" height="7" fill="black"><rect fill="white" x="19.0004" y="11.9998" width="5" height="7"/><path d="M20.1467 17.8533C20.342 18.0486 20.6585 18.0486 20.8538 17.8533L22.8538 15.8533C23.0489 15.658 23.049 15.3415 22.8538 15.1463L20.8538 13.1463C20.6585 12.9512 20.342 12.9512 20.1467 13.1463C19.9515 13.3415 19.9516 13.658 20.1467 13.8533L21.7932 15.4998L20.1467 17.1463C19.9515 17.3415 19.9516 17.658 20.1467 17.8533Z"/></mask><path d="M20.1467 17.8533C20.342 18.0486 20.6585 18.0486 20.8538 17.8533L22.8538 15.8533C23.0489 15.658 23.049 15.3415 22.8538 15.1463L20.8538 13.1463C20.6585 12.9512 20.342 12.9512 20.1467 13.1463C19.9515 13.3415 19.9516 13.658 20.1467 13.8533L21.7932 15.4998L20.1467 17.1463C19.9515 17.3415 19.9516 17.658 20.1467 17.8533Z" fill="black"/><path d="M20.1467 17.8533L19.4396 18.5604L19.4394 18.5601L20.1467 17.8533ZM20.8538 17.8533L20.1467 17.1462L20.1467 17.1462L20.8538 17.8533ZM22.8538 15.8533L23.5612 16.5601L23.5609 16.5604L22.8538 15.8533ZM22.8538 15.1463L22.1467 15.8534L22.1467 15.8534L22.8538 15.1463ZM20.8538 13.1463L21.5606 12.4389L21.5609 12.4392L20.8538 13.1463ZM20.1467 13.1463L19.4396 12.4392L19.4399 12.4389L20.1467 13.1463ZM20.1467 13.8533L19.4396 14.5604L19.4394 14.5601L20.1467 13.8533ZM21.7932 15.4998L22.5003 14.7927C22.8909 15.1832 22.8909 15.8164 22.5003 16.2069L21.7932 15.4998ZM20.1467 17.1463L20.8539 17.8534L20.8539 17.8534L20.1467 17.1463ZM20.1467 17.8533L20.8539 17.1462C20.6586 16.9509 20.3419 16.9509 20.1467 17.1462L20.8538 17.8533L21.5609 18.5604C20.9751 19.1462 20.0254 19.1462 19.4396 18.5604L20.1467 17.8533ZM20.8538 17.8533L20.1467 17.1462L22.1467 15.1462L22.8538 15.8533L23.5609 16.5604L21.5609 18.5604L20.8538 17.8533ZM22.8538 15.8533L22.1464 15.1465C21.9516 15.3414 21.9511 15.6578 22.1467 15.8534L22.8538 15.1463L23.5609 14.4392C24.1469 15.0252 24.1461 15.9747 23.5612 16.5601L22.8538 15.8533ZM22.8538 15.1463L22.1467 15.8534L20.1467 13.8534L20.8538 13.1463L21.5609 12.4392L23.5609 14.4392L22.8538 15.1463ZM20.8538 13.1463L20.1469 13.8537C20.3422 14.0488 20.6584 14.0487 20.8536 13.8537L20.1467 13.1463L19.4399 12.4389C20.0256 11.8537 20.9749 11.8536 21.5606 12.4389L20.8538 13.1463ZM20.1467 13.1463L20.8539 13.8534C21.0494 13.6578 21.0489 13.3414 20.8541 13.1465L20.1467 13.8533L19.4394 14.5601C18.8543 13.9747 18.8536 13.0252 19.4396 12.4392L20.1467 13.1463ZM20.1467 13.8533L20.8539 13.1462L22.5003 14.7927L21.7932 15.4998L21.0861 16.2069L19.4396 14.5604L20.1467 13.8533ZM21.7932 15.4998L22.5003 16.2069L20.8539 17.8534L20.1467 17.1463L19.4396 16.4392L21.0861 14.7927L21.7932 15.4998ZM20.1467 17.1463L20.8539 17.8534C21.0494 17.6578 21.0489 17.3414 20.8541 17.1465L20.1467 17.8533L19.4394 18.5601C18.8543 17.9747 18.8536 17.0252 19.4396 16.4392L20.1467 17.1463Z" fill="white" mask="url(#path-1-outside-1_8554_411488)"/></g><g filter="url(#filter1_d_8554_411488)"><mask id="path-3-outside-2_8554_411488" maskUnits="userSpaceOnUse" x="6.99976" y="12.0002" width="5" height="7" fill="black"><rect fill="white" x="6.99976" y="12.0002" width="5" height="7"/><path d="M10.8534 13.1467C10.6581 12.9514 10.3416 12.9514 10.1464 13.1467L8.14635 15.1467C7.95109 15.3419 7.95109 15.6585 8.14635 15.8537L10.1464 17.8537C10.3416 18.0488 10.6582 18.0489 10.8534 17.8537C11.0486 17.6585 11.0485 17.342 10.8534 17.1467L9.2069 15.5002L10.8534 13.8537C11.0486 13.6585 11.0485 13.342 10.8534 13.1467Z"/></mask><path d="M10.8534 13.1467C10.6581 12.9514 10.3416 12.9514 10.1464 13.1467L8.14635 15.1467C7.95109 15.3419 7.95109 15.6585 8.14635 15.8537L10.1464 17.8537C10.3416 18.0488 10.6582 18.0489 10.8534 17.8537C11.0486 17.6585 11.0485 17.342 10.8534 17.1467L9.2069 15.5002L10.8534 13.8537C11.0486 13.6585 11.0485 13.342 10.8534 13.1467Z" fill="black"/><path d="M10.8534 13.1467L11.5605 12.4396L11.5608 12.4398L10.8534 13.1467ZM10.1464 13.1467L9.43924 12.4396L9.43926 12.4396L10.1464 13.1467ZM8.14635 15.1467L7.43924 14.4396L7.43924 14.4396L8.14635 15.1467ZM8.14635 15.8537L8.85346 15.1466L8.85346 15.1466L8.14635 15.8537ZM10.1464 17.8537L9.43951 18.5611L9.43924 18.5608L10.1464 17.8537ZM10.8534 17.8537L11.5605 18.5608L11.5605 18.5608L10.8534 17.8537ZM10.8534 17.1467L11.5605 16.4396L11.5608 16.4398L10.8534 17.1467ZM9.2069 15.5002L8.49979 16.2073C8.31225 16.0198 8.2069 15.7654 8.2069 15.5002C8.2069 15.235 8.31225 14.9806 8.49979 14.7931L9.2069 15.5002ZM10.8534 13.8537L11.5605 14.5608L11.5605 14.5608L10.8534 13.8537ZM10.8534 13.1467L10.1463 13.8538C10.3416 14.0491 10.6582 14.049 10.8534 13.8538L10.1464 13.1467L9.43926 12.4396C10.025 11.8538 10.9747 11.8538 11.5605 12.4396L10.8534 13.1467ZM10.1464 13.1467L10.8535 13.8538L8.85346 15.8538L8.14635 15.1467L7.43924 14.4396L9.43924 12.4396L10.1464 13.1467ZM8.14635 15.1467L8.85346 15.8538C9.04872 15.6585 9.04872 15.3419 8.85346 15.1466L8.14635 15.8537L7.43924 16.5608C6.85346 15.975 6.85346 15.0254 7.43924 14.4396L8.14635 15.1467ZM8.14635 15.8537L8.85346 15.1466L10.8535 17.1466L10.1464 17.8537L9.43924 18.5608L7.43924 16.5608L8.14635 15.8537ZM10.1464 17.8537L10.8532 17.1463C10.6583 16.9516 10.3419 16.951 10.1463 17.1466L10.8534 17.8537L11.5605 18.5608C10.9745 19.1468 10.025 19.1461 9.43951 18.5611L10.1464 17.8537ZM10.8534 17.8537L10.1463 17.1466C9.95071 17.3422 9.95121 17.6586 10.146 17.8535L10.8534 17.1467L11.5608 16.4398C12.1458 17.0253 12.1465 17.9748 11.5605 18.5608L10.8534 17.8537ZM10.8534 17.1467L10.1463 17.8538L8.49979 16.2073L9.2069 15.5002L9.914 14.7931L11.5605 16.4396L10.8534 17.1467ZM9.2069 15.5002L8.49979 14.7931L10.1463 13.1466L10.8534 13.8537L11.5605 14.5608L9.914 16.2073L9.2069 15.5002ZM10.8534 13.8537L10.1463 13.1466C9.95071 13.3422 9.95121 13.6586 10.146 13.8535L10.8534 13.1467L11.5608 12.4398C12.1458 13.0253 12.1465 13.9748 11.5605 14.5608L10.8534 13.8537Z" fill="white" mask="url(#path-3-outside-2_8554_411488)"/></g><g filter="url(#filter2_d_8554_411488)"><mask id="path-5-outside-3_8554_411488" maskUnits="userSpaceOnUse" x="14" y="6" width="5" height="19" fill="black"><rect fill="white" x="14" y="6" width="5" height="19"/><path d="M17.5 7C17.7761 7 18 7.22386 18 7.5C18 7.77614 17.7761 8 17.5 8C16.6716 8 16 8.67157 16 9.5V21.5C16 22.3284 16.6716 23 17.5 23C17.7761 23 18 23.2239 18 23.5C18 23.7761 17.7761 24 17.5 24C16.1193 24 15 22.8807 15 21.5V9.5C15 8.11929 16.1193 7 17.5 7Z"/></mask><path d="M17.5 7C17.7761 7 18 7.22386 18 7.5C18 7.77614 17.7761 8 17.5 8C16.6716 8 16 8.67157 16 9.5V21.5C16 22.3284 16.6716 23 17.5 23C17.7761 23 18 23.2239 18 23.5C18 23.7761 17.7761 24 17.5 24C16.1193 24 15 22.8807 15 21.5V9.5C15 8.11929 16.1193 7 17.5 7Z" fill="black"/><path d="M17.5 7V8C17.2239 8 17 7.77614 17 7.5H18H19C19 6.67157 18.3284 6 17.5 6V7ZM18 7.5H17C17 7.22386 17.2239 7 17.5 7V8V9C18.3284 9 19 8.32843 19 7.5H18ZM17.5 8V7C16.1193 7 15 8.11929 15 9.5H16H17C17 9.22386 17.2239 9 17.5 9V8ZM16 9.5H15V21.5H16H17V9.5H16ZM16 21.5H15C15 22.8807 16.1193 24 17.5 24V23V22C17.2239 22 17 21.7761 17 21.5H16ZM17.5 23V24C17.2239 24 17 23.7761 17 23.5H18H19C19 22.6716 18.3284 22 17.5 22V23ZM18 23.5H17C17 23.2239 17.2239 23 17.5 23V24V25C18.3284 25 19 24.3284 19 23.5H18ZM17.5 24V23C16.6716 23 16 22.3284 16 21.5H15H14C14 23.433 15.567 25 17.5 25V24ZM15 21.5H16V9.5H15H14V21.5H15ZM15 9.5H16C16 8.67157 16.6716 8 17.5 8V7V6C15.567 6 14 7.567 14 9.5H15Z" fill="white" mask="url(#path-5-outside-3_8554_411488)"/></g><defs><filter id="filter0_d_8554_411488" x="16.0004" y="10" width="10.9998" height="12.9998" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="1"/><feGaussianBlur stdDeviation="1.5"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8554_411488"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_8554_411488" result="shape"/></filter><filter id="filter1_d_8554_411488" x="3.99988" y="10.0002" width="10.9999" height="12.9998" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="1"/><feGaussianBlur stdDeviation="1.5"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8554_411488"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_8554_411488" result="shape"/></filter><filter id="filter2_d_8554_411488" x="11" y="4" width="11" height="25" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="1"/><feGaussianBlur stdDeviation="1.5"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8554_411488"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_8554_411488" result="shape"/></filter></defs></svg>`+const TRIM_LEFT_SVG = `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g filter="url(#filter0_d_8554_411501)"><mask id="path-1-outside-1_8554_411501" maskUnits="userSpaceOnUse" x="19.0002" y="11.9995" width="5" height="7" fill="black"><rect fill="white" x="19.0002" y="11.9995" width="5" height="7"/><path d="M20.1467 17.8531C20.3419 18.0483 20.6584 18.0483 20.8537 17.8531L22.8537 15.8531C23.0489 15.6578 23.049 15.3413 22.8537 15.146L20.8537 13.146C20.6584 12.9508 20.3419 12.9508 20.1467 13.146C19.9514 13.3413 19.9515 13.6578 20.1467 13.8531L21.7932 15.4995L20.1467 17.146C19.9514 17.3413 19.9515 17.6578 20.1467 17.8531Z"/></mask><path d="M20.1467 17.8531C20.3419 18.0483 20.6584 18.0483 20.8537 17.8531L22.8537 15.8531C23.0489 15.6578 23.049 15.3413 22.8537 15.146L20.8537 13.146C20.6584 12.9508 20.3419 12.9508 20.1467 13.146C19.9514 13.3413 19.9515 13.6578 20.1467 13.8531L21.7932 15.4995L20.1467 17.146C19.9514 17.3413 19.9515 17.6578 20.1467 17.8531Z" fill="black"/><path d="M20.1467 17.8531L19.4396 18.5602L19.4395 18.5601L20.1467 17.8531ZM20.8537 17.8531L20.1466 17.146L20.1466 17.146L20.8537 17.8531ZM22.8537 15.8531L23.5609 16.5601L23.5608 16.5602L22.8537 15.8531ZM22.8537 15.146L22.1466 15.8531L22.1466 15.8531L22.8537 15.146ZM20.8537 13.146L21.5607 12.4388L21.5608 12.4389L20.8537 13.146ZM20.1467 13.146L19.4396 12.4389L19.4396 12.4389L20.1467 13.146ZM20.1467 13.8531L19.4396 14.5602L19.4395 14.5601L20.1467 13.8531ZM21.7932 15.4995L22.5003 14.7924C22.6878 14.98 22.7932 15.2343 22.7932 15.4995C22.7932 15.7648 22.6878 16.0191 22.5003 16.2067L21.7932 15.4995ZM20.1467 17.146L20.8538 17.8531L20.8538 17.8531L20.1467 17.146ZM20.1467 17.8531L20.8538 17.146C20.6585 16.9507 20.3419 16.9507 20.1466 17.146L20.8537 17.8531L21.5608 18.5602C20.975 19.146 20.0253 19.146 19.4396 18.5602L20.1467 17.8531ZM20.8537 17.8531L20.1466 17.146L22.1466 15.146L22.8537 15.8531L23.5608 16.5602L21.5608 18.5602L20.8537 17.8531ZM22.8537 15.8531L22.1465 15.146C21.9514 15.3412 21.9513 15.6578 22.1466 15.8531L22.8537 15.146L23.5608 14.4389C24.1466 15.0247 24.1465 15.9744 23.5609 16.5601L22.8537 15.8531ZM22.8537 15.146L22.1466 15.8531L20.1466 13.8531L20.8537 13.146L21.5608 12.4389L23.5608 14.4389L22.8537 15.146ZM20.8537 13.146L20.1467 13.8532C20.3419 14.0484 20.6584 14.0485 20.8537 13.8532L20.1467 13.146L19.4396 12.4389C20.0254 11.8531 20.975 11.8533 21.5607 12.4388L20.8537 13.146ZM20.1467 13.146L20.8538 13.8531C21.0491 13.6578 21.049 13.3412 20.8539 13.146L20.1467 13.8531L19.4395 14.5601C18.8539 13.9744 18.8537 13.0248 19.4396 12.4389L20.1467 13.146ZM20.1467 13.8531L20.8538 13.146L22.5003 14.7924L21.7932 15.4995L21.086 16.2067L19.4396 14.5602L20.1467 13.8531ZM21.7932 15.4995L22.5003 16.2067L20.8538 17.8531L20.1467 17.146L19.4396 16.4389L21.086 14.7924L21.7932 15.4995ZM20.1467 17.146L20.8538 17.8531C21.0491 17.6578 21.049 17.3412 20.8539 17.146L20.1467 17.8531L19.4395 18.5601C18.8539 17.9744 18.8537 17.0248 19.4396 16.4389L20.1467 17.146Z" fill="white" mask="url(#path-1-outside-1_8554_411501)"/></g><g filter="url(#filter1_d_8554_411501)"><mask id="path-3-outside-2_8554_411501" maskUnits="userSpaceOnUse" x="6.99976" y="12.0002" width="5" height="7" fill="black"><rect fill="white" x="6.99976" y="12.0002" width="5" height="7"/><path d="M10.8534 13.1467C10.6581 12.9514 10.3416 12.9514 10.1464 13.1467L8.14635 15.1467C7.95109 15.3419 7.95109 15.6585 8.14635 15.8537L10.1464 17.8537C10.3416 18.0488 10.6582 18.0489 10.8534 17.8537C11.0486 17.6585 11.0485 17.342 10.8534 17.1467L9.2069 15.5002L10.8534 13.8537C11.0486 13.6585 11.0485 13.342 10.8534 13.1467Z"/></mask><path d="M10.8534 13.1467C10.6581 12.9514 10.3416 12.9514 10.1464 13.1467L8.14635 15.1467C7.95109 15.3419 7.95109 15.6585 8.14635 15.8537L10.1464 17.8537C10.3416 18.0488 10.6582 18.0489 10.8534 17.8537C11.0486 17.6585 11.0485 17.342 10.8534 17.1467L9.2069 15.5002L10.8534 13.8537C11.0486 13.6585 11.0485 13.342 10.8534 13.1467Z" fill="black"/><path d="M10.8534 13.1467L11.5605 12.4396L11.5608 12.4398L10.8534 13.1467ZM10.1464 13.1467L9.43924 12.4396L9.43926 12.4396L10.1464 13.1467ZM8.14635 15.1467L7.43924 14.4396L7.43924 14.4396L8.14635 15.1467ZM8.14635 15.8537L8.85346 15.1466L8.85346 15.1466L8.14635 15.8537ZM10.1464 17.8537L9.43951 18.5611L9.43924 18.5608L10.1464 17.8537ZM10.8534 17.8537L11.5605 18.5608L11.5605 18.5608L10.8534 17.8537ZM10.8534 17.1467L11.5605 16.4396L11.5608 16.4398L10.8534 17.1467ZM9.2069 15.5002L8.49979 16.2073C8.31225 16.0198 8.2069 15.7654 8.2069 15.5002C8.2069 15.235 8.31225 14.9806 8.49979 14.7931L9.2069 15.5002ZM10.8534 13.8537L11.5605 14.5608L11.5605 14.5608L10.8534 13.8537ZM10.8534 13.1467L10.1463 13.8538C10.3416 14.0491 10.6582 14.049 10.8534 13.8538L10.1464 13.1467L9.43926 12.4396C10.025 11.8538 10.9747 11.8538 11.5605 12.4396L10.8534 13.1467ZM10.1464 13.1467L10.8535 13.8538L8.85346 15.8538L8.14635 15.1467L7.43924 14.4396L9.43924 12.4396L10.1464 13.1467ZM8.14635 15.1467L8.85346 15.8538C9.04872 15.6585 9.04872 15.3419 8.85346 15.1466L8.14635 15.8537L7.43924 16.5608C6.85346 15.975 6.85346 15.0254 7.43924 14.4396L8.14635 15.1467ZM8.14635 15.8537L8.85346 15.1466L10.8535 17.1466L10.1464 17.8537L9.43924 18.5608L7.43924 16.5608L8.14635 15.8537ZM10.1464 17.8537L10.8532 17.1463C10.6583 16.9516 10.3419 16.951 10.1463 17.1466L10.8534 17.8537L11.5605 18.5608C10.9745 19.1468 10.025 19.1461 9.43951 18.5611L10.1464 17.8537ZM10.8534 17.8537L10.1463 17.1466C9.95071 17.3422 9.95121 17.6586 10.146 17.8535L10.8534 17.1467L11.5608 16.4398C12.1458 17.0253 12.1465 17.9748 11.5605 18.5608L10.8534 17.8537ZM10.8534 17.1467L10.1463 17.8538L8.49979 16.2073L9.2069 15.5002L9.914 14.7931L11.5605 16.4396L10.8534 17.1467ZM9.2069 15.5002L8.49979 14.7931L10.1463 13.1466L10.8534 13.8537L11.5605 14.5608L9.914 16.2073L9.2069 15.5002ZM10.8534 13.8537L10.1463 13.1466C9.95071 13.3422 9.95121 13.6586 10.146 13.8535L10.8534 13.1467L11.5608 12.4398C12.1458 13.0253 12.1465 13.9748 11.5605 14.5608L10.8534 13.8537Z" fill="white" mask="url(#path-3-outside-2_8554_411501)"/></g><g filter="url(#filter2_d_8554_411501)"><mask id="path-5-outside-3_8554_411501" maskUnits="userSpaceOnUse" x="12" y="6" width="5" height="19" fill="black"><rect fill="white" x="12" y="6" width="5" height="19"/><path d="M13.5 7C14.8807 7 16 8.11929 16 9.5V21.5C16 22.8807 14.8807 24 13.5 24C13.2239 24 13 23.7761 13 23.5C13 23.2239 13.2239 23 13.5 23C14.3284 23 15 22.3284 15 21.5V9.5C15 8.67157 14.3284 8 13.5 8C13.2239 8 13 7.77614 13 7.5C13 7.22386 13.2239 7 13.5 7Z"/></mask><path d="M13.5 7C14.8807 7 16 8.11929 16 9.5V21.5C16 22.8807 14.8807 24 13.5 24C13.2239 24 13 23.7761 13 23.5C13 23.2239 13.2239 23 13.5 23C14.3284 23 15 22.3284 15 21.5V9.5C15 8.67157 14.3284 8 13.5 8C13.2239 8 13 7.77614 13 7.5C13 7.22386 13.2239 7 13.5 7Z" fill="black"/><path d="M13.5 7V8C14.3284 8 15 8.67157 15 9.5H16H17C17 7.567 15.433 6 13.5 6V7ZM16 9.5H15V21.5H16H17V9.5H16ZM16 21.5H15C15 22.3284 14.3284 23 13.5 23V24V25C15.433 25 17 23.433 17 21.5H16ZM13.5 24V23C13.7761 23 14 23.2239 14 23.5H13H12C12 24.3284 12.6716 25 13.5 25V24ZM13 23.5H14C14 23.7761 13.7761 24 13.5 24V23V22C12.6716 22 12 22.6716 12 23.5H13ZM13.5 23V24C14.8807 24 16 22.8807 16 21.5H15H14C14 21.7761 13.7761 22 13.5 22V23ZM15 21.5H16V9.5H15H14V21.5H15ZM15 9.5H16C16 8.11929 14.8807 7 13.5 7V8V9C13.7761 9 14 9.22386 14 9.5H15ZM13.5 8V7C13.7761 7 14 7.22386 14 7.5H13H12C12 8.32843 12.6716 9 13.5 9V8ZM13 7.5H14C14 7.77614 13.7761 8 13.5 8V7V6C12.6716 6 12 6.67157 12 7.5H13Z" fill="white" mask="url(#path-5-outside-3_8554_411501)"/></g><defs><filter id="filter0_d_8554_411501" x="16.0002" y="9.99951" width="10.9999" height="13" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="1"/><feGaussianBlur stdDeviation="1.5"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8554_411501"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_8554_411501" result="shape"/></filter><filter id="filter1_d_8554_411501" x="3.99988" y="10.0002" width="10.9999" height="12.9998" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="1"/><feGaussianBlur stdDeviation="1.5"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8554_411501"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_8554_411501" result="shape"/></filter><filter id="filter2_d_8554_411501" x="9" y="4" width="11" height="25" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="1"/><feGaussianBlur stdDeviation="1.5"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8554_411501"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_8554_411501" result="shape"/></filter></defs></svg>`++const STATIC_CURSORS = new Set(['default', 'pointer', 'cross', 'move', 'grab', 'grabbing', 'text', 'zoom-in', 'zoom-out'])++function getCursorCss(svg: string, r: number, tr: number, color: string, hx = 16, hy = 16) {+ const a = (-tr - r) * (Math.PI / 180)+ const dx = Math.cos(a) - Math.sin(a)+ const dy = Math.sin(a) + Math.cos(a)+ return `url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg' style='color: ${color};'><defs><filter id='shadow' y='-40%' x='-40%' width='180px' height='180%' color-interpolation-filters='sRGB'><feDropShadow dx='${dx}' dy='${dy}' stdDeviation='1.2' flood-opacity='.5'/></filter></defs><g fill='none' transform='rotate(${r + tr} 16 16)' filter='url(%23shadow)'>${svg.replaceAll(`"`, `'`)}</g></svg>") ${hx} ${hy}, pointer`+}++// Embeds a full, self-contained SVG (its own shadow/outlines) directly as a cursor+// data URI. Newlines are stripped and `#`/`"` encoded so it survives in a CSS url().+function trimCursorCss(svg: string, hx = 16, hy = 16) {+ const encoded = svg.replace(/\s*\n\s*/g, '').replaceAll(`"`, `'`).replaceAll('#', '%23')+ return `url("data:image/svg+xml,${encoded}") ${hx} ${hy}, pointer`+}++const CURSORS: Record<string, (r: number, c: string) => string> = {+ 'ew-resize': (r, c) => getCursorCss(EDGE_SVG, r, 0, c),+ 'ns-resize': (r, c) => getCursorCss(EDGE_SVG, r, 90, c),+ 'nesw-resize': (r, c) => getCursorCss(CORNER_SVG, r, 0, c),+ 'nwse-resize': (r, c) => getCursorCss(CORNER_SVG, r, 90, c),+ 'nwse-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 0, c),+ 'nesw-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 90, c),+ 'senw-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 180, c),+ 'swne-rotate': (r, c) => getCursorCss(ROTATE_SVG, r, 270, c),+ 'trim-left': () => trimCursorCss(TRIM_LEFT_SVG),+ 'trim-right': () => trimCursorCss(TRIM_RIGHT_SVG),+}++export type CursorType = 'none' | 'default' | 'pointer' | 'cross' | 'grab' | 'rotate' | 'grabbing' | 'resize-edge' | 'resize-corner' | 'text' | 'move' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'nesw-rotate' | 'nwse-rotate' | 'swne-rotate' | 'senw-rotate' | 'zoom-in' | 'zoom-out' | 'trim-left' | 'trim-right';++export function useCursor() {+ return {+ set(el: HTMLElement | undefined, type: CursorType, rotation = 0, color = 'black') {+ const hash = `${type}-${rotation}-${color}`+ if (!el || CURSOR_CACHE.get(el) === hash) return++ if (!CURSOR_CACHE.has(el)) el.style.cursor = 'var(--tl-cursor)'+ CURSOR_CACHE.set(el, hash)++ const cursor = STATIC_CURSORS.has(type)+ ? type+ : CURSORS[type]?.(rotation * 180 / Math.PI, color) ?? 'default'++ el.style.setProperty('--tl-cursor', cursor)+ },+ get: (el: HTMLElement) => CURSOR_CACHE.get(el) ?? 'default',+ }+}diff --git a/apps/web/src/hooks/use-drag.ts b/apps/web/src/hooks/use-drag.tsnew file mode 100644index 00000000..92956391--- /dev/null+++ b/apps/web/src/hooks/use-drag.ts@@ -0,0 +1,61 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal, onCleanup } from "solid-js";++type Point = { x: number; y: number };++export type UseDragOptions = {+ onDragStart?: (pos: Point, e: PointerEvent) => void;+ onDragMove?: (pos: Point, e: PointerEvent) => void;+ onDragEnd?: (pos: Point, e: PointerEvent) => void;+ disabled?: () => boolean;+};++export function useDrag(options: UseDragOptions = {}) {+ const [isDragging, setIsDragging] = createSignal(false);+ let activePointerId: number | null = null;++ const getPointerPos = (e: PointerEvent): Point => ({ x: e.clientX, y: e.clientY });++ const removeGlobalListeners = () => {+ window.removeEventListener("pointermove", handlePointerMove);+ window.removeEventListener("pointerup", handlePointerUp);+ window.removeEventListener("pointercancel", handlePointerUp);+ document.body.classList.remove("select-none");+ };++ const handlePointerMove = (e: PointerEvent) => {+ if (activePointerId !== null && e.pointerId !== activePointerId) return;+ options.onDragMove?.(getPointerPos(e), e);+ };++ const handlePointerUp = (e: PointerEvent) => {+ if (activePointerId !== null && e.pointerId !== activePointerId) return;+ activePointerId = null;+ setIsDragging(false);+ removeGlobalListeners();+ options.onDragEnd?.(getPointerPos(e), e);+ };++ const onPointerDown = (e: PointerEvent) => {+ if (options.disabled?.()) return;+ e.preventDefault();+ (e.currentTarget as HTMLElement | null)?.setPointerCapture?.(e.pointerId);+ activePointerId = e.pointerId;+ setIsDragging(true);+ document.body.classList.add("select-none");+ window.addEventListener("pointermove", handlePointerMove);+ window.addEventListener("pointerup", handlePointerUp);+ window.addEventListener("pointercancel", handlePointerUp);+ options.onDragStart?.(getPointerPos(e), e);+ };++ onCleanup(removeGlobalListeners);++ return {+ isDragging,+ onPointerDown,+ };+}diff --git a/apps/web/src/hooks/use-mobile.ts b/apps/web/src/hooks/use-mobile.tsnew file mode 100644index 00000000..f5b75bec--- /dev/null+++ b/apps/web/src/hooks/use-mobile.ts@@ -0,0 +1,23 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// https://github.com/solidjs-community/solid-primitives/blob/main/packages/media/src/index.ts++import { createSignal, onCleanup } from "solid-js"+import { isServer } from "solid-js/web"++export const useIsMobile = () => {+ if (isServer) {+ return () => false+ }++ const mql = window.matchMedia("(max-width: 767px)")+ const [state, setState] = createSignal(mql.matches)+ const update = () => setState(mql.matches)+ mql.addEventListener("change", update)+ onCleanup(() => {+ mql.removeEventListener("change", update)+ })+ return state+}diff --git a/apps/web/src/hooks/use-permission.ts b/apps/web/src/hooks/use-permission.tsnew file mode 100644index 00000000..733aabf5--- /dev/null+++ b/apps/web/src/hooks/use-permission.ts@@ -0,0 +1,35 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { onCleanup, onMount, createSignal } from "solid-js";++export type PermissionState = "granted" | "denied" | "prompt" | "unsupported";++export function usePermissionState(name: string) {+ const [state, setState] = createSignal<PermissionState>("prompt");+ let status: PermissionStatus | null = null;+ const handleChange = () => {+ if (status) setState(status.state as PermissionState);+ };++ onMount(async () => {+ if (!navigator.permissions?.query) {+ setState("unsupported");+ return;+ }+ try {+ status = await navigator.permissions.query({ name: name as PermissionName });+ setState(status.state as PermissionState);+ status.addEventListener("change", handleChange);+ } catch {+ setState("unsupported");+ }+ });++ onCleanup(() => {+ status?.removeEventListener("change", handleChange);+ });++ return state;+}diff --git a/apps/web/src/hooks/use-project-id.ts b/apps/web/src/hooks/use-project-id.tsnew file mode 100644index 00000000..6ce2ef6d--- /dev/null+++ b/apps/web/src/hooks/use-project-id.ts@@ -0,0 +1,28 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { z } from 'zod';+import { useSearchParams } from "@solidjs/router";+import { createMemo } from 'solid-js';+import { DEFAULT_PROJECT_ID } from '@/components/engine/db';++export function useProjectId() {+ const [params] = useSearchParams();++ const projectId = createMemo(() => {+ const { success, data } = z+ .string()+ .regex(/^[A-Za-z0-9_-]{21}$/)+ .safeParse(params.project);++ if (!success) {+ // when no project is set use a default project id+ return DEFAULT_PROJECT_ID;+ }++ return data;+ });++ return projectId;+}diff --git a/apps/web/src/hooks/use-volume-meter.ts b/apps/web/src/hooks/use-volume-meter.tsnew file mode 100644index 00000000..aafc5dce--- /dev/null+++ b/apps/web/src/hooks/use-volume-meter.ts@@ -0,0 +1,293 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal, onCleanup } from 'solid-js';++export type ChannelLevels = {+ rms: number;+ peak: number;+};++const ZERO_LEVELS: ChannelLevels[] = [+ { rms: 0, peak: 0 },+ { rms: 0, peak: 0 },+];++type Listener = (levels: ChannelLevels[]) => void;++/**+ * A single shared AudioWorkletNode tapped onto a GainNode. Multiple+ * `useVolumeMeter` consumers pointing at the same GainNode reuse the same+ * worklet — the meter math runs once and the result fans out to every+ * subscribed listener.+ */+type SharedMeter = {+ workletNode: AudioWorkletNode;+ listeners: Set<Listener>;+ lastLevels: ChannelLevels[];+};++const sharedMeters = new WeakMap<GainNode, SharedMeter>();+const modulesLoaded = new WeakSet<BaseAudioContext>();++async function ensureModuleLoaded(ctx: BaseAudioContext) {+ if (modulesLoaded.has(ctx)) return;+ await ctx.audioWorklet.addModule(getVolumeMeterWorkletUrl());+ modulesLoaded.add(ctx);+}++function parseLevels(data: Float32Array): ChannelLevels[] {+ const channels = data.length / 2;+ const out: ChannelLevels[] = [];+ for (let ch = 0; ch < Math.min(channels, 2); ch++) {+ out.push({ rms: data[ch * 2], peak: data[ch * 2 + 1] });+ }+ // Pad mono → stereo for the meter UI.+ while (out.length < 2) {+ out.push(out[0] ?? { rms: 0, peak: 0 });+ }+ return out;+}++/**+ * Attach `listener` to the meter for `gainNode`, creating the worklet on+ * demand. Returns a teardown function — when the last listener detaches the+ * worklet is disconnected and the shared entry is dropped.+ */+async function subscribe(gainNode: GainNode, listener: Listener): Promise<() => void> {+ const existing = sharedMeters.get(gainNode);+ if (existing) {+ existing.listeners.add(listener);+ // Replay the last value so a freshly-attached consumer doesn't render+ // ZERO_LEVELS for one frame.+ listener(existing.lastLevels);+ return () => detach(gainNode, listener);+ }++ const ctx = gainNode.context;+ await ensureModuleLoaded(ctx);++ // Another consumer may have raced ahead while addModule was awaiting.+ const racedExisting = sharedMeters.get(gainNode);+ if (racedExisting) {+ racedExisting.listeners.add(listener);+ listener(racedExisting.lastLevels);+ return () => detach(gainNode, listener);+ }++ const workletNode = new AudioWorkletNode(ctx, 'volume-meter', {+ channelCount: 2,+ channelCountMode: 'explicit',+ numberOfInputs: 1,+ numberOfOutputs: 1,+ outputChannelCount: [2],+ });++ const shared: SharedMeter = {+ workletNode,+ listeners: new Set([listener]),+ lastLevels: ZERO_LEVELS,+ };++ workletNode.port.onmessage = (event: MessageEvent<Float32Array>) => {+ const levels = parseLevels(event.data);+ shared.lastLevels = levels;+ for (const l of shared.listeners) l(levels);+ };++ // Tap the gain node's output. The worklet's output is left disconnected+ // so it doesn't double the signal into the audio destination.+ gainNode.connect(workletNode);++ sharedMeters.set(gainNode, shared);+ return () => detach(gainNode, listener);+}++function detach(gainNode: GainNode, listener: Listener) {+ const shared = sharedMeters.get(gainNode);+ if (!shared) return;+ shared.listeners.delete(listener);+ if (shared.listeners.size > 0) return;++ shared.workletNode.port.onmessage = null;+ try {+ shared.workletNode.disconnect();+ } catch {+ /* already disconnected */+ }+ sharedMeters.delete(gainNode);+}++/**+ * Returns reactive per-channel RMS + peak levels for the given GainNode.+ * Multiple callers pointing at the same node share a single worklet — the+ * audio-thread work runs once regardless of how many meters are mounted.+ *+ * Call `connect(gainNode)` to wire it up and `disconnect()` to tear down.+ */+export function useVolumeMeter() {+ const [levels, setLevels] = createSignal<ChannelLevels[]>(ZERO_LEVELS);++ let currentGainNode: GainNode | null = null;+ let teardown: (() => void) | null = null;+ // Tracks the latest subscription request so an in-flight subscribe() that+ // resolves after a newer connect()/disconnect() can be discarded.+ let subscriptionToken = 0;++ const handleLevels: Listener = (next) => setLevels(next);++ const disconnect = () => {+ subscriptionToken++;+ currentGainNode = null;+ if (teardown) {+ teardown();+ teardown = null;+ }+ setLevels(ZERO_LEVELS);+ };++ const connect = async (gainNode: GainNode) => {+ if (currentGainNode === gainNode && teardown) return;++ disconnect();+ currentGainNode = gainNode;+ const token = ++subscriptionToken;++ const release = await subscribe(gainNode, handleLevels);++ // A newer connect()/disconnect() landed while we were awaiting — drop+ // this subscription instead of leaking it.+ if (token !== subscriptionToken) {+ release();+ return;+ }++ teardown = release;+ };++ onCleanup(disconnect);++ return { levels, connect, disconnect };+}++/**+ * AudioWorklet processor for volume metering.+ *+ * Computes per-channel RMS and peak values with smoothing and peak-hold,+ * all on the audio thread. Posts ready-to-display values to the main thread+ * via MessagePort so the UI just writes them into a signal.+ *+ * The processor is a pass-through — input is copied to output so it can be+ * inserted anywhere in the audio graph without affecting playback.+ */+function volumeMeterWorkletCode() {+ /* global AudioWorkletProcessor, registerProcessor, sampleRate */+ const SMOOTHING_DOWN = 0.85;+ const SMOOTHING_UP = 0.4;+ const PEAK_SMOOTHING_UP = 0.2;+ const PEAK_DECAY = 0.97;+ const MAX_CHANNELS = 2;++ class VolumeMeterProcessor extends AudioWorkletProcessor {+ private framesSinceLastPost = 0;+ private readonly updateInterval: number;++ // Per-channel smoothing state+ private smoothedRms: number[] = [0, 0];+ private smoothedPeak: number[] = [0, 0];+ private peakHoldValues: number[] = [0, 0];+ private peakHoldFrames: number[] = [0, 0];+ private readonly peakHoldDuration: number;++ constructor(options: { processorOptions?: { updateIntervalMs?: number; peakHoldMs?: number } }) {+ super();+ const ms = options.processorOptions?.updateIntervalMs ?? 16;+ this.updateInterval = Math.round((sampleRate * ms) / 1000);+ this.peakHoldDuration = Math.round((sampleRate * (options.processorOptions?.peakHoldMs ?? 600)) / 1000);+ }++ process(inputs: Float32Array[][], outputs: Float32Array[][]) {+ const input = inputs[0];+ if (!input || input.length === 0) return true;++ // Pass-through+ const output = outputs[0];+ for (let ch = 0; ch < input.length; ch++) {+ if (output[ch]) {+ output[ch].set(input[ch]);+ }+ }++ const blockSize = input[0].length;+ const channels = Math.min(input.length, MAX_CHANNELS);++ // Accumulate RMS and peak per block for smoothing+ for (let ch = 0; ch < channels; ch++) {+ const samples = input[ch];+ let sumSq = 0;+ let peak = 0;++ for (let i = 0; i < samples.length; i++) {+ const s = samples[i];+ sumSq += s * s;+ const abs = s < 0 ? -s : s;+ if (abs > peak) peak = abs;+ }++ const rawRms = Math.sqrt(sumSq / samples.length);++ // Smooth RMS (fast attack, slow release)+ const rmsFactor = rawRms > this.smoothedRms[ch] ? SMOOTHING_UP : SMOOTHING_DOWN;+ this.smoothedRms[ch] = this.smoothedRms[ch] * rmsFactor + rawRms * (1 - rmsFactor);++ // Peak hold with decay+ if (peak >= this.peakHoldValues[ch]) {+ this.peakHoldValues[ch] = peak;+ this.peakHoldFrames[ch] = 0;+ } else {+ this.peakHoldFrames[ch] += blockSize;+ if (this.peakHoldFrames[ch] > this.peakHoldDuration) {+ this.peakHoldValues[ch] *= PEAK_DECAY;+ }+ }++ // Smooth peak for display+ const peakFactor = peak > this.smoothedPeak[ch] ? PEAK_SMOOTHING_UP : SMOOTHING_DOWN;+ this.smoothedPeak[ch] = this.smoothedPeak[ch] * peakFactor + peak * (1 - peakFactor);+ }++ this.framesSinceLastPost += blockSize;++ if (this.framesSinceLastPost >= this.updateInterval) {+ this.framesSinceLastPost = 0;++ // Layout: [rms0, peak0, rms1, peak1, ...]+ const data = new Float32Array(channels * 2);+ for (let ch = 0; ch < channels; ch++) {+ data[ch * 2] = this.smoothedRms[ch];+ data[ch * 2 + 1] = this.smoothedPeak[ch];+ }++ this.port.postMessage(data);+ }++ return true;+ }+ }++ registerProcessor('volume-meter', VolumeMeterProcessor);+}++let workletUrl: string | null = null;++export function getVolumeMeterWorkletUrl(): string {+ if (!workletUrl) {+ const blob = new Blob(+ [`(${volumeMeterWorkletCode.toString()})()`],+ { type: 'application/javascript' },+ );+ workletUrl = URL.createObjectURL(blob);+ }+ return workletUrl;+}diff --git a/apps/web/src/index.css b/apps/web/src/index.cssnew file mode 100644index 00000000..8f956ca5--- /dev/null+++ b/apps/web/src/index.css@@ -0,0 +1,272 @@+@import "tailwindcss";+@import "tw-animate-css";++@custom-variant dark (&:is([data-kb-theme="dark"] *));++@font-face {+ font-family: 'Inter';+ src: url('./assets/fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype');+ font-weight: 100 900;+ font-stretch: normal;+ font-style: normal;+ font-optical-sizing: auto;+}++@font-face {+ font-family: 'Inter';+ src: url('./assets/fonts/Inter-Italic-VariableFont_opsz,wght.ttf') format('truetype');+ font-weight: 100 900;+ font-stretch: normal;+ font-style: italic;+ font-optical-sizing: auto;+}++@font-face {+ font-family: 'JetBrains Mono';+ src: url('./assets/fonts/JetBrainsMono-VariableFont.ttf') format('truetype');+ font-weight: 100 900;+ font-stretch: normal;+ font-style: normal;+ font-feature-settings: 'zero' 1;+}++@theme inline {+ --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";+ --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;+ --font-weight-strong: 450;+ --radius-xs: calc(var(--radius) - 4px);+ --radius-sm: calc(var(--radius) - 2px);+ --radius-md: var(--radius);+ --radius-lg: calc(var(--radius) + 2px);+ --radius-xl: 12px;+ --radius-xxl: 16px;+ --text-xxs: 10px;+ --text-xs: 11px;+ --text-lg: 18px;+ --color-canvas: var(--canvas);+ --color-background: var(--background);+ --color-foreground: var(--foreground);+ --color-card: var(--card);+ --color-card-foreground: var(--card-foreground);+ --color-popover: var(--popover);+ --color-popover-foreground: var(--popover-foreground);+ --color-primary: var(--primary);+ --color-primary-foreground: var(--primary-foreground);+ --color-secondary: var(--secondary);+ --color-secondary-foreground: var(--secondary-foreground);+ --color-secondary-hover: var(--secondary-hover);+ --color-secondary-pressing: var(--secondary-pressing);+ --color-tertiary: var(--tertiary);+ --color-tertiary-foreground: var(--tertiary-foreground);+ --color-tertiary-hover: var(--tertiary-hover);+ --color-tertiary-pressing: var(--tertiary-pressing);+ --color-muted: var(--muted);+ --color-muted-foreground: var(--muted-foreground);+ --color-disabled-foreground: var(--disabled-foreground);+ --color-accent: var(--accent);+ --color-accent-foreground: var(--accent-foreground);+ --color-primary-hover: var(--primary-hover);+ --color-primary-pressing: var(--primary-pressing);+ --color-destructive: var(--destructive);+ --color-destructive-hover: var(--destructive-hover);+ --color-destructive-pressing: var(--destructive-pressing);+ --color-destructive-accent: var(--destructive-accent);+ --color-destructive-accent-foreground: var(--destructive-accent-foreground);+ --color-success-accent: var(--success-accent);+ --color-success-accent-foreground: var(--success-accent-foreground);+ --color-border: var(--border);+ --color-input: var(--input);+ --color-ring: var(--ring);+ --color-surface: var(--surface);+ --color-surface-foreground: var(--surface-foreground);+ --color-code: var(--code);+ --color-code-foreground: var(--code-foreground);+ --color-code-highlight: var(--code-highlight);+ --color-code-number: var(--code-number);+ --color-selection: var(--selection);+ --color-selection-foreground: var(--selection-foreground);+ --color-inset: var(--inset);+ --color-overlay: var(--overlay);+ --color-overlay-soft: var(--overlay-soft);+ --color-meter-green: var(--meter-green);+ --color-meter-yellow: var(--meter-yellow);+ --color-meter-red: var(--meter-red);+ --color-meter-clip: var(--meter-clip);++ /** Timeline colors */+ --color-audio-background: hsla(168, 67%, 17%, 1);+ --color-audio-primary: hsla(162, 66%, 29%, 1);+ --color-caption-background: #5F254A;+ --color-caption-accent: rgba(207, 63, 149, 0.24);+}++:root {+ --radius: 6px;++ --text-xs: 10px;+ --text-sm: 11px;+ --text-base: 11px;+ --text-lg: 12px;+ --text-xl: 14px;+ --text-2xl: 16px;+ --text-3xl: 18px;+ --text-4xl: 20px;+ --text-5xl: 24px;+ --text-6xl: 32px;++ --canvas: hsla(0, 0%, 91%, 1);+ --background: hsla(0, 0%, 100%, 1);+ --foreground: hsla(240, 5%, 9%, 1);+ --card: hsla(0, 0%, 100%, 1);+ --card-foreground: hsla(240, 5%, 9%, 1);+ --popover: hsla(0, 0%, 95%, 1);+ --popover-foreground: hsla(240, 5%, 9%, 1);+ --primary: hsla(207, 100%, 50%, 1);+ --primary-foreground: hsla(0, 0%, 95%, 1);+ --primary-hover: hsla(207, 98%, 40%, 1);+ --primary-pressing: hsla(207, 99%, 35%, 1);+ --secondary: hsla(0, 0%, 95%, 1);+ --secondary-foreground: hsla(207, 100%, 90%, 1);+ --secondary-hover: hsla(0, 0%, 88%, 1);+ --secondary-pressing: hsla(0, 0%, 40%, 1);+ --tertiary: hsla(207, 100%, 50%, 1);+ --tertiary-foreground: hsla(207, 100%, 90%, 1);+ --tertiary-hover: hsla(207, 80%, 40%, 1);+ --tertiary-pressing: hsla(207, 80%, 35%, 1);+ --muted: hsla(0, 0%, 91%, 1);+ --muted-foreground: hsla(0, 0%, 45%, 1);+ --disabled-foreground: hsla(0, 0%, 40%, 1);+ --accent: hsla(0, 0%, 95%, 1);+ --accent-foreground: hsla(0, 0%, 45%, 1);+ --destructive: hsla(0, 79%, 54%, 1);+ --destructive-foreground: hsla(0, 0%, 100%, 1);+ --destructive-hover: hsla(0, 60%, 40%, 1);+ --destructive-pressing: hsla(0, 53%, 27%, 1);+ --destructive-accent: hsla(0, 79%, 54%, 0.24);+ --destructive-accent-foreground: hsla(0, 78%, 95%, 1);+ --success-accent: hsla(162, 66%, 29%, 0.24);+ --success-accent-foreground: hsla(162, 84%, 89%, 1);+ --border: hsla(0, 0%, 91%, 1);+ --border-input: hsla(0, 0%, 88%, 1);+ --border-darker: hsla(0, 0%, 95%, 1);+ --input: hsla(0, 0%, 95%, 1);+ --ring: hsla(207, 100%, 50%, 1);+ --canvas: hsla(0, 0%, 91%, 1);+ --overlay: hsla(0, 0%, 9%, 0.7);+ --overlay-soft: hsla(0, 0%, 9%, 0.4);+ --selection: hsla(207, 100%, 50%, 1);+ --selection-foreground: hsla(207, 100%, 90%, 1);+ --selection-muted-foreground: hsla(0, 0%, 45%, 1);+ --inset: hsla(0, 0%, 85%, 1);+ --meter-green: hsla(125, 85%, 57%, 1);+ --meter-yellow: hsla(46, 90%, 62%, 1);+ --meter-red: hsla(1, 90%, 62%, 1);+ --meter-clip: hsla(60, 100%, 50%, 1);+}++[data-kb-theme="dark"] {+ --canvas: hsla(0, 0%, 9%, 1);+ --background: hsla(0, 0%, 11%, 1);+ --foreground: hsla(0, 0%, 95%, 1);+ --card: hsla(0, 0%, 11%, 1);+ --card-foreground: hsla(0, 0%, 95%, 1);+ --popover: hsla(0, 0%, 9%, 1);+ --popover-foreground: hsla(0, 0%, 95%, 1);+ --primary: hsla(207, 100%, 50%, 1);+ --primary-foreground: hsla(0, 0%, 95%, 1);+ --primary-hover: hsla(207, 98%, 29%, 1);+ --primary-pressing: hsla(207, 99%, 22%, 1);+ --secondary: hsla(0, 0%, 16%, 1);+ --secondary-foreground: hsla(0, 0%, 95%, 1);+ --secondary-hover: hsla(0, 0%, 25%, 1);+ --secondary-pressing: hsla(0, 0%, 40%, 1);+ --tertiary: hsla(207, 99%, 22%, 1);+ --tertiary-foreground: hsla(207, 100%, 90%, 1);+ --tertiary-hover: hsla(207, 80%, 17%, 1);+ --tertiary-pressing: hsla(207, 80%, 14%, 1);+ --muted: hsla(0, 0%, 25%, 1);+ --muted-foreground: hsla(0, 0%, 62%, 1);+ --disabled-foreground: hsla(0, 0%, 40%, 1);+ --accent: hsla(0, 0%, 16%, 1);+ --accent-foreground: hsla(0, 0%, 62%, 1);+ --destructive: hsla(0, 79%, 54%, 1);+ --destructive-foreground: hsla(0, 0%, 100%, 1);+ --destructive-hover: hsla(0, 60%, 40%, 1);+ --destructive-pressing: hsla(0, 53%, 27%, 1);+ --destructive-accent: hsla(0, 79%, 54%, 0.24);+ --destructive-accent-foreground: hsla(0, 78%, 95%, 1);+ --success-accent: hsla(162, 66%, 29%, 0.24);+ --success-accent-foreground: hsla(162, 84%, 89%, 1);+ --border: hsla(0, 0%, 15%, 1);+ --border-input: hsla(0, 0%, 25%, 1);+ --border-darker: hsla(0, 0%, 11%, 1);+ --input: hsla(0, 0%, 16%, 1);+ --ring: hsla(207, 100%, 50%, 1);+ --canvas: hsla(0, 0%, 9%, 1);+ --overlay: hsla(0, 0%, 9%, 0.7);+ --overlay-soft: hsla(0, 0%, 9%, 0.4);+ --selection: hsla(207, 99%, 22%, 1);+ --selection-foreground: hsla(207, 100%, 90%, 1);+ --selection-muted-foreground: hsla(0, 0%, 16%, 1);+ --inset: hsla(0, 0%, 25%, 1);+ --meter-green: hsla(125, 85%, 57%, 1);+ --meter-yellow: hsla(46, 90%, 62%, 1);+ --meter-red: hsla(1, 90%, 62%, 1);+ --meter-clip: hsla(60, 100%, 50%, 1);+}++@layer base {+ * {+ @apply border-border outline-ring/50 select-none;++ /* Hide scrollbars (keep scroll behavior) until we add custom styling. */+ scrollbar-width: none;+ -ms-overflow-style: none;++ /* disables things like pull-to-refresh and overscroll effects */+ /* overscroll-behavior: none; */+ }++ *::-webkit-scrollbar {+ width: 0;+ height: 0;+ }++ ::selection {+ background-color: var(--color-selection);+ color: var(--color-selection-foreground);+ }++ body {+ @apply bg-background text-foreground font-sans;+ }++ input[type="number"]::-webkit-inner-spin-button,+ input[type="number"]::-webkit-outer-spin-button {+ -webkit-appearance: none;+ margin: 0;+ }++ button {+ @apply cursor-default;+ }+}++@layer utilities {+ .focus-ring:focus-visible,+ .focus-ring[data-dragging='true'] {+ border-color: var(--ring);+ box-shadow: inset 0 0 0 1px var(--ring);+ outline: none;+ transition:+ box-shadow 0.2s,+ outline 0.2s,+ border 0.2s;+ }+}++@media (max-width: 1023px), (max-height: 639px) {+ .screen-too-small {+ display: flex;+ }+}diff --git a/apps/web/src/index.tsx b/apps/web/src/index.tsxnew file mode 100644index 00000000..74ae7815--- /dev/null+++ b/apps/web/src/index.tsx@@ -0,0 +1,37 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/* @refresh reload */+import * as Sentry from '@sentry/solid'+import { render } from 'solid-js/web'+import './index.css'+import App from './app'+import { initAnalytics } from './lib/analytics'+import { restoreLastRoute } from './lib/persist-route'++if (import.meta.env.PROD) {+ Sentry.init({+ dsn: 'https://5786931d60606166d379cd2405683cb1@o4511326229889024.ingest.us.sentry.io/4511326232903680',+ sendDefaultPii: true,+ release: APP_VERSION,+ environment: 'production',+ })+}++document.addEventListener('contextmenu', (e) => e.preventDefault())++if (window.desktop) {+ const origRequest = FileSystemHandle.prototype.requestPermission;+ FileSystemHandle.prototype.queryPermission = function (desc) {+ return origRequest.call(this, desc);+ };++ restoreLastRoute();+}++initAnalytics()++const root = document.getElementById('root')++render(() => <App />, root!)diff --git a/apps/web/src/init.ts b/apps/web/src/init.tsnew file mode 100644index 00000000..89d2b0c8--- /dev/null+++ b/apps/web/src/init.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Store } from "@/lib/store";++export const store = new Store('dspro.ui');diff --git a/apps/web/src/lib/analytics.ts b/apps/web/src/lib/analytics.tsnew file mode 100644index 00000000..080fc1f9--- /dev/null+++ b/apps/web/src/lib/analytics.ts@@ -0,0 +1,77 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Umami analytics wrapper. Loads the Umami script lazily and exposes+ * type-safe `track` / `identify` helpers that no-op when Umami is+ * disabled (env vars unset) or has not finished loading yet.+ *+ * Pageviews and SPA route changes are auto-tracked by the Umami script+ * via the History API — call `track` only for custom product events.+ */++type UmamiEventData = Record<string, string | number | boolean | undefined>;++type UmamiClient = {+ track: (event?: string | UmamiEventData, data?: UmamiEventData) => void;+ identify: (data: UmamiEventData) => void;+};++declare global {+ interface Window {+ umami?: UmamiClient;+ }+}++const websiteId = import.meta.env.VITE_UMAMI_WEBSITE_ID ?? '';+const scriptUrl = import.meta.env.VITE_UMAMI_SCRIPT_URL ?? '';+const domains = import.meta.env.VITE_UMAMI_DOMAINS ?? '';++let initialized = false;++export function initAnalytics(): void {+ if (initialized) return;+ initialized = true;++ const script = document.createElement("script");+ script.async = true;+ script.defer = true;+ script.src = scriptUrl;+ script.setAttribute("data-website-id", websiteId);+ script.setAttribute("data-domains", domains);+ script.setAttribute("data-tag", "web-app-v1");+ script.setAttribute("data-performance", "true");+ document.head.appendChild(script);+}++/** Drop undefined entries — Umami rejects payloads with `undefined` values. */+function clean(data?: UmamiEventData): UmamiEventData | undefined {+ if (!data) return undefined;+ const out: UmamiEventData = {};+ for (const k in data) {+ const v = data[k];+ if (v !== undefined) {+ out[k] = v+ };+ }+ return out;+}++export function track(event: string, data?: UmamiEventData): void {+ const payload = clean(data);+ if (payload) {+ window.umami?.track(event, payload);+ } else {+ window.umami?.track(event);+ }+}++export function identify(userId: string, traits?: UmamiEventData): void {+ const payload = clean(traits);+ window.umami?.identify({ id: userId, ...(payload ?? {}) });+}++export function resetIdentity(): void {+ window.umami?.identify({});+}diff --git a/apps/web/src/lib/call-handler.ts b/apps/web/src/lib/call-handler.tsnew file mode 100644index 00000000..6a0f473a--- /dev/null+++ b/apps/web/src/lib/call-handler.ts@@ -0,0 +1,28 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// https://github.com/kobaltedev/kobalte/blob/main/packages/utils/src/assertion.ts+// https://github.com/kobaltedev/kobalte/blob/main/packages/utils/src/events.ts++import type { JSX } from "solid-js"++// Function assertions+export const isFunction = (value: unknown): value is Function =>+ typeof value === "function"++/** Call a JSX.EventHandlerUnion with the event. */+export const callHandler = <T, E extends Event>(+ event: E & { currentTarget: T; target: Element },+ handler: JSX.EventHandlerUnion<T, E> | undefined,+) => {+ if (handler) {+ if (isFunction(handler)) {+ handler(event)+ } else {+ handler[0](handler[1], event)+ }+ }++ return event.defaultPrevented+}diff --git a/apps/web/src/lib/checkout.ts b/apps/web/src/lib/checkout.tsnew file mode 100644index 00000000..e0ecc7ba--- /dev/null+++ b/apps/web/src/lib/checkout.ts@@ -0,0 +1,119 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { TRPCClientError } from "@trpc/client";+import { toast } from "somoto";+import type {+ BillingPeriod,+ SubscriptionCredits,+ TopupCredits,+} from "@diffusionstudio/api-contract";++import { trpc } from "./trpc";++function toastMessage(err: unknown, fallback: string): string {+ // Empty / non-JSON 500 bodies (e.g. upstream crashed before tRPC could+ // serialize the error) surface as a SyntaxError — not useful to display.+ if (err instanceof TRPCClientError && err.cause instanceof SyntaxError) {+ return fallback;+ }+ return err instanceof Error ? err.message : fallback;+}++export const CREDIT_RATE = 0.01;+export const ANNUAL_DISCOUNT = 0.24;++export const SUBSCRIPTION_VOLUME_DISCOUNT: Record<SubscriptionCredits, number> = {+ "2_500": 0,+ "5_000": 0,+ "15_000": 0.1,+ "30_000": 0.15,+ "45_000": 0.2,+};++export const TOPUP_MARKUP: Record<TopupCredits, number> = {+ "1_000": 0.2,+ "2_000": 0.1,+ "5_000": 0,+ "10_000": 0,+ "25_000": 0,+};++export const SUBSCRIPTION_CREDIT_TIERS = Object.keys(+ SUBSCRIPTION_VOLUME_DISCOUNT,+) as SubscriptionCredits[];++export const TOPUP_CREDIT_TIERS = Object.keys(TOPUP_MARKUP) as TopupCredits[];++function parseCredits(tier: string): number {+ return parseInt(tier.replace("_", ""), 10);+}++/** Monthly display price (USD) for a subscription tier. */+export function getSubscriptionPrice(+ tier: SubscriptionCredits,+ billing: BillingPeriod,+): number {+ const credits = parseCredits(tier);+ const discount = SUBSCRIPTION_VOLUME_DISCOUNT[tier];+ let price = credits * CREDIT_RATE * (1 - discount);+ if (billing === "year") price *= 1 - ANNUAL_DISCOUNT;+ return Math.round(price);+}++/** One-time topup price (USD) for a topup tier. */+export function getTopupPrice(tier: TopupCredits): number {+ const credits = parseCredits(tier);+ const markup = TOPUP_MARKUP[tier];+ return Math.round(credits * CREDIT_RATE * (1 + markup));+}++function successAndCancelUrls(): { successUrl: string; cancelUrl: string } {+ const cancelUrl = window.location.href;+ const success = new URL(window.location.href);+ success.searchParams.set("checkout", "success");+ return { successUrl: success.toString(), cancelUrl };+}++export async function startSubscriptionCheckout(input: {+ creditQuantity: SubscriptionCredits;+ billingPeriod: BillingPeriod;+}): Promise<void> {+ try {+ const { url } = await trpc.createSubscription.mutate({+ ...input,+ ...successAndCancelUrls(),+ });+ window.location.href = url;+ } catch (err) {+ toast.error(toastMessage(err, "Checkout failed"));+ }+}++export async function startTopupCheckout(+ creditQuantity: TopupCredits,+): Promise<void> {+ try {+ const { url } = await trpc.createTopup.mutate({+ creditQuantity,+ ...successAndCancelUrls(),+ });+ window.location.href = url;+ } catch (err) {+ toast.error(toastMessage(err, "Checkout failed"));+ }+}++export async function openBillingPortal(): Promise<void> {+ const tab = window.open("", "_blank");+ if (!tab) return;++ try {+ const { url } = await trpc.createBillingPortal.mutate();+ tab.location.href = url;+ } catch (err) {+ tab.close();+ toast.error(toastMessage(err, "Failed to open billing portal"));+ }+}diff --git a/apps/web/src/lib/combine-style.ts b/apps/web/src/lib/combine-style.tsnew file mode 100644index 00000000..a7a8ccc2--- /dev/null+++ b/apps/web/src/lib/combine-style.ts@@ -0,0 +1,42 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// https://github.com/solidjs-community/solid-primitives/blob/main/packages/props/src/combineProps.ts++import type { JSX } from "solid-js"++const extractCSSregex = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g++export function stringStyleToObject(style: string): JSX.CSSProperties {+ const object: Record<string, string> = {}+ let match: RegExpExecArray | null+ while ((match = extractCSSregex.exec(style))) {+ object[match[1]] = match[2]+ }+ return object+}++export function combineStyle(a: string, b: string): string+export function combineStyle(+ a: JSX.CSSProperties | undefined,+ b: JSX.CSSProperties | undefined,+): JSX.CSSProperties+export function combineStyle(+ a: JSX.CSSProperties | string | undefined,+ b: JSX.CSSProperties | string | undefined,+): JSX.CSSProperties+export function combineStyle(+ a: JSX.CSSProperties | string | undefined,+ b: JSX.CSSProperties | string | undefined,+): JSX.CSSProperties | string {+ if (typeof a === "string") {+ if (typeof b === "string") return `${a};${b}`++ a = stringStyleToObject(a)+ } else if (typeof b === "string") {+ b = stringStyleToObject(b)+ }++ return { ...a, ...b }+}diff --git a/apps/web/src/lib/cva.ts b/apps/web/src/lib/cva.tsnew file mode 100644index 00000000..c5581a5f--- /dev/null+++ b/apps/web/src/lib/cva.ts@@ -0,0 +1,12 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { defineConfig } from "cva"+import { twMerge } from "tailwind-merge"++export const { cva, cx, compose } = defineConfig({+ hooks: {+ onComplete: (className) => twMerge(className),+ },+});diff --git a/apps/web/src/lib/electron-file-handle.ts b/apps/web/src/lib/electron-file-handle.tsnew file mode 100644index 00000000..0895d17b--- /dev/null+++ b/apps/web/src/lib/electron-file-handle.ts@@ -0,0 +1,110 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { mainBridge } from "@/lib/ipc";+import { MAIN_CHANNELS } from "@desktop/main-channels";++const INPUT_ID = "__electron-file-import-input__";+const INPUT_SELECTOR = `#${INPUT_ID}`;++export type SerializedElectronFileHandle = {+ kind: "electron-file";+ path: string;+ name: string;+};++let hiddenInput: HTMLInputElement | null = null;+let inFlight: Promise<unknown> = Promise.resolve();++function basename(path: string): string {+ const idx = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));+ return idx === -1 ? path : path.slice(idx + 1);+}++function getHiddenInput(): HTMLInputElement {+ if (hiddenInput && document.body.contains(hiddenInput)) return hiddenInput;+ const input = document.createElement("input");+ input.type = "file";+ input.id = INPUT_ID;+ input.style.position = "fixed";+ input.style.left = "-10000px";+ input.style.top = "-10000px";+ input.style.width = "1px";+ input.style.height = "1px";+ input.style.opacity = "0";+ input.style.pointerEvents = "none";+ input.tabIndex = -1;+ input.setAttribute("aria-hidden", "true");+ document.body.appendChild(input);+ hiddenInput = input;+ return input;+}++async function materializeFile(absolutePath: string): Promise<File> {+ if (!window.desktop) {+ throw new Error("ElectronFileHandle requires the desktop bridge");+ }+ const input = getHiddenInput();+ await mainBridge.call(MAIN_CHANNELS.FILE_TRANSFER, {+ selector: INPUT_SELECTOR,+ absolutePath,+ });+ const file = input.files?.[0];+ // Reset so subsequent reads of `input.files[0]` aren't ambiguous if a+ // caller forgets to serialize through `inFlight`.+ input.value = "";+ if (!file) {+ throw new Error(`Failed to materialize file: ${absolutePath}`);+ }+ return file;+}++export class ElectronFileHandle {+ readonly kind = "file" as const;+ readonly name: string;+ readonly path: string;++ constructor(path: string, name?: string) {+ this.path = path;+ this.name = name ?? basename(path);+ }++ async getFile(): Promise<File> {+ // Serialize CDP round-trips: every call shares the same hidden input, and+ // overlapping setFiles() calls would race on `input.files[0]`.+ const next = inFlight.then(() => materializeFile(this.path));+ inFlight = next.catch(() => {});+ return next;+ }++ // FileSystemFileHandle shape — ElectronFileHandle is always "granted" because+ // the main process has full disk access.+ async queryPermission(_descriptor?: any): Promise<PermissionState> {+ return "granted";+ }++ async requestPermission(_descriptor?: any): Promise<PermissionState> {+ return "granted";+ }++ toJSON(): SerializedElectronFileHandle {+ return { kind: "electron-file", path: this.path, name: this.name };+ }+}++export function isSerializedElectronFileHandle(+ value: unknown+): value is SerializedElectronFileHandle {+ return (+ typeof value === "object" &&+ value !== null &&+ (value as { kind?: unknown }).kind === "electron-file"+ );+}++export function rehydrateElectronFileHandle(+ value: SerializedElectronFileHandle+): ElectronFileHandle {+ return new ElectronFileHandle(value.path, value.name);+}diff --git a/apps/web/src/lib/electron-file-writable.ts b/apps/web/src/lib/electron-file-writable.tsnew file mode 100644index 00000000..c6c2ecf6--- /dev/null+++ b/apps/web/src/lib/electron-file-writable.ts@@ -0,0 +1,58 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { mainBridge } from "@/lib/ipc";+import { MAIN_CHANNELS } from "@desktop/main-channels";++import type { StreamTargetChunk } from "mediabunny";+import type { WritableFileTarget } from "@/components/engine/encode/types";++// A write-only, FileSystemFileHandle-shaped target backed by the main process.+// `createWritable()` returns a stream whose positioned chunks are forwarded to+// main and written to disk via an open fd — letting mediabunny's StreamTarget+// stream encoder output straight to a path without buffering the whole file in+// the renderer. Desktop only (relies on the main bridge).+export class ElectronWritableFileHandle implements WritableFileTarget {+ readonly path: string;+ // Tracks the in-flight write so callers can abort + clean up a partial file+ // on error paths mediabunny doesn't surface through the stream itself.+ private openId: string | null = null;++ constructor(path: string) {+ this.path = path;+ }++ async createWritable(opts?: { exclusive?: boolean }): Promise<WritableStream<StreamTargetChunk>> {+ const { id } = await mainBridge.call(MAIN_CHANNELS.FILE_WRITE_OPEN, {+ ...opts,+ path: this.path,+ });+ this.openId = id;++ return new WritableStream<StreamTargetChunk>({+ write: (chunk) =>+ mainBridge.call(MAIN_CHANNELS.FILE_WRITE_CHUNK, {+ id,+ data: chunk.data,+ position: chunk.position,+ }),+ close: async () => {+ this.openId = null;+ await mainBridge.call(MAIN_CHANNELS.FILE_WRITE_CLOSE, { id });+ },+ abort: async () => {+ this.openId = null;+ await mainBridge.call(MAIN_CHANNELS.FILE_WRITE_ABORT, { id });+ },+ });+ }++ // Close + delete the partial file if a write is still open (error cleanup).+ async dispose(): Promise<void> {+ const id = this.openId;+ if (id === null) return;+ this.openId = null;+ await mainBridge.call(MAIN_CHANNELS.FILE_WRITE_ABORT, { id });+ }+}diff --git a/apps/web/src/lib/ipc.ts b/apps/web/src/lib/ipc.tsnew file mode 100644index 00000000..ef5f74fa--- /dev/null+++ b/apps/web/src/lib/ipc.ts@@ -0,0 +1,164 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { MAIN_WIRE } from "@desktop/main-channels";+import type {+ MainEvent,+ MainEventChannel,+ MainEventMap,+ MainReply,+ MainRequest,+ MainRequestChannel,+ MainRequestMap,+} from "@desktop/main-channels";+import { CLI_CHANNELS, CLI_WIRE } from "@diffusionstudio/cli/channels";+import type {+ CliReply,+ CliRequest,+ CliRequestChannel,+ CliRequestMap,+} from "@diffusionstudio/cli/channels";++type EventHandler<C extends MainEventChannel> = (data: MainEventMap[C]) => void;++type CliHandler<C extends CliRequestChannel> = (+ data: CliRequestMap[C]["request"],+) => CliRequestMap[C]["response"] | Promise<CliRequestMap[C]["response"]>;++type Pending = {+ resolve: (value: unknown) => void;+ reject: (error: Error) => void;+};++// Renderer↔main bridge. Symmetric with cliBridge: `handle` registers a+// single-subscriber receiver for inbound channels (events from main); `call`+// sends a request to main and awaits the reply.+class MainBridge {+ private pending = new Map<string, Pending>();+ private eventHandlers = new Map<MainEventChannel, EventHandler<MainEventChannel>>();+ private bound = false;++ private bind(): void {+ if (this.bound || !window.desktop) return;+ this.bound = true;++ window.desktop.on(MAIN_WIRE.RESPONSE, (payload) => {+ const reply = payload as MainReply;+ const entry = this.pending.get(reply.id);+ if (!entry) return;+ this.pending.delete(reply.id);+ if (reply.ok) entry.resolve(reply.data);+ else entry.reject(new Error(reply.error));+ });++ window.desktop.on(MAIN_WIRE.EVENT, (payload) => {+ const envelope = payload as MainEvent;+ const handler = this.eventHandlers.get(envelope.channel);+ if (!handler) return;+ try {+ handler(envelope.data as never);+ } catch (err) {+ console.error(`[main-bridge] handler for ${envelope.channel} threw`, err);+ }+ });+ }++ call<C extends MainRequestChannel>(+ channel: C,+ data: MainRequestMap[C]["request"],+ ): Promise<MainRequestMap[C]["response"]> {+ if (!window.desktop) {+ return Promise.reject(new Error("Main bridge unavailable: not running in desktop"));+ }+ this.bind();+ const id = crypto.randomUUID();+ const envelope: MainRequest = { id, channel, data };+ return new Promise((resolve, reject) => {+ this.pending.set(id, {+ resolve: resolve as (value: unknown) => void,+ reject,+ });+ window.desktop!.send(MAIN_WIRE.REQUEST, envelope);+ });+ }++ handle<C extends MainEventChannel>(channel: C, handler: EventHandler<C>): () => void {+ if (!window.desktop) return () => {};+ this.bind();+ const stored = handler as EventHandler<MainEventChannel>;+ this.eventHandlers.set(channel, stored);+ return () => {+ if (this.eventHandlers.get(channel) === stored) {+ this.eventHandlers.delete(channel);+ }+ };+ }+}++export const mainBridge = new MainBridge();++// CLI bridge — answers forwarded CLI requests. Main is opaque to channel names+// here; it just delivers FORWARD_REQ envelopes and routes our FORWARD_REPLY+// back to the originating socket by id. Requests for channels whose handler+// isn't registered yet are queued per-channel and drained on the first+// `handle()` call — this is how we wait for handlers that mount lazily+// (e.g. asset/project handlers that only register after sign-in) without an+// explicit ready signal.+class CliBridge {+ private handlers = new Map<CliRequestChannel, CliHandler<CliRequestChannel>>();+ private queue = new Map<CliRequestChannel, CliRequest[]>();++ constructor() {+ // Built-in: lets `waitForCliSocket` probe the round-trip without depending+ // on any app-level handler being registered.+ this.handlers.set(CLI_CHANNELS.PING, (() => undefined) as CliHandler<CliRequestChannel>);++ // Bind eagerly so FORWARD_REQ arrivals during page bootstrap are caught+ // rather than silently dropped before any handler registers.+ if (window.desktop) {+ window.desktop.on(CLI_WIRE.FORWARD_REQ, (payload) => {+ void this.dispatch(payload as CliRequest);+ });+ }+ }++ private async dispatch(req: CliRequest): Promise<void> {+ const handler = this.handlers.get(req.channel);+ if (!handler) {+ let q = this.queue.get(req.channel);+ if (!q) {+ q = [];+ this.queue.set(req.channel, q);+ }+ q.push(req);+ return;+ }+ let reply: CliReply;+ try {+ const data = await handler(req.data as never);+ reply = { id: req.id, ok: true, data };+ } catch (err) {+ reply = { id: req.id, ok: false, error: (err as Error).message };+ }+ window.desktop?.send(CLI_WIRE.FORWARD_REPLY, reply);+ }++ handle<C extends CliRequestChannel>(channel: C, handler: CliHandler<C>): () => void {+ if (!window.desktop) return () => {};+ const stored = handler as unknown as CliHandler<CliRequestChannel>;+ this.handlers.set(channel, stored);+ const queued = this.queue.get(channel);+ if (queued) {+ this.queue.delete(channel);+ for (const req of queued) void this.dispatch(req);+ }+ return () => {+ if (this.handlers.get(channel) === stored) {+ this.handlers.delete(channel);+ }+ };+ }+}++export const cliBridge = new CliBridge();diff --git a/apps/web/src/lib/layout-presets.ts b/apps/web/src/lib/layout-presets.tsnew file mode 100644index 00000000..599f10b2--- /dev/null+++ b/apps/web/src/lib/layout-presets.ts@@ -0,0 +1,70 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export type LayoutPreset = {+ label: string;+ width: number;+ height: number;+};++export type LayoutPresetCategory = {+ id: string;+ label: string;+ icon: string;+ items: LayoutPreset[];+};++export const PRESET_CATEGORIES: LayoutPresetCategory[] = [+ {+ id: "video",+ label: "Video",+ icon: "video",+ items: [+ { label: "Short-form 9:16", width: 1080, height: 1920 },+ { label: "Long-form 16:9", width: 1920, height: 1080 },+ { label: "Square video 1:1", width: 1080, height: 1080 },+ { label: "Vertical post 4:5", width: 1080, height: 1350 },+ ],+ },+ {+ id: "cinematic",+ label: "Cinematic",+ icon: "film-video-export",+ items: [+ { label: "Ultrawide 21:9", width: 1920, height: 823 },+ { label: "CinemaScope 2.39:1", width: 1920, height: 803 },+ { label: "DCI 4K 17:9", width: 4096, height: 2160 },+ { label: "Anamorphic 2.00:1", width: 1920, height: 960 },+ ],+ },+ {+ id: "social",+ label: "Social",+ icon: "context",+ items: [+ { label: "Instagram post", width: 1080, height: 1350 },+ { label: "Twitter / X post", width: 1200, height: 675 },+ { label: "LinkedIn post", width: 1200, height: 628 },+ { label: "Facebook post", width: 1200, height: 630 },+ ],+ },+ {+ id: "device",+ label: "Device (Preview)",+ icon: "mac-device",+ items: [+ { label: "iPhone 16", width: 393, height: 852 },+ { label: "iPhone 17", width: 402, height: 874 },+ { label: "iPhone 16 Plus / Max", width: 430, height: 932 },+ { label: "iPhone 17 Pro Max", width: 440, height: 956 },+ { label: "Android", width: 412, height: 917 },+ { label: "iPad", width: 834, height: 1194 },+ { label: "Laptop", width: 1440, height: 900 },+ { label: "Desktop", width: 1440, height: 1024 },+ ],+ },+];++/** Flat list of all layout presets for quick lookup. */+export const ALL_PRESETS: LayoutPreset[] = PRESET_CATEGORIES.flatMap((g) => g.items);diff --git a/apps/web/src/lib/persist-route.tsx b/apps/web/src/lib/persist-route.tsxnew file mode 100644index 00000000..a3ed9a94--- /dev/null+++ b/apps/web/src/lib/persist-route.tsx@@ -0,0 +1,57 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createEffect } from "solid-js";+import { useLocation } from "@solidjs/router";+import { store } from "@/init";++const ROUTE_KEY = "last-route";++// Query params that trigger one-shot UI (dialogs) and must not replay on relaunch.+const TRANSIENT_PARAMS = ["checkout"];++function sanitizeRoute(route: string): string | null {+ if (!route || route.startsWith("/auth/")) return null;++ const [path = "/", query = ""] = route.split("?");+ const params = new URLSearchParams(query);++ for (const param of TRANSIENT_PARAMS) {+ params.delete(param);+ }++ const qs = params.toString();+ return qs ? `${path}?${qs}` : path;+}++/**+ * Desktop loads index.html with a bare URL on every launch, so unlike the+ * browser the hash route (and the ?project= param inside it) is lost across+ * restarts. Restores the last saved route at boot — call before the router+ * mounts.+ */+export function restoreLastRoute() {+ if (window.location.hash) return;+ const saved = store.get<string>(ROUTE_KEY);+ if (saved) window.location.hash = saved;+}++/**+ * Keeps the saved route in sync with router navigation. HashRouter navigates+ * via pushState, which fires no hashchange event, so this has to live inside+ * the router tree. Desktop only.+ */+export function PersistRoute() {+ const location = useLocation();++ createEffect(() => {+ if (!window.desktop) return;+ const route = sanitizeRoute(location.pathname + location.search);+ if (route) {+ store.set(ROUTE_KEY, route);+ }+ });++ return null;+}diff --git a/apps/web/src/lib/store/index.ts b/apps/web/src/lib/store/index.tsnew file mode 100644index 00000000..4a140eac--- /dev/null+++ b/apps/web/src/lib/store/index.ts@@ -0,0 +1,7 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from './store';+export * from './storage-item';+export * from './signal';diff --git a/apps/web/src/lib/store/signal.ts b/apps/web/src/lib/store/signal.tsnew file mode 100644index 00000000..45d9c331--- /dev/null+++ b/apps/web/src/lib/store/signal.ts@@ -0,0 +1,20 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal } from 'solid-js';++import type { StorageItem } from '@/lib/store';++export function createStoredSignal<S>(storageItem: StorageItem<S>) {+ const [value, setValue] = createSignal<S>(storageItem.value);++ const updateValue = (newValue: S) => {+ if (newValue === value()) return;++ setValue(() => newValue);+ storageItem.value = newValue;+ };++ return [value, updateValue] as const;+}diff --git a/apps/web/src/lib/store/storage-item.ts b/apps/web/src/lib/store/storage-item.tsnew file mode 100644index 00000000..dfc06023--- /dev/null+++ b/apps/web/src/lib/store/storage-item.ts@@ -0,0 +1,41 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { Store } from './store';++export class StorageItem<T> {+ private _key: string;+ private _value: T | undefined;+ private _store: Store;++ public loaded = false;++ public constructor(store: Store, key: string, value: T | Promise<T>) {+ this._store = store;+ this._key = key;+ this.initValue(value);+ }++ public get key(): string {+ return this._key;+ }++ public get value(): T {+ return this._value!;+ }++ public set value(newValue: T) {+ this._value = newValue;+ this._store.set(this._key, newValue);+ }++ private async initValue(value: T | Promise<T>) {+ if (value instanceof Promise) {+ this._value = await value;+ } else {+ this._value = value;+ }+ this.loaded = true;+ }+}diff --git a/apps/web/src/lib/store/store.ts b/apps/web/src/lib/store/store.tsnew file mode 100644index 00000000..d7d386b9--- /dev/null+++ b/apps/web/src/lib/store/store.ts@@ -0,0 +1,61 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { StorageItem } from './storage-item';++export type Deserializer<T> = (data: any) => Promise<T> | T;++export class Store {+ public readonly storageEngine: Storage;+ public readonly namespace?: string;++ public constructor(namespace?: string, storageEngine = localStorage) {+ this.storageEngine = storageEngine;+ this.namespace = namespace;+ }++ public define<T>(key: string, defaultValue: T, deserializer?: Deserializer<T>): StorageItem<T> {+ const storedValue = this.get<T>(key);++ if (storedValue === null) {+ this.set(key, defaultValue);+ return new StorageItem<T>(this, key, defaultValue);+ }+ if (deserializer && storedValue != undefined) {+ return new StorageItem<T>(this, key, deserializer(storedValue));+ }++ return new StorageItem<T>(this, key, storedValue);+ }++ public set<T>(key: string, value: T): void {+ this.storageEngine.setItem(+ this.getStorageId(key),+ JSON.stringify({+ value: value,+ }),+ );+ }++ public get<T>(key: string): T | null {+ const item = this.storageEngine.getItem(this.getStorageId(key));++ if (item) {+ return JSON.parse(item).value as T;+ }++ return null;+ }++ public remove(key: string): void {+ this.storageEngine.removeItem(this.getStorageId(key));+ }++ private getStorageId(key: string): string {+ if (this.namespace) {+ return `${this.namespace}.${key}`;+ }+ return key;+ }+}diff --git a/apps/web/src/lib/supabase.ts b/apps/web/src/lib/supabase.tsnew file mode 100644index 00000000..b7cee48e--- /dev/null+++ b/apps/web/src/lib/supabase.ts@@ -0,0 +1,25 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createClient, type SupabaseClient } from '@supabase/supabase-js';++const supabaseUrl = import.meta.env.VITE_SUPABASE_URL as string | undefined;+const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY as string | undefined;++function initSupabase(): SupabaseClient | null {+ if (!supabaseUrl || !supabaseAnonKey) {+ console.warn('[supabase] VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY are not set. Auth is disabled.');+ return null;+ }++ return createClient(supabaseUrl, supabaseAnonKey, {+ auth: {+ flowType: 'pkce',+ persistSession: true,+ autoRefreshToken: true,+ },+ });+}++export const supabase = initSupabase();diff --git a/apps/web/src/lib/trpc.ts b/apps/web/src/lib/trpc.tsnew file mode 100644index 00000000..efb662a9--- /dev/null+++ b/apps/web/src/lib/trpc.ts@@ -0,0 +1,39 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createTRPCClient, httpBatchLink, TRPCClientError, type TRPCLink } from "@trpc/client";+import { observable } from "@trpc/server/observable";+import { supabase } from "./supabase";+import { showUpgradeDialog } from "@/components/upgrade-dialog";++import type { AppRouter } from "@diffusionstudio/api-contract";++const paymentRequiredLink: TRPCLink<AppRouter> = () => ({ next, op }) =>+ observable((observer) => {+ const sub = next(op).subscribe({+ next: (value) => observer.next(value),+ error: (err) => {+ if (err instanceof TRPCClientError && err.data?.code === "PAYMENT_REQUIRED") {+ showUpgradeDialog();+ }+ observer.error(err);+ },+ complete: () => observer.complete(),+ });+ return () => sub.unsubscribe();+ });++export const trpc = createTRPCClient<AppRouter>({+ links: [+ paymentRequiredLink,+ httpBatchLink({+ url: `${import.meta.env.VITE_API_URL ?? ""}/api/trpc`,+ async headers() {+ const session = await supabase?.auth.getSession();+ const token = session?.data.session?.access_token;+ return token ? { Authorization: `Bearer ${token}` } : {};+ },+ }),+ ],+});diff --git a/apps/web/src/lib/tw.ts b/apps/web/src/lib/tw.tsnew file mode 100644index 00000000..497d076d--- /dev/null+++ b/apps/web/src/lib/tw.ts@@ -0,0 +1,15 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Tailwind CSS template literal tag for IntelliSense support.+ * The Tailwind IntelliSense extension recognizes `tw` tagged template literals+ * and provides autocomplete and validation.+ */+export function tw(strings: TemplateStringsArray, ...values: unknown[]): string {+ return strings.reduce((result, str, i) => {+ return result + str + (values[i] ?? '')+ }, '')+}+diff --git a/apps/web/src/pages/auth-callback.tsx b/apps/web/src/pages/auth-callback.tsxnew file mode 100644index 00000000..88e15124--- /dev/null+++ b/apps/web/src/pages/auth-callback.tsx@@ -0,0 +1,25 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { onMount } from 'solid-js';+import { useNavigate } from '@solidjs/router';+import { supabase } from '@/lib/supabase';++export function AuthCallbackPage() {+ const navigate = useNavigate();++ onMount(async () => {+ if (supabase) {+ await supabase.auth.getSession();+ }++ navigate('/', { replace: true });+ });++ return (+ <div class="grid h-screen place-items-center bg-background">+ <p class="text-sm text-muted-foreground">Signing you in...</p>+ </div>+ );+}diff --git a/apps/web/src/pages/editor.tsx b/apps/web/src/pages/editor.tsxnew file mode 100644index 00000000..11b4b74c--- /dev/null+++ b/apps/web/src/pages/editor.tsx@@ -0,0 +1,112 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show, createMemo, createSignal } from "solid-js";+import { Canvas } from "@/components/canvas";+import { Timeline, Layers } from "@/components/timeline";+import { Soundboard, Inspector } from "@/components/sidebar-right";+import { FloatingProjectHeader, SidebarLeft } from "@/components/sidebar-left";+import { Footer } from "@/components/footer";+import { useLayout, MIN_TIMELINE_HEIGHT } from "@/context/layout";+import { useElectron } from "@/context/electron";++const FOOTER_HEIGHT = 28;+const MIN_CANVAS_HEIGHT = 200;++export function EditorPage() {+ const { sidebarsVisible, timelineVisible, timelineHeight, setTimelineHeight } = useLayout();+ const { isDesktop, isFullscreen } = useElectron();+ const [resizing, setResizing] = createSignal(false);++ const timelineStyles = createMemo(() => {+ if (!timelineVisible()) return;++ return {+ 'grid-template-rows': `1fr 1px ${timelineHeight()}px 1px ${FOOTER_HEIGHT}px`,+ };+ });++ const handleResizeStart = (e: PointerEvent) => {+ e.preventDefault();+ e.stopPropagation();+ const startY = e.clientY;+ const startHeight = timelineHeight();+ setResizing(true);++ const handleMove = (ev: PointerEvent) => {+ const deltaY = startY - ev.clientY;+ const maxHeight = Math.max(+ MIN_TIMELINE_HEIGHT,+ window.innerHeight - MIN_CANVAS_HEIGHT - FOOTER_HEIGHT - 2,+ );+ const next = Math.max(MIN_TIMELINE_HEIGHT, Math.min(maxHeight, startHeight + deltaY));+ setTimelineHeight(next);+ };++ const handleEnd = () => {+ setResizing(false);+ document.removeEventListener('pointermove', handleMove);+ document.removeEventListener('pointerup', handleEnd);+ };++ document.addEventListener('pointermove', handleMove);+ document.addEventListener('pointerup', handleEnd);+ };++ return (+ <div+ class="bg-background h-screen w-full overflow-hidden grid"+ classList={{+ 'grid-cols-[264px_1px_1fr_1px_264px]': sidebarsVisible(),+ 'grid-cols-[1fr]': !sidebarsVisible(),+ 'grid-rows-[1fr]': !timelineVisible(),+ }}+ style={timelineStyles()}+ >+ <Show when={isDesktop && !isFullscreen()}>+ <div class="fixed top-0 left-0 right-0 h-10 z-20" style="-webkit-app-region: drag;" />+ </Show>+ <Show when={sidebarsVisible()}>+ <SidebarLeft />+ <div class="bg-border" />+ </Show>+ <Canvas />+ <Show when={sidebarsVisible()}>+ <div class="bg-border" />+ <Inspector />+ </Show>+ <Show when={timelineVisible()}>+ <div class="col-span-full bg-border relative">+ <div+ class="absolute left-0 right-0 -top-px h-[3px] z-10 cursor-ns-resize group"+ onPointerDown={handleResizeStart}+ >+ <div+ class="absolute left-0 right-0 top-px h-px transition-colors group-hover:bg-primary"+ classList={{ 'bg-primary': resizing() }}+ />+ </div>+ </div>+ </Show>+ <Show when={timelineVisible()}>+ <Layers />+ <div class="bg-border" />+ </Show>+ <Show when={timelineVisible()}>+ <Timeline />+ </Show>+ <Show when={timelineVisible()}>+ <div class="bg-border" />+ <Soundboard />+ </Show>+ <Show when={timelineVisible()}>+ <div class="col-span-full bg-border" />+ <Footer />+ </Show>+ <Show when={!sidebarsVisible()}>+ <FloatingProjectHeader />+ </Show>+ </div>+ );+}diff --git a/apps/web/src/pages/home.tsx b/apps/web/src/pages/home.tsxnew file mode 100644index 00000000..cbdd41db--- /dev/null+++ b/apps/web/src/pages/home.tsx@@ -0,0 +1,49 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Show } from 'solid-js';+import { EditorPage } from './editor';+import { LayoutProvider } from "@/context/layout";+import { Dashboard } from '@/components/dashboard';+import { PromptInputProvider } from "@/context/prompt-input";+import { EngineProvider } from '@/context/engine';+import { ElectronProvider } from '@/context/electron';+import { ExportProvider } from '@/context/export';+import { useProjectId } from '@/hooks/use-project-id';+import { useSearchParams } from '@solidjs/router';+import { ECSProvider } from '@/context/ecs';+import { TimelineProvider } from '@/context/timeline';++export function HomePage() {+ const projectId = useProjectId();+ const [params] = useSearchParams();++ return (+ /**+ * using show with keyed to ensure the engine provider is remounted when the project id changes+ */+ <Show when={projectId()} keyed>+ {(id) => (+ <EngineProvider projectId={id}>+ <ElectronProvider>+ <TimelineProvider>+ <ECSProvider>+ <ExportProvider>+ <PromptInputProvider>+ <LayoutProvider>+ <EditorPage />+ </LayoutProvider>+ </PromptInputProvider>+ <Show when={!params.project || !!params.dashboard}>+ <Dashboard />+ </Show>+ </ExportProvider>+ </ECSProvider>+ </TimelineProvider>+ </ElectronProvider>+ </EngineProvider>+ )}+ </Show>+ )+}diff --git a/apps/web/src/pages/login.tsx b/apps/web/src/pages/login.tsxnew file mode 100644index 00000000..b7239b89--- /dev/null+++ b/apps/web/src/pages/login.tsx@@ -0,0 +1,157 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createSignal, Show } from 'solid-js';+import { toast } from 'somoto';++import { Button } from '@/components/ui/button';+import { Icon } from '@/components/ui/icon';+import { TextField, TextFieldInput, TextFieldLabel } from '@/components/ui/text-field';+import { DevAuthCodeInput } from '@/components/dev-auth-code-input';+import { HeadlessIndicator } from '@/components/headless-indicator';+import { useAuth } from '@/context/auth';++type OAuthButtonProps = {+ icon: string;+ label: string;+ onClick: () => void;+};++function OAuthButton(props: OAuthButtonProps) {+ return (+ <Button+ variant="secondary"+ class="w-full gap-0 px-0.5"+ onClick={props.onClick}+ >+ <Icon name={props.icon} class="size-6" />+ <span class="min-w-0 flex-1 text-center">{props.label}</span>+ <span class="size-6 shrink-0" aria-hidden="true" />+ </Button>+ );+}++export function LoginPage() {+ const auth = useAuth();+ const [email, setEmail] = createSignal('');+ const [otpSending, setOtpSending] = createSignal(false);++ const handleOtpSubmit = async (e: SubmitEvent) => {+ e.preventDefault();++ const value = email().trim();+ if (!value) return;++ setOtpSending(true);+ const { error } = await auth.signInWithOtp(value);+ setOtpSending(false);++ if (error) {+ toast.error(error);+ } else {+ toast.success('Check your email for the login link');+ }+ };++ return (+ <div class="flex flex-col bg-background fixed inset-0 z-999">+ <HeadlessIndicator />++ <Show when={!window.desktop}>+ <div class="flex items-center gap-1 p-4">+ <Icon name="diffusion-logo" class="size-6" />+ <span class="text-sm font-450 text-foreground">Diffusion Studio</span>+ </div>+ </Show>++ <div class="flex flex-1 items-center justify-center pb-16">+ <div class="flex w-70 flex-col gap-3">+ <div class="flex flex-col gap-3 rounded-xl bg-accent/40 p-4">+ <div class="flex flex-col gap-4">+ <div class="flex flex-col gap-1">+ <h2 class="text-[12px] font-450 text-foreground">+ Sign in or sign up+ </h2>+ <p class="text-xs text-muted-foreground">+ Choose your preferred method+ </p>+ </div>++ <div class="flex flex-col gap-3">+ <OAuthButton+ icon="social.google"+ label="Continue with Google"+ onClick={() => auth.signInWithOAuth('google')}+ />+ <OAuthButton+ icon="social.github"+ label="Continue with GitHub"+ onClick={() => auth.signInWithOAuth('github')}+ />+ </div>++ <div class="flex items-center justify-center gap-3">+ <div class="h-px flex-1 bg-border" />+ <span class="text-xs text-muted-foreground">or</span>+ <div class="h-px flex-1 bg-border" />+ </div>+ </div>++ <form class="flex flex-col gap-3" onSubmit={handleOtpSubmit}>+ <TextField>+ <TextFieldLabel+ uiSize="compact"+ class="text-xs text-muted-foreground"+ >+ </TextFieldLabel>+ <TextFieldInput+ uiSize="compact"+ type="email"+ placeholder="Enter your email"+ value={email()}+ onInput={(e) => setEmail(e.currentTarget.value)}+ onKeyDown={(e) => e.stopPropagation()}+ onKeyUp={(e) => e.stopPropagation()}+ />+ </TextField>++ <Button+ type="submit"+ class="w-full"+ disabled={otpSending() || !email().trim()}+ >+ {otpSending() ? 'Sending...' : 'Send magic link'}+ </Button>+ </form>+ </div>++ <DevAuthCodeInput />++ <span class="px-1 text-center text-xs text-muted-foreground">+ By continuing, you agree to our{' '}+ <a+ href="https://www.diffusion.studio/legal/privacy-policy"+ target="_blank"+ rel="noopener noreferrer"+ class="underline hover:text-foreground"+ >+ Privacy Policy+ </a>{' '}+ and{' '}+ <a+ href="https://www.diffusion.studio/legal/terms-of-service"+ target="_blank"+ rel="noopener noreferrer"+ class="underline hover:text-foreground"+ >+ Terms of Service+ </a>+ .+ </span>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/web/src/pages/not-found.tsx b/apps/web/src/pages/not-found.tsxnew file mode 100644index 00000000..74b6b487--- /dev/null+++ b/apps/web/src/pages/not-found.tsx@@ -0,0 +1,30 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { A } from '@solidjs/router';+import { Button } from '@/components/ui/button';++export function NotFoundPage() {+ return (+ <div class="min-h-screen bg-background flex items-center justify-center relative overflow-hidden">+ <div class="relative z-10 text-center px-6">+ <div class="mb-8">+ <span+ class="bg-gradient-to-b from-foreground to-muted-foreground text-[12rem] font-extralight tracking-tighter leading-none text-transparent bg-clip-text select-none font-mono"+ >+ 404+ </span>+ </div>++ <p class="text-muted-foreground text-lg font-light mb-4">+ Nothing here.+ </p>++ <Button as={A} href="/" variant="ghost">+ Back home+ </Button>+ </div>+ </div>+ );+}diff --git a/apps/web/src/types/common.ts b/apps/web/src/types/common.tsnew file mode 100644index 00000000..9ca60a9c--- /dev/null+++ b/apps/web/src/types/common.ts@@ -0,0 +1,13 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export type AspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';+export type ModelOutput = 'image' | 'video' | 'audio';++export const DataTransferType = {+ ASSET_IDS: 'asset_ids',+ TRANSITION: 'transition',+} as const;++export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;diff --git a/apps/web/src/types/index.ts b/apps/web/src/types/index.tsnew file mode 100644index 00000000..a0724623--- /dev/null+++ b/apps/web/src/types/index.ts@@ -0,0 +1,5 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from "./common";diff --git a/apps/web/src/utils/browser.ts b/apps/web/src/utils/browser.tsnew file mode 100644index 00000000..133873e9--- /dev/null+++ b/apps/web/src/utils/browser.ts@@ -0,0 +1,154 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { mimeTypeToExtension } from "./media";+import { colord } from "colord";++import type { ElectronFileHandle } from "@/lib/electron-file-handle";++/**+ * Reads the computed value of a CSS custom property from the document root.+ * @param name - The CSS variable name (e.g., `'--color-canvas'`)+ * @returns The resolved value as a colord instance+ */+export function getCssVar(name: string) {+ const value = getComputedStyle(document.documentElement).getPropertyValue(name).trim();++ return colord(value);+}++/**+ * Opens the browser's EyeDropper to pick a color from the screen.+ * @returns The selected hex color string, or null if cancelled/unsupported+ */+export async function pickScreenColor(): Promise<string | null> {+ try {+ const eyeDropper = new (window as any).EyeDropper();+ const result = await eyeDropper.open();+ return result.sRGBHex;+ } catch {+ // User cancelled or error occurred+ return null;+ }+}++/**+ * Verifies if we still have permission to access the handle.+ * Returns true if permission is granted, false otherwise.+ */+export async function verifyHandlePermission(+ handle: FileSystemDirectoryHandle | FileSystemFileHandle,+ mode: 'read' | 'readwrite' = 'readwrite'+): Promise<boolean> {+ const options = { mode };++ // Check if we already have permission+ if ((await handle.queryPermission(options)) === 'granted') {+ return true;+ }++ // Request permission if not granted+ if ((await handle.requestPermission(options)) === 'granted') {+ return true;+ }++ return false;+}++/**+ * Batch-verifies permission for many handles. Calls requestPermission on every+ * handle that needs it in parallel within the same task — Chromium consolidates+ * the prompts into a single dialog listing all files. Must be invoked during a+ * transient user activation (e.g. inside a click handler).+ */+export async function verifyHandlePermissions(+ handles: (FileSystemDirectoryHandle | FileSystemFileHandle | ElectronFileHandle)[],+ mode: 'read' | 'readwrite' = 'readwrite'+): Promise<boolean> {+ if (handles.length === 0) return true;++ const options = { mode };+ const states = await Promise.all(handles.map(h => h.queryPermission(options)));+ const pending = handles.filter((_, i) => states[i] !== 'granted');+ if (pending.length === 0) return true;++ const results = await Promise.all(pending.map(h => h.requestPermission(options)));+ return results.every(state => state === 'granted');+}++/**+ * This utility creates a file input element and clicks on it+ * @param accept comma separated mime types+ * @example audio/mp3, video/mp4+ * @param multiple enable multiselection+ * @default true+ */+export async function showFileDialog(+ accept = 'image/*,video/*,audio/*,text/*',+ multiple = true+): Promise<File[] | FileSystemFileHandle[]> {+ try {+ if ('showOpenFilePicker' in window) {+ return await window.showOpenFilePicker({+ multiple,+ startIn: 'downloads',+ });+ }++ return new Promise<File[]>(resolve => {+ // setup input+ const input = document.createElement('input');+ input.type = 'file';+ input.accept = accept;+ input.multiple = multiple;+ // listen for changes+ input.onchange = (fileEvent: Event) => {+ const files = Array.from((fileEvent.target as HTMLInputElement)?.files ?? []);+ resolve(files);+ };+ input.click();+ });+ } catch {+ return [];+ }+}++/**+ * This utility creates an anchor tag and clicks on it+ * @param source Blob url or base64 encoded svg+ * @param name File name suggestion+ */+export async function downloadObject(source: Blob, name?: string): Promise<void> {+ const a = document.createElement('a');+ document.head.appendChild(a);+ a.target = '_blank';++ // Add extension to name if it doesn't have one+ if (name && !name.match(/\.[^.]+$/)) {+ if (source instanceof File) {+ name = name + mimeTypeToExtension(source.type);+ } else if (source instanceof FileSystemFileHandle) {+ const file = await source.getFile();+ name = name + mimeTypeToExtension(file.type);+ }+ }++ if (name) {+ a.download = name;+ } else if (source instanceof File) {+ a.download = source.name;+ } else if (source instanceof Blob) {+ a.download = 'untitled';+ }++ a.href = URL.createObjectURL(source);++ a.click();+ a.remove();+}++export function isInputTarget(e: KeyboardEvent) {+ const target = e.target as HTMLElement;+ return target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable;+}diff --git a/apps/web/src/utils/color.ts b/apps/web/src/utils/color.tsnew file mode 100644index 00000000..9bcf4638--- /dev/null+++ b/apps/web/src/utils/color.ts@@ -0,0 +1,316 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { colord } from "colord";+import { clamp } from "./common";++const NAMED_COLORS: Record<string, string> = {+ red: "FF0000",+ green: "008000",+ blue: "0000FF",+ white: "FFFFFF",+ black: "000000",+ yellow: "FFFF00",+ cyan: "00FFFF",+ magenta: "FF00FF",+ orange: "FFA500",+ purple: "800080",+ pink: "FFC0CB",+ gray: "808080",+ grey: "808080",+ brown: "A52A2A",+ lime: "00FF00",+ navy: "000080",+ teal: "008080",+ maroon: "800000",+ olive: "808000",+ aqua: "00FFFF",+ coral: "FF7F50",+ salmon: "FA8072",+ gold: "FFD700",+ silver: "C0C0C0",+ indigo: "4B0082",+ violet: "EE82EE",+ crimson: "DC143C",+ tomato: "FF6347",+ khaki: "F0E68C",+ plum: "DDA0DD",+ orchid: "DA70D6",+ tan: "D2B48C",+ beige: "F5F5DC",+ ivory: "FFFFF0",+ lavender: "E6E6FA",+ turquoise: "40E0D0",+ chartreuse: "7FFF00",+ sienna: "A0522D",+ peru: "CD853F",+ firebrick: "B22222",+ skyblue: "87CEEB",+ hotpink: "FF69B4",+ mint: "3EB489",+};++/**+ * Parses any colord-compatible input (hex with or without `#`, short hex,+ * `rgb()`, `hsl()`, named colors, etc.) into a numeric hex color (0xRRGGBB).+ *+ * For string input, applies a hex input fallback — normalizes+ * arbitrary input to a valid 6-char hex string.+ *+ * Rules (matches Figma's behavior):+ * 1. Strip all non-hex characters [^0-9A-Fa-f].+ * 2. Normalize the surviving hex string by length:+ * 0 chars → null (revert to previous color, no change)+ * 1 char → repeat 6× "A" → "AAAAAA"+ * 2 chars → repeat 3× "AB" → "ABABAB"+ * 3 chars → CSS shorthand, double "ABC" → "AABBCC"+ * 4 chars → pad right with 0s "ABCD" → "ABCD00"+ * 5 chars → pad right with 0 "ABCDE" → "ABCDE0"+ * 6 chars → use as-is "ABCDEF" → "ABCDEF"+ * 7+ chars → truncate to first 6 "ABCDEFG" → "ABCDEF"+ * 3. Return the result uppercased.+ *+ * This means typing gibberish still produces a deterministic color:+ * "redredred" → strip non-hex → "ededed" (6) → "EDEDED"+ * "blueblueblue" → strip non-hex → "bebebe" (6) → "BEBEBE"+ * "hello" → strip non-hex → "e" (1) → "EEEEEE"+ */+export function parseColor(input: string): number | null {+ const trimmed = input.trim();+ if (trimmed.length === 0) return null;++ const named = NAMED_COLORS[trimmed.toLowerCase()];+ if (named) {+ return parseInt(named, 16);+ }++ const c = colord(trimmed);+ if (c.isValid()) {+ const { r, g, b } = c.toRgb();+ return rgbToColor(r, g, b);+ }++ const hex = trimmed.replace(/[^0-9A-Fa-f]/g, "");+ if (hex.length === 0) return null;++ let normalized: string;+ if (hex.length === 1) normalized = hex.repeat(6);+ else if (hex.length === 2) normalized = hex.repeat(3);+ else if (hex.length === 3) normalized = hex.split("").map((ch) => ch + ch).join("");+ else if (hex.length === 4) normalized = hex + "00";+ else if (hex.length === 5) normalized = hex + "0";+ else if (hex.length === 6) normalized = hex;+ else normalized = hex.slice(0, 6);++ return parseInt(normalized.toUpperCase(), 16);+}++/**+ * Converts RGB values to HSL values.+ * @param r - Red value (0-255)+ * @param g - Green value (0-255)+ * @param b - Blue value (0-255)+ * @returns An object with h (0-360), s (0-100), l (0-100) values+ */+export function rgbToHsl(r: number, g: number, b: number): { h: number; s: number; l: number } {+ const nr = r / 255;+ const ng = g / 255;+ const nb = b / 255;++ const max = Math.max(nr, ng, nb);+ const min = Math.min(nr, ng, nb);+ const delta = max - min;++ let h = 0;+ let s = 0;+ const l = (max + min) / 2;++ if (delta !== 0) {+ s = delta / (1 - Math.abs(2 * l - 1));+ if (max === nr) {+ h = ((ng - nb) / delta) % 6;+ } else if (max === ng) {+ h = (nb - nr) / delta + 2;+ } else {+ h = (nr - ng) / delta + 4;+ }+ h *= 60;+ if (h < 0) h += 360;+ }++ return {+ h: Math.round(h),+ s: Math.round(s * 100),+ l: Math.round(l * 100),+ };+}++/**+ * Converts HSL values to RGB channel values (0-255).+ * @param h - Hue value (0-360)+ * @param s - Saturation value (0-100)+ * @param l - Lightness value (0-100)+ */+export function hslToRgb(h: number, s: number, l: number): { r: number; g: number; b: number } {+ const sat = s / 100;+ const light = l / 100;++ const c = (1 - Math.abs(2 * light - 1)) * sat;+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));+ const m = light - c / 2;++ let r1 = 0;+ let g1 = 0;+ let b1 = 0;++ if (h < 60) {+ r1 = c;+ g1 = x;+ } else if (h < 120) {+ r1 = x;+ g1 = c;+ } else if (h < 180) {+ g1 = c;+ b1 = x;+ } else if (h < 240) {+ g1 = x;+ b1 = c;+ } else if (h < 300) {+ r1 = x;+ b1 = c;+ } else {+ r1 = c;+ b1 = x;+ }++ return {+ r: Math.round((r1 + m) * 255),+ g: Math.round((g1 + m) * 255),+ b: Math.round((b1 + m) * 255),+ };+}++/**+ * Converts RGB values to HSV values.+ * @param r - Red value (0-255)+ * @param g - Green value (0-255)+ * @param b - Blue value (0-255)+ * @returns An object with h (0-360), s (0-100), v (0-100) values+ */+export function rgbToHsv(+ r: number,+ g: number,+ b: number,+): { h: number; s: number; v: number } {+ const rn = clamp(r, 0, 255) / 255;+ const gn = clamp(g, 0, 255) / 255;+ const bn = clamp(b, 0, 255) / 255;+ const max = Math.max(rn, gn, bn);+ const min = Math.min(rn, gn, bn);+ const delta = max - min;++ let h = 0;+ if (delta !== 0) {+ if (max === rn) h = 60 * (((gn - bn) / delta) % 6);+ else if (max === gn) h = 60 * ((bn - rn) / delta + 2);+ else h = 60 * ((rn - gn) / delta + 4);+ }++ if (h < 0) h += 360;++ const s = max === 0 ? 0 : (delta / max) * 100;+ const v = max * 100;+ return { h: Math.round(h), s, v };+}++/**+ * Converts HSV values to RGB values.+ * @param h - Hue value (0-360)+ * @param s - Saturation value (0-100)+ * @param v - Value value (0-100)+ * @returns An object with r, g, b values (0-255)+ */+export function hsvToRgb(+ h: number,+ s: number,+ v: number,+): { r: number; g: number; b: number } {+ const hue = ((h % 360) + 360) % 360;+ const sat = clamp(s, 0, 100) / 100;+ const val = clamp(v, 0, 100) / 100;+ const c = val * sat;+ const x = c * (1 - Math.abs(((hue / 60) % 2) - 1));+ const m = val - c;+ let r1 = 0;+ let g1 = 0;+ let b1 = 0;++ if (hue < 60) {+ r1 = c;+ g1 = x;+ } else if (hue < 120) {+ r1 = x;+ g1 = c;+ } else if (hue < 180) {+ g1 = c;+ b1 = x;+ } else if (hue < 240) {+ g1 = x;+ b1 = c;+ } else if (hue < 300) {+ r1 = x;+ b1 = c;+ } else {+ r1 = c;+ b1 = x;+ }++ return {+ r: Math.round((r1 + m) * 255),+ g: Math.round((g1 + m) * 255),+ b: Math.round((b1 + m) * 255),+ };+}++/**+ * Merges a numeric hex color (0xRRGGBB) with an opacity to create a rgba string.+ * @param color - The numeric hex color to merge with the opacity+ * @param opacity - The opacity to merge with the color+ * @returns A rgba string representing the color with the opacity merged+ */+export function mergeColorWithOpacity(color: number = 0xFFFFFF, opacity: number = 1) {+ const clampedOpacity = Math.round(clamp(opacity, 0, 1) * 100) / 100;+ const r = (color >> 16) & 0xFF;+ const g = (color >> 8) & 0xFF;+ const b = color & 0xFF;+ return `rgba(${r}, ${g}, ${b}, ${clampedOpacity})`;+}++/**+ * Converts a numeric hex color (0xRRGGBB) to a CSS hex string (#RRGGBB).+ */+export function colorToHex(color: number): string {+ return "#" + ((1 << 24) | (color & 0xFFFFFF)).toString(16).slice(1).toUpperCase();+}++/**+ * Packs RGB channel values (0-255) into a numeric hex color (0xRRGGBB).+ */+export function rgbToColor(r: number, g: number, b: number): number {+ const rc = clamp(Math.round(r), 0, 255);+ const gc = clamp(Math.round(g), 0, 255);+ const bc = clamp(Math.round(b), 0, 255);+ return (rc << 16) | (gc << 8) | bc;+}++/**+ * Unpacks a numeric hex color (0xRRGGBB) into RGB channel values (0-255).+ */+export function colorToRgb(color: number): { r: number; g: number; b: number } {+ return {+ r: (color >> 16) & 0xFF,+ g: (color >> 8) & 0xFF,+ b: color & 0xFF,+ };+}diff --git a/apps/web/src/utils/common.ts b/apps/web/src/utils/common.tsnew file mode 100644index 00000000..b7bb8217--- /dev/null+++ b/apps/web/src/utils/common.ts@@ -0,0 +1,101 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { Asset } from "@/components/engine/db";++/**+ * clip assert replacement for the browser+ * @example assert(true == false)+ */+export function assert(condition: any, message?: string): asserts condition {+ if (!condition) {+ throw new Error(message || `Assertion failed: ${String(condition)}`);+ }+}++/**+ * Clamp a value between a minimum and maximum.+ * @param value - The value to clamp.+ * @param min - The minimum value.+ * @param max - The maximum value.+ * @returns The clamped value.+ */+export function clamp(value: number, min: number, max: number) {+ return Math.min(Math.max(value, min), max);+}++/**+ * Attempt to execute a function and return the result or null if it throws.+ * @param fn - The function to attempt to execute.+ * @returns The result of the function or null if it throws.+ */+export function attempt<T>(fn: () => T): { result: T } | { error: Error } {+ try {+ return { result: fn() };+ } catch (error) {+ if (error instanceof Error) {+ return { error: error };+ }+ return { error: new Error('Unknown error') };+ }+}++export class AsyncMutex {+ currentPromise = Promise.resolve();++ async acquire() {+ let resolver: () => void;+ const nextPromise = new Promise<void>(resolve => {+ resolver = resolve;+ });++ const currentPromiseAlias = this.currentPromise;+ this.currentPromise = nextPromise;++ await currentPromiseAlias;++ return resolver!;+ }+}++/**+ * Format a video asset duration in seconds to H:MM:SS or M:SS.+ * Returns null for non-video assets.+ * @param asset - The asset to format.+ * @returns The formatted duration string, or null if the asset is not a video.+ */+export function formatAssetDuration(asset: Asset | null | undefined): string | null {+ if (asset?.type != "VIDEO" && asset?.type != "AUDIO" && asset?.type != "SEQUENCE") {+ return null;+ }++ const seconds = asset.duration;+ if (!Number.isFinite(seconds)) return "0:00";++ const totalSeconds = Math.max(0, Math.floor(seconds));+ const hours = Math.floor(totalSeconds / 3600);+ const minutes = Math.floor((totalSeconds % 3600) / 60);+ const remaining = totalSeconds % 60;++ if (hours > 0) {+ return `${hours}:${minutes.toString().padStart(2, "0")}:${remaining+ .toString()+ .padStart(2, "0")}`;+ }++ return `${minutes}:${remaining.toString().padStart(2, "0")}`;+}++/**+ * Check if two ranges intersect (non-inclusive)+ * @param range1 [start, end]+ * @param range2 [start, end]+ * @returns true if the ranges intersect, false otherwise+ */+export function intersect(range1: [number, number], range2: [number, number]): boolean {+ const [x1, x2] = range1;+ const [y1, y2] = range2;++ return x1 < y2 && y1 < x2;+}diff --git a/apps/web/src/utils/formatters.ts b/apps/web/src/utils/formatters.tsnew file mode 100644index 00000000..bb532159--- /dev/null+++ b/apps/web/src/utils/formatters.ts@@ -0,0 +1,142 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Formats a byte count to a human-readable size using base-1024 units.+ * @param bytes - Raw byte size.+ * @returns Formatted size string (e.g. "1.2 MB").+ */+export function formatBytes(bytes: number) {+ if (!Number.isFinite(bytes) || bytes <= 0) return "0 B";+ const units = ["B", "KB", "MB", "GB", "TB"] as const;+ const base = 1024;+ const exponent = Math.min(+ units.length - 1,+ Math.floor(Math.log(bytes) / Math.log(base)),+ );+ const value = bytes / Math.pow(base, exponent);+ const decimals = exponent === 0 ? 0 : value >= 100 ? 0 : value >= 10 ? 1 : 2;+ return `${value.toFixed(decimals)} ${units[exponent]}`;+}++/**+ * Computes the greatest common divisor of two integers.+ * @param a - First value.+ * @param b - Second value.+ * @returns Greatest common divisor.+ */+function gcd(a: number, b: number) {+ let x = Math.abs(a);+ let y = Math.abs(b);+ while (y) {+ const next = x % y;+ x = y;+ y = next;+ }+ return x;+}++/**+ * Formats width/height to a reduced aspect ratio string.+ * @param width - Pixel width.+ * @param height - Pixel height.+ * @returns Ratio in `W:H` format.+ */+export function formatAspectRatio(width: number, height: number) {+ const d = gcd(width, height);+ if (!d) return `${width}:${height}`;+ return `${Math.round(width / d)}:${Math.round(height / d)}`;+}++/**+ * Converts MIME types into friendlier display labels.+ * Falls back to the raw MIME type when unknown.+ * @param mimeType - MIME type value.+ * @returns Display label for the MIME type.+ */+export function formatMimeTypeLabel(mimeType: string) {+ mimeType = mimeType.split(';')[0].trim();++ const mapping: Record<string, string> = {+ "video/mp4": "MPEG-4 Movie",+ "video/quicktime": "QuickTime Movie",+ "video/webm": "WebM Video",+ "audio/mpeg": "MP3 Audio",+ "audio/wav": "WAV Audio",+ "image/jpeg": "JPEG Image",+ "image/png": "PNG Image",+ "image/webp": "WebP Image",+ };++ return mapping[mimeType] ?? mimeType;+}++/**+ * Formats seconds to `MM:SS` or `HH:MM:SS`.+ * @param seconds - Duration in seconds.+ * @returns Timecode string.+ */+export function formatDuration(seconds: number) {+ if (!Number.isFinite(seconds)) return "00:00";++ const totalSeconds = Math.max(0, Math.floor(seconds));+ const hours = Math.floor(totalSeconds / 3600);+ const minutes = Math.floor((totalSeconds % 3600) / 60);+ const remaining = totalSeconds % 60;++ if (hours > 0) {+ return `${hours.toString().padStart(2, "0")}:${minutes+ .toString()+ .padStart(2, "0")}:${remaining.toString().padStart(2, "0")}`;+ }++ return `${minutes.toString().padStart(2, "0")}:${remaining+ .toString()+ .padStart(2, "0")}`;+}++/**+ * Formats audio channel count to a friendly label.+ * @param channels - Channel count.+ * @returns Channel label or placeholder when unavailable.+ */+export function formatChannels(channels: number | undefined) {+ if (!channels) return null;+ if (channels === 1) return "Mono";+ if (channels === 2) return "Stereo";+ return `${channels} ch`;+}++/**+ * Formats asset timestamps for metadata display.+ * Uses "Today, HH:MM" when date matches current local day.+ * @param value - Date-like input.+ * @returns Formatted date/time label or placeholder when invalid.+ */+export function formatAssetDate(value: string | number | null | undefined) {+ if (value == null) return null;++ const date = new Date(value);+ if (Number.isNaN(date.getTime())) return null;++ const now = new Date();+ const isSameDay =+ date.getFullYear() === now.getFullYear() &&+ date.getMonth() === now.getMonth() &&+ date.getDate() === now.getDate();++ const time = date.toLocaleTimeString(undefined, {+ hour: "numeric",+ minute: "2-digit",+ });++ if (isSameDay) return `Today, ${time}`;++ const datePart = date.toLocaleDateString(undefined, {+ month: "short",+ day: "numeric",+ });++ return `${datePart}, ${time}`;+}diff --git a/apps/web/src/utils/genai.ts b/apps/web/src/utils/genai.tsnew file mode 100644index 00000000..be8b7193--- /dev/null+++ b/apps/web/src/utils/genai.ts@@ -0,0 +1,173 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { query, Not, Or } from "bitecs";+import { ChildOf, PaintType, aabbFromTransformedRect, aabbsIntersect, invert2D, transformPoint, getEntityTree, createEntity, setComponent, appendChild, addComponent, removeComponent, createFolder, ensureFolder, uniqueFolderName, type AABB } from "@/components/engine";+import { MAIN_CANVAS_ID } from "@/components/canvas";++import type { EngineWorld } from "@/components/engine";++const GEN_AI_FOLDER_NAME = 'Gen AI';++/**+ * Map aspect ratio to pixel dimensions assuming 1080p as baseline.+ */+export const ASPECT_RATIO_DIMENSIONS: Record<string, { width: number; height: number }> = {+ "16:9": { width: 1920, height: 1080 },+ "9:16": { width: 1080, height: 1920 },+ "1:1": { width: 1080, height: 1080 },+ "4:3": { width: 1440, height: 1080 },+ "3:4": { width: 1080, height: 1440 },+};++/**+ * Get the world-space center of the current viewport.+ */+export function getViewportCenter(world: EngineWorld) {+ const canvasEl = document.getElementById(MAIN_CANVAS_ID) as HTMLCanvasElement | null;+ if (!canvasEl) return { x: 0, y: 0 };+ const rect = canvasEl.getBoundingClientRect();+ const invMat = invert2D(world.camera);+ const pt = transformPoint(invMat, rect.width / 2, rect.height / 2);+ return pt ?? { x: 0, y: 0 };+}++/**+ * Get the world-space AABB of the current viewport.+ */+function getViewportBounds(world: EngineWorld): AABB | null {+ const canvasEl = document.getElementById(MAIN_CANVAS_ID) as HTMLCanvasElement | null;+ if (!canvasEl) return null;+ const rect = canvasEl.getBoundingClientRect();+ const invMat = invert2D(world.camera);+ const tl = transformPoint(invMat, 0, 0);+ const tr = transformPoint(invMat, rect.width, 0);+ const br = transformPoint(invMat, rect.width, rect.height);+ const bl = transformPoint(invMat, 0, rect.height);+ return {+ minX: Math.min(tl.x, tr.x, br.x, bl.x),+ minY: Math.min(tl.y, tr.y, br.y, bl.y),+ maxX: Math.max(tl.x, tr.x, br.x, bl.x),+ maxY: Math.max(tl.y, tr.y, br.y, bl.y),+ };+}++/**+ * Find a placement spot for a `width`x`height` block on the canvas.+ */+export function findEmptyPlacement(+ world: EngineWorld,+ width: number,+ height: number,+ gap: number,+): { x: number; y: number } {+ const center = getViewportCenter(world);+ const viewport = getViewportBounds(world);++ const c = world.components;+ const LocalTransform = c.LocalTransform;+ const Computed = c.Computed;++ const boxes: AABB[] = [];+ for (const cid of query(world, [Or(c.Geometry, c.Group), Not(ChildOf('*')), Not(c.Deleted), Not(c.Hidden), Not(c.Generating)])) {+ const w = Computed.width[cid];+ const h = Computed.height[cid];+ if (!w || !h) continue;+ if (LocalTransform.a[cid] === undefined) continue;+ const aabb = aabbFromTransformedRect(+ {+ a: LocalTransform.a[cid], b: LocalTransform.b[cid],+ c: LocalTransform.c[cid], d: LocalTransform.d[cid],+ e: LocalTransform.e[cid], f: LocalTransform.f[cid],+ },+ w,+ h,+ );+ boxes.push(aabb);+ }++ if (boxes.length === 0) {+ return center;+ }++ const candidates = viewport+ ? boxes.filter((b) => aabbsIntersect(b, viewport))+ : boxes;+ const ordered = (candidates.length > 0 ? candidates : boxes).slice().sort((a, b) => {+ const acx = (a.minX + a.maxX) / 2, acy = (a.minY + a.maxY) / 2;+ const bcx = (b.minX + b.maxX) / 2, bcy = (b.minY + b.maxY) / 2;+ return Math.hypot(acx - center.x, acy - center.y)+ - Math.hypot(bcx - center.x, bcy - center.y);+ });++ const overlapsAny = (rect: AABB): boolean => {+ for (const b of boxes) {+ if (aabbsIntersect(rect, b)) return true;+ }+ return false;+ };++ for (const cand of ordered) {+ const cy = (cand.minY + cand.maxY) / 2;+ const minY = cy - height / 2;+ const maxY = cy + height / 2;++ const rightMinX = cand.maxX + gap;+ const right: AABB = { minX: rightMinX, minY, maxX: rightMinX + width, maxY };+ if (!overlapsAny(right)) {+ return { x: rightMinX + width / 2, y: cy };+ }++ const leftMaxX = cand.minX - gap;+ const left: AABB = { minX: leftMaxX - width, minY, maxX: leftMaxX, maxY };+ if (!overlapsAny(left)) {+ return { x: leftMaxX - width / 2, y: cy };+ }+ }++ return center;+}++/**+ * Attach the waveform fill to a generated audio entity.+ */+export function addWaveformFill(world: EngineWorld, eid: number, assetId: string) {+ const c = world.components;+ const fillEid = createEntity(world);+ setComponent(world, fillEid, c.Paint, PaintType.WAVEFORM);+ setComponent(world, fillEid, c.AssetId, assetId);+ appendChild(world, fillEid, eid);+}++/**+ * The library folder for a finished generation: every generated asset lands in+ * a root-level "Gen AI" folder, and a multi-variant batch gets its own+ * subfolder inside it, named after the generation. Both are created on demand.+ * Call only after the generation succeeded, so failures leave no empty folders.+ */+export async function ensureGenerationFolder(+ world: EngineWorld,+ name: string,+ count: number,+): Promise<string> {+ const genAi = await ensureFolder(world, GEN_AI_FOLDER_NAME, null);+ if (count <= 1) return genAi.id;++ const batch = await createFolder(world, uniqueFolderName(world, name, genAi.id), genAi.id);+ return batch.id;+}++/**+ * Record a finished generation as a single undoable step.+ */+export function recordGeneration(world: EngineWorld, label: string, rootEids: number[]) {+ const c = world.components;+ const eids = rootEids.flatMap((root) => getEntityTree(world, root));++ world.history.push({+ label,+ execute: () => eids.forEach((e) => removeComponent(world, e, c.Deleted)),+ reverse: () => eids.forEach((e) => addComponent(world, e, c.Deleted)),+ });+}diff --git a/apps/web/src/utils/index.ts b/apps/web/src/utils/index.tsnew file mode 100644index 00000000..a59e92ba--- /dev/null+++ b/apps/web/src/utils/index.ts@@ -0,0 +1,9 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++export * from "./common";+export * from "./signal";+export * from "./browser";+export * from "./color";+export * from "./media";diff --git a/apps/web/src/utils/jsx-generation.ts b/apps/web/src/utils/jsx-generation.tsnew file mode 100644index 00000000..b9a17e7d--- /dev/null+++ b/apps/web/src/utils/jsx-generation.ts@@ -0,0 +1,241 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { getAssetSpec, isAssetRef } from "@diffusionstudio/jsx";+import { loadAsset, uploadAsset } from "@/components/engine";+import {+ PROMPT_INPUT_AUDIO_MODEL_OPTIONS,+ PROMPT_INPUT_IMAGE_MODEL_OPTIONS,+ PROMPT_INPUT_VIDEO_MODEL_OPTIONS,+ PROMPT_INPUT_VOICE_OPTIONS,+} from "@/components/genai/config";+import { ensureGenerationFolder } from "@/utils/genai";+import { assert } from "@/utils";+import { ElectronFileHandle } from "@/lib/electron-file-handle";+import { trpc } from "@/lib/trpc";++import type { AspectRatio, AssetInput, AssetRef, AssetSpecInput } from "@diffusionstudio/jsx";+import type { EngineWorld } from "@/components/engine";+import type { Asset } from "@/components/engine/db";++const URL_RE = /^https?:\/\//;++/**+ * Resolves a plain `src` — a remote URL, a global filesystem path, or an existing asset id.+ */+export async function resolveAsset(world: EngineWorld, src: string): Promise<Asset> {+ const value = src.trim();++ if (URL_RE.test(value)) {+ return await loadAsset(world, value);+ }++ // A global filesystem path (absolute or containing a separator).+ if (value.startsWith("/") || value.includes("/") || value.includes("\\")) {+ return await loadAsset(world, new ElectronFileHandle(value));+ }++ // Otherwise treat it as an existing asset id.+ const existing = world.assets.get(value);+ assert(existing, `Could not resolve media src: ${src}`);++ return existing;+}++// The UI offers a fixed set of voices on a fixed model (see prompt-input.tsx).+const VOICE_MODEL = "elevenlabs-v3";++/**+ * A spec with defaults applied and every `AssetInput` reduced to an asset id.+ * Field order is fixed, so `JSON.stringify` of it is a stable cache key.+ */+type ResolvedSpec =+ | { type: "image"; model: string; prompt: string; aspectRatio: AspectRatio; seed?: number; refIds: string[] }+ | { type: "video"; model: string; prompt: string; aspectRatio: AspectRatio; duration: number; audio: boolean; seed?: number; startFrameId?: string; endFrameId?: string }+ | { type: "voice"; model: string; prompt: string; voice: string }+ | { type: "audio"; model: string; prompt: string };++/**+ * Generated assets, cached by fully-resolved spec. Scoped per world so a+ * cached asset id always exists in the asset store it is reused from, and+ * per-session by construction (in-memory, never persisted).+ */+const sessionCaches = new WeakMap<EngineWorld, Map<string, Promise<Asset>>>();++/**+ * Declarations already resolved within one `generateAssets` run, keyed by ref+ * identity — a ref consumed by several elements resolves (and validates) once.+ */+export type GenerationMemo = Map<AssetRef, Promise<Asset>>;++/** Resolves a `generate.*` declaration to a finished, imported asset. */+export function resolveGeneratedAsset(world: EngineWorld, ref: AssetRef, memo: GenerationMemo): Promise<Asset> {+ let promise = memo.get(ref);+ if (!promise) {+ promise = generateFromRef(world, ref, memo);+ memo.set(ref, promise);+ }+ return promise;+}++function resolveInput(world: EngineWorld, input: AssetInput, memo: GenerationMemo): Promise<Asset> {+ return isAssetRef(input) ? resolveGeneratedAsset(world, input, memo) : resolveAsset(world, input);+}++async function generateFromRef(world: EngineWorld, ref: AssetRef, memo: GenerationMemo): Promise<Asset> {+ const resolved = await resolveSpec(world, getAssetSpec(ref), memo);+ const key = JSON.stringify(resolved);++ let cache = sessionCaches.get(world);+ if (!cache) {+ cache = new Map();+ sessionCaches.set(world, cache);+ }++ const cached = cache.get(key);+ if (cached) {+ // Reuse unless the generation failed or its asset was deleted since.+ const asset = await cached.catch(() => null);+ if (asset && world.assets.has(asset.id)) return asset;+ cache.delete(key);+ }++ const promise = runGeneration(world, resolved);+ cache.set(key, promise);+ return await promise;+}++async function resolveSpec(world: EngineWorld, spec: AssetSpecInput, memo: GenerationMemo): Promise<ResolvedSpec> {+ switch (spec.type) {+ case "image": {+ const refs = await Promise.all((spec.refs ?? []).map((ref) => resolveInput(world, ref, memo)));+ return {+ type: "image",+ model: spec.model ?? PROMPT_INPUT_IMAGE_MODEL_OPTIONS[0].id,+ prompt: spec.prompt,+ aspectRatio: spec.aspectRatio ?? "16:9",+ seed: spec.seed,+ refIds: refs.map((asset) => asset.id),+ };+ }+ case "video": {+ const [startFrame, endFrame] = await Promise.all([+ spec.startFrame !== undefined ? resolveInput(world, spec.startFrame, memo) : undefined,+ spec.endFrame !== undefined ? resolveInput(world, spec.endFrame, memo) : undefined,+ ]);+ const resolved = {+ type: "video",+ model: spec.model ?? PROMPT_INPUT_VIDEO_MODEL_OPTIONS[0].id,+ prompt: spec.prompt,+ aspectRatio: spec.aspectRatio ?? "16:9",+ duration: spec.duration ?? 5,+ audio: spec.audio ?? false,+ seed: spec.seed,+ startFrameId: startFrame?.id,+ endFrameId: endFrame?.id,+ } satisfies ResolvedSpec;+ checkVideoConstraints(resolved);+ return resolved;+ }+ case "voice": {+ return {+ type: "voice",+ model: VOICE_MODEL,+ prompt: spec.prompt,+ voice: spec.voice ?? PROMPT_INPUT_VOICE_OPTIONS[0].value,+ };+ }+ case "audio": {+ return {+ type: "audio",+ model: spec.model ?? PROMPT_INPUT_AUDIO_MODEL_OPTIONS[0].id,+ prompt: spec.prompt,+ };+ }+ }+}++/**+ * Per-model constraints (`dapi models video`); unknown models are left to the server.+ */+function checkVideoConstraints(spec: Extract<ResolvedSpec, { type: "video" }>): void {+ const model = PROMPT_INPUT_VIDEO_MODEL_OPTIONS.find((option) => option.id === spec.model);+ if (!model) return;++ assert(model.aspectRatios.includes(spec.aspectRatio), `${spec.model} does not support aspect ratio ${spec.aspectRatio}`);+ assert(model.durations.includes(`${spec.duration}s`), `${spec.model} does not support a duration of ${spec.duration}s`);+ assert(!spec.audio || model.features.includes("audio"), `${spec.model} does not support audio generation`);+ assert(spec.endFrameId === undefined || model.features.includes("end-frame"), `${spec.model} does not support an end frame`);+}++async function runGeneration(world: EngineWorld, spec: ResolvedSpec): Promise<Asset> {+ const { name, results, generationId } = await requestGeneration(world, spec);+ assert(results.length > 0, "No results returned from the model");++ const folderId = await ensureGenerationFolder(world, name, 1);+ return await loadAsset(world, results[0].url, { name, generationId, folderId });+}++function requestGeneration(world: EngineWorld, spec: ResolvedSpec) {+ switch (spec.type) {+ case "image": {+ return (async () => {+ const images = spec.refIds.length > 0+ ? await Promise.all(spec.refIds.map((id) => uploadInput(world, id)))+ : undefined;++ console.log("requesting image generation", spec.model, spec.prompt, spec.aspectRatio, spec.seed, images);+ return await trpc.generateImage.mutate({+ model: spec.model,+ prompt: spec.prompt,+ aspectRatio: spec.aspectRatio,+ count: 1,+ seed: spec.seed,+ images,+ });+ })();+ }+ case "video": {+ return (async () => {+ const [startFrame, endFrame] = await Promise.all([+ spec.startFrameId ? uploadInput(world, spec.startFrameId) : undefined,+ spec.endFrameId ? uploadInput(world, spec.endFrameId) : undefined,+ ]);++ console.log("requesting video generation", spec.model, spec.prompt, spec.aspectRatio, spec.duration, spec.audio, spec.seed, startFrame, endFrame);+ return await trpc.generateVideo.mutate({+ model: spec.model,+ prompt: spec.prompt,+ aspectRatio: spec.aspectRatio,+ duration: spec.duration,+ generateAudio: spec.audio,+ seed: spec.seed,+ startFrame,+ endFrame,+ });+ })();+ }+ case "voice": {+ console.log("requesting voice generation", spec.model, spec.prompt, spec.voice);+ return trpc.textToSpeech.mutate({+ model: spec.model,+ prompt: spec.prompt,+ voice: spec.voice,+ });+ }+ case "audio": {+ console.log("requesting audio generation", spec.model, spec.prompt);+ return trpc.generateSound.mutate({+ model: spec.model,+ prompt: spec.prompt,+ });+ }+ }+}++async function uploadInput(world: EngineWorld, assetId: string) {+ const uploaded = await uploadAsset(world, assetId);+ assert(uploaded, `Failed to upload referenced asset ${assetId}`);+ return uploaded;+}diff --git a/apps/web/src/utils/jsx.ts b/apps/web/src/utils/jsx.tsnew file mode 100644index 00000000..342e8523--- /dev/null+++ b/apps/web/src/utils/jsx.ts@@ -0,0 +1,687 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { hasComponent, query, Not } from "bitecs";+import { getAssetSpec, isAssetRef, parseTime } from "@diffusionstudio/jsx";+import * as solid from "solid-js";+import * as solidStore from "solid-js/store";+import * as diffusionJsx from "@diffusionstudio/jsx";+import {+ CaptionType,+ FontStyle,+ GeometryType,+ PaintType,+ ScaleMode,+ TextAlign,+ TextBaseline,+ addComponent,+ appendChild,+ createEntity,+ deleteEntity,+ getNextName,+ getSceneAncestor,+ hasAudioSources,+ removeChild,+ removeComponent,+ resizeEntity,+ setComponent,+ transcribeScene,+} from "@/components/engine";+import { ChildOf } from "@/components/engine/components";+import { ASPECT_RATIO_DIMENSIONS, findEmptyPlacement } from "@/utils/genai";+import { resolveAsset, resolveGeneratedAsset } from "@/utils/jsx-generation";+import { assert, parseColor } from "@/utils";++import type { AssetRef, AssetSpecInput, ProjectDocument } from "@diffusionstudio/jsx";+import type { Engine, EngineWorld } from "@/components/engine";+import type { GenerationMemo } from "@/utils/jsx-generation";++type DocumentNode = {+ kind: "element";+ eid: number;+ inPoint?: number;+ outPoint?: number;+ startTime?: number;+ objectFit?: keyof typeof SCALE_MODE_MAP;+ parent?: DocumentNode;+ children?: DocumentNode[];+} | {+ kind: "root";+ eid?: number;+ parent?: undefined;+ children?: DocumentNode[];+} | {+ kind: "text";+ text: string;+ parent?: DocumentNode;+ children?: DocumentNode[];+};++// Multiple new scenes are laid side by side in render order.+const PLACEMENT_GAP = 40;++const SCALE_MODE_MAP = {+ cover: ScaleMode.COVER,+ contain: ScaleMode.FIT,+ fill: ScaleMode.FILL,+} as const;++const FONT_STYLE_MAP = {+ normal: FontStyle.NORMAL,+ italic: FontStyle.ITALIC,+ oblique: FontStyle.OBLIQUE,+} as const;++const TEXT_ALIGN_MAP = {+ left: TextAlign.LEFT,+ center: TextAlign.CENTER,+ right: TextAlign.RIGHT,+} as const;++const TEXT_BASELINE_MAP = {+ top: TextBaseline.TOP,+ middle: TextBaseline.MIDDLE,+ bottom: TextBaseline.BOTTOM,+} as const;++const CAPTION_PRESET_MAP = {+ classic: CaptionType.CLASSIC,+ cascade: CaptionType.CASCADE,+ spotlight: CaptionType.SPOTLIGHT,+ whisper: CaptionType.WHISPER,+ paper: CaptionType.PAPER,+ guinea: CaptionType.GUINEA,+ stark: CaptionType.STARK,+} as const;++type GenaiQueueItem = {+ node: DocumentNode;+ ref?: AssetRef;+ type: "asset" | "caption";+};++export class WorldDocument implements ProjectDocument<DocumentNode> {+ public promises: Promise<void>[] = [];+ public stage: DocumentNode;+ public rootEid: number | null = null;+ public engine: Engine;++ private queue: GenaiQueueItem[] = [];++ public constructor(engine: Engine, target?: { parentEid: number }) {+ this.stage = { kind: "root", eid: target?.parentEid };+ this.engine = engine;+ }++ /**+ * Waits for the rendering to complete and then handles the genai queue.+ */+ public async commit(): Promise<void> {+ const world = this.world;+ const c = world.components;+ const errors: unknown[] = [];++ // Wait for assets to settle+ {+ await Promise.all(this.promises);+ }++ // Handle generative queue+ {+ const memo: GenerationMemo = new Map();++ await Promise.all(this.queue.map(async ({ node, ref, type }) => {+ if (node.kind !== "element" || hasComponent(world, node.eid, c.Deleted) || type !== "asset" || !ref) return;+ try {+ const asset = await resolveGeneratedAsset(world, ref, memo);+ await this.mountSource(node, asset.id);+ } catch (err) {+ errors.push(err instanceof Error ? err : new Error(String(err), { cause: err }));+ } finally {+ world.history.untrack(() => removeComponent(world, node.eid, c.Generating));+ }+ }));+ }++ // Handle captioning queue+ {+ const scenes = new Map<number, number[]>();++ for (const { node, type } of this.queue) {+ if (node.kind !== "element" || hasComponent(world, node.eid, c.Deleted) || type !== "caption" || c.AssetId[node.eid]) continue;+ const sceneEid = getSceneAncestor(world, node.eid);+ if (sceneEid === null) continue;+ scenes.set(sceneEid, [...(scenes.get(sceneEid) ?? []), node.eid]);+ }++ for (const [sceneEid, eids] of scenes) {+ if (!hasAudioSources(world, sceneEid)) continue;+ try {+ const { asset, trim } = await transcribeScene(this.engine, sceneEid);+ world.history.transaction("Attach captions", () => {+ for (const eid of eids) {+ if (hasComponent(world, eid, c.Deleted)) continue;+ setComponent(world, eid, c.AssetId, asset.id);+ setComponent(world, eid, c.Trim, trim);+ }+ });+ } catch (error) {+ console.error("Captioning failed:", error);+ }+ }+ }++ // Handle errors+ {+ const messages = errors.map((err) => err instanceof Error ? err.message : String(err));+ assert(errors.length === 0, `${errors.length} asset generations failed:\n${messages.join("\n")}`);+ }+ }++ private get world(): EngineWorld {+ return this.engine.world;+ }++ public createElement(tag: string): DocumentNode {+ const world = this.world;+ const c = world.components;+ const eid = createEntity(world);+ const node: DocumentNode = { kind: "element", eid };++ switch (tag) {+ case "scene": {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ addComponent(world, eid, c.Scene);+ addComponent(world, eid, c.ClipsContent);+ setComponent(world, eid, c.Name, getNextName(world, "Scene"));+ break;+ } case "group": {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ addComponent(world, eid, c.Group);+ setComponent(world, eid, c.Name, getNextName(world, "Group"));+ break;+ } case "rect": {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ setComponent(world, eid, c.Name, getNextName(world, "Rect"));+ break;+ } case "sequence": {+ addComponent(world, eid, c.Group);+ addComponent(world, eid, c.Sequential);+ setComponent(world, eid, c.Name, getNextName(world, "Sequence"));+ break;+ } case "video": {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ setComponent(world, eid, c.Name, getNextName(world, "Video"));+ break;+ } case "image": {+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ setComponent(world, eid, c.Name, getNextName(world, "Image"));+ break;+ } case "audio": {+ addComponent(world, eid, c.Audio);+ setComponent(world, eid, c.Geometry, GeometryType.RECT);+ setComponent(world, eid, c.Name, getNextName(world, "Audio"));+ break;+ } case "text": {+ setComponent(world, eid, c.Geometry, GeometryType.TEXT);+ const fid = createEntity(world);+ setComponent(world, fid, c.Paint, PaintType.SOLID);+ setComponent(world, fid, c.Color, 0xffffff);+ appendChild(world, fid, eid);+ break;+ } case "captions": {+ setComponent(world, eid, c.Geometry, GeometryType.TEXT);+ setComponent(world, eid, c.Caption, {});+ setComponent(world, eid, c.Name, getNextName(world, "Captions"));+ this.queue.push({ node, type: "caption" });+ break;+ } case "solidPaint": {+ setComponent(world, eid, c.Paint, PaintType.SOLID);+ setComponent(world, eid, c.Color, 0xE0E0E0);+ break;+ } case "linearGradientPaint": {+ setComponent(world, eid, c.Paint, PaintType.LINEAR_GRADIENT);+ break;+ } case "radialGradientPaint": {+ setComponent(world, eid, c.Paint, PaintType.RADIAL_GRADIENT);+ break;+ } case "colorStop": {+ setComponent(world, eid, c.ColorStop, {});+ break;+ } default: {+ assert(false, `unknown tag: "${tag}"`);+ }+ }++ return node;+ }++ public createTextNode(text: string): DocumentNode {+ // This is the text inside a tag, there is no engine equivalent+ return { kind: "text", text };+ }++ /**+ * Wraps an existing entity so props can be applied to it through the same+ * `setProperty` path a fresh render uses (e.g. `dapi node patch`). Timing+ * state is hydrated from the entity's components so a partial patch (say,+ * only `inPoint`) composes with its existing delay/trim like a full render.+ */+ public element(eid: number): DocumentNode {+ const world = this.world;+ const c = world.components;+ const node: DocumentNode = { kind: "element", eid };+ if (hasComponent(world, eid, c.Delay)) node.startTime = c.Delay[eid];+ if (hasComponent(world, eid, c.Trim)) {+ const delay = node.startTime ?? 0;+ const start = c.Trim.start[eid];+ const end = c.Trim.end[eid];+ if (start !== undefined) node.inPoint = start + delay;+ if (end !== undefined) node.outPoint = end + delay;+ }+ return node;+ }++ public replaceText(node: DocumentNode, text: string) {+ assert(node.kind === "text", "replaceText target is not a text node");+ node.text = text;+ }++ public isTextNode(node: DocumentNode): boolean {+ return node.kind === "text";+ }++ public setProperty(node: DocumentNode, name: string, value: unknown) {+ if (name === "children" || name === "ref" || value === undefined || node.kind !== "element") return;++ const world = this.world;+ const c = world.components;+ const eid = node.eid;++ switch (name) {+ case "name": {+ assert(typeof value === "string", "`name` must be a string" + `, value: ${value}`);+ setComponent(world, eid, c.Name, value);+ break;+ } case "x": {+ assert(typeof value === "number", "`x` must be a number" + `, value: ${value}`);+ setComponent(world, eid, c.Position, { x: Math.round(value) });+ break;+ } case "y": {+ assert(typeof value === "number", "`y` must be a number" + `, value: ${value}`);+ setComponent(world, eid, c.Position, { y: Math.round(value) });+ break;+ } case "width": {+ assert(typeof value === "number", "`width` must be a number" + `, value: ${value}`);+ assert(value >= 0, "`width` must be >= 0");+ resizeEntity(world, eid, { width: Math.round(value) });+ break;+ } case "height":+ assert(typeof value === "number", "`height` must be a number" + `, value: ${value}`);+ assert(value >= 0, "`height` must be >= 0");+ resizeEntity(world, eid, { height: Math.round(value) });+ break;+ case "rotation": {+ assert(typeof value === "number", "`rotation` must be a number" + `, value: ${value}`);+ setComponent(world, eid, c.Rotation, value);+ break;+ } case "opacity": {+ assert(typeof value === "number", "`opacity` must be a number" + `, value: ${value}`);+ assert(value >= 0 && value <= 1, "`opacity` must be between 0 and 1");+ if (hasComponent(world, eid, c.ColorStop)) {+ setComponent(world, eid, c.ColorStop, { opacity: value });+ } else {+ setComponent(world, eid, c.Appearance, { opacity: value });+ }+ break;+ } case "cornerRadius": {+ assert(typeof value === "number", "`cornerRadius` must be a number" + `, value: ${value}`);+ assert(value >= 0, "`cornerRadius` must be >= 0");+ setComponent(world, eid, c.CornerRadius, Math.round(value));+ break;+ } case "inPoint": {+ const parsed = parseFrames(String(value), 30);+ assert(typeof parsed === "number", "`inPoint` must be a string or number" + `, value: ${value}`);+ node.inPoint = parsed;+ const delay = node.startTime ?? 0;+ setComponent(world, eid, c.Trim, { start: node.inPoint - delay });+ break;+ } case "outPoint": {+ const parsed = parseFrames(String(value), 30);+ assert(typeof parsed === "number", "`outPoint` must be a string or number" + `, value: ${value}`);+ node.outPoint = parsed;+ const delay = node.startTime ?? 0;+ setComponent(world, eid, c.Trim, { end: node.outPoint - delay });+ break;+ }+ case "startTime": {+ const parsed = parseFrames(String(value), 30);+ assert(typeof parsed === "number", "`startTime` must be a string or number" + `, value: ${value}`);+ node.startTime = parsed;+ setComponent(world, eid, c.Delay, node.startTime);+ if (node.inPoint !== undefined) {+ setComponent(world, eid, c.Trim, { start: node.inPoint - node.startTime });+ }+ if (node.outPoint !== undefined) {+ setComponent(world, eid, c.Trim, { end: node.outPoint - node.startTime });+ }+ break;+ }+ case "fill": {+ assert(typeof value === "string", "`fill` must be a string" + `, value: ${value}`);+ const color = parseColor(value);+ assert(color !== null, `fill is not a valid CSS color: "${value}"`);+ const fills = [...query(world, [c.Paint, ChildOf(eid), Not(c.Deleted)])]+ .filter((fid) => c.Paint[fid] === PaintType.SOLID);++ if (fills.length === 0) {+ const fid = createEntity(world);+ setComponent(world, fid, c.Paint, PaintType.SOLID);+ appendChild(world, fid, eid);+ fills.push(fid);+ }+++ for (const fid of fills) {+ setComponent(world, fid, c.Color, color);+ }+ break;+ }+ case "volume": {+ assert(typeof value === "number", "`volume` must be a number" + `, value: ${value}`);+ assert(value >= 0, "`volume` must be >= 0");+ // Convert linear volume to decibels+ const db = value <= 0 ? -Infinity : 20 * Math.log10(value);+ setComponent(world, eid, c.Volume, db);+ break;+ } case "src": {+ if (isAssetRef(value)) {+ world.history.untrack(() => addComponent(world, eid, c.Generating));+ if (!hasComponent(world, eid, c.Size)) {+ resizeEntity(world, eid, placeholderSize(getAssetSpec(value)));+ }+ this.queue.push({ node, ref: value, type: "asset" });+ break;+ }+ assert(typeof value === "string", "`src` must be a string" + `, value: ${value}`);+ assert(value.trim().length > 0, "`src` must be a non-empty string");++ this.promises.push(this.mountSource(node, value));+ break;+ } case "objectFit":+ assert(typeof value === "string", "`objectFit` must be a string" + `, value: ${value}`);+ assert(value in SCALE_MODE_MAP, `invalid objectFit value: "${value}"`);++ // The media paint is attached asynchronously+ node.objectFit = value as keyof typeof SCALE_MODE_MAP;++ for (const pid of query(world, [c.Paint, ChildOf(eid), Not(c.Deleted)])) {+ if (c.Paint[pid] === PaintType.IMAGE || c.Paint[pid] === PaintType.VIDEO) {+ setComponent(world, pid, c.ScaleMode, SCALE_MODE_MAP[node.objectFit]);+ }+ }+ break;+ case "key": {+ assert(typeof value === "string", "`key` must be a string" + `, value: ${value}`);+ assert(value.trim().length > 0, "`key` must be a non-empty string");+ setComponent(world, eid, c.Key, value.trim());+ break;+ }+ case "fontFamily":+ assert(typeof value === "string", "`fontFamily` must be a string" + `, value: ${value}`);+ assert(value.trim().length > 0, "`fontFamily` must be a non-empty string");+ setComponent(world, eid, c.TextStyle, { fontFamily: value.trim() });+ break;+ case "fontSize":+ assert(typeof value === "number", "`fontSize` must be a number" + `, value: ${value}`);+ assert(value > 0, "`fontSize` must be > 0");+ setComponent(world, eid, c.TextStyle, { fontSize: Math.round(value) });+ break;+ case "fontWeight":+ if (value === "normal") value = "400";+ else if (value === "bold") value = "700";+ assert(typeof value === "string", "`fontWeight` must be a string" + `, value: ${value}`);+ assert(Number.isFinite(Number(value)), "`fontWeight` must be a number");+ setComponent(world, eid, c.TextStyle, { fontWeight: value });+ break;+ case "fontStyle":+ assert(typeof value === "string", "`fontStyle` must be a string" + `, value: ${value}`);+ assert(value in FONT_STYLE_MAP, `invalid fontStyle value: "${value}"`);+ setComponent(world, eid, c.TextStyle, { fontStyle: FONT_STYLE_MAP[value as keyof typeof FONT_STYLE_MAP] });+ break;+ case "textAlign":+ assert(typeof value === "string", "`textAlign` must be a string" + `, value: ${value}`);+ assert(value in TEXT_ALIGN_MAP, `invalid textAlign value: "${value}"`);+ setComponent(world, eid, c.TextStyle, { textAlign: TEXT_ALIGN_MAP[value as keyof typeof TEXT_ALIGN_MAP] });+ break;+ case "textBaseline":+ assert(typeof value === "string", "`textBaseline` must be a string" + `, value: ${value}`);+ assert(value in TEXT_BASELINE_MAP, `invalid textBaseline value: "${value}"`);+ setComponent(world, eid, c.TextStyle, { textBaseline: TEXT_BASELINE_MAP[value as keyof typeof TEXT_BASELINE_MAP] });+ break;+ case "color": {+ assert(typeof value === "string", "`color` must be a string" + `, value: ${value}`);+ const color = parseColor(value);+ assert(color !== null, `color is not a valid CSS color: "${value}"`);+ if (hasComponent(world, eid, c.ColorStop)) {+ setComponent(world, eid, c.ColorStop, { color });+ } else if (hasComponent(world, eid, c.Paint)) {+ setComponent(world, eid, c.Color, color);+ } else {+ assert(false, "`color` only applies to paints or color stops");+ }+ break;+ } case "offset": {+ assert(hasComponent(world, eid, c.ColorStop), "`offset` only applies to <colorStop>");+ assert(typeof value === "number", "`offset` must be a number" + `, value: ${value}`);+ assert(value >= 0 && value <= 1, "`offset` must be between 0 and 1");+ setComponent(world, eid, c.ColorStop, { offset: value });+ break;+ } case "preset": {+ assert(hasComponent(world, eid, c.Caption), "`preset` only applies to <captions>");+ assert(typeof value === "string", "`preset` must be a string" + `, value: ${value}`);+ assert(value in CAPTION_PRESET_MAP, `invalid preset value: "${value}"`);+ setComponent(world, eid, c.Caption, { type: CAPTION_PRESET_MAP[value as keyof typeof CAPTION_PRESET_MAP] });+ break;+ } case "colors": {+ assert(hasComponent(world, eid, c.Caption), "`colors` only applies to <captions>");+ assert(Array.isArray(value), "`colors` must be an array of CSS colors" + `, value: ${value}`);+ const colors = value.map((entry) => {+ assert(typeof entry === "string", "`colors` entries must be strings" + `, value: ${entry}`);+ const color = parseColor(entry);+ assert(color !== null, `colors entry is not a valid CSS color: "${entry}"`);+ return color;+ });+ setComponent(world, eid, c.Caption, { colors });+ break;+ }+ }+ }++ public insertNode(parent: DocumentNode, node: DocumentNode) {+ const c = this.world.components;+ if (parent.kind === "root" && node.kind === "element") {+ if (parent.eid === undefined) {+ assert(hasComponent(this.world, node.eid, c.Geometry), "this element cannot be a document root");+ const key = c.Key[node.eid];+ assert(key !== undefined, "`key` is required for `root` nodes");++ // Find and replace node with the same key+ const existing = query(this.world, [c.Key, Not(c.Deleted)])+ .find((eid) => eid !== node.eid && c.Key[eid] === key);++ if (existing === undefined) {+ const width = c.Computed.width[node.eid] ?? 0;+ const height = c.Computed.height[node.eid] ?? 0;+ const position = this.findPlacement(width, height);+ setComponent(this.world, node.eid, c.Position, position);+ } else {+ setComponent(this.world, node.eid, c.Position, {+ x: c.Position.x[existing] ?? 0,+ y: c.Position.y[existing] ?? 0,+ });+ deleteEntity(this.world, existing);+ }+ } else {+ appendChild(this.world, node.eid, parent.eid);+ }++ this.rootEid = node.eid;+ } else if (parent.kind === "element" && node.kind === "text") {+ assert(hasComponent(this.world, parent.eid, c.Geometry), `<${parent.kind}> cannot contain text`);+ assert(c.Geometry[parent.eid] === GeometryType.TEXT, `<${parent.kind}> is not a text element`);+ setComponent(this.world, parent.eid, c.Chars, node.text);+ } else if (parent.kind === "element" && node.kind === "element") {+ appendChild(this.world, node.eid, parent.eid);+ }++ parent.children ??= [];+ parent.children.push(node);+ node.parent = parent;+ }++ public removeNode(parent: DocumentNode, node: DocumentNode) {+ const c = this.world.components;++ if (parent.kind === "element" && node.kind === "text") {+ removeComponent(this.world, parent.eid, c.Chars);+ } else if (parent.kind === "element" && node.kind === "element") {+ removeChild(this.world, node.eid, parent.eid);+ deleteEntity(this.world, node.eid);+ }++ parent.children = parent.children?.filter((child) => child !== node);+ node.parent = undefined;+ }++ public getParentNode(node: DocumentNode): DocumentNode | undefined {+ return node.parent;+ }++ public getFirstChild(node: DocumentNode): DocumentNode | undefined {+ return node.children?.[0];+ }++ public getNextSibling(node: DocumentNode): DocumentNode | undefined {+ const index = node.parent?.children?.indexOf(node);+ if (index === undefined || index == -1) {+ return undefined;+ }++ return node.parent?.children?.[index + 1];+ }++ private findPlacement(width: number, height: number): { x: number; y: number } {+ const center = findEmptyPlacement(this.world, width, height, PLACEMENT_GAP);+ return {+ x: Math.round(center.x - width / 2),+ y: Math.round(center.y - height / 2),+ };+ }++ /**+ * Attaches a resolved asset to a media node — shared by plain `src` values+ * (resolved during mount) and generated assets (landing after commit).+ */+ private async mountSource(node: DocumentNode, src: string) {+ if (node.kind !== "element") return;++ const asset = await resolveAsset(this.world, src);+ const world = this.world;+ const c = world.components;+ const eid = node.eid;++ if (asset.type === 'AUDIO') {+ setComponent(world, eid, c.AssetId, asset.id);+ resizeEntity(world, eid, { width: 500, height: 150 });+ } else if (asset.type === 'IMAGE' || asset.type === 'VIDEO') {+ const fid = createEntity(world);+ setComponent(world, fid, c.Paint, asset.type === 'IMAGE' ? PaintType.IMAGE : PaintType.VIDEO);+ setComponent(world, fid, c.ScaleMode, node.objectFit ? SCALE_MODE_MAP[node.objectFit] : ScaleMode.COVER);+ setComponent(world, fid, c.AssetId, asset.id);+ appendChild(world, fid, eid);++ if (!hasComponent(world, eid, c.Size)) {+ resizeEntity(world, eid, { width: asset.width, height: asset.height });+ }+ }++ setComponent(world, eid, c.Name, asset.name);+ }+}++function placeholderSize(spec: AssetSpecInput): { width: number; height: number } {+ if (spec.type === "image" || spec.type === "video") {+ return ASPECT_RATIO_DIMENSIONS[spec.aspectRatio ?? "16:9"] ?? { width: 1920, height: 1080 };+ }+ return { width: 500, height: 150 };+}++function parseFrames(value: string | null | undefined, fps: number): number | undefined {+ const seconds = parseTime(value);+ return seconds === undefined ? undefined : Math.round(seconds * fps);+}++/**+ * Evaluates a compiled project module (see JSX_API.md). The CLI ships a+ * single-file ESM bundle whose host modules are left external under the+ * "dapi-host:" prefix; here each one is rewritten to a blob-URL shim that+ * re-exports the app's own module instance, so the project shares the+ * editor's reactive runtime (and the same AssetRef class).+ */++// Must match HOST_MODULE_PREFIX in @diffusionstudio/cli's compile step.+const HOST_MODULE_PREFIX = "dapi-host:";++const HOST_MODULES: Record<string, object> = {+ "solid-js": solid,+ "solid-js/store": solidStore,+ "@diffusionstudio/jsx": diffusionJsx,+};++declare global {+ var __dapiHostModules__: Record<string, object> | undefined;+}++const shimUrls = new Map<string, string>();++// A blob module cannot import bare specifiers, so the shim reaches its target+// namespace through a global and re-exports every name statically.+function getShimUrl(name: string): string {+ const cached = shimUrls.get(name);+ if (cached) return cached;++ const ns = HOST_MODULES[name]!;+ globalThis.__dapiHostModules__ ??= {};+ globalThis.__dapiHostModules__[name] = ns;++ const lines = [`const m = globalThis.__dapiHostModules__[${JSON.stringify(name)}];`];+ for (const key of Object.keys(ns)) {+ if (key === "default") continue;+ lines.push(`export const ${key} = m[${JSON.stringify(key)}];`);+ }+ if ("default" in ns) lines.push("export default m.default;");++ const url = URL.createObjectURL(new Blob([lines.join("\n")], { type: "text/javascript" }));+ shimUrls.set(name, url);+ return url;+}++export async function importProjectModule(code: string): Promise<Record<string, unknown>> {+ let rewritten = code;+ for (const name of Object.keys(HOST_MODULES)) {+ rewritten = rewritten.replaceAll(+ JSON.stringify(`${HOST_MODULE_PREFIX}${name}`),+ JSON.stringify(getShimUrl(name)),+ );+ }++ const url = URL.createObjectURL(new Blob([rewritten], { type: "text/javascript" }));+ try {+ // Top-level code (including top-level await) runs to completion here.+ return (await import(/* @vite-ignore */ url)) as Record<string, unknown>;+ } finally {+ URL.revokeObjectURL(url);+ }+}diff --git a/apps/web/src/utils/media.ts b/apps/web/src/utils/media.tsnew file mode 100644index 00000000..b57ee7a0--- /dev/null+++ b/apps/web/src/utils/media.ts@@ -0,0 +1,77 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */+++/**+ * Converts a MIME type to its corresponding file extension+ * @param mimeType - The MIME type to convert (e.g., "image/jpeg" or "text/plain; charset=utf-8")+ * @returns The file extension with leading dot (e.g., ".jpg") or null if not found+ */+export function mimeTypeToExtension(mimeType: string): string {+ // Normalize the MIME type to lowercase and extract main type (before semicolon)+ const normalizedMimeType = mimeType.toLowerCase().trim().split(';')[0].trim();++ const mimeToExtMap: Record<string, string> = {+ // Images+ 'image/jpeg': '.jpg',+ 'image/jpg': '.jpg',+ 'image/png': '.png',+ 'image/gif': '.gif',+ 'image/webp': '.webp',+ 'image/svg+xml': '.svg',+ 'image/bmp': '.bmp',+ 'image/tiff': '.tiff',+ 'image/x-icon': '.ico',+ 'image/vnd.microsoft.icon': '.ico',+ 'image/avif': '.avif',+ 'image/heic': '.heic',+ 'image/heif': '.heif',++ // Documents+ 'application/pdf': '.pdf',+ 'text/plain': '.txt',++ // Audio+ 'audio/mpeg': '.mp3',+ 'audio/mp3': '.mp3',+ 'audio/wav': '.wav',+ 'audio/wave': '.wav',+ 'audio/x-wav': '.wav',+ 'audio/ogg': '.ogg',+ 'audio/aac': '.aac',+ 'audio/m4a': '.m4a',+ 'audio/flac': '.flac',+ 'audio/webm': '.webm',++ // Video+ 'video/mp4': '.mp4',+ 'video/mpeg': '.mpeg',+ 'video/quicktime': '.mov',+ 'video/x-msvideo': '.avi',+ 'video/webm': '.webm',+ 'video/ogg': '.ogv',+ 'video/3gpp': '.3gp',+ 'video/x-flv': '.flv',+ 'video/x-ms-wmv': '.wmv',++ // Web files+ 'text/html': '.html',+ 'application/json': '.json',+ 'text/xml': '.xml',+ 'application/xml': '.xml',+ };++ return mimeToExtMap[normalizedMimeType] || '.bin';+}++/**+ * Returns a file name without its final extension.+ * @param name - File name+ * @returns File name without extension+ */+export function stripExtension(name: string): string {+ const dotIndex = name.lastIndexOf('.');+ if (dotIndex <= 0) return name;+ return name.slice(0, dotIndex);+}diff --git a/apps/web/src/utils/signal.ts b/apps/web/src/utils/signal.tsnew file mode 100644index 00000000..baf02bba--- /dev/null+++ b/apps/web/src/utils/signal.ts@@ -0,0 +1,96 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createMemo, createRoot, createSignal, type Accessor } from "solid-js";++export type SignalFunction<T> = {+ (): T;+ <S extends T>(value: S): S;+}++export function onCreated(fn: () => void): void {+ fn();+}++export function createSignalFunction<T>(initialValue: T): SignalFunction<T> {+ const [currentValue, setCurrentValue] = createSignal<T>(initialValue);++ function fn(): T;+ function fn(value: T): T;+ function fn(value?: T): T {+ if (arguments.length > 0 && value !== undefined) {+ setCurrentValue(() => value);+ }++ return currentValue();+ }++ return fn;+}++export function createRootMemo<T>(fn: () => T): [Accessor<T>, () => void] {+ return createRoot(dispose => {+ const memo = createMemo(() => fn());++ return [memo, dispose];+ });+}++export function createRootEffect(fn: () => void): () => void {+ return createRoot(dispose => {+ fn();+ return dispose;+ });+}++type Simplify<T> = { [K in keyof T]: T[K] } & {};++type MergeTwo<A, B> = Simplify<Omit<A, keyof B> & B>;++// Merge in order: MergeMany<[A, B, C]> = MergeTwo<MergeTwo<A, B>, C>+type MergeMany<T extends readonly unknown[]> =+ T extends readonly [infer A, infer B, ...infer R]+ ? MergeMany<readonly [MergeTwo<A & object, B & object>, ...R]>+ : T extends readonly [infer Only]+ ? Only & object+ : {};++type Nullable<T> = T | null | undefined;++/**+ * Object.assign semantics for *enumerable own props* (string + symbol),+ * but preserves property descriptors (getters/setters/etc).+ *+ * Return type matches ordered object spread:+ * { ...target, ...sources }+ */+export function mergeProps<+ T extends object,+ const S extends readonly object[]+>(+ target: T,+ ...sources: { [K in keyof S]: Nullable<S[K]> }+): Simplify<MergeMany<readonly [T, ...S]>> {+ for (const source of sources) {+ if (source == null) continue;++ const descriptors: PropertyDescriptorMap = {};++ // enumerable string keys+ for (const key of Object.keys(source)) {+ const d = Object.getOwnPropertyDescriptor(source, key);+ if (d) descriptors[key] = d;+ }++ // enumerable symbol keys+ for (const sym of Object.getOwnPropertySymbols(source)) {+ const d = Object.getOwnPropertyDescriptor(source, sym);+ if (d?.enumerable) (descriptors as any)[sym] = d;+ }++ Object.defineProperties(target, descriptors);+ }++ return target as any;+}diff --git a/apps/web/src/vite-env.d.ts b/apps/web/src/vite-env.d.tsnew file mode 100644index 00000000..d8755d9e--- /dev/null+++ b/apps/web/src/vite-env.d.ts@@ -0,0 +1,52 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/// <reference types="vite/client" />+/// <reference types="vite-plugin-solid-svg/types-component-solid" />+/// <reference types="@types/chrome" />+/// <reference types="user-agent-data-types" />++declare global {+ const APP_VERSION: string;+ interface Window {+ queryLocalFonts(query?: Record<string, any>): FontData[];+ chrome: any;+ desktop?: {+ platform: string;+ send(channel: string, payload: unknown): void;+ on(channel: string, cb: (payload: unknown) => void): (() => void);+ };+ showOpenFilePicker(options?: OpenFilePickerOptions): Promise<FileSystemFileHandle[]>;+ EyeDropper?: {+ new(): EyeDropper;+ };+ }++ interface OpenFilePickerOptions {+ multiple?: boolean;+ startIn?: 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | FileSystemHandle;+ types?: Array<{+ description?: string;+ accept: Record<string, string[]>;+ }>;+ excludeAcceptAllOption?: boolean;+ }+ interface EyeDropperOpenResult {+ sRGBHex: string;+ }+ interface EyeDropper {+ open(options?: { signal?: AbortSignal }): Promise<EyeDropperOpenResult>;+ }+ interface VideoEncoder {+ ondequeue(): void;+ }+ interface VideoDecoder {+ ondequeue(): void;+ }+ interface FileSystemHandle {+ remove(): Promise<void>;+ }+}++export type { };diff --git a/apps/web/tsconfig.app.json b/apps/web/tsconfig.app.jsonnew file mode 100644index 00000000..d6e87afb--- /dev/null+++ b/apps/web/tsconfig.app.json@@ -0,0 +1,35 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",+ "useDefineForClassFields": true,+ "erasableSyntaxOnly": false,+ "lib": [+ "es2024",+ "DOM",+ "DOM.Iterable"+ ],+ "types": [+ "vite-plugin-solid-svg/types-component-solid",+ "vite/client",+ "@types/audioworklet",+ "@types/wicg-file-system-access"+ ],+ "allowImportingTsExtensions": true,+ "jsx": "preserve",+ "jsxImportSource": "solid-js",+ "baseUrl": "./",+ "paths": {+ "@/*": [+ "./src/*"+ ],+ "@desktop/*": [+ "../desktop/src/*"+ ]+ }+ },+ "include": [+ "src",+ "../desktop/src/ipc-channels.ts"+ ]+}diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.jsonnew file mode 100644index 00000000..1ffef600--- /dev/null+++ b/apps/web/tsconfig.json@@ -0,0 +1,7 @@+{+ "files": [],+ "references": [+ { "path": "./tsconfig.app.json" },+ { "path": "./tsconfig.node.json" }+ ]+}diff --git a/apps/web/tsconfig.node.json b/apps/web/tsconfig.node.jsonnew file mode 100644index 00000000..54784de1--- /dev/null+++ b/apps/web/tsconfig.node.json@@ -0,0 +1,11 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",+ "target": "ES2023",+ "lib": ["ES2023"],+ "types": ["node"],+ "allowImportingTsExtensions": true+ },+ "include": ["vite.config.ts"]+}diff --git a/apps/web/vercel.json b/apps/web/vercel.jsonnew file mode 100644index 00000000..d091d27a--- /dev/null+++ b/apps/web/vercel.json@@ -0,0 +1,18 @@+{+ "$schema": "https://openapi.vercel.sh/vercel.json",+ "framework": "vite",+ "buildCommand": "cp .env.example .env && npm run build",+ "outputDirectory": "dist",+ "rewrites": [+ { "source": "/((?!.*\\..*).*)", "destination": "/index.html" }+ ],+ "headers": [+ {+ "source": "/(.*)",+ "headers": [+ { "key": "Cross-Origin-Opener-Policy", "value": "same-origin" },+ { "key": "Cross-Origin-Embedder-Policy", "value": "credentialless" }+ ]+ }+ ]+}diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.tsnew file mode 100644index 00000000..f578fc6a--- /dev/null+++ b/apps/web/vite.config.ts@@ -0,0 +1,39 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { defineConfig } from 'vite'+import solid from 'vite-plugin-solid'+import solidSvg from 'vite-plugin-solid-svg'+import tailwindcss from '@tailwindcss/vite'+import { resolve } from 'path'+import pkg from '../../package.json'++export default defineConfig({+ plugins: [+ solid(),+ tailwindcss(),+ solidSvg({ defaultAsComponent: true }),+ ],+ define: {+ APP_VERSION: JSON.stringify(pkg.version),+ },+ server: {+ headers: {+ 'Cross-Origin-Opener-Policy': 'same-origin',+ 'Cross-Origin-Embedder-Policy': 'credentialless',+ },+ proxy: {+ '/api': {+ target: 'http://localhost:3000',+ changeOrigin: true,+ },+ },+ },+ resolve: {+ alias: {+ "@": resolve(__dirname, "./src"),+ "@desktop": resolve(__dirname, "../desktop/src"),+ }+ }+})diff --git a/package-lock.json b/package-lock.jsonnew file mode 100644index 00000000..14935249--- /dev/null+++ b/package-lock.json@@ -0,0 +1,11654 @@+{+ "name": "@diffusionstudio/editor",+ "version": "0.129.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "@diffusionstudio/editor",+ "version": "0.129.0",+ "license": "MPL-2.0",+ "workspaces": [+ "apps/*",+ "packages/*"+ ]+ },+ "apps/cli": {+ "name": "@diffusionstudio/cli",+ "version": "0.0.0",+ "license": "MPL-2.0",+ "dependencies": {+ "@babel/core": "^7.29.7",+ "@babel/preset-typescript": "^7.27.1",+ "babel-preset-solid": "^1.9.12",+ "commander": "^14.0.3",+ "esbuild": "^0.28.1"+ },+ "bin": {+ "dapi": "dist/index.js"+ },+ "devDependencies": {+ "@types/babel__core": "^7.20.5",+ "@types/node": "^24.10.1",+ "typescript": "~5.9.3"+ }+ },+ "apps/desktop": {+ "name": "@diffusionstudio/desktop",+ "version": "0.0.0",+ "license": "MPL-2.0",+ "dependencies": {+ "@diffusionstudio/cli": "*"+ },+ "devDependencies": {+ "@electron-forge/cli": "^7.11.1",+ "@electron-forge/maker-deb": "^7.11.1",+ "@electron-forge/maker-dmg": "^7.11.1",+ "@electron-forge/maker-squirrel": "^7.11.1",+ "@electron-forge/maker-zip": "^7.11.1",+ "@types/node": "^24.10.1",+ "electron": "^35.1.2",+ "esbuild": "^0.28.1",+ "typescript": "~5.9.3"+ }+ },+ "apps/web": {+ "name": "@diffusionstudio/web",+ "version": "0.0.0",+ "license": "MPL-2.0",+ "dependencies": {+ "@diffusionstudio/api-contract": "^0.1.0",+ "@diffusionstudio/cli": "*",+ "@diffusionstudio/jsx": "*",+ "@kobalte/core": "^0.13.11",+ "@sentry/solid": "^10.51.0",+ "@solid-primitives/keyboard": "^1.3.3",+ "@solid-primitives/pointer": "^0.3.3",+ "@solid-primitives/resize-observer": "^2.1.3",+ "@solidjs/router": "^0.15.4",+ "@supabase/supabase-js": "^2.99.2",+ "@tailwindcss/vite": "^4.1.18",+ "@trpc/client": "^11.10.0",+ "animejs": "^4.4.1",+ "bitecs": "^0.4.0",+ "cmdk-solid": "^1.1.2",+ "colord": "^2.9.3",+ "cva": "^1.0.0-beta.4",+ "idb": "^8.0.3",+ "mediabunny": "^1.32.2",+ "solid-js": "^1.9.10",+ "somoto": "^0.0.2",+ "sqids": "^0.3.0",+ "stats.js": "^0.17.0",+ "tailwind-merge": "^3.4.0",+ "tailwindcss": "^4.1.18",+ "tw-animate-css": "^1.4.0",+ "vite-plugin-solid-svg": "^0.8.1",+ "zod": "^4.2.1"+ },+ "devDependencies": {+ "@eslint/js": "^9.39.2",+ "@types/audioworklet": "^0.0.92",+ "@types/chrome": "^0.1.32",+ "@types/node": "^24.10.1",+ "@types/stats.js": "^0.17.4",+ "@types/wicg-file-system-access": "^2023.10.7",+ "@typescript-eslint/eslint-plugin": "^8.51.0",+ "@typescript-eslint/parser": "^8.51.0",+ "eslint": "^9.39.2",+ "eslint-plugin-solid": "^0.14.5",+ "globals": "^17.0.0",+ "typescript": "~5.9.3",+ "vite": "^7.2.4",+ "vite-plugin-solid": "^2.11.10"+ }+ },+ "node_modules/@babel/code-frame": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",+ "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-validator-identifier": "^7.29.7",+ "js-tokens": "^4.0.0",+ "picocolors": "^1.1.1"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/compat-data": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz",+ "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/core": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",+ "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",+ "license": "MIT",+ "dependencies": {+ "@babel/code-frame": "^7.29.7",+ "@babel/generator": "^7.29.7",+ "@babel/helper-compilation-targets": "^7.29.7",+ "@babel/helper-module-transforms": "^7.29.7",+ "@babel/helpers": "^7.29.7",+ "@babel/parser": "^7.29.7",+ "@babel/template": "^7.29.7",+ "@babel/traverse": "^7.29.7",+ "@babel/types": "^7.29.7",+ "@jridgewell/remapping": "^2.3.5",+ "convert-source-map": "^2.0.0",+ "debug": "^4.1.0",+ "gensync": "^1.0.0-beta.2",+ "json5": "^2.2.3",+ "semver": "^6.3.1"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/babel"+ }+ },+ "node_modules/@babel/core/node_modules/semver": {+ "version": "6.3.1",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ }+ },+ "node_modules/@babel/generator": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz",+ "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/parser": "^7.29.7",+ "@babel/types": "^7.29.7",+ "@jridgewell/gen-mapping": "^0.3.12",+ "@jridgewell/trace-mapping": "^0.3.28",+ "jsesc": "^3.0.2"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-annotate-as-pure": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.29.7.tgz",+ "integrity": "sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw==",+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-compilation-targets": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz",+ "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==",+ "license": "MIT",+ "dependencies": {+ "@babel/compat-data": "^7.29.7",+ "@babel/helper-validator-option": "^7.29.7",+ "browserslist": "^4.24.0",+ "lru-cache": "^5.1.1",+ "semver": "^6.3.1"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",+ "license": "ISC",+ "dependencies": {+ "yallist": "^3.0.2"+ }+ },+ "node_modules/@babel/helper-compilation-targets/node_modules/semver": {+ "version": "6.3.1",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ }+ },+ "node_modules/@babel/helper-compilation-targets/node_modules/yallist": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",+ "license": "ISC"+ },+ "node_modules/@babel/helper-create-class-features-plugin": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.29.7.tgz",+ "integrity": "sha512-IY3ZD9Tmooqr3TUhc3DUWxiuo8xx1DWLhd5M7hQ+ZWJamqM2BbalrBJb2MisSLoYorOj75U03qULCxQTY9r3hg==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-annotate-as-pure": "^7.29.7",+ "@babel/helper-member-expression-to-functions": "^7.29.7",+ "@babel/helper-optimise-call-expression": "^7.29.7",+ "@babel/helper-replace-supers": "^7.29.7",+ "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7",+ "@babel/traverse": "^7.29.7",+ "semver": "^6.3.1"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0"+ }+ },+ "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": {+ "version": "6.3.1",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ }+ },+ "node_modules/@babel/helper-globals": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz",+ "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-member-expression-to-functions": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.29.7.tgz",+ "integrity": "sha512-j+7JYmk1JYDtACIGj0QJqqWZjoUpMoEikQGADMaHgCMCSDqd2+P32rfcibUNrGOMWrlzK1WJBdxrB3JJQZwWtg==",+ "license": "MIT",+ "dependencies": {+ "@babel/traverse": "^7.29.7",+ "@babel/types": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-module-imports": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz",+ "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==",+ "license": "MIT",+ "dependencies": {+ "@babel/traverse": "^7.29.7",+ "@babel/types": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-module-transforms": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz",+ "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-module-imports": "^7.29.7",+ "@babel/helper-validator-identifier": "^7.29.7",+ "@babel/traverse": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0"+ }+ },+ "node_modules/@babel/helper-optimise-call-expression": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.29.7.tgz",+ "integrity": "sha512-+kmGVjcT9RGYzoDwdwEqEvGgKe3BYq+O1iGzjFubaNgZHwYHP6lsF2Yghf4kEuv9BV7tYDZ913aBW9am6YKong==",+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-plugin-utils": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz",+ "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-replace-supers": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.29.7.tgz",+ "integrity": "sha512-atfGXWSeCiF4DnKZIfmJfQRkSw9b9gNNXR1kqKjbhG4pGYCOnkp8OcTB8E3NXjBu8NpheSnOeNKz8KT7UNFTmQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-member-expression-to-functions": "^7.29.7",+ "@babel/helper-optimise-call-expression": "^7.29.7",+ "@babel/traverse": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0"+ }+ },+ "node_modules/@babel/helper-skip-transparent-expression-wrappers": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.29.7.tgz",+ "integrity": "sha512-brcMGQaVzIeUb+6/bs1Av0f8YuNNjKY2JyvfRCsFuFsdKccEQ5Ges2y74D74NZ1Rz8lKJ9ksJkfqwQFJ/iNEyQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/traverse": "^7.29.7",+ "@babel/types": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-string-parser": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",+ "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-validator-identifier": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",+ "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helper-validator-option": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz",+ "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/helpers": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz",+ "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==",+ "license": "MIT",+ "dependencies": {+ "@babel/template": "^7.29.7",+ "@babel/types": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/parser": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz",+ "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==",+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.29.7"+ },+ "bin": {+ "parser": "bin/babel-parser.js"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@babel/plugin-syntax-jsx": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.29.7.tgz",+ "integrity": "sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-plugin-utils": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0-0"+ }+ },+ "node_modules/@babel/plugin-syntax-typescript": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.29.7.tgz",+ "integrity": "sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-plugin-utils": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0-0"+ }+ },+ "node_modules/@babel/plugin-transform-modules-commonjs": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.29.7.tgz",+ "integrity": "sha512-j0vCldybPC5b5dwCQOJ21uKtHzt7hxLygJTg9eF1ScfaikEDNfzn94XoW5Fi+seBR0nCyL23xaBFFkq7dTM8XQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-module-transforms": "^7.29.7",+ "@babel/helper-plugin-utils": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0-0"+ }+ },+ "node_modules/@babel/plugin-transform-typescript": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.29.7.tgz",+ "integrity": "sha512-jK52h8LaLc7JarhQV2ofeFMts4H7vnOXnqZNA6fYglBTZewRBE51KWt3BUltW1P+KoPsYkHoJeXePuz4zo2LMw==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-annotate-as-pure": "^7.29.7",+ "@babel/helper-create-class-features-plugin": "^7.29.7",+ "@babel/helper-plugin-utils": "^7.29.7",+ "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7",+ "@babel/plugin-syntax-typescript": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0-0"+ }+ },+ "node_modules/@babel/preset-typescript": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.29.7.tgz",+ "integrity": "sha512-/Foi8vKY2EVbed/1eZx0gJEEwHAIxogrySI7rULcRIvhZzbvoE/b5qG5Ghc0WKAFKOHA9SD1x7RsFlOYdutIiQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-plugin-utils": "^7.29.7",+ "@babel/helper-validator-option": "^7.29.7",+ "@babel/plugin-syntax-jsx": "^7.29.7",+ "@babel/plugin-transform-modules-commonjs": "^7.29.7",+ "@babel/plugin-transform-typescript": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0-0"+ }+ },+ "node_modules/@babel/template": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",+ "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",+ "license": "MIT",+ "dependencies": {+ "@babel/code-frame": "^7.29.7",+ "@babel/parser": "^7.29.7",+ "@babel/types": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/traverse": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz",+ "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==",+ "license": "MIT",+ "dependencies": {+ "@babel/code-frame": "^7.29.7",+ "@babel/generator": "^7.29.7",+ "@babel/helper-globals": "^7.29.7",+ "@babel/parser": "^7.29.7",+ "@babel/template": "^7.29.7",+ "@babel/types": "^7.29.7",+ "debug": "^4.3.1"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@babel/types": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz",+ "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-string-parser": "^7.29.7",+ "@babel/helper-validator-identifier": "^7.29.7"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@corvu/utils": {+ "version": "0.4.2",+ "resolved": "https://registry.npmjs.org/@corvu/utils/-/utils-0.4.2.tgz",+ "integrity": "sha512-Ox2kYyxy7NoXdKWdHeDEjZxClwzO4SKM8plAaVwmAJPxHMqA0rLOoAsa+hBDwRLpctf+ZRnAd/ykguuJidnaTA==",+ "license": "MIT",+ "dependencies": {+ "@floating-ui/dom": "^1.6.11"+ },+ "peerDependencies": {+ "solid-js": "^1.8"+ }+ },+ "node_modules/@diffusionstudio/api-contract": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/@diffusionstudio/api-contract/-/api-contract-0.1.0.tgz",+ "integrity": "sha512-oufWqwI9XZDV1hRexeRALTyW0c3xR2KShEz3YRh3Ejr9GIV2t58dZiMHUbPgbARafjEg7YsyLwfRqchgOuHKEA==",+ "license": "MIT",+ "dependencies": {+ "@trpc/server": "^11.10.0",+ "zod": "^4.3.6"+ }+ },+ "node_modules/@diffusionstudio/cli": {+ "resolved": "apps/cli",+ "link": true+ },+ "node_modules/@diffusionstudio/desktop": {+ "resolved": "apps/desktop",+ "link": true+ },+ "node_modules/@diffusionstudio/jsx": {+ "resolved": "packages/jsx",+ "link": true+ },+ "node_modules/@diffusionstudio/web": {+ "resolved": "apps/web",+ "link": true+ },+ "node_modules/@electron-forge/cli": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-7.11.2.tgz",+ "integrity": "sha512-c+C4ndLfHbxwZuCn9G8iT9wD/woLdaVkoSVjAIbj+0nJhi8UmiVsz/+Gxlj4cvhMRTzBMBxudstLU7RocMikfg==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/electron"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@electron-forge/core": "7.11.2",+ "@electron-forge/core-utils": "7.11.2",+ "@electron-forge/shared-types": "7.11.2",+ "@electron/get": "^3.0.0",+ "@inquirer/prompts": "^6.0.1",+ "@listr2/prompt-adapter-inquirer": "^2.0.22",+ "chalk": "^4.0.0",+ "commander": "^11.1.0",+ "debug": "^4.3.1",+ "fs-extra": "^10.0.0",+ "listr2": "^7.0.2",+ "log-symbols": "^4.0.0",+ "semver": "^7.2.1"+ },+ "bin": {+ "electron-forge": "dist/electron-forge.js",+ "electron-forge-vscode-nix": "script/vscode.sh",+ "electron-forge-vscode-win": "script/vscode.cmd"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/cli/node_modules/commander": {+ "version": "11.1.0",+ "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",+ "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=16"+ }+ },+ "node_modules/@electron-forge/core": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/core/-/core-7.11.2.tgz",+ "integrity": "sha512-RbOvlCahSlYBkY1XFgD5QuoifZltEY3ezYGqJYnV1z6RiUK1DfUXwdidmclBLI9d6u8NNr9xWPv79LHVc9ZA3Q==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/electron"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@electron-forge/core-utils": "7.11.2",+ "@electron-forge/maker-base": "7.11.2",+ "@electron-forge/plugin-base": "7.11.2",+ "@electron-forge/publisher-base": "7.11.2",+ "@electron-forge/shared-types": "7.11.2",+ "@electron-forge/template-base": "7.11.2",+ "@electron-forge/template-vite": "7.11.2",+ "@electron-forge/template-vite-typescript": "7.11.2",+ "@electron-forge/template-webpack": "7.11.2",+ "@electron-forge/template-webpack-typescript": "7.11.2",+ "@electron-forge/tracer": "7.11.2",+ "@electron/get": "^3.0.0",+ "@electron/packager": "^18.3.5",+ "@electron/rebuild": "^3.7.0",+ "@malept/cross-spawn-promise": "^2.0.0",+ "@vscode/sudo-prompt": "^9.3.1",+ "chalk": "^4.0.0",+ "debug": "^4.3.1",+ "eta": "^3.5.0",+ "fast-glob": "^3.2.7",+ "filenamify": "^4.1.0",+ "find-up": "^5.0.0",+ "fs-extra": "^10.0.0",+ "global-dirs": "^3.0.0",+ "got": "^11.8.5",+ "interpret": "^3.1.1",+ "jiti": "^2.4.2",+ "listr2": "^7.0.2",+ "log-symbols": "^4.0.0",+ "node-fetch": "^2.6.7",+ "rechoir": "^0.8.0",+ "semver": "^7.2.1",+ "source-map-support": "^0.5.13",+ "username": "^5.1.0"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/core-utils": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/core-utils/-/core-utils-7.11.2.tgz",+ "integrity": "sha512-/Fpwo44an6ulUdq94co5OOcbRCohgYNci/E6eoZZuTO9f72X+PqJkMkghqkMX3iQ8Aq2QRLkGKFwrKWJNTjL7Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2",+ "@electron/rebuild": "^3.7.0",+ "@malept/cross-spawn-promise": "^2.0.0",+ "chalk": "^4.0.0",+ "debug": "^4.3.1",+ "find-up": "^5.0.0",+ "fs-extra": "^10.0.0",+ "log-symbols": "^4.0.0",+ "parse-author": "^2.0.0",+ "semver": "^7.2.1"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/maker-base": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/maker-base/-/maker-base-7.11.2.tgz",+ "integrity": "sha512-9934zYu9WVdgCYQXvtS+eL1oyLagsY8JlWhZmoK8yWTYftSAydH7jb3seVpfy6n85SYmY/yjcAy2lvOTy5dUwA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2",+ "fs-extra": "^10.0.0",+ "which": "^2.0.2"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/maker-deb": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/maker-deb/-/maker-deb-7.11.2.tgz",+ "integrity": "sha512-MYSdCTsqzKNmsmaq7CIFh2kJdBWUZ4njxnVGrIRClzueVITk5Kots3+eQo+e5QQLvXTVn2XTNDc2nYjvtBh+Mw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/maker-base": "7.11.2",+ "@electron-forge/shared-types": "7.11.2"+ },+ "engines": {+ "node": ">= 16.4.0"+ },+ "optionalDependencies": {+ "electron-installer-debian": "^3.2.0"+ }+ },+ "node_modules/@electron-forge/maker-dmg": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/maker-dmg/-/maker-dmg-7.11.2.tgz",+ "integrity": "sha512-vh8/mnu3xyMbRcz3S0TV1rB7ZyGhMK60Yz2f2R+Zmj1EbAivLEq5UAvzHdB+kLttr0Dpjp2FIX4TcZ9neD4Y9g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/maker-base": "7.11.2",+ "@electron-forge/shared-types": "7.11.2",+ "fs-extra": "^10.0.0"+ },+ "engines": {+ "node": ">= 16.4.0"+ },+ "optionalDependencies": {+ "electron-installer-dmg": "^5.0.1"+ }+ },+ "node_modules/@electron-forge/maker-squirrel": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/maker-squirrel/-/maker-squirrel-7.11.2.tgz",+ "integrity": "sha512-4CILo57ZDEQH1mJxjhYCSXuv+WaU7oPq67KqiTLEUOEzmiPg9u9/z7FXE34H/Tn5aKWN3dy+ngAETzv6iERCGg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/maker-base": "7.11.2",+ "@electron-forge/shared-types": "7.11.2",+ "fs-extra": "^10.0.0"+ },+ "engines": {+ "node": ">= 16.4.0"+ },+ "optionalDependencies": {+ "electron-winstaller": "^5.3.0"+ }+ },+ "node_modules/@electron-forge/maker-zip": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/maker-zip/-/maker-zip-7.11.2.tgz",+ "integrity": "sha512-FWnOm2MORX/nt8psnEtID3Vnt8Blby1NkzjU3KjXBPF9kave71C3lI8KbBbCeKKyTQ/S00i2FiglKdRWQ1WNTw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/maker-base": "7.11.2",+ "@electron-forge/shared-types": "7.11.2",+ "cross-zip": "^4.0.0",+ "fs-extra": "^10.0.0",+ "got": "^11.8.5"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/plugin-base": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-7.11.2.tgz",+ "integrity": "sha512-tIFzEE2+D9NnCAn/rLwSkh8H59IqN+G973JNl7xmCzquO6qa7/veitZOQFGO79Zmmgkc8R/fmiCbh7LIdLS9Tg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/publisher-base": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/publisher-base/-/publisher-base-7.11.2.tgz",+ "integrity": "sha512-YwK4ZF3+uW7PBEV/ho59NVTriP3fCahskORrztUaFIdG0QP3hqMsfmo01euv98FDsBEW9UXo7/EW8t5jpmYZ0Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/shared-types": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-7.11.2.tgz",+ "integrity": "sha512-Tcles7y74xy3jN5dEC+Pt1duJYk4c7W2xu98tjWW8RewmfKD2uHkie6I1I3yifPFZXZ/QfTlaFOOoKIQ9ENZjg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/tracer": "7.11.2",+ "@electron/packager": "^18.3.5",+ "@electron/rebuild": "^3.7.0",+ "listr2": "^7.0.2"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/template-base": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/template-base/-/template-base-7.11.2.tgz",+ "integrity": "sha512-l10I+XZRbbxFGiDLMnuXmlOppmLYmimKj6FWjEGUvft4VJFXW2BIDrLIugIGdM1nbrl/0aYjen2xRg0nZlcWzg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/core-utils": "7.11.2",+ "@electron-forge/shared-types": "7.11.2",+ "@malept/cross-spawn-promise": "^2.0.0",+ "debug": "^4.3.1",+ "fs-extra": "^10.0.0",+ "semver": "^7.2.1",+ "username": "^5.1.0"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/template-vite": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/template-vite/-/template-vite-7.11.2.tgz",+ "integrity": "sha512-yFSDSu3IdyNpgLXzrwODSUyaWniHRSZI82gwcXdnJLx7D7DIDLtbx6KzEoy7QBmWZRULO3F7rLsYG+Ur7orvyA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2",+ "@electron-forge/template-base": "7.11.2",+ "fs-extra": "^10.0.0"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/template-vite-typescript": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/template-vite-typescript/-/template-vite-typescript-7.11.2.tgz",+ "integrity": "sha512-QvvdmO9Gdv+3aISI9+bBLKPBTyKaucs6HhXxz+IDALcdykIL9wVN0/BrWuwwgbwuw4BiJTyXGSPNXuJ+EWnP6g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2",+ "@electron-forge/template-base": "7.11.2",+ "fs-extra": "^10.0.0"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/template-webpack": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack/-/template-webpack-7.11.2.tgz",+ "integrity": "sha512-JjG8XIZctrSZvTlii7Hqvt/pHDKigRk4PoLTQCs1TiT05ZWsn40itBm8cbja3L7bfm0ccDd3JTWWOl2G7PhlmA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2",+ "@electron-forge/template-base": "7.11.2",+ "fs-extra": "^10.0.0"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/template-webpack-typescript": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack-typescript/-/template-webpack-typescript-7.11.2.tgz",+ "integrity": "sha512-2lwK+OrCeZgYM8WqsUXJzk94rdF0z/kA7WnAf79U3COEmAAMcFIwJtwF8c/n+52UecP3yrEE70LIGmM1sjGZJQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron-forge/shared-types": "7.11.2",+ "@electron-forge/template-base": "7.11.2",+ "fs-extra": "^10.0.0",+ "typescript": "~5.4.5",+ "webpack": "^5.69.1"+ },+ "engines": {+ "node": ">= 16.4.0"+ }+ },+ "node_modules/@electron-forge/template-webpack-typescript/node_modules/typescript": {+ "version": "5.4.5",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",+ "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc",+ "tsserver": "bin/tsserver"+ },+ "engines": {+ "node": ">=14.17"+ }+ },+ "node_modules/@electron-forge/tracer": {+ "version": "7.11.2",+ "resolved": "https://registry.npmjs.org/@electron-forge/tracer/-/tracer-7.11.2.tgz",+ "integrity": "sha512-U8j5Hyj2Zt7I5PciJvPJfmEv69Gb/Da9v+k655z3Jj1cuY0UnToEJ61IhXrzlTYqo+jUKC+fgAjDJ6vltJTS0A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "chrome-trace-event": "^1.0.3"+ },+ "engines": {+ "node": ">= 14.17.5"+ }+ },+ "node_modules/@electron/asar": {+ "version": "3.4.1",+ "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.4.1.tgz",+ "integrity": "sha512-i4/rNPRS84t0vSRa2HorerGRXWyF4vThfHesw0dmcWHp+cspK743UanA0suA5Q5y8kzY2y6YKrvbIUn69BCAiA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "commander": "^5.0.0",+ "glob": "^7.1.6",+ "minimatch": "^3.0.4"+ },+ "bin": {+ "asar": "bin/asar.js"+ },+ "engines": {+ "node": ">=10.12.0"+ }+ },+ "node_modules/@electron/asar/node_modules/commander": {+ "version": "5.1.0",+ "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",+ "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/@electron/get": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/@electron/get/-/get-3.1.0.tgz",+ "integrity": "sha512-F+nKc0xW+kVbBRhFzaMgPy3KwmuNTYX1fx6+FxxoSnNgwYX6LD7AKBTWkU0MQ6IBoe7dz069CNkR673sPAgkCQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "debug": "^4.1.1",+ "env-paths": "^2.2.0",+ "fs-extra": "^8.1.0",+ "got": "^11.8.5",+ "progress": "^2.0.3",+ "semver": "^6.2.0",+ "sumchecker": "^3.0.1"+ },+ "engines": {+ "node": ">=14"+ },+ "optionalDependencies": {+ "global-agent": "^3.0.0"+ }+ },+ "node_modules/@electron/get/node_modules/fs-extra": {+ "version": "8.1.0",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",+ "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.0",+ "jsonfile": "^4.0.0",+ "universalify": "^0.1.0"+ },+ "engines": {+ "node": ">=6 <7 || >=8"+ }+ },+ "node_modules/@electron/get/node_modules/jsonfile": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",+ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",+ "dev": true,+ "license": "MIT",+ "optionalDependencies": {+ "graceful-fs": "^4.1.6"+ }+ },+ "node_modules/@electron/get/node_modules/semver": {+ "version": "6.3.1",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ }+ },+ "node_modules/@electron/get/node_modules/universalify": {+ "version": "0.1.2",+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 4.0.0"+ }+ },+ "node_modules/@electron/node-gyp": {+ "version": "10.2.0-electron.1",+ "resolved": "git+ssh://[email protected]/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2",+ "integrity": "sha512-CrYo6TntjpoMO1SHjl5Pa/JoUsECNqNdB7Kx49WLQpWzPw53eEITJ2Hs9fh/ryUYDn4pxZz11StaBYBrLFJdqg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "env-paths": "^2.2.0",+ "exponential-backoff": "^3.1.1",+ "glob": "^8.1.0",+ "graceful-fs": "^4.2.6",+ "make-fetch-happen": "^10.2.1",+ "nopt": "^6.0.0",+ "proc-log": "^2.0.1",+ "semver": "^7.3.5",+ "tar": "^6.2.1",+ "which": "^2.0.2"+ },+ "bin": {+ "node-gyp": "bin/node-gyp.js"+ },+ "engines": {+ "node": ">=12.13.0"+ }+ },+ "node_modules/@electron/node-gyp/node_modules/brace-expansion": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz",+ "integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0"+ }+ },+ "node_modules/@electron/node-gyp/node_modules/glob": {+ "version": "8.1.0",+ "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",+ "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",+ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "fs.realpath": "^1.0.0",+ "inflight": "^1.0.4",+ "inherits": "2",+ "minimatch": "^5.0.1",+ "once": "^1.3.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/@electron/node-gyp/node_modules/minimatch": {+ "version": "5.1.9",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",+ "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^2.0.1"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/@electron/notarize": {+ "version": "2.5.0",+ "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.5.0.tgz",+ "integrity": "sha512-jNT8nwH1f9X5GEITXaQ8IF/KdskvIkOFfB2CvwumsveVidzpSc+mvhhTMdAGSYF3O+Nq49lJ7y+ssODRXu06+A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "debug": "^4.1.1",+ "fs-extra": "^9.0.1",+ "promise-retry": "^2.0.1"+ },+ "engines": {+ "node": ">= 10.0.0"+ }+ },+ "node_modules/@electron/notarize/node_modules/fs-extra": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",+ "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "at-least-node": "^1.0.0",+ "graceful-fs": "^4.2.0",+ "jsonfile": "^6.0.1",+ "universalify": "^2.0.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/@electron/osx-sign": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.3.3.tgz",+ "integrity": "sha512-KZ8mhXvWv2rIEgMbWZ4y33bDHyUKMXnx4M0sTyPNK/vcB81ImdeY9Ggdqy0SWbMDgmbqyQ+phgejh6V3R2QuSg==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "compare-version": "^0.1.2",+ "debug": "^4.3.4",+ "fs-extra": "^10.0.0",+ "isbinaryfile": "^4.0.8",+ "minimist": "^1.2.6",+ "plist": "^3.0.5"+ },+ "bin": {+ "electron-osx-flat": "bin/electron-osx-flat.js",+ "electron-osx-sign": "bin/electron-osx-sign.js"+ },+ "engines": {+ "node": ">=12.0.0"+ }+ },+ "node_modules/@electron/packager": {+ "version": "18.4.4",+ "resolved": "https://registry.npmjs.org/@electron/packager/-/packager-18.4.4.tgz",+ "integrity": "sha512-fTUCmgL25WXTcFpM1M72VmFP8w3E4d+KNzWxmTDRpvwkfn/S206MAtM2cy0GF78KS9AwASMOUmlOIzCHeNxcGQ==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "@electron/asar": "^3.2.13",+ "@electron/get": "^3.0.0",+ "@electron/notarize": "^2.1.0",+ "@electron/osx-sign": "^1.0.5",+ "@electron/universal": "^2.0.1",+ "@electron/windows-sign": "^1.0.0",+ "@malept/cross-spawn-promise": "^2.0.0",+ "debug": "^4.0.1",+ "extract-zip": "^2.0.0",+ "filenamify": "^4.1.0",+ "fs-extra": "^11.1.0",+ "galactus": "^1.0.0",+ "get-package-info": "^1.0.0",+ "junk": "^3.1.0",+ "parse-author": "^2.0.0",+ "plist": "^3.0.0",+ "prettier": "^3.4.2",+ "resedit": "^2.0.0",+ "resolve": "^1.1.6",+ "semver": "^7.1.3",+ "yargs-parser": "^21.1.1"+ },+ "bin": {+ "electron-packager": "bin/electron-packager.js"+ },+ "engines": {+ "node": ">= 16.13.0"+ },+ "funding": {+ "url": "https://github.com/electron/packager?sponsor=1"+ }+ },+ "node_modules/@electron/packager/node_modules/fs-extra": {+ "version": "11.3.6",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.6.tgz",+ "integrity": "sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.0",+ "jsonfile": "^6.0.1",+ "universalify": "^2.0.0"+ },+ "engines": {+ "node": ">=14.14"+ }+ },+ "node_modules/@electron/rebuild": {+ "version": "3.7.2",+ "resolved": "https://registry.npmjs.org/@electron/rebuild/-/rebuild-3.7.2.tgz",+ "integrity": "sha512-19/KbIR/DAxbsCkiaGMXIdPnMCJLkcf8AvGnduJtWBs/CBwiAjY1apCqOLVxrXg+rtXFCngbXhBanWjxLUt1Mg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron/node-gyp": "git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2",+ "@malept/cross-spawn-promise": "^2.0.0",+ "chalk": "^4.0.0",+ "debug": "^4.1.1",+ "detect-libc": "^2.0.1",+ "fs-extra": "^10.0.0",+ "got": "^11.7.0",+ "node-abi": "^3.45.0",+ "node-api-version": "^0.2.0",+ "ora": "^5.1.0",+ "read-binary-file-arch": "^1.0.6",+ "semver": "^7.3.5",+ "tar": "^6.0.5",+ "yargs": "^17.0.1"+ },+ "bin": {+ "electron-rebuild": "lib/cli.js"+ },+ "engines": {+ "node": ">=12.13.0"+ }+ },+ "node_modules/@electron/universal": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-2.0.3.tgz",+ "integrity": "sha512-Wn9sPYIVFRFl5HmwMJkARCCf7rqK/EurkfQ/rJZ14mHP3iYTjZSIOSVonEAnhWeAXwtw7zOekGRlc6yTtZ0t+g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@electron/asar": "^3.3.1",+ "@malept/cross-spawn-promise": "^2.0.0",+ "debug": "^4.3.1",+ "dir-compare": "^4.2.0",+ "fs-extra": "^11.1.1",+ "minimatch": "^9.0.3",+ "plist": "^3.1.0"+ },+ "engines": {+ "node": ">=16.4"+ }+ },+ "node_modules/@electron/universal/node_modules/brace-expansion": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz",+ "integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0"+ }+ },+ "node_modules/@electron/universal/node_modules/fs-extra": {+ "version": "11.3.6",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.6.tgz",+ "integrity": "sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.0",+ "jsonfile": "^6.0.1",+ "universalify": "^2.0.0"+ },+ "engines": {+ "node": ">=14.14"+ }+ },+ "node_modules/@electron/universal/node_modules/minimatch": {+ "version": "9.0.9",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",+ "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^2.0.2"+ },+ "engines": {+ "node": ">=16 || 14 >=14.17"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/@electron/windows-sign": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/@electron/windows-sign/-/windows-sign-1.2.2.tgz",+ "integrity": "sha512-dfZeox66AvdPtb2lD8OsIIQh12Tp0GNCRUDfBHIKGpbmopZto2/A8nSpYYLoedPIHpqkeblZ/k8OV0Gy7PYuyQ==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "cross-dirname": "^0.1.0",+ "debug": "^4.3.4",+ "fs-extra": "^11.1.1",+ "minimist": "^1.2.8",+ "postject": "^1.0.0-alpha.6"+ },+ "bin": {+ "electron-windows-sign": "bin/electron-windows-sign.js"+ },+ "engines": {+ "node": ">=14.14"+ }+ },+ "node_modules/@electron/windows-sign/node_modules/fs-extra": {+ "version": "11.3.6",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.6.tgz",+ "integrity": "sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.0",+ "jsonfile": "^6.0.1",+ "universalify": "^2.0.0"+ },+ "engines": {+ "node": ">=14.14"+ }+ },+ "node_modules/@esbuild/aix-ppc64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",+ "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "aix"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-arm": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz",+ "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz",+ "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/android-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz",+ "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/darwin-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz",+ "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/darwin-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz",+ "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/freebsd-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz",+ "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/freebsd-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz",+ "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-arm": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz",+ "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz",+ "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-ia32": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz",+ "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==",+ "cpu": [+ "ia32"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-loong64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz",+ "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==",+ "cpu": [+ "loong64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-mips64el": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz",+ "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==",+ "cpu": [+ "mips64el"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-ppc64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz",+ "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-riscv64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz",+ "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==",+ "cpu": [+ "riscv64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-s390x": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz",+ "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==",+ "cpu": [+ "s390x"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/linux-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz",+ "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/netbsd-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz",+ "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/netbsd-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz",+ "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openbsd-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz",+ "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openbsd-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz",+ "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/openharmony-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",+ "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/sunos-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz",+ "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "sunos"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-arm64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz",+ "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-ia32": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz",+ "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==",+ "cpu": [+ "ia32"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@esbuild/win32-x64": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz",+ "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@eslint-community/eslint-utils": {+ "version": "4.9.1",+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",+ "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "eslint-visitor-keys": "^3.4.3"+ },+ "engines": {+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ },+ "peerDependencies": {+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"+ }+ },+ "node_modules/@eslint-community/regexpp": {+ "version": "4.12.2",+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz",+ "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"+ }+ },+ "node_modules/@eslint/config-array": {+ "version": "0.21.2",+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz",+ "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@eslint/object-schema": "^2.1.7",+ "debug": "^4.3.1",+ "minimatch": "^3.1.5"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/config-helpers": {+ "version": "0.4.2",+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",+ "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@eslint/core": "^0.17.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/core": {+ "version": "0.17.0",+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",+ "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@types/json-schema": "^7.0.15"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/eslintrc": {+ "version": "3.3.5",+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.5.tgz",+ "integrity": "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ajv": "^6.14.0",+ "debug": "^4.3.2",+ "espree": "^10.0.1",+ "globals": "^14.0.0",+ "ignore": "^5.2.0",+ "import-fresh": "^3.2.1",+ "js-yaml": "^4.1.1",+ "minimatch": "^3.1.5",+ "strip-json-comments": "^3.1.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/@eslint/eslintrc/node_modules/globals": {+ "version": "14.0.0",+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/@eslint/eslintrc/node_modules/ignore": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 4"+ }+ },+ "node_modules/@eslint/js": {+ "version": "9.39.4",+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.4.tgz",+ "integrity": "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://eslint.org/donate"+ }+ },+ "node_modules/@eslint/object-schema": {+ "version": "2.1.7",+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",+ "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@eslint/plugin-kit": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",+ "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@eslint/core": "^0.17.0",+ "levn": "^0.4.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ }+ },+ "node_modules/@floating-ui/core": {+ "version": "1.7.5",+ "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.5.tgz",+ "integrity": "sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ==",+ "license": "MIT",+ "dependencies": {+ "@floating-ui/utils": "^0.2.11"+ }+ },+ "node_modules/@floating-ui/dom": {+ "version": "1.7.6",+ "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.6.tgz",+ "integrity": "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ==",+ "license": "MIT",+ "dependencies": {+ "@floating-ui/core": "^1.7.5",+ "@floating-ui/utils": "^0.2.11"+ }+ },+ "node_modules/@floating-ui/utils": {+ "version": "0.2.11",+ "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.11.tgz",+ "integrity": "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==",+ "license": "MIT"+ },+ "node_modules/@gar/promisify": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz",+ "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@humanfs/core": {+ "version": "0.19.2",+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",+ "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@humanfs/types": "^0.15.0"+ },+ "engines": {+ "node": ">=18.18.0"+ }+ },+ "node_modules/@humanfs/node": {+ "version": "0.16.8",+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz",+ "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@humanfs/core": "^0.19.2",+ "@humanfs/types": "^0.15.0",+ "@humanwhocodes/retry": "^0.4.0"+ },+ "engines": {+ "node": ">=18.18.0"+ }+ },+ "node_modules/@humanfs/types": {+ "version": "0.15.0",+ "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz",+ "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=18.18.0"+ }+ },+ "node_modules/@humanwhocodes/module-importer": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=12.22"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/nzakas"+ }+ },+ "node_modules/@humanwhocodes/retry": {+ "version": "0.4.3",+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz",+ "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=18.18"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/nzakas"+ }+ },+ "node_modules/@inquirer/checkbox": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-3.0.1.tgz",+ "integrity": "sha512-0hm2nrToWUdD6/UHnel/UKGdk1//ke5zGUpHIvk5ZWmaKezlGxZkOJXNSWsdxO/rEqTkbB3lNC2J6nBElV2aAQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/figures": "^1.0.6",+ "@inquirer/type": "^2.0.0",+ "ansi-escapes": "^4.3.2",+ "yoctocolors-cjs": "^2.1.2"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/confirm": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-4.0.1.tgz",+ "integrity": "sha512-46yL28o2NJ9doViqOy0VDcoTzng7rAb6yPQKU7VDLqkmbCaH4JqK4yk4XqlzNWy9PVC5pG1ZUXPBQv+VqnYs2w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/type": "^2.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/core": {+ "version": "9.2.1",+ "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-9.2.1.tgz",+ "integrity": "sha512-F2VBt7W/mwqEU4bL0RnHNZmC/OxzNx9cOYxHqnXX3MP6ruYvZUZAW9imgN9+h/uBT/oP8Gh888J2OZSbjSeWcg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/figures": "^1.0.6",+ "@inquirer/type": "^2.0.0",+ "@types/mute-stream": "^0.0.4",+ "@types/node": "^22.5.5",+ "@types/wrap-ansi": "^3.0.0",+ "ansi-escapes": "^4.3.2",+ "cli-width": "^4.1.0",+ "mute-stream": "^1.0.0",+ "signal-exit": "^4.1.0",+ "strip-ansi": "^6.0.1",+ "wrap-ansi": "^6.2.0",+ "yoctocolors-cjs": "^2.1.2"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/core/node_modules/@types/node": {+ "version": "22.20.0",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.0.tgz",+ "integrity": "sha512-QWlFW2wf3nTjC13/DqRnBpR4ZO36VJH/JVBkA/vcnmbTBNQIlnObqyqZE1tUR7+Ni23Lda8R1BxMfbXRpCUx5g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~6.21.0"+ }+ },+ "node_modules/@inquirer/core/node_modules/undici-types": {+ "version": "6.21.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@inquirer/editor": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-3.0.1.tgz",+ "integrity": "sha512-VA96GPFaSOVudjKFraokEEmUQg/Lub6OXvbIEZU1SDCmBzRkHGhxoFAVaF30nyiB4m5cEbDgiI2QRacXZ2hw9Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/type": "^2.0.0",+ "external-editor": "^3.1.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/expand": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-3.0.1.tgz",+ "integrity": "sha512-ToG8d6RIbnVpbdPdiN7BCxZGiHOTomOX94C2FaT5KOHupV40tKEDozp12res6cMIfRKrXLJyexAZhWVHgbALSQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/type": "^2.0.0",+ "yoctocolors-cjs": "^2.1.2"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/figures": {+ "version": "1.0.15",+ "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.15.tgz",+ "integrity": "sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/input": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-3.0.1.tgz",+ "integrity": "sha512-BDuPBmpvi8eMCxqC5iacloWqv+5tQSJlUafYWUe31ow1BVXjW2a5qe3dh4X/Z25Wp22RwvcaLCc2siHobEOfzg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/type": "^2.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/number": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/number/-/number-2.0.1.tgz",+ "integrity": "sha512-QpR8jPhRjSmlr/mD2cw3IR8HRO7lSVOnqUvQa8scv1Lsr3xoAMMworcYW3J13z3ppjBFBD2ef1Ci6AE5Qn8goQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/type": "^2.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/password": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-3.0.1.tgz",+ "integrity": "sha512-haoeEPUisD1NeE2IanLOiFr4wcTXGWrBOyAyPZi1FfLJuXOzNmxCJPgUrGYKVh+Y8hfGJenIfz5Wb/DkE9KkMQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/type": "^2.0.0",+ "ansi-escapes": "^4.3.2"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/prompts": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-6.0.1.tgz",+ "integrity": "sha512-yl43JD/86CIj3Mz5mvvLJqAOfIup7ncxfJ0Btnl0/v5TouVUyeEdcpknfgc+yMevS/48oH9WAkkw93m7otLb/A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/checkbox": "^3.0.1",+ "@inquirer/confirm": "^4.0.1",+ "@inquirer/editor": "^3.0.1",+ "@inquirer/expand": "^3.0.1",+ "@inquirer/input": "^3.0.1",+ "@inquirer/number": "^2.0.1",+ "@inquirer/password": "^3.0.1",+ "@inquirer/rawlist": "^3.0.1",+ "@inquirer/search": "^2.0.1",+ "@inquirer/select": "^3.0.1"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/rawlist": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-3.0.1.tgz",+ "integrity": "sha512-VgRtFIwZInUzTiPLSfDXK5jLrnpkuSOh1ctfaoygKAdPqjcjKYmGh6sCY1pb0aGnCGsmhUxoqLDUAU0ud+lGXQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/type": "^2.0.0",+ "yoctocolors-cjs": "^2.1.2"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/search": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/search/-/search-2.0.1.tgz",+ "integrity": "sha512-r5hBKZk3g5MkIzLVoSgE4evypGqtOannnB3PKTG9NRZxyFRKcfzrdxXXPcoJQsxJPzvdSU2Rn7pB7lw0GCmGAg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/figures": "^1.0.6",+ "@inquirer/type": "^2.0.0",+ "yoctocolors-cjs": "^2.1.2"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/select": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-3.0.1.tgz",+ "integrity": "sha512-lUDGUxPhdWMkN/fHy1Lk7pF3nK1fh/gqeyWXmctefhxLYxlDsc7vsPBEpxrfVGDsVdyYJsiJoD4bJ1b623cV1Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/core": "^9.2.1",+ "@inquirer/figures": "^1.0.6",+ "@inquirer/type": "^2.0.0",+ "ansi-escapes": "^4.3.2",+ "yoctocolors-cjs": "^2.1.2"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@inquirer/type": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-2.0.0.tgz",+ "integrity": "sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "mute-stream": "^1.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@internationalized/date": {+ "version": "3.12.2",+ "resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.12.2.tgz",+ "integrity": "sha512-FY1Y+H64NDs+HAF6omlnWxm3mEpfgaCSWtL5l551ZZfImA+kGjPFgrnJrGjH6lfmLL0g8Z/mBu1R3kufeCp6Jw==",+ "license": "Apache-2.0",+ "dependencies": {+ "@swc/helpers": "^0.5.0"+ }+ },+ "node_modules/@internationalized/number": {+ "version": "3.6.7",+ "resolved": "https://registry.npmjs.org/@internationalized/number/-/number-3.6.7.tgz",+ "integrity": "sha512-3ji1fcrT+FPAK86UqEhB/psHixYo6niWPJtt7+qRaYFynt/BaJG8GhAPimtWUpEiVSTq8ZM8L5psMxGquiB/Vg==",+ "license": "Apache-2.0",+ "dependencies": {+ "@swc/helpers": "^0.5.0"+ }+ },+ "node_modules/@jridgewell/gen-mapping": {+ "version": "0.3.13",+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.5.0",+ "@jridgewell/trace-mapping": "^0.3.24"+ }+ },+ "node_modules/@jridgewell/remapping": {+ "version": "2.3.5",+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/gen-mapping": "^0.3.5",+ "@jridgewell/trace-mapping": "^0.3.24"+ }+ },+ "node_modules/@jridgewell/resolve-uri": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",+ "license": "MIT",+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@jridgewell/source-map": {+ "version": "0.3.11",+ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz",+ "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",+ "devOptional": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/gen-mapping": "^0.3.5",+ "@jridgewell/trace-mapping": "^0.3.25"+ }+ },+ "node_modules/@jridgewell/sourcemap-codec": {+ "version": "1.5.5",+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",+ "license": "MIT"+ },+ "node_modules/@jridgewell/trace-mapping": {+ "version": "0.3.31",+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/resolve-uri": "^3.1.0",+ "@jridgewell/sourcemap-codec": "^1.4.14"+ }+ },+ "node_modules/@kobalte/core": {+ "version": "0.13.12",+ "resolved": "https://registry.npmjs.org/@kobalte/core/-/core-0.13.12.tgz",+ "integrity": "sha512-aumsbsPe99/z2igcX2+p+Mdhzw89uuZx8ZdgfEqSlVuuWeTvkoBtCId5sl/Y7sWvllIOFwPoMzE3u0rAzDNkvg==",+ "license": "MIT",+ "dependencies": {+ "@floating-ui/dom": "^1.5.1",+ "@internationalized/number": "^3.2.1",+ "@kobalte/utils": "^0.9.2",+ "@solid-primitives/props": "^3.1.8",+ "@solid-primitives/resize-observer": "^2.0.26",+ "solid-presence": "^0.1.8",+ "solid-prevent-scroll": "^0.1.4"+ },+ "peerDependencies": {+ "solid-js": "^1.8.15"+ }+ },+ "node_modules/@kobalte/utils": {+ "version": "0.9.2",+ "resolved": "https://registry.npmjs.org/@kobalte/utils/-/utils-0.9.2.tgz",+ "integrity": "sha512-jRVXr+zsVHxzDXRoh+CDeXzvCsFJ6uiHhqqNQ26Cw9ZsZ3D6nqPUBt1gGVtj2ZPmRL3a9Uk1v8D1aJ8/I12Dow==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/event-listener": "^2.2.14",+ "@solid-primitives/keyed": "^1.2.0",+ "@solid-primitives/map": "^0.4.7",+ "@solid-primitives/media": "^2.2.4",+ "@solid-primitives/props": "^3.1.8",+ "@solid-primitives/refs": "^1.0.5",+ "@solid-primitives/utils": "^6.2.1"+ },+ "peerDependencies": {+ "solid-js": "^1.8.8"+ }+ },+ "node_modules/@listr2/prompt-adapter-inquirer": {+ "version": "2.0.22",+ "resolved": "https://registry.npmjs.org/@listr2/prompt-adapter-inquirer/-/prompt-adapter-inquirer-2.0.22.tgz",+ "integrity": "sha512-hV36ZoY+xKL6pYOt1nPNnkciFkn89KZwqLhAFzJvYysAvL5uBQdiADZx/8bIDXIukzzwG0QlPYolgMzQUtKgpQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@inquirer/type": "^1.5.5"+ },+ "engines": {+ "node": ">=18.0.0"+ },+ "peerDependencies": {+ "@inquirer/prompts": ">= 3 < 8"+ }+ },+ "node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type": {+ "version": "1.5.5",+ "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.5.5.tgz",+ "integrity": "sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "mute-stream": "^1.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@malept/cross-spawn-promise": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz",+ "integrity": "sha512-1DpKU0Z5ThltBwjNySMC14g0CkbyhCaz9FkhxqNsZI6uAPJXFS8cMXlBKo26FJ8ZuW6S9GCMcR9IO5k2X5/9Fg==",+ "dev": true,+ "funding": [+ {+ "type": "individual",+ "url": "https://github.com/sponsors/malept"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund"+ }+ ],+ "license": "Apache-2.0",+ "dependencies": {+ "cross-spawn": "^7.0.1"+ },+ "engines": {+ "node": ">= 12.13.0"+ }+ },+ "node_modules/@nodelib/fs.scandir": {+ "version": "2.1.5",+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@nodelib/fs.stat": "2.0.5",+ "run-parallel": "^1.1.9"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/@nodelib/fs.stat": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/@nodelib/fs.walk": {+ "version": "1.2.8",+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@nodelib/fs.scandir": "2.1.5",+ "fastq": "^1.6.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/@npmcli/fs": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz",+ "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "@gar/promisify": "^1.1.3",+ "semver": "^7.3.5"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/@npmcli/move-file": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz",+ "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==",+ "deprecated": "This functionality has been moved to @npmcli/fs",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "mkdirp": "^1.0.4",+ "rimraf": "^3.0.2"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/@rollup/rollup-android-arm-eabi": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz",+ "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-android-arm64": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz",+ "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-darwin-arm64": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz",+ "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-darwin-x64": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz",+ "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-arm64": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz",+ "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-x64": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz",+ "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz",+ "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz",+ "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-gnu": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz",+ "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-musl": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz",+ "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-gnu": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz",+ "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==",+ "cpu": [+ "loong64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-musl": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz",+ "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==",+ "cpu": [+ "loong64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz",+ "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-musl": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz",+ "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==",+ "cpu": [+ "ppc64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz",+ "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==",+ "cpu": [+ "riscv64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-musl": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz",+ "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==",+ "cpu": [+ "riscv64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-s390x-gnu": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz",+ "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==",+ "cpu": [+ "s390x"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-gnu": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz",+ "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-musl": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz",+ "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-openbsd-x64": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz",+ "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ]+ },+ "node_modules/@rollup/rollup-openharmony-arm64": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz",+ "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ]+ },+ "node_modules/@rollup/rollup-win32-arm64-msvc": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz",+ "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-ia32-msvc": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz",+ "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==",+ "cpu": [+ "ia32"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-gnu": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz",+ "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-msvc": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz",+ "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@sentry/browser": {+ "version": "10.63.0",+ "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-10.63.0.tgz",+ "integrity": "sha512-0mi56YOkwgyjdLOcN5cB1//EcYzEOt3NZ2GLygE92B3zAAwVM1WgbmibZCXToKFClH7z1uH3VWVfBffmkwIMYw==",+ "license": "MIT",+ "dependencies": {+ "@sentry/browser-utils": "10.63.0",+ "@sentry/core": "10.63.0",+ "@sentry/feedback": "10.63.0",+ "@sentry/replay": "10.63.0",+ "@sentry/replay-canvas": "10.63.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@sentry/browser-utils": {+ "version": "10.63.0",+ "resolved": "https://registry.npmjs.org/@sentry/browser-utils/-/browser-utils-10.63.0.tgz",+ "integrity": "sha512-DhUGNN+CH8fzAs6qAsueKPU70qShyTX3NxLhIP+l5DbGXDSXpYXBT6s8ubZus0/LhxpLvI0iSyNIDvZRD/gZaA==",+ "license": "MIT",+ "dependencies": {+ "@sentry/core": "10.63.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@sentry/core": {+ "version": "10.63.0",+ "resolved": "https://registry.npmjs.org/@sentry/core/-/core-10.63.0.tgz",+ "integrity": "sha512-OtUbsrnbEHffOF2S2+M5zXa3HIM0U2b4CDVLKMY1dgS0J3ivRF8XvkjvyIcEG/y8JXnwXbnprLyjhG+AqMdUZQ==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@sentry/feedback": {+ "version": "10.63.0",+ "resolved": "https://registry.npmjs.org/@sentry/feedback/-/feedback-10.63.0.tgz",+ "integrity": "sha512-If/+72xFg9ylz4twUo3U9gUpZ+Ys+T/3Y09WH7r2gGhWEOF9bp+ta94+Pg7Lb0M2nVD7waz4OxIvB49GEvtLDA==",+ "license": "MIT",+ "dependencies": {+ "@sentry/core": "10.63.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@sentry/replay": {+ "version": "10.63.0",+ "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-10.63.0.tgz",+ "integrity": "sha512-u4fDaLbd4QmJbU0qGzV5g2B2hjw5utdeZzpTrmq565AS5o6mfaZdCz30zF9R2Unkn0g9SJr90piTN2RMwvDrkw==",+ "license": "MIT",+ "dependencies": {+ "@sentry/browser-utils": "10.63.0",+ "@sentry/core": "10.63.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@sentry/replay-canvas": {+ "version": "10.63.0",+ "resolved": "https://registry.npmjs.org/@sentry/replay-canvas/-/replay-canvas-10.63.0.tgz",+ "integrity": "sha512-1Dg6yo+KDNZcE9M6V2EP4DGgTDJMcUgg5ui69w/E96ZZPWErS/bibK2bGj20H3qwpJXlnEwXB5YAJ2fZ620T1A==",+ "license": "MIT",+ "dependencies": {+ "@sentry/core": "10.63.0",+ "@sentry/replay": "10.63.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@sentry/solid": {+ "version": "10.63.0",+ "resolved": "https://registry.npmjs.org/@sentry/solid/-/solid-10.63.0.tgz",+ "integrity": "sha512-Vbc1QNZ5FnuCY0Dx8eIP9IUWxg5saBaUwoZ0jslUc9SJNjRD9wIk5/0GX2xuFQHxw5kmqqV35Euvfvp5l/hdtQ==",+ "license": "MIT",+ "dependencies": {+ "@sentry/browser": "10.63.0",+ "@sentry/core": "10.63.0"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "@solidjs/router": "^0.13.4 || ^0.14.0 || ^0.15.0",+ "@tanstack/solid-router": "^1.132.27",+ "solid-js": "^1.8.4"+ },+ "peerDependenciesMeta": {+ "@solidjs/router": {+ "optional": true+ },+ "@tanstack/solid-router": {+ "optional": true+ }+ }+ },+ "node_modules/@sindresorhus/is": {+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",+ "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sindresorhus/is?sponsor=1"+ }+ },+ "node_modules/@solid-primitives/deep": {+ "version": "0.2.10",+ "resolved": "https://registry.npmjs.org/@solid-primitives/deep/-/deep-0.2.10.tgz",+ "integrity": "sha512-uzhXr/cMABsGkTcV3yuviZjTDmj44wb2JetuJ5O8NCugz4Ug/6XlPjT8ISMPYV7eCbC/gFhgt7e60+TRpl2Upg==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/memo": "^1.3.10"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/event-listener": {+ "version": "2.4.6",+ "resolved": "https://registry.npmjs.org/@solid-primitives/event-listener/-/event-listener-2.4.6.tgz",+ "integrity": "sha512-5I0YJcTVYIWoMmgBSROBZGcz+ymhew/pGTg2dHW74BUjFKsV8Li4bOZYl0YAGP4mHw5o4UBd9/BEesqBci3wxw==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/keyboard": {+ "version": "1.3.7",+ "resolved": "https://registry.npmjs.org/@solid-primitives/keyboard/-/keyboard-1.3.7.tgz",+ "integrity": "sha512-558RPNYnXx4nGh537DSqAn4xMrC8iFipl/5+xzgzWoTNFst4RnUN3BOLmtDjJ0UGGoQXVMALYR3bNOHM0xnt1Q==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/event-listener": "^2.4.6",+ "@solid-primitives/rootless": "^1.5.4",+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/keyed": {+ "version": "1.5.3",+ "resolved": "https://registry.npmjs.org/@solid-primitives/keyed/-/keyed-1.5.3.tgz",+ "integrity": "sha512-zNadtyYBhJSOjXtogkGHmRxjGdz9KHc8sGGVAGlUABkE8BED2tbIZoxkwSqzOwde8OcUEH0bb5DLZUWIMvyBSA==",+ "license": "MIT",+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/map": {+ "version": "0.4.13",+ "resolved": "https://registry.npmjs.org/@solid-primitives/map/-/map-0.4.13.tgz",+ "integrity": "sha512-B1zyFbsiTQvqPr+cuPCXO72sRuczG9Swncqk5P74NCGw1VE8qa/Ry9GlfI1e/VdeQYHjan+XkbE3rO2GW/qKew==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/trigger": "^1.1.0"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/media": {+ "version": "2.3.6",+ "resolved": "https://registry.npmjs.org/@solid-primitives/media/-/media-2.3.6.tgz",+ "integrity": "sha512-pk49gPOq/UMRUJ+pTSrOfBiR8xJjRYHXIf1iR/jSnyQ/KroU+ZXhkZzavC7hvfp2vJeOTW5k2/HN0r3Q1VJ7Pw==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/event-listener": "^2.4.6",+ "@solid-primitives/rootless": "^1.5.4",+ "@solid-primitives/static-store": "^0.1.4",+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/memo": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/@solid-primitives/memo/-/memo-1.5.1.tgz",+ "integrity": "sha512-VDPrkl9epp0tbby9MvsqphGFCYCtDRC5J8FKzTqHbQiG5hhR8n6xv4MfjhTW231IaBxxPHLxS43EE8c5Q23mSQ==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/scheduled": "^1.5.3",+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/mutation-observer": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@solid-primitives/mutation-observer/-/mutation-observer-1.2.4.tgz",+ "integrity": "sha512-CVKOLDj09ZLoN9Hq+o5BTNVBCVM1vKcpRhaZnvpSuXguQBaAz75R8nkaEhkIdMcpENueLivPIJbUqAA1BAaOGw==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/pointer": {+ "version": "0.3.6",+ "resolved": "https://registry.npmjs.org/@solid-primitives/pointer/-/pointer-0.3.6.tgz",+ "integrity": "sha512-307wko5OGb2b7j1pUIRetF58atTP3wDgm+h2o6/OQBgT1z0EwMDuW7ujaqCj3iTzUS7YaWbyVQ7nC/ojXd6rKA==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/event-listener": "^2.4.6",+ "@solid-primitives/rootless": "^1.5.4",+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/props": {+ "version": "3.2.4",+ "resolved": "https://registry.npmjs.org/@solid-primitives/props/-/props-3.2.4.tgz",+ "integrity": "sha512-MXXdvi2TSB6d+0N6ueA/HP1j/Kh9SEc4WdF1ZDMLwPagxW6pIHHSS9xbRO0RjqSVpNP4j0nxCWT1hx3CkJNhNA==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/refs": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/@solid-primitives/refs/-/refs-1.1.4.tgz",+ "integrity": "sha512-bLjwIs6ZPu8NQnuw04sU3Zc8qKSpbc0umUU/O4SHf6oWOdO4+dHY8vb1T7C4b/Tg103+9WGr6sEE0+NFlbaB/A==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/resize-observer": {+ "version": "2.1.6",+ "resolved": "https://registry.npmjs.org/@solid-primitives/resize-observer/-/resize-observer-2.1.6.tgz",+ "integrity": "sha512-GFj6b81KIahl5SBf35VlyClHshDhVEREeZz2WYkHHKBvam66mE5H5f1g3EralabAAjmcU1bBd18YYYETPv0Knw==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/event-listener": "^2.4.6",+ "@solid-primitives/rootless": "^1.5.4",+ "@solid-primitives/static-store": "^0.1.4",+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/rootless": {+ "version": "1.5.4",+ "resolved": "https://registry.npmjs.org/@solid-primitives/rootless/-/rootless-1.5.4.tgz",+ "integrity": "sha512-TOIZa1VUfVJ+9nkCcRajw3U4t9vBOP1HxX1WHNTbXq32mXwlqTvUnC4CRIilohcryBkT9u2ZkhUDSHRTaGp55g==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/scheduled": {+ "version": "1.5.3",+ "resolved": "https://registry.npmjs.org/@solid-primitives/scheduled/-/scheduled-1.5.3.tgz",+ "integrity": "sha512-oNwLE6E6lxJAWrc8QXuwM0k2oU1BnANnkChwMw82aK1j3+mWGJkG1IFe5gCwbV+afYmjI76t9JJV3md/8tLw+g==",+ "license": "MIT",+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/static-store": {+ "version": "0.1.4",+ "resolved": "https://registry.npmjs.org/@solid-primitives/static-store/-/static-store-0.1.4.tgz",+ "integrity": "sha512-LgtVaVBtB7EbmS4+M0b8xY5Iq6pUWXBsIC4VgtrFKDGDdyCaDt88sHk0fUlx1Enxm/XZnZyLXJABRoa39RjJqA==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/trigger": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@solid-primitives/trigger/-/trigger-1.2.4.tgz",+ "integrity": "sha512-Ju0e+ZOD7hpOp7nptJimvDSZHWFvIvF9iBWMvuwt30smX7c5wmB8Kmc0AdDuv0wOTi06PQ1J5IrP1WJbH2yUBQ==",+ "license": "MIT",+ "dependencies": {+ "@solid-primitives/utils": "^6.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solid-primitives/utils": {+ "version": "6.4.1",+ "resolved": "https://registry.npmjs.org/@solid-primitives/utils/-/utils-6.4.1.tgz",+ "integrity": "sha512-ISSB5QX1qP2ynrheIpYwc4oKR5Ny4siNuUyf1qZniy+Il+p/PtDB0QK1Dnle8noiHpwRD3gpPdubOC3qI/Zamg==",+ "license": "MIT",+ "peerDependencies": {+ "solid-js": "^1.6.12"+ }+ },+ "node_modules/@solidjs/router": {+ "version": "0.15.4",+ "resolved": "https://registry.npmjs.org/@solidjs/router/-/router-0.15.4.tgz",+ "integrity": "sha512-WOpgg9a9T638cR+5FGbFi/IV4l2FpmBs1GpIMSPa0Ce9vyJN7Wts+X2PqMf9IYn0zUj2MlSJtm1gp7/HI/n5TQ==",+ "license": "MIT",+ "peerDependencies": {+ "solid-js": "^1.8.6"+ }+ },+ "node_modules/@supabase/auth-js": {+ "version": "2.109.0",+ "resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.109.0.tgz",+ "integrity": "sha512-krf61vksi92kEUYtNH70GnIMOoQqLBAKG2e3Aha4e/0uJA6i1OWCxL7WUGHo6c0Vu/w96Y1DdnkYz0NOg0kYog==",+ "license": "MIT",+ "dependencies": {+ "tslib": "2.8.1"+ },+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/@supabase/functions-js": {+ "version": "2.109.0",+ "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.109.0.tgz",+ "integrity": "sha512-IiwAspZrVrBRYQoFgSJvkcA9iJvTCw8nHOdvlKARDushlw/x1YY3YJYtwwgZFtl7utUbTiZ5SwohXPNgnpZM+g==",+ "license": "MIT",+ "dependencies": {+ "tslib": "2.8.1"+ },+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/@supabase/phoenix": {+ "version": "0.4.4",+ "resolved": "https://registry.npmjs.org/@supabase/phoenix/-/phoenix-0.4.4.tgz",+ "integrity": "sha512-Gt0pqoXuIqX/8dvG0OKp/wMCobXNH3klNbUPBNyOfN0YA1IswrM3HyWFMOPk1Jy+BRaIyDPcFx4jLBwHNmlyfQ==",+ "license": "MIT"+ },+ "node_modules/@supabase/postgrest-js": {+ "version": "2.109.0",+ "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-2.109.0.tgz",+ "integrity": "sha512-Xk4gzuzyrGIPWCUuJolDQS/9zdFZDEXRhNsVeOHEKwFr+vpNU0himsHtLOhSEYlyPqwmeY8LUCKL6bLsDp0ScA==",+ "license": "MIT",+ "dependencies": {+ "tslib": "2.8.1"+ },+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/@supabase/realtime-js": {+ "version": "2.109.0",+ "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.109.0.tgz",+ "integrity": "sha512-q9tjGUgWLNhfLz6HeYE7yl6FG9WEsnr6bFmmLpn2Nakxp3Z36pqI4xu0xns5/n8Xtq10HVcy9CRxOxgvviCM4Q==",+ "license": "MIT",+ "dependencies": {+ "@supabase/phoenix": "0.4.4",+ "tslib": "2.8.1"+ },+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/@supabase/storage-js": {+ "version": "2.109.0",+ "resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.109.0.tgz",+ "integrity": "sha512-j119SdEuwrOPGqiPjshpfovrQPFqeATKg990jNV88Ie+SEufznzVD2mL5kQvly+z2oVBeZn+pweU0QN/OYLmJw==",+ "license": "MIT",+ "dependencies": {+ "iceberg-js": "^0.8.1",+ "tslib": "2.8.1"+ },+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/@supabase/supabase-js": {+ "version": "2.109.0",+ "resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.109.0.tgz",+ "integrity": "sha512-eNpUGegTT3hhoTK9j6aLViVjybYtdq6Ishb4BkVLi5tT58S1D80n7dmALMoBWkbrYG4uQv30c8iAB6nZylX0Fg==",+ "license": "MIT",+ "dependencies": {+ "@supabase/auth-js": "2.109.0",+ "@supabase/functions-js": "2.109.0",+ "@supabase/postgrest-js": "2.109.0",+ "@supabase/realtime-js": "2.109.0",+ "@supabase/storage-js": "2.109.0"+ },+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/@swc/helpers": {+ "version": "0.5.23",+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz",+ "integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==",+ "license": "Apache-2.0",+ "dependencies": {+ "tslib": "^2.8.0"+ }+ },+ "node_modules/@szmarczak/http-timer": {+ "version": "4.0.6",+ "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz",+ "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "defer-to-connect": "^2.0.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/@tailwindcss/node": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.2.tgz",+ "integrity": "sha512-yWP/sqEcBLaD8JuA6zNwxoYKr75qxTioYwlRwekj5Jr/I5GXnoJfjetH/psLUIv74cYTH2lBUEzBkinthoYcBg==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/remapping": "^2.3.5",+ "enhanced-resolve": "5.21.6",+ "jiti": "^2.7.0",+ "lightningcss": "1.32.0",+ "magic-string": "^0.30.21",+ "source-map-js": "^1.2.1",+ "tailwindcss": "4.3.2"+ }+ },+ "node_modules/@tailwindcss/oxide": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.2.tgz",+ "integrity": "sha512-z8ZgnzX8gdNoWLBLqBPoh/sjnxkwvf9ZuWjnO0l0yIzbLa5/9S+eC5QxGZKRobVHIC3/1BoMWjHblqWjcgFgag==",+ "license": "MIT",+ "engines": {+ "node": ">= 20"+ },+ "optionalDependencies": {+ "@tailwindcss/oxide-android-arm64": "4.3.2",+ "@tailwindcss/oxide-darwin-arm64": "4.3.2",+ "@tailwindcss/oxide-darwin-x64": "4.3.2",+ "@tailwindcss/oxide-freebsd-x64": "4.3.2",+ "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.2",+ "@tailwindcss/oxide-linux-arm64-gnu": "4.3.2",+ "@tailwindcss/oxide-linux-arm64-musl": "4.3.2",+ "@tailwindcss/oxide-linux-x64-gnu": "4.3.2",+ "@tailwindcss/oxide-linux-x64-musl": "4.3.2",+ "@tailwindcss/oxide-wasm32-wasi": "4.3.2",+ "@tailwindcss/oxide-win32-arm64-msvc": "4.3.2",+ "@tailwindcss/oxide-win32-x64-msvc": "4.3.2"+ }+ },+ "node_modules/@tailwindcss/oxide-android-arm64": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.2.tgz",+ "integrity": "sha512-WHxqIuHpvZ5VtdX6GTl1Ik/Vp2YuN42Et+0CdeaVd/frQ9jAvGmvR8vLT+jk3e8/Q3x8kECB9+R17pgpp2BulA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-darwin-arm64": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.2.tgz",+ "integrity": "sha512-GZypeUY/IDJW3877KeM+O67vbXr3MBnbtEL4aYhNErv/JWZhye2vGSWWG9tB6iiqR2MqRNkY8IOUy4NdSZV26w==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-darwin-x64": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.2.tgz",+ "integrity": "sha512-UIIzmefR6KO1sDU7MzRqAxC8iBpft/VhkGjTjnhoS6k7Z3rQ9wEgA1ODSiyH/tcSYssulNm4Ci3hOeK1jH7ccQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-freebsd-x64": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.2.tgz",+ "integrity": "sha512-GN+uAmcI6DNspnCDwtOAZrTz6oukJnp337qZvxqCGLd3BHBzJpO0ZbTLRvJNdztOeAmTzewewGIMPb0tk2R4WA==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.2.tgz",+ "integrity": "sha512-4ABn7qSbdHRwTiDiuWNegCyb5+2FJ4vKIKc3DmKrvAFw7MU1Lm11dIkTPwUaFdTzc7IsOpDbqBrlh0x6y36U/w==",+ "cpu": [+ "arm"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-linux-arm64-gnu": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.2.tgz",+ "integrity": "sha512-wDgEIGwoM8w8pufh9LVt1PahDgNdKXrLC2qfAnV3vAmococ9RWbxeAw4pxPttd/TsJfwjyLf90Dg1y9y8I6Emw==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-linux-arm64-musl": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.2.tgz",+ "integrity": "sha512-J5Nuk0uZQIiMTJj3LEx4sAA9tMFUoXQZFv1J6An+QGYe53HKRJuFDi0rpq/tuouCZeAbOBY3kQ6g8qeD4TUjtA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-linux-x64-gnu": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.2.tgz",+ "integrity": "sha512-kqCZpSKOBEJO4mz7OqWoofBZeXTAwaVGPj0ErAj7CojmhKpWVWVOnrt9dE8odoIraZq4oj3ausM37kXi+Tow8w==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-linux-x64-musl": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.2.tgz",+ "integrity": "sha512-cixpqbh2toJDmkuCRI68nXA8ZxNmdK9Y+9v5h3MC3ZQKy/0BO8AWzlkWyRM7JAFSGBlfig4YVTPsK6MVgqz1uw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-wasm32-wasi": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.2.tgz",+ "integrity": "sha512-4ec2Z/LOmRsAgU23CS4xeJfcJlmRg94A/XrbGRCF1gyU/zdDfRLYDVsS+ynSZCmGNxQ1jQriQOKMQeQxBA3Isw==",+ "bundleDependencies": [+ "@napi-rs/wasm-runtime",+ "@emnapi/core",+ "@emnapi/runtime",+ "@tybys/wasm-util",+ "@emnapi/wasi-threads",+ "tslib"+ ],+ "cpu": [+ "wasm32"+ ],+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "@emnapi/core": "^1.11.1",+ "@emnapi/runtime": "^1.11.1",+ "@emnapi/wasi-threads": "^1.2.2",+ "@napi-rs/wasm-runtime": "^1.1.4",+ "@tybys/wasm-util": "^0.10.2",+ "tslib": "^2.8.1"+ },+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/@tailwindcss/oxide-win32-arm64-msvc": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.2.tgz",+ "integrity": "sha512-Zyr/M0+XcYZu3bZrUytc7TXvrk0ftWfl8gN2MwekNDzhqhKRUucMPSeOzM0o0wH5AWOU49BsKRrfKxI2atCPMQ==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/oxide-win32-x64-msvc": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.2.tgz",+ "integrity": "sha512-QI9BO7KlNZsp2GuO0jwAAj5jCDABOKXRkCk2XuKTSaNEFSdfzqswYVTtCHBNKHLsqyjFyFkqlDiwkNbTYSssMQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 20"+ }+ },+ "node_modules/@tailwindcss/vite": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.2.tgz",+ "integrity": "sha512-eHpMeX4JXfVNJDEcsouTeCBubJBTcTLigeaw/NTUW6PB5ATKKXdyonnXgTBX2VuRbjz1hjfz6C5XAhr52ImQXA==",+ "license": "MIT",+ "dependencies": {+ "@tailwindcss/node": "4.3.2",+ "@tailwindcss/oxide": "4.3.2",+ "tailwindcss": "4.3.2"+ },+ "peerDependencies": {+ "vite": "^5.2.0 || ^6 || ^7 || ^8"+ }+ },+ "node_modules/@tootallnate/once": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.1.tgz",+ "integrity": "sha512-HqmEUIGRJ5fSXchkVgR5F7qn48bDBzv0kWj/Kfu5e6uci4UlEeng4331LnBkWffb++Ei3FOVLxo8JJWMFBDMeQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@trpc/client": {+ "version": "11.18.0",+ "resolved": "https://registry.npmjs.org/@trpc/client/-/client-11.18.0.tgz",+ "integrity": "sha512-wOqeg3Fvl25V1ZisQhUD3K8G60ZJDlSGJNSyeXrLH24xAo5w6GSR2Kzb1cSNY9Y+IQ2YZvYGZstBU+V/ulo/ow==",+ "funding": [+ "https://trpc.io/sponsor"+ ],+ "license": "MIT",+ "bin": {+ "intent": "bin/intent.js"+ },+ "peerDependencies": {+ "@trpc/server": "11.18.0",+ "typescript": ">=5.7.2"+ }+ },+ "node_modules/@trpc/server": {+ "version": "11.18.0",+ "resolved": "https://registry.npmjs.org/@trpc/server/-/server-11.18.0.tgz",+ "integrity": "sha512-JAvXOuNTxgXjIDfQaOvDq1j66LMNfDJUH1IU7Slfn8EvRv2EkH6ehu3A7zpYhjO0syHHiYg77v2lG2JFJgvw7Q==",+ "funding": [+ "https://trpc.io/sponsor"+ ],+ "license": "MIT",+ "bin": {+ "intent": "bin/intent.js"+ },+ "peerDependencies": {+ "typescript": ">=5.7.2"+ }+ },+ "node_modules/@types/appdmg": {+ "version": "0.5.5",+ "resolved": "https://registry.npmjs.org/@types/appdmg/-/appdmg-0.5.5.tgz",+ "integrity": "sha512-G+n6DgZTZFOteITE30LnWj+HRVIGr7wMlAiLWOO02uJFWVEitaPU9JVXm9wJokkgshBawb2O1OykdcsmkkZfgg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@types/audioworklet": {+ "version": "0.0.92",+ "resolved": "https://registry.npmjs.org/@types/audioworklet/-/audioworklet-0.0.92.tgz",+ "integrity": "sha512-ykniYTjl1eqgkLeHLH2AAgj4rqdFZyxeVDtCopTTlcvgH7nOHNSn0KYXZPgc0Mx0TiUAwHNEzBWoJw/i8OETBg==",+ "dev": true,+ "license": "Apache-2.0"+ },+ "node_modules/@types/babel__core": {+ "version": "7.20.5",+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/parser": "^7.20.7",+ "@babel/types": "^7.20.7",+ "@types/babel__generator": "*",+ "@types/babel__template": "*",+ "@types/babel__traverse": "*"+ }+ },+ "node_modules/@types/babel__generator": {+ "version": "7.27.0",+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",+ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.0.0"+ }+ },+ "node_modules/@types/babel__template": {+ "version": "7.4.4",+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/parser": "^7.1.0",+ "@babel/types": "^7.0.0"+ }+ },+ "node_modules/@types/babel__traverse": {+ "version": "7.28.0",+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",+ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.28.2"+ }+ },+ "node_modules/@types/cacheable-request": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz",+ "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/http-cache-semantics": "*",+ "@types/keyv": "^3.1.4",+ "@types/node": "*",+ "@types/responselike": "^1.0.0"+ }+ },+ "node_modules/@types/chrome": {+ "version": "0.1.43",+ "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.1.43.tgz",+ "integrity": "sha512-ukH/HhmR6ht+UTX3PLUWJxgJ/RQcK2Foj4lBzsF24SIWsXgqhGuXqjd8FFuwioPP7d/JUKLM4g8GZxw3F4HTcA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/filesystem": "*",+ "@types/har-format": "*"+ }+ },+ "node_modules/@types/dom-mediacapture-transform": {+ "version": "0.1.11",+ "resolved": "https://registry.npmjs.org/@types/dom-mediacapture-transform/-/dom-mediacapture-transform-0.1.11.tgz",+ "integrity": "sha512-Y2p+nGf1bF2XMttBnsVPHUWzRRZzqUoJAKmiP10b5umnO6DDrWI0BrGDJy1pOHoOULVmGSfFNkQrAlC5dcj6nQ==",+ "license": "MIT",+ "dependencies": {+ "@types/dom-webcodecs": "*"+ }+ },+ "node_modules/@types/dom-webcodecs": {+ "version": "0.1.13",+ "resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.13.tgz",+ "integrity": "sha512-O5hkiFIcjjszPIYyUSyvScyvrBoV3NOEEZx/pMlsu44TKzWNkLVBBxnxJz42in5n3QIolYOcBYFCPZZ0h8SkwQ==",+ "license": "MIT"+ },+ "node_modules/@types/estree": {+ "version": "1.0.9",+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",+ "license": "MIT"+ },+ "node_modules/@types/filesystem": {+ "version": "0.0.36",+ "resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.36.tgz",+ "integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/filewriter": "*"+ }+ },+ "node_modules/@types/filewriter": {+ "version": "0.0.33",+ "resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.33.tgz",+ "integrity": "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/fs-extra": {+ "version": "9.0.13",+ "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",+ "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@types/har-format": {+ "version": "1.2.16",+ "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.16.tgz",+ "integrity": "sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/http-cache-semantics": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz",+ "integrity": "sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/json-schema": {+ "version": "7.0.15",+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/keyv": {+ "version": "3.1.4",+ "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz",+ "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@types/mute-stream": {+ "version": "0.0.4",+ "resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz",+ "integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@types/node": {+ "version": "24.13.2",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.2.tgz",+ "integrity": "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA==",+ "devOptional": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~7.18.0"+ }+ },+ "node_modules/@types/responselike": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz",+ "integrity": "sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@types/stats.js": {+ "version": "0.17.4",+ "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz",+ "integrity": "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/wicg-file-system-access": {+ "version": "2023.10.7",+ "resolved": "https://registry.npmjs.org/@types/wicg-file-system-access/-/wicg-file-system-access-2023.10.7.tgz",+ "integrity": "sha512-g49ijasEJvCd7ifmAY2D0wdEtt1xRjBbA33PJTiv8mKBr7DoMsPeISoJ8oQOTopSRi+FBWPpPW5ouDj2QPKtGA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/wrap-ansi": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz",+ "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/yauzl": {+ "version": "2.10.3",+ "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz",+ "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@typescript-eslint/eslint-plugin": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.62.1.tgz",+ "integrity": "sha512-4EQM77WgVNxj7OkL/5b/D/xZsw00G577+UriYTC7JF5opcF3T2AuoeY7ueLaZgSVjSgCS6yOAJB5bRGLPSJUzA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@eslint-community/regexpp": "^4.12.2",+ "@typescript-eslint/scope-manager": "8.62.1",+ "@typescript-eslint/type-utils": "8.62.1",+ "@typescript-eslint/utils": "8.62.1",+ "@typescript-eslint/visitor-keys": "8.62.1",+ "ignore": "^7.0.5",+ "natural-compare": "^1.4.0",+ "ts-api-utils": "^2.5.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ },+ "peerDependencies": {+ "@typescript-eslint/parser": "^8.62.1",+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",+ "typescript": ">=4.8.4 <6.1.0"+ }+ },+ "node_modules/@typescript-eslint/parser": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.62.1.tgz",+ "integrity": "sha512-sPhE4iHuJDSvoAiec+Ro8JyXw8f0ql13HFR82P99nCm9GwTEKG0KYLvDe6REk8BCXuit6vJAv/Yxg5ABaNS2rA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@typescript-eslint/scope-manager": "8.62.1",+ "@typescript-eslint/types": "8.62.1",+ "@typescript-eslint/typescript-estree": "8.62.1",+ "@typescript-eslint/visitor-keys": "8.62.1",+ "debug": "^4.4.3"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ },+ "peerDependencies": {+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",+ "typescript": ">=4.8.4 <6.1.0"+ }+ },+ "node_modules/@typescript-eslint/project-service": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.62.1.tgz",+ "integrity": "sha512-yQ3RgY5RkSBpsNS1Bx/JQEcA24FOSdfGktoyprAr5u18390UQdtVcfnEv4nIrIshNnavlVyZBKxQwT1fIAE6cg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@typescript-eslint/tsconfig-utils": "^8.62.1",+ "@typescript-eslint/types": "^8.62.1",+ "debug": "^4.4.3"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ },+ "peerDependencies": {+ "typescript": ">=4.8.4 <6.1.0"+ }+ },+ "node_modules/@typescript-eslint/scope-manager": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.62.1.tgz",+ "integrity": "sha512-r4d249KbQ1SFdpeStvob8Ih6aPPIzfqllPVOtvhve6ZcpuVcYo5/7zUWckKpHE7StASX4kTKZTLf0WQm/wPkcg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@typescript-eslint/types": "8.62.1",+ "@typescript-eslint/visitor-keys": "8.62.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ }+ },+ "node_modules/@typescript-eslint/tsconfig-utils": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.62.1.tgz",+ "integrity": "sha512-xadytJqX9vJVQ2fdQjkcIVigwaOJNWkpjdLt6cEQ+xPnrI1fkp+/jZE/I97k9KUjqtpd25i0HeyZf3T6dutv2g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ },+ "peerDependencies": {+ "typescript": ">=4.8.4 <6.1.0"+ }+ },+ "node_modules/@typescript-eslint/type-utils": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.62.1.tgz",+ "integrity": "sha512-aXM5xlqXiTxPibXB93cLAURfT3rlizf7uMXISCXy66Isr/9hISJx3yDsKl0L7lKa51b8JpFuNKby0/O0pEm9jg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@typescript-eslint/types": "8.62.1",+ "@typescript-eslint/typescript-estree": "8.62.1",+ "@typescript-eslint/utils": "8.62.1",+ "debug": "^4.4.3",+ "ts-api-utils": "^2.5.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ },+ "peerDependencies": {+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",+ "typescript": ">=4.8.4 <6.1.0"+ }+ },+ "node_modules/@typescript-eslint/types": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.62.1.tgz",+ "integrity": "sha512-ooCzJFaf+Hg+uG6fA3NRFGuFjlfNlDhBthbv4ZPU/0elCAFUfnyXUvf/WOpHz/jYwSmvU2GkR2LtyUfy1AxZ1Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ }+ },+ "node_modules/@typescript-eslint/typescript-estree": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.62.1.tgz",+ "integrity": "sha512-xMcW9oP9u7fAMXYs9A65CVmtLQe2r//oXINHfi8HV+oiqhih17sbLdhXr4540YWlgpDKQdY854OL5ZrdCiQsAA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@typescript-eslint/project-service": "8.62.1",+ "@typescript-eslint/tsconfig-utils": "8.62.1",+ "@typescript-eslint/types": "8.62.1",+ "@typescript-eslint/visitor-keys": "8.62.1",+ "debug": "^4.4.3",+ "minimatch": "^10.2.2",+ "semver": "^7.7.3",+ "tinyglobby": "^0.2.15",+ "ts-api-utils": "^2.5.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ },+ "peerDependencies": {+ "typescript": ">=4.8.4 <6.1.0"+ }+ },+ "node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "18 || 20 || >=22"+ }+ },+ "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {+ "version": "5.0.7",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz",+ "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^4.0.2"+ },+ "engines": {+ "node": "18 || 20 || >=22"+ }+ },+ "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {+ "version": "10.2.5",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",+ "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",+ "dev": true,+ "license": "BlueOak-1.0.0",+ "dependencies": {+ "brace-expansion": "^5.0.5"+ },+ "engines": {+ "node": "18 || 20 || >=22"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/@typescript-eslint/utils": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.62.1.tgz",+ "integrity": "sha512-sHtbPfuKNZCG+ih8SyjjucqRntSVmp8XgL5u6o9mAhiSn8ds5o/M/XdM0abweme2Tln3szOstOrZ9OXitvPh0g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@eslint-community/eslint-utils": "^4.9.1",+ "@typescript-eslint/scope-manager": "8.62.1",+ "@typescript-eslint/types": "8.62.1",+ "@typescript-eslint/typescript-estree": "8.62.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ },+ "peerDependencies": {+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",+ "typescript": ">=4.8.4 <6.1.0"+ }+ },+ "node_modules/@typescript-eslint/visitor-keys": {+ "version": "8.62.1",+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.62.1.tgz",+ "integrity": "sha512-4g3BLxfdTMy8iZG0MaBkadnlRrCJ74cQiFbyEVMrkwIoqdyaXXQM22cotDvrl4x28wgIZ9rEJRoM+mmhSJpJ1g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@typescript-eslint/types": "8.62.1",+ "eslint-visitor-keys": "^5.0.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/typescript-eslint"+ }+ },+ "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^20.19.0 || ^22.13.0 || >=24"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/@vscode/sudo-prompt": {+ "version": "9.3.2",+ "resolved": "https://registry.npmjs.org/@vscode/sudo-prompt/-/sudo-prompt-9.3.2.tgz",+ "integrity": "sha512-gcXoCN00METUNFeQOFJ+C9xUI0DKB+0EGMVg7wbVYRHBw2Eq3fKisDZOkRdOz3kqXRKOENMfShPOmypw1/8nOw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@webassemblyjs/ast": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz",+ "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/helper-numbers": "1.13.2",+ "@webassemblyjs/helper-wasm-bytecode": "1.13.2"+ }+ },+ "node_modules/@webassemblyjs/floating-point-hex-parser": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",+ "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@webassemblyjs/helper-api-error": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",+ "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@webassemblyjs/helper-buffer": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz",+ "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@webassemblyjs/helper-numbers": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz",+ "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/floating-point-hex-parser": "1.13.2",+ "@webassemblyjs/helper-api-error": "1.13.2",+ "@xtuc/long": "4.2.2"+ }+ },+ "node_modules/@webassemblyjs/helper-wasm-bytecode": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",+ "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@webassemblyjs/helper-wasm-section": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz",+ "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/ast": "1.14.1",+ "@webassemblyjs/helper-buffer": "1.14.1",+ "@webassemblyjs/helper-wasm-bytecode": "1.13.2",+ "@webassemblyjs/wasm-gen": "1.14.1"+ }+ },+ "node_modules/@webassemblyjs/ieee754": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz",+ "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@xtuc/ieee754": "^1.2.0"+ }+ },+ "node_modules/@webassemblyjs/leb128": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz",+ "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@xtuc/long": "4.2.2"+ }+ },+ "node_modules/@webassemblyjs/utf8": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz",+ "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@webassemblyjs/wasm-edit": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz",+ "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/ast": "1.14.1",+ "@webassemblyjs/helper-buffer": "1.14.1",+ "@webassemblyjs/helper-wasm-bytecode": "1.13.2",+ "@webassemblyjs/helper-wasm-section": "1.14.1",+ "@webassemblyjs/wasm-gen": "1.14.1",+ "@webassemblyjs/wasm-opt": "1.14.1",+ "@webassemblyjs/wasm-parser": "1.14.1",+ "@webassemblyjs/wast-printer": "1.14.1"+ }+ },+ "node_modules/@webassemblyjs/wasm-gen": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz",+ "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/ast": "1.14.1",+ "@webassemblyjs/helper-wasm-bytecode": "1.13.2",+ "@webassemblyjs/ieee754": "1.13.2",+ "@webassemblyjs/leb128": "1.13.2",+ "@webassemblyjs/utf8": "1.13.2"+ }+ },+ "node_modules/@webassemblyjs/wasm-opt": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz",+ "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/ast": "1.14.1",+ "@webassemblyjs/helper-buffer": "1.14.1",+ "@webassemblyjs/wasm-gen": "1.14.1",+ "@webassemblyjs/wasm-parser": "1.14.1"+ }+ },+ "node_modules/@webassemblyjs/wasm-parser": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz",+ "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/ast": "1.14.1",+ "@webassemblyjs/helper-api-error": "1.13.2",+ "@webassemblyjs/helper-wasm-bytecode": "1.13.2",+ "@webassemblyjs/ieee754": "1.13.2",+ "@webassemblyjs/leb128": "1.13.2",+ "@webassemblyjs/utf8": "1.13.2"+ }+ },+ "node_modules/@webassemblyjs/wast-printer": {+ "version": "1.14.1",+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz",+ "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@webassemblyjs/ast": "1.14.1",+ "@xtuc/long": "4.2.2"+ }+ },+ "node_modules/@xmldom/xmldom": {+ "version": "0.9.10",+ "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.10.tgz",+ "integrity": "sha512-A9gOqLdi6cV4ibazAjcQufGj0B1y/vDqYrcuP6d/6x8P27gRS8643Dj9o1dEKtB6O7fwxb2FgBmJS2mX7gpvdw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14.6"+ }+ },+ "node_modules/@xtuc/ieee754": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",+ "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",+ "dev": true,+ "license": "BSD-3-Clause"+ },+ "node_modules/@xtuc/long": {+ "version": "4.2.2",+ "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",+ "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",+ "dev": true,+ "license": "Apache-2.0"+ },+ "node_modules/abbrev": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",+ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/acorn": {+ "version": "8.17.0",+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz",+ "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==",+ "devOptional": true,+ "license": "MIT",+ "bin": {+ "acorn": "bin/acorn"+ },+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/acorn-import-phases": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",+ "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10.13.0"+ },+ "peerDependencies": {+ "acorn": "^8.14.0"+ }+ },+ "node_modules/acorn-jsx": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",+ "dev": true,+ "license": "MIT",+ "peerDependencies": {+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"+ }+ },+ "node_modules/agent-base": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",+ "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "debug": "4"+ },+ "engines": {+ "node": ">= 6.0.0"+ }+ },+ "node_modules/agentkeepalive": {+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz",+ "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "humanize-ms": "^1.2.1"+ },+ "engines": {+ "node": ">= 8.0.0"+ }+ },+ "node_modules/aggregate-error": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",+ "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "clean-stack": "^2.0.0",+ "indent-string": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/ajv": {+ "version": "6.15.0",+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",+ "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.1",+ "fast-json-stable-stringify": "^2.0.0",+ "json-schema-traverse": "^0.4.1",+ "uri-js": "^4.2.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/epoberezkin"+ }+ },+ "node_modules/ajv-formats": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz",+ "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ajv": "^8.0.0"+ },+ "peerDependencies": {+ "ajv": "^8.0.0"+ },+ "peerDependenciesMeta": {+ "ajv": {+ "optional": true+ }+ }+ },+ "node_modules/ajv-formats/node_modules/ajv": {+ "version": "8.20.0",+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",+ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.3",+ "fast-uri": "^3.0.1",+ "json-schema-traverse": "^1.0.0",+ "require-from-string": "^2.0.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/epoberezkin"+ }+ },+ "node_modules/ajv-formats/node_modules/json-schema-traverse": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/animejs": {+ "version": "4.5.0",+ "resolved": "https://registry.npmjs.org/animejs/-/animejs-4.5.0.tgz",+ "integrity": "sha512-NQimYX+lz8WaXonGS9zVVoviCIAjONeJayxacUditaivYLqyXgGjFKjuyl0aUUhFKm5MriX9ty1TGovNzoJQWA==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/juliangarnier"+ },+ "peerDependencies": {+ "@types/three": ">=0.150.0",+ "three": ">=0.150.0"+ },+ "peerDependenciesMeta": {+ "@types/three": {+ "optional": true+ },+ "three": {+ "optional": true+ }+ }+ },+ "node_modules/ansi-escapes": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",+ "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "type-fest": "^0.21.3"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/ansi-styles": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "color-convert": "^2.0.1"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/appdmg": {+ "version": "0.6.6",+ "resolved": "https://registry.npmjs.org/appdmg/-/appdmg-0.6.6.tgz",+ "integrity": "sha512-GRmFKlCG+PWbcYF4LUNonTYmy0GjguDy6Jh9WP8mpd0T6j80XIJyXBiWlD0U+MLNhqV9Nhx49Gl9GpVToulpLg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "dependencies": {+ "async": "^1.4.2",+ "ds-store": "^0.1.5",+ "execa": "^1.0.0",+ "fs-temp": "^1.0.0",+ "fs-xattr": "^0.3.0",+ "image-size": "^0.7.4",+ "is-my-json-valid": "^2.20.0",+ "minimist": "^1.1.3",+ "parse-color": "^1.0.0",+ "path-exists": "^4.0.0",+ "repeat-string": "^1.5.4"+ },+ "bin": {+ "appdmg": "bin/appdmg.js"+ },+ "engines": {+ "node": ">=8.5"+ }+ },+ "node_modules/argparse": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",+ "dev": true,+ "license": "Python-2.0"+ },+ "node_modules/async": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",+ "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/at-least-node": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",+ "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">= 4.0.0"+ }+ },+ "node_modules/author-regex": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/author-regex/-/author-regex-1.0.0.tgz",+ "integrity": "sha512-KbWgR8wOYRAPekEmMXrYYdc7BRyhn2Ftk7KWfMUnQ43hFdojWEFRxhhRUm3/OFEdPa1r0KAvTTg9YQK57xTe0g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.8"+ }+ },+ "node_modules/babel-plugin-jsx-dom-expressions": {+ "version": "0.40.7",+ "resolved": "https://registry.npmjs.org/babel-plugin-jsx-dom-expressions/-/babel-plugin-jsx-dom-expressions-0.40.7.tgz",+ "integrity": "sha512-/O6JWUmjv03OI9lL2ry9bUjpD5S3PclM55RRJEyCdcFZ5W2SEA/59d+l2hNsk3gI6kiWRdRPdOtqZmsQzFN1pQ==",+ "license": "MIT",+ "dependencies": {+ "@babel/helper-module-imports": "7.18.6",+ "@babel/plugin-syntax-jsx": "^7.18.6",+ "@babel/types": "^7.20.7",+ "html-entities": "2.3.3",+ "parse5": "^7.1.2"+ },+ "peerDependencies": {+ "@babel/core": "^7.20.12"+ }+ },+ "node_modules/babel-plugin-jsx-dom-expressions/node_modules/@babel/helper-module-imports": {+ "version": "7.18.6",+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz",+ "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==",+ "license": "MIT",+ "dependencies": {+ "@babel/types": "^7.18.6"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/babel-preset-solid": {+ "version": "1.9.12",+ "resolved": "https://registry.npmjs.org/babel-preset-solid/-/babel-preset-solid-1.9.12.tgz",+ "integrity": "sha512-LLqnuKVDlKpyBlMPcH6qEvs/wmS9a+NczppxJ3ryS/c0O5IiSFOIBQi9GzyiGDSbcJpx4Gr87jyFTos1MyEuWg==",+ "license": "MIT",+ "dependencies": {+ "babel-plugin-jsx-dom-expressions": "^0.40.6"+ },+ "peerDependencies": {+ "@babel/core": "^7.0.0",+ "solid-js": "^1.9.12"+ },+ "peerDependenciesMeta": {+ "solid-js": {+ "optional": true+ }+ }+ },+ "node_modules/balanced-match": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/base32-encode": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/base32-encode/-/base32-encode-1.2.0.tgz",+ "integrity": "sha512-cHFU8XeRyx0GgmoWi5qHMCVRiqU6J3MHWxVgun7jggCBUpVzm1Ir7M9dYr2whjSNc3tFeXfQ/oZjQu/4u55h9A==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "to-data-view": "^1.1.0"+ }+ },+ "node_modules/base64-js": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/baseline-browser-mapping": {+ "version": "2.10.42",+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.42.tgz",+ "integrity": "sha512-c/jurFrDLyui7o1J86yLkRu4LMsTYcBohveus7/I2Hzdn9KIP2bdJPTue/lR1KH46enoPbD77GKeSYNdyPoD3Q==",+ "license": "Apache-2.0",+ "bin": {+ "baseline-browser-mapping": "dist/cli.cjs"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/bitecs": {+ "version": "0.4.0",+ "resolved": "https://registry.npmjs.org/bitecs/-/bitecs-0.4.0.tgz",+ "integrity": "sha512-ho6Zop/L79DRTnBAfakPpGPuX7y0+lAjX06CpaAW+5tnAc7BH3L3RlSrWAXAqwnQGDZ10GsoxaxyTTsddlun3g==",+ "license": "MPL-2.0"+ },+ "node_modules/bl": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "buffer": "^5.5.0",+ "inherits": "^2.0.4",+ "readable-stream": "^3.4.0"+ }+ },+ "node_modules/bluebird": {+ "version": "3.7.2",+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",+ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/boolbase": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",+ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",+ "license": "ISC"+ },+ "node_modules/boolean": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",+ "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",+ "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/bplist-creator": {+ "version": "0.0.8",+ "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz",+ "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "stream-buffers": "~2.2.0"+ }+ },+ "node_modules/brace-expansion": {+ "version": "1.1.15",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",+ "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0",+ "concat-map": "0.0.1"+ }+ },+ "node_modules/braces": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fill-range": "^7.1.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/browserslist": {+ "version": "4.28.4",+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.4.tgz",+ "integrity": "sha512-MTc8i/x9jBQd1iMw2CFGS+rwMa07eYjLR0CCTLDACl9xhxy+nIs3KeML/biicXtk9JrZ6dnnTatmc7ErPXIxqw==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/browserslist"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "baseline-browser-mapping": "^2.10.38",+ "caniuse-lite": "^1.0.30001799",+ "electron-to-chromium": "^1.5.376",+ "node-releases": "^2.0.48",+ "update-browserslist-db": "^1.2.3"+ },+ "bin": {+ "browserslist": "cli.js"+ },+ "engines": {+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"+ }+ },+ "node_modules/buffer": {+ "version": "5.7.1",+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "base64-js": "^1.3.1",+ "ieee754": "^1.1.13"+ }+ },+ "node_modules/buffer-crc32": {+ "version": "0.2.13",+ "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",+ "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "*"+ }+ },+ "node_modules/buffer-from": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",+ "devOptional": true,+ "license": "MIT"+ },+ "node_modules/cacache": {+ "version": "16.1.3",+ "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz",+ "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "@npmcli/fs": "^2.1.0",+ "@npmcli/move-file": "^2.0.0",+ "chownr": "^2.0.0",+ "fs-minipass": "^2.1.0",+ "glob": "^8.0.1",+ "infer-owner": "^1.0.4",+ "lru-cache": "^7.7.1",+ "minipass": "^3.1.6",+ "minipass-collect": "^1.0.2",+ "minipass-flush": "^1.0.5",+ "minipass-pipeline": "^1.2.4",+ "mkdirp": "^1.0.4",+ "p-map": "^4.0.0",+ "promise-inflight": "^1.0.1",+ "rimraf": "^3.0.2",+ "ssri": "^9.0.0",+ "tar": "^6.1.11",+ "unique-filename": "^2.0.0"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/cacache/node_modules/brace-expansion": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz",+ "integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0"+ }+ },+ "node_modules/cacache/node_modules/glob": {+ "version": "8.1.0",+ "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",+ "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",+ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "fs.realpath": "^1.0.0",+ "inflight": "^1.0.4",+ "inherits": "2",+ "minimatch": "^5.0.1",+ "once": "^1.3.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/cacache/node_modules/minimatch": {+ "version": "5.1.9",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",+ "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^2.0.1"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/cacheable-lookup": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",+ "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10.6.0"+ }+ },+ "node_modules/cacheable-request": {+ "version": "7.0.4",+ "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz",+ "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "clone-response": "^1.0.2",+ "get-stream": "^5.1.0",+ "http-cache-semantics": "^4.0.0",+ "keyv": "^4.0.0",+ "lowercase-keys": "^2.0.0",+ "normalize-url": "^6.0.1",+ "responselike": "^2.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cacheable-request/node_modules/get-stream": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "pump": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/callsites": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/caniuse-lite": {+ "version": "1.0.30001800",+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001800.tgz",+ "integrity": "sha512-MMHtuAz9Ys840zAY5F4k6fV5GaivZ9sPk+nz0mY+GYVzRBnYkN0mpqkSR92oWRQ19yQWo4HvBV/FnC16AJX8MA==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "CC-BY-4.0"+ },+ "node_modules/chalk": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^4.1.0",+ "supports-color": "^7.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/chalk?sponsor=1"+ }+ },+ "node_modules/chardet": {+ "version": "0.7.0",+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",+ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/chownr": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/chrome-trace-event": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz",+ "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.0"+ }+ },+ "node_modules/clean-stack": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",+ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/cli-cursor": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz",+ "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "restore-cursor": "^4.0.0"+ },+ "engines": {+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/cli-spinners": {+ "version": "2.9.2",+ "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz",+ "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/cli-truncate": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz",+ "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "slice-ansi": "^5.0.0",+ "string-width": "^5.0.0"+ },+ "engines": {+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/cli-width": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz",+ "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">= 12"+ }+ },+ "node_modules/cliui": {+ "version": "8.0.1",+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "string-width": "^4.2.0",+ "strip-ansi": "^6.0.1",+ "wrap-ansi": "^7.0.0"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/cliui/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/cliui/node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/wrap-ansi": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },+ "node_modules/clone": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",+ "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.8"+ }+ },+ "node_modules/clone-response": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz",+ "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "mimic-response": "^1.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/clsx": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/cmdk-solid": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/cmdk-solid/-/cmdk-solid-1.1.2.tgz",+ "integrity": "sha512-E0g6bwr2Z92Ib1K2WHwGsq6xsrkVVSN1oe5YTg8LCV3iIwtyZORwmR+8n0xrecqycdhgAar8vWUjtB1OJt9tiA==",+ "license": "MIT",+ "dependencies": {+ "@kobalte/core": "^0.12.4",+ "@kobalte/utils": "^0.9.0",+ "@solid-primitives/deep": "^0.2.7",+ "@solid-primitives/mutation-observer": "^1.1.17"+ },+ "peerDependencies": {+ "solid-js": "^1.8.0"+ }+ },+ "node_modules/cmdk-solid/node_modules/@kobalte/core": {+ "version": "0.12.6",+ "resolved": "https://registry.npmjs.org/@kobalte/core/-/core-0.12.6.tgz",+ "integrity": "sha512-+Ta2o2wEqZ2fCqLMkvjT40VHNmcFKdGe8TNDVQbbMPk66qoU6g/DDRFR/Ib7eAjb+C95VoIyk6zaafos2VOo0w==",+ "license": "MIT",+ "dependencies": {+ "@floating-ui/dom": "^1.5.1",+ "@internationalized/date": "^3.4.0",+ "@internationalized/number": "^3.2.1",+ "@kobalte/utils": "^0.9.0",+ "solid-prevent-scroll": "^0.1.4"+ },+ "peerDependencies": {+ "solid-js": "^1.8.15"+ }+ },+ "node_modules/color-convert": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "color-name": "~1.1.4"+ },+ "engines": {+ "node": ">=7.0.0"+ }+ },+ "node_modules/color-name": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/colord": {+ "version": "2.9.3",+ "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz",+ "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==",+ "license": "MIT"+ },+ "node_modules/colorette": {+ "version": "2.0.20",+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",+ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/commander": {+ "version": "14.0.3",+ "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",+ "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",+ "license": "MIT",+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/compare-version": {+ "version": "0.1.2",+ "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz",+ "integrity": "sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/concat-map": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/convert-source-map": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",+ "license": "MIT"+ },+ "node_modules/cross-dirname": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/cross-dirname/-/cross-dirname-0.1.0.tgz",+ "integrity": "sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/cross-spawn": {+ "version": "7.0.6",+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "path-key": "^3.1.0",+ "shebang-command": "^2.0.0",+ "which": "^2.0.1"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/cross-zip": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/cross-zip/-/cross-zip-4.0.1.tgz",+ "integrity": "sha512-n63i0lZ0rvQ6FXiGQ+/JFCKAUyPFhLQYJIqKaa+tSJtfKeULF/IDNDAbdnSIxgS4NTuw2b0+lj8LzfITuq+ZxQ==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "engines": {+ "node": ">=12.10"+ }+ },+ "node_modules/css-select": {+ "version": "5.2.2",+ "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz",+ "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "boolbase": "^1.0.0",+ "css-what": "^6.1.0",+ "domhandler": "^5.0.2",+ "domutils": "^3.0.1",+ "nth-check": "^2.0.1"+ },+ "funding": {+ "url": "https://github.com/sponsors/fb55"+ }+ },+ "node_modules/css-tree": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz",+ "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",+ "license": "MIT",+ "dependencies": {+ "mdn-data": "2.0.30",+ "source-map-js": "^1.0.1"+ },+ "engines": {+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"+ }+ },+ "node_modules/css-what": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz",+ "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==",+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">= 6"+ },+ "funding": {+ "url": "https://github.com/sponsors/fb55"+ }+ },+ "node_modules/csso": {+ "version": "5.0.5",+ "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz",+ "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==",+ "license": "MIT",+ "dependencies": {+ "css-tree": "~2.2.0"+ },+ "engines": {+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0",+ "npm": ">=7.0.0"+ }+ },+ "node_modules/csso/node_modules/css-tree": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz",+ "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==",+ "license": "MIT",+ "dependencies": {+ "mdn-data": "2.0.28",+ "source-map-js": "^1.0.1"+ },+ "engines": {+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0",+ "npm": ">=7.0.0"+ }+ },+ "node_modules/csso/node_modules/mdn-data": {+ "version": "2.0.28",+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz",+ "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==",+ "license": "CC0-1.0"+ },+ "node_modules/csstype": {+ "version": "3.2.3",+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",+ "license": "MIT"+ },+ "node_modules/cva": {+ "version": "1.0.0-beta.4",+ "resolved": "https://registry.npmjs.org/cva/-/cva-1.0.0-beta.4.tgz",+ "integrity": "sha512-F/JS9hScapq4DBVQXcK85l9U91M6ePeXoBMSp7vypzShoefUBxjQTo3g3935PUHgQd+IW77DjbPRIxugy4/GCQ==",+ "license": "Apache-2.0",+ "dependencies": {+ "clsx": "^2.1.1"+ },+ "funding": {+ "url": "https://polar.sh/cva"+ },+ "peerDependencies": {+ "typescript": ">= 4.5.5"+ },+ "peerDependenciesMeta": {+ "typescript": {+ "optional": true+ }+ }+ },+ "node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/decompress-response": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",+ "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "mimic-response": "^3.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/decompress-response/node_modules/mimic-response": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",+ "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/deep-is": {+ "version": "0.1.4",+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/defaults": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz",+ "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "clone": "^1.0.2"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/defer-to-connect": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",+ "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/define-data-property": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",+ "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "es-define-property": "^1.0.0",+ "es-errors": "^1.3.0",+ "gopd": "^1.0.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/define-properties": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",+ "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "define-data-property": "^1.0.1",+ "has-property-descriptors": "^1.0.0",+ "object-keys": "^1.1.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/detect-libc": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",+ "license": "Apache-2.0",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/detect-node": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",+ "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/dir-compare": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-4.2.0.tgz",+ "integrity": "sha512-2xMCmOoMrdQIPHdsTawECdNPwlVFB9zGcz3kuhmBO6U3oU+UQjsue0i8ayLKpgBcm+hcXPMVSGUN9d+pvJ6+VQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "minimatch": "^3.0.5",+ "p-limit": "^3.1.0 "+ }+ },+ "node_modules/dom-serializer": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",+ "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",+ "license": "MIT",+ "dependencies": {+ "domelementtype": "^2.3.0",+ "domhandler": "^5.0.2",+ "entities": "^4.2.0"+ },+ "funding": {+ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"+ }+ },+ "node_modules/dom-serializer/node_modules/entities": {+ "version": "4.5.0",+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",+ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=0.12"+ },+ "funding": {+ "url": "https://github.com/fb55/entities?sponsor=1"+ }+ },+ "node_modules/domelementtype": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",+ "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/fb55"+ }+ ],+ "license": "BSD-2-Clause"+ },+ "node_modules/domhandler": {+ "version": "5.0.3",+ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",+ "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "domelementtype": "^2.3.0"+ },+ "engines": {+ "node": ">= 4"+ },+ "funding": {+ "url": "https://github.com/fb55/domhandler?sponsor=1"+ }+ },+ "node_modules/domutils": {+ "version": "3.2.2",+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz",+ "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "dom-serializer": "^2.0.0",+ "domelementtype": "^2.3.0",+ "domhandler": "^5.0.3"+ },+ "funding": {+ "url": "https://github.com/fb55/domutils?sponsor=1"+ }+ },+ "node_modules/ds-store": {+ "version": "0.1.6",+ "resolved": "https://registry.npmjs.org/ds-store/-/ds-store-0.1.6.tgz",+ "integrity": "sha512-kY21M6Lz+76OS3bnCzjdsJSF7LBpLYGCVfavW8TgQD2XkcqIZ86W0y9qUDZu6fp7SIZzqosMDW2zi7zVFfv4hw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "bplist-creator": "~0.0.3",+ "macos-alias": "~0.2.5",+ "tn1150": "^0.1.0"+ }+ },+ "node_modules/eastasianwidth": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",+ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/electron": {+ "version": "35.7.5",+ "resolved": "https://registry.npmjs.org/electron/-/electron-35.7.5.tgz",+ "integrity": "sha512-dnL+JvLraKZl7iusXTVTGYs10TKfzUi30uEDTqsmTm0guN9V2tbOjTzyIZbh9n3ygUjgEYyo+igAwMRXIi3IPw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "@electron/get": "^2.0.0",+ "@types/node": "^22.7.7",+ "extract-zip": "^2.0.1"+ },+ "bin": {+ "electron": "cli.js"+ },+ "engines": {+ "node": ">= 12.20.55"+ }+ },+ "node_modules/electron-installer-common": {+ "version": "0.10.4",+ "resolved": "https://registry.npmjs.org/electron-installer-common/-/electron-installer-common-0.10.4.tgz",+ "integrity": "sha512-8gMNPXfAqUE5CfXg8RL0vXpLE9HAaPkgLXVoHE3BMUzogMWenf4LmwQ27BdCUrEhkjrKl+igs2IHJibclR3z3Q==",+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "@electron/asar": "^3.2.5",+ "@malept/cross-spawn-promise": "^1.0.0",+ "debug": "^4.1.1",+ "fs-extra": "^9.0.0",+ "glob": "^7.1.4",+ "lodash": "^4.17.15",+ "parse-author": "^2.0.0",+ "semver": "^7.1.1",+ "tmp-promise": "^3.0.2"+ },+ "engines": {+ "node": ">= 10.0.0"+ },+ "funding": {+ "url": "https://github.com/electron-userland/electron-installer-common?sponsor=1"+ },+ "optionalDependencies": {+ "@types/fs-extra": "^9.0.1"+ }+ },+ "node_modules/electron-installer-common/node_modules/@malept/cross-spawn-promise": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz",+ "integrity": "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ==",+ "dev": true,+ "funding": [+ {+ "type": "individual",+ "url": "https://github.com/sponsors/malept"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund"+ }+ ],+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "cross-spawn": "^7.0.1"+ },+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/electron-installer-common/node_modules/fs-extra": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",+ "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "at-least-node": "^1.0.0",+ "graceful-fs": "^4.2.0",+ "jsonfile": "^6.0.1",+ "universalify": "^2.0.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/electron-installer-debian": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/electron-installer-debian/-/electron-installer-debian-3.2.0.tgz",+ "integrity": "sha512-58ZrlJ1HQY80VucsEIG9tQ//HrTlG6sfofA3nRGr6TmkX661uJyu4cMPPh6kXW+aHdq/7+q25KyQhDrXvRL7jw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin",+ "linux"+ ],+ "dependencies": {+ "@malept/cross-spawn-promise": "^1.0.0",+ "debug": "^4.1.1",+ "electron-installer-common": "^0.10.2",+ "fs-extra": "^9.0.0",+ "get-folder-size": "^2.0.1",+ "lodash": "^4.17.4",+ "word-wrap": "^1.2.3",+ "yargs": "^16.0.2"+ },+ "bin": {+ "electron-installer-debian": "src/cli.js"+ },+ "engines": {+ "node": ">= 10.0.0"+ }+ },+ "node_modules/electron-installer-debian/node_modules/@malept/cross-spawn-promise": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz",+ "integrity": "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ==",+ "dev": true,+ "funding": [+ {+ "type": "individual",+ "url": "https://github.com/sponsors/malept"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund"+ }+ ],+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "cross-spawn": "^7.0.1"+ },+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/electron-installer-debian/node_modules/cliui": {+ "version": "7.0.4",+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",+ "dev": true,+ "license": "ISC",+ "optional": true,+ "dependencies": {+ "string-width": "^4.2.0",+ "strip-ansi": "^6.0.0",+ "wrap-ansi": "^7.0.0"+ }+ },+ "node_modules/electron-installer-debian/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/electron-installer-debian/node_modules/fs-extra": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",+ "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "at-least-node": "^1.0.0",+ "graceful-fs": "^4.2.0",+ "jsonfile": "^6.0.1",+ "universalify": "^2.0.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/electron-installer-debian/node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/electron-installer-debian/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/electron-installer-debian/node_modules/wrap-ansi": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },+ "node_modules/electron-installer-debian/node_modules/yargs": {+ "version": "16.2.2",+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.2.tgz",+ "integrity": "sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "cliui": "^7.0.2",+ "escalade": "^3.1.1",+ "get-caller-file": "^2.0.5",+ "require-directory": "^2.1.1",+ "string-width": "^4.2.0",+ "y18n": "^5.0.5",+ "yargs-parser": "^20.2.2"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/electron-installer-debian/node_modules/yargs-parser": {+ "version": "20.2.9",+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",+ "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",+ "dev": true,+ "license": "ISC",+ "optional": true,+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/electron-installer-dmg": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/electron-installer-dmg/-/electron-installer-dmg-5.0.1.tgz",+ "integrity": "sha512-qOa1aAQdX57C+vzhDk3549dd/PRlNL4F8y736MTD1a43qptD+PvHY97Bo9gSf+OZ8iUWE7BrYSpk/FgLUe40EA==",+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "@types/appdmg": "^0.5.5",+ "debug": "^4.3.2",+ "minimist": "^1.2.7"+ },+ "bin": {+ "electron-installer-dmg": "dist/electron-installer-dmg-bin.js"+ },+ "engines": {+ "node": ">= 16"+ },+ "optionalDependencies": {+ "appdmg": "^0.6.4"+ }+ },+ "node_modules/electron-to-chromium": {+ "version": "1.5.387",+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.387.tgz",+ "integrity": "sha512-TaxwufTFDufvPEoXdhwVrA3UdFWBeWGkYoJ1K8ldF1xe6gKfth6iRNS5lTQ5JPNOHdGQm8PT1QYKUqFLCiUefQ==",+ "license": "ISC"+ },+ "node_modules/electron-winstaller": {+ "version": "5.4.4",+ "resolved": "https://registry.npmjs.org/electron-winstaller/-/electron-winstaller-5.4.4.tgz",+ "integrity": "sha512-j9ETcBGJaXxAY/b6UBpR7LZfjdU4BAO+yvr4ifqHEdyuc3UNCy91PDGkWKY5UQ4coHNYfnwFggrqD6QPeFGAlg==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "@electron/asar": "^3.2.1",+ "debug": "^4.1.1",+ "fs-extra": "^7.0.1",+ "lodash": "^4.17.21",+ "semver": "^7.6.3",+ "temp": "^0.9.0"+ },+ "engines": {+ "node": ">=8.0.0"+ },+ "optionalDependencies": {+ "@electron/windows-sign": "^1.1.2"+ }+ },+ "node_modules/electron-winstaller/node_modules/fs-extra": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",+ "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "graceful-fs": "^4.1.2",+ "jsonfile": "^4.0.0",+ "universalify": "^0.1.0"+ },+ "engines": {+ "node": ">=6 <7 || >=8"+ }+ },+ "node_modules/electron-winstaller/node_modules/jsonfile": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",+ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "optionalDependencies": {+ "graceful-fs": "^4.1.6"+ }+ },+ "node_modules/electron-winstaller/node_modules/universalify": {+ "version": "0.1.2",+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">= 4.0.0"+ }+ },+ "node_modules/electron/node_modules/@electron/get": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz",+ "integrity": "sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "debug": "^4.1.1",+ "env-paths": "^2.2.0",+ "fs-extra": "^8.1.0",+ "got": "^11.8.5",+ "progress": "^2.0.3",+ "semver": "^6.2.0",+ "sumchecker": "^3.0.1"+ },+ "engines": {+ "node": ">=12"+ },+ "optionalDependencies": {+ "global-agent": "^3.0.0"+ }+ },+ "node_modules/electron/node_modules/@types/node": {+ "version": "22.20.0",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.0.tgz",+ "integrity": "sha512-QWlFW2wf3nTjC13/DqRnBpR4ZO36VJH/JVBkA/vcnmbTBNQIlnObqyqZE1tUR7+Ni23Lda8R1BxMfbXRpCUx5g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~6.21.0"+ }+ },+ "node_modules/electron/node_modules/fs-extra": {+ "version": "8.1.0",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",+ "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.0",+ "jsonfile": "^4.0.0",+ "universalify": "^0.1.0"+ },+ "engines": {+ "node": ">=6 <7 || >=8"+ }+ },+ "node_modules/electron/node_modules/jsonfile": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",+ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",+ "dev": true,+ "license": "MIT",+ "optionalDependencies": {+ "graceful-fs": "^4.1.6"+ }+ },+ "node_modules/electron/node_modules/semver": {+ "version": "6.3.1",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ }+ },+ "node_modules/electron/node_modules/undici-types": {+ "version": "6.21.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/electron/node_modules/universalify": {+ "version": "0.1.2",+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 4.0.0"+ }+ },+ "node_modules/emoji-regex": {+ "version": "9.2.2",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",+ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/encode-utf8": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz",+ "integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/encoding": {+ "version": "0.1.13",+ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",+ "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "iconv-lite": "^0.6.2"+ }+ },+ "node_modules/encoding/node_modules/iconv-lite": {+ "version": "0.6.3",+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "safer-buffer": ">= 2.1.2 < 3.0.0"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/end-of-stream": {+ "version": "1.4.5",+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",+ "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "once": "^1.4.0"+ }+ },+ "node_modules/enhanced-resolve": {+ "version": "5.21.6",+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.21.6.tgz",+ "integrity": "sha512-aNnGCvbJ/RIyWo1IuhNdVjnNF+EjH9wpzpNHt+ci/m9He9LJvUN8wrCcXjp9cWsGNAuvSpVFTx/vraAFQ8qGjQ==",+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.4",+ "tapable": "^2.3.3"+ },+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/entities": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",+ "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=0.12"+ },+ "funding": {+ "url": "https://github.com/fb55/entities?sponsor=1"+ }+ },+ "node_modules/env-paths": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",+ "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/err-code": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz",+ "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/error-ex": {+ "version": "1.3.4",+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz",+ "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-arrayish": "^0.2.1"+ }+ },+ "node_modules/es-define-property": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-errors": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-module-lexer": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.0.tgz",+ "integrity": "sha512-KLdwQm2NvGLDkQDCGvmiQrhkd0JbMzXthwQAUgWjQuQdBLFa3eiBP5arXZyA+f8x+x7OXgud6bq2rxjGtHV2tw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/es6-error": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",+ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/esbuild": {+ "version": "0.28.1",+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz",+ "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==",+ "hasInstallScript": true,+ "license": "MIT",+ "bin": {+ "esbuild": "bin/esbuild"+ },+ "engines": {+ "node": ">=18"+ },+ "optionalDependencies": {+ "@esbuild/aix-ppc64": "0.28.1",+ "@esbuild/android-arm": "0.28.1",+ "@esbuild/android-arm64": "0.28.1",+ "@esbuild/android-x64": "0.28.1",+ "@esbuild/darwin-arm64": "0.28.1",+ "@esbuild/darwin-x64": "0.28.1",+ "@esbuild/freebsd-arm64": "0.28.1",+ "@esbuild/freebsd-x64": "0.28.1",+ "@esbuild/linux-arm": "0.28.1",+ "@esbuild/linux-arm64": "0.28.1",+ "@esbuild/linux-ia32": "0.28.1",+ "@esbuild/linux-loong64": "0.28.1",+ "@esbuild/linux-mips64el": "0.28.1",+ "@esbuild/linux-ppc64": "0.28.1",+ "@esbuild/linux-riscv64": "0.28.1",+ "@esbuild/linux-s390x": "0.28.1",+ "@esbuild/linux-x64": "0.28.1",+ "@esbuild/netbsd-arm64": "0.28.1",+ "@esbuild/netbsd-x64": "0.28.1",+ "@esbuild/openbsd-arm64": "0.28.1",+ "@esbuild/openbsd-x64": "0.28.1",+ "@esbuild/openharmony-arm64": "0.28.1",+ "@esbuild/sunos-x64": "0.28.1",+ "@esbuild/win32-arm64": "0.28.1",+ "@esbuild/win32-ia32": "0.28.1",+ "@esbuild/win32-x64": "0.28.1"+ }+ },+ "node_modules/escalade": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/escape-string-regexp": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/eslint": {+ "version": "9.39.4",+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.4.tgz",+ "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@eslint-community/eslint-utils": "^4.8.0",+ "@eslint-community/regexpp": "^4.12.1",+ "@eslint/config-array": "^0.21.2",+ "@eslint/config-helpers": "^0.4.2",+ "@eslint/core": "^0.17.0",+ "@eslint/eslintrc": "^3.3.5",+ "@eslint/js": "9.39.4",+ "@eslint/plugin-kit": "^0.4.1",+ "@humanfs/node": "^0.16.6",+ "@humanwhocodes/module-importer": "^1.0.1",+ "@humanwhocodes/retry": "^0.4.2",+ "@types/estree": "^1.0.6",+ "ajv": "^6.14.0",+ "chalk": "^4.0.0",+ "cross-spawn": "^7.0.6",+ "debug": "^4.3.2",+ "escape-string-regexp": "^4.0.0",+ "eslint-scope": "^8.4.0",+ "eslint-visitor-keys": "^4.2.1",+ "espree": "^10.4.0",+ "esquery": "^1.5.0",+ "esutils": "^2.0.2",+ "fast-deep-equal": "^3.1.3",+ "file-entry-cache": "^8.0.0",+ "find-up": "^5.0.0",+ "glob-parent": "^6.0.2",+ "ignore": "^5.2.0",+ "imurmurhash": "^0.1.4",+ "is-glob": "^4.0.0",+ "json-stable-stringify-without-jsonify": "^1.0.1",+ "lodash.merge": "^4.6.2",+ "minimatch": "^3.1.5",+ "natural-compare": "^1.4.0",+ "optionator": "^0.9.3"+ },+ "bin": {+ "eslint": "bin/eslint.js"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://eslint.org/donate"+ },+ "peerDependencies": {+ "jiti": "*"+ },+ "peerDependenciesMeta": {+ "jiti": {+ "optional": true+ }+ }+ },+ "node_modules/eslint-plugin-solid": {+ "version": "0.14.5",+ "resolved": "https://registry.npmjs.org/eslint-plugin-solid/-/eslint-plugin-solid-0.14.5.tgz",+ "integrity": "sha512-nfuYK09ah5aJG/oEN6P1qziy1zLgW4PDWe75VNPi4CEFYk1x2AEqwFeQfEPR7gNn0F2jOeqKhx2E+5oNCOBYWQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@typescript-eslint/utils": "^7.13.1 || ^8.0.0",+ "estraverse": "^5.3.0",+ "is-html": "^2.0.0",+ "kebab-case": "^1.0.2",+ "known-css-properties": "^0.30.0",+ "style-to-object": "^1.0.6"+ },+ "engines": {+ "node": ">=18.0.0"+ },+ "peerDependencies": {+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",+ "typescript": ">=4.8.4"+ }+ },+ "node_modules/eslint-scope": {+ "version": "8.4.0",+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",+ "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "esrecurse": "^4.3.0",+ "estraverse": "^5.2.0"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/eslint-visitor-keys": {+ "version": "3.4.3",+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/eslint/node_modules/eslint-visitor-keys": {+ "version": "4.2.1",+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",+ "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/eslint/node_modules/ignore": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 4"+ }+ },+ "node_modules/espree": {+ "version": "10.4.0",+ "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",+ "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "acorn": "^8.15.0",+ "acorn-jsx": "^5.3.2",+ "eslint-visitor-keys": "^4.2.1"+ },+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/espree/node_modules/eslint-visitor-keys": {+ "version": "4.2.1",+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",+ "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/eslint"+ }+ },+ "node_modules/esquery": {+ "version": "1.7.0",+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",+ "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",+ "dev": true,+ "license": "BSD-3-Clause",+ "dependencies": {+ "estraverse": "^5.1.0"+ },+ "engines": {+ "node": ">=0.10"+ }+ },+ "node_modules/esrecurse": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "estraverse": "^5.2.0"+ },+ "engines": {+ "node": ">=4.0"+ }+ },+ "node_modules/estraverse": {+ "version": "5.3.0",+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",+ "dev": true,+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=4.0"+ }+ },+ "node_modules/esutils": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",+ "dev": true,+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/eta": {+ "version": "3.5.0",+ "resolved": "https://registry.npmjs.org/eta/-/eta-3.5.0.tgz",+ "integrity": "sha512-e3x3FBvGzeCIHhF+zhK8FZA2vC5uFn6b4HJjegUbIWrDb4mJ7JjTGMJY9VGIbRVpmSwHopNiaJibhjIr+HfLug==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.0.0"+ },+ "funding": {+ "url": "https://github.com/eta-dev/eta?sponsor=1"+ }+ },+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/events": {+ "version": "3.3.0",+ "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",+ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.8.x"+ }+ },+ "node_modules/execa": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",+ "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "cross-spawn": "^6.0.0",+ "get-stream": "^4.0.0",+ "is-stream": "^1.1.0",+ "npm-run-path": "^2.0.0",+ "p-finally": "^1.0.0",+ "signal-exit": "^3.0.0",+ "strip-eof": "^1.0.0"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/execa/node_modules/cross-spawn": {+ "version": "6.0.6",+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz",+ "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "nice-try": "^1.0.4",+ "path-key": "^2.0.1",+ "semver": "^5.5.0",+ "shebang-command": "^1.2.0",+ "which": "^1.2.9"+ },+ "engines": {+ "node": ">=4.8"+ }+ },+ "node_modules/execa/node_modules/path-key": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",+ "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/execa/node_modules/semver": {+ "version": "5.7.2",+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",+ "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver"+ }+ },+ "node_modules/execa/node_modules/shebang-command": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",+ "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "shebang-regex": "^1.0.0"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/execa/node_modules/shebang-regex": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",+ "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/execa/node_modules/signal-exit": {+ "version": "3.0.7",+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/execa/node_modules/which": {+ "version": "1.3.1",+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "isexe": "^2.0.0"+ },+ "bin": {+ "which": "bin/which"+ }+ },+ "node_modules/exponential-backoff": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz",+ "integrity": "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==",+ "dev": true,+ "license": "Apache-2.0"+ },+ "node_modules/external-editor": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",+ "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "chardet": "^0.7.0",+ "iconv-lite": "^0.4.24",+ "tmp": "^0.0.33"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/extract-zip": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",+ "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "debug": "^4.1.1",+ "get-stream": "^5.1.0",+ "yauzl": "^2.10.0"+ },+ "bin": {+ "extract-zip": "cli.js"+ },+ "engines": {+ "node": ">= 10.17.0"+ },+ "optionalDependencies": {+ "@types/yauzl": "^2.9.1"+ }+ },+ "node_modules/extract-zip/node_modules/get-stream": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "pump": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/fast-deep-equal": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/fast-glob": {+ "version": "3.3.3",+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",+ "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@nodelib/fs.stat": "^2.0.2",+ "@nodelib/fs.walk": "^1.2.3",+ "glob-parent": "^5.1.2",+ "merge2": "^1.3.0",+ "micromatch": "^4.0.8"+ },+ "engines": {+ "node": ">=8.6.0"+ }+ },+ "node_modules/fast-glob/node_modules/glob-parent": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/fast-json-stable-stringify": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/fast-levenshtein": {+ "version": "2.0.6",+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/fast-uri": {+ "version": "3.1.3",+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.3.tgz",+ "integrity": "sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/fastify"+ },+ {+ "type": "opencollective",+ "url": "https://opencollective.com/fastify"+ }+ ],+ "license": "BSD-3-Clause"+ },+ "node_modules/fastq": {+ "version": "1.20.1",+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",+ "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "reusify": "^1.0.4"+ }+ },+ "node_modules/fd-slicer": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",+ "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "pend": "~1.2.0"+ }+ },+ "node_modules/file-entry-cache": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",+ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "flat-cache": "^4.0.0"+ },+ "engines": {+ "node": ">=16.0.0"+ }+ },+ "node_modules/filename-reserved-regex": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz",+ "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/filenamify": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz",+ "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "filename-reserved-regex": "^2.0.0",+ "strip-outer": "^1.0.1",+ "trim-repeated": "^1.0.0"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/fill-range": {+ "version": "7.1.1",+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "to-regex-range": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/find-up": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "locate-path": "^6.0.0",+ "path-exists": "^4.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/flat-cache": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",+ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "flatted": "^3.2.9",+ "keyv": "^4.5.4"+ },+ "engines": {+ "node": ">=16"+ }+ },+ "node_modules/flatted": {+ "version": "3.4.2",+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",+ "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/flora-colossus": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-2.0.0.tgz",+ "integrity": "sha512-dz4HxH6pOvbUzZpZ/yXhafjbR2I8cenK5xL0KtBFb7U2ADsR+OwXifnxZjij/pZWF775uSCMzWVd+jDik2H2IA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "debug": "^4.3.4",+ "fs-extra": "^10.1.0"+ },+ "engines": {+ "node": ">= 12"+ }+ },+ "node_modules/fmix": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/fmix/-/fmix-0.1.0.tgz",+ "integrity": "sha512-Y6hyofImk9JdzU8k5INtTXX1cu8LDlePWDFU5sftm9H+zKCr5SGrVjdhkvsim646cw5zD0nADj8oHyXMZmCZ9w==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "imul": "^1.0.0"+ }+ },+ "node_modules/fs-extra": {+ "version": "10.1.0",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",+ "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.0",+ "jsonfile": "^6.0.1",+ "universalify": "^2.0.0"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/fs-minipass": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/fs-temp": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/fs-temp/-/fs-temp-1.2.1.tgz",+ "integrity": "sha512-okTwLB7/Qsq82G6iN5zZJFsOfZtx2/pqrA7Hk/9fvy+c+eJS9CvgGXT2uNxwnI14BDY9L/jQPkaBgSvlKfSW9w==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "random-path": "^0.1.0"+ }+ },+ "node_modules/fs-xattr": {+ "version": "0.3.1",+ "resolved": "https://registry.npmjs.org/fs-xattr/-/fs-xattr-0.3.1.tgz",+ "integrity": "sha512-UVqkrEW0GfDabw4C3HOrFlxKfx0eeigfRne69FxSBdHIP8Qt5Sq6Pu3RM9KmMlkygtC4pPKkj5CiPO5USnj2GA==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "!win32"+ ],+ "engines": {+ "node": ">=8.6.0"+ }+ },+ "node_modules/fs.realpath": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",+ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "dev": true,+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/galactus": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/galactus/-/galactus-1.0.0.tgz",+ "integrity": "sha512-R1fam6D4CyKQGNlvJne4dkNF+PvUUl7TAJInvTGa9fti9qAv95quQz29GXapA4d8Ec266mJJxFVh82M4GIIGDQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "debug": "^4.3.4",+ "flora-colossus": "^2.0.0",+ "fs-extra": "^10.1.0"+ },+ "engines": {+ "node": ">= 12"+ }+ },+ "node_modules/gar": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/gar/-/gar-1.0.4.tgz",+ "integrity": "sha512-w4n9cPWyP7aHxKxYHFQMegj7WIAsL/YX/C4Bs5Rr8s1H9M1rNtRWRsw+ovYMkXDQ5S4ZbYHsHAPmevPjPgw44w==",+ "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/generate-function": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",+ "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "is-property": "^1.0.2"+ }+ },+ "node_modules/generate-object-property": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz",+ "integrity": "sha512-TuOwZWgJ2VAMEGJvAyPWvpqxSANF0LDpmyHauMjFYzaACvn+QTT/AZomvPCzVBV7yDN3OmwHQ5OvHaeLKre3JQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "is-property": "^1.0.0"+ }+ },+ "node_modules/gensync": {+ "version": "1.0.0-beta.2",+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/get-caller-file": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": "6.* || 8.* || >= 10.*"+ }+ },+ "node_modules/get-folder-size": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/get-folder-size/-/get-folder-size-2.0.1.tgz",+ "integrity": "sha512-+CEb+GDCM7tkOS2wdMKTn9vU7DgnKUTuDlehkNJKNSovdCOVxs14OfKCk4cvSaR3za4gj+OBdl9opPN9xrJ0zA==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "gar": "^1.0.4",+ "tiny-each-async": "2.0.3"+ },+ "bin": {+ "get-folder-size": "bin/get-folder-size"+ }+ },+ "node_modules/get-package-info": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/get-package-info/-/get-package-info-1.0.0.tgz",+ "integrity": "sha512-SCbprXGAPdIhKAXiG+Mk6yeoFH61JlYunqdFQFHDtLjJlDjFf6x07dsS8acO+xWt52jpdVo49AlVDnUVK1sDNw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "bluebird": "^3.1.1",+ "debug": "^2.2.0",+ "lodash.get": "^4.0.0",+ "read-pkg-up": "^2.0.0"+ },+ "engines": {+ "node": ">= 4.0"+ }+ },+ "node_modules/get-package-info/node_modules/debug": {+ "version": "2.6.9",+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ms": "2.0.0"+ }+ },+ "node_modules/get-package-info/node_modules/ms": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/get-stream": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "pump": "^3.0.0"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/glob": {+ "version": "7.2.3",+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",+ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "fs.realpath": "^1.0.0",+ "inflight": "^1.0.4",+ "inherits": "2",+ "minimatch": "^3.1.1",+ "once": "^1.3.0",+ "path-is-absolute": "^1.0.0"+ },+ "engines": {+ "node": "*"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/glob-parent": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.3"+ },+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/global-agent": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz",+ "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==",+ "dev": true,+ "license": "BSD-3-Clause",+ "optional": true,+ "dependencies": {+ "boolean": "^3.0.1",+ "es6-error": "^4.1.1",+ "matcher": "^3.0.0",+ "roarr": "^2.15.3",+ "semver": "^7.3.2",+ "serialize-error": "^7.0.1"+ },+ "engines": {+ "node": ">=10.0"+ }+ },+ "node_modules/global-dirs": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz",+ "integrity": "sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ini": "2.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/globals": {+ "version": "17.7.0",+ "resolved": "https://registry.npmjs.org/globals/-/globals-17.7.0.tgz",+ "integrity": "sha512-Czmyns5dUsq4seFBR/Kdydhmo8y9kC79hiSkPn0YcGtNnYWnrgt0vjrSjx9tspoDGWm2CMarffRuLjM4xUz8xg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/globalthis": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",+ "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "define-properties": "^1.2.1",+ "gopd": "^1.0.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/gopd": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/got": {+ "version": "11.8.6",+ "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz",+ "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@sindresorhus/is": "^4.0.0",+ "@szmarczak/http-timer": "^4.0.5",+ "@types/cacheable-request": "^6.0.1",+ "@types/responselike": "^1.0.0",+ "cacheable-lookup": "^5.0.3",+ "cacheable-request": "^7.0.2",+ "decompress-response": "^6.0.0",+ "http2-wrapper": "^1.0.0-beta.5.2",+ "lowercase-keys": "^2.0.0",+ "p-cancelable": "^2.0.0",+ "responselike": "^2.0.0"+ },+ "engines": {+ "node": ">=10.19.0"+ },+ "funding": {+ "url": "https://github.com/sindresorhus/got?sponsor=1"+ }+ },+ "node_modules/graceful-fs": {+ "version": "4.2.11",+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",+ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",+ "license": "ISC"+ },+ "node_modules/has-flag": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/has-property-descriptors": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",+ "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "es-define-property": "^1.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/hasown": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/hosted-git-info": {+ "version": "2.8.9",+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",+ "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/html-entities": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz",+ "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==",+ "license": "MIT"+ },+ "node_modules/html-tags": {+ "version": "3.3.1",+ "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.3.1.tgz",+ "integrity": "sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/http-cache-semantics": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz",+ "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==",+ "dev": true,+ "license": "BSD-2-Clause"+ },+ "node_modules/http-proxy-agent": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz",+ "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@tootallnate/once": "2",+ "agent-base": "6",+ "debug": "4"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/http2-wrapper": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz",+ "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "quick-lru": "^5.1.1",+ "resolve-alpn": "^1.0.0"+ },+ "engines": {+ "node": ">=10.19.0"+ }+ },+ "node_modules/https-proxy-agent": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",+ "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "agent-base": "6",+ "debug": "4"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/humanize-ms": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",+ "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ms": "^2.0.0"+ }+ },+ "node_modules/iceberg-js": {+ "version": "0.8.1",+ "resolved": "https://registry.npmjs.org/iceberg-js/-/iceberg-js-0.8.1.tgz",+ "integrity": "sha512-1dhVQZXhcHje7798IVM+xoo/1ZdVfzOMIc8/rgVSijRK38EDqOJoGula9N/8ZI5RD8QTxNQtK/Gozpr+qUqRRA==",+ "license": "MIT",+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/iconv-lite": {+ "version": "0.4.24",+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "safer-buffer": ">= 2.1.2 < 3"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/idb": {+ "version": "8.0.3",+ "resolved": "https://registry.npmjs.org/idb/-/idb-8.0.3.tgz",+ "integrity": "sha512-LtwtVyVYO5BqRvcsKuB2iUMnHwPVByPCXFXOpuU96IZPPoPN6xjOGxZQ74pgSVVLQWtUOYgyeL4GE98BY5D3wg==",+ "license": "ISC"+ },+ "node_modules/ieee754": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "BSD-3-Clause"+ },+ "node_modules/ignore": {+ "version": "7.0.5",+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",+ "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 4"+ }+ },+ "node_modules/image-size": {+ "version": "0.7.5",+ "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz",+ "integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "bin": {+ "image-size": "bin/image-size.js"+ },+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/import-fresh": {+ "version": "3.3.1",+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",+ "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "parent-module": "^1.0.0",+ "resolve-from": "^4.0.0"+ },+ "engines": {+ "node": ">=6"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/imul": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/imul/-/imul-1.0.1.tgz",+ "integrity": "sha512-WFAgfwPLAjU66EKt6vRdTlKj4nAgIDQzh29JonLa4Bqtl6D8JrIMvWjCnx7xEjVNmP3U0fM5o8ZObk7d0f62bA==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/imurmurhash": {+ "version": "0.1.4",+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",+ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.8.19"+ }+ },+ "node_modules/indent-string": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",+ "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/infer-owner": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",+ "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/inflight": {+ "version": "1.0.6",+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",+ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",+ "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "once": "^1.3.0",+ "wrappy": "1"+ }+ },+ "node_modules/inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/ini": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz",+ "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/inline-style-parser": {+ "version": "0.2.7",+ "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz",+ "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/interpret": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz",+ "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/ip-address": {+ "version": "10.2.0",+ "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz",+ "integrity": "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 12"+ }+ },+ "node_modules/is-arrayish": {+ "version": "0.2.1",+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",+ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/is-core-module": {+ "version": "2.16.2",+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz",+ "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "hasown": "^2.0.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/is-extglob": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-fullwidth-code-point": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz",+ "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-glob": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-extglob": "^2.1.1"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-html": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/is-html/-/is-html-2.0.0.tgz",+ "integrity": "sha512-S+OpgB5i7wzIue/YSE5hg0e5ZYfG3hhpNh9KGl6ayJ38p7ED6wxQLd1TV91xHpcTvw90KMJ9EwN3F/iNflHBVg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "html-tags": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/is-interactive": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",+ "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/is-lambda": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",+ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/is-my-ip-valid": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.1.tgz",+ "integrity": "sha512-jxc8cBcOWbNK2i2aTkCZP6i7wkHF1bqKFrwEHuN5Jtg5BSaZHUZQ/JTOJwoV41YvHnOaRyWWh72T/KvfNz9DJg==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/is-my-json-valid": {+ "version": "2.20.6",+ "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.20.6.tgz",+ "integrity": "sha512-1JQwulVNjx8UqkPE/bqDaxtH4PXCe/2VRh/y3p99heOV87HG4Id5/VfDswd+YiAfHcRTfDlWgISycnHuhZq1aw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "generate-function": "^2.0.0",+ "generate-object-property": "^1.1.0",+ "is-my-ip-valid": "^1.0.0",+ "jsonpointer": "^5.0.0",+ "xtend": "^4.0.0"+ }+ },+ "node_modules/is-number": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.12.0"+ }+ },+ "node_modules/is-property": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",+ "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/is-stream": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",+ "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-unicode-supported": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",+ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-what": {+ "version": "4.1.16",+ "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz",+ "integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12.13"+ },+ "funding": {+ "url": "https://github.com/sponsors/mesqueeb"+ }+ },+ "node_modules/isbinaryfile": {+ "version": "4.0.10",+ "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz",+ "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 8.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/gjtorikian/"+ }+ },+ "node_modules/isexe": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/jest-worker": {+ "version": "27.5.1",+ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz",+ "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/node": "*",+ "merge-stream": "^2.0.0",+ "supports-color": "^8.0.0"+ },+ "engines": {+ "node": ">= 10.13.0"+ }+ },+ "node_modules/jest-worker/node_modules/supports-color": {+ "version": "8.1.1",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "has-flag": "^4.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/supports-color?sponsor=1"+ }+ },+ "node_modules/jiti": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",+ "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",+ "license": "MIT",+ "bin": {+ "jiti": "lib/jiti-cli.mjs"+ }+ },+ "node_modules/js-tokens": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",+ "license": "MIT"+ },+ "node_modules/js-yaml": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",+ "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/puzrin"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/nodeca"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "argparse": "^2.0.1"+ },+ "bin": {+ "js-yaml": "bin/js-yaml.js"+ }+ },+ "node_modules/jsesc": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",+ "license": "MIT",+ "bin": {+ "jsesc": "bin/jsesc"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/json-buffer": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/json-schema-traverse": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/json-stable-stringify-without-jsonify": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/json-stringify-safe": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",+ "dev": true,+ "license": "ISC",+ "optional": true+ },+ "node_modules/json5": {+ "version": "2.2.3",+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",+ "license": "MIT",+ "bin": {+ "json5": "lib/cli.js"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/jsonfile": {+ "version": "6.2.1",+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",+ "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "universalify": "^2.0.0"+ },+ "optionalDependencies": {+ "graceful-fs": "^4.1.6"+ }+ },+ "node_modules/jsonpointer": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz",+ "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/junk": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz",+ "integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/kebab-case": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/kebab-case/-/kebab-case-1.0.2.tgz",+ "integrity": "sha512-7n6wXq4gNgBELfDCpzKc+mRrZFs7D+wgfF5WRFLNAr4DA/qtr9Js8uOAVAfHhuLMfAcQ0pRKqbpjx+TcJVdE1Q==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/keyv": {+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "json-buffer": "3.0.1"+ }+ },+ "node_modules/known-css-properties": {+ "version": "0.30.0",+ "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.30.0.tgz",+ "integrity": "sha512-VSWXYUnsPu9+WYKkfmJyLKtIvaRJi1kXUqVmBACORXZQxT5oZDsoZ2vQP+bQFDnWtpI/4eq3MLoRMjI2fnLzTQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/levn": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "prelude-ls": "^1.2.1",+ "type-check": "~0.4.0"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/lightningcss": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",+ "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",+ "license": "MPL-2.0",+ "dependencies": {+ "detect-libc": "^2.0.3"+ },+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ },+ "optionalDependencies": {+ "lightningcss-android-arm64": "1.32.0",+ "lightningcss-darwin-arm64": "1.32.0",+ "lightningcss-darwin-x64": "1.32.0",+ "lightningcss-freebsd-x64": "1.32.0",+ "lightningcss-linux-arm-gnueabihf": "1.32.0",+ "lightningcss-linux-arm64-gnu": "1.32.0",+ "lightningcss-linux-arm64-musl": "1.32.0",+ "lightningcss-linux-x64-gnu": "1.32.0",+ "lightningcss-linux-x64-musl": "1.32.0",+ "lightningcss-win32-arm64-msvc": "1.32.0",+ "lightningcss-win32-x64-msvc": "1.32.0"+ }+ },+ "node_modules/lightningcss-android-arm64": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz",+ "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==",+ "cpu": [+ "arm64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-darwin-arm64": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz",+ "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==",+ "cpu": [+ "arm64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-darwin-x64": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz",+ "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==",+ "cpu": [+ "x64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-freebsd-x64": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz",+ "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==",+ "cpu": [+ "x64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-arm-gnueabihf": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz",+ "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==",+ "cpu": [+ "arm"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-arm64-gnu": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz",+ "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==",+ "cpu": [+ "arm64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-arm64-musl": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz",+ "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==",+ "cpu": [+ "arm64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-x64-gnu": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz",+ "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==",+ "cpu": [+ "x64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-linux-x64-musl": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz",+ "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==",+ "cpu": [+ "x64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-win32-arm64-msvc": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz",+ "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==",+ "cpu": [+ "arm64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/lightningcss-win32-x64-msvc": {+ "version": "1.32.0",+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz",+ "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==",+ "cpu": [+ "x64"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/listr2": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/listr2/-/listr2-7.0.2.tgz",+ "integrity": "sha512-rJysbR9GKIalhTbVL2tYbF2hVyDnrf7pFUZBwjPaMIdadYHmeT+EVi/Bu3qd7ETQPahTotg2WRCatXwRBW554g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "cli-truncate": "^3.1.0",+ "colorette": "^2.0.20",+ "eventemitter3": "^5.0.1",+ "log-update": "^5.0.1",+ "rfdc": "^1.3.0",+ "wrap-ansi": "^8.1.0"+ },+ "engines": {+ "node": ">=16.0.0"+ }+ },+ "node_modules/listr2/node_modules/ansi-regex": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"+ }+ },+ "node_modules/listr2/node_modules/ansi-styles": {+ "version": "6.2.3",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/listr2/node_modules/strip-ansi": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^6.2.2"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"+ }+ },+ "node_modules/listr2/node_modules/wrap-ansi": {+ "version": "8.1.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",+ "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^6.1.0",+ "string-width": "^5.0.1",+ "strip-ansi": "^7.0.1"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },+ "node_modules/load-json-file": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",+ "integrity": "sha512-3p6ZOGNbiX4CdvEd1VcE6yi78UrGNpjHO33noGwHCnT/o2fyllJDepsm8+mFFv/DvtwFHht5HIHSyOy5a+ChVQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.1.2",+ "parse-json": "^2.2.0",+ "pify": "^2.0.0",+ "strip-bom": "^3.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/loader-runner": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.2.tgz",+ "integrity": "sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.11.5"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/webpack"+ }+ },+ "node_modules/locate-path": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-locate": "^5.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/lodash": {+ "version": "4.18.1",+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",+ "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/lodash.get": {+ "version": "4.4.2",+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",+ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",+ "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/lodash.merge": {+ "version": "4.6.2",+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/log-symbols": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",+ "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "chalk": "^4.1.0",+ "is-unicode-supported": "^0.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/log-update": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz",+ "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-escapes": "^5.0.0",+ "cli-cursor": "^4.0.0",+ "slice-ansi": "^5.0.0",+ "strip-ansi": "^7.0.1",+ "wrap-ansi": "^8.0.1"+ },+ "engines": {+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/log-update/node_modules/ansi-escapes": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz",+ "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "type-fest": "^1.0.2"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/log-update/node_modules/ansi-regex": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"+ }+ },+ "node_modules/log-update/node_modules/ansi-styles": {+ "version": "6.2.3",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/log-update/node_modules/strip-ansi": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^6.2.2"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"+ }+ },+ "node_modules/log-update/node_modules/type-fest": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",+ "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==",+ "dev": true,+ "license": "(MIT OR CC0-1.0)",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/log-update/node_modules/wrap-ansi": {+ "version": "8.1.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",+ "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^6.1.0",+ "string-width": "^5.0.1",+ "strip-ansi": "^7.0.1"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },+ "node_modules/lowercase-keys": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",+ "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/lru-cache": {+ "version": "7.18.3",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/macos-alias": {+ "version": "0.2.12",+ "resolved": "https://registry.npmjs.org/macos-alias/-/macos-alias-0.2.12.tgz",+ "integrity": "sha512-yiLHa7cfJcGRFq4FrR4tMlpNHb4Vy4mWnpajlSSIFM5k4Lv8/7BbbDLzCAVogWNl0LlLhizRp1drXv0hK9h0Yw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "dependencies": {+ "nan": "^2.4.0"+ }+ },+ "node_modules/magic-string": {+ "version": "0.30.21",+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.5.5"+ }+ },+ "node_modules/make-fetch-happen": {+ "version": "10.2.1",+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz",+ "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "agentkeepalive": "^4.2.1",+ "cacache": "^16.1.0",+ "http-cache-semantics": "^4.1.0",+ "http-proxy-agent": "^5.0.0",+ "https-proxy-agent": "^5.0.0",+ "is-lambda": "^1.0.1",+ "lru-cache": "^7.7.1",+ "minipass": "^3.1.6",+ "minipass-collect": "^1.0.2",+ "minipass-fetch": "^2.0.3",+ "minipass-flush": "^1.0.5",+ "minipass-pipeline": "^1.2.4",+ "negotiator": "^0.6.3",+ "promise-retry": "^2.0.1",+ "socks-proxy-agent": "^7.0.0",+ "ssri": "^9.0.0"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/map-age-cleaner": {+ "version": "0.1.3",+ "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",+ "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-defer": "^1.0.0"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/matcher": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",+ "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "escape-string-regexp": "^4.0.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/mdn-data": {+ "version": "2.0.30",+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",+ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==",+ "license": "CC0-1.0"+ },+ "node_modules/mediabunny": {+ "version": "1.50.6",+ "resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.50.6.tgz",+ "integrity": "sha512-ktHEuGFZ1lqXx16CQiViawxg8Kn2cBcpudjjko7dMuDHMT8W/UrQ0ojhfrXL69/nUrbVFGMwmu58pFz9d0MyOQ==",+ "license": "MPL-2.0",+ "workspaces": [+ ".",+ "packages/*"+ ],+ "dependencies": {+ "@types/dom-mediacapture-transform": "^0.1.11",+ "@types/dom-webcodecs": "0.1.13"+ },+ "funding": {+ "type": "individual",+ "url": "https://github.com/sponsors/Vanilagy"+ }+ },+ "node_modules/mem": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",+ "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "map-age-cleaner": "^0.1.1",+ "mimic-fn": "^2.0.0",+ "p-is-promise": "^2.0.0"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/merge-anything": {+ "version": "5.1.7",+ "resolved": "https://registry.npmjs.org/merge-anything/-/merge-anything-5.1.7.tgz",+ "integrity": "sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-what": "^4.1.8"+ },+ "engines": {+ "node": ">=12.13"+ },+ "funding": {+ "url": "https://github.com/sponsors/mesqueeb"+ }+ },+ "node_modules/merge-stream": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/merge2": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/micromatch": {+ "version": "4.0.8",+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "braces": "^3.0.3",+ "picomatch": "^2.3.1"+ },+ "engines": {+ "node": ">=8.6"+ }+ },+ "node_modules/mime-db": {+ "version": "1.54.0",+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",+ "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mimic-fn": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/mimic-response": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",+ "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/minimatch": {+ "version": "3.1.5",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^1.1.7"+ },+ "engines": {+ "node": "*"+ }+ },+ "node_modules/minimist": {+ "version": "1.2.8",+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",+ "dev": true,+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/minimizer-webpack-plugin": {+ "version": "5.6.1",+ "resolved": "https://registry.npmjs.org/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.6.1.tgz",+ "integrity": "sha512-DoeAZz8Q1C1znwsUzej1fdoi4jCf7/+Em27ouLqfK/+3m8G+D7yDhUwrc3CNhjSzGUN1kn7Iv4sWmjflQHenpw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/trace-mapping": "^0.3.25",+ "jest-worker": "^27.4.5",+ "schema-utils": "^4.3.0",+ "terser": "^5.31.1"+ },+ "engines": {+ "node": ">= 10.13.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/webpack"+ },+ "peerDependencies": {+ "webpack": "^5.1.0"+ },+ "peerDependenciesMeta": {+ "@minify-html/node": {+ "optional": true+ },+ "@swc/core": {+ "optional": true+ },+ "@swc/css": {+ "optional": true+ },+ "@swc/html": {+ "optional": true+ },+ "clean-css": {+ "optional": true+ },+ "cssnano": {+ "optional": true+ },+ "csso": {+ "optional": true+ },+ "esbuild": {+ "optional": true+ },+ "html-minifier-terser": {+ "optional": true+ },+ "lightningcss": {+ "optional": true+ },+ "postcss": {+ "optional": true+ },+ "uglify-js": {+ "optional": true+ }+ }+ },+ "node_modules/minipass": {+ "version": "3.3.6",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minipass-collect": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz",+ "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/minipass-fetch": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz",+ "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "minipass": "^3.1.6",+ "minipass-sized": "^1.0.3",+ "minizlib": "^2.1.2"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ },+ "optionalDependencies": {+ "encoding": "^0.1.13"+ }+ },+ "node_modules/minipass-flush": {+ "version": "1.0.7",+ "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.7.tgz",+ "integrity": "sha512-TbqTz9cUwWyHS2Dy89P3ocAGUGxKjjLuR9z8w4WUTGAVgEj17/4nhgo2Du56i0Fm3Pm30g4iA8Lcqctc76jCzA==",+ "dev": true,+ "license": "BlueOak-1.0.0",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/minipass-pipeline": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz",+ "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minipass-sized": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz",+ "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minizlib": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "minipass": "^3.0.0",+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/mkdirp": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "mkdirp": "bin/cmd.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/murmur-32": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/murmur-32/-/murmur-32-0.2.0.tgz",+ "integrity": "sha512-ZkcWZudylwF+ir3Ld1n7gL6bI2mQAzXvSobPwVtu8aYi2sbXeipeSkdcanRLzIofLcM5F53lGaKm2dk7orBi7Q==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "encode-utf8": "^1.0.3",+ "fmix": "^0.1.0",+ "imul": "^1.0.0"+ }+ },+ "node_modules/mute-stream": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz",+ "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },+ "node_modules/nan": {+ "version": "2.28.0",+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.28.0.tgz",+ "integrity": "sha512-fTsDz99OTq2sVePhGdp4qQhggZFtKr64ZNVyVajRKtMOkJxYekplBh577PiJB12v/D3s2E5cGtOI45LWp6rnLQ==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/nanoid": {+ "version": "3.3.15",+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz",+ "integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.cjs"+ },+ "engines": {+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"+ }+ },+ "node_modules/natural-compare": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",+ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/negotiator": {+ "version": "0.6.4",+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz",+ "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/neo-async": {+ "version": "2.6.2",+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/nice-try": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/node-abi": {+ "version": "3.94.0",+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.94.0.tgz",+ "integrity": "sha512-W5ZNO5KRPB5TkYmGVD9F6YqhsglXJzE6etpbmT+f6EQElhiX/UTG551cnsRGvLG3fyZEg9HwaDmNmj5nwJ4z9g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "semver": "^7.3.5"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/node-api-version": {+ "version": "0.2.1",+ "resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.2.1.tgz",+ "integrity": "sha512-2xP/IGGMmmSQpI1+O/k72jF/ykvZ89JeuKX3TLJAYPDVLUalrshrLHkeVcCCZqG/eEa635cr8IBYzgnDvM2O8Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "semver": "^7.3.5"+ }+ },+ "node_modules/node-fetch": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },+ "node_modules/node-releases": {+ "version": "2.0.50",+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.50.tgz",+ "integrity": "sha512-J6l92tKHX6w8Jy5nO1Vuc01NoIiRGi/d6qBKVxh+IQ8Cr3b6HbVNfKiF8ZpFKufTwpwxMmce2W3iQZ861ZRyTg==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/nopt": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz",+ "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "abbrev": "^1.0.0"+ },+ "bin": {+ "nopt": "bin/nopt.js"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/normalize-package-data": {+ "version": "2.5.0",+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",+ "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "hosted-git-info": "^2.1.4",+ "resolve": "^1.10.0",+ "semver": "2 || 3 || 4 || 5",+ "validate-npm-package-license": "^3.0.1"+ }+ },+ "node_modules/normalize-package-data/node_modules/semver": {+ "version": "5.7.2",+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",+ "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver"+ }+ },+ "node_modules/normalize-url": {+ "version": "6.1.0",+ "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz",+ "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/npm-run-path": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",+ "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "path-key": "^2.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/npm-run-path/node_modules/path-key": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",+ "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/nth-check": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",+ "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",+ "license": "BSD-2-Clause",+ "dependencies": {+ "boolbase": "^1.0.0"+ },+ "funding": {+ "url": "https://github.com/fb55/nth-check?sponsor=1"+ }+ },+ "node_modules/object-keys": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/once": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "wrappy": "1"+ }+ },+ "node_modules/onetime": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",+ "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "mimic-fn": "^2.1.0"+ },+ "engines": {+ "node": ">=6"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/optionator": {+ "version": "0.9.4",+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "deep-is": "^0.1.3",+ "fast-levenshtein": "^2.0.6",+ "levn": "^0.4.1",+ "prelude-ls": "^1.2.1",+ "type-check": "^0.4.0",+ "word-wrap": "^1.2.5"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/ora": {+ "version": "5.4.1",+ "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz",+ "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "bl": "^4.1.0",+ "chalk": "^4.1.0",+ "cli-cursor": "^3.1.0",+ "cli-spinners": "^2.5.0",+ "is-interactive": "^1.0.0",+ "is-unicode-supported": "^0.1.0",+ "log-symbols": "^4.1.0",+ "strip-ansi": "^6.0.0",+ "wcwidth": "^1.0.1"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/ora/node_modules/cli-cursor": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",+ "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "restore-cursor": "^3.1.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/ora/node_modules/restore-cursor": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",+ "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "onetime": "^5.1.0",+ "signal-exit": "^3.0.2"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/ora/node_modules/signal-exit": {+ "version": "3.0.7",+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/os-tmpdir": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",+ "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/p-cancelable": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz",+ "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/p-defer": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz",+ "integrity": "sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/p-finally": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",+ "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/p-is-promise": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz",+ "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/p-limit": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "yocto-queue": "^0.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-locate": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-limit": "^3.0.2"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-map": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",+ "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "aggregate-error": "^3.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-try": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",+ "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/parent-module": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "callsites": "^3.0.0"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/parse-author": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/parse-author/-/parse-author-2.0.0.tgz",+ "integrity": "sha512-yx5DfvkN8JsHL2xk2Os9oTia467qnvRgey4ahSm2X8epehBLx/gWLcy5KI+Y36ful5DzGbCS6RazqZGgy1gHNw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "author-regex": "^1.0.0"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/parse-color": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/parse-color/-/parse-color-1.0.0.tgz",+ "integrity": "sha512-fuDHYgFHJGbpGMgw9skY/bj3HL/Jrn4l/5rSspy00DoT4RyLnDcRvPxdZ+r6OFwIsgAuhDh4I09tAId4mI12bw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "color-convert": "~0.5.0"+ }+ },+ "node_modules/parse-color/node_modules/color-convert": {+ "version": "0.5.3",+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-0.5.3.tgz",+ "integrity": "sha512-RwBeO/B/vZR3dfKL1ye/vx8MHZ40ugzpyfeVG5GsiuGnrlMWe2o8wxBbLCpw9CsxV+wHuzYlCiWnybrIA0ling==",+ "dev": true,+ "optional": true+ },+ "node_modules/parse-json": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",+ "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "error-ex": "^1.2.0"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/parse5": {+ "version": "7.3.0",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",+ "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",+ "license": "MIT",+ "dependencies": {+ "entities": "^6.0.0"+ },+ "funding": {+ "url": "https://github.com/inikulin/parse5?sponsor=1"+ }+ },+ "node_modules/path-exists": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/path-is-absolute": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",+ "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/path-key": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/path-parse": {+ "version": "1.0.7",+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/path-type": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",+ "integrity": "sha512-dUnb5dXUf+kzhC/W/F4e5/SkluXIFf5VUHolW1Eg1irn1hGWjPGdsRcvYJ1nD6lhk8Ir7VM0bHJKsYTx8Jx9OQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "pify": "^2.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/pe-library": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/pe-library/-/pe-library-1.0.1.tgz",+ "integrity": "sha512-nh39Mo1eGWmZS7y+mK/dQIqg7S1lp38DpRxkyoHf0ZcUs/HDc+yyTjuOtTvSMZHmfSLuSQaX945u05Y2Q6UWZg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14",+ "npm": ">=7"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/jet2jet"+ }+ },+ "node_modules/pend": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",+ "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/picocolors": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "license": "ISC"+ },+ "node_modules/picomatch": {+ "version": "2.3.2",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/pify": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",+ "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/plist": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.1.tgz",+ "integrity": "sha512-ZIfcLJC+7E7FBFnDxm9MPmt7D+DidyQ26lewieO75AdhA2ayMtsJSES0iWzqJQbcVRSrTufQoy0DR94xHue0oA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@xmldom/xmldom": "^0.9.10",+ "base64-js": "^1.5.1",+ "xmlbuilder": "^15.1.1"+ },+ "engines": {+ "node": ">=10.4.0"+ }+ },+ "node_modules/postcss": {+ "version": "8.5.16",+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz",+ "integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.12",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.1"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/postject": {+ "version": "1.0.0-alpha.6",+ "resolved": "https://registry.npmjs.org/postject/-/postject-1.0.0-alpha.6.tgz",+ "integrity": "sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "commander": "^9.4.0"+ },+ "bin": {+ "postject": "dist/cli.js"+ },+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/postject/node_modules/commander": {+ "version": "9.5.0",+ "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",+ "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^12.20.0 || >=14"+ }+ },+ "node_modules/prelude-ls": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/prettier": {+ "version": "3.9.4",+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.4.tgz",+ "integrity": "sha512-yWG/o/4oJfo036EKAfK6ACAoDOfHeRHx4tuxkfBZiauURiaSmYwlpOr5LQqKtIkRD2z1PLteme2WoxEnj4tHTg==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "prettier": "bin/prettier.cjs"+ },+ "engines": {+ "node": ">=14"+ },+ "funding": {+ "url": "https://github.com/prettier/prettier?sponsor=1"+ }+ },+ "node_modules/proc-log": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-2.0.1.tgz",+ "integrity": "sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/progress": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.4.0"+ }+ },+ "node_modules/promise-inflight": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",+ "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/promise-retry": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",+ "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "err-code": "^2.0.2",+ "retry": "^0.12.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/pump": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",+ "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "end-of-stream": "^1.1.0",+ "once": "^1.3.1"+ }+ },+ "node_modules/punycode": {+ "version": "2.3.1",+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/queue-microtask": {+ "version": "1.2.3",+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/quick-lru": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",+ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/random-path": {+ "version": "0.1.2",+ "resolved": "https://registry.npmjs.org/random-path/-/random-path-0.1.2.tgz",+ "integrity": "sha512-4jY0yoEaQ5v9StCl5kZbNIQlg1QheIDBrdkDn53EynpPb9FgO6//p3X/tgMnrC45XN6QZCzU1Xz/+pSSsJBpRw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "base32-encode": "^0.1.0 || ^1.0.0",+ "murmur-32": "^0.1.0 || ^0.2.0"+ }+ },+ "node_modules/read-binary-file-arch": {+ "version": "1.0.6",+ "resolved": "https://registry.npmjs.org/read-binary-file-arch/-/read-binary-file-arch-1.0.6.tgz",+ "integrity": "sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "debug": "^4.3.4"+ },+ "bin": {+ "read-binary-file-arch": "cli.js"+ }+ },+ "node_modules/read-pkg": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",+ "integrity": "sha512-eFIBOPW7FGjzBuk3hdXEuNSiTZS/xEMlH49HxMyzb0hyPfu4EhVjT2DH32K1hSSmVq4sebAWnZuuY5auISUTGA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "load-json-file": "^2.0.0",+ "normalize-package-data": "^2.3.2",+ "path-type": "^2.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/read-pkg-up": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",+ "integrity": "sha512-1orxQfbWGUiTn9XsPlChs6rLie/AV9jwZTGmu2NZw/CUDJQchXJFYE0Fq5j7+n558T1JhDWLdhyd1Zj+wLY//w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "find-up": "^2.0.0",+ "read-pkg": "^2.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/read-pkg-up/node_modules/find-up": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",+ "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "locate-path": "^2.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/read-pkg-up/node_modules/locate-path": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",+ "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-locate": "^2.0.0",+ "path-exists": "^3.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/read-pkg-up/node_modules/p-limit": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",+ "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-try": "^1.0.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/read-pkg-up/node_modules/p-locate": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",+ "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "p-limit": "^1.1.0"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/read-pkg-up/node_modules/path-exists": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",+ "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/readable-stream": {+ "version": "3.6.2",+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "inherits": "^2.0.3",+ "string_decoder": "^1.1.1",+ "util-deprecate": "^1.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/rechoir": {+ "version": "0.8.0",+ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",+ "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "resolve": "^1.20.0"+ },+ "engines": {+ "node": ">= 10.13.0"+ }+ },+ "node_modules/repeat-string": {+ "version": "1.6.1",+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",+ "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=0.10"+ }+ },+ "node_modules/require-directory": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/require-from-string": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/resedit": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/resedit/-/resedit-2.0.3.tgz",+ "integrity": "sha512-oTeemxwoMuxxTYxXUwjkrOPfngTQehlv0/HoYFNkB4uzsP1Un1A9nI8JQKGOFkxpqkC7qkMs0lUsGrvUlbLNUA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "pe-library": "^1.0.1"+ },+ "engines": {+ "node": ">=14",+ "npm": ">=7"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/jet2jet"+ }+ },+ "node_modules/resolve": {+ "version": "1.22.12",+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz",+ "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "is-core-module": "^2.16.1",+ "path-parse": "^1.0.7",+ "supports-preserve-symlinks-flag": "^1.0.0"+ },+ "bin": {+ "resolve": "bin/resolve"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/resolve-alpn": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz",+ "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/resolve-from": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/responselike": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz",+ "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "lowercase-keys": "^2.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/restore-cursor": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz",+ "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "onetime": "^5.1.0",+ "signal-exit": "^3.0.2"+ },+ "engines": {+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/restore-cursor/node_modules/signal-exit": {+ "version": "3.0.7",+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/retry": {+ "version": "0.12.0",+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",+ "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 4"+ }+ },+ "node_modules/reusify": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",+ "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "iojs": ">=1.0.0",+ "node": ">=0.10.0"+ }+ },+ "node_modules/rfdc": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",+ "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/rimraf": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",+ "deprecated": "Rimraf versions prior to v4 are no longer supported",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "glob": "^7.1.3"+ },+ "bin": {+ "rimraf": "bin.js"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/roarr": {+ "version": "2.15.4",+ "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",+ "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",+ "dev": true,+ "license": "BSD-3-Clause",+ "optional": true,+ "dependencies": {+ "boolean": "^3.0.1",+ "detect-node": "^2.0.4",+ "globalthis": "^1.0.1",+ "json-stringify-safe": "^5.0.1",+ "semver-compare": "^1.0.0",+ "sprintf-js": "^1.1.2"+ },+ "engines": {+ "node": ">=8.0"+ }+ },+ "node_modules/rollup": {+ "version": "4.62.2",+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz",+ "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==",+ "license": "MIT",+ "dependencies": {+ "@types/estree": "1.0.9"+ },+ "bin": {+ "rollup": "dist/bin/rollup"+ },+ "engines": {+ "node": ">=18.0.0",+ "npm": ">=8.0.0"+ },+ "optionalDependencies": {+ "@rollup/rollup-android-arm-eabi": "4.62.2",+ "@rollup/rollup-android-arm64": "4.62.2",+ "@rollup/rollup-darwin-arm64": "4.62.2",+ "@rollup/rollup-darwin-x64": "4.62.2",+ "@rollup/rollup-freebsd-arm64": "4.62.2",+ "@rollup/rollup-freebsd-x64": "4.62.2",+ "@rollup/rollup-linux-arm-gnueabihf": "4.62.2",+ "@rollup/rollup-linux-arm-musleabihf": "4.62.2",+ "@rollup/rollup-linux-arm64-gnu": "4.62.2",+ "@rollup/rollup-linux-arm64-musl": "4.62.2",+ "@rollup/rollup-linux-loong64-gnu": "4.62.2",+ "@rollup/rollup-linux-loong64-musl": "4.62.2",+ "@rollup/rollup-linux-ppc64-gnu": "4.62.2",+ "@rollup/rollup-linux-ppc64-musl": "4.62.2",+ "@rollup/rollup-linux-riscv64-gnu": "4.62.2",+ "@rollup/rollup-linux-riscv64-musl": "4.62.2",+ "@rollup/rollup-linux-s390x-gnu": "4.62.2",+ "@rollup/rollup-linux-x64-gnu": "4.62.2",+ "@rollup/rollup-linux-x64-musl": "4.62.2",+ "@rollup/rollup-openbsd-x64": "4.62.2",+ "@rollup/rollup-openharmony-arm64": "4.62.2",+ "@rollup/rollup-win32-arm64-msvc": "4.62.2",+ "@rollup/rollup-win32-ia32-msvc": "4.62.2",+ "@rollup/rollup-win32-x64-gnu": "4.62.2",+ "@rollup/rollup-win32-x64-msvc": "4.62.2",+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/run-parallel": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "queue-microtask": "^1.2.2"+ }+ },+ "node_modules/safe-buffer": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/safer-buffer": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/sax": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",+ "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==",+ "license": "BlueOak-1.0.0",+ "engines": {+ "node": ">=11.0.0"+ }+ },+ "node_modules/schema-utils": {+ "version": "4.3.3",+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz",+ "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/json-schema": "^7.0.9",+ "ajv": "^8.9.0",+ "ajv-formats": "^2.1.1",+ "ajv-keywords": "^5.1.0"+ },+ "engines": {+ "node": ">= 10.13.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/webpack"+ }+ },+ "node_modules/schema-utils/node_modules/ajv": {+ "version": "8.20.0",+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",+ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.3",+ "fast-uri": "^3.0.1",+ "json-schema-traverse": "^1.0.0",+ "require-from-string": "^2.0.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/epoberezkin"+ }+ },+ "node_modules/schema-utils/node_modules/ajv-keywords": {+ "version": "5.1.0",+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz",+ "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.3"+ },+ "peerDependencies": {+ "ajv": "^8.8.2"+ }+ },+ "node_modules/schema-utils/node_modules/json-schema-traverse": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/semver": {+ "version": "7.8.5",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",+ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",+ "dev": true,+ "license": "ISC",+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/semver-compare": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",+ "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/serialize-error": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz",+ "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "type-fest": "^0.13.1"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/serialize-error/node_modules/type-fest": {+ "version": "0.13.1",+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",+ "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",+ "dev": true,+ "license": "(MIT OR CC0-1.0)",+ "optional": true,+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/seroval": {+ "version": "1.5.4",+ "resolved": "https://registry.npmjs.org/seroval/-/seroval-1.5.4.tgz",+ "integrity": "sha512-46uFvgrXTVxZcUorgSSRZ4y+ieqLLQRMlG4bnCZKW3qI6BZm7Rg4ntMW4p1mILEEBZWrFlcpp0AyIIlM6jD9iw==",+ "license": "MIT",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/seroval-plugins": {+ "version": "1.5.4",+ "resolved": "https://registry.npmjs.org/seroval-plugins/-/seroval-plugins-1.5.4.tgz",+ "integrity": "sha512-S0xQPhUTefAhNvNWFg0c1J8qJArHt5KdtJ/cFAofo06KD1MVSeFWyl4iiu+ApDIuw0WhjpOfCdgConOfAnLgkw==",+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "peerDependencies": {+ "seroval": "^1.0"+ }+ },+ "node_modules/shebang-command": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "shebang-regex": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/shebang-regex": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/signal-exit": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",+ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=14"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/slice-ansi": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz",+ "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^6.0.0",+ "is-fullwidth-code-point": "^4.0.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/slice-ansi?sponsor=1"+ }+ },+ "node_modules/slice-ansi/node_modules/ansi-styles": {+ "version": "6.2.3",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/smart-buffer": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",+ "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 6.0.0",+ "npm": ">= 3.0.0"+ }+ },+ "node_modules/socks": {+ "version": "2.8.9",+ "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.9.tgz",+ "integrity": "sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ip-address": "^10.1.1",+ "smart-buffer": "^4.2.0"+ },+ "engines": {+ "node": ">= 10.0.0",+ "npm": ">= 3.0.0"+ }+ },+ "node_modules/socks-proxy-agent": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz",+ "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "agent-base": "^6.0.2",+ "debug": "^4.3.3",+ "socks": "^2.6.2"+ },+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/solid-js": {+ "version": "1.9.14",+ "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.9.14.tgz",+ "integrity": "sha512-sAEXC0Kk0S1EDg+8ysEWJDbYhA3RRoEjwuySUGlKIemeo0I5YZfOyumNjNs9Sv3y2nmhD+0rW66ag2HsMuQiGQ==",+ "license": "MIT",+ "dependencies": {+ "csstype": "^3.1.0",+ "seroval": "~1.5.4",+ "seroval-plugins": "~1.5.4"+ }+ },+ "node_modules/solid-presence": {+ "version": "0.1.8",+ "resolved": "https://registry.npmjs.org/solid-presence/-/solid-presence-0.1.8.tgz",+ "integrity": "sha512-pWGtXUFWYYUZNbg5YpG5vkQJyOtzn2KXhxYaMx/4I+lylTLYkITOLevaCwMRN+liCVk0pqB6EayLWojNqBFECA==",+ "license": "MIT",+ "dependencies": {+ "@corvu/utils": "~0.4.0"+ },+ "peerDependencies": {+ "solid-js": "^1.8"+ }+ },+ "node_modules/solid-prevent-scroll": {+ "version": "0.1.10",+ "resolved": "https://registry.npmjs.org/solid-prevent-scroll/-/solid-prevent-scroll-0.1.10.tgz",+ "integrity": "sha512-KplGPX2GHiWJLZ6AXYRql4M127PdYzfwvLJJXMkO+CMb8Np4VxqDAg5S8jLdwlEuBis/ia9DKw2M8dFx5u8Mhw==",+ "license": "MIT",+ "dependencies": {+ "@corvu/utils": "~0.4.1"+ },+ "peerDependencies": {+ "solid-js": "^1.8"+ }+ },+ "node_modules/solid-refresh": {+ "version": "0.6.3",+ "resolved": "https://registry.npmjs.org/solid-refresh/-/solid-refresh-0.6.3.tgz",+ "integrity": "sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/generator": "^7.23.6",+ "@babel/helper-module-imports": "^7.22.15",+ "@babel/types": "^7.23.6"+ },+ "peerDependencies": {+ "solid-js": "^1.3"+ }+ },+ "node_modules/somoto": {+ "version": "0.0.2",+ "resolved": "https://registry.npmjs.org/somoto/-/somoto-0.0.2.tgz",+ "integrity": "sha512-2e7V2O16D+DkE3z0kBdA4AnVYOi4yLLwIrKe3SE1kRAicwALrw+kx57/SRqSbEXaIsZrIPhGfL7VcRQE+tI0Bg==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "solid-js": ">=1.6.0"+ }+ },+ "node_modules/source-map": {+ "version": "0.6.1",+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",+ "devOptional": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/source-map-js": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/source-map-support": {+ "version": "0.5.21",+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",+ "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",+ "devOptional": true,+ "license": "MIT",+ "dependencies": {+ "buffer-from": "^1.0.0",+ "source-map": "^0.6.0"+ }+ },+ "node_modules/spdx-correct": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz",+ "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "spdx-expression-parse": "^3.0.0",+ "spdx-license-ids": "^3.0.0"+ }+ },+ "node_modules/spdx-exceptions": {+ "version": "2.5.0",+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz",+ "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==",+ "dev": true,+ "license": "CC-BY-3.0"+ },+ "node_modules/spdx-expression-parse": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",+ "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "spdx-exceptions": "^2.1.0",+ "spdx-license-ids": "^3.0.0"+ }+ },+ "node_modules/spdx-license-ids": {+ "version": "3.0.23",+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz",+ "integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==",+ "dev": true,+ "license": "CC0-1.0"+ },+ "node_modules/sprintf-js": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",+ "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",+ "dev": true,+ "license": "BSD-3-Clause",+ "optional": true+ },+ "node_modules/sqids": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/sqids/-/sqids-0.3.0.tgz",+ "integrity": "sha512-lOQK1ucVg+W6n3FhRwwSeUijxe93b51Bfz5PMRMihVf1iVkl82ePQG7V5vwrhzB11v0NtsR25PSZRGiSomJaJw==",+ "license": "MIT"+ },+ "node_modules/ssri": {+ "version": "9.0.1",+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz",+ "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.1.1"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/stats.js": {+ "version": "0.17.0",+ "resolved": "https://registry.npmjs.org/stats.js/-/stats.js-0.17.0.tgz",+ "integrity": "sha512-hNKz8phvYLPEcRkeG1rsGmV5ChMjKDAWU7/OJJdDErPBNChQXxCo3WZurGpnWc6gZhAzEPFad1aVgyOANH1sMw==",+ "license": "MIT"+ },+ "node_modules/stream-buffers": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-2.2.0.tgz",+ "integrity": "sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==",+ "dev": true,+ "license": "Unlicense",+ "optional": true,+ "engines": {+ "node": ">= 0.10.0"+ }+ },+ "node_modules/string_decoder": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "~5.2.0"+ }+ },+ "node_modules/string-width": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",+ "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "eastasianwidth": "^0.2.0",+ "emoji-regex": "^9.2.2",+ "strip-ansi": "^7.0.1"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/string-width/node_modules/ansi-regex": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"+ }+ },+ "node_modules/string-width/node_modules/strip-ansi": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^6.2.2"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"+ }+ },+ "node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/strip-bom": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",+ "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/strip-eof": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",+ "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/strip-json-comments": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/strip-outer": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz",+ "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "escape-string-regexp": "^1.0.2"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/strip-outer/node_modules/escape-string-regexp": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.8.0"+ }+ },+ "node_modules/style-to-object": {+ "version": "1.0.14",+ "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz",+ "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "inline-style-parser": "0.2.7"+ }+ },+ "node_modules/sumchecker": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz",+ "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "debug": "^4.1.0"+ },+ "engines": {+ "node": ">= 8.0"+ }+ },+ "node_modules/supports-color": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "has-flag": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/supports-preserve-symlinks-flag": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/svgo": {+ "version": "3.3.3",+ "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.3.tgz",+ "integrity": "sha512-+wn7I4p7YgJhHs38k2TNjy1vCfPIfLIJWR5MnCStsN8WuuTcBnRKcMHQLMM2ijxGZmDoZwNv8ipl5aTTen62ng==",+ "license": "MIT",+ "dependencies": {+ "commander": "^7.2.0",+ "css-select": "^5.1.0",+ "css-tree": "^2.3.1",+ "css-what": "^6.1.0",+ "csso": "^5.0.5",+ "picocolors": "^1.0.0",+ "sax": "^1.5.0"+ },+ "bin": {+ "svgo": "bin/svgo"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/svgo"+ }+ },+ "node_modules/svgo/node_modules/commander": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",+ "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",+ "license": "MIT",+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/tailwind-merge": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.6.0.tgz",+ "integrity": "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/dcastil"+ }+ },+ "node_modules/tailwindcss": {+ "version": "4.3.2",+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.2.tgz",+ "integrity": "sha512-WtctNNSH8A9jlMIqxzuYumOHU5uGZyRv0Q5svQl+oEPy5w84YpBxdb7MdqyiSPQge5jTJ6zFQLq0PFygdccSBA==",+ "license": "MIT"+ },+ "node_modules/tapable": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz",+ "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/webpack"+ }+ },+ "node_modules/tar": {+ "version": "6.2.1",+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",+ "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",+ "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "chownr": "^2.0.0",+ "fs-minipass": "^2.0.0",+ "minipass": "^5.0.0",+ "minizlib": "^2.1.1",+ "mkdirp": "^1.0.3",+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/tar/node_modules/minipass": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/temp": {+ "version": "0.9.4",+ "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.4.tgz",+ "integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "mkdirp": "^0.5.1",+ "rimraf": "~2.6.2"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/temp/node_modules/mkdirp": {+ "version": "0.5.6",+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "minimist": "^1.2.6"+ },+ "bin": {+ "mkdirp": "bin/cmd.js"+ }+ },+ "node_modules/temp/node_modules/rimraf": {+ "version": "2.6.3",+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",+ "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",+ "deprecated": "Rimraf versions prior to v4 are no longer supported",+ "dev": true,+ "license": "ISC",+ "optional": true,+ "dependencies": {+ "glob": "^7.1.3"+ },+ "bin": {+ "rimraf": "bin.js"+ }+ },+ "node_modules/terser": {+ "version": "5.48.0",+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.48.0.tgz",+ "integrity": "sha512-J/9An6vs9Us6wKRriSFXBWdRZapREHqFzdNUKk0pmu804EMR6dr6winwo7e5JDxN4xahxQsuysyYFwlwj4XN/Q==",+ "devOptional": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "@jridgewell/source-map": "^0.3.3",+ "acorn": "^8.15.0",+ "commander": "^2.20.0",+ "source-map-support": "~0.5.20"+ },+ "bin": {+ "terser": "bin/terser"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/terser/node_modules/commander": {+ "version": "2.20.3",+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",+ "devOptional": true,+ "license": "MIT"+ },+ "node_modules/tiny-each-async": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/tiny-each-async/-/tiny-each-async-2.0.3.tgz",+ "integrity": "sha512-5ROII7nElnAirvFn8g7H7MtpfV1daMcyfTGQwsn/x2VtyV+VPiO5CjReCJtWLvoKTDEDmZocf3cNPraiMnBXLA==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/tinyglobby": {+ "version": "0.2.17",+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",+ "license": "MIT",+ "dependencies": {+ "fdir": "^6.5.0",+ "picomatch": "^4.0.4"+ },+ "engines": {+ "node": ">=12.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/SuperchupuDev"+ }+ },+ "node_modules/tinyglobby/node_modules/fdir": {+ "version": "6.5.0",+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",+ "license": "MIT",+ "engines": {+ "node": ">=12.0.0"+ },+ "peerDependencies": {+ "picomatch": "^3 || ^4"+ },+ "peerDependenciesMeta": {+ "picomatch": {+ "optional": true+ }+ }+ },+ "node_modules/tinyglobby/node_modules/picomatch": {+ "version": "4.0.5",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",+ "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/tmp": {+ "version": "0.0.33",+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "os-tmpdir": "~1.0.2"+ },+ "engines": {+ "node": ">=0.6.0"+ }+ },+ "node_modules/tmp-promise": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",+ "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "tmp": "^0.2.0"+ }+ },+ "node_modules/tmp-promise/node_modules/tmp": {+ "version": "0.2.7",+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz",+ "integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=14.14"+ }+ },+ "node_modules/tn1150": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/tn1150/-/tn1150-0.1.0.tgz",+ "integrity": "sha512-DbplOfQFkqG5IHcDyyrs/lkvSr3mPUVsFf/RbDppOshs22yTPnSJWEe6FkYd1txAwU/zcnR905ar2fi4kwF29w==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "unorm": "^1.4.1"+ },+ "engines": {+ "node": ">=0.12"+ }+ },+ "node_modules/to-data-view": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/to-data-view/-/to-data-view-1.1.0.tgz",+ "integrity": "sha512-1eAdufMg6mwgmlojAx3QeMnzB/BTVp7Tbndi3U7ftcT2zCZadjxkkmLmd97zmaxWi+sgGcgWrokmpEoy0Dn0vQ==",+ "dev": true,+ "license": "MIT",+ "optional": true+ },+ "node_modules/to-regex-range": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-number": "^7.0.0"+ },+ "engines": {+ "node": ">=8.0"+ }+ },+ "node_modules/tr46": {+ "version": "0.0.3",+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/trim-repeated": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz",+ "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "escape-string-regexp": "^1.0.2"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/trim-repeated/node_modules/escape-string-regexp": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.8.0"+ }+ },+ "node_modules/ts-api-utils": {+ "version": "2.5.0",+ "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",+ "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18.12"+ },+ "peerDependencies": {+ "typescript": ">=4.8.4"+ }+ },+ "node_modules/tslib": {+ "version": "2.8.1",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "license": "0BSD"+ },+ "node_modules/tw-animate-css": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/tw-animate-css/-/tw-animate-css-1.4.0.tgz",+ "integrity": "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/Wombosvideo"+ }+ },+ "node_modules/type-check": {+ "version": "0.4.0",+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "prelude-ls": "^1.2.1"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/type-fest": {+ "version": "0.21.3",+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",+ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",+ "dev": true,+ "license": "(MIT OR CC0-1.0)",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/typescript": {+ "version": "5.9.3",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc",+ "tsserver": "bin/tsserver"+ },+ "engines": {+ "node": ">=14.17"+ }+ },+ "node_modules/undici-types": {+ "version": "7.18.2",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",+ "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",+ "devOptional": true,+ "license": "MIT"+ },+ "node_modules/unique-filename": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz",+ "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "unique-slug": "^3.0.0"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/unique-slug": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz",+ "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "imurmurhash": "^0.1.4"+ },+ "engines": {+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"+ }+ },+ "node_modules/universalify": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",+ "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 10.0.0"+ }+ },+ "node_modules/unorm": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz",+ "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==",+ "dev": true,+ "license": "MIT or GPL-2.0",+ "optional": true,+ "engines": {+ "node": ">= 0.4.0"+ }+ },+ "node_modules/update-browserslist-db": {+ "version": "1.2.3",+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/browserslist"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "escalade": "^3.2.0",+ "picocolors": "^1.1.1"+ },+ "bin": {+ "update-browserslist-db": "cli.js"+ },+ "peerDependencies": {+ "browserslist": ">= 4.21.0"+ }+ },+ "node_modules/uri-js": {+ "version": "4.4.1",+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "punycode": "^2.1.0"+ }+ },+ "node_modules/username": {+ "version": "5.1.0",+ "resolved": "https://registry.npmjs.org/username/-/username-5.1.0.tgz",+ "integrity": "sha512-PCKbdWw85JsYMvmCv5GH3kXmM66rCd9m1hBEDutPNv94b/pqCMT4NtcKyeWYvLFiE8b+ha1Jdl8XAaUdPn5QTg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "execa": "^1.0.0",+ "mem": "^4.3.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/util-deprecate": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/validate-npm-package-license": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "spdx-correct": "^3.0.0",+ "spdx-expression-parse": "^3.0.0"+ }+ },+ "node_modules/vite": {+ "version": "7.3.6",+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.6.tgz",+ "integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==",+ "license": "MIT",+ "dependencies": {+ "esbuild": "^0.27.0 || ^0.28.0",+ "fdir": "^6.5.0",+ "picomatch": "^4.0.3",+ "postcss": "^8.5.6",+ "rollup": "^4.43.0",+ "tinyglobby": "^0.2.15"+ },+ "bin": {+ "vite": "bin/vite.js"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "funding": {+ "url": "https://github.com/vitejs/vite?sponsor=1"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.3"+ },+ "peerDependencies": {+ "@types/node": "^20.19.0 || >=22.12.0",+ "jiti": ">=1.21.0",+ "less": "^4.0.0",+ "lightningcss": "^1.21.0",+ "sass": "^1.70.0",+ "sass-embedded": "^1.70.0",+ "stylus": ">=0.54.8",+ "sugarss": "^5.0.0",+ "terser": "^5.16.0",+ "tsx": "^4.8.1",+ "yaml": "^2.4.2"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ },+ "jiti": {+ "optional": true+ },+ "less": {+ "optional": true+ },+ "lightningcss": {+ "optional": true+ },+ "sass": {+ "optional": true+ },+ "sass-embedded": {+ "optional": true+ },+ "stylus": {+ "optional": true+ },+ "sugarss": {+ "optional": true+ },+ "terser": {+ "optional": true+ },+ "tsx": {+ "optional": true+ },+ "yaml": {+ "optional": true+ }+ }+ },+ "node_modules/vite-plugin-solid": {+ "version": "2.11.12",+ "resolved": "https://registry.npmjs.org/vite-plugin-solid/-/vite-plugin-solid-2.11.12.tgz",+ "integrity": "sha512-FgjPcx2OwX9h6f28jli7A4bG7PP3te8uyakE5iqsmpq3Jqi1TWLgSroC9N6cMfGRU2zXsl4Q6ISvTr2VL0QHpA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@babel/core": "^7.23.3",+ "@types/babel__core": "^7.20.4",+ "babel-preset-solid": "^1.8.4",+ "merge-anything": "^5.1.7",+ "solid-refresh": "^0.6.3",+ "vitefu": "^1.0.4"+ },+ "peerDependencies": {+ "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*",+ "solid-js": "^1.7.2",+ "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "@testing-library/jest-dom": {+ "optional": true+ }+ }+ },+ "node_modules/vite-plugin-solid-svg": {+ "version": "0.8.1",+ "resolved": "https://registry.npmjs.org/vite-plugin-solid-svg/-/vite-plugin-solid-svg-0.8.1.tgz",+ "integrity": "sha512-ROGC2ae1eYUCMd+zfJtsbUtuZwsb6DZS0+Sy5/ZXDokOunGi0Ez/cL7OPdsixN3I0/rNYd/3hilo3kpRMAS+IA==",+ "license": "MIT",+ "dependencies": {+ "svgo": "^3.1.0"+ },+ "peerDependencies": {+ "solid-js": "^1",+ "vite": ">=4"+ }+ },+ "node_modules/vite/node_modules/fdir": {+ "version": "6.5.0",+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",+ "license": "MIT",+ "engines": {+ "node": ">=12.0.0"+ },+ "peerDependencies": {+ "picomatch": "^3 || ^4"+ },+ "peerDependenciesMeta": {+ "picomatch": {+ "optional": true+ }+ }+ },+ "node_modules/vite/node_modules/picomatch": {+ "version": "4.0.5",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",+ "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/vitefu": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz",+ "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==",+ "dev": true,+ "license": "MIT",+ "workspaces": [+ "tests/deps/*",+ "tests/projects/*",+ "tests/projects/workspace/packages/*"+ ],+ "peerDependencies": {+ "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "vite": {+ "optional": true+ }+ }+ },+ "node_modules/watchpack": {+ "version": "2.5.2",+ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.2.tgz",+ "integrity": "sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.1.2"+ },+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/wcwidth": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",+ "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "defaults": "^1.0.3"+ }+ },+ "node_modules/webidl-conversions": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",+ "dev": true,+ "license": "BSD-2-Clause"+ },+ "node_modules/webpack": {+ "version": "5.108.4",+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.108.4.tgz",+ "integrity": "sha512-yur8LyJoeiWh47dErD+Ok7vlbmDsJ3UbbRPAoxbGJ54WpE2y5yVo5G/inUzujnYgw3tPmBRdn+G7PoxXaYC33w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.8",+ "@types/json-schema": "^7.0.15",+ "@webassemblyjs/ast": "^1.14.1",+ "@webassemblyjs/wasm-edit": "^1.14.1",+ "@webassemblyjs/wasm-parser": "^1.14.1",+ "acorn": "^8.16.0",+ "acorn-import-phases": "^1.0.3",+ "browserslist": "^4.28.1",+ "chrome-trace-event": "^1.0.2",+ "enhanced-resolve": "^5.22.2",+ "es-module-lexer": "^2.1.0",+ "eslint-scope": "5.1.1",+ "events": "^3.2.0",+ "graceful-fs": "^4.2.11",+ "loader-runner": "^4.3.2",+ "mime-db": "^1.54.0",+ "minimizer-webpack-plugin": "^5.6.1",+ "neo-async": "^2.6.2",+ "schema-utils": "^4.3.3",+ "tapable": "^2.3.0",+ "watchpack": "^2.5.2",+ "webpack-sources": "^3.5.0"+ },+ "bin": {+ "webpack": "bin/webpack.js"+ },+ "engines": {+ "node": ">=10.13.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/webpack"+ },+ "peerDependenciesMeta": {+ "webpack-cli": {+ "optional": true+ }+ }+ },+ "node_modules/webpack-sources": {+ "version": "3.5.0",+ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.5.0.tgz",+ "integrity": "sha512-HPuy+uuoTCaaoEoI1LQ3JN9+vrPBvEesnnX1jADHy728cHSMlq4wUc4afYqahq2B1mhQVZxCXOkNTnXltr+2vQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/webpack/node_modules/enhanced-resolve": {+ "version": "5.24.1",+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.24.1.tgz",+ "integrity": "sha512-7DdUaTjmNwMcH2gLr1qycesKII3BK4RLy/mdAb7x10Lq7bR4aNKHt1BR1ZALSv0rPM/hF5wYF0PhGop/rJm8vw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "graceful-fs": "^4.2.4",+ "tapable": "^2.3.3"+ },+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/webpack/node_modules/eslint-scope": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",+ "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",+ "dev": true,+ "license": "BSD-2-Clause",+ "dependencies": {+ "esrecurse": "^4.3.0",+ "estraverse": "^4.1.1"+ },+ "engines": {+ "node": ">=8.0.0"+ }+ },+ "node_modules/webpack/node_modules/estraverse": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",+ "dev": true,+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=4.0"+ }+ },+ "node_modules/whatwg-url": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "tr46": "~0.0.3",+ "webidl-conversions": "^3.0.0"+ }+ },+ "node_modules/which": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "isexe": "^2.0.0"+ },+ "bin": {+ "node-which": "bin/node-which"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/word-wrap": {+ "version": "1.2.5",+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/wrap-ansi": {+ "version": "6.2.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/wrap-ansi/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/wrap-ansi/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/wrappy": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/xmlbuilder": {+ "version": "15.1.1",+ "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",+ "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8.0"+ }+ },+ "node_modules/xtend": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",+ "dev": true,+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=0.4"+ }+ },+ "node_modules/y18n": {+ "version": "5.0.8",+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/yallist": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/yargs": {+ "version": "17.7.3",+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz",+ "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "cliui": "^8.0.1",+ "escalade": "^3.1.1",+ "get-caller-file": "^2.0.5",+ "require-directory": "^2.1.1",+ "string-width": "^4.2.3",+ "y18n": "^5.0.5",+ "yargs-parser": "^21.1.1"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/yargs-parser": {+ "version": "21.1.1",+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",+ "dev": true,+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/yargs/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/yargs/node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yargs/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yauzl": {+ "version": "2.10.0",+ "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",+ "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "buffer-crc32": "~0.2.3",+ "fd-slicer": "~1.1.0"+ }+ },+ "node_modules/yocto-queue": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/yoctocolors-cjs": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz",+ "integrity": "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/zod": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",+ "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ },+ "packages/jsx": {+ "name": "@diffusionstudio/jsx",+ "version": "0.1.0",+ "license": "MPL-2.0",+ "devDependencies": {+ "typescript": "~5.9.3"+ },+ "peerDependencies": {+ "solid-js": "^1.9.0"+ }+ }+ }+}diff --git a/package.json b/package.jsonnew file mode 100644index 00000000..0ee734d6--- /dev/null+++ b/package.json@@ -0,0 +1,18 @@+{+ "name": "@diffusionstudio/editor",+ "version": "0.129.0",+ "private": true,+ "license": "MPL-2.0",+ "type": "module",+ "workspaces": ["apps/*", "packages/*"],+ "scripts": {+ "dev": "npm run dev --workspace=@diffusionstudio/web",+ "dev:desktop": "npm run dev --workspace=@diffusionstudio/desktop",+ "build": "npm run build --workspace=@diffusionstudio/web",+ "build:web": "npm run build --workspace=@diffusionstudio/web",+ "build:desktop": "npm run build --workspace=@diffusionstudio/desktop",+ "make": "npm run make --workspace=@diffusionstudio/desktop",+ "lint": "npm run lint --workspaces --if-present",+ "check": "npm run check --workspaces --if-present"+ }+}diff --git a/packages/jsx/LICENSE b/packages/jsx/LICENSEnew file mode 100644index 00000000..f4bbcd20--- /dev/null+++ b/packages/jsx/LICENSE@@ -0,0 +1,373 @@+Mozilla Public License Version 2.0+==================================++1. Definitions+--------------++1.1. "Contributor"+ means each individual or legal entity that creates, contributes to+ the creation of, or owns Covered Software.++1.2. "Contributor Version"+ means the combination of the Contributions of others (if any) used+ by a Contributor and that particular Contributor's Contribution.++1.3. "Contribution"+ means Covered Software of a particular Contributor.++1.4. "Covered Software"+ means Source Code Form to which the initial Contributor has attached+ the notice in Exhibit A, the Executable Form of such Source Code+ Form, and Modifications of such Source Code Form, in each case+ including portions thereof.++1.5. "Incompatible With Secondary Licenses"+ means++ (a) that the initial Contributor has attached the notice described+ in Exhibit B to the Covered Software; or++ (b) that the Covered Software was made available under the terms of+ version 1.1 or earlier of the License, but not also under the+ terms of a Secondary License.++1.6. "Executable Form"+ means any form of the work other than Source Code Form.++1.7. "Larger Work"+ means a work that combines Covered Software with other material, in+ a separate file or files, that is not Covered Software.++1.8. "License"+ means this document.++1.9. "Licensable"+ means having the right to grant, to the maximum extent possible,+ whether at the time of the initial grant or subsequently, any and+ all of the rights conveyed by this License.++1.10. "Modifications"+ means any of the following:++ (a) any file in Source Code Form that results from an addition to,+ deletion from, or modification of the contents of Covered+ Software; or++ (b) any new file in Source Code Form that contains any Covered+ Software.++1.11. "Patent Claims" of a Contributor+ means any patent claim(s), including without limitation, method,+ process, and apparatus claims, in any patent Licensable by such+ Contributor that would be infringed, but for the grant of the+ License, by the making, using, selling, offering for sale, having+ made, import, or transfer of either its Contributions or its+ Contributor Version.++1.12. "Secondary License"+ means either the GNU General Public License, Version 2.0, the GNU+ Lesser General Public License, Version 2.1, the GNU Affero General+ Public License, Version 3.0, or any later versions of those+ licenses.++1.13. "Source Code Form"+ means the form of the work preferred for making modifications.++1.14. "You" (or "Your")+ means an individual or a legal entity exercising rights under this+ License. For legal entities, "You" includes any entity that+ controls, is controlled by, or is under common control with You. For+ purposes of this definition, "control" means (a) the power, direct+ or indirect, to cause the direction or management of such entity,+ whether by contract or otherwise, or (b) ownership of more than+ fifty percent (50%) of the outstanding shares or beneficial+ ownership of such entity.++2. License Grants and Conditions+--------------------------------++2.1. Grants++Each Contributor hereby grants You a world-wide, royalty-free,+non-exclusive license:++(a) under intellectual property rights (other than patent or trademark)+ Licensable by such Contributor to use, reproduce, make available,+ modify, display, perform, distribute, and otherwise exploit its+ Contributions, either on an unmodified basis, with Modifications, or+ as part of a Larger Work; and++(b) under Patent Claims of such Contributor to make, use, sell, offer+ for sale, have made, import, and otherwise transfer either its+ Contributions or its Contributor Version.++2.2. Effective Date++The licenses granted in Section 2.1 with respect to any Contribution+become effective for each Contribution on the date the Contributor first+distributes such Contribution.++2.3. Limitations on Grant Scope++The licenses granted in this Section 2 are the only rights granted under+this License. No additional rights or licenses will be implied from the+distribution or licensing of Covered Software under this License.+Notwithstanding Section 2.1(b) above, no patent license is granted by a+Contributor:++(a) for any code that a Contributor has removed from Covered Software;+ or++(b) for infringements caused by: (i) Your and any other third party's+ modifications of Covered Software, or (ii) the combination of its+ Contributions with other software (except as part of its Contributor+ Version); or++(c) under Patent Claims infringed by Covered Software in the absence of+ its Contributions.++This License does not grant any rights in the trademarks, service marks,+or logos of any Contributor (except as may be necessary to comply with+the notice requirements in Section 3.4).++2.4. Subsequent Licenses++No Contributor makes additional grants as a result of Your choice to+distribute the Covered Software under a subsequent version of this+License (see Section 10.2) or under the terms of a Secondary License (if+permitted under the terms of Section 3.3).++2.5. Representation++Each Contributor represents that the Contributor believes its+Contributions are its original creation(s) or it has sufficient rights+to grant the rights to its Contributions conveyed by this License.++2.6. Fair Use++This License is not intended to limit any rights You have under+applicable copyright doctrines of fair use, fair dealing, or other+equivalents.++2.7. Conditions++Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted+in Section 2.1.++3. Responsibilities+-------------------++3.1. Distribution of Source Form++All distribution of Covered Software in Source Code Form, including any+Modifications that You create or to which You contribute, must be under+the terms of this License. You must inform recipients that the Source+Code Form of the Covered Software is governed by the terms of this+License, and how they can obtain a copy of this License. You may not+attempt to alter or restrict the recipients' rights in the Source Code+Form.++3.2. Distribution of Executable Form++If You distribute Covered Software in Executable Form then:++(a) such Covered Software must also be made available in Source Code+ Form, as described in Section 3.1, and You must inform recipients of+ the Executable Form how they can obtain a copy of such Source Code+ Form by reasonable means in a timely manner, at a charge no more+ than the cost of distribution to the recipient; and++(b) You may distribute such Executable Form under the terms of this+ License, or sublicense it under different terms, provided that the+ license for the Executable Form does not attempt to limit or alter+ the recipients' rights in the Source Code Form under this License.++3.3. Distribution of a Larger Work++You may create and distribute a Larger Work under terms of Your choice,+provided that You also comply with the requirements of this License for+the Covered Software. If the Larger Work is a combination of Covered+Software with a work governed by one or more Secondary Licenses, and the+Covered Software is not Incompatible With Secondary Licenses, this+License permits You to additionally distribute such Covered Software+under the terms of such Secondary License(s), so that the recipient of+the Larger Work may, at their option, further distribute the Covered+Software under the terms of either this License or such Secondary+License(s).++3.4. Notices++You may not remove or alter the substance of any license notices+(including copyright notices, patent notices, disclaimers of warranty,+or limitations of liability) contained within the Source Code Form of+the Covered Software, except that You may alter any license notices to+the extent required to remedy known factual inaccuracies.++3.5. Application of Additional Terms++You may choose to offer, and to charge a fee for, warranty, support,+indemnity or liability obligations to one or more recipients of Covered+Software. However, You may do so only on Your own behalf, and not on+behalf of any Contributor. You must make it absolutely clear that any+such warranty, support, indemnity, or liability obligation is offered by+You alone, and You hereby agree to indemnify every Contributor for any+liability incurred by such Contributor as a result of warranty, support,+indemnity or liability terms You offer. You may include additional+disclaimers of warranty and limitations of liability specific to any+jurisdiction.++4. Inability to Comply Due to Statute or Regulation+---------------------------------------------------++If it is impossible for You to comply with any of the terms of this+License with respect to some or all of the Covered Software due to+statute, judicial order, or regulation then You must: (a) comply with+the terms of this License to the maximum extent possible; and (b)+describe the limitations and the code they affect. Such description must+be placed in a text file included with all distributions of the Covered+Software under this License. Except to the extent prohibited by statute+or regulation, such description must be sufficiently detailed for a+recipient of ordinary skill to be able to understand it.++5. Termination+--------------++5.1. The rights granted under this License will terminate automatically+if You fail to comply with any of its terms. However, if You become+compliant, then the rights granted under this License from a particular+Contributor are reinstated (a) provisionally, unless and until such+Contributor explicitly and finally terminates Your grants, and (b) on an+ongoing basis, if such Contributor fails to notify You of the+non-compliance by some reasonable means prior to 60 days after You have+come back into compliance. Moreover, Your grants from a particular+Contributor are reinstated on an ongoing basis if such Contributor+notifies You of the non-compliance by some reasonable means, this is the+first time You have received notice of non-compliance with this License+from such Contributor, and You become compliant prior to 30 days after+Your receipt of the notice.++5.2. If You initiate litigation against any entity by asserting a patent+infringement claim (excluding declaratory judgment actions,+counter-claims, and cross-claims) alleging that a Contributor Version+directly or indirectly infringes any patent, then the rights granted to+You by any and all Contributors for the Covered Software under Section+2.1 of this License shall terminate.++5.3. In the event of termination under Sections 5.1 or 5.2 above, all+end user license agreements (excluding distributors and resellers) which+have been validly granted by You or Your distributors under this License+prior to termination shall survive termination.++************************************************************************+* *+* 6. Disclaimer of Warranty *+* ------------------------- *+* *+* Covered Software is provided under this License on an "as is" *+* basis, without warranty of any kind, either expressed, implied, or *+* statutory, including, without limitation, warranties that the *+* Covered Software is free of defects, merchantable, fit for a *+* particular purpose or non-infringing. The entire risk as to the *+* quality and performance of the Covered Software is with You. *+* Should any Covered Software prove defective in any respect, You *+* (not any Contributor) assume the cost of any necessary servicing, *+* repair, or correction. This disclaimer of warranty constitutes an *+* essential part of this License. No use of any Covered Software is *+* authorized under this License except under this disclaimer. *+* *+************************************************************************++************************************************************************+* *+* 7. Limitation of Liability *+* -------------------------- *+* *+* Under no circumstances and under no legal theory, whether tort *+* (including negligence), contract, or otherwise, shall any *+* Contributor, or anyone who distributes Covered Software as *+* permitted above, be liable to You for any direct, indirect, *+* special, incidental, or consequential damages of any character *+* including, without limitation, damages for lost profits, loss of *+* goodwill, work stoppage, computer failure or malfunction, or any *+* and all other commercial damages or losses, even if such party *+* shall have been informed of the possibility of such damages. This *+* limitation of liability shall not apply to liability for death or *+* personal injury resulting from such party's negligence to the *+* extent applicable law prohibits such limitation. Some *+* jurisdictions do not allow the exclusion or limitation of *+* incidental or consequential damages, so this exclusion and *+* limitation may not apply to You. *+* *+************************************************************************++8. Litigation+-------------++Any litigation relating to this License may be brought only in the+courts of a jurisdiction where the defendant maintains its principal+place of business and such litigation shall be governed by laws of that+jurisdiction, without reference to its conflict-of-law provisions.+Nothing in this Section shall prevent a party's ability to bring+cross-claims or counter-claims.++9. Miscellaneous+----------------++This License represents the complete agreement concerning the subject+matter hereof. If any provision of this License is held to be+unenforceable, such provision shall be reformed only to the extent+necessary to make it enforceable. Any law or regulation which provides+that the language of a contract shall be construed against the drafter+shall not be used to construe this License against a Contributor.++10. Versions of the License+---------------------------++10.1. New Versions++Mozilla Foundation is the license steward. Except as provided in Section+10.3, no one other than the license steward has the right to modify or+publish new versions of this License. Each version will be given a+distinguishing version number.++10.2. Effect of New Versions++You may distribute the Covered Software under the terms of the version+of the License under which You originally received the Covered Software,+or under the terms of any subsequent version published by the license+steward.++10.3. Modified Versions++If you create software not governed by this License, and you want to+create a new license for such software, you may create and use a+modified version of this License if you rename the license and remove+any references to the name of the license steward (except to note that+such modified license differs from this License).++10.4. Distributing Source Code Form that is Incompatible With Secondary+Licenses++If You choose to distribute Source Code Form that is Incompatible With+Secondary Licenses under the terms of this version of the License, the+notice described in Exhibit B of this License must be attached.++Exhibit A - Source Code Form License Notice+-------------------------------------------++ This Source Code Form is subject to the terms of the Mozilla Public+ License, v. 2.0. If a copy of the MPL was not distributed with this+ file, You can obtain one at http://mozilla.org/MPL/2.0/.++If it is not possible or desirable to put the notice in a particular+file, then You may include the notice in a location (such as a LICENSE+file in a relevant directory) where a recipient would be likely to look+for such a notice.++You may add additional accurate notices of copyright ownership.++Exhibit B - "Incompatible With Secondary Licenses" Notice+---------------------------------------------------------++ This Source Code Form is "Incompatible With Secondary Licenses", as+ defined by the Mozilla Public License, v. 2.0.\ No newline at end of filediff --git a/packages/jsx/README.md b/packages/jsx/README.mdnew file mode 100644index 00000000..1e07b986--- /dev/null+++ b/packages/jsx/README.md@@ -0,0 +1,71 @@+# @diffusionstudio/jsx++Solid JSX runtime and types for authoring [Diffusion Studio](https://diffusion.studio)+compositions as code. Projects written against this package are compiled and+mounted into the running editor with `dapi mount`; every JSX element becomes an+editable node in the composition — there is no hidden DOM, no CSS resolution,+and no measuring pass.++```tsx+import { generate } from "@diffusionstudio/jsx";++const hero = generate.image({ prompt: "A neon city at night, cinematic" });++export default function Project() {+ return (+ <scene key="intro" name="Intro" width={1920} height={1080}>+ <image src={hero} />+ <text textAlign="center" textBaseline="middle" fontSize={128} fontWeight="bold">+ Hello World+ </text>+ <captions />+ </scene>+ );+}+```++## Setup++The editor supplies the runtime when a project is mounted, so this package is+needed for **types and tooling** — IntelliSense, `tsc --noEmit`, and testing+components outside the editor.++```sh+npm install --save-dev @diffusionstudio/jsx solid-js+```++```jsonc+// tsconfig.json+{+ "compilerOptions": {+ "jsx": "preserve",+ "jsxImportSource": "@diffusionstudio/jsx"+ }+}+```++## Documentation++See the JSX API specification shipped with the Diffusion Studio CLI+(`JSX_API.md`) for the full element reference, timing model, media source+resolution, and the `generate.*` declaration API.++## Testing outside the editor++`renderProject` renders a component into any `ProjectDocument` implementation,+so a test can supply a lightweight in-memory document and assert on what the+renderer wrote into it:++```ts+import { renderProject } from "@diffusionstudio/jsx";+import type { ProjectDocument } from "@diffusionstudio/jsx";+import Project from "./project";++const document: ProjectDocument = /* your in-memory implementation */;+const dispose = renderProject(Project, document);+dispose();+```++## License++[MPL-2.0](./LICENSE)diff --git a/packages/jsx/package.json b/packages/jsx/package.jsonnew file mode 100644index 00000000..080df1be--- /dev/null+++ b/packages/jsx/package.json@@ -0,0 +1,33 @@+{+ "name": "@diffusionstudio/jsx",+ "version": "0.1.0",+ "description": "Solid JSX runtime and types for authoring Diffusion Studio compositions — mounted into the editor via `dapi mount`.",+ "license": "MPL-2.0",+ "type": "module",+ "sideEffects": false,+ "files": [+ "dist"+ ],+ "exports": {+ ".": "./src/index.ts",+ "./time": "./src/time.ts",+ "./jsx-runtime": "./src/jsx-runtime.ts",+ "./jsx-dev-runtime": "./src/jsx-runtime.ts"+ },+ "scripts": {+ "build": "tsc -p tsconfig.build.json",+ "check": "tsc --noEmit"+ },+ "keywords": [+ "diffusion-studio",+ "solid-js",+ "jsx",+ "video-editing"+ ],+ "peerDependencies": {+ "solid-js": "^1.9.0"+ },+ "devDependencies": {+ "typescript": "~5.9.3"+ }+}diff --git a/packages/jsx/src/document.ts b/packages/jsx/src/document.tsnew file mode 100644index 00000000..620ec306--- /dev/null+++ b/packages/jsx/src/document.ts@@ -0,0 +1,25 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * The host document the universal renderer writes into. The editor implements+ * this interface directly over its ECS world, so rendering a project builds+ * real composition entities — there is no intermediate staged tree. The+ * operations mirror `createRenderer`'s host config one to one; node values are+ * opaque to the renderer.+ */++export interface ProjectDocument<N = unknown> {+ stage: N;+ createElement(tag: string): N;+ createTextNode(text: string): N;+ replaceText(node: N, text: string): void;+ isTextNode(node: N): boolean;+ setProperty(node: N, name: string, value: unknown): void;+ insertNode(parent: N, node: N, anchor?: N): void;+ removeNode(parent: N, node: N): void;+ getParentNode(node: N): N | undefined;+ getFirstChild(node: N): N | undefined;+ getNextSibling(node: N): N | undefined;+}diff --git a/packages/jsx/src/generate.ts b/packages/jsx/src/generate.tsnew file mode 100644index 00000000..47ba4a35--- /dev/null+++ b/packages/jsx/src/generate.ts@@ -0,0 +1,123 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Declarative generated assets. A `generate.*` call is pure: it validates its+ * options and returns an `AssetRef` value that can be passed wherever a source+ * is expected (`src`, `startFrame`, `endFrame`, `refs`). Nothing generates+ * until the mounted tree commits; refs never used by a mounted element are+ * dropped. Because dependencies are values (not string ids), reference cycles+ * are impossible by construction.+ */++export type AspectRatio = "1:1" | "4:3" | "3:4" | "16:9" | "9:16";++/** A path, URL, asset id, or another `generate.*` declaration. */+export type AssetInput = string | AssetRef;++export type GenerateImageOptions = {+ prompt: string;+ model?: string;+ aspectRatio?: AspectRatio;+ refs?: AssetInput[];+ seed?: number;+};++export type GenerateVideoOptions = {+ prompt: string;+ model?: string;+ aspectRatio?: AspectRatio;+ /** Whole seconds; default 5. */+ duration?: number;+ /** Generate audio alongside; models with the `audio` feature only. */+ audio?: boolean;+ /** Image used as the first frame. */+ startFrame?: AssetInput;+ /** Image used as the last frame; `end-frame` feature only. */+ endFrame?: AssetInput;+ seed?: number;+};++export type GenerateVoiceOptions = {+ /** The text to speak. */+ prompt: string;+ /** Voice id; default the first voice from `dapi voices`. */+ voice?: string;+};++export type GenerateAudioOptions = {+ prompt: string;+ model?: string;+};++export type AssetSpecInput =+ | ({ type: "image" } & GenerateImageOptions)+ | ({ type: "video" } & GenerateVideoOptions)+ | ({ type: "voice" } & GenerateVoiceOptions)+ | ({ type: "audio" } & GenerateAudioOptions);++/**+ * Opaque handle to a declared (not-yet-generated) asset. Obtained from+ * `generate.*`; consumed by `src` / `startFrame` / `endFrame` / `refs`.+ */+export class AssetRef {+ /** @internal — read via `getAssetSpec`. */+ readonly spec: AssetSpecInput;++ /** @internal — declare refs with `generate.*`, not `new AssetRef()`. */+ constructor(spec: AssetSpecInput) {+ this.spec = spec;+ }+}++export function isAssetRef(value: unknown): value is AssetRef {+ return value instanceof AssetRef;+}++/** Host-side accessor for a declaration's spec. */+export function getAssetSpec(ref: AssetRef): AssetSpecInput {+ return ref.spec;+}++function requirePrompt(value: unknown, kind: string): string {+ if (typeof value !== "string" || value.trim().length === 0) {+ throw new Error(`generate.${kind} requires a non-empty string prompt`);+ }+ return value;+}++function checkAssetInput(value: unknown, kind: string, option: string): void {+ if (value === undefined) return;+ if (typeof value === "string" && value.trim().length > 0) return;+ if (isAssetRef(value)) return;+ throw new Error(`generate.${kind}: ${option} must be a path, URL, asset id, or an AssetRef`);+}++export const generate = {+ image(opts: GenerateImageOptions): AssetRef {+ requirePrompt(opts.prompt, "image");+ for (const ref of opts.refs ?? []) checkAssetInput(ref, "image", "refs");+ return new AssetRef({ type: "image", ...opts });+ },++ video(opts: GenerateVideoOptions): AssetRef {+ requirePrompt(opts.prompt, "video");+ checkAssetInput(opts.startFrame, "video", "startFrame");+ checkAssetInput(opts.endFrame, "video", "endFrame");+ if (opts.duration !== undefined && (!Number.isInteger(opts.duration) || opts.duration <= 0)) {+ throw new Error("generate.video: duration must be a positive whole number of seconds");+ }+ return new AssetRef({ type: "video", ...opts });+ },++ voice(opts: GenerateVoiceOptions): AssetRef {+ requirePrompt(opts.prompt, "voice");+ return new AssetRef({ type: "voice", ...opts });+ },++ audio(opts: GenerateAudioOptions): AssetRef {+ requirePrompt(opts.prompt, "audio");+ return new AssetRef({ type: "audio", ...opts });+ },+};diff --git a/packages/jsx/src/index.ts b/packages/jsx/src/index.tsnew file mode 100644index 00000000..d2edb796--- /dev/null+++ b/packages/jsx/src/index.ts@@ -0,0 +1,55 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++// Public authoring API (used by project modules).+export { generate, AssetRef, isAssetRef, getAssetSpec } from "./generate";+export type {+ AspectRatio,+ AssetInput,+ AssetSpecInput,+ GenerateAudioOptions,+ GenerateImageOptions,+ GenerateVideoOptions,+ GenerateVoiceOptions,+} from "./generate";+export { PATCH_PROP_KEYS } from "./types";+export { parseTime, TIME_FPS } from "./time";+export type {+ AudioProps,+ CaptionPreset,+ CaptionsProps,+ ColorStopProps,+ Fit,+ GradientPaintProps,+ GroupProps,+ ImageProps,+ PatchProps,+ RectProps,+ SceneProps,+ SequenceProps,+ SolidPaintProps,+ TextProps,+ Time,+ VideoProps,+} from "./types";++// Renderer runtime — compiled project modules import these (babel-preset-solid+// universal mode, moduleName "@diffusionstudio/jsx").+export {+ render,+ effect,+ memo,+ createComponent,+ createElement,+ createTextNode,+ insertNode,+ insert,+ spread,+ setProp,+ mergeProps,+ use,+ renderProject,+} from "./renderer";++export type { ProjectDocument } from "./document";diff --git a/packages/jsx/src/jsx-runtime.ts b/packages/jsx/src/jsx-runtime.tsnew file mode 100644index 00000000..a32442a8--- /dev/null+++ b/packages/jsx/src/jsx-runtime.ts@@ -0,0 +1,52 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++/**+ * Type-only JSX runtime for `jsxImportSource: "@diffusionstudio/jsx"`. JSX is+ * compiled by babel-preset-solid (universal mode) against the renderer in+ * "./renderer", so this module carries no runtime — only the JSX namespace+ * TypeScript resolves element and prop types from.+ */++import type { JSX as SolidJSX } from "solid-js";+import type {+ AudioProps,+ CaptionsProps,+ ColorStopProps,+ GradientPaintProps,+ GroupProps,+ ImageProps,+ RectProps,+ SceneProps,+ SequenceProps,+ SolidPaintProps,+ TextProps,+ VideoProps,+} from "./types";++export declare namespace JSX {+ // Solid's Element type keeps Solid's control flow (<For>, <Show>, …) and+ // user components interoperable with this JSX namespace.+ export type Element = SolidJSX.Element;++ export interface ElementChildrenAttribute {+ children: unknown;+ }++ export interface IntrinsicElements {+ scene: SceneProps;+ group: GroupProps;+ rect: RectProps;+ video: VideoProps;+ image: ImageProps;+ audio: AudioProps;+ text: TextProps;+ sequence: SequenceProps;+ captions: CaptionsProps;+ solidPaint: SolidPaintProps;+ linearGradientPaint: GradientPaintProps;+ radialGradientPaint: GradientPaintProps;+ colorStop: ColorStopProps;+ }+}diff --git a/packages/jsx/src/renderer.ts b/packages/jsx/src/renderer.tsnew file mode 100644index 00000000..2e78027e--- /dev/null+++ b/packages/jsx/src/renderer.ts@@ -0,0 +1,88 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { createRenderer } from "solid-js/universal";++import type { ProjectDocument } from "./document";++// Compiled project modules call the static runtime exports below+// (babel-preset-solid in `universal` mode with a fixed moduleName), so the+// renderer must be a module-level singleton. Its host operations forward to+// the document of the active `renderProject` call.+let currentDocument: ProjectDocument | null = null;++function doc(): ProjectDocument {+ if (currentDocument === null) {+ throw new Error("No active mount — elements can only be created while a project renders");+ }+ return currentDocument;+}++const renderer = createRenderer<unknown>({+ createElement(tag: string): unknown {+ return doc().createElement(tag);+ },+ createTextNode(value: string): unknown {+ return doc().createTextNode(String(value));+ },+ replaceText(textNode: unknown, value: string): void {+ doc().replaceText(textNode, String(value));+ },+ isTextNode(node: unknown): boolean {+ return doc().isTextNode(node);+ },+ setProperty(node: unknown, name: string, value: unknown): void {+ doc().setProperty(node, name, value);+ },+ insertNode(parent: unknown, node: unknown, anchor?: unknown): void {+ doc().insertNode(parent, node, anchor);+ },+ removeNode(parent: unknown, node: unknown): void {+ doc().removeNode(parent, node);+ },+ getParentNode(node: unknown): unknown {+ return doc().getParentNode(node);+ },+ getFirstChild(node: unknown): unknown {+ return doc().getFirstChild(node);+ },+ getNextSibling(node: unknown): unknown {+ return doc().getNextSibling(node);+ },+});++export const {+ render,+ effect,+ memo,+ createComponent,+ createElement,+ createTextNode,+ insertNode,+ insert,+ spread,+ setProp,+ mergeProps,+ use,+} = renderer;++/**+ * Host entry point: renders a project component directly into `document`.+ * Mounting is synchronous — the document is fully written when this returns —+ * and the returned dispose function ends the reactive root (the one-shot+ * contract in JSX_API.md; nothing is rendered outside an active mount).+ */+export function renderProject<N>(project: () => unknown, document: ProjectDocument<N>) {+ const previous = currentDocument;+ currentDocument = document as ProjectDocument;++ let dispose: () => void = () => { };+ try {+ dispose = render(() => createComponent(project as () => unknown, {}), document.stage);+ } catch (error) {+ dispose?.();+ currentDocument = previous;+ throw error;+ }+}diff --git a/packages/jsx/src/time.ts b/packages/jsx/src/time.tsnew file mode 100644index 00000000..bf0cb117--- /dev/null+++ b/packages/jsx/src/time.ts@@ -0,0 +1,54 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { Time } from "./types";++/** Frames per second of the canonical `Time` frame unit ("30f"). */+export const TIME_FPS = 30;++/**+ * Parses a `Time` value into seconds: plain numbers are seconds, "30f" is+ * frames at `TIME_FPS`, "MM:SS" / "HH:MM:SS" are clock strings. Values may be+ * negative. Returns undefined for anything unparsable.+ */+export function parseTime(value: Time | string | null | undefined): number | undefined {+ if (typeof value === "number") {+ return Number.isFinite(value) ? value : undefined;+ }++ const str = value?.trim();+ if (typeof str !== "string" || str.length === 0) {+ return undefined;+ }++ // Frames, e.g. "-30f".+ if (/^-?\d+(?:\.\d+)?f$/i.test(str)) {+ return parseFloat(str) / TIME_FPS;+ }++ // MM:SS or HH:MM:SS.+ if (str.includes(":")) {+ const negative = str.startsWith("-");+ const parts = str.replace(/^-/, "").split(":").map(Number);++ if (parts.some((n) => !Number.isFinite(n))) {+ return undefined;+ }++ let seconds: number;+ if (parts.length === 2) {+ seconds = parts[0]! * 60 + parts[1]!;+ } else if (parts.length === 3) {+ seconds = parts[0]! * 3600 + parts[1]! * 60 + parts[2]!;+ } else {+ return undefined;+ }++ return negative ? -seconds : seconds;+ }++ // Plain seconds (may be fractional).+ const seconds = parseFloat(str);+ return Number.isFinite(seconds) ? seconds : undefined;+}diff --git a/packages/jsx/src/types.ts b/packages/jsx/src/types.tsnew file mode 100644index 00000000..50693c85--- /dev/null+++ b/packages/jsx/src/types.ts@@ -0,0 +1,190 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { JSX as SolidJSX } from "solid-js";+import type { AssetRef } from "./generate";++/**+ * Composition-relative time: seconds (number), frames ("30f"), or a+ * "MM:SS" / "HH:MM:SS" clock string. The canonical internal unit is frames+ * at 30 fps; all formats are converted on import. Values may be negative.+ */+export type Time = number | `${number}f` | `${string}:${string}`;++export type Fit = "cover" | "contain" | "fill";++/** Caption style presets — the editor's caption inspector presets. */+export type CaptionPreset =+ | "classic"+ | "cascade"+ | "spotlight"+ | "whisper"+ | "paper"+ | "guinea"+ | "stark";++/**+ * Every property assignable through the renderer — exactly the set+ * `WorldDocument.setProperty` accepts. This is the single property table:+ * element props pick from it, and `dapi node patch` takes any subset per+ * patch entry with identical value requirements, so JSX and CLI can't drift.+ */+export type PatchProps = {+ /**+ * Stable identity across mounts — required when the element is a document+ * root: re-mounting replaces the node carrying the same key, or creates it+ * if absent.+ */+ key?: string;+ /** Human-readable node name. */+ name?: string;+ /** Position relative to the parent, px. Defaults to 0. */+ x?: number;+ y?: number;+ /** Box size, px. Defaults to the parent's size. */+ width?: number;+ height?: number;+ /** Rotation in degrees. */+ rotation?: number;+ /** Opacity, 0–1. */+ opacity?: number;+ /** Uniform corner radius, px. */+ cornerRadius?: number;+ /** Composition time at which the node becomes visible/audible. */+ inPoint?: Time;+ /** Composition time at which the node stops. */+ outPoint?: Time;+ /** Composition time at which the node's source time 0 is placed. Defaults to the in point. */+ startTime?: Time;+ /** Any CSS color, applied to the node's solid fill (created if absent); alpha is ignored — use `opacity`. */+ fill?: string;+ /** Path, URL, asset id, or a `generate.*` declaration. */+ src?: string | AssetRef;+ /** How the source maps into the box. Default "cover" on `<video>`, "contain" on `<image>`. */+ objectFit?: Fit;+ /** 0–1; 1 = unity gain. */+ volume?: number;+ /** A family available on the machine (`dapi fonts`). */+ fontFamily?: string;+ /** Font size, px. */+ fontSize?: number;+ /** CSS weights 100–900, or "normal" / "bold". */+ fontWeight?: number | "normal" | "bold";+ fontStyle?: "normal" | "italic";+ /** Any CSS color: the glyph color on `<text>`, the paint color on paints and color stops. */+ color?: string;+ /** Horizontal alignment of glyphs within the box. Default "left". */+ textAlign?: "left" | "center" | "right";+ /** Vertical alignment within the box. Default "top". */+ textBaseline?: "top" | "middle" | "bottom";+ /** Position along the gradient, 0–1. */+ offset?: number;+ /** Caption style preset — `<captions>` only. Default "classic". */+ preset?: CaptionPreset;+ /** Fills the caption preset's color slots in order; any CSS color, alpha is ignored. */+ colors?: string[];+};++/** Every PatchProps key, at runtime — the `dapi node patch` allowlist. */+export const PATCH_PROP_KEYS = Object.keys({+ key: true,+ name: true,+ x: true,+ y: true,+ width: true,+ height: true,+ rotation: true,+ opacity: true,+ cornerRadius: true,+ inPoint: true,+ outPoint: true,+ startTime: true,+ fill: true,+ src: true,+ objectFit: true,+ volume: true,+ fontFamily: true,+ fontSize: true,+ fontWeight: true,+ fontStyle: true,+ color: true,+ textAlign: true,+ textBaseline: true,+ offset: true,+ preset: true,+ colors: true,+} satisfies Record<keyof PatchProps, true>) as ReadonlyArray<keyof PatchProps>;++type TimingProps = Pick<PatchProps, "inPoint" | "outPoint" | "startTime">;++type CommonProps = TimingProps &+ Pick<+ PatchProps,+ "key" | "name" | "x" | "y" | "width" | "height" | "rotation" | "opacity" | "cornerRadius"+ >;++export type SceneProps = {+ /**+ * Stable identity across mounts — required: re-mounting replaces the scene+ * carrying the same key, or creates it if absent.+ */+ key: string;+ /** Human-readable scene name — recommended, e.g. `name="Intro"`. */+ name?: string;+ /** Composition width in pixels. Required. */+ width: number;+ /** Composition height in pixels. Required. */+ height: number;+ /** Background fill, any CSS color (alpha is ignored). */+ fill?: string;+ children?: SolidJSX.Element;+};++export type GroupProps = CommonProps & Pick<PatchProps, "fill"> & {+ children?: SolidJSX.Element;+};++export type RectProps = CommonProps & Pick<PatchProps, "fill"> & {+ /** Paint children (`<solidPaint>`, `<linearGradientPaint>`, `<radialGradientPaint>`). */+ children?: SolidJSX.Element;+};++export type SolidPaintProps = Required<Pick<PatchProps, "color">> & Pick<PatchProps, "opacity">;++export type GradientPaintProps = Pick<PatchProps, "opacity"> & {+ /** Gradient rotation in degrees. Defaults to 0 (left to right). */+ rotation?: number;+ /** `<colorStop>` children — the gradient's color stops. */+ children?: SolidJSX.Element;+};++export type ColorStopProps = Required<Pick<PatchProps, "offset" | "color">> &+ Pick<PatchProps, "opacity">;++export type VideoProps = CommonProps &+ Required<Pick<PatchProps, "src">> &+ Pick<PatchProps, "objectFit" | "volume">;++export type ImageProps = CommonProps &+ Required<Pick<PatchProps, "src">> &+ Pick<PatchProps, "objectFit">;++export type AudioProps = TimingProps &+ Required<Pick<PatchProps, "src">> &+ Pick<PatchProps, "name" | "volume">;++export type TextProps = CommonProps &+ Pick<+ PatchProps,+ "fontFamily" | "fontSize" | "fontWeight" | "fontStyle" | "color" | "textAlign" | "textBaseline"+ > & {+ /** The text content. Required. */+ children: SolidJSX.Element;+ };++export type SequenceProps = Pick<PatchProps, "name"> & {+ children?: SolidJSX.Element;+};++export type CaptionsProps = Pick<PatchProps, "preset" | "colors">;diff --git a/packages/jsx/tsconfig.build.json b/packages/jsx/tsconfig.build.jsonnew file mode 100644index 00000000..771e7dd9--- /dev/null+++ b/packages/jsx/tsconfig.build.json@@ -0,0 +1,9 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "noEmit": false,+ "declaration": true,+ "rootDir": "src",+ "outDir": "dist"+ }+}diff --git a/packages/jsx/tsconfig.json b/packages/jsx/tsconfig.jsonnew file mode 100644index 00000000..5ed16ed1--- /dev/null+++ b/packages/jsx/tsconfig.json@@ -0,0 +1,8 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",+ "lib": ["es2024"]+ },+ "include": ["src"]+}diff --git a/temp.sh b/temp.shnew file mode 100644index 00000000..9e5ae07e--- /dev/null+++ b/temp.sh@@ -0,0 +1,7 @@+dapi mount --code 'export default () => (+ <scene key="intro" width={1920} height={1080}>+ <rect x={100} y={100} width={400} height={300} fill="#ff5533" cornerRadius={12} />+</scene>+)'++# inPoint={5} outPoint={16} startTime="-30f"\ No newline at end of filediff --git a/tsconfig.base.json b/tsconfig.base.jsonnew file mode 100644index 00000000..45175694--- /dev/null+++ b/tsconfig.base.json@@ -0,0 +1,17 @@+{+ "compilerOptions": {+ "target": "es2024",+ "module": "ESNext",+ "moduleResolution": "bundler",+ "verbatimModuleSyntax": true,+ "moduleDetection": "force",+ "skipLibCheck": true,+ "noEmit": true,+ "strict": true,+ "noUnusedLocals": true,+ "noUnusedParameters": true,+ "erasableSyntaxOnly": true,+ "noFallthroughCasesInSwitch": true,+ "noUncheckedSideEffectImports": true+ }+}diff --git a/tsconfig.json b/tsconfig.jsonnew file mode 100644index 00000000..6818e204--- /dev/null+++ b/tsconfig.json@@ -0,0 +1,8 @@+{+ "files": [],+ "references": [+ { "path": "./apps/web" },+ { "path": "./apps/cli" },+ { "path": "./apps/desktop" },+ ]+}