openplanr 3.4.0 → 3.5.0
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/CHANGELOG.md +28 -0
- package/dist/cli/commands/design.d.ts +3 -0
- package/dist/cli/commands/design.d.ts.map +1 -0
- package/dist/cli/commands/design.js +137 -0
- package/dist/cli/commands/design.js.map +1 -0
- package/dist/cli/commands/groups/operations.d.ts.map +1 -1
- package/dist/cli/commands/groups/operations.js +2 -0
- package/dist/cli/commands/groups/operations.js.map +1 -1
- package/dist/dashboard/.vite/manifest.json +1 -1
- package/dist/dashboard/assets/{index-CvQAlBy3.js → index-B-l_941W.js} +2 -2
- package/dist/dashboard/assets/{index-CvQAlBy3.js.map → index-B-l_941W.js.map} +1 -1
- package/dist/dashboard/dashboard-manifest.json +13 -13
- package/dist/dashboard/index.html +1 -1
- package/dist/services/design-artifact-service.d.ts +22 -0
- package/dist/services/design-artifact-service.d.ts.map +1 -1
- package/dist/services/design-artifact-service.js +76 -16
- package/dist/services/design-artifact-service.js.map +1 -1
- package/dist/services/runtime-manager/runtime-package.js +1 -1
- package/dist/services/runtime-manager/runtime-package.js.map +1 -1
- package/docs/CLI.md +29 -0
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +1 -1
- package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +24 -340
- package/lib/host-packages/claude/openplanr/README.md +8 -8
- package/lib/host-packages/claude/openplanr/skills/artifact/references/design-sharing.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/design/SKILL.md +23 -12
- package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +3 -3
- package/lib/host-packages/claude/openplanr/skills/design/references/hosted-canvas.md +6 -3
- package/lib/host-packages/claude/openplanr/skills/design/references/review.md +6 -6
- package/lib/host-packages/claude/openplanr/skills/design/references/team-review.md +3 -4
- package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +78 -38
- package/lib/host-packages/claude/openplanr/skills/design-loop/SKILL.md +15 -7
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +3 -3
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/review.md +6 -6
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/team-review.md +3 -4
- package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +78 -38
- package/lib/host-packages/claude/openplanr/skills/design-review/SKILL.md +25 -5
- package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +2 -2
- package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +3 -3
- package/lib/host-packages/claude/openplanr/skills/design-review/references/review.md +6 -6
- package/lib/host-packages/claude/openplanr/skills/design-review/references/team-review.md +3 -4
- package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +78 -38
- package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +7 -3
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +23 -339
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/design-sharing.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +3 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/hosted-canvas.md +6 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/review.md +6 -6
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/team-review.md +3 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +78 -38
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +3 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/review.md +6 -6
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/team-review.md +3 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +78 -38
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop.mdc +15 -7
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +2 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +3 -3
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/review.md +6 -6
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/team-review.md +3 -4
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +78 -38
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review.mdc +25 -5
- package/lib/host-packages/cursor/openplanr/rules/planr-design.mdc +23 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +7 -3
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +27 -343
- package/lib/host-packages/openai/openplanr/skills/artifact/references/design-sharing.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/design/SKILL.md +23 -12
- package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +0 -11
- package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +3 -3
- package/lib/host-packages/openai/openplanr/skills/design/references/hosted-canvas.md +6 -3
- package/lib/host-packages/openai/openplanr/skills/design/references/review.md +6 -6
- package/lib/host-packages/openai/openplanr/skills/design/references/team-review.md +3 -4
- package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +78 -38
- package/lib/host-packages/openai/openplanr/skills/design-loop/SKILL.md +15 -7
- package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +0 -11
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +3 -3
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/review.md +6 -6
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/team-review.md +3 -4
- package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +78 -38
- package/lib/host-packages/openai/openplanr/skills/design-review/SKILL.md +25 -5
- package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +0 -11
- package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +2 -2
- package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +3 -3
- package/lib/host-packages/openai/openplanr/skills/design-review/references/review.md +6 -6
- package/lib/host-packages/openai/openplanr/skills/design-review/references/team-review.md +3 -4
- package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +78 -38
- package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +7 -3
- package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +0 -11
- package/package.json +2 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +0 -1500
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +0 -2611
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +0 -12
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +0 -12
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +0 -12
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +0 -12
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +0 -1500
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +0 -2611
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +0 -1500
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +0 -2611
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
- package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +0 -12
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +0 -12
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +0 -12
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +0 -12
|
@@ -1,814 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// lib/artifact/ui/stage.mjs
|
|
4
|
-
var stage_exports = {};
|
|
5
|
-
__export(stage_exports, {
|
|
6
|
-
ARTIFACT_STAGE_EVENTS: () => ARTIFACT_STAGE_EVENTS,
|
|
7
|
-
ARTIFACT_STAGE_LIMITS: () => ARTIFACT_STAGE_LIMITS,
|
|
8
|
-
bootstrapArtifactStage: () => bootstrapArtifactStage,
|
|
9
|
-
clientPointToNormalized: () => clientPointToNormalized,
|
|
10
|
-
createArtifactStagePayload: () => createArtifactStagePayload,
|
|
11
|
-
createArtifactStageState: () => createArtifactStageState,
|
|
12
|
-
mountArtifactStage: () => mountArtifactStage,
|
|
13
|
-
normalizedPointToClient: () => normalizedPointToClient,
|
|
14
|
-
reduceArtifactStageState: () => reduceArtifactStageState,
|
|
15
|
-
resolveArtifactPresentation: () => resolveArtifactPresentation,
|
|
16
|
-
visibleArtifactIds: () => visibleArtifactIds
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// lib/artifact/ui/presentation.mjs
|
|
20
|
-
function resolveArtifactPresentation(value, {
|
|
21
|
-
mode,
|
|
22
|
-
viewMode = mode ?? "single",
|
|
23
|
-
artifactCount = 1
|
|
24
|
-
} = {}) {
|
|
25
|
-
if (value === "document" || value === "canvas") return value;
|
|
26
|
-
return artifactCount > 1 || viewMode === "variants" || viewMode === "split" ? "canvas" : "document";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// lib/artifact/ui/annotations.mjs
|
|
30
|
-
var ARTIFACT_ANNOTATION_EVENTS = Object.freeze({
|
|
31
|
-
draft: "planr:artifact-annotation-draft",
|
|
32
|
-
focus: "planr:artifact-annotation-focus"
|
|
33
|
-
});
|
|
34
|
-
var ARTIFACT_ANNOTATION_LIMITS = Object.freeze({
|
|
35
|
-
dragThreshold: 4,
|
|
36
|
-
maxCommentLength: 65536,
|
|
37
|
-
maxIdentityLength: 256
|
|
38
|
-
});
|
|
39
|
-
var INTENTS = Object.freeze(["fix", "improve", "question"]);
|
|
40
|
-
function finite(value, fallback = 0) {
|
|
41
|
-
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
42
|
-
}
|
|
43
|
-
function clamp(value, min = 0, max = 1) {
|
|
44
|
-
return Math.min(max, Math.max(min, finite(value)));
|
|
45
|
-
}
|
|
46
|
-
function normalized(value) {
|
|
47
|
-
return Math.round(clamp(value) * 1e6) / 1e6;
|
|
48
|
-
}
|
|
49
|
-
function assertRect(rect) {
|
|
50
|
-
if (!rect || !Number.isFinite(rect.left) || !Number.isFinite(rect.top) || !Number.isFinite(rect.width) || !Number.isFinite(rect.height) || rect.width <= 0 || rect.height <= 0) {
|
|
51
|
-
throw new RangeError("Artifact bounds must have positive finite dimensions.");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function clientSelectionToNormalized(rect, start, end = start, { dragThreshold = ARTIFACT_ANNOTATION_LIMITS.dragThreshold } = {}) {
|
|
55
|
-
assertRect(rect);
|
|
56
|
-
const startX = clamp(
|
|
57
|
-
finite(start?.x ?? start?.clientX, rect.left),
|
|
58
|
-
rect.left,
|
|
59
|
-
rect.left + rect.width
|
|
60
|
-
);
|
|
61
|
-
const startY = clamp(
|
|
62
|
-
finite(start?.y ?? start?.clientY, rect.top),
|
|
63
|
-
rect.top,
|
|
64
|
-
rect.top + rect.height
|
|
65
|
-
);
|
|
66
|
-
const endX = clamp(finite(end?.x ?? end?.clientX, startX), rect.left, rect.left + rect.width);
|
|
67
|
-
const endY = clamp(finite(end?.y ?? end?.clientY, startY), rect.top, rect.top + rect.height);
|
|
68
|
-
const dragged = Math.hypot(endX - startX, endY - startY) >= Math.max(0, finite(dragThreshold, 4));
|
|
69
|
-
const left = dragged ? Math.min(startX, endX) : startX;
|
|
70
|
-
const top = dragged ? Math.min(startY, endY) : startY;
|
|
71
|
-
const right = dragged ? Math.max(startX, endX) : startX;
|
|
72
|
-
const bottom = dragged ? Math.max(startY, endY) : startY;
|
|
73
|
-
return Object.freeze({
|
|
74
|
-
x: normalized((left - rect.left) / rect.width),
|
|
75
|
-
y: normalized((top - rect.top) / rect.height),
|
|
76
|
-
w: normalized((right - left) / rect.width),
|
|
77
|
-
h: normalized((bottom - top) / rect.height)
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function artifactAnchorPoint(region, viewport) {
|
|
81
|
-
const width = Number.isInteger(viewport?.width) && viewport.width > 0 ? viewport.width : 1;
|
|
82
|
-
const height = Number.isInteger(viewport?.height) && viewport.height > 0 ? viewport.height : 1;
|
|
83
|
-
return Object.freeze({
|
|
84
|
-
x: Math.round(clamp(region?.x + finite(region?.w) / 2) * width),
|
|
85
|
-
y: Math.round(clamp(region?.y + finite(region?.h) / 2) * height)
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function annotationStyle(region) {
|
|
89
|
-
const percent = (value) => `${Math.round(clamp(value) * 1e6) / 1e4}%`;
|
|
90
|
-
return Object.freeze({
|
|
91
|
-
left: percent(region?.x),
|
|
92
|
-
top: percent(region?.y),
|
|
93
|
-
width: percent(region?.w),
|
|
94
|
-
height: percent(region?.h)
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function viewportRegionToAnchorRegion(region, viewport, anchorRect) {
|
|
98
|
-
const width = Number.isInteger(viewport?.width) && viewport.width > 0 ? viewport.width : 1;
|
|
99
|
-
const height = Number.isInteger(viewport?.height) && viewport.height > 0 ? viewport.height : 1;
|
|
100
|
-
const anchorWidth = Math.max(1, finite(anchorRect?.width, 1));
|
|
101
|
-
const anchorHeight = Math.max(1, finite(anchorRect?.height, 1));
|
|
102
|
-
const left = clamp(region?.x) * width;
|
|
103
|
-
const top = clamp(region?.y) * height;
|
|
104
|
-
const right = left + clamp(region?.w) * width;
|
|
105
|
-
const bottom = top + clamp(region?.h) * height;
|
|
106
|
-
const x = clamp((left - finite(anchorRect?.x)) / anchorWidth);
|
|
107
|
-
const y = clamp((top - finite(anchorRect?.y)) / anchorHeight);
|
|
108
|
-
return Object.freeze({
|
|
109
|
-
x: normalized(x),
|
|
110
|
-
y: normalized(y),
|
|
111
|
-
w: normalized(Math.max(0, Math.min(1 - x, (right - left) / anchorWidth))),
|
|
112
|
-
h: normalized(Math.max(0, Math.min(1 - y, (bottom - top) / anchorHeight)))
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function anchorRegionToViewportRegion(region, viewport, anchorRect) {
|
|
116
|
-
const width = Number.isInteger(viewport?.width) && viewport.width > 0 ? viewport.width : 1;
|
|
117
|
-
const height = Number.isInteger(viewport?.height) && viewport.height > 0 ? viewport.height : 1;
|
|
118
|
-
const anchorWidth = Math.max(0, finite(anchorRect?.width));
|
|
119
|
-
const anchorHeight = Math.max(0, finite(anchorRect?.height));
|
|
120
|
-
return Object.freeze({
|
|
121
|
-
x: normalized((finite(anchorRect?.x) + clamp(region?.x) * anchorWidth) / width),
|
|
122
|
-
y: normalized((finite(anchorRect?.y) + clamp(region?.y) * anchorHeight) / height),
|
|
123
|
-
w: normalized(clamp(region?.w) * anchorWidth / width),
|
|
124
|
-
h: normalized(clamp(region?.h) * anchorHeight / height)
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
function domToken(value) {
|
|
128
|
-
const source = String(value);
|
|
129
|
-
let token = "";
|
|
130
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
131
|
-
token += source.charCodeAt(index).toString(16).padStart(4, "0");
|
|
132
|
-
}
|
|
133
|
-
return token;
|
|
134
|
-
}
|
|
135
|
-
function annotationDomIds(pinId) {
|
|
136
|
-
const suffix = domToken(pinId);
|
|
137
|
-
return Object.freeze({
|
|
138
|
-
pin: `planr-pin-${suffix}`,
|
|
139
|
-
thread: `planr-thread-${suffix}`
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
function text(value, max = ARTIFACT_ANNOTATION_LIMITS.maxCommentLength) {
|
|
143
|
-
return typeof value === "string" ? value.trim().slice(0, max) : "";
|
|
144
|
-
}
|
|
145
|
-
function make(document2, tag, { className, textContent, attributes = {} } = {}) {
|
|
146
|
-
const node = document2.createElement(tag);
|
|
147
|
-
if (className) node.className = className;
|
|
148
|
-
if (textContent !== void 0) node.textContent = textContent;
|
|
149
|
-
for (const [name, value] of Object.entries(attributes)) {
|
|
150
|
-
if (value !== void 0 && value !== null) node.setAttribute(name, String(value));
|
|
151
|
-
}
|
|
152
|
-
return node;
|
|
153
|
-
}
|
|
154
|
-
function setRegionStyle(node, region) {
|
|
155
|
-
const style = annotationStyle(region);
|
|
156
|
-
if (node.style.left !== style.left) node.style.left = style.left;
|
|
157
|
-
if (node.style.top !== style.top) node.style.top = style.top;
|
|
158
|
-
if (region.w > 0 || region.h > 0) {
|
|
159
|
-
if (node.style.width !== style.width) node.style.width = style.width;
|
|
160
|
-
if (node.style.height !== style.height) node.style.height = style.height;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function announce(document2, value) {
|
|
164
|
-
const node = document2.querySelector('[data-planr-slot="review-announcer"]');
|
|
165
|
-
if (node) node.textContent = value;
|
|
166
|
-
}
|
|
167
|
-
function identityName(reviewController) {
|
|
168
|
-
return text(
|
|
169
|
-
reviewController?.getIdentity?.()?.name,
|
|
170
|
-
ARTIFACT_ANNOTATION_LIMITS.maxIdentityLength
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
function createIntentPicker(document2) {
|
|
174
|
-
const group = make(document2, "div", {
|
|
175
|
-
className: "planr-intent-picker",
|
|
176
|
-
attributes: { role: "radiogroup", "aria-label": "Feedback intent" }
|
|
177
|
-
});
|
|
178
|
-
for (const [index, intent] of INTENTS.entries()) {
|
|
179
|
-
const button = make(document2, "button", {
|
|
180
|
-
textContent: intent[0].toUpperCase() + intent.slice(1),
|
|
181
|
-
attributes: {
|
|
182
|
-
type: "button",
|
|
183
|
-
role: "radio",
|
|
184
|
-
"aria-checked": String(index === 0),
|
|
185
|
-
tabindex: index === 0 ? 0 : -1,
|
|
186
|
-
"data-planr-intent": intent
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
group.append(button);
|
|
190
|
-
}
|
|
191
|
-
return group;
|
|
192
|
-
}
|
|
193
|
-
function mountArtifactAnnotations({
|
|
194
|
-
document: document2 = globalThis.document,
|
|
195
|
-
window = document2?.defaultView,
|
|
196
|
-
root = document2?.querySelector?.(".planr-shell"),
|
|
197
|
-
stageController,
|
|
198
|
-
reviewController,
|
|
199
|
-
onFocusPin
|
|
200
|
-
} = {}) {
|
|
201
|
-
if (!document2 || !window || !root || !stageController || !reviewController) return null;
|
|
202
|
-
const cleanup = [];
|
|
203
|
-
let draft = null;
|
|
204
|
-
let suspendedDraft = null;
|
|
205
|
-
let draftToken = 0;
|
|
206
|
-
let draftFieldCleanup = null;
|
|
207
|
-
let composerLayoutCleanup = null;
|
|
208
|
-
let composerReturnFocus = null;
|
|
209
|
-
const pinRecords = /* @__PURE__ */ new Map();
|
|
210
|
-
const anchorRequests = /* @__PURE__ */ new Map();
|
|
211
|
-
let destroyed = false;
|
|
212
|
-
function listen(target, type, handler, options) {
|
|
213
|
-
target.addEventListener(type, handler, options);
|
|
214
|
-
cleanup.push(() => target.removeEventListener(type, handler, options));
|
|
215
|
-
}
|
|
216
|
-
function review() {
|
|
217
|
-
return reviewController.getReview?.() ?? reviewController.getState?.()?.review ?? reviewController.getState?.();
|
|
218
|
-
}
|
|
219
|
-
function layerFor(artifactId) {
|
|
220
|
-
return [...document2.querySelectorAll("[data-planr-annotation-layer]")].find(
|
|
221
|
-
(node) => node.dataset.planrAnnotationLayer === artifactId
|
|
222
|
-
) ?? null;
|
|
223
|
-
}
|
|
224
|
-
function frameFor(artifactId) {
|
|
225
|
-
return [...document2.querySelectorAll("[data-planr-artifact-frame]")].find(
|
|
226
|
-
(node) => node.dataset.planrArtifactFrame === artifactId
|
|
227
|
-
) ?? null;
|
|
228
|
-
}
|
|
229
|
-
function focusThread(pinId) {
|
|
230
|
-
const pin = review()?.pins?.find((item) => item.id === pinId);
|
|
231
|
-
if (!pin) return;
|
|
232
|
-
reviewController.selectPin?.(pinId);
|
|
233
|
-
const state = stageController.getState();
|
|
234
|
-
if (state.activeArtifactId !== pin.artifactId) {
|
|
235
|
-
stageController.dispatch({ type: "set-active", artifactId: pin.artifactId });
|
|
236
|
-
}
|
|
237
|
-
stageController.dispatch({ type: "set-rail-open", railOpen: true });
|
|
238
|
-
queueMicrotask(() => document2.getElementById(annotationDomIds(pinId).thread)?.focus());
|
|
239
|
-
}
|
|
240
|
-
function focusPin(pinId) {
|
|
241
|
-
const pin = review()?.pins?.find((item) => item.id === pinId);
|
|
242
|
-
if (!pin) return;
|
|
243
|
-
reviewController.selectPin?.(pinId);
|
|
244
|
-
const state = stageController.getState();
|
|
245
|
-
if (state.activeArtifactId !== pin.artifactId) {
|
|
246
|
-
stageController.dispatch({ type: "set-active", artifactId: pin.artifactId });
|
|
247
|
-
}
|
|
248
|
-
queueMicrotask(() => {
|
|
249
|
-
const marker = document2.getElementById(annotationDomIds(pinId).pin);
|
|
250
|
-
if (marker?.hidden) {
|
|
251
|
-
announce(
|
|
252
|
-
document2,
|
|
253
|
-
"This pin’s element is not currently visible. The original comment remains in Review."
|
|
254
|
-
);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (onFocusPin) onFocusPin(pin);
|
|
258
|
-
else marker?.scrollIntoView?.({ block: "center", inline: "center", behavior: "smooth" });
|
|
259
|
-
marker?.focus?.({ preventScroll: true });
|
|
260
|
-
marker?.classList.add("planr-pin-highlight");
|
|
261
|
-
window.setTimeout(() => marker?.classList.remove("planr-pin-highlight"), 1200);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
function pinGeometryKey(pin) {
|
|
265
|
-
return JSON.stringify([
|
|
266
|
-
reviewController.getReviewOf?.() ?? review()?.reviewOf,
|
|
267
|
-
pin.artifactId,
|
|
268
|
-
pin.anchor,
|
|
269
|
-
pin.region,
|
|
270
|
-
pin.viewport
|
|
271
|
-
]);
|
|
272
|
-
}
|
|
273
|
-
function setPinPosition(record, region) {
|
|
274
|
-
const point = { x: region.x + region.w / 2, y: region.y + region.h / 2, w: 0, h: 0 };
|
|
275
|
-
setRegionStyle(record.button, point);
|
|
276
|
-
if (record.region) setRegionStyle(record.region, region);
|
|
277
|
-
if (record.button.hidden) record.button.hidden = false;
|
|
278
|
-
if (record.region?.hidden) record.region.hidden = false;
|
|
279
|
-
}
|
|
280
|
-
function hidePin(record) {
|
|
281
|
-
if (!record.button.hidden) record.button.hidden = true;
|
|
282
|
-
if (record.region && !record.region.hidden) record.region.hidden = true;
|
|
283
|
-
}
|
|
284
|
-
function removePin(record) {
|
|
285
|
-
record.pending = null;
|
|
286
|
-
record.button.remove();
|
|
287
|
-
record.region?.remove();
|
|
288
|
-
}
|
|
289
|
-
function refreshAnchors() {
|
|
290
|
-
if (destroyed) return;
|
|
291
|
-
const now = window.performance.now();
|
|
292
|
-
const frames = new Map(
|
|
293
|
-
[...document2.querySelectorAll("[data-planr-artifact-frame]")].map((frame) => [
|
|
294
|
-
frame.dataset.planrArtifactFrame,
|
|
295
|
-
frame
|
|
296
|
-
])
|
|
297
|
-
);
|
|
298
|
-
const records = [...pinRecords.values()].flatMap((records2) => [...records2.values()]).filter((record) => record.pin.anchor?.planrId).sort((a, b) => a.requestedAt - b.requestedAt);
|
|
299
|
-
for (const record of records) {
|
|
300
|
-
if (record.pending || now - record.requestedAt < 200 || !record.button.isConnected) continue;
|
|
301
|
-
const frame = frames.get(record.pin.artifactId);
|
|
302
|
-
const bridge = frame?.__openPlanrBridge;
|
|
303
|
-
if (!bridge?.resolve || frame.closest("[hidden]") || frame.dataset.planrBridgeTrusted === "false" || (anchorRequests.get(frame) ?? 0) >= 8)
|
|
304
|
-
continue;
|
|
305
|
-
const request = {}, key = record.geometryKey, pin = record.pin;
|
|
306
|
-
record.pending = request;
|
|
307
|
-
record.requestedAt = now;
|
|
308
|
-
anchorRequests.set(frame, (anchorRequests.get(frame) ?? 0) + 1);
|
|
309
|
-
Promise.resolve().then(() => bridge.resolve(pin.anchor.planrId, pin.anchor.screen)).then((anchor) => {
|
|
310
|
-
if (destroyed || record.pending !== request || record.geometryKey !== key || !record.button.isConnected || frame.__openPlanrBridge !== bridge)
|
|
311
|
-
return;
|
|
312
|
-
if (!anchor || anchor.rect.width <= 0 || anchor.rect.height <= 0) {
|
|
313
|
-
hidePin(record);
|
|
314
|
-
if (record.button.dataset.planrAnchorStatus !== "unavailable")
|
|
315
|
-
record.button.dataset.planrAnchorStatus = "unavailable";
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
const projected = anchorRegionToViewportRegion(
|
|
319
|
-
pin.region,
|
|
320
|
-
anchor.viewport ?? pin.viewport,
|
|
321
|
-
anchor.rect
|
|
322
|
-
);
|
|
323
|
-
setPinPosition(record, projected);
|
|
324
|
-
if (record.button.dataset.planrAnchorStatus !== "resolved")
|
|
325
|
-
record.button.dataset.planrAnchorStatus = "resolved";
|
|
326
|
-
}).catch(() => {
|
|
327
|
-
}).finally(() => {
|
|
328
|
-
const remaining = (anchorRequests.get(frame) ?? 1) - 1;
|
|
329
|
-
if (remaining > 0) anchorRequests.set(frame, remaining);
|
|
330
|
-
else anchorRequests.delete(frame);
|
|
331
|
-
if (record.pending === request) record.pending = null;
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
function renderPins() {
|
|
336
|
-
if (destroyed) return;
|
|
337
|
-
const pins = Array.isArray(review()?.pins) ? review().pins : [];
|
|
338
|
-
const layers = new Set(document2.querySelectorAll("[data-planr-annotation-layer]"));
|
|
339
|
-
for (const [layer, records] of pinRecords) {
|
|
340
|
-
if (layers.has(layer)) continue;
|
|
341
|
-
for (const record of records.values()) removePin(record);
|
|
342
|
-
pinRecords.delete(layer);
|
|
343
|
-
}
|
|
344
|
-
for (const layer of layers) {
|
|
345
|
-
let records = pinRecords.get(layer);
|
|
346
|
-
if (!records) {
|
|
347
|
-
records = /* @__PURE__ */ new Map();
|
|
348
|
-
pinRecords.set(layer, records);
|
|
349
|
-
}
|
|
350
|
-
const current = /* @__PURE__ */ new Set();
|
|
351
|
-
for (const [index, pin] of pins.entries()) {
|
|
352
|
-
if (pin.artifactId !== layer.dataset.planrAnnotationLayer) continue;
|
|
353
|
-
current.add(pin.id);
|
|
354
|
-
const ids = annotationDomIds(pin.id), ordinal = index + 1;
|
|
355
|
-
const hasRegion = pin.region.w > 0 || pin.region.h > 0;
|
|
356
|
-
let record = records.get(pin.id);
|
|
357
|
-
if (!record) {
|
|
358
|
-
const button = make(document2, "button", {
|
|
359
|
-
attributes: {
|
|
360
|
-
type: "button",
|
|
361
|
-
id: ids.pin,
|
|
362
|
-
"data-planr-pin-id": pin.id,
|
|
363
|
-
"aria-controls": ids.thread
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
button.addEventListener("click", () => focusThread(pin.id));
|
|
367
|
-
layer.append(button);
|
|
368
|
-
record = {
|
|
369
|
-
button,
|
|
370
|
-
region: null,
|
|
371
|
-
pin,
|
|
372
|
-
geometryKey: null,
|
|
373
|
-
pending: null,
|
|
374
|
-
requestedAt: -Infinity
|
|
375
|
-
};
|
|
376
|
-
records.set(pin.id, record);
|
|
377
|
-
}
|
|
378
|
-
record.pin = pin;
|
|
379
|
-
if (hasRegion && !record.region) {
|
|
380
|
-
record.region = make(document2, "span", {
|
|
381
|
-
attributes: { "data-planr-pin-region-id": pin.id, "aria-hidden": "true" }
|
|
382
|
-
});
|
|
383
|
-
layer.insertBefore(record.region, record.button);
|
|
384
|
-
} else if (!hasRegion && record.region) {
|
|
385
|
-
record.region.remove();
|
|
386
|
-
record.region = null;
|
|
387
|
-
}
|
|
388
|
-
const buttonClass = `planr-pin planr-pin-${pin.intent} planr-pin-${pin.status}${hasRegion ? " planr-pin-region-handle" : ""}${record.button.classList.contains("planr-pin-highlight") ? " planr-pin-highlight" : ""}`;
|
|
389
|
-
if (record.button.className !== buttonClass) record.button.className = buttonClass;
|
|
390
|
-
if (record.button.textContent !== String(ordinal))
|
|
391
|
-
record.button.textContent = String(ordinal);
|
|
392
|
-
for (const [name, value] of Object.entries({
|
|
393
|
-
"data-planr-intent": pin.intent,
|
|
394
|
-
"data-planr-status": pin.status,
|
|
395
|
-
"aria-label": `${pin.intent} comment ${ordinal}: ${pin.comment}`
|
|
396
|
-
})) {
|
|
397
|
-
if (record.button.getAttribute(name) !== value) record.button.setAttribute(name, value);
|
|
398
|
-
}
|
|
399
|
-
if (record.region) {
|
|
400
|
-
const regionClass = `planr-pin-region planr-pin-region-${pin.intent} planr-pin-region-${pin.status}`;
|
|
401
|
-
if (record.region.className !== regionClass) record.region.className = regionClass;
|
|
402
|
-
}
|
|
403
|
-
const key = pinGeometryKey(pin);
|
|
404
|
-
if (record.geometryKey !== key) {
|
|
405
|
-
record.geometryKey = key;
|
|
406
|
-
record.pending = null;
|
|
407
|
-
record.requestedAt = -Infinity;
|
|
408
|
-
if (pin.anchor?.planrId) hidePin(record);
|
|
409
|
-
else {
|
|
410
|
-
delete record.button.dataset.planrAnchorStatus;
|
|
411
|
-
setPinPosition(record, pin.region);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
for (const [id, record] of records) {
|
|
416
|
-
if (!current.has(id)) {
|
|
417
|
-
removePin(record);
|
|
418
|
-
records.delete(id);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
refreshAnchors();
|
|
423
|
-
}
|
|
424
|
-
function closeComposer({ restoreFocus = false, preserveDraft = false } = {}) {
|
|
425
|
-
const snapshot = preserveDraft ? snapshotDraft() : null;
|
|
426
|
-
draftFieldCleanup?.();
|
|
427
|
-
draftFieldCleanup = null;
|
|
428
|
-
composerLayoutCleanup?.();
|
|
429
|
-
composerLayoutCleanup = null;
|
|
430
|
-
const activeLayer = draft ? layerFor(draft.artifactId) : null;
|
|
431
|
-
const composer = root.querySelector("[data-planr-annotation-composer]");
|
|
432
|
-
try {
|
|
433
|
-
if (composer?.matches(":popover-open")) composer.hidePopover();
|
|
434
|
-
} catch {
|
|
435
|
-
}
|
|
436
|
-
composer?.remove();
|
|
437
|
-
draft = null;
|
|
438
|
-
suspendedDraft = snapshot;
|
|
439
|
-
draftToken += 1;
|
|
440
|
-
if (activeLayer && stageController.getState().reviewMode !== "comment") {
|
|
441
|
-
activeLayer.setAttribute("aria-disabled", "true");
|
|
442
|
-
}
|
|
443
|
-
if (restoreFocus) {
|
|
444
|
-
const target = composerReturnFocus?.isConnected && composerReturnFocus !== document2.body ? composerReturnFocus : activeLayer;
|
|
445
|
-
target?.focus?.({ preventScroll: true });
|
|
446
|
-
}
|
|
447
|
-
composerReturnFocus = null;
|
|
448
|
-
}
|
|
449
|
-
async function resolveAnchor(token, candidate) {
|
|
450
|
-
const frame = frameFor(candidate.artifactId);
|
|
451
|
-
const point = artifactAnchorPoint(candidate.region, candidate.viewport);
|
|
452
|
-
let result = null;
|
|
453
|
-
try {
|
|
454
|
-
const anchor = frame?.__openPlanrBridge?.hitTest?.(point.x, point.y);
|
|
455
|
-
if (anchor) {
|
|
456
|
-
result = await Promise.race([
|
|
457
|
-
anchor,
|
|
458
|
-
new Promise((resolve) => window.setTimeout(() => resolve(null), 800))
|
|
459
|
-
]);
|
|
460
|
-
}
|
|
461
|
-
} catch {
|
|
462
|
-
result = null;
|
|
463
|
-
}
|
|
464
|
-
if (token !== draftToken || !draft || draft.artifactId !== candidate.artifactId) return;
|
|
465
|
-
if (result?.planrId) {
|
|
466
|
-
draft.anchor = Object.freeze({
|
|
467
|
-
planrId: String(result.planrId).slice(0, 512),
|
|
468
|
-
...result.screen ? { screen: String(result.screen).slice(0, 128) } : {}
|
|
469
|
-
});
|
|
470
|
-
draft.region = viewportRegionToAnchorRegion(draft.region, draft.viewport, result.rect);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
function positionComposer() {
|
|
474
|
-
const composer = root.querySelector("[data-planr-annotation-composer]");
|
|
475
|
-
const layer = draft && layerFor(draft.artifactId);
|
|
476
|
-
if (!composer || !layer) return;
|
|
477
|
-
const visual = window.visualViewport;
|
|
478
|
-
const viewport = {
|
|
479
|
-
x: finite(visual?.offsetLeft),
|
|
480
|
-
y: finite(visual?.offsetTop),
|
|
481
|
-
width: finite(visual?.width, window.innerWidth),
|
|
482
|
-
height: finite(visual?.height, window.innerHeight)
|
|
483
|
-
};
|
|
484
|
-
const margin = Math.min(12, viewport.width / 8, viewport.height / 8);
|
|
485
|
-
const availableWidth = Math.max(1, viewport.width - margin * 2), availableHeight = Math.max(1, viewport.height - margin * 2);
|
|
486
|
-
composer.style.width = `${Math.min(360, availableWidth)}px`;
|
|
487
|
-
composer.style.maxHeight = `${Math.min(620, availableHeight)}px`;
|
|
488
|
-
const bounds = layer.getBoundingClientRect();
|
|
489
|
-
const point = {
|
|
490
|
-
x: bounds.left + clamp(draft.displayRegion.x + draft.displayRegion.w / 2) * bounds.width,
|
|
491
|
-
y: bounds.top + clamp(draft.displayRegion.y + draft.displayRegion.h / 2) * bounds.height
|
|
492
|
-
};
|
|
493
|
-
const size = composer.getBoundingClientRect();
|
|
494
|
-
const width = Math.min(size.width || 360, availableWidth), height = Math.min(size.height || 360, availableHeight);
|
|
495
|
-
const left = point.x + 16 + width <= viewport.x + viewport.width - margin ? point.x + 16 : point.x - width - 16;
|
|
496
|
-
composer.style.left = `${clamp(left, viewport.x + margin, viewport.x + viewport.width - width - margin)}px`;
|
|
497
|
-
composer.style.top = `${clamp(point.y + 16, viewport.y + margin, viewport.y + viewport.height - height - margin)}px`;
|
|
498
|
-
}
|
|
499
|
-
function openComposer(detail, { restoredDraft = null } = {}) {
|
|
500
|
-
const opener = document2.activeElement;
|
|
501
|
-
closeComposer();
|
|
502
|
-
composerReturnFocus = opener;
|
|
503
|
-
const layer = layerFor(detail.artifactId);
|
|
504
|
-
if (!layer) return;
|
|
505
|
-
draftToken += 1;
|
|
506
|
-
const token = draftToken;
|
|
507
|
-
draft = {
|
|
508
|
-
artifactId: detail.artifactId,
|
|
509
|
-
region: Object.freeze({ ...detail.region }),
|
|
510
|
-
viewport: Object.freeze({ ...detail.viewport }),
|
|
511
|
-
variant: typeof detail.variant === "string" && detail.variant.length > 0 ? detail.variant : detail.artifactId,
|
|
512
|
-
anchor: restoredDraft?.anchor ?? null,
|
|
513
|
-
displayRegion: Object.freeze({ ...restoredDraft?.displayRegion ?? detail.region })
|
|
514
|
-
};
|
|
515
|
-
const composer = make(document2, "form", {
|
|
516
|
-
className: "planr-annotation-composer",
|
|
517
|
-
attributes: {
|
|
518
|
-
"data-planr-annotation-composer": "",
|
|
519
|
-
role: "dialog",
|
|
520
|
-
popover: "manual",
|
|
521
|
-
"aria-label": "Add artifact comment"
|
|
522
|
-
}
|
|
523
|
-
});
|
|
524
|
-
const header = make(document2, "header", { className: "planr-composer-header" });
|
|
525
|
-
const heading = make(document2, "strong", { textContent: "New comment" });
|
|
526
|
-
const close = make(document2, "button", {
|
|
527
|
-
textContent: "×",
|
|
528
|
-
attributes: {
|
|
529
|
-
type: "button",
|
|
530
|
-
"data-planr-composer-close": "",
|
|
531
|
-
"aria-label": "Close new comment",
|
|
532
|
-
title: "Close new comment (Escape)"
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
header.append(heading, close);
|
|
536
|
-
const identityLabel = make(document2, "label", { textContent: "Your name" });
|
|
537
|
-
const identity = make(document2, "input", {
|
|
538
|
-
attributes: {
|
|
539
|
-
type: "text",
|
|
540
|
-
maxlength: ARTIFACT_ANNOTATION_LIMITS.maxIdentityLength,
|
|
541
|
-
autocomplete: "name",
|
|
542
|
-
value: identityName(reviewController),
|
|
543
|
-
"data-planr-composer-identity": "",
|
|
544
|
-
"aria-describedby": "planr-composer-error"
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
identityLabel.append(identity);
|
|
548
|
-
const intentPicker = createIntentPicker(document2);
|
|
549
|
-
const commentLabel = make(document2, "label", { textContent: "Comment" });
|
|
550
|
-
const comment = make(document2, "textarea", {
|
|
551
|
-
attributes: {
|
|
552
|
-
maxlength: ARTIFACT_ANNOTATION_LIMITS.maxCommentLength,
|
|
553
|
-
required: "",
|
|
554
|
-
placeholder: "Describe what the coding agent should change or consider…",
|
|
555
|
-
"data-planr-composer-comment": "",
|
|
556
|
-
"aria-describedby": "planr-composer-error"
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
commentLabel.append(comment);
|
|
560
|
-
const error = make(document2, "p", {
|
|
561
|
-
className: "planr-field-error",
|
|
562
|
-
attributes: { id: "planr-composer-error", role: "alert", "data-planr-composer-error": "" }
|
|
563
|
-
});
|
|
564
|
-
const actions = make(document2, "div", { className: "planr-composer-actions" });
|
|
565
|
-
actions.append(
|
|
566
|
-
make(document2, "button", {
|
|
567
|
-
textContent: "Cancel",
|
|
568
|
-
attributes: { type: "button", "data-planr-composer-cancel": "" }
|
|
569
|
-
}),
|
|
570
|
-
make(document2, "button", {
|
|
571
|
-
textContent: "Add comment",
|
|
572
|
-
attributes: { type: "submit", "data-planr-composer-submit": "" }
|
|
573
|
-
})
|
|
574
|
-
);
|
|
575
|
-
composer.append(header, identityLabel, intentPicker, commentLabel, error, actions);
|
|
576
|
-
root.append(composer);
|
|
577
|
-
try {
|
|
578
|
-
if (typeof composer.showPopover === "function") composer.showPopover();
|
|
579
|
-
else composer.removeAttribute("popover");
|
|
580
|
-
} catch {
|
|
581
|
-
composer.removeAttribute("popover");
|
|
582
|
-
}
|
|
583
|
-
positionComposer();
|
|
584
|
-
const observer = typeof window.ResizeObserver === "function" ? new window.ResizeObserver(positionComposer) : null;
|
|
585
|
-
observer?.observe(composer);
|
|
586
|
-
composerLayoutCleanup = () => observer?.disconnect();
|
|
587
|
-
let selectedIntent = "fix";
|
|
588
|
-
listen(intentPicker, "click", (event) => {
|
|
589
|
-
const button = event.target.closest?.("[data-planr-intent]");
|
|
590
|
-
if (!button || !INTENTS.includes(button.dataset.planrIntent)) return;
|
|
591
|
-
selectedIntent = button.dataset.planrIntent;
|
|
592
|
-
for (const option of intentPicker.querySelectorAll("[data-planr-intent]")) {
|
|
593
|
-
option.setAttribute("aria-checked", String(option === button));
|
|
594
|
-
option.tabIndex = option === button ? 0 : -1;
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
listen(intentPicker, "keydown", (event) => {
|
|
598
|
-
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(event.key))
|
|
599
|
-
return;
|
|
600
|
-
const options = [...intentPicker.querySelectorAll("[data-planr-intent]")];
|
|
601
|
-
const current = options.findIndex((option) => option.getAttribute("aria-checked") === "true");
|
|
602
|
-
const delta = ["ArrowRight", "ArrowDown"].includes(event.key) ? 1 : -1;
|
|
603
|
-
const nextIndex = event.key === "Home" ? 0 : event.key === "End" ? options.length - 1 : (Math.max(0, current) + delta + options.length) % options.length;
|
|
604
|
-
event.preventDefault();
|
|
605
|
-
options[nextIndex].click();
|
|
606
|
-
options[nextIndex].focus();
|
|
607
|
-
});
|
|
608
|
-
listen(close, "click", () => closeComposer({ restoreFocus: true }));
|
|
609
|
-
listen(
|
|
610
|
-
composer.querySelector("[data-planr-composer-cancel]"),
|
|
611
|
-
"click",
|
|
612
|
-
() => {
|
|
613
|
-
closeComposer({ restoreFocus: true });
|
|
614
|
-
},
|
|
615
|
-
{ once: true }
|
|
616
|
-
);
|
|
617
|
-
listen(composer, "keydown", (event) => {
|
|
618
|
-
if (event.key === "Escape") {
|
|
619
|
-
event.preventDefault();
|
|
620
|
-
event.stopPropagation();
|
|
621
|
-
closeComposer({ restoreFocus: true });
|
|
622
|
-
} else if (event.key === "Enter" && !event.isComposing && (event.metaKey || event.ctrlKey)) {
|
|
623
|
-
event.preventDefault();
|
|
624
|
-
composer.requestSubmit();
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
listen(composer, "submit", (event) => {
|
|
628
|
-
event.preventDefault();
|
|
629
|
-
if (!draft) return;
|
|
630
|
-
const author = text(identity.value, ARTIFACT_ANNOTATION_LIMITS.maxIdentityLength);
|
|
631
|
-
const body = text(comment.value);
|
|
632
|
-
identity.setAttribute("aria-invalid", String(!author));
|
|
633
|
-
comment.setAttribute("aria-invalid", String(!body));
|
|
634
|
-
if (!author || !body) {
|
|
635
|
-
error.textContent = !author ? "Enter your name before adding a comment." : "Enter a comment before submitting.";
|
|
636
|
-
(!author ? identity : comment).focus();
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
reviewController.setIdentity?.({ name: author });
|
|
640
|
-
const existingIds = new Set(review()?.pins?.map(({ id }) => id) ?? []);
|
|
641
|
-
const action = {
|
|
642
|
-
type: "add-pin",
|
|
643
|
-
pin: {
|
|
644
|
-
artifactId: draft.artifactId,
|
|
645
|
-
region: draft.region,
|
|
646
|
-
viewport: draft.viewport,
|
|
647
|
-
variant: draft.variant,
|
|
648
|
-
...draft.anchor ? { anchor: draft.anchor } : {},
|
|
649
|
-
intent: selectedIntent,
|
|
650
|
-
comment: body
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
const next = reviewController.dispatch(action);
|
|
654
|
-
const nextReview = next?.review ?? next;
|
|
655
|
-
const created = nextReview?.pins?.find?.(({ id }) => !existingIds.has(id));
|
|
656
|
-
closeComposer();
|
|
657
|
-
renderPins();
|
|
658
|
-
announce(document2, `${selectedIntent} comment added.`);
|
|
659
|
-
if (created?.id) queueMicrotask(() => focusThread(created.id));
|
|
660
|
-
});
|
|
661
|
-
comment.focus();
|
|
662
|
-
root.dispatchEvent(
|
|
663
|
-
new window.CustomEvent(ARTIFACT_ANNOTATION_EVENTS.draft, {
|
|
664
|
-
bubbles: true,
|
|
665
|
-
detail: Object.freeze({ ...draft })
|
|
666
|
-
})
|
|
667
|
-
);
|
|
668
|
-
if (restoredDraft) {
|
|
669
|
-
identity.value = restoredDraft.identity;
|
|
670
|
-
comment.value = restoredDraft.comment;
|
|
671
|
-
selectedIntent = restoredDraft.intent;
|
|
672
|
-
for (const option of intentPicker.querySelectorAll("[data-planr-intent]")) {
|
|
673
|
-
const selected = option.dataset.planrIntent === selectedIntent;
|
|
674
|
-
option.setAttribute("aria-checked", String(selected));
|
|
675
|
-
option.tabIndex = selected ? 0 : -1;
|
|
676
|
-
}
|
|
677
|
-
if (Number.isInteger(restoredDraft.selectionStart))
|
|
678
|
-
comment.setSelectionRange(
|
|
679
|
-
restoredDraft.selectionStart,
|
|
680
|
-
restoredDraft.selectionEnd,
|
|
681
|
-
restoredDraft.selectionDirection
|
|
682
|
-
);
|
|
683
|
-
const fields = new Map(
|
|
684
|
-
Object.entries(restoredDraft.fields ?? {}).slice(0, 32).filter(
|
|
685
|
-
([key, value]) => key.length <= 128 && typeof value === "string" && value.length <= ARTIFACT_ANNOTATION_LIMITS.maxCommentLength
|
|
686
|
-
)
|
|
687
|
-
);
|
|
688
|
-
if (fields.size) {
|
|
689
|
-
let restoreFields = function() {
|
|
690
|
-
if (token !== draftToken || !composer.isConnected) {
|
|
691
|
-
finish();
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
for (const field of composer.querySelectorAll("[data-planr-draft-key]")) {
|
|
695
|
-
const key = field.dataset.planrDraftKey;
|
|
696
|
-
if (!fields.has(key) || typeof field.value !== "string") continue;
|
|
697
|
-
field.value = fields.get(key);
|
|
698
|
-
fields.delete(key);
|
|
699
|
-
field.dispatchEvent(new window.Event("change", { bubbles: true }));
|
|
700
|
-
}
|
|
701
|
-
if (!fields.size) finish();
|
|
702
|
-
};
|
|
703
|
-
let timer;
|
|
704
|
-
const observer2 = new window.MutationObserver(restoreFields);
|
|
705
|
-
const finish = () => {
|
|
706
|
-
observer2.disconnect();
|
|
707
|
-
window.clearTimeout(timer);
|
|
708
|
-
};
|
|
709
|
-
observer2.observe(composer, { childList: true, subtree: true });
|
|
710
|
-
timer = window.setTimeout(finish, 1500);
|
|
711
|
-
draftFieldCleanup = finish;
|
|
712
|
-
restoreFields();
|
|
713
|
-
}
|
|
714
|
-
} else void resolveAnchor(token, draft);
|
|
715
|
-
}
|
|
716
|
-
function snapshotDraft() {
|
|
717
|
-
const composer = document2.querySelector("[data-planr-annotation-composer]");
|
|
718
|
-
if (!draft || !composer) return suspendedDraft;
|
|
719
|
-
const comment = composer.querySelector("[data-planr-composer-comment]");
|
|
720
|
-
return Object.freeze({
|
|
721
|
-
...draft,
|
|
722
|
-
reviewOf: reviewController.getReviewOf?.() ?? review()?.reviewOf ?? null,
|
|
723
|
-
identity: composer.querySelector("[data-planr-composer-identity]").value,
|
|
724
|
-
fields: Object.fromEntries(
|
|
725
|
-
[...composer.querySelectorAll("[data-planr-draft-key]")].slice(0, 32).filter(
|
|
726
|
-
(field) => field.dataset.planrDraftKey.length <= 128 && typeof field.value === "string"
|
|
727
|
-
).map((field) => [
|
|
728
|
-
field.dataset.planrDraftKey,
|
|
729
|
-
field.value.slice(0, ARTIFACT_ANNOTATION_LIMITS.maxCommentLength)
|
|
730
|
-
])
|
|
731
|
-
),
|
|
732
|
-
comment: comment.value,
|
|
733
|
-
intent: composer.querySelector('[data-planr-intent][aria-checked="true"]')?.dataset.planrIntent ?? "fix",
|
|
734
|
-
selectionStart: comment.selectionStart,
|
|
735
|
-
selectionEnd: comment.selectionEnd,
|
|
736
|
-
selectionDirection: comment.selectionDirection
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
function restoreDraft(snapshot) {
|
|
740
|
-
if (!snapshot || snapshot.reviewOf !== (reviewController.getReviewOf?.() ?? review()?.reviewOf ?? null))
|
|
741
|
-
return false;
|
|
742
|
-
const artifact = stageController.getState().artifacts.find((entry) => entry.id === snapshot.artifactId);
|
|
743
|
-
if (!artifact || artifact.viewport.width !== snapshot.viewport?.width || artifact.viewport.height !== snapshot.viewport?.height || !["x", "y", "w", "h"].every(
|
|
744
|
-
(key) => Number.isFinite(snapshot.region?.[key]) && snapshot.region[key] >= 0 && snapshot.region[key] <= 1
|
|
745
|
-
) || !["x", "y", "w", "h"].every(
|
|
746
|
-
(key) => Number.isFinite(snapshot.displayRegion?.[key]) && snapshot.displayRegion[key] >= 0 && snapshot.displayRegion[key] <= 1
|
|
747
|
-
) || typeof snapshot.comment !== "string" || snapshot.comment.length > ARTIFACT_ANNOTATION_LIMITS.maxCommentLength || typeof snapshot.identity !== "string" || snapshot.identity.length > ARTIFACT_ANNOTATION_LIMITS.maxIdentityLength || !INTENTS.includes(snapshot.intent) || snapshot.anchor && (typeof snapshot.anchor.planrId !== "string" || snapshot.anchor.planrId.length > 512))
|
|
748
|
-
return false;
|
|
749
|
-
openComposer(snapshot, { restoredDraft: snapshot });
|
|
750
|
-
return Boolean(draft);
|
|
751
|
-
}
|
|
752
|
-
listen(window, "resize", positionComposer);
|
|
753
|
-
if (window.visualViewport) {
|
|
754
|
-
listen(window.visualViewport, "resize", positionComposer);
|
|
755
|
-
listen(window.visualViewport, "scroll", positionComposer);
|
|
756
|
-
}
|
|
757
|
-
listen(root, "planr:artifact-region", (event) => openComposer(event.detail));
|
|
758
|
-
listen(root, "planr:stage-change", () => {
|
|
759
|
-
const state = stageController.getState();
|
|
760
|
-
const visible = state.viewMode === "split" ? [state.activeArtifactId, state.comparisonArtifactId] : [state.activeArtifactId];
|
|
761
|
-
if (!draft) {
|
|
762
|
-
if (suspendedDraft && state.status === "ready" && state.reviewMode === "comment" && visible.includes(suspendedDraft.artifactId))
|
|
763
|
-
restoreDraft(suspendedDraft);
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
if (state.status !== "ready" || state.presentation !== "document" && state.reviewMode !== "comment") {
|
|
767
|
-
closeComposer({ preserveDraft: true });
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
if (!visible.includes(draft.artifactId)) closeComposer({ preserveDraft: true });
|
|
771
|
-
else {
|
|
772
|
-
draftToken += 1;
|
|
773
|
-
positionComposer();
|
|
774
|
-
}
|
|
775
|
-
});
|
|
776
|
-
listen(root, "planr:artifact-review-change", renderPins);
|
|
777
|
-
const anchorRefresh = window.setInterval(refreshAnchors, 250);
|
|
778
|
-
cleanup.push(() => window.clearInterval(anchorRefresh));
|
|
779
|
-
listen(root, ARTIFACT_ANNOTATION_EVENTS.focus, (event) => {
|
|
780
|
-
if (event.detail?.target === "pin") focusPin(event.detail.pinId);
|
|
781
|
-
if (event.detail?.target === "thread") focusThread(event.detail.pinId);
|
|
782
|
-
});
|
|
783
|
-
listen(root, "planr:artifact-review-select", (event) => {
|
|
784
|
-
if (event.detail?.source === "thread" && typeof event.detail?.pinId === "string") {
|
|
785
|
-
focusPin(event.detail.pinId);
|
|
786
|
-
}
|
|
787
|
-
});
|
|
788
|
-
renderPins();
|
|
789
|
-
const controller = Object.freeze({
|
|
790
|
-
render: renderPins,
|
|
791
|
-
openComposer,
|
|
792
|
-
closeComposer,
|
|
793
|
-
snapshotDraft,
|
|
794
|
-
restoreDraft,
|
|
795
|
-
focusPin,
|
|
796
|
-
focusThread,
|
|
797
|
-
destroy() {
|
|
798
|
-
destroyed = true;
|
|
799
|
-
closeComposer();
|
|
800
|
-
for (const remove of cleanup.splice(0)) remove();
|
|
801
|
-
for (const records of pinRecords.values())
|
|
802
|
-
for (const record of records.values()) removePin(record);
|
|
803
|
-
pinRecords.clear();
|
|
804
|
-
anchorRequests.clear();
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
window.__openPlanrArtifactAnnotations = controller;
|
|
808
|
-
return controller;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
// local-stage-stub:./durable-paste-share.mjs
|
|
812
|
-
function createDurablePasteShare() {
|
|
813
|
-
return null;
|
|
814
|
-
}
|