@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,149 @@
|
|
|
1
|
+
// comment-reattach.ts — "Re-attach to element" (#151 §5, T2.3 D5), the two halves of one gesture.
|
|
2
|
+
//
|
|
3
|
+
// A thread whose anchor no longer finds its element (an edit moved the id, the element was never
|
|
4
|
+
// instrumented) can be pointed at another one. The thread card (comments-overlay.tsx) asks for it;
|
|
5
|
+
// the comment mount (canvas-comment-mount.tsx), which owns the canvas click, takes the next
|
|
6
|
+
// comment-tool click as the new anchor instead of opening a composer; the overlay then sends the
|
|
7
|
+
// `reattach` op (comments/ops.ts) through the same door every other op uses.
|
|
8
|
+
//
|
|
9
|
+
// Three document events carry it, so neither side imports the other:
|
|
10
|
+
// cm:reattach-start { id } overlay → mount (arm; the mount picks the comment tool)
|
|
11
|
+
// cm:reattach { id, selection, clientX/Y } mount → overlay (the click that names the element)
|
|
12
|
+
// cm:reattach-cancel {} either side (Esc, a closed thread)
|
|
13
|
+
|
|
14
|
+
import type { WorldPoint } from './comment-anchor.ts';
|
|
15
|
+
|
|
16
|
+
export const REATTACH_START = 'cm:reattach-start';
|
|
17
|
+
export const REATTACH_PICK = 'cm:reattach';
|
|
18
|
+
export const REATTACH_CANCEL = 'cm:reattach-cancel';
|
|
19
|
+
|
|
20
|
+
/** The slice of a comment selection (dom-selection.ts `Selection`) an anchor is made of. */
|
|
21
|
+
export interface ReattachSelection {
|
|
22
|
+
selector: string;
|
|
23
|
+
index?: number;
|
|
24
|
+
dom_path?: string[];
|
|
25
|
+
tag?: string;
|
|
26
|
+
classes?: string;
|
|
27
|
+
bounds?: { x: number; y: number; w: number; h: number } | null;
|
|
28
|
+
html?: string;
|
|
29
|
+
artboardId?: string | null;
|
|
30
|
+
annotationId?: string;
|
|
31
|
+
world?: WorldPoint;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ReattachPick {
|
|
35
|
+
id: string;
|
|
36
|
+
selection: ReattachSelection;
|
|
37
|
+
clientX: number;
|
|
38
|
+
clientY: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let pending: string | null = null;
|
|
42
|
+
|
|
43
|
+
/** The thread waiting for its next element click, or null. */
|
|
44
|
+
export function pendingReattach(): string | null {
|
|
45
|
+
return pending;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function fire(type: string, detail: unknown): void {
|
|
49
|
+
if (typeof document === 'undefined') return;
|
|
50
|
+
try {
|
|
51
|
+
document.dispatchEvent(new CustomEvent(type, { detail }));
|
|
52
|
+
} catch {
|
|
53
|
+
/* CustomEvent absent — nothing to tell */
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Overlay → mount: the next element click re-attaches thread `id`. */
|
|
58
|
+
export function requestReattach(id: string): void {
|
|
59
|
+
fire(REATTACH_START, { id });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Either side: stop waiting. */
|
|
63
|
+
export function cancelReattach(): void {
|
|
64
|
+
// Always told: the two halves may be separate bundles, so this side cannot know what the other waits for.
|
|
65
|
+
pending = null;
|
|
66
|
+
fire(REATTACH_CANCEL, {});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Mount side: listen for a start, keep the pending id, and run `arm` (pick the comment tool).
|
|
71
|
+
* `onCancel` runs when the wait ends without a pick. Returns the disposer.
|
|
72
|
+
*/
|
|
73
|
+
export function listenForReattach(arm: () => void, onCancel: () => void): () => void {
|
|
74
|
+
if (typeof document === 'undefined') return () => {};
|
|
75
|
+
const onStart = (e: Event) => {
|
|
76
|
+
const id = (e as CustomEvent<{ id?: unknown }>).detail?.id;
|
|
77
|
+
if (typeof id !== 'string' || !id) return;
|
|
78
|
+
pending = id;
|
|
79
|
+
arm();
|
|
80
|
+
};
|
|
81
|
+
const onStop = () => {
|
|
82
|
+
pending = null;
|
|
83
|
+
onCancel();
|
|
84
|
+
};
|
|
85
|
+
document.addEventListener(REATTACH_START, onStart);
|
|
86
|
+
document.addEventListener(REATTACH_CANCEL, onStop);
|
|
87
|
+
return () => {
|
|
88
|
+
document.removeEventListener(REATTACH_START, onStart);
|
|
89
|
+
document.removeEventListener(REATTACH_CANCEL, onStop);
|
|
90
|
+
pending = null;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Mount side: the click that names the element. Returns true when a re-attach was waiting and took
|
|
96
|
+
* the click (the caller must NOT open a composer), false when none was.
|
|
97
|
+
*/
|
|
98
|
+
export function pickForReattach(
|
|
99
|
+
selection: ReattachSelection,
|
|
100
|
+
clientX: number,
|
|
101
|
+
clientY: number
|
|
102
|
+
): boolean {
|
|
103
|
+
const id = pending;
|
|
104
|
+
if (id === null) return false;
|
|
105
|
+
pending = null;
|
|
106
|
+
fire(REATTACH_PICK, { id, selection, clientX, clientY } satisfies ReattachPick);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Overlay side: listen for the pick. Returns the disposer. */
|
|
111
|
+
export function listenForReattachPick(
|
|
112
|
+
onPick: (pick: ReattachPick) => void,
|
|
113
|
+
onCancel: () => void
|
|
114
|
+
): () => void {
|
|
115
|
+
if (typeof document === 'undefined') return () => {};
|
|
116
|
+
const onEvent = (e: Event) => {
|
|
117
|
+
const d = (e as CustomEvent<Partial<ReattachPick>>).detail;
|
|
118
|
+
if (!d || typeof d.id !== 'string' || !d.selection || typeof d.selection.selector !== 'string')
|
|
119
|
+
return;
|
|
120
|
+
onPick(d as ReattachPick);
|
|
121
|
+
};
|
|
122
|
+
document.addEventListener(REATTACH_PICK, onEvent);
|
|
123
|
+
document.addEventListener(REATTACH_CANCEL, onCancel);
|
|
124
|
+
return () => {
|
|
125
|
+
document.removeEventListener(REATTACH_PICK, onEvent);
|
|
126
|
+
document.removeEventListener(REATTACH_CANCEL, onCancel);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** The `reattach` comment op for a pick. `anchors.artboard` is where the click landed (anchorsAt). */
|
|
131
|
+
export function reattachOpFor(
|
|
132
|
+
id: string,
|
|
133
|
+
sel: ReattachSelection,
|
|
134
|
+
anchors: { artboard?: string } = {}
|
|
135
|
+
): Record<string, unknown> {
|
|
136
|
+
return {
|
|
137
|
+
op: 'reattach',
|
|
138
|
+
id,
|
|
139
|
+
selector: sel.selector,
|
|
140
|
+
index: sel.index,
|
|
141
|
+
dom_path: sel.dom_path,
|
|
142
|
+
tag: sel.tag,
|
|
143
|
+
classes: sel.classes,
|
|
144
|
+
bounds: sel.bounds,
|
|
145
|
+
html_excerpt: sel.html,
|
|
146
|
+
...(sel.world ? { world: sel.world } : {}),
|
|
147
|
+
...(anchors.artboard ? { artboard: anchors.artboard } : {}),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
@@ -26,30 +26,38 @@ function sameAuthor(x: Signed, me: string): boolean {
|
|
|
26
26
|
return a !== '' && a === me;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
/** #168 G2: what a record of yours is signed with on its way to the canvas — never your author string. */
|
|
30
|
+
export const MINE_AUTHOR = 'You';
|
|
31
|
+
|
|
32
|
+
function stamp<T extends Signed>(x: T, mine: boolean, project = false): T & { mine?: true } {
|
|
30
33
|
const { mine: _old, ...rest } = x;
|
|
31
|
-
|
|
34
|
+
if (!mine) return rest as T & { mine?: true };
|
|
35
|
+
return (project ? { ...rest, author: MINE_AUTHOR, mine: true } : { ...rest, mine: true }) as T & {
|
|
36
|
+
mine?: true;
|
|
37
|
+
};
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
function eachWithReplies<T extends Signed>(
|
|
35
41
|
list: readonly WithThread<T>[],
|
|
36
|
-
isMine: (x: Signed) => boolean
|
|
42
|
+
isMine: (x: Signed) => boolean,
|
|
43
|
+
project = false
|
|
37
44
|
): Array<WithThread<T> & { mine?: true; thread?: Array<Signed & { mine?: true }> }> {
|
|
38
45
|
return (Array.isArray(list) ? list : []).map((c) => {
|
|
39
|
-
const out = stamp(c, isMine(c)) as WithThread<T> & { mine?: true };
|
|
46
|
+
const out = stamp(c, isMine(c), project) as WithThread<T> & { mine?: true };
|
|
40
47
|
if (Array.isArray(c.thread)) {
|
|
41
48
|
(out as { thread?: unknown }).thread = c.thread.map((r: Signed) =>
|
|
42
|
-
r && typeof r === 'object' ? stamp(r, isMine(r)) : r
|
|
49
|
+
r && typeof r === 'object' ? stamp(r, isMine(r), project) : r
|
|
43
50
|
);
|
|
44
51
|
}
|
|
45
52
|
return out as WithThread<T> & { mine?: true; thread?: Array<Signed & { mine?: true }> };
|
|
46
53
|
});
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
/** The shell side: a copy of `list` with `mine: true` on each comment / reply signed with `me
|
|
56
|
+
/** The shell side: a copy of `list` with `mine: true` on each comment / reply signed with `me` — and that
|
|
57
|
+
* record's author projected to "You" (#168 G2), so the stamp never tells the canvas which name is the viewer's. */
|
|
50
58
|
export function markMine<T extends Signed>(list: readonly WithThread<T>[], me: unknown) {
|
|
51
59
|
const name = nameOf(me);
|
|
52
|
-
return eachWithReplies(list, (x) => name !== '' && sameAuthor(x, name));
|
|
60
|
+
return eachWithReplies(list, (x) => name !== '' && sameAuthor(x, name), true);
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
/** The ids a stamped list marks as mine (comments and replies), kept for a list that arrives unstamped. */
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// Erasable TypeScript only (the hub imports it under Node).
|
|
13
13
|
|
|
14
14
|
import type { Comment, Reply } from '../api.ts';
|
|
15
|
-
import { readAnchors } from './anchors.ts';
|
|
15
|
+
import { ANCHOR_KEYS, readAnchors } from './anchors.ts';
|
|
16
16
|
import { addedMentions, mentionsOf } from './mentions.ts';
|
|
17
17
|
|
|
18
18
|
/** Same bound as a top-level comment and a reply today (`api.ts`). */
|
|
@@ -29,6 +29,7 @@ export const OP_NAMES = Object.freeze([
|
|
|
29
29
|
'reopen',
|
|
30
30
|
'edit-own',
|
|
31
31
|
'delete-own',
|
|
32
|
+
'reattach',
|
|
32
33
|
] as const);
|
|
33
34
|
export type OpName = (typeof OP_NAMES)[number];
|
|
34
35
|
|
|
@@ -95,7 +96,10 @@ export type CommentOp =
|
|
|
95
96
|
| ({ op: 'add' } & AddPayload)
|
|
96
97
|
| { op: 'reply'; id: string; body: string }
|
|
97
98
|
| { op: 'resolve' | 'reopen' | 'delete-own'; id: string }
|
|
98
|
-
| { op: 'edit-own'; id: string; text: string }
|
|
99
|
+
| { op: 'edit-own'; id: string; text: string }
|
|
100
|
+
// #151 D5 — "Re-attach to element": the thread's anchor moves onto another element. An element
|
|
101
|
+
// anchor (`AddPayload`'s, validated by `elementAnchorFields`) with a thread id instead of a text.
|
|
102
|
+
| ({ op: 'reattach'; id: string } & Omit<AddPayload, 'file' | 'text'>);
|
|
99
103
|
|
|
100
104
|
/** A stored record as these ops see it: today's Comment plus the Maude 2 authorship keys. */
|
|
101
105
|
export type CommentRecord = Comment & {
|
|
@@ -185,6 +189,11 @@ export function parseCommentOp(raw: unknown): CommentOp | null {
|
|
|
185
189
|
return { ...raw, op, file: raw.file, text: body } as CommentOp;
|
|
186
190
|
}
|
|
187
191
|
if (typeof raw.id !== 'string' || !ID_RE.test(raw.id)) return null;
|
|
192
|
+
if (op === 'reattach') {
|
|
193
|
+
// An element anchor needs its selector: a thread cannot be re-attached to nothing.
|
|
194
|
+
if (typeof raw.selector !== 'string' || !raw.selector) return null;
|
|
195
|
+
return { ...raw, op, id: raw.id, selector: raw.selector } as CommentOp;
|
|
196
|
+
}
|
|
188
197
|
if (op === 'reply') {
|
|
189
198
|
const body = text(raw.body);
|
|
190
199
|
return body ? { op, id: raw.id, body } : null;
|
|
@@ -207,13 +216,19 @@ const authorship = (actor: OpActor): Pick<CommentRecord, 'authorId' | 'authorKin
|
|
|
207
216
|
...(actor.kind === 'ai' ? { authorKind: 'ai' as const } : {}),
|
|
208
217
|
});
|
|
209
218
|
|
|
210
|
-
/**
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
219
|
+
/**
|
|
220
|
+
* The element-anchor fields of a record, from a create / re-attach payload: the same bounds either
|
|
221
|
+
* way, so a re-attach cannot store what an add would have cut. No `index: undefined` key — the
|
|
222
|
+
* record must equal its own JSON round trip.
|
|
223
|
+
*/
|
|
224
|
+
function elementAnchorFields(
|
|
225
|
+
p: Omit<AddPayload, 'file' | 'text'>
|
|
226
|
+
): Pick<
|
|
227
|
+
CommentRecord,
|
|
228
|
+
'selector' | 'index' | 'dom_path' | 'tag' | 'classes' | 'bounds' | 'html_excerpt'
|
|
229
|
+
> {
|
|
230
|
+
return {
|
|
215
231
|
selector: typeof p.selector === 'string' ? p.selector.slice(0, 2000) : '',
|
|
216
|
-
// No `index: undefined` key: the record must equal its own JSON round trip.
|
|
217
232
|
...(typeof p.index === 'number' && Number.isInteger(p.index) && p.index >= 0
|
|
218
233
|
? { index: p.index }
|
|
219
234
|
: {}),
|
|
@@ -224,6 +239,15 @@ function recordFrom(p: AddPayload, ctx: OpContext): CommentRecord {
|
|
|
224
239
|
classes: typeof p.classes === 'string' ? p.classes.slice(0, 2000) : '',
|
|
225
240
|
bounds: bounds(p.bounds),
|
|
226
241
|
html_excerpt: typeof p.html_excerpt === 'string' ? p.html_excerpt.slice(0, 2000) : '',
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** A new record from an add op: the shape `api.ts commentsAdd` writes, plus the Maude 2 keys. */
|
|
246
|
+
function recordFrom(p: AddPayload, ctx: OpContext): CommentRecord {
|
|
247
|
+
const c: CommentRecord = {
|
|
248
|
+
id: ctx.newId(),
|
|
249
|
+
file: p.file,
|
|
250
|
+
...elementAnchorFields(p),
|
|
227
251
|
text: p.text,
|
|
228
252
|
status: 'open',
|
|
229
253
|
created: ctx.now,
|
|
@@ -240,6 +264,24 @@ function recordFrom(p: AddPayload, ctx: OpContext): CommentRecord {
|
|
|
240
264
|
return c;
|
|
241
265
|
}
|
|
242
266
|
|
|
267
|
+
/**
|
|
268
|
+
* #151 D5 — move a thread onto a new element. The old element anchor goes (an `index` the new
|
|
269
|
+
* element lacks must not survive; so must not a world point, annotation, video moment or print
|
|
270
|
+
* point that belonged to the old place), the new one is read with the add op's own validators.
|
|
271
|
+
* Words, author, status and replies are not touched.
|
|
272
|
+
*/
|
|
273
|
+
function reattach(c: CommentRecord, p: Omit<AddPayload, 'file' | 'text'>): void {
|
|
274
|
+
const keep = readAnchors(p);
|
|
275
|
+
const rec = c as Record<string, unknown>;
|
|
276
|
+
// The keys must be ABSENT, not undefined: a record equals its own JSON round trip.
|
|
277
|
+
// biome-ignore lint/performance/noDelete: see above
|
|
278
|
+
delete rec.index;
|
|
279
|
+
for (const key of ANCHOR_KEYS) delete rec[key];
|
|
280
|
+
Object.assign(c, elementAnchorFields(p));
|
|
281
|
+
if (keep.world) c.world = keep.world;
|
|
282
|
+
if (keep.artboard) c.artboard = keep.artboard;
|
|
283
|
+
}
|
|
284
|
+
|
|
243
285
|
/**
|
|
244
286
|
* Apply one op. Ops are id-TOTAL, like `api.ts commentsPatch` (issue #112): a list still holding
|
|
245
287
|
* a duplicated id from an older peer has every copy changed, so resolve resolves.
|
|
@@ -282,6 +324,8 @@ export function applyCommentOp(
|
|
|
282
324
|
c.resolved_at = op.op === 'resolve' ? ctx.now : null;
|
|
283
325
|
} else if (op.op === 'edit-own') {
|
|
284
326
|
c.text = op.text;
|
|
327
|
+
} else if (op.op === 'reattach') {
|
|
328
|
+
reattach(c, op);
|
|
285
329
|
}
|
|
286
330
|
c.mentions = mentionsOf(c);
|
|
287
331
|
}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* renders for `.html` mocks where this React overlay never mounts.
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
54
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
55
55
|
import { canvasInsets } from './bridge/canvas-mode-store.ts';
|
|
56
56
|
import { type Insets, visibleRect } from './bridge/occlusion.ts';
|
|
57
57
|
import {
|
|
@@ -61,6 +61,13 @@ import {
|
|
|
61
61
|
type WorldPoint,
|
|
62
62
|
worldToClient,
|
|
63
63
|
} from './comment-anchor.ts';
|
|
64
|
+
import {
|
|
65
|
+
cancelReattach,
|
|
66
|
+
listenForReattachPick,
|
|
67
|
+
type ReattachPick,
|
|
68
|
+
reattachOpFor,
|
|
69
|
+
requestReattach,
|
|
70
|
+
} from './comment-reattach.ts';
|
|
64
71
|
import { authorFace } from './comments/author-face.ts';
|
|
65
72
|
import { fromHeadline, fromWho } from './comments/from-line.ts';
|
|
66
73
|
import {
|
|
@@ -168,6 +175,7 @@ export interface OverlayComment {
|
|
|
168
175
|
tag?: string;
|
|
169
176
|
classes?: string;
|
|
170
177
|
dom_path?: string[];
|
|
178
|
+
html_excerpt?: string;
|
|
171
179
|
/** Anchor on an annotation (sticky, shape, stroke…) — see comment-anchor.ts. */
|
|
172
180
|
annotationId?: string;
|
|
173
181
|
/** World point of the comment — the anchor of a floating comment, and the
|
|
@@ -454,6 +462,64 @@ export interface TargetRef {
|
|
|
454
462
|
classes?: string;
|
|
455
463
|
dom_path?: string[];
|
|
456
464
|
annotationId?: string;
|
|
465
|
+
/** The element's markup at capture time: what a shared-id anchor is checked against (#151 §6). */
|
|
466
|
+
html_excerpt?: string;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/** The words inside a stored `html_excerpt`, whitespace collapsed ('' = it holds none). */
|
|
470
|
+
function wordsOfMarkup(html: string | undefined): string {
|
|
471
|
+
if (!html) return '';
|
|
472
|
+
return html
|
|
473
|
+
.replace(/<[^>]*>?/g, '')
|
|
474
|
+
.replace(/ /g, ' ')
|
|
475
|
+
.replace(/</g, '<')
|
|
476
|
+
.replace(/>/g, '>')
|
|
477
|
+
.replace(/"/g, '"')
|
|
478
|
+
.replace(/'/g, "'")
|
|
479
|
+
.replace(/&/g, '&')
|
|
480
|
+
.replace(/\s+/g, ' ')
|
|
481
|
+
.trim();
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** Cut-off length of a stored excerpt (comments/ops.ts): a stored text this long may be a prefix. */
|
|
485
|
+
const EXCERPT_CUT = 1500;
|
|
486
|
+
|
|
487
|
+
function holdsWords(el: Element, stored: string): boolean {
|
|
488
|
+
const live = (el.textContent ?? '').replace(/\s+/g, ' ').trim();
|
|
489
|
+
return live === stored || (stored.length >= EXCERPT_CUT && live.startsWith(stored));
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** Only so many matches are read per look — a pin is re-resolved every frame while it floats. */
|
|
493
|
+
const SHARED_MATCH_CAP = 400;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Which of the elements a SHARED `data-cd-id` selector matches is the one the thread was made on?
|
|
497
|
+
* The stored occurrence index is the first guess (cheap, right while nothing changed). An edit that
|
|
498
|
+
* inserts or removes a row before it shifts the index onto a different element, or past the end
|
|
499
|
+
* (which used to mean "the first match"), so the guess is checked against the words the thread
|
|
500
|
+
* stored: kept when they are still there, else the match that holds them (the one nearest the
|
|
501
|
+
* stored index when several do). A record without stored words keeps the old behaviour exactly.
|
|
502
|
+
*/
|
|
503
|
+
function pickSharedMatch(all: ArrayLike<Element>, target: TargetRef): Element | null {
|
|
504
|
+
if (all.length === 0) return null;
|
|
505
|
+
const want = target.index && target.index > 0 && target.index < all.length ? target.index : 0;
|
|
506
|
+
const guess = all[want] ?? all[0] ?? null;
|
|
507
|
+
if (all.length === 1 || all.length > SHARED_MATCH_CAP) return guess;
|
|
508
|
+
const stored = wordsOfMarkup(target.html_excerpt);
|
|
509
|
+
if (!stored || (guess && holdsWords(guess, stored))) return guess;
|
|
510
|
+
const from = target.index ?? 0;
|
|
511
|
+
let best: Element | null = null;
|
|
512
|
+
let bestGap = Number.POSITIVE_INFINITY;
|
|
513
|
+
for (let i = 0; i < all.length; i++) {
|
|
514
|
+
const cand = all[i] as Element;
|
|
515
|
+
if (!holdsWords(cand, stored)) continue;
|
|
516
|
+
const gap = Math.abs(i - from);
|
|
517
|
+
if (gap < bestGap) {
|
|
518
|
+
best = cand;
|
|
519
|
+
bestGap = gap;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return best ?? guess;
|
|
457
523
|
}
|
|
458
524
|
|
|
459
525
|
/**
|
|
@@ -473,9 +539,7 @@ export function resolveCommentTarget(target: TargetRef): HTMLElement | null {
|
|
|
473
539
|
try {
|
|
474
540
|
// index disambiguates a component repeated within one artboard (querySelector
|
|
475
541
|
// alone would always grab the first match). Absent/0 → first.
|
|
476
|
-
|
|
477
|
-
const i = target.index && target.index > 0 && target.index < all.length ? target.index : 0;
|
|
478
|
-
el = (all[i] ?? all[0] ?? null) as HTMLElement | null;
|
|
542
|
+
el = pickSharedMatch(document.querySelectorAll(target.selector), target) as HTMLElement | null;
|
|
479
543
|
} catch {
|
|
480
544
|
el = null;
|
|
481
545
|
}
|
|
@@ -569,6 +633,8 @@ export function CommentsOverlay(): React.ReactNode {
|
|
|
569
633
|
const [submitting, setSubmitting] = useState(false);
|
|
570
634
|
// A sentence when the door refuses (what happened · what is safe · one verb) — the text stays put.
|
|
571
635
|
const [notice, setNotice] = useState<string | null>(null);
|
|
636
|
+
// #151 D5 — the thread waiting for the click that names its new element (comment-reattach.ts).
|
|
637
|
+
const [reattaching, setReattaching] = useState<string | null>(null);
|
|
572
638
|
// The door's answer is the thread after the op; merge it now, the broadcast confirms it later.
|
|
573
639
|
const mergeComment = useCallback((c: OverlayComment) => {
|
|
574
640
|
setComments((prev) =>
|
|
@@ -676,6 +742,8 @@ export function CommentsOverlay(): React.ReactNode {
|
|
|
676
742
|
useEffect(() => {
|
|
677
743
|
if (typeof window === 'undefined') return;
|
|
678
744
|
const onMessage = (e: MessageEvent) => {
|
|
745
|
+
// only the shell above this canvas may drive the overlay (#168 F3: a sibling frame could post here)
|
|
746
|
+
if (e.source !== window.parent) return;
|
|
679
747
|
const m = e.data as {
|
|
680
748
|
dgn?: string;
|
|
681
749
|
comments?: unknown;
|
|
@@ -925,6 +993,35 @@ export function CommentsOverlay(): React.ReactNode {
|
|
|
925
993
|
});
|
|
926
994
|
}, []);
|
|
927
995
|
|
|
996
|
+
// #151 D5 — the mount took the click that names the new element: send the `reattach` op. The thread
|
|
997
|
+
// stays open on its new place; a refusal is a sentence (the thread stays where it was).
|
|
998
|
+
const handleReattachPick = useCallback(
|
|
999
|
+
(pick: ReattachPick) => {
|
|
1000
|
+
setReattaching(null);
|
|
1001
|
+
const anchors = anchorsAt(pick.selection.artboardId, pick.clientX, pick.clientY);
|
|
1002
|
+
void shellCommentOp(reattachOpFor(pick.id, pick.selection, anchors)).then((r) => {
|
|
1003
|
+
if (r === null) return setNotice('Re-attaching needs the Maude window.');
|
|
1004
|
+
if (!r.ok) return setNotice(r.error ?? 'That did not go through.');
|
|
1005
|
+
setNotice(null);
|
|
1006
|
+
if (r.comment) mergeComment(r.comment);
|
|
1007
|
+
setFocusedId(pick.id);
|
|
1008
|
+
});
|
|
1009
|
+
},
|
|
1010
|
+
[mergeComment]
|
|
1011
|
+
);
|
|
1012
|
+
useEffect(
|
|
1013
|
+
() => listenForReattachPick(handleReattachPick, () => setReattaching(null)),
|
|
1014
|
+
[handleReattachPick]
|
|
1015
|
+
);
|
|
1016
|
+
const startReattach = useCallback((id: string) => {
|
|
1017
|
+
setReattaching(id);
|
|
1018
|
+
requestReattach(id);
|
|
1019
|
+
}, []);
|
|
1020
|
+
const stopReattach = useCallback(() => {
|
|
1021
|
+
setReattaching(null);
|
|
1022
|
+
cancelReattach();
|
|
1023
|
+
}, []);
|
|
1024
|
+
|
|
928
1025
|
const handleReply = useCallback(
|
|
929
1026
|
async (id: string, body: string): Promise<boolean> => {
|
|
930
1027
|
if (typeof fetch === 'undefined') return false;
|
|
@@ -996,14 +1093,28 @@ export function CommentsOverlay(): React.ReactNode {
|
|
|
996
1093
|
</button>
|
|
997
1094
|
</div>
|
|
998
1095
|
) : null}
|
|
1096
|
+
{reattaching ? (
|
|
1097
|
+
<div className="cm-notice" role="status" data-testid="comment-reattach-hint">
|
|
1098
|
+
<span>Click the element this comment belongs on. Esc to cancel.</span>
|
|
1099
|
+
<button
|
|
1100
|
+
type="button"
|
|
1101
|
+
className="cm-notice__x"
|
|
1102
|
+
aria-label="Cancel re-attach"
|
|
1103
|
+
onClick={stopReattach}
|
|
1104
|
+
>
|
|
1105
|
+
×
|
|
1106
|
+
</button>
|
|
1107
|
+
</div>
|
|
1108
|
+
) : null}
|
|
999
1109
|
{(() => {
|
|
1000
|
-
if (!focusedId) return null;
|
|
1110
|
+
if (!focusedId || reattaching) return null;
|
|
1001
1111
|
const focused = visible.find((c) => c.id === focusedId);
|
|
1002
1112
|
if (!focused) return null;
|
|
1003
1113
|
return (
|
|
1004
1114
|
<CommentThread
|
|
1005
1115
|
comment={focused}
|
|
1006
1116
|
sequence={indexById.get(focused.id) ?? 0}
|
|
1117
|
+
onReattach={() => startReattach(focused.id)}
|
|
1007
1118
|
onClose={() => {
|
|
1008
1119
|
setFocusedId(null);
|
|
1009
1120
|
// Drop the canvas halo when the thread closes — symmetric with
|
|
@@ -1474,7 +1585,7 @@ export function CommentComposer({
|
|
|
1474
1585
|
// while typing keeps the card glued to its anchor. Writes directly to the
|
|
1475
1586
|
// DOM so we don't re-render every frame. `placeNearPoint` picks whichever
|
|
1476
1587
|
// side actually fits the viewport instead of always growing down-right.
|
|
1477
|
-
|
|
1588
|
+
useLayoutEffect(() => {
|
|
1478
1589
|
const tick = () => {
|
|
1479
1590
|
rafRef.current = null;
|
|
1480
1591
|
const node = cardRef.current;
|
|
@@ -1483,9 +1594,12 @@ export function CommentComposer({
|
|
|
1483
1594
|
const placed = placeNearPoint(anchor, { w: node.offsetWidth, h: node.offsetHeight });
|
|
1484
1595
|
node.style.left = `${Math.round(placed.x)}px`;
|
|
1485
1596
|
node.style.top = `${Math.round(placed.y)}px`;
|
|
1597
|
+
// #170: the stylesheet keeps the card hidden until it is placed (no frame at the window's top-left)
|
|
1598
|
+
node.dataset.placed = '1';
|
|
1486
1599
|
rafRef.current = frameRaf(tick);
|
|
1487
1600
|
};
|
|
1488
|
-
|
|
1601
|
+
// placed before the first paint, then followed per frame
|
|
1602
|
+
tick();
|
|
1489
1603
|
return () => {
|
|
1490
1604
|
if (rafRef.current != null) frameCaf(rafRef.current);
|
|
1491
1605
|
};
|
|
@@ -1675,6 +1789,11 @@ function useViewerName(): string | null {
|
|
|
1675
1789
|
return name;
|
|
1676
1790
|
}
|
|
1677
1791
|
|
|
1792
|
+
/** A comment that sits on an element (or nothing yet): not a board object, a video moment or a point on paper. */
|
|
1793
|
+
function isElementAnchored(c: OverlayComment): boolean {
|
|
1794
|
+
return !c.annotationId && typeof c.t !== 'number' && !c.mm;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1678
1797
|
export function CommentThread({
|
|
1679
1798
|
comment,
|
|
1680
1799
|
sequence,
|
|
@@ -1682,6 +1801,7 @@ export function CommentThread({
|
|
|
1682
1801
|
onPatch,
|
|
1683
1802
|
onDelete,
|
|
1684
1803
|
onReply,
|
|
1804
|
+
onReattach,
|
|
1685
1805
|
focusReply = 0,
|
|
1686
1806
|
mine = false,
|
|
1687
1807
|
me,
|
|
@@ -1692,6 +1812,8 @@ export function CommentThread({
|
|
|
1692
1812
|
onPatch: (patch: Record<string, unknown>) => void;
|
|
1693
1813
|
onDelete: () => void;
|
|
1694
1814
|
onReply: (body: string) => Promise<boolean>;
|
|
1815
|
+
/** #151 D5 — "Re-attach to element": the next element click becomes this thread's anchor. */
|
|
1816
|
+
onReattach?: () => void;
|
|
1695
1817
|
/** S6.11b — non-zero (bumped per request): put the focus in the reply field, not on the dialog. */
|
|
1696
1818
|
focusReply?: number;
|
|
1697
1819
|
/** The person looking wrote this comment — they may edit its text. */
|
|
@@ -1719,7 +1841,7 @@ export function CommentThread({
|
|
|
1719
1841
|
// target through pan / zoom (FigJam parity). Writing to the dialog style
|
|
1720
1842
|
// directly avoids re-rendering every frame. `placeNearPoint` picks whichever
|
|
1721
1843
|
// side actually fits the viewport instead of always growing down-right.
|
|
1722
|
-
|
|
1844
|
+
useLayoutEffect(() => {
|
|
1723
1845
|
const tick = () => {
|
|
1724
1846
|
rafRef.current = null;
|
|
1725
1847
|
const node = dialogRef.current;
|
|
@@ -1728,9 +1850,12 @@ export function CommentThread({
|
|
|
1728
1850
|
const placed = placeNearPoint(anchor, { w: node.offsetWidth, h: node.offsetHeight });
|
|
1729
1851
|
node.style.left = `${Math.round(placed.x)}px`;
|
|
1730
1852
|
node.style.top = `${Math.round(placed.y)}px`;
|
|
1853
|
+
// #170: the stylesheet keeps the card hidden until it is placed (no frame at the window's top-left)
|
|
1854
|
+
node.dataset.placed = '1';
|
|
1731
1855
|
rafRef.current = frameRaf(tick);
|
|
1732
1856
|
};
|
|
1733
|
-
|
|
1857
|
+
// placed before the first paint, then followed per frame
|
|
1858
|
+
tick();
|
|
1734
1859
|
return () => {
|
|
1735
1860
|
if (rafRef.current != null) frameCaf(rafRef.current);
|
|
1736
1861
|
};
|
|
@@ -1877,6 +2002,18 @@ export function CommentThread({
|
|
|
1877
2002
|
<span className="cm-thread__head-end">
|
|
1878
2003
|
{canAct ? (
|
|
1879
2004
|
<span className="cm-thread__actions">
|
|
2005
|
+
{onReattach && isElementAnchored(comment) ? (
|
|
2006
|
+
<button
|
|
2007
|
+
type="button"
|
|
2008
|
+
className="cm-btn"
|
|
2009
|
+
data-testid={`comment-reattach-${comment.id}`}
|
|
2010
|
+
aria-label="Re-attach to element"
|
|
2011
|
+
title="Re-attach to element"
|
|
2012
|
+
onClick={onReattach}
|
|
2013
|
+
>
|
|
2014
|
+
Re-attach
|
|
2015
|
+
</button>
|
|
2016
|
+
) : null}
|
|
1880
2017
|
{mine && draft === null && !imported ? (
|
|
1881
2018
|
<button
|
|
1882
2019
|
type="button"
|