@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,789 @@
|
|
|
1
|
+
// _perf-sweep-shared.mjs — the pure half of `maude design perf --sweep` (issues burndown T9.1).
|
|
2
|
+
//
|
|
3
|
+
// A short pan+zoom burst only moves a small piece of a big canvas, so it says little about the way
|
|
4
|
+
// someone really uses a board: panning across ALL of it. The sweep drives the same wheel path the viewport
|
|
5
|
+
// controller listens for (a plain wheel = 2D pan, a ctrl wheel = zoom) through four phases and records, per
|
|
6
|
+
// phase, every frame's rAF delta, how many artboards were on screen / mounted / standing in as a still, and
|
|
7
|
+
// how many frames showed an artboard that already had content as a blank:
|
|
8
|
+
//
|
|
9
|
+
// sweep-overview serpentine over the whole world at the overview zoom (10 % by default), after a settle
|
|
10
|
+
// sweep-fit the zoom with the most artboards on screen (fit-all), a small pan to keep it moving
|
|
11
|
+
// zoom-cycles fit-all <-> overview, three times
|
|
12
|
+
// sweep-after-zoom serpentine at the overview zoom, started the instant a zoom cycle ends (no settle)
|
|
13
|
+
//
|
|
14
|
+
// Everything that needs no browser lives here (option parsing, statistics, result validation, the
|
|
15
|
+
// report) so it is testable; `_perf-sweep.mjs` is the driver (Playwright Chromium / safaridriver Safari).
|
|
16
|
+
// The in-page harness is a real function (`sweepHarness`) serialised with toString(), so it is
|
|
17
|
+
// syntax-checked with the rest of the file.
|
|
18
|
+
|
|
19
|
+
export const SWEEP_PHASES = ['sweep-overview', 'sweep-fit', 'zoom-cycles', 'sweep-after-zoom'];
|
|
20
|
+
export const DEFAULT_SWEEP = {
|
|
21
|
+
engine: 'chromium',
|
|
22
|
+
url: '',
|
|
23
|
+
label: '',
|
|
24
|
+
passes: 3,
|
|
25
|
+
runs: 1,
|
|
26
|
+
zoom: 0.1,
|
|
27
|
+
speed: 1200,
|
|
28
|
+
afterZoomRows: 3,
|
|
29
|
+
sweeps: 3,
|
|
30
|
+
warmup: 2,
|
|
31
|
+
window: '1600x920',
|
|
32
|
+
dpr: 2,
|
|
33
|
+
query: 'artboard-live=sleep',
|
|
34
|
+
timeout: 600,
|
|
35
|
+
driverPort: 4488,
|
|
36
|
+
json: false,
|
|
37
|
+
gpu: false,
|
|
38
|
+
out: '',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const INT = /^\d+$/;
|
|
42
|
+
const NUM = /^\d+(\.\d+)?$/;
|
|
43
|
+
|
|
44
|
+
/** Parse the argv of the sweep driver. Throws an Error naming the bad option (the caller prints it, exit 2). */
|
|
45
|
+
export function parseSweepArgs(argv) {
|
|
46
|
+
const o = { ...DEFAULT_SWEEP };
|
|
47
|
+
const takeInt = (name, v, min, max) => {
|
|
48
|
+
if (!INT.test(String(v ?? ''))) throw new Error(`${name} must be a whole number`);
|
|
49
|
+
const n = Number(v);
|
|
50
|
+
if (n < min || n > max) throw new Error(`${name} must be between ${min} and ${max}`);
|
|
51
|
+
return n;
|
|
52
|
+
};
|
|
53
|
+
for (let i = 0; i < argv.length; i++) {
|
|
54
|
+
const a = argv[i];
|
|
55
|
+
const next = () => {
|
|
56
|
+
if (i + 1 >= argv.length) throw new Error(`${a} needs a value`);
|
|
57
|
+
return argv[++i];
|
|
58
|
+
};
|
|
59
|
+
switch (a) {
|
|
60
|
+
case '--engine': {
|
|
61
|
+
const v = next();
|
|
62
|
+
if (v !== 'chromium' && v !== 'safari')
|
|
63
|
+
throw new Error('--engine must be chromium or safari');
|
|
64
|
+
o.engine = v;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
case '--url':
|
|
68
|
+
o.url = next();
|
|
69
|
+
break;
|
|
70
|
+
case '--label':
|
|
71
|
+
o.label = next();
|
|
72
|
+
break;
|
|
73
|
+
case '--passes':
|
|
74
|
+
case '--repeat':
|
|
75
|
+
o.passes = takeInt('--passes', next(), 1, 20);
|
|
76
|
+
break;
|
|
77
|
+
case '--runs':
|
|
78
|
+
o.runs = takeInt('--runs', next(), 1, 20);
|
|
79
|
+
break;
|
|
80
|
+
case '--zoom': {
|
|
81
|
+
const v = next();
|
|
82
|
+
if (!NUM.test(v)) throw new Error('--zoom must be a number such as 0.1');
|
|
83
|
+
const z = Number(v);
|
|
84
|
+
if (z < 0.02 || z > 1) throw new Error('--zoom must be between 0.02 and 1');
|
|
85
|
+
o.zoom = z;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case '--speed':
|
|
89
|
+
o.speed = takeInt('--speed', next(), 100, 6000);
|
|
90
|
+
break;
|
|
91
|
+
case '--sweeps':
|
|
92
|
+
o.sweeps = takeInt('--sweeps', next(), 1, 20);
|
|
93
|
+
break;
|
|
94
|
+
case '--warmup':
|
|
95
|
+
o.warmup = takeInt('--warmup', next(), 0, 20);
|
|
96
|
+
break;
|
|
97
|
+
case '--after-zoom-rows':
|
|
98
|
+
o.afterZoomRows = takeInt('--after-zoom-rows', next(), 1, 50);
|
|
99
|
+
break;
|
|
100
|
+
case '--window': {
|
|
101
|
+
const v = next();
|
|
102
|
+
const m = /^(\d{3,5})x(\d{3,5})$/.exec(v);
|
|
103
|
+
if (!m) throw new Error('--window must look like 2560x1340');
|
|
104
|
+
o.window = v;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case '--dpr': {
|
|
108
|
+
const v = next();
|
|
109
|
+
if (!NUM.test(v) || Number(v) < 1 || Number(v) > 3)
|
|
110
|
+
throw new Error('--dpr must be between 1 and 3');
|
|
111
|
+
o.dpr = Number(v);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case '--query': {
|
|
115
|
+
const v = next();
|
|
116
|
+
if (/[^A-Za-z0-9=&_-]/.test(v))
|
|
117
|
+
throw new Error('--query takes letters, digits and = & _ - only');
|
|
118
|
+
o.query = v;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case '--timeout':
|
|
122
|
+
o.timeout = takeInt('--timeout', next(), 10, 7200);
|
|
123
|
+
break;
|
|
124
|
+
case '--driver-port':
|
|
125
|
+
o.driverPort = takeInt('--driver-port', next(), 1024, 65535);
|
|
126
|
+
break;
|
|
127
|
+
case '--out':
|
|
128
|
+
o.out = next();
|
|
129
|
+
break;
|
|
130
|
+
case '--json':
|
|
131
|
+
o.json = true;
|
|
132
|
+
break;
|
|
133
|
+
case '--gpu':
|
|
134
|
+
o.gpu = true;
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
throw new Error(`unknown option '${a}'`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (!o.url) throw new Error('--url is required');
|
|
141
|
+
return o;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function parseWindow(v) {
|
|
145
|
+
const m = /^(\d+)x(\d+)$/.exec(v);
|
|
146
|
+
return m ? { w: Number(m[1]), h: Number(m[2]) } : null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ---------- statistics (node side, over the raw rAF deltas the page returns) ----------
|
|
150
|
+
|
|
151
|
+
/** The p-th percentile (0..1) of a list, the same index rule the other perf probes use. */
|
|
152
|
+
export function percentile(values, p) {
|
|
153
|
+
if (!values.length) return null;
|
|
154
|
+
const s = values.slice().sort((a, b) => a - b);
|
|
155
|
+
return Math.round(s[Math.min(s.length - 1, Math.floor(s.length * p))] * 10) / 10;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The worst 1 s window of a frame-delta series: the fewest frames delivered in any window of `ms`
|
|
160
|
+
* (ends at each frame) and the longest single stall inside the window that lost the most time. The delta
|
|
161
|
+
* series is the timeline (cumulative sum), so no timestamps are needed.
|
|
162
|
+
*/
|
|
163
|
+
export function worstWindow(dts, ms = 1000) {
|
|
164
|
+
if (!dts.length) return { minFrames: null, fps: null, worstStall: null };
|
|
165
|
+
const t = [];
|
|
166
|
+
let acc = 0;
|
|
167
|
+
for (const d of dts) {
|
|
168
|
+
acc += d;
|
|
169
|
+
t.push(acc);
|
|
170
|
+
}
|
|
171
|
+
let minFrames = Number.POSITIVE_INFINITY;
|
|
172
|
+
let lo = 0;
|
|
173
|
+
for (let i = 0; i < t.length; i++) {
|
|
174
|
+
while (t[i] - t[lo] >= ms) lo++;
|
|
175
|
+
// only windows that are really `ms` long: skip the ramp-up at the start of the series
|
|
176
|
+
if (t[i] < ms) continue;
|
|
177
|
+
const n = i - lo + 1;
|
|
178
|
+
if (n < minFrames) minFrames = n;
|
|
179
|
+
}
|
|
180
|
+
if (!Number.isFinite(minFrames)) {
|
|
181
|
+
// a series shorter than the window: the whole of it
|
|
182
|
+
minFrames = dts.length;
|
|
183
|
+
return {
|
|
184
|
+
minFrames,
|
|
185
|
+
fps: Math.round((dts.length / (acc / 1000)) * 10) / 10,
|
|
186
|
+
worstStall: Math.round(Math.max(...dts)),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
minFrames,
|
|
191
|
+
fps: minFrames,
|
|
192
|
+
worstStall: Math.round(Math.max(...dts)),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** One phase record (as the page returns it) -> the numbers the report shows. */
|
|
197
|
+
export function summarizePhase(rec) {
|
|
198
|
+
const dts = rec.dts;
|
|
199
|
+
const w = worstWindow(dts);
|
|
200
|
+
const n = Math.max(1, rec.samples);
|
|
201
|
+
return {
|
|
202
|
+
name: rec.name,
|
|
203
|
+
frames: dts.length,
|
|
204
|
+
ms: Math.round(dts.reduce((a, b) => a + b, 0)),
|
|
205
|
+
p50: percentile(dts, 0.5),
|
|
206
|
+
p95: percentile(dts, 0.95),
|
|
207
|
+
p99: percentile(dts, 0.99),
|
|
208
|
+
max: dts.length ? Math.round(Math.max(...dts)) : null,
|
|
209
|
+
long50: dts.filter((d) => d >= 50).length,
|
|
210
|
+
worstWindowFps: w.fps,
|
|
211
|
+
onAvg: Math.round((rec.on / n) * 10) / 10,
|
|
212
|
+
onMax: rec.onMax,
|
|
213
|
+
mountedAvg: Math.round((rec.live / n) * 10) / 10,
|
|
214
|
+
mountedMax: rec.liveMax,
|
|
215
|
+
stillAvg: Math.round((rec.still / n) * 10) / 10,
|
|
216
|
+
standInAvg: Math.round((rec.standIn / n) * 10) / 10,
|
|
217
|
+
blankFrames: rec.blankFrames,
|
|
218
|
+
blankSamples: rec.samples,
|
|
219
|
+
blankBoards: rec.blankBoards,
|
|
220
|
+
zoomStart: rec.zoomStart,
|
|
221
|
+
zoomEnd: rec.zoomEnd,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const med = (xs) => {
|
|
226
|
+
const v = xs.filter((x) => typeof x === 'number' && Number.isFinite(x)).sort((a, b) => a - b);
|
|
227
|
+
if (!v.length) return null;
|
|
228
|
+
const m = Math.floor(v.length / 2);
|
|
229
|
+
return v.length % 2 ? v[m] : Math.round(((v[m - 1] + v[m]) / 2) * 10) / 10;
|
|
230
|
+
};
|
|
231
|
+
const minOf = (xs) => Math.min(...xs.filter((x) => typeof x === 'number'));
|
|
232
|
+
const maxOf = (xs) => Math.max(...xs.filter((x) => typeof x === 'number'));
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The summaries of one phase over every pass of every run -> median plus the min..max spread (the spread
|
|
236
|
+
* is the noise floor: a difference between two arms smaller than it is not a difference).
|
|
237
|
+
*/
|
|
238
|
+
export function aggregatePhase(name, summaries) {
|
|
239
|
+
const pick = (k) => summaries.map((s) => s[k]);
|
|
240
|
+
const out = { name, passes: summaries.length };
|
|
241
|
+
for (const k of [
|
|
242
|
+
'p50',
|
|
243
|
+
'p95',
|
|
244
|
+
'p99',
|
|
245
|
+
'max',
|
|
246
|
+
'long50',
|
|
247
|
+
'worstWindowFps',
|
|
248
|
+
'onAvg',
|
|
249
|
+
'mountedAvg',
|
|
250
|
+
'stillAvg',
|
|
251
|
+
'standInAvg',
|
|
252
|
+
]) {
|
|
253
|
+
out[k] = med(pick(k));
|
|
254
|
+
out[`${k}Min`] = summaries.length ? minOf(pick(k)) : null;
|
|
255
|
+
out[`${k}Max`] = summaries.length ? maxOf(pick(k)) : null;
|
|
256
|
+
}
|
|
257
|
+
out.onMax = maxOf(pick('onMax'));
|
|
258
|
+
out.mountedMax = maxOf(pick('mountedMax'));
|
|
259
|
+
out.blankFrames = pick('blankFrames').reduce((a, b) => a + b, 0);
|
|
260
|
+
out.blankSamples = pick('blankSamples').reduce((a, b) => a + b, 0);
|
|
261
|
+
out.blankBoards = maxOf(pick('blankBoards'));
|
|
262
|
+
out.frames = pick('frames').reduce((a, b) => a + b, 0);
|
|
263
|
+
return out;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ---------- result validation: the harness parks its answer on a global of the untrusted canvas origin ----------
|
|
267
|
+
|
|
268
|
+
const isNum = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
269
|
+
const isCount = (v) => Number.isInteger(v) && v >= 0;
|
|
270
|
+
|
|
271
|
+
function validPhase(p) {
|
|
272
|
+
if (!p || typeof p !== 'object') return false;
|
|
273
|
+
if (!SWEEP_PHASES.includes(p.name)) return false;
|
|
274
|
+
if (
|
|
275
|
+
!Array.isArray(p.dts) ||
|
|
276
|
+
p.dts.length > 200000 ||
|
|
277
|
+
!p.dts.every((d) => isNum(d) && d >= 0 && d < 3600000)
|
|
278
|
+
)
|
|
279
|
+
return false;
|
|
280
|
+
for (const k of ['on', 'live', 'still', 'standIn']) if (!isNum(p[k]) || p[k] < 0) return false;
|
|
281
|
+
for (const k of ['onMax', 'liveMax', 'blankFrames', 'blankBoards', 'samples'])
|
|
282
|
+
if (!isCount(p[k])) return false;
|
|
283
|
+
return isNum(p.zoomStart) && isNum(p.zoomEnd);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Shape-check the page's final result before any of it is printed or recorded (a canvas from a cloned repo
|
|
288
|
+
* can define the global ahead of the harness). Returns the object only when every leaf is the primitive it
|
|
289
|
+
* claims to be, else null.
|
|
290
|
+
*/
|
|
291
|
+
export function parseSweepResult(raw) {
|
|
292
|
+
let r;
|
|
293
|
+
try {
|
|
294
|
+
r = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
295
|
+
} catch {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
if (!r || typeof r !== 'object') return null;
|
|
299
|
+
if (r.occluded === true) {
|
|
300
|
+
const vis =
|
|
301
|
+
typeof r.visibility === 'string' ? r.visibility.slice(0, 20).replace(/[^a-z]/g, '') : '';
|
|
302
|
+
return { occluded: true, visibility: vis, idleHz: isNum(r.idleHz) ? r.idleHz : 0 };
|
|
303
|
+
}
|
|
304
|
+
if (!Array.isArray(r.passes) || !r.passes.length || r.passes.length > 50) return null;
|
|
305
|
+
for (const pass of r.passes) {
|
|
306
|
+
if (!pass || !Array.isArray(pass.phases) || pass.phases.length !== SWEEP_PHASES.length)
|
|
307
|
+
return null;
|
|
308
|
+
if (!pass.phases.every(validPhase)) return null;
|
|
309
|
+
if (typeof pass.visibility !== 'string' || !isNum(pass.idleHz)) return null;
|
|
310
|
+
}
|
|
311
|
+
const e = r.env;
|
|
312
|
+
if (!e || typeof e !== 'object') return null;
|
|
313
|
+
for (const k of ['innerW', 'innerH', 'hostW', 'hostH', 'dpr', 'artboards', 'zoomFit', 'idleHz'])
|
|
314
|
+
if (!isNum(e[k])) return null;
|
|
315
|
+
if (!Array.isArray(e.world) || e.world.length !== 4 || !e.world.every(isNum)) return null;
|
|
316
|
+
return r;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** Did any pass run on a page that was hidden / throttled? Then those numbers describe nothing a user sees. */
|
|
320
|
+
export function occlusionReason(result, minHz = 50) {
|
|
321
|
+
if (result.occluded)
|
|
322
|
+
return `the page was occluded before the run (visibility ${result.visibility || 'unknown'}, idle ${result.idleHz} Hz)`;
|
|
323
|
+
for (const [i, pass] of result.passes.entries()) {
|
|
324
|
+
if (pass.visibility !== 'visible')
|
|
325
|
+
return `pass ${i + 1} ended with visibilityState ${pass.visibility.slice(0, 20)}`;
|
|
326
|
+
if (pass.idleHz < minHz) return `pass ${i + 1} idle rAF was ${pass.idleHz} Hz (< ${minHz})`;
|
|
327
|
+
}
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** Fold several results (runs) into the per-phase aggregate. */
|
|
332
|
+
export function aggregateRuns(results) {
|
|
333
|
+
const byPhase = new Map(SWEEP_PHASES.map((p) => [p, []]));
|
|
334
|
+
for (const r of results)
|
|
335
|
+
for (const pass of r.passes)
|
|
336
|
+
for (const ph of pass.phases) byPhase.get(ph.name).push(summarizePhase(ph));
|
|
337
|
+
return SWEEP_PHASES.map((p) => aggregatePhase(p, byPhase.get(p)));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export function renderSweepReport({ label, engine, opts, results, aggregate }) {
|
|
341
|
+
const e = results[0].env;
|
|
342
|
+
const lines = [];
|
|
343
|
+
lines.push(
|
|
344
|
+
`perf sweep — ${label} | engine ${engine} | ${e.innerW}x${e.innerH} @${e.dpr}x | ${e.artboards} artboards | overview zoom ${opts.zoom} | fit zoom ${e.zoomFit}`
|
|
345
|
+
);
|
|
346
|
+
lines.push(
|
|
347
|
+
`runs ${results.length} x passes ${opts.passes} = ${results.reduce((n, r) => n + r.passes.length, 0)} samples per phase; speed ${opts.speed} px/s; ${opts.query}`
|
|
348
|
+
);
|
|
349
|
+
lines.push('');
|
|
350
|
+
lines.push(
|
|
351
|
+
'phase frames p50 p95 (min..max) p99 max worst-1s fps on-screen avg/max mounted avg/max stand-ins blank frames (boards)'
|
|
352
|
+
);
|
|
353
|
+
for (const a of aggregate) {
|
|
354
|
+
lines.push(
|
|
355
|
+
`${a.name.padEnd(18)} ${String(a.frames).padStart(7)} ${String(a.p50).padStart(5)} ${String(a.p95).padStart(5)} (${a.p95Min}..${a.p95Max})`.padEnd(
|
|
356
|
+
54
|
|
357
|
+
) +
|
|
358
|
+
` ${String(a.p99).padStart(5)} ${String(a.max).padStart(5)} ${String(a.worstWindowFps).padStart(11)}` +
|
|
359
|
+
` ${`${a.onAvg}/${a.onMax}`.padStart(16)} ${`${a.mountedAvg}/${a.mountedMax}`.padStart(15)} ${String(a.standInAvg).padStart(9)}` +
|
|
360
|
+
` ${a.blankFrames}/${a.blankSamples} (${a.blankBoards})`
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
return lines.join('\n');
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// ---------- the in-page harness ----------
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Runs in the canvas page (Playwright `evaluate` / WebDriver `execute`). Returns 'STARTED' (or 'NO_HOST'); the
|
|
370
|
+
* answer is parked on `window.__maudeSweep` ({ state, progress, result }) because the drivers cannot await.
|
|
371
|
+
* Self-contained: it may not close over anything outside its own body.
|
|
372
|
+
*/
|
|
373
|
+
export function sweepHarness(opts) {
|
|
374
|
+
const win = window;
|
|
375
|
+
const doc = document;
|
|
376
|
+
const host = doc.querySelector('.dc-canvas');
|
|
377
|
+
if (!host) return 'NO_HOST';
|
|
378
|
+
const S = { state: 'running', progress: 'starting', phase: '', result: null };
|
|
379
|
+
win.__maudeSweep = S;
|
|
380
|
+
const ZOOM_K = 0.0035; // canvas-lib WHEEL_ZOOM_K
|
|
381
|
+
const SAMPLE_EVERY = 3; // the artboard scan runs on every 3rd frame
|
|
382
|
+
const MARGIN = 20;
|
|
383
|
+
const PHASE_CAP_MS = 240000;
|
|
384
|
+
const sleep = (ms) => new Promise((r) => win.setTimeout(r, ms));
|
|
385
|
+
// The page's real rAF: while the camera moves, the canvas holds the global rAF (the frame freeze,
|
|
386
|
+
// ~250 ms per flush) so artboards do no work; the freeze keeps the unheld one on __maudeFrameFreeze.raf and
|
|
387
|
+
// that is the clock a person's screen follows (the other probes use it the same way).
|
|
388
|
+
const raf = (f) =>
|
|
389
|
+
(win.__maudeFrameFreeze ? win.__maudeFrameFreeze.raf : win.requestAnimationFrame.bind(win))(f);
|
|
390
|
+
const nextFrame = () => new Promise((r) => raf(r));
|
|
391
|
+
const cam = () => (win.__maudeViewport ? win.__maudeViewport() : null);
|
|
392
|
+
const hostBox = () => host.getBoundingClientRect();
|
|
393
|
+
const hb0 = hostBox();
|
|
394
|
+
const cx = hb0.left + hb0.width / 2;
|
|
395
|
+
const cy = hb0.top + hb0.height / 2;
|
|
396
|
+
const wheel = (dx, dy, ctrl) =>
|
|
397
|
+
host.dispatchEvent(
|
|
398
|
+
new win.WheelEvent('wheel', {
|
|
399
|
+
deltaX: dx,
|
|
400
|
+
deltaY: dy,
|
|
401
|
+
ctrlKey: !!ctrl,
|
|
402
|
+
clientX: cx,
|
|
403
|
+
clientY: cy,
|
|
404
|
+
bubbles: true,
|
|
405
|
+
cancelable: true,
|
|
406
|
+
})
|
|
407
|
+
);
|
|
408
|
+
const arts = () => Array.from(doc.querySelectorAll('[data-dc-screen]'));
|
|
409
|
+
|
|
410
|
+
// ---- artboard state ----
|
|
411
|
+
// Which artboards are on screen comes from the camera and each artboard's world rectangle (read once per
|
|
412
|
+
// phase, unmeasured) - never from an intersection observer or per-frame rects: those make the browser
|
|
413
|
+
// recompute 88 heavy artboards on every camera move, and the probe would time itself (~250 ms frames).
|
|
414
|
+
let boards = [];
|
|
415
|
+
const refreshBoards = () => {
|
|
416
|
+
const c = cam();
|
|
417
|
+
const hb = hostBox();
|
|
418
|
+
boards = arts().map((a) => {
|
|
419
|
+
const r = a.getBoundingClientRect();
|
|
420
|
+
return {
|
|
421
|
+
a,
|
|
422
|
+
id: a.getAttribute('data-dc-screen'),
|
|
423
|
+
x0: (r.left - hb.left - c.x) / c.zoom,
|
|
424
|
+
y0: (r.top - hb.top - c.y) / c.zoom,
|
|
425
|
+
x1: (r.right - hb.left - c.x) / c.zoom,
|
|
426
|
+
y1: (r.bottom - hb.top - c.y) / c.zoom,
|
|
427
|
+
};
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
const had = new Set(); // ids that have shown a still (or a held one) at some point
|
|
431
|
+
const stateOf = (a) => {
|
|
432
|
+
const s = a.getAttribute('data-dc-still');
|
|
433
|
+
if (s) return s === 'cover' ? 'cover' : 'still';
|
|
434
|
+
const ph = a.querySelector('.dc-artboard-sleeping');
|
|
435
|
+
if (ph) return ph.querySelector('canvas, img') ? 'held' : 'ph';
|
|
436
|
+
return 'live';
|
|
437
|
+
};
|
|
438
|
+
const newRec = (name) => ({
|
|
439
|
+
name,
|
|
440
|
+
dts: [],
|
|
441
|
+
on: 0,
|
|
442
|
+
onMax: 0,
|
|
443
|
+
live: 0,
|
|
444
|
+
liveMax: 0,
|
|
445
|
+
still: 0,
|
|
446
|
+
standIn: 0,
|
|
447
|
+
samples: 0,
|
|
448
|
+
blankFrames: 0,
|
|
449
|
+
blankIds: {},
|
|
450
|
+
zoomStart: (cam() || { zoom: 0 }).zoom,
|
|
451
|
+
zoomEnd: 0,
|
|
452
|
+
});
|
|
453
|
+
const sample = (rec) => {
|
|
454
|
+
let on = 0;
|
|
455
|
+
let live = 0;
|
|
456
|
+
let still = 0;
|
|
457
|
+
let standIn = 0;
|
|
458
|
+
let blank = 0;
|
|
459
|
+
const c = cam();
|
|
460
|
+
const vx0 = -c.x / c.zoom;
|
|
461
|
+
const vy0 = -c.y / c.zoom;
|
|
462
|
+
const vx1 = (hb0.width - c.x) / c.zoom;
|
|
463
|
+
const vy1 = (hb0.height - c.y) / c.zoom;
|
|
464
|
+
for (const b of boards) {
|
|
465
|
+
const a = b.a;
|
|
466
|
+
const id = b.id;
|
|
467
|
+
const st = stateOf(a);
|
|
468
|
+
if (st === 'still' || st === 'held') had.add(id);
|
|
469
|
+
if (st === 'live') live++;
|
|
470
|
+
else if (st === 'still' || st === 'held') still++;
|
|
471
|
+
if (b.x1 <= vx0 || b.x0 >= vx1 || b.y1 <= vy0 || b.y0 >= vy1) continue;
|
|
472
|
+
on++;
|
|
473
|
+
if (st === 'ph' || st === 'cover') {
|
|
474
|
+
standIn++;
|
|
475
|
+
if (had.has(id)) {
|
|
476
|
+
blank++;
|
|
477
|
+
rec.blankIds[id] = 1;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
rec.samples++;
|
|
482
|
+
rec.on += on;
|
|
483
|
+
rec.live += live;
|
|
484
|
+
rec.still += still;
|
|
485
|
+
rec.standIn += standIn;
|
|
486
|
+
if (on > rec.onMax) rec.onMax = on;
|
|
487
|
+
if (live > rec.liveMax) rec.liveMax = live;
|
|
488
|
+
if (blank) rec.blankFrames++;
|
|
489
|
+
};
|
|
490
|
+
const finish = (rec) => {
|
|
491
|
+
const c = cam();
|
|
492
|
+
rec.zoomEnd = c ? c.zoom : 0;
|
|
493
|
+
rec.blankBoards = Object.keys(rec.blankIds).length;
|
|
494
|
+
delete rec.blankIds;
|
|
495
|
+
return rec;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// One measured phase: `driver(dt, t, rec)` is called once per frame and returns true when it is finished.
|
|
499
|
+
const runPhase = (name, driver) =>
|
|
500
|
+
new Promise((resolve) => {
|
|
501
|
+
refreshBoards();
|
|
502
|
+
const rec = newRec(name);
|
|
503
|
+
let last = 0;
|
|
504
|
+
let n = 0;
|
|
505
|
+
let t0 = 0;
|
|
506
|
+
const frame = (t) => {
|
|
507
|
+
const dt = last ? t - last : 16.7;
|
|
508
|
+
if (!t0) t0 = t;
|
|
509
|
+
if (last) rec.dts.push(dt);
|
|
510
|
+
last = t;
|
|
511
|
+
// a phase that never ends (a gesture that does not land) must not hang the run
|
|
512
|
+
const done = driver(Math.min(dt, 100), t, rec) || t - t0 > PHASE_CAP_MS;
|
|
513
|
+
n++;
|
|
514
|
+
if (n % SAMPLE_EVERY === 0) sample(rec);
|
|
515
|
+
if (n % 30 === 0) {
|
|
516
|
+
const c = cam();
|
|
517
|
+
S.progress = `${S.phase} f=${n} zoom=${c ? c.zoom.toFixed(3) : '?'} x=${c ? Math.round(c.x) : '?'} y=${c ? Math.round(c.y) : '?'}`;
|
|
518
|
+
}
|
|
519
|
+
if (done) resolve(finish(rec));
|
|
520
|
+
else raf(frame);
|
|
521
|
+
};
|
|
522
|
+
raf(frame);
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
// ---- camera helpers (not measured) ----
|
|
526
|
+
const setZoom = async (target) => {
|
|
527
|
+
for (let i = 0; i < 300; i++) {
|
|
528
|
+
const c = cam();
|
|
529
|
+
const r = Math.log(target / c.zoom);
|
|
530
|
+
if (Math.abs(r) < 0.02) return;
|
|
531
|
+
wheel(0, Math.max(-50, Math.min(50, -r / ZOOM_K)), true);
|
|
532
|
+
await nextFrame();
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
const worldBox = () => {
|
|
536
|
+
const c = cam();
|
|
537
|
+
const hb = hostBox();
|
|
538
|
+
let x0 = Infinity;
|
|
539
|
+
let y0 = Infinity;
|
|
540
|
+
let x1 = -Infinity;
|
|
541
|
+
let y1 = -Infinity;
|
|
542
|
+
for (const a of arts()) {
|
|
543
|
+
const r = a.getBoundingClientRect();
|
|
544
|
+
if (!r.width) continue;
|
|
545
|
+
x0 = Math.min(x0, (r.left - hb.left - c.x) / c.zoom);
|
|
546
|
+
y0 = Math.min(y0, (r.top - hb.top - c.y) / c.zoom);
|
|
547
|
+
x1 = Math.max(x1, (r.right - hb.left - c.x) / c.zoom);
|
|
548
|
+
y1 = Math.max(y1, (r.bottom - hb.top - c.y) / c.zoom);
|
|
549
|
+
}
|
|
550
|
+
return { x0, y0, x1, y1 };
|
|
551
|
+
};
|
|
552
|
+
// a pan that does not land would time an empty gesture: refuse it, never report it
|
|
553
|
+
const moveCamTo = async (x, y) => {
|
|
554
|
+
for (let i = 0; i < 40; i++) {
|
|
555
|
+
const c = cam();
|
|
556
|
+
const dx = x - c.x;
|
|
557
|
+
const dy = y - c.y;
|
|
558
|
+
if (Math.abs(dx) < 1 && Math.abs(dy) < 1) return;
|
|
559
|
+
wheel(-dx, -dy, false);
|
|
560
|
+
await nextFrame();
|
|
561
|
+
}
|
|
562
|
+
throw new Error('the camera did not reach its start (wheel pan not applied)');
|
|
563
|
+
};
|
|
564
|
+
// the serpentine's camera waypoints at zoom z over the world box, `rows` rows at most
|
|
565
|
+
const serpentine = (z, wb, rows) => {
|
|
566
|
+
const hb = hostBox();
|
|
567
|
+
const W = hb.width;
|
|
568
|
+
const H = hb.height;
|
|
569
|
+
const ww = (wb.x1 - wb.x0) * z;
|
|
570
|
+
const wh = (wb.y1 - wb.y0) * z;
|
|
571
|
+
const xl = MARGIN - wb.x0 * z;
|
|
572
|
+
const xr = ww > W - 2 * MARGIN ? W - MARGIN - wb.x1 * z : xl;
|
|
573
|
+
const rowStep = H * 0.8;
|
|
574
|
+
const total = Math.max(1, Math.ceil(Math.max(0, wh - (H - 2 * MARGIN)) / rowStep) + 1);
|
|
575
|
+
const n = Math.min(total, rows || total);
|
|
576
|
+
const pts = [];
|
|
577
|
+
for (let r = 0; r < n; r++) {
|
|
578
|
+
let y = MARGIN - wb.y0 * z - r * rowStep;
|
|
579
|
+
// the last row stops where the world's bottom edge meets the viewport's, not a full row further
|
|
580
|
+
if (wh > H - 2 * MARGIN) y = Math.max(y, H - MARGIN - wb.y1 * z);
|
|
581
|
+
const [a, b] = r % 2 === 0 ? [xl, xr] : [xr, xl];
|
|
582
|
+
pts.push({ x: a, y }, { x: b, y });
|
|
583
|
+
}
|
|
584
|
+
return { pts, rows: n, total };
|
|
585
|
+
};
|
|
586
|
+
// a driver that walks a polyline of camera positions at `speed` px/s
|
|
587
|
+
const walker = (pts, speed) => {
|
|
588
|
+
let i = 0;
|
|
589
|
+
return (dt) => {
|
|
590
|
+
const c = cam();
|
|
591
|
+
let budget = (speed * dt) / 1000;
|
|
592
|
+
let x = c.x;
|
|
593
|
+
let y = c.y;
|
|
594
|
+
while (budget > 0 && i < pts.length) {
|
|
595
|
+
const p = pts[i];
|
|
596
|
+
const d = Math.hypot(p.x - x, p.y - y);
|
|
597
|
+
if (d <= budget) {
|
|
598
|
+
x = p.x;
|
|
599
|
+
y = p.y;
|
|
600
|
+
budget -= d;
|
|
601
|
+
i++;
|
|
602
|
+
} else {
|
|
603
|
+
x += ((p.x - x) / d) * budget;
|
|
604
|
+
y += ((p.y - y) / d) * budget;
|
|
605
|
+
budget = 0;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (Math.abs(x - c.x) > 0.01 || Math.abs(y - c.y) > 0.01)
|
|
609
|
+
wheel(-(x - c.x), -(y - c.y), false);
|
|
610
|
+
return i >= pts.length;
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
const fit = async () => {
|
|
614
|
+
for (const t of [doc, host]) {
|
|
615
|
+
t.dispatchEvent(
|
|
616
|
+
new win.KeyboardEvent('keydown', {
|
|
617
|
+
key: '0',
|
|
618
|
+
code: 'Digit0',
|
|
619
|
+
metaKey: true,
|
|
620
|
+
bubbles: true,
|
|
621
|
+
cancelable: true,
|
|
622
|
+
})
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
await sleep(900);
|
|
626
|
+
};
|
|
627
|
+
const idle = async () => {
|
|
628
|
+
// rAF callbacks over 500 ms of nothing: behind a locked screen / another window WebKit stops them
|
|
629
|
+
let hz = 0;
|
|
630
|
+
for (let w = 0; String(doc.visibilityState) !== 'hidden' && w < 20; w++) {
|
|
631
|
+
let f = 0;
|
|
632
|
+
let on = true;
|
|
633
|
+
const tick = () => {
|
|
634
|
+
if (!on) return;
|
|
635
|
+
f++;
|
|
636
|
+
raf(tick);
|
|
637
|
+
};
|
|
638
|
+
raf(tick);
|
|
639
|
+
await sleep(500);
|
|
640
|
+
on = false;
|
|
641
|
+
hz = Math.max(hz, f * 2);
|
|
642
|
+
if (hz >= 50) break;
|
|
643
|
+
}
|
|
644
|
+
return hz;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
(async () => {
|
|
648
|
+
try {
|
|
649
|
+
const vis0 = String(doc.visibilityState || 'unknown');
|
|
650
|
+
const hz0 = await idle();
|
|
651
|
+
if (vis0 === 'hidden' || hz0 < 50) {
|
|
652
|
+
S.result = { occluded: true, visibility: vis0, idleHz: hz0 };
|
|
653
|
+
S.state = 'done';
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
if (!cam()) throw new Error('no viewport hook');
|
|
657
|
+
await fit();
|
|
658
|
+
const zoomFit = cam().zoom;
|
|
659
|
+
const wb = worldBox();
|
|
660
|
+
const env = {
|
|
661
|
+
innerW: win.innerWidth,
|
|
662
|
+
innerH: win.innerHeight,
|
|
663
|
+
hostW: Math.round(hostBox().width),
|
|
664
|
+
hostH: Math.round(hostBox().height),
|
|
665
|
+
dpr: win.devicePixelRatio,
|
|
666
|
+
artboards: arts().length,
|
|
667
|
+
zoomFit,
|
|
668
|
+
idleHz: hz0,
|
|
669
|
+
world: [Math.round(wb.x0), Math.round(wb.y0), Math.round(wb.x1), Math.round(wb.y1)],
|
|
670
|
+
};
|
|
671
|
+
const passes = [];
|
|
672
|
+
// Warm-up (not measured): the stills of a board are taken the first time its artboards are seen, so a
|
|
673
|
+
// cold first sweep times the mounting of every artboard, not the revisit a person pans through. Walk
|
|
674
|
+
// the world `warmup` times, then let the stills settle.
|
|
675
|
+
if (opts.warmup > 0) {
|
|
676
|
+
S.phase = S.progress = 'warm-up';
|
|
677
|
+
await setZoom(opts.zoom);
|
|
678
|
+
await nextFrame();
|
|
679
|
+
const sw = serpentine(opts.zoom, worldBox(), 0);
|
|
680
|
+
await moveCamTo(sw.pts[0].x, sw.pts[0].y);
|
|
681
|
+
const ptsW = [];
|
|
682
|
+
for (let k = 0; k < opts.warmup; k++) ptsW.push(...sw.pts);
|
|
683
|
+
await runPhase('warmup', walker(ptsW, opts.speed));
|
|
684
|
+
await sleep(4000);
|
|
685
|
+
}
|
|
686
|
+
for (let p = 0; p < opts.passes; p++) {
|
|
687
|
+
const phases = [];
|
|
688
|
+
// 1. the whole world at the overview zoom, after a settle
|
|
689
|
+
S.phase = S.progress = `pass ${p + 1}/${opts.passes} sweep-overview`;
|
|
690
|
+
await setZoom(opts.zoom);
|
|
691
|
+
await nextFrame();
|
|
692
|
+
const w1 = worldBox();
|
|
693
|
+
const s1 = serpentine(opts.zoom, w1, 0);
|
|
694
|
+
await moveCamTo(s1.pts[0].x, s1.pts[0].y);
|
|
695
|
+
await sleep(1500);
|
|
696
|
+
// the serpentine ×N: a single sweep is ~100 frames at 60 fps, too few for a p95
|
|
697
|
+
const pts1 = [];
|
|
698
|
+
for (let k = 0; k < opts.sweeps; k++) pts1.push(...s1.pts);
|
|
699
|
+
phases.push(await runPhase('sweep-overview', walker(pts1, opts.speed)));
|
|
700
|
+
|
|
701
|
+
// 2. the zoom with the most artboards on screen (fit-all), kept moving by a small circle
|
|
702
|
+
S.phase = S.progress = `pass ${p + 1}/${opts.passes} sweep-fit`;
|
|
703
|
+
await fit();
|
|
704
|
+
const c2 = cam();
|
|
705
|
+
const t2 = { start: 0 };
|
|
706
|
+
phases.push(
|
|
707
|
+
await runPhase('sweep-fit', (_dt, t) => {
|
|
708
|
+
if (!t2.start) t2.start = t;
|
|
709
|
+
const e = t - t2.start;
|
|
710
|
+
const tx = c2.x + 120 * Math.sin((e / 2000) * Math.PI * 2);
|
|
711
|
+
const ty = c2.y + 90 * Math.sin((e / 1700) * Math.PI * 2);
|
|
712
|
+
const c = cam();
|
|
713
|
+
wheel(-(tx - c.x), -(ty - c.y), false);
|
|
714
|
+
return e >= 6000;
|
|
715
|
+
})
|
|
716
|
+
);
|
|
717
|
+
|
|
718
|
+
// 3. fit-all <-> overview, three times (a zoom event every frame, a short hold between)
|
|
719
|
+
S.phase = S.progress = `pass ${p + 1}/${opts.passes} zoom-cycles`;
|
|
720
|
+
const steps = [];
|
|
721
|
+
for (let k = 0; k < 3; k++)
|
|
722
|
+
steps.push({ to: opts.zoom }, { hold: 400 }, { to: zoomFit * 1.02 }, { hold: 400 });
|
|
723
|
+
steps.push({ to: opts.zoom });
|
|
724
|
+
let si = 0;
|
|
725
|
+
let holdUntil = 0;
|
|
726
|
+
phases.push(
|
|
727
|
+
await runPhase('zoom-cycles', (_dt, t) => {
|
|
728
|
+
if (si >= steps.length) return true;
|
|
729
|
+
const st = steps[si];
|
|
730
|
+
if (st.hold !== undefined) {
|
|
731
|
+
if (!holdUntil) holdUntil = t + st.hold;
|
|
732
|
+
if (t >= holdUntil) {
|
|
733
|
+
holdUntil = 0;
|
|
734
|
+
si++;
|
|
735
|
+
}
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
const c = cam();
|
|
739
|
+
const r = Math.log(st.to / c.zoom);
|
|
740
|
+
if (Math.abs(r) < 0.03) {
|
|
741
|
+
si++;
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
wheel(0, Math.max(-20, Math.min(20, -r / ZOOM_K)), true);
|
|
745
|
+
return false;
|
|
746
|
+
})
|
|
747
|
+
);
|
|
748
|
+
|
|
749
|
+
// 4. a sweep started the moment the last zoom ended: no settle, no re-park
|
|
750
|
+
S.phase = S.progress = `pass ${p + 1}/${opts.passes} sweep-after-zoom`;
|
|
751
|
+
const w4 = worldBox();
|
|
752
|
+
const s4 = serpentine(opts.zoom, w4, opts.afterZoomRows);
|
|
753
|
+
phases.push(await runPhase('sweep-after-zoom', walker(s4.pts, opts.speed)));
|
|
754
|
+
|
|
755
|
+
passes.push({
|
|
756
|
+
phases,
|
|
757
|
+
visibility: String(doc.visibilityState || 'unknown'),
|
|
758
|
+
idleHz: await idle(),
|
|
759
|
+
rows: s1.total,
|
|
760
|
+
});
|
|
761
|
+
await sleep(1500);
|
|
762
|
+
}
|
|
763
|
+
S.result = { passes, env };
|
|
764
|
+
S.state = 'done';
|
|
765
|
+
} catch (err) {
|
|
766
|
+
S.result = null;
|
|
767
|
+
S.state = 'error';
|
|
768
|
+
S.progress = String((err && err.message) || err).slice(0, 200);
|
|
769
|
+
}
|
|
770
|
+
})();
|
|
771
|
+
return 'STARTED';
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/** The expression a driver evaluates to start the harness. */
|
|
775
|
+
export function sweepStartExpression(opts) {
|
|
776
|
+
const safe = {
|
|
777
|
+
passes: opts.passes,
|
|
778
|
+
zoom: opts.zoom,
|
|
779
|
+
speed: opts.speed,
|
|
780
|
+
afterZoomRows: opts.afterZoomRows,
|
|
781
|
+
sweeps: opts.sweeps,
|
|
782
|
+
warmup: opts.warmup,
|
|
783
|
+
};
|
|
784
|
+
return `(${sweepHarness.toString()})(${JSON.stringify(safe)})`;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** The expression a driver polls: a JSON string `{state, progress, result}` (never the page's own object). */
|
|
788
|
+
export const SWEEP_POLL_EXPRESSION =
|
|
789
|
+
'(() => { const s = window.__maudeSweep; return s ? JSON.stringify({ state: String(s.state), progress: String(s.progress), result: s.result }) : "null"; })()';
|