@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,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file annotations/checklist-ops.ts — the checklist gestures as op batches (#113, contract
|
|
3
|
+
* 113-checklist §5.3)
|
|
4
|
+
* @scope apps/studio/annotations/checklist-ops.ts
|
|
5
|
+
* @purpose Every gesture on a checklist (tick, add, reword, remove, reorder, turn into a checklist,
|
|
6
|
+
* delete / copy the sticky) is ONE op batch, so it is one action and one ⌘Z. Each function
|
|
7
|
+
* takes the committed board and returns `{ ok, ops, label }` — `label` is the undo / history
|
|
8
|
+
* line ("Ticked “Write the post”") — or a refusal `{ ok: false, reason, message }`.
|
|
9
|
+
*
|
|
10
|
+
* Pure and DOM-free: the layer (slice 113-B) commits what these return through the op
|
|
11
|
+
* pipeline (never through the stroke diff — the stroke view carries items untouched), the AI
|
|
12
|
+
* write engine (`AiBatch`) reuses `guardLockedLists` and `withItemDeletes`, and the tests pin
|
|
13
|
+
* the batches.
|
|
14
|
+
*
|
|
15
|
+
* The lock rule (DDR-246 is a UX guard, contract §4.5): a LOCKED list still ticks; adding,
|
|
16
|
+
* removing, rewording and reordering its entries are refused with the lock line.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
fromTaskLines,
|
|
21
|
+
isChecklist,
|
|
22
|
+
itemsByList,
|
|
23
|
+
itemsOf,
|
|
24
|
+
MAX_CHECK_ITEMS,
|
|
25
|
+
} from './elements/checkitem.model.ts';
|
|
26
|
+
import { keyBetween, keysBetween } from './fractional-index.ts';
|
|
27
|
+
import { isLocked } from './lock.ts';
|
|
28
|
+
import type { Op } from './ops.ts';
|
|
29
|
+
import { validateElement } from './registry.ts';
|
|
30
|
+
import type { AnnotationElement } from './types.ts';
|
|
31
|
+
|
|
32
|
+
export type Board = ReadonlyMap<string, AnnotationElement>;
|
|
33
|
+
|
|
34
|
+
export type RefusalReason =
|
|
35
|
+
/** The entry / list is not on the board (a concurrent delete) or the entry is an orphan. */
|
|
36
|
+
| 'gone'
|
|
37
|
+
/** The target is not a sticky. */
|
|
38
|
+
| 'not-a-list'
|
|
39
|
+
/** The list is locked (and the gesture is not a tick). */
|
|
40
|
+
| 'locked'
|
|
41
|
+
/** The list already has entries. */
|
|
42
|
+
| 'already'
|
|
43
|
+
/** `MAX_CHECK_ITEMS` entries. */
|
|
44
|
+
| 'limit'
|
|
45
|
+
/** The ops could not be built (a record the registry refuses, or order keys with no room). */
|
|
46
|
+
| 'invalid';
|
|
47
|
+
|
|
48
|
+
export interface ChecklistOps {
|
|
49
|
+
ok: true;
|
|
50
|
+
/** One batch = one action = one ⌘Z. Empty when the gesture changes nothing. */
|
|
51
|
+
ops: Op[];
|
|
52
|
+
/** The undo / history line. */
|
|
53
|
+
label: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ChecklistRefusal {
|
|
57
|
+
ok: false;
|
|
58
|
+
reason: RefusalReason;
|
|
59
|
+
/** A plain sentence for a toast or an AI error. */
|
|
60
|
+
message: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type ChecklistResult = ChecklistOps | ChecklistRefusal;
|
|
64
|
+
|
|
65
|
+
const refuse = (reason: RefusalReason, message: string): ChecklistRefusal => ({
|
|
66
|
+
ok: false,
|
|
67
|
+
reason,
|
|
68
|
+
message,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const isoNow = (now?: Date): string => (now ?? new Date()).toISOString().replace(/\.\d+Z$/, 'Z');
|
|
72
|
+
|
|
73
|
+
/** `“text”` cut to a readable length; null for an empty entry. */
|
|
74
|
+
function quoted(text: unknown, max = 40): string | null {
|
|
75
|
+
if (typeof text !== 'string' || !text.trim()) return null;
|
|
76
|
+
const t = text.trim();
|
|
77
|
+
return `“${t.length > max ? `${t.slice(0, max - 1)}…` : t}”`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function titleOf(list: AnnotationElement): string {
|
|
81
|
+
return quoted(list.text) ?? 'this note';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function mintItemId(): string {
|
|
85
|
+
return `ck_${Math.random().toString(36).slice(2, 10).padEnd(8, '0')}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A genuine entry: a `checkitem` whose `list` is a sticky on this board. */
|
|
89
|
+
function entryOf(
|
|
90
|
+
board: Board,
|
|
91
|
+
itemId: string
|
|
92
|
+
): { item: AnnotationElement; list: AnnotationElement } | null {
|
|
93
|
+
const item = board.get(itemId);
|
|
94
|
+
if (!item || item.type !== 'checkitem' || typeof item.list !== 'string') return null;
|
|
95
|
+
const list = board.get(item.list);
|
|
96
|
+
return list?.type === 'sticky' ? { item, list } : null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const lockedMessage = (list: AnnotationElement, verb: string): string =>
|
|
100
|
+
`${titleOf(list)} is locked — unlock it to ${verb}`;
|
|
101
|
+
|
|
102
|
+
const gone = (what: string): ChecklistRefusal =>
|
|
103
|
+
refuse('gone', `That ${what} is gone — someone else removed it`);
|
|
104
|
+
|
|
105
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
106
|
+
// Tick
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Tick (`done: true`) or untick an entry. Allowed on a locked list. Already in that state → an empty
|
|
110
|
+
* batch (nothing to undo).
|
|
111
|
+
*/
|
|
112
|
+
export function tickItem(
|
|
113
|
+
board: Board,
|
|
114
|
+
itemId: string,
|
|
115
|
+
done: boolean,
|
|
116
|
+
who: { by: string; now?: Date }
|
|
117
|
+
): ChecklistResult {
|
|
118
|
+
const e = entryOf(board, itemId);
|
|
119
|
+
if (!e) return gone('item');
|
|
120
|
+
const was = e.item.done !== undefined;
|
|
121
|
+
const name = quoted(e.item.text) ?? 'an item';
|
|
122
|
+
if (was === done) return { ok: true, ops: [], label: `${done ? 'Ticked' : 'Unticked'} ${name}` };
|
|
123
|
+
const op: Op = done
|
|
124
|
+
? {
|
|
125
|
+
op: 'patch',
|
|
126
|
+
id: itemId,
|
|
127
|
+
set: { done: { by: who.by, at: isoNow(who.now) } },
|
|
128
|
+
expect: { done: e.item.done },
|
|
129
|
+
}
|
|
130
|
+
: { op: 'patch', id: itemId, unset: ['done'], expect: { done: e.item.done } };
|
|
131
|
+
return { ok: true, ops: [op], label: `${done ? 'Ticked' : 'Unticked'} ${name}` };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
135
|
+
// Add / reword / remove / reorder
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Add an entry. `after` = an entry id to insert after it (↵ in the middle of the list), `null` = first,
|
|
139
|
+
* omitted = last. `id` is for tests and for callers that need to focus the new row.
|
|
140
|
+
*/
|
|
141
|
+
export function addItem(
|
|
142
|
+
board: Board,
|
|
143
|
+
listId: string,
|
|
144
|
+
opts: { text?: string; id?: string; after?: string | null } = {}
|
|
145
|
+
): ChecklistResult {
|
|
146
|
+
const list = board.get(listId);
|
|
147
|
+
if (!list) return gone('note');
|
|
148
|
+
if (list.type !== 'sticky') return refuse('not-a-list', 'Only a sticky can hold a checklist');
|
|
149
|
+
if (isLocked(list)) return refuse('locked', lockedMessage(list, 'add an item'));
|
|
150
|
+
const items = itemsOf(board.values(), listId);
|
|
151
|
+
if (items.length >= MAX_CHECK_ITEMS) {
|
|
152
|
+
return refuse('limit', `A checklist holds ${MAX_CHECK_ITEMS} items at most`);
|
|
153
|
+
}
|
|
154
|
+
let lo: string | null;
|
|
155
|
+
let hi: string | null;
|
|
156
|
+
if (opts.after === undefined) {
|
|
157
|
+
lo = items[items.length - 1]?.index ?? null;
|
|
158
|
+
hi = null;
|
|
159
|
+
} else if (opts.after === null) {
|
|
160
|
+
lo = null;
|
|
161
|
+
hi = items[0]?.index ?? null;
|
|
162
|
+
} else {
|
|
163
|
+
const at = items.findIndex((i) => i.id === opts.after);
|
|
164
|
+
if (at < 0) return gone('item');
|
|
165
|
+
lo = (items[at] as AnnotationElement).index;
|
|
166
|
+
hi = items[at + 1]?.index ?? null;
|
|
167
|
+
}
|
|
168
|
+
let index: string;
|
|
169
|
+
try {
|
|
170
|
+
index = keyBetween(lo, hi);
|
|
171
|
+
} catch {
|
|
172
|
+
return refuse('invalid', 'There is no room to add an item there');
|
|
173
|
+
}
|
|
174
|
+
const id = opts.id ?? mintItemId();
|
|
175
|
+
const v = validateElement({
|
|
176
|
+
id,
|
|
177
|
+
type: 'checkitem',
|
|
178
|
+
index,
|
|
179
|
+
list: listId,
|
|
180
|
+
...(opts.text ? { text: opts.text } : {}),
|
|
181
|
+
});
|
|
182
|
+
if (!v.ok) return refuse('invalid', `Could not add that item (${v.reason})`);
|
|
183
|
+
return { ok: true, ops: [{ op: 'put', el: v.el }], label: `Added an item to ${titleOf(list)}` };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Reword an entry — one text patch carrying its merge base (concurrent rewords merge by character). */
|
|
187
|
+
export function rewordItem(board: Board, itemId: string, text: string): ChecklistResult {
|
|
188
|
+
const e = entryOf(board, itemId);
|
|
189
|
+
if (!e) return gone('item');
|
|
190
|
+
if (isLocked(e.list)) return refuse('locked', lockedMessage(e.list, 'edit its items'));
|
|
191
|
+
return {
|
|
192
|
+
ok: true,
|
|
193
|
+
ops: [{ op: 'patch', id: itemId, set: { text }, expect: { text: e.item.text ?? '' } }],
|
|
194
|
+
label: 'Edited an item',
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Remove an entry. Removing the last one makes the sticky a plain sticky again (it has no entry left). */
|
|
199
|
+
export function removeItem(board: Board, itemId: string): ChecklistResult {
|
|
200
|
+
const e = entryOf(board, itemId);
|
|
201
|
+
if (!e) return gone('item');
|
|
202
|
+
if (isLocked(e.list)) return refuse('locked', lockedMessage(e.list, 'remove its items'));
|
|
203
|
+
return { ok: true, ops: [{ op: 'delete', id: itemId }], label: 'Removed an item' };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type MoveTarget = 'up' | 'down' | 'first' | 'last' | { before: string } | { after: string };
|
|
207
|
+
|
|
208
|
+
/** Reorder an entry: one patch of its `index` between its new neighbours. */
|
|
209
|
+
export function moveItem(board: Board, itemId: string, to: MoveTarget): ChecklistResult {
|
|
210
|
+
const e = entryOf(board, itemId);
|
|
211
|
+
if (!e) return gone('item');
|
|
212
|
+
if (isLocked(e.list)) return refuse('locked', lockedMessage(e.list, 'reorder its items'));
|
|
213
|
+
const items = itemsOf(board.values(), e.list.id);
|
|
214
|
+
const at = items.findIndex((i) => i.id === itemId);
|
|
215
|
+
if (at < 0) return gone('item');
|
|
216
|
+
const rest = items.filter((i) => i.id !== itemId);
|
|
217
|
+
let pos: number; // insert position in `rest`
|
|
218
|
+
if (to === 'up') pos = Math.max(0, at - 1);
|
|
219
|
+
else if (to === 'down') pos = Math.min(rest.length, at + 1);
|
|
220
|
+
else if (to === 'first') pos = 0;
|
|
221
|
+
else if (to === 'last') pos = rest.length;
|
|
222
|
+
else {
|
|
223
|
+
const ref = 'before' in to ? to.before : to.after;
|
|
224
|
+
const i = rest.findIndex((x) => x.id === ref);
|
|
225
|
+
if (i < 0) return gone('item');
|
|
226
|
+
pos = 'before' in to ? i : i + 1;
|
|
227
|
+
}
|
|
228
|
+
const label = `Reordered ${titleOf(e.list)}`;
|
|
229
|
+
if (pos === at) return { ok: true, ops: [], label };
|
|
230
|
+
let index: string;
|
|
231
|
+
try {
|
|
232
|
+
index = keyBetween(rest[pos - 1]?.index ?? null, rest[pos]?.index ?? null);
|
|
233
|
+
} catch {
|
|
234
|
+
return refuse('invalid', 'Those items share one place in the order');
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
ok: true,
|
|
238
|
+
ops: [{ op: 'patch', id: itemId, set: { index }, expect: { index: e.item.index } }],
|
|
239
|
+
label,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
244
|
+
// Turn into checklist
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* "Turn into checklist": the sticky's task lines (`☐ ☑ - [ ] - [x]`) become entries and what is left is
|
|
248
|
+
* its title (one patch + N puts). A sticky without task lines gets one empty entry so it is a checklist.
|
|
249
|
+
*/
|
|
250
|
+
export function makeChecklist(
|
|
251
|
+
board: Board,
|
|
252
|
+
stickyId: string,
|
|
253
|
+
opts: { mint?: () => string; by?: string; now?: Date } = {}
|
|
254
|
+
): ChecklistResult {
|
|
255
|
+
const s = board.get(stickyId);
|
|
256
|
+
if (!s) return gone('note');
|
|
257
|
+
if (s.type !== 'sticky') return refuse('not-a-list', 'Only a sticky can hold a checklist');
|
|
258
|
+
if (isChecklist(board.values(), stickyId)) {
|
|
259
|
+
return refuse('already', `${titleOf(s)} is already a checklist`);
|
|
260
|
+
}
|
|
261
|
+
if (isLocked(s)) return refuse('locked', lockedMessage(s, 'turn it into a checklist'));
|
|
262
|
+
const text = typeof s.text === 'string' ? s.text : '';
|
|
263
|
+
const parsed = fromTaskLines(text);
|
|
264
|
+
const entries = parsed.items.length
|
|
265
|
+
? parsed.items.slice(0, MAX_CHECK_ITEMS)
|
|
266
|
+
: [{ text: '', done: false }];
|
|
267
|
+
const mint = opts.mint ?? mintItemId;
|
|
268
|
+
const at = isoNow(opts.now);
|
|
269
|
+
const keys = keysBetween(null, null, entries.length);
|
|
270
|
+
const ops: Op[] = [];
|
|
271
|
+
if (parsed.items.length) {
|
|
272
|
+
ops.push({ op: 'patch', id: stickyId, set: { text: parsed.title }, expect: { text } });
|
|
273
|
+
}
|
|
274
|
+
for (const [i, entry] of entries.entries()) {
|
|
275
|
+
const v = validateElement({
|
|
276
|
+
id: mint(),
|
|
277
|
+
type: 'checkitem',
|
|
278
|
+
index: keys[i],
|
|
279
|
+
list: stickyId,
|
|
280
|
+
...(entry.text ? { text: entry.text } : {}),
|
|
281
|
+
...(entry.done ? { done: { by: opts.by ?? 'Someone', at } } : {}),
|
|
282
|
+
});
|
|
283
|
+
if (!v.ok) return refuse('invalid', `Could not turn that into a checklist (${v.reason})`);
|
|
284
|
+
ops.push({ op: 'put', el: v.el });
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
ok: true,
|
|
288
|
+
ops,
|
|
289
|
+
label: `Turned ${titleOf({ ...s, text: parsed.title || text })} into a checklist`,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
294
|
+
// Delete / copy the sticky, and the lock net
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* A batch that deletes a sticky also deletes its entries (same batch = same ⌘Z). Entries already named
|
|
298
|
+
* in the batch are not repeated. A LOCKED sticky's entries are left alone: the lock guard drops the
|
|
299
|
+
* sticky's delete, and a list must never lose its entries while the sticky stays.
|
|
300
|
+
*/
|
|
301
|
+
export function withItemDeletes(board: Board, ops: readonly Op[]): Op[] {
|
|
302
|
+
const deleting = new Set<string>();
|
|
303
|
+
for (const o of ops) if (o.op === 'delete') deleting.add(o.id);
|
|
304
|
+
const byList = new Map<string, AnnotationElement[]>();
|
|
305
|
+
for (const e of board.values()) {
|
|
306
|
+
if (e.type !== 'checkitem' || typeof e.list !== 'string') continue;
|
|
307
|
+
const l = byList.get(e.list);
|
|
308
|
+
if (l) l.push(e);
|
|
309
|
+
else byList.set(e.list, [e]);
|
|
310
|
+
}
|
|
311
|
+
const extra: Op[] = [];
|
|
312
|
+
for (const id of [...deleting]) {
|
|
313
|
+
const s = board.get(id);
|
|
314
|
+
if (s?.type !== 'sticky' || isLocked(s)) continue;
|
|
315
|
+
for (const item of byList.get(id) ?? []) {
|
|
316
|
+
if (deleting.has(item.id)) continue;
|
|
317
|
+
deleting.add(item.id);
|
|
318
|
+
extra.push({ op: 'delete', id: item.id });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return extra.length ? [...ops, ...extra] : [...ops];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Copies of the entries of the lists in `listMap` (old sticky id → the copy's id): fresh ids, `list`
|
|
326
|
+
* remapped, ticks kept, order kept. An entry whose list is not in the map is not copied (a stray in a
|
|
327
|
+
* pasted payload is dropped).
|
|
328
|
+
*/
|
|
329
|
+
export function cloneItems(
|
|
330
|
+
elements: Iterable<AnnotationElement>,
|
|
331
|
+
listMap: ReadonlyMap<string, string>,
|
|
332
|
+
mint: () => string = mintItemId
|
|
333
|
+
): AnnotationElement[] {
|
|
334
|
+
const byList = itemsByList(elements);
|
|
335
|
+
const out: AnnotationElement[] = [];
|
|
336
|
+
for (const [oldId, newId] of listMap) {
|
|
337
|
+
for (const item of byList.get(oldId) ?? []) {
|
|
338
|
+
const { locked: _l, groups: _g, ...rest } = item;
|
|
339
|
+
out.push({ ...rest, id: mint(), list: newId } as AnnotationElement);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return out;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** Fields of an entry a locked list still allows to change. */
|
|
346
|
+
const LOCKED_LIST_EXEMPT: ReadonlySet<string> = new Set(['done']);
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* The lock net for entries: ops that add, remove, reword or reorder an entry of a LOCKED list. The
|
|
350
|
+
* board's own guard (`guardLockedOps`) only sees the locked sticky, and the entries are other records, so
|
|
351
|
+
* every commit path (UI and the AI engine) also asks this. Ticks pass. Returns the offending entry ids.
|
|
352
|
+
*/
|
|
353
|
+
export function guardLockedLists(
|
|
354
|
+
board: Board,
|
|
355
|
+
ops: readonly Op[]
|
|
356
|
+
): { blocked: number; ids: string[] } {
|
|
357
|
+
const ids: string[] = [];
|
|
358
|
+
for (const o of ops) {
|
|
359
|
+
let listId: string | undefined;
|
|
360
|
+
if (o.op === 'put') {
|
|
361
|
+
if (o.el.type === 'checkitem' && typeof o.el.list === 'string') listId = o.el.list;
|
|
362
|
+
} else {
|
|
363
|
+
const cur = board.get(o.id);
|
|
364
|
+
if (cur?.type === 'checkitem' && typeof cur.list === 'string') listId = cur.list;
|
|
365
|
+
}
|
|
366
|
+
if (!listId || !isLocked(board.get(listId))) continue;
|
|
367
|
+
if (o.op === 'patch') {
|
|
368
|
+
const keys = [...Object.keys(o.set ?? {}), ...(o.unset ?? [])];
|
|
369
|
+
if (keys.every((k) => LOCKED_LIST_EXEMPT.has(k))) continue;
|
|
370
|
+
}
|
|
371
|
+
ids.push(o.op === 'put' ? o.el.id : o.id);
|
|
372
|
+
}
|
|
373
|
+
return { blocked: ids.length, ids };
|
|
374
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check item (#113, contract 113-checklist §5.1) — one entry of a checklist. A checklist IS a sticky that
|
|
3
|
+
* has at least one genuine `checkitem`; the sticky's own text is the title, the entries sit under it.
|
|
4
|
+
*
|
|
5
|
+
* A format-2 element TYPE (V2-1.12 R4): a format-1 peer keeps it verbatim as an unknown type and still
|
|
6
|
+
* shows the sticky with its title. One element per entry (not an array on the sticky) because the board
|
|
7
|
+
* syncs per element and per field — two people ticking two entries at once must both land, and an array
|
|
8
|
+
* field is one last-writer-wins value (the same class of loss `ballot` was built to avoid).
|
|
9
|
+
*
|
|
10
|
+
* No geometry: `list` names the sticky it belongs to (not `parent`, which would make x/y relative and turn
|
|
11
|
+
* the sticky into a container); `index` is the order within the list. `caps.metadata` makes the stroke-view
|
|
12
|
+
* UI carry the record untouched, so a stroke-diff write never deletes what it does not draw.
|
|
13
|
+
*
|
|
14
|
+
* Orphans (an entry whose list is gone, or is not a sticky — a concurrent delete) are inert: `itemsOf`
|
|
15
|
+
* never returns them, every reader keeps them.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { id, str } from '../fields.ts';
|
|
19
|
+
import { compareOrder } from '../fractional-index.ts';
|
|
20
|
+
import type { AnnotationElement, ElementDef } from '../types.ts';
|
|
21
|
+
import { resolvedField } from './_shared.ts';
|
|
22
|
+
|
|
23
|
+
/** Genuine entries per list that are drawn / accepted by the verb. */
|
|
24
|
+
export const MAX_CHECK_ITEMS = 200;
|
|
25
|
+
/** Characters of one entry (one line: ↵ makes the next entry). */
|
|
26
|
+
export const MAX_CHECK_TEXT = 2_000;
|
|
27
|
+
|
|
28
|
+
export const checkitem: ElementDef = {
|
|
29
|
+
type: 'checkitem',
|
|
30
|
+
fields: {
|
|
31
|
+
/** The sticky this entry belongs to. */
|
|
32
|
+
list: id(true),
|
|
33
|
+
/** '' is valid (drawn as the placeholder "To do"); stored without the key. */
|
|
34
|
+
text: { ...str({ max: MAX_CHECK_TEXT, plain: true, allowEmpty: true }), def: '' },
|
|
35
|
+
/** `{ by: <person | 'AI'>, at: ISO }` — absent = open. */
|
|
36
|
+
done: resolvedField(),
|
|
37
|
+
},
|
|
38
|
+
sortedKeys: true, // a format-2 type (R5: a format-1 reader sorts an unknown type's keys)
|
|
39
|
+
caps: {
|
|
40
|
+
box: false,
|
|
41
|
+
rotatable: false,
|
|
42
|
+
resizable: false,
|
|
43
|
+
bindable: false,
|
|
44
|
+
container: false,
|
|
45
|
+
textSlot: 'text',
|
|
46
|
+
metadata: true,
|
|
47
|
+
},
|
|
48
|
+
bounds: () => null,
|
|
49
|
+
hitTest: () => false,
|
|
50
|
+
translate: () => ({}),
|
|
51
|
+
resize: () => ({}),
|
|
52
|
+
meaningful: () => true,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type Board = Iterable<AnnotationElement>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Every list's genuine entries in one pass: `list` names an existing STICKY, sorted by `compareOrder`,
|
|
59
|
+
* capped at `MAX_CHECK_ITEMS`. Lists with no genuine entry are absent from the map.
|
|
60
|
+
*/
|
|
61
|
+
export function itemsByList(elements: Board): Map<string, AnnotationElement[]> {
|
|
62
|
+
const all = [...elements];
|
|
63
|
+
const stickies = new Set<string>();
|
|
64
|
+
for (const e of all) if (e.type === 'sticky') stickies.add(e.id);
|
|
65
|
+
const out = new Map<string, AnnotationElement[]>();
|
|
66
|
+
for (const e of all) {
|
|
67
|
+
if (e.type !== 'checkitem' || typeof e.list !== 'string' || !stickies.has(e.list)) continue;
|
|
68
|
+
const list = out.get(e.list);
|
|
69
|
+
if (list) list.push(e);
|
|
70
|
+
else out.set(e.list, [e]);
|
|
71
|
+
}
|
|
72
|
+
for (const [k, list] of out) out.set(k, list.sort(compareOrder).slice(0, MAX_CHECK_ITEMS));
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The genuine entries of `listId`, in order (empty when it is not a sticky or has none). */
|
|
77
|
+
export function itemsOf(elements: Board, listId: string): AnnotationElement[] {
|
|
78
|
+
return itemsByList(elements).get(listId) ?? [];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A sticky with at least one genuine entry draws as a checklist. */
|
|
82
|
+
export function isChecklist(elements: Board, stickyId: string): boolean {
|
|
83
|
+
return itemsOf(elements, stickyId).length > 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Ticked / total (the chip "3/5"). */
|
|
87
|
+
export function progressOf(items: readonly AnnotationElement[]): { done: number; total: number } {
|
|
88
|
+
let done = 0;
|
|
89
|
+
for (const i of items) if (i.done !== undefined) done++;
|
|
90
|
+
return { done, total: items.length };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface TaskLines {
|
|
94
|
+
title: string;
|
|
95
|
+
items: Array<{ text: string; done: boolean }>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** `☐ ☑ ✓ ✔`, or a Markdown task marker `- [ ]` / `- [x]` / `* [ ]` (any case, optional bullet). */
|
|
99
|
+
const TASK_LINE = /^\s*(?:(☐|☑|✓|✔)|[-*]\s*\[( |x|X)\])\s*(.*)$/u;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Split a sticky's text into its title (the lines that are not task lines) and its entries (the task
|
|
103
|
+
* lines, in order) — the "Turn into checklist" import path, and what the old `☐` template wrote.
|
|
104
|
+
*/
|
|
105
|
+
export function fromTaskLines(text: string): TaskLines {
|
|
106
|
+
const title: string[] = [];
|
|
107
|
+
const items: TaskLines['items'] = [];
|
|
108
|
+
for (const line of text.split('\n')) {
|
|
109
|
+
const m = TASK_LINE.exec(line);
|
|
110
|
+
if (!m) {
|
|
111
|
+
title.push(line);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const glyph = m[1];
|
|
115
|
+
const box = m[2];
|
|
116
|
+
const done = glyph ? glyph !== '☐' : box !== ' ';
|
|
117
|
+
items.push({ text: (m[3] ?? '').trim(), done });
|
|
118
|
+
}
|
|
119
|
+
return { title: title.join('\n').trim(), items };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The Markdown task-list form (text exports, the comment conversion, `read-annotations` text mode). */
|
|
123
|
+
export function toTaskLines(
|
|
124
|
+
title: string,
|
|
125
|
+
items: ReadonlyArray<{ text: string; done: boolean }>
|
|
126
|
+
): string {
|
|
127
|
+
const lines = items.map((i) => `- [${i.done ? 'x' : ' '}] ${i.text}`.trimEnd());
|
|
128
|
+
return (title ? [title, ...lines] : lines).join('\n');
|
|
129
|
+
}
|
|
@@ -116,6 +116,15 @@ export function wrapLines(text: string, fontSize: number, innerW: number): numbe
|
|
|
116
116
|
return Math.max(1, lines);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/** A checklist entry is indented by its 16 px box and an 8 px gap (contract 113-checklist §5.2). */
|
|
120
|
+
export const CHECK_INDENT = 24;
|
|
121
|
+
/** Vertical gap between two entries. */
|
|
122
|
+
export const CHECK_ROW_GAP = 6;
|
|
123
|
+
/** The footer row under the entries (the progress chip, the author line). */
|
|
124
|
+
export const CHECK_FOOTER_H = 22;
|
|
125
|
+
/** What an empty entry shows (and so measures as). */
|
|
126
|
+
const CHECK_PLACEHOLDER = 'To do';
|
|
127
|
+
|
|
119
128
|
export interface StickySize {
|
|
120
129
|
w: number;
|
|
121
130
|
h: number;
|
|
@@ -125,9 +134,14 @@ export interface StickySize {
|
|
|
125
134
|
/**
|
|
126
135
|
* The size a sticky needs for `text` (cell 1): square until the words need more, then it grows to five
|
|
127
136
|
* lines, then wider (never a scrollbar), and the type gets smaller only past 120 words. GROWS ONLY — a
|
|
128
|
-
* sticky the person made roomy never shrinks on a text edit (as `grownStickyBox` before it).
|
|
137
|
+
* sticky the person made roomy never shrinks on a text edit (as `grownStickyBox` before it). A checklist
|
|
138
|
+
* passes its `items`: each entry adds a row (wrapped inside `CHECK_INDENT`) and the footer.
|
|
129
139
|
*/
|
|
130
|
-
export function fitSticky(
|
|
140
|
+
export function fitSticky(
|
|
141
|
+
cur: StickySize,
|
|
142
|
+
text: string,
|
|
143
|
+
items?: ReadonlyArray<{ text?: unknown }>
|
|
144
|
+
): StickySize {
|
|
131
145
|
let fontSize = cur.fontSize;
|
|
132
146
|
const words = wordsOf(text);
|
|
133
147
|
if (words > STICKY_SHRINK_WORDS) {
|
|
@@ -148,9 +162,47 @@ export function fitSticky(cur: StickySize, text: string): StickySize {
|
|
|
148
162
|
}
|
|
149
163
|
// 3. still more (a long essay at the ceiling): taller again, so nothing is clipped.
|
|
150
164
|
if (hFor(lines) > h) h = Math.min(STICKY_MAX_GROWN_H, hFor(lines));
|
|
165
|
+
// 4. a checklist (#113): one row per entry under the title, wrapped inside the indent, plus the footer.
|
|
166
|
+
// Grows only, and stops at the ceiling (the layer clips the rest with "+N more").
|
|
167
|
+
if (items?.length) {
|
|
168
|
+
const rowW = w - PAD_X * 2 - CHECK_INDENT;
|
|
169
|
+
let rowsH = 0;
|
|
170
|
+
for (const it of items) {
|
|
171
|
+
const t = typeof it.text === 'string' && it.text ? it.text : CHECK_PLACEHOLDER;
|
|
172
|
+
rowsH += wrapLines(t, fontSize, rowW) * lineH + CHECK_ROW_GAP;
|
|
173
|
+
}
|
|
174
|
+
const need = Math.ceil(hFor(lines) + rowsH + CHECK_FOOTER_H);
|
|
175
|
+
if (need > h) h = Math.min(STICKY_MAX_GROWN_H, need);
|
|
176
|
+
}
|
|
151
177
|
return { w, h, fontSize };
|
|
152
178
|
}
|
|
153
179
|
|
|
180
|
+
/**
|
|
181
|
+
* How many entries of a checklist no longer fit in a sticky of this size (#113 "+N more"): the title and the
|
|
182
|
+
* entries are measured the way `fitSticky` measures them, and an entry whose bottom passes the card's height
|
|
183
|
+
* (less the footer) is clipped. Only a list past `STICKY_MAX_GROWN_H`, or a card the person made small, has any.
|
|
184
|
+
*/
|
|
185
|
+
export function hiddenCheckItems(
|
|
186
|
+
size: StickySize,
|
|
187
|
+
text: string,
|
|
188
|
+
items: ReadonlyArray<{ text?: unknown }>
|
|
189
|
+
): number {
|
|
190
|
+
if (!items.length) return 0;
|
|
191
|
+
const lineH = size.fontSize * LINE_H;
|
|
192
|
+
const titleH = Math.ceil(wrapLines(text, size.fontSize, size.w - PAD_X * 2) * lineH + PAD_Y * 2);
|
|
193
|
+
const rowW = size.w - PAD_X * 2 - CHECK_INDENT;
|
|
194
|
+
const room = size.h - CHECK_FOOTER_H;
|
|
195
|
+
let used = titleH;
|
|
196
|
+
let hidden = 0;
|
|
197
|
+
for (const it of items) {
|
|
198
|
+
const t = typeof it.text === 'string' && it.text ? it.text : CHECK_PLACEHOLDER;
|
|
199
|
+
used += wrapLines(t, size.fontSize, rowW) * lineH + CHECK_ROW_GAP;
|
|
200
|
+
// the gap below the last visible entry is air, not content
|
|
201
|
+
if (used - CHECK_ROW_GAP > room) hidden++;
|
|
202
|
+
}
|
|
203
|
+
return hidden;
|
|
204
|
+
}
|
|
205
|
+
|
|
154
206
|
/** A drop on a sticky lands this far down and right, so the one under it still shows (cell 3). */
|
|
155
207
|
export const STICKY_STACK_STEP = 12;
|
|
156
208
|
|
|
@@ -487,6 +487,36 @@ export function diffToOps(
|
|
|
487
487
|
return ops;
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
+
/** T7.3b — the longest gesture label an op batch may carry (code points). */
|
|
491
|
+
export const MAX_GESTURE_LABEL = 80;
|
|
492
|
+
// C0/C1 controls, zero-width and bidi/format characters, line/paragraph separators, BOM, and
|
|
493
|
+
// interlinear annotation marks; plus lone surrogates.
|
|
494
|
+
const LABEL_STRIP =
|
|
495
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what this strips
|
|
496
|
+
/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u180e\u200b-\u200f\u2028-\u202e\u2060-\u206f\ufeff\ufff9-\ufffb]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* T7.3b (#113) — the words a person's op batch says it was ("Ticked “Write the post”"), from the
|
|
500
|
+
* canvas: untrusted text. Control and format characters become a space, blanks collapse, at most
|
|
501
|
+
* `MAX_GESTURE_LABEL` code points (an ellipsis marks a cut). Text only — every reader renders it as
|
|
502
|
+
* text, never HTML. `undefined` when there is nothing left (the lane's own label stands).
|
|
503
|
+
*/
|
|
504
|
+
export function cleanGestureLabel(v: unknown): string | undefined {
|
|
505
|
+
if (typeof v !== 'string') return undefined;
|
|
506
|
+
const s = v
|
|
507
|
+
.slice(0, 4 * MAX_GESTURE_LABEL)
|
|
508
|
+
.replace(LABEL_STRIP, ' ')
|
|
509
|
+
.replace(/\s+/g, ' ')
|
|
510
|
+
.trim();
|
|
511
|
+
if (!s) return undefined;
|
|
512
|
+
const cps = [...s];
|
|
513
|
+
if (cps.length <= MAX_GESTURE_LABEL) return s;
|
|
514
|
+
return `${cps
|
|
515
|
+
.slice(0, MAX_GESTURE_LABEL - 1)
|
|
516
|
+
.join('')
|
|
517
|
+
.trimEnd()}…`;
|
|
518
|
+
}
|
|
519
|
+
|
|
490
520
|
/** Validate an untrusted op list (from a peer / the wire) into typed ops; bad ops are dropped. */
|
|
491
521
|
export function parseOps(raw: unknown, max = 5000): { ops: Op[]; dropped: number } {
|
|
492
522
|
if (!Array.isArray(raw)) return { ops: [], dropped: 0 };
|
|
@@ -15,6 +15,7 @@ import { MAX_ELEMENT_BYTES, MAX_GROUPS_PER_ELEMENT } from './constants.ts';
|
|
|
15
15
|
import { artboardIdField, sourceField, timeRangeField } from './elements/_shared.ts';
|
|
16
16
|
import { arrow } from './elements/arrow.model.ts';
|
|
17
17
|
import { ballot } from './elements/ballot.model.ts';
|
|
18
|
+
import { checkitem } from './elements/checkitem.model.ts';
|
|
18
19
|
import { image, link, mediaref } from './elements/media.model.ts';
|
|
19
20
|
import { pen } from './elements/pen.model.ts';
|
|
20
21
|
import { section } from './elements/section.model.ts';
|
|
@@ -55,6 +56,8 @@ const DEFS: readonly ElementDef[] = [
|
|
|
55
56
|
stamp,
|
|
56
57
|
vote,
|
|
57
58
|
ballot,
|
|
59
|
+
// #113: a checklist is a sticky with these (one record per entry, no board version bump).
|
|
60
|
+
checkitem,
|
|
58
61
|
];
|
|
59
62
|
|
|
60
63
|
const TYPES = new Map(DEFS.map((d) => [d.type, d]));
|
|
@@ -205,7 +208,12 @@ export function isKnownType(type: string): boolean {
|
|
|
205
208
|
}
|
|
206
209
|
|
|
207
210
|
/** Element types format 2 added (V2-1.12 R4). A format-1 peer keeps them as unknown types. */
|
|
208
|
-
export const FORMAT2_TYPES: ReadonlySet<string> = new Set([
|
|
211
|
+
export const FORMAT2_TYPES: ReadonlySet<string> = new Set([
|
|
212
|
+
stamp.type,
|
|
213
|
+
vote.type,
|
|
214
|
+
ballot.type,
|
|
215
|
+
checkitem.type,
|
|
216
|
+
]);
|
|
209
217
|
|
|
210
218
|
export type ElementResult =
|
|
211
219
|
| { ok: true; el: AnnotationElement }
|
|
@@ -34,7 +34,8 @@ export interface BoardTemplate {
|
|
|
34
34
|
export interface BoardSpec {
|
|
35
35
|
title?: string;
|
|
36
36
|
layout?: 'columns' | 'radial' | 'flow';
|
|
37
|
-
|
|
37
|
+
/** A card is its text, or `{ text, items }` — a checklist sticky (#113). */
|
|
38
|
+
groups?: { title: string; cards?: (string | { text: string; items: string[] })[] }[];
|
|
38
39
|
nodes?: { id: string; label: string; shape?: string }[];
|
|
39
40
|
edges?: { from: string; to: string; label?: string }[];
|
|
40
41
|
}
|
|
@@ -130,7 +131,8 @@ export const TEMPLATES: readonly BoardTemplate[] = Object.freeze([
|
|
|
130
131
|
desc: 'One section, ticks',
|
|
131
132
|
thumb: 'check',
|
|
132
133
|
board: {
|
|
133
|
-
|
|
134
|
+
// #113: one real checklist sticky — a title and three empty tickable entries (not ☐ text).
|
|
135
|
+
groups: [{ title: 'Checklist', cards: [{ text: 'Checklist', items: ['', '', ''] }] }],
|
|
134
136
|
},
|
|
135
137
|
},
|
|
136
138
|
{
|