@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
|
@@ -22,10 +22,17 @@
|
|
|
22
22
|
* in the canvas iframe.
|
|
23
23
|
*
|
|
24
24
|
* @invariant DEPENDENCY-FREE beyond `draw/palette.ts` (the colorspace helpers
|
|
25
|
-
* `import-tokens` already reuses)
|
|
25
|
+
* `import-tokens` already reuses) and `codegen-fonts.ts` (the
|
|
26
|
+
* font-class allowlist, pure string work). No fs, no network.
|
|
26
27
|
*/
|
|
27
28
|
|
|
28
29
|
import { parseColor, rgbToOklch } from '../draw/palette.ts';
|
|
30
|
+
import {
|
|
31
|
+
type FontResolution,
|
|
32
|
+
type FontToken,
|
|
33
|
+
isDsFontValue,
|
|
34
|
+
resolveDsFontStack,
|
|
35
|
+
} from './codegen-fonts.ts';
|
|
29
36
|
import type { FigmaColor, FigmaEffect, FigmaNode, FigmaPaint, FigmaTypeStyle } from './types.ts';
|
|
30
37
|
|
|
31
38
|
/** Default perceptual distance under which a paint snaps to a DS token. */
|
|
@@ -51,6 +58,12 @@ const PRINTABLE_ASCII_RE = /^[\x20-\x7E]*$/;
|
|
|
51
58
|
const HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
|
|
52
59
|
const RGBA_RE = /^rgba?\( ?[\d.]+[ ,]+[\d.]+[ ,]+[\d.]+(?: ?[,/] ?[\d.]+%?)? ?\)$/;
|
|
53
60
|
const VAR_RE = /^var\(--[a-z0-9-]{1,64}\)$/;
|
|
61
|
+
// A token at partial strength: the ONE function-shaped colour the grammar admits,
|
|
62
|
+
// closed to `var(--token)` + a percentage + the keyword `transparent` (#155 §4).
|
|
63
|
+
const COLOR_MIX_RE =
|
|
64
|
+
/^color-mix\(in srgb, var\(--[a-z0-9-]{1,64}\) (?:100|[0-9]{1,2}(?:\.[0-9])?)%, transparent\)$/;
|
|
65
|
+
// A built gradient: only the characters the builders below can produce.
|
|
66
|
+
const GRADIENT_RE = /^(?:linear|radial|conic)-gradient\([A-Za-z0-9 .,%()#-]{1,1800}\)$/;
|
|
54
67
|
const DIM_MAX = 4096;
|
|
55
68
|
const FONT_SIZE_MAX = 512;
|
|
56
69
|
|
|
@@ -64,7 +77,12 @@ function printableAscii(v: string): boolean {
|
|
|
64
77
|
|
|
65
78
|
export function isValidColorValue(v: string): boolean {
|
|
66
79
|
if (!printableAscii(v)) return false;
|
|
67
|
-
return HEX_RE.test(v) || RGBA_RE.test(v) || VAR_RE.test(v);
|
|
80
|
+
return HEX_RE.test(v) || RGBA_RE.test(v) || VAR_RE.test(v) || COLOR_MIX_RE.test(v);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** A gradient this file built (checked again at the end: belt and braces). */
|
|
84
|
+
export function isValidGradient(v: string): boolean {
|
|
85
|
+
return printableAscii(v) && GRADIENT_RE.test(v) && !/url\(|expression|;|\{|\}/i.test(v);
|
|
68
86
|
}
|
|
69
87
|
|
|
70
88
|
export function isValidDimension(v: string, max = DIM_MAX): boolean {
|
|
@@ -141,6 +159,8 @@ export function resolveColor(
|
|
|
141
159
|
export interface StyleMapOptions {
|
|
142
160
|
tokens: readonly DsToken[];
|
|
143
161
|
threshold?: number;
|
|
162
|
+
/** The DS's `--font*` tokens, so a TEXT node's family lands on the project's own stack (D8). */
|
|
163
|
+
fontTokens?: readonly FontToken[];
|
|
144
164
|
}
|
|
145
165
|
|
|
146
166
|
export interface MappedStyle {
|
|
@@ -150,10 +170,14 @@ export interface MappedStyle {
|
|
|
150
170
|
rejected: string[];
|
|
151
171
|
/** Properties that shipped a literal because no token was near (reported). */
|
|
152
172
|
unTokenized: string[];
|
|
173
|
+
/** Constructs CSS has no exact equivalent for, drawn by the nearest one (reported). */
|
|
174
|
+
approximated: string[];
|
|
175
|
+
/** How a TEXT node's font family was resolved (carried so the caller can report it once per family). */
|
|
176
|
+
font?: FontResolution;
|
|
153
177
|
}
|
|
154
178
|
|
|
155
179
|
function emptyStyle(): MappedStyle {
|
|
156
|
-
return { declarations: {}, rejected: [], unTokenized: [] };
|
|
180
|
+
return { declarations: {}, rejected: [], unTokenized: [], approximated: [] };
|
|
157
181
|
}
|
|
158
182
|
|
|
159
183
|
function firstVisible<T extends { visible: boolean }>(list: readonly T[] | undefined): T | null {
|
|
@@ -161,48 +185,201 @@ function firstVisible<T extends { visible: boolean }>(list: readonly T[] | undef
|
|
|
161
185
|
return null;
|
|
162
186
|
}
|
|
163
187
|
|
|
164
|
-
/**
|
|
165
|
-
function
|
|
188
|
+
/** Alpha as the shortest decimal CSS accepts (`0.1`, not `0.100000001`). */
|
|
189
|
+
function alphaText(a: number): string {
|
|
190
|
+
return String(Number(a.toFixed(3)));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* A colour at an alpha: the token (mixed down to the alpha) when one is near,
|
|
195
|
+
* else a literal. `mark` controls whether an un-snapped literal is flagged —
|
|
196
|
+
* fills are audited, shadows never were and stay quiet.
|
|
197
|
+
*/
|
|
198
|
+
function colorAt(
|
|
199
|
+
c: FigmaColor,
|
|
200
|
+
alpha: number,
|
|
201
|
+
opts: StyleMapOptions,
|
|
202
|
+
out: MappedStyle,
|
|
203
|
+
prop: string,
|
|
204
|
+
mark: boolean
|
|
205
|
+
): string | null {
|
|
206
|
+
const hex = figmaColorToHex(c);
|
|
207
|
+
const resolved = resolveColor(hex, opts.tokens, opts.threshold);
|
|
208
|
+
if (mark && resolved.marker) out.unTokenized.push(prop);
|
|
209
|
+
const a = Math.max(0, Math.min(1, alpha));
|
|
210
|
+
if (a >= 0.9995) return isValidColorValue(resolved.value) ? resolved.value : null;
|
|
211
|
+
let value: string;
|
|
212
|
+
if (resolved.token) {
|
|
213
|
+
value = `color-mix(in srgb, ${resolved.value} ${Number((a * 100).toFixed(1))}%, transparent)`;
|
|
214
|
+
} else {
|
|
215
|
+
const to = (v: number) => Math.max(0, Math.min(255, Math.round(v * 255)));
|
|
216
|
+
value = `rgba(${to(c.r)}, ${to(c.g)}, ${to(c.b)}, ${alphaText(a)})`;
|
|
217
|
+
}
|
|
218
|
+
return isValidColorValue(value) ? value : null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** The paint's own alpha: colour alpha × paint opacity. */
|
|
222
|
+
function paintAlpha(paint: FigmaPaint): number {
|
|
223
|
+
return (paint.color?.a ?? 1) * (paint.opacity ?? 1);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const pct = (v: number) => `${Number(v.toFixed(1))}%`;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* A gradient paint → the CSS equivalent.
|
|
230
|
+
*
|
|
231
|
+
* LINEAR is placed exactly: the handles are projected onto CSS's gradient line
|
|
232
|
+
* (whose length depends on the angle and the box), so the stop positions move
|
|
233
|
+
* rather than the angle drifting. RADIAL takes centre and radii from the
|
|
234
|
+
* handles; ANGULAR becomes `conic-gradient` starting where the first handle
|
|
235
|
+
* points. DIAMOND has no CSS form and is drawn as the radial one (reported).
|
|
236
|
+
* Rotation of a skewed radial is not carried.
|
|
237
|
+
*/
|
|
238
|
+
function gradientCss(
|
|
239
|
+
paint: FigmaPaint,
|
|
240
|
+
box: { width: number; height: number } | undefined,
|
|
241
|
+
opts: StyleMapOptions,
|
|
242
|
+
out: MappedStyle
|
|
243
|
+
): string | null {
|
|
166
244
|
const stops = paint.gradientStops;
|
|
167
245
|
if (!stops || stops.length < 2) return null;
|
|
168
|
-
const parts: string[] = [];
|
|
169
|
-
for (const s of stops) {
|
|
170
|
-
const resolved = resolveColor(figmaColorToHex(s.color), opts.tokens, opts.threshold);
|
|
171
|
-
if (!isValidColorValue(resolved.value)) return null;
|
|
172
|
-
if (resolved.marker) out.unTokenized.push('background-image');
|
|
173
|
-
const pct = Math.max(0, Math.min(100, Math.round(s.position * 100)));
|
|
174
|
-
parts.push(`${resolved.value} ${pct}%`);
|
|
175
|
-
}
|
|
176
246
|
const handles = paint.gradientHandlePositions;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
247
|
+
const W = box && box.width > 0 ? box.width : 0;
|
|
248
|
+
const H = box && box.height > 0 ? box.height : 0;
|
|
249
|
+
const sized = W > 0 && H > 0;
|
|
250
|
+
const kind = paint.type;
|
|
251
|
+
const opacity = paint.opacity ?? 1;
|
|
252
|
+
|
|
253
|
+
const colorStops = (project: (position: number) => number): string | null => {
|
|
254
|
+
const parts: string[] = [];
|
|
255
|
+
for (const s of stops) {
|
|
256
|
+
const value = colorAt(s.color, s.color.a * opacity, opts, out, 'background-image', true);
|
|
257
|
+
if (value === null) return null;
|
|
258
|
+
const at = Math.max(-500, Math.min(500, project(Math.max(0, Math.min(1, s.position)))));
|
|
259
|
+
parts.push(`${value} ${pct(at * 100)}`);
|
|
260
|
+
}
|
|
261
|
+
return parts.join(', ');
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
let css: string | null = null;
|
|
265
|
+
if (kind === 'GRADIENT_LINEAR') {
|
|
266
|
+
let angle = 180;
|
|
267
|
+
let project = (t: number) => t;
|
|
268
|
+
if (handles && handles.length >= 2) {
|
|
269
|
+
const dx = (handles[1].x - handles[0].x) * (sized ? W : 1);
|
|
270
|
+
const dy = (handles[1].y - handles[0].y) * (sized ? H : 1);
|
|
271
|
+
const rad = Math.atan2(dy, dx) + Math.PI / 2;
|
|
272
|
+
angle = Math.round((rad * 180) / Math.PI);
|
|
273
|
+
if (sized) {
|
|
274
|
+
// CSS's gradient line: length |W sinθ| + |H cosθ|, through the box centre.
|
|
275
|
+
const sin = Math.sin(rad);
|
|
276
|
+
const cos = Math.cos(rad);
|
|
277
|
+
const len = Math.abs(W * sin) + Math.abs(H * cos);
|
|
278
|
+
if (len > 1e-6) {
|
|
279
|
+
const along = (hx: number, hy: number) =>
|
|
280
|
+
((hx * W - W / 2) * sin + (hy * H - H / 2) * -cos) / len + 0.5;
|
|
281
|
+
const t0 = along(handles[0].x, handles[0].y);
|
|
282
|
+
const t1 = along(handles[1].x, handles[1].y);
|
|
283
|
+
project = (t) => t0 + t * (t1 - t0);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const list = colorStops(project);
|
|
288
|
+
if (list) css = `linear-gradient(${((angle % 360) + 360) % 360}deg, ${list})`;
|
|
289
|
+
} else if (kind === 'GRADIENT_RADIAL' || kind === 'GRADIENT_DIAMOND') {
|
|
290
|
+
if (kind === 'GRADIENT_DIAMOND') out.approximated.push('diamond gradient');
|
|
291
|
+
const list = colorStops((t) => t);
|
|
292
|
+
if (list) {
|
|
293
|
+
let shape = 'ellipse closest-side at 50% 50%';
|
|
294
|
+
if (handles && handles.length >= 2 && sized) {
|
|
295
|
+
const rx = Math.hypot((handles[1].x - handles[0].x) * W, (handles[1].y - handles[0].y) * H);
|
|
296
|
+
const third = handles[2] ?? { x: handles[0].x, y: handles[0].y + 0.5 };
|
|
297
|
+
const ry = Math.hypot((third.x - handles[0].x) * W, (third.y - handles[0].y) * H);
|
|
298
|
+
if (rx >= 1 && ry >= 1 && rx <= 8192 && ry <= 8192) {
|
|
299
|
+
shape = `${Math.round(rx)}px ${Math.round(ry)}px at ${pct(handles[0].x * 100)} ${pct(handles[0].y * 100)}`;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
css = `radial-gradient(${shape}, ${list})`;
|
|
303
|
+
}
|
|
304
|
+
} else if (kind === 'GRADIENT_ANGULAR') {
|
|
305
|
+
const list = colorStops((t) => t);
|
|
306
|
+
if (list) {
|
|
307
|
+
let from = 90;
|
|
308
|
+
let at = '50% 50%';
|
|
309
|
+
if (handles && handles.length >= 2) {
|
|
310
|
+
const dx = (handles[1].x - handles[0].x) * (sized ? W : 1);
|
|
311
|
+
const dy = (handles[1].y - handles[0].y) * (sized ? H : 1);
|
|
312
|
+
from = Math.round((Math.atan2(dy, dx) * 180) / Math.PI + 90);
|
|
313
|
+
from = ((from % 360) + 360) % 360;
|
|
314
|
+
at = `${pct(handles[0].x * 100)} ${pct(handles[0].y * 100)}`;
|
|
315
|
+
}
|
|
316
|
+
css = `conic-gradient(from ${from}deg at ${at}, ${list})`;
|
|
317
|
+
}
|
|
182
318
|
}
|
|
183
|
-
return
|
|
319
|
+
return css !== null && isValidGradient(css) ? css : null;
|
|
184
320
|
}
|
|
185
321
|
|
|
186
322
|
/** Effects → `box-shadow`. Every layer is strict-numeric; no free-text capture. */
|
|
187
|
-
function shadowCss(
|
|
323
|
+
function shadowCss(
|
|
324
|
+
effects: readonly FigmaEffect[],
|
|
325
|
+
opts: StyleMapOptions,
|
|
326
|
+
out: MappedStyle
|
|
327
|
+
): string | null {
|
|
188
328
|
const layers: string[] = [];
|
|
189
329
|
for (const e of effects) {
|
|
190
330
|
if (!e.visible) continue;
|
|
191
331
|
if (e.type !== 'DROP_SHADOW' && e.type !== 'INNER_SHADOW') continue;
|
|
192
|
-
const c = e.color
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
332
|
+
const c = e.color ?? { r: 0, g: 0, b: 0, a: 1 };
|
|
333
|
+
const colour = colorAt(c, c.a, opts, out, 'box-shadow', false);
|
|
334
|
+
if (colour === null) continue;
|
|
195
335
|
const x = Math.round(e.offset?.x ?? 0);
|
|
196
336
|
const y = Math.round(e.offset?.y ?? 0);
|
|
197
337
|
const blur = Math.round(e.radius ?? 0);
|
|
198
338
|
const spread = Math.round(e.spread ?? 0);
|
|
199
339
|
if ([x, y, blur, spread].some((n) => !Number.isFinite(n) || Math.abs(n) > 512)) continue;
|
|
200
340
|
const inset = e.type === 'INNER_SHADOW' ? 'inset ' : '';
|
|
201
|
-
layers.push(`${inset}${x}px ${y}px ${blur}px ${spread}px ${
|
|
341
|
+
layers.push(`${inset}${x}px ${y}px ${blur}px ${spread}px ${colour}`);
|
|
202
342
|
}
|
|
203
343
|
return layers.length ? layers.join(', ') : null;
|
|
204
344
|
}
|
|
205
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Figma's blur radius is twice CSS's `blur()` sigma (Dev Mode itself emits
|
|
348
|
+
* `blur(5px)` for a blur of 10), so the value is halved.
|
|
349
|
+
*/
|
|
350
|
+
function blurPx(radius: number | undefined): string | null {
|
|
351
|
+
if (radius === undefined || !Number.isFinite(radius) || radius < 0) return null;
|
|
352
|
+
const v = `${Number((radius / 2).toFixed(1))}px`;
|
|
353
|
+
return isValidDimension(v, 256) ? v : null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Figma blend modes → `mix-blend-mode`. A closed table (own-property, null
|
|
358
|
+
* prototype): the mode name is document text, so it is looked up, never copied.
|
|
359
|
+
* `exact` modes have a CSS twin; the rest are drawn by the nearest one.
|
|
360
|
+
*/
|
|
361
|
+
const BLEND_EXACT: Record<string, string> = Object.assign(Object.create(null), {
|
|
362
|
+
DARKEN: 'darken',
|
|
363
|
+
MULTIPLY: 'multiply',
|
|
364
|
+
COLOR_BURN: 'color-burn',
|
|
365
|
+
LIGHTEN: 'lighten',
|
|
366
|
+
SCREEN: 'screen',
|
|
367
|
+
LINEAR_DODGE: 'plus-lighter',
|
|
368
|
+
COLOR_DODGE: 'color-dodge',
|
|
369
|
+
OVERLAY: 'overlay',
|
|
370
|
+
SOFT_LIGHT: 'soft-light',
|
|
371
|
+
HARD_LIGHT: 'hard-light',
|
|
372
|
+
DIFFERENCE: 'difference',
|
|
373
|
+
EXCLUSION: 'exclusion',
|
|
374
|
+
HUE: 'hue',
|
|
375
|
+
SATURATION: 'saturation',
|
|
376
|
+
COLOR: 'color',
|
|
377
|
+
LUMINOSITY: 'luminosity',
|
|
378
|
+
});
|
|
379
|
+
const BLEND_NEAREST: Record<string, string> = Object.assign(Object.create(null), {
|
|
380
|
+
LINEAR_BURN: 'color-burn',
|
|
381
|
+
});
|
|
382
|
+
|
|
206
383
|
/** A node's fills/strokes/effects/corner radius → CSS declarations. */
|
|
207
384
|
export function mapNodeStyle(node: FigmaNode, opts: StyleMapOptions): MappedStyle {
|
|
208
385
|
const out = emptyStyle();
|
|
@@ -214,32 +391,65 @@ export function mapNodeStyle(node: FigmaNode, opts: StyleMapOptions): MappedStyl
|
|
|
214
391
|
out.declarations[prop] = value;
|
|
215
392
|
};
|
|
216
393
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
394
|
+
// Figma lists fills bottom → top. IMAGE fills are pictures, handled by the
|
|
395
|
+
// emitter before it ever asks for a colour.
|
|
396
|
+
const paints = (node.fills ?? []).filter((p) => p.visible && p.type !== 'IMAGE');
|
|
397
|
+
if (node.type === 'TEXT') {
|
|
398
|
+
// A TEXT node's fill is its FOREGROUND — one colour, the topmost solid.
|
|
399
|
+
for (let i = paints.length - 1; i >= 0; i--) {
|
|
400
|
+
const p = paints[i];
|
|
401
|
+
if (p.type !== 'SOLID' || !p.color) continue;
|
|
402
|
+
const value = colorAt(p.color, paintAlpha(p), opts, out, 'background', true);
|
|
403
|
+
if (value === null) out.rejected.push('background');
|
|
404
|
+
else out.declarations.background = value;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
} else if (paints.length > 0) {
|
|
408
|
+
// CSS lists background layers top → bottom.
|
|
409
|
+
const layers: Array<{ solid: boolean; css: string }> = [];
|
|
410
|
+
let blended = false;
|
|
411
|
+
for (let i = paints.length - 1; i >= 0; i--) {
|
|
412
|
+
const p = paints[i];
|
|
413
|
+
if (p.blendMode && p.blendMode !== 'NORMAL' && p.blendMode !== 'PASS_THROUGH') blended = true;
|
|
414
|
+
if (p.type === 'SOLID' && p.color) {
|
|
415
|
+
const alpha = paintAlpha(p);
|
|
416
|
+
if (alpha <= 0.003) continue; // fully transparent: paints nothing
|
|
417
|
+
const value = colorAt(p.color, alpha, opts, out, 'background', true);
|
|
418
|
+
if (value === null) out.rejected.push('background');
|
|
419
|
+
else layers.push({ solid: true, css: value });
|
|
420
|
+
} else if (p.type.startsWith('GRADIENT')) {
|
|
421
|
+
const css = gradientCss(p, node.absoluteBoundingBox, opts, out);
|
|
422
|
+
if (css) layers.push({ solid: false, css });
|
|
423
|
+
else out.rejected.push('background-image');
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (blended) out.approximated.push('fill blend mode');
|
|
427
|
+
if (layers.length === 1 && layers[0].solid) {
|
|
428
|
+
out.declarations.background = layers[0].css;
|
|
429
|
+
} else if (layers.length > 0) {
|
|
430
|
+
// The bottom solid becomes the background COLOUR; every other solid is a
|
|
431
|
+
// one-colour gradient layer, since `background-color` has only one slot.
|
|
432
|
+
// camelCase, NOT `background-image`: these declarations are emitted into a
|
|
433
|
+
// JSX style OBJECT, where a hyphenated key is a syntax error that takes
|
|
229
434
|
// the whole canvas down. One gradient anywhere on a page was enough to
|
|
230
435
|
// make the file unparseable.
|
|
231
|
-
|
|
232
|
-
|
|
436
|
+
const bottom = layers[layers.length - 1];
|
|
437
|
+
const images = bottom.solid ? layers.slice(0, -1) : layers;
|
|
438
|
+
if (bottom.solid) out.declarations.backgroundColor = bottom.css;
|
|
439
|
+
if (images.length > 0) {
|
|
440
|
+
out.declarations.backgroundImage = images
|
|
441
|
+
.map((l) => (l.solid ? `linear-gradient(${l.css}, ${l.css})` : l.css))
|
|
442
|
+
.join(', ');
|
|
443
|
+
}
|
|
233
444
|
}
|
|
234
445
|
}
|
|
235
446
|
|
|
236
447
|
const stroke = firstVisible(node.strokes);
|
|
237
448
|
if (stroke?.type === 'SOLID' && stroke.color) {
|
|
238
|
-
const
|
|
239
|
-
if (resolved.marker) out.unTokenized.push('border-color');
|
|
449
|
+
const colour = colorAt(stroke.color, paintAlpha(stroke), opts, out, 'border-color', true);
|
|
240
450
|
const w = Math.round(node.strokeWeight ?? 1);
|
|
241
|
-
if (Number.isFinite(w) && w > 0 && w <= 64 &&
|
|
242
|
-
out.declarations.border = `${w}px solid ${
|
|
451
|
+
if (Number.isFinite(w) && w > 0 && w <= 64 && colour !== null) {
|
|
452
|
+
out.declarations.border = `${w}px solid ${colour}`;
|
|
243
453
|
} else {
|
|
244
454
|
out.rejected.push('border');
|
|
245
455
|
}
|
|
@@ -250,8 +460,34 @@ export function mapNodeStyle(node: FigmaNode, opts: StyleMapOptions): MappedStyl
|
|
|
250
460
|
}
|
|
251
461
|
|
|
252
462
|
if (node.effects?.length) {
|
|
253
|
-
const css = shadowCss(node.effects, opts);
|
|
463
|
+
const css = shadowCss(node.effects, opts, out);
|
|
254
464
|
if (css) out.declarations.boxShadow = css;
|
|
465
|
+
const layerBlur = node.effects.find(
|
|
466
|
+
(e) => e.visible && (e.type === 'LAYER_BLUR' || e.type === 'FOREGROUND_BLUR')
|
|
467
|
+
);
|
|
468
|
+
if (layerBlur) {
|
|
469
|
+
const px = blurPx(layerBlur.radius);
|
|
470
|
+
if (px) out.declarations.filter = `blur(${px})`;
|
|
471
|
+
else out.rejected.push('filter');
|
|
472
|
+
}
|
|
473
|
+
const backBlur = node.effects.find((e) => e.visible && e.type === 'BACKGROUND_BLUR');
|
|
474
|
+
if (backBlur) {
|
|
475
|
+
const px = blurPx(backBlur.radius);
|
|
476
|
+
if (px) {
|
|
477
|
+
out.declarations.backdropFilter = `blur(${px})`;
|
|
478
|
+
out.declarations.WebkitBackdropFilter = `blur(${px})`;
|
|
479
|
+
} else out.rejected.push('backdrop-filter');
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (node.blendMode && node.blendMode !== 'NORMAL' && node.blendMode !== 'PASS_THROUGH') {
|
|
484
|
+
const exact = BLEND_EXACT[node.blendMode];
|
|
485
|
+
const near = exact ? undefined : BLEND_NEAREST[node.blendMode];
|
|
486
|
+
if (exact) out.declarations.mixBlendMode = exact;
|
|
487
|
+
else if (near) {
|
|
488
|
+
out.declarations.mixBlendMode = near;
|
|
489
|
+
out.approximated.push(`blend mode ${node.blendMode}`);
|
|
490
|
+
} else out.rejected.push('mix-blend-mode');
|
|
255
491
|
}
|
|
256
492
|
|
|
257
493
|
// Node opacity is carried ONLY when it is not a hiding mechanism. D6b makes
|
|
@@ -304,11 +540,20 @@ export function mapTypeStyle(
|
|
|
304
540
|
if (style.textDecoration === 'UNDERLINE') out.declarations.textDecoration = 'underline';
|
|
305
541
|
if (style.textDecoration === 'STRIKETHROUGH') out.declarations.textDecoration = 'line-through';
|
|
306
542
|
|
|
307
|
-
// FONT FAMILY
|
|
308
|
-
//
|
|
309
|
-
//
|
|
310
|
-
//
|
|
311
|
-
//
|
|
543
|
+
// FONT FAMILY (#155 §3, D8). A Figma font name is free text from the document
|
|
544
|
+
// and the canvas CSP is `font-src 'self'`, so the literal can neither be
|
|
545
|
+
// loaded nor safely written into a stylesheet. It is therefore NEVER carried:
|
|
546
|
+
// the family is classified against a closed allowlist (sans / serif / mono)
|
|
547
|
+
// and mapped onto the project's own DS stack of that class — or onto a fixed
|
|
548
|
+
// system stack when the DS has none. Without this every imported artboard
|
|
549
|
+
// rendered in the browser's serif default.
|
|
550
|
+
if (style.fontFamily) {
|
|
551
|
+
const res = resolveDsFontStack(style.fontFamily, opts.fontTokens ?? []);
|
|
552
|
+
if (isDsFontValue(res.css)) {
|
|
553
|
+
out.declarations.fontFamily = res.css;
|
|
554
|
+
out.font = res;
|
|
555
|
+
} else out.rejected.push('fontFamily');
|
|
556
|
+
}
|
|
312
557
|
|
|
313
558
|
return out;
|
|
314
559
|
}
|