@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,87 @@
|
|
|
1
|
+
// svg-inline.ts — issue #150 §1: keep an inline <svg>'s own box out of the bitmap
|
|
2
|
+
// @remotion/web-renderer draws for it.
|
|
3
|
+
//
|
|
4
|
+
// `turnSvgIntoDrawable` (web-renderer) serializes the LIVE <svg> element — its
|
|
5
|
+
// inline `style` attribute included — into a standalone `data:image/svg+xml`
|
|
6
|
+
// document, loads that as an Image and draws it into the frame. In the standalone
|
|
7
|
+
// document the <svg> is the ROOT, so an inline `position:absolute; left:300px;
|
|
8
|
+
// top:80px` (the usual way a logo / flying shape / divider is placed on a comp)
|
|
9
|
+
// moves the artwork 300 × 80 px out of the image's own viewport: the image loads,
|
|
10
|
+
// `onload` fires, nothing throws, and the bitmap is empty. The renderer already
|
|
11
|
+
// neutralizes `transform` and the margins around that serialization; it forgets
|
|
12
|
+
// the rest of the box. The page's CSP is not involved (`img-src` allows `data:`
|
|
13
|
+
// and `blob:`, probed live) and is NOT widened by this fix.
|
|
14
|
+
//
|
|
15
|
+
// This module lives in the capture shim, not in node_modules: the guard patches
|
|
16
|
+
// `XMLSerializer.prototype.serializeToString` for the duration of one render, so
|
|
17
|
+
// the library stays unpatched (no per-workspace patchedDependencies entry, DDR-176)
|
|
18
|
+
// and a renderer upgrade that fixes this itself just makes the guard a no-op.
|
|
19
|
+
//
|
|
20
|
+
// Browser-safe and React-free; imported by `video-render-lib.ts` (runs inside the
|
|
21
|
+
// capture Chromium) and unit-tested under happy-dom.
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Inline-style properties that place an element inside ITS PARENT — meaningless
|
|
25
|
+
* (or harmful) once the <svg> is the root of its own image document. `margin*`
|
|
26
|
+
* and `transform*` are already reset by the renderer itself.
|
|
27
|
+
*/
|
|
28
|
+
export const SVG_POSITIONAL_PROPS: readonly string[] = [
|
|
29
|
+
'position',
|
|
30
|
+
'top',
|
|
31
|
+
'right',
|
|
32
|
+
'bottom',
|
|
33
|
+
'left',
|
|
34
|
+
'inset',
|
|
35
|
+
'inset-block',
|
|
36
|
+
'inset-inline',
|
|
37
|
+
'translate',
|
|
38
|
+
'rotate',
|
|
39
|
+
'scale',
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
interface SavedProp {
|
|
43
|
+
prop: string;
|
|
44
|
+
value: string;
|
|
45
|
+
priority: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Clear the positional inline style on `svg`, run `fn`, put it back exactly as it
|
|
50
|
+
* was (value AND `!important`). Synchronous on purpose: the renderer reads the
|
|
51
|
+
* serialization in the same tick, and the live element must never be left
|
|
52
|
+
* mutated for a frame the Player (or the next measurement) could observe.
|
|
53
|
+
*/
|
|
54
|
+
export function withSvgBoxNeutralized<T>(svg: SVGSVGElement, fn: () => T): T {
|
|
55
|
+
const style = svg.style;
|
|
56
|
+
const saved: SavedProp[] = [];
|
|
57
|
+
for (const prop of SVG_POSITIONAL_PROPS) {
|
|
58
|
+
const value = style.getPropertyValue(prop);
|
|
59
|
+
if (value === '') continue;
|
|
60
|
+
saved.push({ prop, value, priority: style.getPropertyPriority(prop) });
|
|
61
|
+
style.removeProperty(prop);
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
return fn();
|
|
65
|
+
} finally {
|
|
66
|
+
for (const { prop, value, priority } of saved) style.setProperty(prop, value, priority);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Wrap `XMLSerializer.prototype.serializeToString` so an <svg> ROOT is serialized
|
|
72
|
+
* without its own box. Anything else (every other node, every other caller)
|
|
73
|
+
* passes straight through. Returns the restore function — call it in a `finally`.
|
|
74
|
+
*/
|
|
75
|
+
export function installSvgSerializeGuard(): () => void {
|
|
76
|
+
const proto = XMLSerializer.prototype;
|
|
77
|
+
const original = proto.serializeToString;
|
|
78
|
+
proto.serializeToString = function guardedSerializeToString(this: XMLSerializer, node: Node) {
|
|
79
|
+
if (typeof SVGSVGElement !== 'undefined' && node instanceof SVGSVGElement) {
|
|
80
|
+
return withSvgBoxNeutralized(node, () => original.call(this, node));
|
|
81
|
+
}
|
|
82
|
+
return original.call(this, node);
|
|
83
|
+
};
|
|
84
|
+
return () => {
|
|
85
|
+
proto.serializeToString = original;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -27,6 +27,16 @@
|
|
|
27
27
|
import { renderMediaOnWeb } from '@remotion/web-renderer';
|
|
28
28
|
import type { ComponentType } from 'react';
|
|
29
29
|
|
|
30
|
+
import { installCapturePrepass } from './capture-prepass.ts';
|
|
31
|
+
import {
|
|
32
|
+
mergeFindings,
|
|
33
|
+
type ParityFinding,
|
|
34
|
+
type ParityScan,
|
|
35
|
+
sampleFrames,
|
|
36
|
+
scanParity,
|
|
37
|
+
} from './parity-check.ts';
|
|
38
|
+
import { installSvgSerializeGuard } from './svg-inline.ts';
|
|
39
|
+
|
|
30
40
|
interface RenderVideoOpts {
|
|
31
41
|
component: ComponentType<Record<string, unknown>>;
|
|
32
42
|
inputProps?: Record<string, unknown>;
|
|
@@ -73,32 +83,44 @@ async function renderVideo(opts: RenderVideoOpts): Promise<RenderVideoResult> {
|
|
|
73
83
|
typeof renderMediaOnWeb
|
|
74
84
|
>[0]['audioCodec']);
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
86
|
+
// Issue #150 §1 — an inline <svg> with its own `position`/`left`/`top` rendered
|
|
87
|
+
// as an empty bitmap. The guard is scoped to this one render (see svg-inline.ts).
|
|
88
|
+
const restoreSerializer = installSvgSerializeGuard();
|
|
89
|
+
// Issue #150 §2 + §3 — a size-less svg <img> drawn cropped / not at all, and absolute children
|
|
90
|
+
// of a transformed static parent jumping to the frame. Scoped to this one render too.
|
|
91
|
+
const restorePrepass = installCapturePrepass();
|
|
92
|
+
let result: Awaited<ReturnType<typeof renderMediaOnWeb>>;
|
|
93
|
+
try {
|
|
94
|
+
result = await renderMediaOnWeb({
|
|
95
|
+
composition: {
|
|
96
|
+
component: opts.component,
|
|
97
|
+
id: 'maude-export',
|
|
98
|
+
width: opts.width,
|
|
99
|
+
height: opts.height,
|
|
100
|
+
fps: opts.fps,
|
|
101
|
+
durationInFrames: opts.durationInFrames,
|
|
102
|
+
},
|
|
103
|
+
inputProps: opts.inputProps ?? {},
|
|
104
|
+
container: opts.container,
|
|
105
|
+
videoCodec,
|
|
106
|
+
audioCodec,
|
|
107
|
+
muted,
|
|
108
|
+
scale: opts.scale ?? 1,
|
|
109
|
+
frameRange: opts.frameRange ?? null,
|
|
110
|
+
isProduction: true,
|
|
111
|
+
licenseKey: opts.licenseKey ?? 'free-license',
|
|
112
|
+
logLevel: 'error',
|
|
113
|
+
// Remotion defaults this to 'medium', which yields the event loop every
|
|
114
|
+
// ~33 ms to keep a page interactive while it renders. Nobody is looking at
|
|
115
|
+
// this page — it is a headless capture Chromium with no UI — so the courtesy
|
|
116
|
+
// is pure overhead. 'disabled' is Remotion's documented setting for exactly
|
|
117
|
+
// this case (client-side rendering / page-responsiveness).
|
|
118
|
+
pageResponsiveness: 'disabled',
|
|
119
|
+
});
|
|
120
|
+
} finally {
|
|
121
|
+
restorePrepass();
|
|
122
|
+
restoreSerializer();
|
|
123
|
+
}
|
|
102
124
|
const blob = await result.getBlob();
|
|
103
125
|
const buf = new Uint8Array(await blob.arrayBuffer());
|
|
104
126
|
return {
|
|
@@ -112,3 +134,43 @@ async function renderVideo(opts: RenderVideoOpts): Promise<RenderVideoResult> {
|
|
|
112
134
|
|
|
113
135
|
(globalThis as unknown as { __maudeRenderVideo__: typeof renderVideo }).__maudeRenderVideo__ =
|
|
114
136
|
renderVideo;
|
|
137
|
+
|
|
138
|
+
interface SeekWindow {
|
|
139
|
+
__maude_seek__?: (frame: number) => Promise<void>;
|
|
140
|
+
__maude_comps__?: () => Array<{ id: string; durationInFrames: number }>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* #150 §4 / #128 §8 — what the renderer will not draw the way the Player does, found BEFORE the
|
|
145
|
+
* render starts, by reading the Player's own DOM at a few frames (an element can appear mid-comp).
|
|
146
|
+
* Never throws and never blocks: a failed seek or an unreadable page just means fewer findings.
|
|
147
|
+
*/
|
|
148
|
+
async function parityCheck(compId: string): Promise<ParityScan> {
|
|
149
|
+
const w = globalThis as unknown as SeekWindow;
|
|
150
|
+
const rootOf = (): Element | undefined =>
|
|
151
|
+
[...document.querySelectorAll('[data-comp-id]')].find(
|
|
152
|
+
(e) => e.getAttribute('data-comp-id') === compId
|
|
153
|
+
);
|
|
154
|
+
const first = rootOf();
|
|
155
|
+
const artboard = first?.closest('[data-dc-screen]')?.getAttribute('data-dc-screen') ?? null;
|
|
156
|
+
const duration = w.__maude_comps__?.().find((c) => c.id === compId)?.durationInFrames ?? 1;
|
|
157
|
+
let findings: ParityFinding[] = [];
|
|
158
|
+
for (const frame of sampleFrames(duration)) {
|
|
159
|
+
try {
|
|
160
|
+
await w.__maude_seek__?.(frame);
|
|
161
|
+
} catch {
|
|
162
|
+
/* the comp stays on the frame it had */
|
|
163
|
+
}
|
|
164
|
+
const root = rootOf();
|
|
165
|
+
if (root) findings = mergeFindings(findings, scanParity(root));
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
await w.__maude_seek__?.(0);
|
|
169
|
+
} catch {
|
|
170
|
+
/* as above */
|
|
171
|
+
}
|
|
172
|
+
return { artboard, findings };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
(globalThis as unknown as { __maudeParityCheck__: typeof parityCheck }).__maudeParityCheck__ =
|
|
176
|
+
parityCheck;
|
|
@@ -21,7 +21,13 @@ import path from 'node:path';
|
|
|
21
21
|
|
|
22
22
|
import { getEncodeLibBundle, getWebRendererBundle } from './_browser-bundles.ts';
|
|
23
23
|
import { exportShimPath, runShim } from './_runtime.ts';
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
type ExportDegradation,
|
|
26
|
+
hasAudioStream,
|
|
27
|
+
mergeDegraded,
|
|
28
|
+
parityGap,
|
|
29
|
+
remedyFor,
|
|
30
|
+
} from './degraded.ts';
|
|
25
31
|
import {
|
|
26
32
|
canvasShellUrl,
|
|
27
33
|
type ExportContext,
|
|
@@ -93,6 +99,14 @@ const MAX_FRAMES_CEILING = 18000;
|
|
|
93
99
|
* captures have died from memory pressure — warn loudly, recommend ≤720p. */
|
|
94
100
|
const HEAVY_FRAMES_WARNING = 900; // 30 s @ 30 fps
|
|
95
101
|
|
|
102
|
+
/** `--scale` for the capture shim: the user's 1–3× choice, or `auto` (the shim picks by artboard size). */
|
|
103
|
+
export function resolveScaleArg(options: { scale?: unknown }): string {
|
|
104
|
+
const raw: unknown = options.scale;
|
|
105
|
+
if (raw === undefined || raw === null || raw === '') return 'auto';
|
|
106
|
+
const scale = clampInt(raw, 1, 3);
|
|
107
|
+
return scale ? String(scale) : 'auto';
|
|
108
|
+
}
|
|
109
|
+
|
|
96
110
|
async function runVideo(
|
|
97
111
|
format: VideoFormat,
|
|
98
112
|
targets: Target[],
|
|
@@ -205,11 +219,11 @@ async function runVideo(
|
|
|
205
219
|
args.push('--license-key', process.env.MAUDE_REMOTION_LICENSE);
|
|
206
220
|
}
|
|
207
221
|
|
|
208
|
-
// Resolution multiplier (1–3×) — the artboard's native size × scale.
|
|
209
|
-
//
|
|
210
|
-
// shim
|
|
211
|
-
|
|
212
|
-
args.push('--scale',
|
|
222
|
+
// Resolution multiplier (1–3×) — the artboard's native size × scale. The shim applies it as
|
|
223
|
+
// deviceScaleFactor AND sizes the encoder to match. When the user passed none, `auto` makes the
|
|
224
|
+
// shim measure the artboard and pick the default (1× from a 1080 px short side up, else 2× —
|
|
225
|
+
// decision maude/burndown-d6-default-export-scale); the exporter cannot, it never sees the size.
|
|
226
|
+
args.push('--scale', resolveScaleArg(options));
|
|
213
227
|
|
|
214
228
|
const fps = clampInt(options.fps, 1, 60);
|
|
215
229
|
if (fps) args.push('--fps', String(fps));
|
|
@@ -272,6 +286,9 @@ async function runVideo(
|
|
|
272
286
|
// A pre-flight finding stands unless the shim reports its own, more specific
|
|
273
287
|
// cause below — never let a clean-looking summary erase a known defect.
|
|
274
288
|
let degraded: ExportDegradation | undefined = preStamped;
|
|
289
|
+
// The pre-render parity warning is applied LAST: it must not make `degraded` truthy before the
|
|
290
|
+
// audio backstop below, which only speaks when nothing else has.
|
|
291
|
+
let parityNote: ExportDegradation | undefined;
|
|
275
292
|
try {
|
|
276
293
|
const lastLine = stdoutLines.at(-1) ?? '{}';
|
|
277
294
|
const summary = JSON.parse(lastLine) as {
|
|
@@ -279,8 +296,12 @@ async function runVideo(
|
|
|
279
296
|
degraded?: boolean;
|
|
280
297
|
audioDropped?: boolean;
|
|
281
298
|
fallbackReason?: string;
|
|
299
|
+
/** #150 §4 — the pre-render parity scan (only when the one-pass renderer drew the file) */
|
|
300
|
+
parity?: unknown;
|
|
282
301
|
};
|
|
283
302
|
if (summary.container) ext = summary.container;
|
|
303
|
+
parityNote = parityGap(summary.parity);
|
|
304
|
+
if (parityNote) console.error(`⚠ ${format} export: ${parityNote.reason}`);
|
|
284
305
|
if (summary.degraded) {
|
|
285
306
|
const reason = summary.fallbackReason ?? 'unknown';
|
|
286
307
|
console.error(
|
|
@@ -315,6 +336,8 @@ async function runVideo(
|
|
|
315
336
|
console.error(`⚠ ${format} export produced no audio track despite audio being requested.`);
|
|
316
337
|
}
|
|
317
338
|
|
|
339
|
+
degraded = mergeDegraded(degraded, parityNote);
|
|
340
|
+
|
|
318
341
|
return {
|
|
319
342
|
filename: `${el.canvasSlug}.${ext}`,
|
|
320
343
|
contentType: CONTENT_TYPE[ext] ?? 'application/octet-stream',
|
|
@@ -95,6 +95,59 @@ export const MAX_CONCURRENT_DOWNLOADS = 4;
|
|
|
95
95
|
*/
|
|
96
96
|
export const MAX_SVG_PROMOTE_CHUNK = 24;
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Promote many staged SVGs through the shared lane, CHUNKED and with one retry,
|
|
100
|
+
* failing closed per chunk. One `promoteBatch` call is one browser session, so
|
|
101
|
+
* the chunk size trades browser launches against blast radius — see
|
|
102
|
+
* `MAX_SVG_PROMOTE_CHUNK`. Returns one ref (or null) per input, in order.
|
|
103
|
+
*
|
|
104
|
+
* CHUNKED, because "fail closed for the whole batch" and "one batch for the
|
|
105
|
+
* whole import" together turn a single browser timeout into total asset loss.
|
|
106
|
+
* Measured on a live 6-page import: the DDR-167 execution canary spawns
|
|
107
|
+
* `agent-browser` with a fixed 20 s budget (`_import-asset.mjs`), one session
|
|
108
|
+
* for the whole array — at 272 frame renders it blew that budget, the promote
|
|
109
|
+
* threw, and every one of the 272 became `asset-skipped`. The import still
|
|
110
|
+
* exited 0, so it reported success while producing a folder of broken images.
|
|
111
|
+
* Reproduced at 60 SVGs, and it reproduces WITHOUT any of the Figma-lane
|
|
112
|
+
* changes, so this is the shared lane's shape, not the caller's. Fail-closed is
|
|
113
|
+
* KEPT (the DDR-177 rule); what changes is the blast radius: a timeout costs
|
|
114
|
+
* its own chunk, and the rest of the artwork still lands.
|
|
115
|
+
*
|
|
116
|
+
* ONE RETRY, because the canary's failure is measurably TRANSIENT rather than a
|
|
117
|
+
* property of the input (the same lane promoted 4/4 and 24/24 but threw on 12).
|
|
118
|
+
* A chunk lost to a coin-flip is a permanently broken image in a versioned
|
|
119
|
+
* artifact, and a second attempt is one browser launch. Bounded at one: a lane
|
|
120
|
+
* that is genuinely down must fail fast rather than retry a dozen chunks into a
|
|
121
|
+
* multi-minute stall.
|
|
122
|
+
*/
|
|
123
|
+
export async function promoteSvgInChunks(
|
|
124
|
+
promoteBatch: (stagedPaths: string[]) => Promise<Array<string | null>>,
|
|
125
|
+
stagedPaths: readonly string[]
|
|
126
|
+
): Promise<Array<string | null>> {
|
|
127
|
+
const refs: Array<string | null> = [];
|
|
128
|
+
for (let start = 0; start < stagedPaths.length; start += MAX_SVG_PROMOTE_CHUNK) {
|
|
129
|
+
const chunk = stagedPaths.slice(start, start + MAX_SVG_PROMOTE_CHUNK);
|
|
130
|
+
let got: Array<string | null> | null = null;
|
|
131
|
+
for (let attempt = 0; attempt < 2 && got === null; attempt += 1) {
|
|
132
|
+
try {
|
|
133
|
+
got = await promoteBatch(chunk);
|
|
134
|
+
} catch {
|
|
135
|
+
got = null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (got === null) {
|
|
139
|
+
// FAIL CLOSED: the bun-side lane being unavailable must never become
|
|
140
|
+
// "we already have the bytes" (DDR-177's packaged-app failure mode).
|
|
141
|
+
for (let i = 0; i < chunk.length; i += 1) refs.push(null);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
// A short return would silently shift every later ref onto the wrong
|
|
145
|
+
// node — pad rather than trust the length.
|
|
146
|
+
for (let i = 0; i < chunk.length; i += 1) refs.push(got[i] ?? null);
|
|
147
|
+
}
|
|
148
|
+
return refs;
|
|
149
|
+
}
|
|
150
|
+
|
|
98
151
|
export interface AssetRequest {
|
|
99
152
|
nodeId: string;
|
|
100
153
|
format: 'svg' | 'png';
|
|
@@ -366,49 +419,11 @@ export async function resolveAssets(
|
|
|
366
419
|
});
|
|
367
420
|
|
|
368
421
|
if (stagedSvgs.length > 0 && deps.promoteSvgBatch) {
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
// session for the whole array — at 272 frame renders it blew that budget,
|
|
375
|
-
// the promote threw, and every one of the 272 became `asset-skipped`. The
|
|
376
|
-
// import still exited 0, so it reported success while producing a folder of
|
|
377
|
-
// broken images. Reproduced at 60 SVGs, and it reproduces WITHOUT any of the
|
|
378
|
-
// Figma-lane changes, so this is the shared lane's shape, not the caller's.
|
|
379
|
-
//
|
|
380
|
-
// Fail-closed is KEPT — it is the DDR-177 rule and it is right. What changes
|
|
381
|
-
// is the blast radius: a timeout now costs its own chunk, and the rest of
|
|
382
|
-
// the artwork still lands.
|
|
383
|
-
for (let start = 0; start < stagedSvgs.length; start += MAX_SVG_PROMOTE_CHUNK) {
|
|
384
|
-
const chunk = stagedSvgs.slice(start, start + MAX_SVG_PROMOTE_CHUNK);
|
|
385
|
-
let got: Array<string | null> | null = null;
|
|
386
|
-
// ONE RETRY, because the canary's failure is measurably TRANSIENT rather
|
|
387
|
-
// than a property of the input. Measured on a cleaned machine: the same
|
|
388
|
-
// lane promoted 4/4 (30.7 s) and 24/24 (42.3 s) but threw on 12 (24.3 s) —
|
|
389
|
-
// the budget is per `agent-browser` invocation, and a big frame render
|
|
390
|
-
// flirts with it. A chunk lost to a coin-flip is a permanently broken
|
|
391
|
-
// image in a versioned artifact, and a second attempt is one browser
|
|
392
|
-
// launch. Bounded at one: a lane that is genuinely down must still fail
|
|
393
|
-
// fast rather than retry 12 chunks into a multi-minute stall.
|
|
394
|
-
for (let attempt = 0; attempt < 2 && got === null; attempt += 1) {
|
|
395
|
-
try {
|
|
396
|
-
got = await deps.promoteSvgBatch(chunk.map((x) => x.staged));
|
|
397
|
-
} catch {
|
|
398
|
-
got = null;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
if (got === null) {
|
|
402
|
-
// FAIL CLOSED, same rule as the per-file path: the bun-side lane being
|
|
403
|
-
// unavailable must never become "we already have the bytes"
|
|
404
|
-
// (DDR-177's packaged-app failure mode).
|
|
405
|
-
for (let i = 0; i < chunk.length; i += 1) refs.push(null);
|
|
406
|
-
continue;
|
|
407
|
-
}
|
|
408
|
-
// A short return would silently shift every later ref onto the wrong
|
|
409
|
-
// node — pad rather than trust the length.
|
|
410
|
-
for (let i = 0; i < chunk.length; i += 1) refs.push(got[i] ?? null);
|
|
411
|
-
}
|
|
422
|
+
const promoteBatch = deps.promoteSvgBatch.bind(deps);
|
|
423
|
+
const refs = await promoteSvgInChunks(
|
|
424
|
+
promoteBatch,
|
|
425
|
+
stagedSvgs.map((x) => x.staged)
|
|
426
|
+
);
|
|
412
427
|
for (let i = 0; i < stagedSvgs.length; i += 1) {
|
|
413
428
|
const { req, staged } = stagedSvgs[i];
|
|
414
429
|
const ref = refs[i];
|
|
@@ -148,6 +148,99 @@ export function resolveFontFamily(
|
|
|
148
148
|
return { css: SYSTEM_STACK, substituted: true, requested };
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
// ── The tree lane (#155 §3, D8) ─────────────────────────────────────────────
|
|
152
|
+
//
|
|
153
|
+
// `resolveFontFamily` above serves the codegen lane, which may quote a
|
|
154
|
+
// ubiquitous family. The tree lane (`style-map.ts`) is stricter: the document's
|
|
155
|
+
// family name NEVER reaches the stylesheet. It is classified against a closed
|
|
156
|
+
// allowlist into sans / serif / mono and mapped onto the DS stack of that class.
|
|
157
|
+
|
|
158
|
+
export type FontClass = 'sans' | 'serif' | 'mono';
|
|
159
|
+
|
|
160
|
+
/** Fixed fallbacks when the DS has no stack of the class — code-owned constants, never document text. */
|
|
161
|
+
export const SERIF_STACK = "Georgia, 'Times New Roman', Times, serif";
|
|
162
|
+
export const MONO_STACK =
|
|
163
|
+
"ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace";
|
|
164
|
+
const FALLBACK_STACK: Record<FontClass, string> = Object.assign(Object.create(null), {
|
|
165
|
+
sans: SYSTEM_STACK,
|
|
166
|
+
serif: SERIF_STACK,
|
|
167
|
+
mono: MONO_STACK,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const MONO_RE =
|
|
171
|
+
/\bmono\b|monospace|\bcode\b|courier|consolas|menlo|monaco|jetbrains|inconsolata|iosevka|\bhack\b|\bterminal\b/;
|
|
172
|
+
const SERIF_RE =
|
|
173
|
+
/\bserif\b|georgia|times|garamond|playfair|merriweather|\blora\b|baskerville|crimson|cormorant|bodoni|didot|palatino|cambria|charter|fraunces|spectral|newsreader|\bcaslon\b|domine|literata|gelasio/;
|
|
174
|
+
|
|
175
|
+
/** Which DS stack a requested family belongs on. Sans is the default: when unsure, the neutral UI face. */
|
|
176
|
+
export function classifyFamily(rawFamily: string): FontClass {
|
|
177
|
+
const f = splitFamilyAndStyle(rawFamily).family.toLowerCase().replace(/[_-]+/g, ' ');
|
|
178
|
+
if (MONO_RE.test(f)) return 'mono';
|
|
179
|
+
if (/\bsans\b/.test(f)) return 'sans';
|
|
180
|
+
if (SERIF_RE.test(f)) return 'serif';
|
|
181
|
+
return 'sans';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const CLASS_TOKEN: Record<FontClass, RegExp> = Object.assign(Object.create(null), {
|
|
185
|
+
mono: /mono|code/,
|
|
186
|
+
serif: /serif/,
|
|
187
|
+
sans: /sans|body|text|base|ui/,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
/** A token's declared families, quotes and case stripped, for an exact-name match. */
|
|
191
|
+
function declaredFamilies(value: string): string[] {
|
|
192
|
+
return value
|
|
193
|
+
.split(',')
|
|
194
|
+
.map((x) => x.replace(/['"]/g, '').trim().toLowerCase())
|
|
195
|
+
.filter(Boolean);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function resolveDsFontStack(
|
|
199
|
+
rawFamily: string,
|
|
200
|
+
tokens: readonly FontToken[] = []
|
|
201
|
+
): FontResolution & { fontClass: FontClass } {
|
|
202
|
+
const { family } = splitFamilyAndStyle(rawFamily);
|
|
203
|
+
const requested = attrValue(family, MAX_FAMILY_DETAIL);
|
|
204
|
+
const needle = family.toLowerCase().replace(/['"]/g, '').trim();
|
|
205
|
+
const fontClass = classifyFamily(family);
|
|
206
|
+
|
|
207
|
+
// The DS declares this very family: same typeface, reached through its variable.
|
|
208
|
+
if (needle.length > 0) {
|
|
209
|
+
for (const t of tokens) {
|
|
210
|
+
if (declaredFamilies(t.value).includes(needle)) {
|
|
211
|
+
return { css: `var(${t.name})`, substituted: false, requested, token: t.name, fontClass };
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Otherwise the DS stack of the same CLASS: a serif heading stays a serif.
|
|
216
|
+
const pattern = CLASS_TOKEN[fontClass];
|
|
217
|
+
const byClass = tokens.find((t) => {
|
|
218
|
+
if (!pattern.test(t.name)) return false;
|
|
219
|
+
if (fontClass === 'sans') return !/mono|code|serif/.test(t.name);
|
|
220
|
+
return true;
|
|
221
|
+
});
|
|
222
|
+
if (byClass) {
|
|
223
|
+
return {
|
|
224
|
+
css: `var(${byClass.name})`,
|
|
225
|
+
substituted: true,
|
|
226
|
+
requested,
|
|
227
|
+
token: byClass.name,
|
|
228
|
+
fontClass,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return { css: FALLBACK_STACK[fontClass], substituted: true, requested, fontClass };
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** True for exactly what `resolveDsFontStack` can return — a DS variable or one of the fixed stacks. */
|
|
235
|
+
export function isDsFontValue(v: string): boolean {
|
|
236
|
+
return (
|
|
237
|
+
/^var\(--[a-z0-9-]{1,64}\)$/.test(v) ||
|
|
238
|
+
v === SYSTEM_STACK ||
|
|
239
|
+
v === SERIF_STACK ||
|
|
240
|
+
v === MONO_STACK
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
151
244
|
/**
|
|
152
245
|
* Quote a family name for a CSS value position. Charset-allowlisted first, so a
|
|
153
246
|
* family carrying a quote, a semicolon or a brace cannot terminate the
|
|
@@ -178,6 +271,13 @@ export class FontSubstitutions {
|
|
|
178
271
|
this.counts.set(key, (this.counts.get(key) ?? 0) + 1);
|
|
179
272
|
}
|
|
180
273
|
|
|
274
|
+
/** Fold another tally in, so a canvas of many frames reports each family once. */
|
|
275
|
+
absorb(other: FontSubstitutions): void {
|
|
276
|
+
for (const [family, n] of other.counts) {
|
|
277
|
+
this.counts.set(family, (this.counts.get(family) ?? 0) + n);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
181
281
|
get size(): number {
|
|
182
282
|
return this.counts.size;
|
|
183
283
|
}
|