@1agh/maude 2.0.8 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/apps/hub/src/project-transactions/kernel.mjs +13 -7
- package/apps/studio/access/closure.ts +86 -10
- package/apps/studio/access/filters.ts +18 -1
- package/apps/studio/access/request.ts +8 -0
- package/apps/studio/acp/design-write-verb.ts +12 -2
- package/apps/studio/acp/env.ts +7 -2
- package/apps/studio/acp/index.ts +15 -4
- package/apps/studio/acp/login-state.ts +22 -5
- package/apps/studio/acp/may-scope.ts +38 -1
- package/apps/studio/acp/plugin-bootstrap.ts +13 -1
- package/apps/studio/acp/probe.ts +11 -4
- package/apps/studio/actions/agents.ts +110 -28
- package/apps/studio/actions/canvas-keys.ts +4 -2
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/annotation.ts +84 -2
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/edit.ts +13 -0
- package/apps/studio/actions/defs/export.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +18 -0
- package/apps/studio/actions/defs/video.ts +9 -0
- package/apps/studio/actions/documents.ts +6 -1
- package/apps/studio/actions/keymap.gen.ts +147 -9
- package/apps/studio/actions/menu.ts +5 -1
- package/apps/studio/actions/types.ts +4 -2
- package/apps/studio/actions/verbs.ts +9 -0
- package/apps/studio/actions.manifest.json +300 -45
- package/apps/studio/actions.parity.json +19 -1
- package/apps/studio/ai/save-hold.ts +2 -1
- package/apps/studio/ai/write-claim-scope.ts +7 -1
- package/apps/studio/ai/write-claim.ts +154 -3
- package/apps/studio/annotations/ai-read.ts +42 -6
- package/apps/studio/annotations/ai-write.ts +145 -2
- package/apps/studio/annotations/board-ops.ts +34 -3
- package/apps/studio/annotations/checklist-ops.ts +374 -0
- package/apps/studio/annotations/elements/checkitem.model.ts +129 -0
- package/apps/studio/annotations/elements/sticky.model.ts +54 -2
- package/apps/studio/annotations/ops.ts +30 -0
- package/apps/studio/annotations/registry.ts +9 -1
- package/apps/studio/annotations/templates.ts +4 -2
- package/apps/studio/annotations/text-steps.ts +114 -10
- package/apps/studio/annotations/ui/checklist-wire.ts +129 -0
- package/apps/studio/annotations/ui/checklist.tsx +429 -0
- package/apps/studio/annotations/ui/element-node.tsx +48 -2
- package/apps/studio/annotations/ui/template-place.ts +11 -1
- package/apps/studio/annotations/v1-adapter.ts +22 -3
- package/apps/studio/annotations-context-toolbar.tsx +12 -0
- package/apps/studio/annotations-layer.tsx +442 -49
- package/apps/studio/annotations-model.ts +4 -2
- package/apps/studio/api.ts +148 -21
- package/apps/studio/artboard-live-gate.tsx +54 -17
- package/apps/studio/artboard-still-persist.ts +166 -0
- package/apps/studio/artboard-still-raster.ts +6 -2
- package/apps/studio/artboard-still.ts +390 -20
- package/apps/studio/asset-added.ts +154 -0
- package/apps/studio/asset-details.ts +46 -3
- package/apps/studio/asset-origins.ts +5 -3
- package/apps/studio/asset-trash.ts +6 -1
- package/apps/studio/bin/_agent-browser-safe.mjs +3 -4
- package/apps/studio/bin/_annotate-post.mjs +14 -5
- package/apps/studio/bin/_audio-search.mjs +8 -2
- package/apps/studio/bin/_curl-local.mjs +7 -4
- package/apps/studio/bin/_desktop-locate.sh +145 -0
- package/apps/studio/bin/_ds-check-live.mjs +2 -1
- package/apps/studio/bin/_exports.mjs +38 -2
- package/apps/studio/bin/_history.mjs +79 -8
- package/apps/studio/bin/_import-asset.mjs +14 -9
- package/apps/studio/bin/_import-figma.mjs +510 -98
- package/apps/studio/bin/_index-cli.mjs +10 -21
- package/apps/studio/bin/_ingest-footage.mjs +24 -6
- package/apps/studio/bin/_media-probe.mjs +232 -0
- package/apps/studio/bin/_perf-probe-open.mjs +6 -0
- package/apps/studio/bin/_perf-probe-safari.mjs +6 -0
- package/apps/studio/bin/_perf-probe-studio.mjs +6 -1
- package/apps/studio/bin/_perf-probe.mjs +8 -3
- package/apps/studio/bin/_perf-sweep-shared.mjs +789 -0
- package/apps/studio/bin/_perf-sweep.mjs +240 -0
- package/apps/studio/bin/_record-shot.sh +33 -8
- package/apps/studio/bin/_screenshot-playwright.mjs +45 -2
- package/apps/studio/bin/_studio-verb.mjs +8 -3
- package/apps/studio/bin/_thumb-route.mjs +21 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +83 -1
- package/apps/studio/bin/_transcribe.mjs +22 -6
- package/apps/studio/bin/_unsynced-refs.mjs +22 -0
- package/apps/studio/bin/_url-guard.mjs +120 -5
- package/apps/studio/bin/_url-guard.sh +29 -7
- package/apps/studio/bin/_video-limits.mjs +104 -0
- package/apps/studio/bin/_video-playwright.mjs +119 -19
- package/apps/studio/bin/_video-proxy.mjs +130 -0
- package/apps/studio/bin/_write-claim.mjs +38 -16
- package/apps/studio/bin/annotate.mjs +12 -2
- package/apps/studio/bin/canvas-rects.sh +19 -4
- package/apps/studio/bin/chat-open.sh +7 -1
- package/apps/studio/bin/draw-proof.sh +6 -2
- package/apps/studio/bin/generate.sh +32 -10
- package/apps/studio/bin/handoff.sh +2 -2
- package/apps/studio/bin/perf.sh +96 -15
- package/apps/studio/bin/photo-adjust.sh +6 -3
- package/apps/studio/bin/photo-bg-remove.sh +2 -2
- package/apps/studio/bin/prep.sh +21 -4
- package/apps/studio/bin/read-annotations.mjs +3 -0
- package/apps/studio/bin/runtime-health.sh +27 -1
- package/apps/studio/bin/screenshot.sh +152 -12
- package/apps/studio/bin/server-up.sh +64 -6
- package/apps/studio/bin/smoke.sh +43 -8
- package/apps/studio/bin/to-lottie.sh +3 -2
- package/apps/studio/bin/video-proxy.sh +27 -0
- package/apps/studio/bin/visual-sanity.sh +3 -1
- package/apps/studio/bridge/dgn-protocol.ts +157 -1
- package/apps/studio/bridge/mode-shows.ts +8 -6
- package/apps/studio/bridge/still-webp.ts +233 -0
- package/apps/studio/build.ts +18 -0
- package/apps/studio/canvas-build.ts +93 -11
- package/apps/studio/canvas-comment-mount.tsx +53 -8
- package/apps/studio/canvas-edit.ts +34 -1
- package/apps/studio/canvas-lib-module.ts +210 -0
- package/apps/studio/canvas-lib.tsx +3 -12
- package/apps/studio/canvas-pipeline.ts +111 -5
- package/apps/studio/canvas-shell.tsx +8 -11
- package/apps/studio/canvas-theme-pill.tsx +5 -3
- package/apps/studio/check/index.ts +12 -5
- package/apps/studio/check/video.ts +18 -2
- package/apps/studio/client/app.jsx +65 -7
- package/apps/studio/client/clipboard-relay.ts +193 -16
- package/apps/studio/client/comments-overlay.css +18 -0
- package/apps/studio/client/export-center.jsx +30 -0
- package/apps/studio/client/generate-dialog.jsx +49 -4
- package/apps/studio/client/github.js +7 -0
- package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
- package/apps/studio/client/home/HomeConnection.jsx +111 -0
- package/apps/studio/client/home/home-accounts-model.js +110 -1
- package/apps/studio/client/home/home-api.js +9 -2
- package/apps/studio/client/home/home-app.jsx +126 -13
- package/apps/studio/client/home/home-model.js +69 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +239 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +173 -98
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +5 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/DiffView.jsx +7 -1
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/panels/chat-context.js +2 -0
- package/apps/studio/client/panels/slash-commands.gen.js +13 -13
- package/apps/studio/client/selection-scope.js +16 -9
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/shell/viewport.jsx +11 -1
- package/apps/studio/client/shell-events.js +8 -0
- package/apps/studio/client/styles/3-kit-maude-v2.css +16 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/ai/Feed.jsx +1 -1
- package/apps/studio/client/v2/ai/OfferCard.jsx +34 -0
- package/apps/studio/client/v2/ai/activity-line.js +54 -1
- package/apps/studio/client/v2/ai/ai-offer.js +21 -1
- package/apps/studio/client/v2/ai/run-model.js +3 -1
- package/apps/studio/client/v2/annotations/vote-store.js +28 -4
- package/apps/studio/client/v2/assets/asset-drop-session.js +37 -2
- package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +7 -5
- package/apps/studio/client/v2/assets/details-model.js +1 -1
- package/apps/studio/client/v2/assets/details.jsx +5 -0
- package/apps/studio/client/v2/assets/tile-drag.js +11 -7
- package/apps/studio/client/v2/comments/comments-panel.jsx +22 -3
- package/apps/studio/client/v2/create/duplicate-done.js +6 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +113 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +343 -6
- package/apps/studio/client/v2/diagnostics/sync-details/unsynced-refs.js +55 -0
- package/apps/studio/client/v2/ds/review.css +1 -1
- package/apps/studio/client/v2/export/exports-model.js +7 -0
- package/apps/studio/client/v2/export/exports-panel.jsx +1 -0
- package/apps/studio/client/v2/export/job-row.jsx +32 -2
- package/apps/studio/client/v2/handoff/ready-card.jsx +1 -1
- package/apps/studio/client/v2/history/compare-view.jsx +1 -0
- package/apps/studio/client/v2/inspector/css-write.js +6 -1
- package/apps/studio/client/v2/inspector/frame.jsx +28 -4
- package/apps/studio/client/v2/inspector/kinds/clip-model.js +51 -0
- package/apps/studio/client/v2/inspector/kinds/clip.jsx +75 -2
- package/apps/studio/client/v2/inspector/model.js +21 -0
- package/apps/studio/client/v2/inspector/sections/fill.jsx +12 -3
- package/apps/studio/client/v2/inspector/sections/recent-colours.js +8 -5
- package/apps/studio/client/v2/inspector/view-mode.jsx +11 -1
- package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/preview/link-follow.js +4 -2
- package/apps/studio/client/v2/preview/preview-chrome-host.jsx +16 -6
- package/apps/studio/client/v2/search/help-model.js +2 -0
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +344 -137
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +155 -24
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +100 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/share/share-sheet.jsx +28 -11
- package/apps/studio/client/v2/shell/api-session-boot.js +6 -0
- package/apps/studio/client/v2/shell/api-session.js +126 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/floating-panels.css +31 -1
- package/apps/studio/client/v2/shell/image-pick.js +61 -8
- package/apps/studio/client/v2/shell/menu-aim.js +43 -0
- package/apps/studio/client/v2/shell/menu-runner.js +25 -7
- package/apps/studio/client/v2/shell/occlusion-insets.js +18 -1
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/project-pill.jsx +52 -6
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +71 -36
- package/apps/studio/client/v2/shell/still-bridge.js +194 -0
- package/apps/studio/client/v2/shell/still-store.js +319 -0
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/shell/use-tool-panels.js +2 -1
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/client/v2/timeline/Timeline.jsx +15 -0
- package/apps/studio/client/v2/timeline/frame-handle-model.js +142 -0
- package/apps/studio/client/v2/timeline/frame-handle.jsx +151 -0
- package/apps/studio/clip-ops.ts +126 -8
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/collab/ai-activity.ts +10 -8
- package/apps/studio/collab/awareness-bridge.ts +34 -9
- package/apps/studio/collab/index.ts +3 -0
- package/apps/studio/collab/registry.ts +41 -10
- package/apps/studio/comment-reattach.ts +149 -0
- package/apps/studio/comments/mine-stamp.ts +15 -7
- package/apps/studio/comments/ops.ts +52 -8
- package/apps/studio/comments-overlay.tsx +146 -9
- package/apps/studio/dist/client.bundle.js +892 -885
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/dom-selection.ts +87 -18
- package/apps/studio/ds/board/directions.css +8 -0
- package/apps/studio/ds/board/outline.tsx +16 -0
- package/apps/studio/ds/canvas-check.ts +6 -0
- package/apps/studio/edit-ops/clip/reframe.ts +19 -3
- package/apps/studio/edit-ops/clip-carry.ts +602 -0
- package/apps/studio/edit-ops/clipboard.ts +318 -23
- package/apps/studio/edit-ops/dispatch.ts +20 -2
- package/apps/studio/edit-ops/scope-names.ts +249 -40
- package/apps/studio/edit-ops/slot-defaults.ts +3 -0
- package/apps/studio/edit-ops/types.ts +6 -0
- package/apps/studio/editing/align-bar.tsx +33 -9
- package/apps/studio/editing/artboard-actions.ts +5 -0
- package/apps/studio/editing/artboard-menu.tsx +6 -2
- package/apps/studio/editing/click-to-type.ts +1 -1
- package/apps/studio/editing/clip-words.ts +48 -0
- package/apps/studio/editing/clipboard.ts +21 -6
- package/apps/studio/editing/declared-background.ts +25 -0
- package/apps/studio/editing/index.tsx +3 -0
- package/apps/studio/editing/object-keys.ts +4 -4
- package/apps/studio/editing/object-menu.tsx +13 -3
- package/apps/studio/editing/pen/points.tsx +61 -0
- package/apps/studio/editing/text-in-place.tsx +11 -0
- package/apps/studio/editing/video-frame-handle.tsx +425 -0
- package/apps/studio/exporters/capture-prepass.ts +374 -0
- package/apps/studio/exporters/degraded.ts +148 -0
- package/apps/studio/exporters/hub-render-door.ts +28 -2
- package/apps/studio/exporters/index.ts +3 -1
- package/apps/studio/exporters/job-budget.ts +93 -0
- package/apps/studio/exporters/jobs.ts +215 -28
- package/apps/studio/exporters/parity-check.ts +254 -0
- package/apps/studio/exporters/remote.ts +209 -15
- package/apps/studio/exporters/svg-inline.ts +87 -0
- package/apps/studio/exporters/video-render-lib.ts +88 -26
- package/apps/studio/exporters/video.ts +29 -6
- package/apps/studio/figma/assets.ts +58 -43
- package/apps/studio/figma/codegen-fonts.ts +100 -0
- package/apps/studio/figma/fig-decode.ts +390 -25
- package/apps/studio/figma/fig-kiwi.ts +18 -4
- package/apps/studio/figma/fig-vector.ts +59 -3
- package/apps/studio/figma/sanitize.ts +2 -0
- package/apps/studio/figma/style-map.ts +293 -48
- package/apps/studio/figma/to-artboard.ts +455 -69
- package/apps/studio/figma/to-strokes.ts +44 -11
- package/apps/studio/figma/types.ts +13 -0
- package/apps/studio/footage/schema.ts +3 -3
- package/apps/studio/generation/adapters/elevenlabs.ts +7 -1
- package/apps/studio/generation/adapters/groq.ts +8 -1
- package/apps/studio/generation/spend.ts +312 -0
- package/apps/studio/generation/types.ts +12 -0
- package/apps/studio/handoff/run.ts +1 -1
- package/apps/studio/handoff/targets.ts +2 -2
- package/apps/studio/handoff/write-scopes.ts +1 -1
- package/apps/studio/history/describe-annotations.ts +4 -0
- package/apps/studio/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/create-local.ts +32 -3
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +15 -4
- package/apps/studio/http.ts +438 -86
- package/apps/studio/imported-module-ids.ts +91 -0
- package/apps/studio/inspect.ts +2 -0
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/notifications.tsx +47 -5
- package/apps/studio/paths.ts +10 -1
- package/apps/studio/port.ts +3 -2
- package/apps/studio/preview/preview-camera.tsx +15 -382
- package/apps/studio/readiness.ts +10 -1
- package/apps/studio/release-build.ts +51 -0
- package/apps/studio/routes/agent.ts +188 -9
- package/apps/studio/routes/ai.ts +43 -11
- package/apps/studio/routes/annotations.ts +27 -1
- package/apps/studio/routes/assets.ts +18 -1
- package/apps/studio/routes/canvas-origin.ts +12 -9
- package/apps/studio/routes/cloud-move.ts +15 -0
- package/apps/studio/routes/edit.ts +3 -0
- package/apps/studio/routes/export.ts +51 -0
- package/apps/studio/routes/generate.ts +42 -12
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +9 -1
- package/apps/studio/routes/shell.ts +217 -5
- package/apps/studio/routes/sync.ts +136 -8
- package/apps/studio/routes/votes.ts +2 -1
- package/apps/studio/schema/annotations.v2.schema.json +143 -1
- package/apps/studio/schema/beats.v1.schema.json +1 -1
- package/apps/studio/schema/edl.v1.schema.json +1 -1
- package/apps/studio/schema/formats.ts +3 -3
- package/apps/studio/schema/transcript.v1.schema.json +1 -1
- package/apps/studio/server.ts +142 -43
- package/apps/studio/shell/api-key.ts +503 -0
- package/apps/studio/shell/attest.ts +59 -0
- package/apps/studio/shell/capture-url.ts +20 -0
- package/apps/studio/shell/cli-yield.ts +276 -0
- package/apps/studio/shell/clip-transfer.ts +302 -0
- package/apps/studio/shell/key-file.ts +108 -0
- package/apps/studio/shell/server-json.ts +75 -0
- package/apps/studio/shell/worktree.ts +19 -0
- package/apps/studio/spoof-chars.ts +9 -0
- package/apps/studio/studio-page-host.ts +1 -1
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/accepted-link.ts +76 -29
- package/apps/studio/sync/action-stage.ts +575 -44
- package/apps/studio/sync/adopt-held.ts +85 -0
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-membership.ts +16 -1
- package/apps/studio/sync/file-plane.ts +289 -22
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +196 -12
- package/apps/studio/sync/journal-client.ts +50 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +296 -8
- package/apps/studio/sync/projection.ts +22 -3
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +59 -3
- package/apps/studio/sync/status.ts +19 -2
- package/apps/studio/sync/unsynced-refs.ts +397 -0
- package/apps/studio/sync/writer-registry.ts +20 -0
- package/apps/studio/thumbs/service.ts +4 -1
- package/apps/studio/tool-palette.tsx +23 -0
- package/apps/studio/ui-prefs.ts +40 -0
- package/apps/studio/use-agent-presence.tsx +2 -2
- package/apps/studio/use-canvas-keys.ts +6 -1
- package/apps/studio/video/format-ids.ts +2 -2
- package/apps/studio/video/inject.ts +31 -0
- package/apps/studio/video/media-risk.ts +58 -0
- package/apps/studio/video/object-fit.ts +137 -0
- package/apps/studio/video/provider-transcript.ts +141 -0
- package/apps/studio/whats-new.json +137 -0
- package/apps/studio/workspace-mode.ts +1 -0
- package/apps/studio/ws.ts +5 -0
- package/cli/commands/design.mjs +119 -8
- package/cli/lib/bash-guard.mjs +366 -6
- package/cli/lib/confine-read.mjs +1 -0
- package/cli/lib/design-help.gen.mjs +3 -2
- package/cli/lib/design-hook.mjs +387 -81
- package/cli/lib/design-link.mjs +16 -1
- package/cli/lib/design-open.mjs +49 -3
- package/cli/lib/desktop-locate.mjs +770 -0
- package/cli/lib/handoff.mjs +1 -1
- package/cli/lib/hook-state.mjs +291 -0
- package/cli/lib/pkg-root.mjs +65 -13
- package/cli/lib/studio-locate.mjs +59 -16
- package/package.json +15 -8
- package/plugins/design/templates/_shell.html +13 -0
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// client/v2/shell/still-store.js — #212 §5 (T2.2): the overview stills, kept across sessions by the SHELL.
|
|
2
|
+
//
|
|
3
|
+
// The canvas frame (untrusted origin, DDR-054) never reaches this store: it only posts a still over the typed
|
|
4
|
+
// bridge, and client/v2/shell/still-bridge.js decides the key. This module holds the bytes and the caps:
|
|
5
|
+
//
|
|
6
|
+
// one record per (pid, scope, artboard) scope = a SHA-256 of the frame's capability for its canvas (C4), chosen
|
|
7
|
+
// by the shell (the capability itself is never written down)
|
|
8
|
+
// src = the index's srcHash:metaHash:depsHash at write time; `list` returns only records of the CURRENT src and
|
|
9
|
+
// deletes the others (a changed canvas never shows a stale still)
|
|
10
|
+
// caps = 256 kB a still (and a real still WebP or single-image PNG, bridge/still-webp.ts) · 8 MB and 2000 stills a canvas · 32 MB a
|
|
11
|
+
// project · 96 MB the store · 300 writes and 2 MB a minute a canvas
|
|
12
|
+
// eviction: a canvas pays for its own writes first (its own records used longest ago); another canvas's records go
|
|
13
|
+
// only when the project or store cap still holds after that, oldest first — so one canvas's writes neither
|
|
14
|
+
// flush another canvas nor tell it anything about that canvas's use
|
|
15
|
+
//
|
|
16
|
+
// Storage: the main origin's IndexedDB (`maude-stills`) — the app's own data store in the desktop shell, the
|
|
17
|
+
// browser profile's otherwise; never the design root (not synced, not committed). No IndexedDB, or one that
|
|
18
|
+
// fails: the store answers nothing and keeps nothing. Contract: client/v2/contracts/212-still-cache.md §5.
|
|
19
|
+
|
|
20
|
+
import { checkStillImage, STILL_PERSIST_MAX_BYTES } from '../../../bridge/still-webp.ts';
|
|
21
|
+
|
|
22
|
+
export const STILL_PROJECT_MAX_BYTES = 32 * 1024 * 1024;
|
|
23
|
+
export const STILL_STORE_MAX_BYTES = 96 * 1024 * 1024;
|
|
24
|
+
export const STILL_CANVAS_MAX = 2000;
|
|
25
|
+
/** A canvas's share of the project cap. */
|
|
26
|
+
export const STILL_CANVAS_MAX_BYTES = 8 * 1024 * 1024;
|
|
27
|
+
export const STILL_WRITES_PER_MINUTE = 300;
|
|
28
|
+
export const STILL_BYTES_PER_MINUTE = 2 * 1024 * 1024;
|
|
29
|
+
/** A read refreshes a record's place in the eviction order only when its last refresh is older than this. */
|
|
30
|
+
export const STILL_TOUCH_AFTER_MS = 10 * 60_000;
|
|
31
|
+
/** The record shape. Records of another shape (the first one, keyed on the plain capability) are dropped. */
|
|
32
|
+
export const STILL_RECORD_V = 2;
|
|
33
|
+
const MAX_PART = 2048;
|
|
34
|
+
|
|
35
|
+
const okPart = (s) =>
|
|
36
|
+
typeof s === 'string' && s.length > 0 && s.length <= MAX_PART && !s.includes('\0');
|
|
37
|
+
const keyOf = (pid, scope, artboard) => `${pid}\0${scope}\0${artboard}`;
|
|
38
|
+
|
|
39
|
+
/** An in-memory backend (tests; also the shape the IndexedDB one keeps). */
|
|
40
|
+
export function memoryStillBackend() {
|
|
41
|
+
const meta = new Map();
|
|
42
|
+
const bytes = new Map();
|
|
43
|
+
return {
|
|
44
|
+
async loadMeta() {
|
|
45
|
+
return [...meta.values()].map((m) => ({ ...m }));
|
|
46
|
+
},
|
|
47
|
+
async getBytes(k) {
|
|
48
|
+
// a copy, as IndexedDB gives: the bridge transfers (detaches) the answer's buffers
|
|
49
|
+
return bytes.get(k)?.slice(0) ?? null;
|
|
50
|
+
},
|
|
51
|
+
async put(m, b) {
|
|
52
|
+
meta.set(m.k, { ...m });
|
|
53
|
+
bytes.set(m.k, b);
|
|
54
|
+
},
|
|
55
|
+
/** Several records' new `at` in one go (IndexedDB: one transaction). */
|
|
56
|
+
async touch(ms) {
|
|
57
|
+
for (const m of ms) if (meta.has(m.k)) meta.set(m.k, { ...m });
|
|
58
|
+
},
|
|
59
|
+
/** tests: a raw record, as an older build wrote it */
|
|
60
|
+
_raw(m, b) {
|
|
61
|
+
meta.set(m.k, { ...m });
|
|
62
|
+
bytes.set(m.k, b);
|
|
63
|
+
},
|
|
64
|
+
async del(keys) {
|
|
65
|
+
for (const k of keys) {
|
|
66
|
+
meta.delete(k);
|
|
67
|
+
bytes.delete(k);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
/** tests: what is on "disk" */
|
|
71
|
+
_keys: () => [...meta.keys()],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const DB_NAME = 'maude-stills';
|
|
76
|
+
const DB_VERSION = 1;
|
|
77
|
+
|
|
78
|
+
/** The IndexedDB backend: `meta` (keyPath `k`) and `bytes` (out-of-line, same key). Null when there is none. */
|
|
79
|
+
export function idbStillBackend(idb = typeof indexedDB !== 'undefined' ? indexedDB : null) {
|
|
80
|
+
if (!idb) return null;
|
|
81
|
+
let dbp = null;
|
|
82
|
+
const db = () => {
|
|
83
|
+
dbp ??= new Promise((res, rej) => {
|
|
84
|
+
let req;
|
|
85
|
+
try {
|
|
86
|
+
req = idb.open(DB_NAME, DB_VERSION);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
rej(err);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
req.onupgradeneeded = () => {
|
|
92
|
+
const d = req.result;
|
|
93
|
+
if (!d.objectStoreNames.contains('meta')) d.createObjectStore('meta', { keyPath: 'k' });
|
|
94
|
+
if (!d.objectStoreNames.contains('bytes')) d.createObjectStore('bytes');
|
|
95
|
+
};
|
|
96
|
+
req.onsuccess = () => res(req.result);
|
|
97
|
+
req.onerror = () => rej(req.error);
|
|
98
|
+
req.onblocked = () => rej(new Error('blocked'));
|
|
99
|
+
});
|
|
100
|
+
return dbp;
|
|
101
|
+
};
|
|
102
|
+
const run = async (mode, fn) => {
|
|
103
|
+
const d = await db();
|
|
104
|
+
return new Promise((res, rej) => {
|
|
105
|
+
const tx = d.transaction(['meta', 'bytes'], mode);
|
|
106
|
+
let out;
|
|
107
|
+
tx.oncomplete = () => res(out);
|
|
108
|
+
tx.onerror = () => rej(tx.error);
|
|
109
|
+
tx.onabort = () => rej(tx.error);
|
|
110
|
+
out = fn(tx.objectStore('meta'), tx.objectStore('bytes'));
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
async loadMeta() {
|
|
115
|
+
const d = await db();
|
|
116
|
+
return new Promise((res, rej) => {
|
|
117
|
+
const req = d.transaction('meta', 'readonly').objectStore('meta').getAll();
|
|
118
|
+
req.onsuccess = () => res(Array.isArray(req.result) ? req.result : []);
|
|
119
|
+
req.onerror = () => rej(req.error);
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
async getBytes(k) {
|
|
123
|
+
const d = await db();
|
|
124
|
+
return new Promise((res, rej) => {
|
|
125
|
+
const req = d.transaction('bytes', 'readonly').objectStore('bytes').get(k);
|
|
126
|
+
req.onsuccess = () => res(req.result ?? null);
|
|
127
|
+
req.onerror = () => rej(req.error);
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
put: (m, b) =>
|
|
131
|
+
run('readwrite', (meta, bytes) => {
|
|
132
|
+
meta.put(m);
|
|
133
|
+
bytes.put(b, m.k);
|
|
134
|
+
}),
|
|
135
|
+
touch: (ms) =>
|
|
136
|
+
run('readwrite', (meta) => {
|
|
137
|
+
for (const m of ms) meta.put(m);
|
|
138
|
+
}),
|
|
139
|
+
del: (keys) =>
|
|
140
|
+
run('readwrite', (meta, bytes) => {
|
|
141
|
+
for (const k of keys) {
|
|
142
|
+
meta.delete(k);
|
|
143
|
+
bytes.delete(k);
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The store. `put` and `list` never throw: a failing backend is the same as no store.
|
|
151
|
+
* Records: `{ v, k, pid, scope, artboard, src, sig, size, at }` + the bytes beside them.
|
|
152
|
+
*/
|
|
153
|
+
export function createStillStore({ backend = idbStillBackend(), now = () => Date.now() } = {}) {
|
|
154
|
+
let metas = null; // Map k → meta, loaded once
|
|
155
|
+
let loading = null;
|
|
156
|
+
const writes = new Map(); // `${pid}\0${scope}` → [time, bytes] of its writes in the last minute
|
|
157
|
+
let tick = 0;
|
|
158
|
+
const stamp = () => Math.max(now(), ++tick);
|
|
159
|
+
const load = async () => {
|
|
160
|
+
if (metas) return metas;
|
|
161
|
+
loading ??= (async () => {
|
|
162
|
+
const m = new Map();
|
|
163
|
+
const old = [];
|
|
164
|
+
try {
|
|
165
|
+
for (const r of (await backend?.loadMeta()) ?? []) {
|
|
166
|
+
if (!r || typeof r.k !== 'string') continue;
|
|
167
|
+
if (r.v === STILL_RECORD_V && Number.isFinite(r.size)) m.set(r.k, r);
|
|
168
|
+
else old.push(r.k);
|
|
169
|
+
}
|
|
170
|
+
} catch {
|
|
171
|
+
/* no store: an empty one */
|
|
172
|
+
}
|
|
173
|
+
metas = m;
|
|
174
|
+
if (old.length) {
|
|
175
|
+
try {
|
|
176
|
+
await backend?.del(old);
|
|
177
|
+
} catch {}
|
|
178
|
+
}
|
|
179
|
+
return m;
|
|
180
|
+
})();
|
|
181
|
+
return loading;
|
|
182
|
+
};
|
|
183
|
+
const drop = async (keys) => {
|
|
184
|
+
if (!keys.length) return;
|
|
185
|
+
for (const k of keys) metas?.delete(k);
|
|
186
|
+
try {
|
|
187
|
+
await backend?.del(keys);
|
|
188
|
+
} catch {}
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Over a cap: records leave until `over()` is false — first `own` (the writing canvas's, used longest ago first),
|
|
192
|
+
* then `rest` (oldest first). The record just written is in neither.
|
|
193
|
+
*/
|
|
194
|
+
const evict = async (own, rest, over) => {
|
|
195
|
+
const out = [];
|
|
196
|
+
const byAge = (rs) => [...rs].sort((x, y) => x.at - y.at);
|
|
197
|
+
for (const r of [...byAge(own), ...byAge(rest)]) {
|
|
198
|
+
if (!over()) break;
|
|
199
|
+
if (!metas.has(r.k)) continue;
|
|
200
|
+
out.push(r.k);
|
|
201
|
+
metas.delete(r.k);
|
|
202
|
+
}
|
|
203
|
+
await drop(out);
|
|
204
|
+
};
|
|
205
|
+
/** One canvas's write rate: writes and bytes in the last minute. */
|
|
206
|
+
const rateOk = (pid, scope, size) => {
|
|
207
|
+
const id = `${pid}\0${scope}`;
|
|
208
|
+
const t = now();
|
|
209
|
+
const list = (writes.get(id) ?? []).filter((x) => t - x[0] < 60_000);
|
|
210
|
+
const sent = list.reduce((n, x) => n + x[1], 0);
|
|
211
|
+
if (list.length >= STILL_WRITES_PER_MINUTE || sent + size > STILL_BYTES_PER_MINUTE) {
|
|
212
|
+
writes.set(id, list);
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
list.push([t, size]);
|
|
216
|
+
writes.set(id, list);
|
|
217
|
+
return true;
|
|
218
|
+
};
|
|
219
|
+
return {
|
|
220
|
+
/** Keep one still. False when it is refused (not a still WebP / PNG, too big, over the write rate, no store). */
|
|
221
|
+
async put({ pid, scope, src, artboard, sig, bytes }) {
|
|
222
|
+
if (!backend) return false;
|
|
223
|
+
if (![pid, scope, src, artboard].every(okPart) || typeof sig !== 'string' || sig.length > 200)
|
|
224
|
+
return false;
|
|
225
|
+
const check = checkStillImage(bytes);
|
|
226
|
+
if (!check.ok) return false;
|
|
227
|
+
const size = bytes.byteLength;
|
|
228
|
+
if (size > STILL_PERSIST_MAX_BYTES) return false;
|
|
229
|
+
if (!rateOk(pid, scope, size)) return false;
|
|
230
|
+
const m = await load();
|
|
231
|
+
const k = keyOf(pid, scope, artboard);
|
|
232
|
+
const rec = { v: STILL_RECORD_V, k, pid, scope, artboard, src, sig, size, at: stamp() };
|
|
233
|
+
const prev = m.get(k);
|
|
234
|
+
m.set(k, rec);
|
|
235
|
+
const live = (pred) => [...m.values()].filter(pred);
|
|
236
|
+
const sum = (rs) => rs.reduce((n, r) => n + r.size, 0);
|
|
237
|
+
const mine = (r) => r.pid === pid && r.scope === scope;
|
|
238
|
+
const ownOld = () => live((r) => mine(r) && r.k !== k);
|
|
239
|
+
// 1. the canvas's own count and its share of the project: only its own records go
|
|
240
|
+
await evict(ownOld(), [], () => {
|
|
241
|
+
const rs = live(mine);
|
|
242
|
+
return rs.length > STILL_CANVAS_MAX || sum(rs) > STILL_CANVAS_MAX_BYTES;
|
|
243
|
+
});
|
|
244
|
+
// 2. the project, 3. the store: the writer's own records first, then the oldest of the others
|
|
245
|
+
await evict(
|
|
246
|
+
ownOld(),
|
|
247
|
+
live((r) => r.pid === pid && !mine(r)),
|
|
248
|
+
() => sum(live((r) => r.pid === pid)) > STILL_PROJECT_MAX_BYTES
|
|
249
|
+
);
|
|
250
|
+
await evict(
|
|
251
|
+
ownOld(),
|
|
252
|
+
live((r) => !mine(r)),
|
|
253
|
+
() => sum(live(() => true)) > STILL_STORE_MAX_BYTES
|
|
254
|
+
);
|
|
255
|
+
try {
|
|
256
|
+
await backend.put(rec, bytes.slice(0));
|
|
257
|
+
return true;
|
|
258
|
+
} catch {
|
|
259
|
+
if (prev) m.set(k, prev);
|
|
260
|
+
else m.delete(k);
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
/**
|
|
265
|
+
* The stills of one canvas scope at the current `src`: `[{ artboard, sig, bytes }]`. Records of any other src
|
|
266
|
+
* are deleted (their canvas changed). A record whose bytes fail the check again is deleted too.
|
|
267
|
+
*/
|
|
268
|
+
async list({ pid, scope, src }) {
|
|
269
|
+
if (!backend || ![pid, scope, src].every(okPart)) return [];
|
|
270
|
+
const m = await load();
|
|
271
|
+
const mine = [...m.values()].filter((r) => r.pid === pid && r.scope === scope);
|
|
272
|
+
await drop(mine.filter((r) => r.src !== src).map((r) => r.k));
|
|
273
|
+
const out = [];
|
|
274
|
+
const bad = [];
|
|
275
|
+
const touched = [];
|
|
276
|
+
const t = now();
|
|
277
|
+
for (const r of mine) {
|
|
278
|
+
if (r.src !== src) continue;
|
|
279
|
+
let bytes = null;
|
|
280
|
+
try {
|
|
281
|
+
bytes = await backend.getBytes(r.k);
|
|
282
|
+
} catch {
|
|
283
|
+
bytes = null;
|
|
284
|
+
}
|
|
285
|
+
if (!checkStillImage(bytes).ok) {
|
|
286
|
+
bad.push(r.k);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
// a read refreshes the eviction order: only a record not refreshed lately, all in one write
|
|
290
|
+
if (t - r.at > STILL_TOUCH_AFTER_MS) {
|
|
291
|
+
r.at = stamp();
|
|
292
|
+
touched.push(r);
|
|
293
|
+
}
|
|
294
|
+
out.push({ artboard: r.artboard, sig: r.sig, bytes });
|
|
295
|
+
}
|
|
296
|
+
if (touched.length) {
|
|
297
|
+
try {
|
|
298
|
+
await backend.touch(touched);
|
|
299
|
+
} catch {}
|
|
300
|
+
}
|
|
301
|
+
await drop(bad);
|
|
302
|
+
return out;
|
|
303
|
+
},
|
|
304
|
+
/** tests + diagnostics */
|
|
305
|
+
async stats() {
|
|
306
|
+
const m = await load();
|
|
307
|
+
let bytes = 0;
|
|
308
|
+
for (const r of m.values()) bytes += r.size;
|
|
309
|
+
return { n: m.size, bytes };
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
let shared = null;
|
|
315
|
+
/** The page's one store (lazily opened). */
|
|
316
|
+
export function stillStore() {
|
|
317
|
+
shared ??= createStillStore();
|
|
318
|
+
return shared;
|
|
319
|
+
}
|
|
@@ -31,6 +31,8 @@ export function useAccount(enabled) {
|
|
|
31
31
|
// 2.0.5 W4 — the project account card's kind: the cloud address and this folder's link
|
|
32
32
|
cloudUrl: typeof j?.url === 'string' ? j.url : '',
|
|
33
33
|
linkedHub: j?.linkedHub ?? null,
|
|
34
|
+
// 2.1.1 T2 — where the project lives: { kept } | { kept: false, folder }
|
|
35
|
+
place: j?.place && typeof j.place === 'object' ? j.place : null,
|
|
34
36
|
}));
|
|
35
37
|
})
|
|
36
38
|
.catch(() => {
|
|
@@ -194,7 +194,8 @@ export function useToolPanels({
|
|
|
194
194
|
now: () => Date.now(),
|
|
195
195
|
openAssets: () => live.current.openAssets(),
|
|
196
196
|
// TD10 — the picture picker posts its pick to the canvas that asked, on the canvas origin only
|
|
197
|
-
|
|
197
|
+
// #168 F1: the shell's chip first; only its click opens the dialog
|
|
198
|
+
pickImage: (canvas) => void imagePick().ask(canvas),
|
|
198
199
|
openGenerate: () => menuRunner.run('assets.generate'),
|
|
199
200
|
});
|
|
200
201
|
const lane = laneRef.current;
|
|
@@ -58,7 +58,7 @@ export function useCloudSignIn({ native, onSignedIn, now = Date.now }) {
|
|
|
58
58
|
};
|
|
59
59
|
let profile;
|
|
60
60
|
try {
|
|
61
|
-
profile = await signInPrepare(opts.forInvite);
|
|
61
|
+
profile = await signInPrepare(opts.forInvite, opts.profile);
|
|
62
62
|
} catch (e) {
|
|
63
63
|
fail(wordsOf(e));
|
|
64
64
|
return;
|
|
@@ -60,6 +60,7 @@ import { deriveTracks } from './tracks.js';
|
|
|
60
60
|
import { isBand } from './transport.js';
|
|
61
61
|
import { KeptStatus, SharedStatus, SizeButton } from './island-controls.jsx';
|
|
62
62
|
import { OtherTakesHost } from './other-takes.jsx';
|
|
63
|
+
import { FrameHandleHost } from './frame-handle.jsx';
|
|
63
64
|
import { ReframeHost } from './reframe-island.jsx';
|
|
64
65
|
import { bindClips } from './clip-search.js';
|
|
65
66
|
import { FOLD_WORDS, FOLDABLE, trackFold, useFoldVersion } from './fold.js';
|
|
@@ -1248,6 +1249,8 @@ export default function TimelinePanel({
|
|
|
1248
1249
|
titleMotion: selSeq.titleMotion ?? null,
|
|
1249
1250
|
titleStyle: selSeq.titleStyle ?? null,
|
|
1250
1251
|
fit: selSeq.fit ?? null,
|
|
1252
|
+
// #128 §5: the inspector's Zoom / Focus rows read the clip's <Reframe>
|
|
1253
|
+
reframe: selSeq.reframe ?? null,
|
|
1251
1254
|
rowKind: rowKind(selSeq),
|
|
1252
1255
|
},
|
|
1253
1256
|
transitionAfter:
|
|
@@ -3087,6 +3090,18 @@ export default function TimelinePanel({
|
|
|
3087
3090
|
url={selSeq?.mediaSrc ? resolveUrl(selSeq.mediaSrc) : null}
|
|
3088
3091
|
run={(params) => selSeq && onClipVerb?.(refFor(selSeq, selIndex), 'video.reframe', params)}
|
|
3089
3092
|
/>
|
|
3093
|
+
{/* #128 §5 (T3.6b) — the selected clip's pan / zoom handle on the canvas (drawn there only while it is on) */}
|
|
3094
|
+
<FrameHandleHost
|
|
3095
|
+
seq={selSeq}
|
|
3096
|
+
comp={comp}
|
|
3097
|
+
fps={fps}
|
|
3098
|
+
frame={frame}
|
|
3099
|
+
name={selSeq ? displayNameOf(selSeq, selIndex) : ''}
|
|
3100
|
+
artboardId={comp?.artboardId ?? null}
|
|
3101
|
+
canEdit={canEditHere && !!onClipVerb}
|
|
3102
|
+
url={selSeq?.mediaSrc ? resolveUrl(selSeq.mediaSrc) : null}
|
|
3103
|
+
run={(params) => selSeq && onClipVerb?.(refFor(selSeq, selIndex), 'video.reframe', params)}
|
|
3104
|
+
/>
|
|
3090
3105
|
{/* S7.15 — Other takes: the selected clip's other good moments, swapped in at the same length (07 · ve-ai-adjust) */}
|
|
3091
3106
|
<OtherTakesHost
|
|
3092
3107
|
seq={selSeq}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// client/v2/timeline/frame-handle-model.js — #128 §5 (T3.6b): the shell's words for the on-canvas pan / zoom handle.
|
|
2
|
+
//
|
|
3
|
+
// "The user's first instinct was to drag the video's corners in the preview." The Timeline owns the selected clip and the
|
|
4
|
+
// one write pipe; the canvas (editing/video-frame-handle.tsx) only draws the handle over the clip's artboard and reports
|
|
5
|
+
// where the person left the picture. This file is what crosses: what the shell tells the canvas (`video-frame-handle`) and
|
|
6
|
+
// how the canvas's report becomes ONE `video.reframe` — the write the clip inspector's Zoom / Focus rows make, so undo, the
|
|
7
|
+
// toast and a refusal are theirs.
|
|
8
|
+
//
|
|
9
|
+
// The numbers are the renderer's (`video/framing.ts` `focusAt`): this artboard's own per-format keys win, then the shared
|
|
10
|
+
// ones, then the centre. A pan writes where those keys live — the artboard's format when it has its own framing, else the
|
|
11
|
+
// shared focus — and a focus that moves over time gets a keyframe at the playhead (source time), like the Re-frame island.
|
|
12
|
+
//
|
|
13
|
+
// Pure, apart from the toggle (a per-viewer UI fact, never stored).
|
|
14
|
+
|
|
15
|
+
import { aspectKey, focusAt } from '../../../video/framing.ts';
|
|
16
|
+
import { dropParams, keysFor, playheadSourceSec } from './reframe-model.js';
|
|
17
|
+
|
|
18
|
+
const PICTURE_TAGS = ['Video', 'OffthreadVideo', 'MaudeVideo', 'Img'];
|
|
19
|
+
export const LABEL_MAX = 120;
|
|
20
|
+
const ZOOM_MIN = 1;
|
|
21
|
+
const ZOOM_MAX = 8;
|
|
22
|
+
|
|
23
|
+
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
24
|
+
const r4 = (v) => Math.round(v * 10000) / 10000;
|
|
25
|
+
const r2 = (v) => Math.round(v * 100) / 100;
|
|
26
|
+
const SAME = 0.0005;
|
|
27
|
+
|
|
28
|
+
// ── the toggle ───────────────────────────────────────────────────────────────────────────────────────────────
|
|
29
|
+
let openFor = null; // { stableId } | null
|
|
30
|
+
let version = 0;
|
|
31
|
+
const subs = new Set();
|
|
32
|
+
const notify = () => {
|
|
33
|
+
version += 1;
|
|
34
|
+
for (const fn of subs) fn();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const frameHandleUi = {
|
|
38
|
+
get: () => openFor,
|
|
39
|
+
/** On or off (the action `video.frame-handle`). On pins nothing yet: the host pins the selected clip. */
|
|
40
|
+
toggle() {
|
|
41
|
+
openFor = openFor ? null : { stableId: null };
|
|
42
|
+
notify();
|
|
43
|
+
},
|
|
44
|
+
close() {
|
|
45
|
+
if (!openFor) return;
|
|
46
|
+
openFor = null;
|
|
47
|
+
notify();
|
|
48
|
+
},
|
|
49
|
+
/** The host pins the clip it opened on; another clip turns the handle off. */
|
|
50
|
+
pin(stableId) {
|
|
51
|
+
if (!openFor || openFor.stableId === stableId) return;
|
|
52
|
+
openFor = openFor.stableId === null ? { stableId } : null;
|
|
53
|
+
notify();
|
|
54
|
+
},
|
|
55
|
+
subscribe(fn) {
|
|
56
|
+
subs.add(fn);
|
|
57
|
+
return () => subs.delete(fn);
|
|
58
|
+
},
|
|
59
|
+
version: () => version,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// ── the rules ────────────────────────────────────────────────────────────────────────────────────────────────
|
|
63
|
+
/** Why the handle will not open on this selection, in the person's words; null when it may. */
|
|
64
|
+
export function frameHandleRefusal(seq) {
|
|
65
|
+
if (!seq || !PICTURE_TAGS.includes(seq.mediaTag ?? ''))
|
|
66
|
+
return 'Select a clip with a picture to move it on the canvas.';
|
|
67
|
+
// Fit and Blur behind letterbox the whole picture: there is nothing to move inside the frame
|
|
68
|
+
if (seq.fit === 'fit' || seq.fit === 'blur')
|
|
69
|
+
return 'Set Framing to Fill to move the picture on the canvas.';
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Where this artboard's framing lives: its own format's keys when it has any, else the shared focus. */
|
|
74
|
+
export function handleScope(reframe, out) {
|
|
75
|
+
const aspect = aspectKey(out.w, out.h);
|
|
76
|
+
return reframe?.formats?.[aspect]?.length
|
|
77
|
+
? { scope: 'format', aspect }
|
|
78
|
+
: { scope: 'all', aspect };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The zoom and the focus the renderer shows for this artboard at the playhead. */
|
|
82
|
+
export function frameHandleState(seq, out, frame, fps) {
|
|
83
|
+
const reframe = seq?.reframe ?? null;
|
|
84
|
+
const t = playheadSourceSec(frame, seq, fps);
|
|
85
|
+
const f = focusAt(t, reframe?.focus, reframe?.formats, out);
|
|
86
|
+
const z = typeof reframe?.zoom === 'number' && reframe.zoom >= 1 ? reframe.zoom : 1;
|
|
87
|
+
return { zoom: z, focus: [r4(f[0]), r4(f[1])] };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The `video-frame-handle` message for the active canvas: the clip, or the clear.
|
|
92
|
+
* @param {{ open: boolean, seq: any, out: {w:number,h:number}|null, frame: number, fps: number,
|
|
93
|
+
* src: {w:number,h:number}|null, artboardId: string|null, label?: string }} p
|
|
94
|
+
*/
|
|
95
|
+
export function frameHandleMessage(p) {
|
|
96
|
+
const { open, seq, out, artboardId } = p;
|
|
97
|
+
if (!open || !artboardId || !out || !seq?.stableId || frameHandleRefusal(seq))
|
|
98
|
+
return { dgn: 'video-frame-handle', v: 1, artboardId: null };
|
|
99
|
+
const s = frameHandleState(seq, out, p.frame, p.fps);
|
|
100
|
+
return {
|
|
101
|
+
dgn: 'video-frame-handle',
|
|
102
|
+
v: 1,
|
|
103
|
+
artboardId,
|
|
104
|
+
stableId: seq.stableId,
|
|
105
|
+
label: String(p.label ?? '').slice(0, LABEL_MAX),
|
|
106
|
+
src: p.src?.w > 0 && p.src?.h > 0 ? { w: p.src.w, h: p.src.h } : null,
|
|
107
|
+
zoom: s.zoom,
|
|
108
|
+
focus: s.focus,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The `video.reframe` params for where the canvas left the picture — or null when nothing changed.
|
|
114
|
+
* @param {{ zoom: number, focus: [number, number] }} next the canvas's report
|
|
115
|
+
*/
|
|
116
|
+
export function frameCommitParams(seq, out, frame, fps, next) {
|
|
117
|
+
const reframe = seq?.reframe ?? null;
|
|
118
|
+
const cur = frameHandleState(seq, out, frame, fps);
|
|
119
|
+
const params = {};
|
|
120
|
+
const z = r2(clamp(Number(next?.zoom) || 1, ZOOM_MIN, ZOOM_MAX));
|
|
121
|
+
if (z !== r2(cur.zoom)) params.zoom = z === 1 ? null : z;
|
|
122
|
+
const fx = r4(clamp(Number(next?.focus?.[0]), 0, 1) || 0);
|
|
123
|
+
const fy = r4(clamp(Number(next?.focus?.[1]), 0, 1) || 0);
|
|
124
|
+
if (Math.abs(fx - cur.focus[0]) > SAME || Math.abs(fy - cur.focus[1]) > SAME) {
|
|
125
|
+
const { scope, aspect } = handleScope(reframe, out);
|
|
126
|
+
const keys = keysFor(reframe, scope, aspect);
|
|
127
|
+
let focus;
|
|
128
|
+
if (keys.length > 1) {
|
|
129
|
+
focus = dropParams(reframe, scope, aspect, playheadSourceSec(frame, seq, fps), [
|
|
130
|
+
fx,
|
|
131
|
+
fy,
|
|
132
|
+
]).focus;
|
|
133
|
+
} else if (Math.abs(fx - 0.5) <= SAME && Math.abs(fy - 0.5) <= SAME) {
|
|
134
|
+
focus = null; // the centre is the default: nothing left to say
|
|
135
|
+
} else {
|
|
136
|
+
focus = [[keys[0]?.[0] ?? 0, fx, fy]];
|
|
137
|
+
}
|
|
138
|
+
params.focus = focus;
|
|
139
|
+
if (scope === 'format') params.format = aspect;
|
|
140
|
+
}
|
|
141
|
+
return Object.keys(params).length ? params : null;
|
|
142
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// client/v2/timeline/frame-handle.jsx — #128 §5 (T3.6b): the shell's wiring of the on-canvas pan / zoom handle.
|
|
2
|
+
//
|
|
3
|
+
// The action `video.frame-handle` (⌘K, the clip inspector's "Move on canvas") turns it on and off. While it is on and a
|
|
4
|
+
// picture clip is selected in the Timeline, this host tells the ACTIVE canvas which clip (`video-frame-handle`) and
|
|
5
|
+
// listens for the canvas's report (`video-frame-commit`, from the active frame only); a report becomes ONE `video.reframe`
|
|
6
|
+
// through the Timeline's clip pipe — the write the inspector's Zoom / Focus rows make. Another clip, a closed Timeline or
|
|
7
|
+
// the action again takes the handle down. The rules are frame-handle-model.js; the drawing is editing/video-frame-handle.tsx.
|
|
8
|
+
|
|
9
|
+
import { useContext, useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
10
|
+
import { acceptFromCanvas } from '../../../bridge/dgn-protocol.ts';
|
|
11
|
+
import { SYSTEM_TAB } from '../../shell/constants.js';
|
|
12
|
+
import { shellToast } from '../../shell/util.js';
|
|
13
|
+
import { ShellStoreContext } from '../../stores/shell-store.jsx';
|
|
14
|
+
import { disabledReason } from '../access/disabled-reason.js';
|
|
15
|
+
import { probeSize } from './fit-model.js';
|
|
16
|
+
import {
|
|
17
|
+
frameCommitParams,
|
|
18
|
+
frameHandleMessage,
|
|
19
|
+
frameHandleRefusal,
|
|
20
|
+
frameHandleUi,
|
|
21
|
+
} from './frame-handle-model.js';
|
|
22
|
+
|
|
23
|
+
/** The handle's on / off state (a per-viewer UI fact). */
|
|
24
|
+
export function useFrameHandleUi() {
|
|
25
|
+
useSyncExternalStore(frameHandleUi.subscribe, frameHandleUi.version, frameHandleUi.version);
|
|
26
|
+
return frameHandleUi.get();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The lane for the canvas's reports: origin, the active frame and the payload checked by the table.
|
|
31
|
+
* @param {{ canvasOrigin: () => string, activeWin: () => Window|null, onCommit: (m: any) => void }} deps
|
|
32
|
+
*/
|
|
33
|
+
export function createFrameCommitLane(deps) {
|
|
34
|
+
return {
|
|
35
|
+
onMessage(e) {
|
|
36
|
+
if (e?.data?.dgn !== 'video-frame-commit') return;
|
|
37
|
+
const m = acceptFromCanvas(e, {
|
|
38
|
+
canvasOrigin: deps.canvasOrigin(),
|
|
39
|
+
active: deps.activeWin(),
|
|
40
|
+
});
|
|
41
|
+
if (m?.dgn !== 'video-frame-commit') return;
|
|
42
|
+
deps.onCommit(m);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {{ seq: any|null, comp: { width: number, height: number }|null, fps: number, frame: number, name: string,
|
|
49
|
+
* artboardId: string|null, canEdit: boolean, url: string|null, run: (params: object) => Promise<any> }} p
|
|
50
|
+
*/
|
|
51
|
+
export function FrameHandleHost({ seq, comp, fps, frame, name, artboardId, canEdit, url, run }) {
|
|
52
|
+
const ui = useFrameHandleUi();
|
|
53
|
+
const store = useContext(ShellStoreContext);
|
|
54
|
+
const core = store?.shellCore;
|
|
55
|
+
const activePath = core?.activePath ?? null;
|
|
56
|
+
const [src, setSrc] = useState(null);
|
|
57
|
+
const [refused, setRefused] = useState(0);
|
|
58
|
+
const stableId = seq?.stableId ?? null;
|
|
59
|
+
const refusal = frameHandleRefusal(seq);
|
|
60
|
+
|
|
61
|
+
// opening on something that cannot be moved says so, once; a different clip turns it off
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!ui) return;
|
|
64
|
+
const why = !canEdit ? disabledReason('viewer') : refusal;
|
|
65
|
+
if (why) {
|
|
66
|
+
shellToast(why);
|
|
67
|
+
frameHandleUi.close();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
frameHandleUi.pin(stableId);
|
|
71
|
+
}, [ui, canEdit, refusal, stableId]);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!ui || !url) return undefined;
|
|
75
|
+
let dead = false;
|
|
76
|
+
probeSize(url).then((s) => {
|
|
77
|
+
if (!dead) setSrc(s);
|
|
78
|
+
});
|
|
79
|
+
return () => {
|
|
80
|
+
dead = true;
|
|
81
|
+
};
|
|
82
|
+
}, [ui, url]);
|
|
83
|
+
|
|
84
|
+
const out = comp?.width > 0 && comp?.height > 0 ? { w: comp.width, h: comp.height } : null;
|
|
85
|
+
const open = !!ui && canEdit && ui.stableId === stableId;
|
|
86
|
+
const msg = frameHandleMessage({ open, seq, out, frame, fps, src, artboardId, label: name });
|
|
87
|
+
|
|
88
|
+
// the live numbers the lane reads (it is mounted once)
|
|
89
|
+
const live = useRef({});
|
|
90
|
+
live.current = {
|
|
91
|
+
activePath,
|
|
92
|
+
iframesRef: core?.iframesRef,
|
|
93
|
+
canvasOrigin: core?.cfg?.canvasOrigin,
|
|
94
|
+
post: core?.postToActiveCanvas,
|
|
95
|
+
seq,
|
|
96
|
+
out,
|
|
97
|
+
frame,
|
|
98
|
+
fps,
|
|
99
|
+
artboardId,
|
|
100
|
+
run,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const key = `${JSON.stringify(msg)}|${refused}`;
|
|
104
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the message's text + the canvas are the value identity
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
live.current.post?.(msg);
|
|
107
|
+
}, [key, activePath]);
|
|
108
|
+
// the Timeline going away takes the handle with it
|
|
109
|
+
useEffect(
|
|
110
|
+
() => () => live.current.post?.({ dgn: 'video-frame-handle', v: 1, artboardId: null }),
|
|
111
|
+
[]
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (typeof window === 'undefined') return undefined;
|
|
116
|
+
const lane = createFrameCommitLane({
|
|
117
|
+
canvasOrigin: () => live.current.canvasOrigin || window.location.origin,
|
|
118
|
+
activeWin: () => {
|
|
119
|
+
const p = live.current.activePath;
|
|
120
|
+
return p && p !== SYSTEM_TAB
|
|
121
|
+
? (live.current.iframesRef?.current?.get(p)?.contentWindow ?? null)
|
|
122
|
+
: null;
|
|
123
|
+
},
|
|
124
|
+
onCommit: (m) => {
|
|
125
|
+
const l = live.current;
|
|
126
|
+
const on = frameHandleUi.get();
|
|
127
|
+
if (
|
|
128
|
+
!on ||
|
|
129
|
+
!l.seq ||
|
|
130
|
+
!l.out ||
|
|
131
|
+
m.stableId !== l.seq.stableId ||
|
|
132
|
+
m.artboardId !== l.artboardId
|
|
133
|
+
)
|
|
134
|
+
return;
|
|
135
|
+
const params = frameCommitParams(l.seq, l.out, l.frame, l.fps, m);
|
|
136
|
+
if (!params) return;
|
|
137
|
+
// a refused write: say the file's numbers again, so the canvas lets go of where it was dragged
|
|
138
|
+
Promise.resolve(l.run?.(params)).then(
|
|
139
|
+
(j) => {
|
|
140
|
+
if (j && j.ok === false) setRefused((n) => n + 1);
|
|
141
|
+
},
|
|
142
|
+
() => setRefused((n) => n + 1)
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
window.addEventListener('message', lane.onMessage);
|
|
147
|
+
return () => window.removeEventListener('message', lane.onMessage);
|
|
148
|
+
}, []);
|
|
149
|
+
|
|
150
|
+
return null;
|
|
151
|
+
}
|