@north-light/crouter 0.3.198 → 0.3.200
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/dist/api/client.d.ts +18 -18
- package/dist/api/client.js +29 -37
- package/dist/api/dto/broker-ops.d.ts +3 -1
- package/dist/api/dto/broker.d.ts +13 -2
- package/dist/api/dto/broker.js +4 -4
- package/dist/api/dto/human.d.ts +6 -5
- package/dist/api/dto/inbox.d.ts +81 -34
- package/dist/api/dto/nodes.d.ts +8 -2
- package/dist/api/dto/profiles.d.ts +23 -0
- package/dist/api/dto/profiles.js +2 -2
- package/dist/api/dto/worktree.d.ts +3 -5
- package/dist/api/routes.d.ts +3 -5
- package/dist/api/routes.js +4 -6
- package/dist/builtin-memory/00-runtime-base.md +6 -6
- package/dist/builtin-memory/01-spine/01-no-manager.md +1 -1
- package/dist/builtin-memory/02-lifecycle/00-terminal.md +3 -3
- package/dist/builtin-memory/04-orchestration-kernel.md +6 -6
- package/dist/builtin-memory/05-kinds/design/00-base.md +1 -1
- package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +2 -2
- package/dist/builtin-memory/05-kinds/review/00-base.md +2 -2
- package/dist/builtin-memory/05-kinds/review/01-orchestrator.md +1 -1
- package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +1 -1
- package/dist/builtin-memory/insights/capture.md +2 -2
- package/dist/builtin-memory/insights/init.md +3 -3
- package/dist/builtin-memory/internal/INDEX.md +1 -1
- package/dist/builtin-memory/internal/memory-loading.md +1 -1
- package/dist/builtin-memory/internal/nodes-and-canvas.md +2 -2
- package/dist/builtin-memory/internal/plugins.md +59 -2
- package/dist/builtin-memory/internal/storage-tiers.md +3 -1
- package/dist/builtin-memory/spec/roadmap.md +2 -2
- package/dist/builtin-memory/testing.md +1 -1
- package/dist/clients/attach/chrome/bash-jobs.js +3 -3
- package/dist/clients/attach/render/chat-view.d.ts +26 -1
- package/dist/clients/attach/render/chat-view.js +61 -11
- package/dist/clients/attach/render/page-block.d.ts +34 -0
- package/dist/clients/attach/render/page-block.js +226 -0
- package/dist/clients/attach/session/whip.d.ts +2 -0
- package/dist/clients/attach/session/whip.js +2 -0
- package/dist/clients/attach/viewer.js +1419 -993
- package/dist/clients/conversation/projection.js +18 -3
- package/dist/clients/inbox/__tests__/serial/inbox-controller.test.js +9 -6
- package/dist/clients/inbox/__tests__/serial/mount-panel.test.js +13 -21
- package/dist/clients/inbox/controller.js +10 -16
- package/dist/clients/inbox/page-adapter.d.ts +1 -3
- package/dist/clients/inbox/page-adapter.js +3 -4
- package/dist/clients/inbox/resolve.d.ts +1 -1
- package/dist/clients/inbox/resolve.js +3 -3
- package/dist/clients/inbox/review/document-surface.js +3 -1
- package/dist/clients/inbox/review/state.d.ts +2 -1
- package/dist/clients/inbox/review/state.js +5 -16
- package/dist/clients/inbox/tui/input.js +37 -19
- package/dist/clients/inbox/tui/panel.js +5 -31
- package/dist/clients/inbox/tui/render.d.ts +11 -0
- package/dist/clients/inbox/tui/render.js +71 -27
- package/dist/clients/inbox/tui/slots.d.ts +3 -1
- package/dist/clients/inbox/tui/slots.js +16 -12
- package/dist/clients/inbox/tui/types.d.ts +2 -7
- package/dist/clients/inbox/tui.js +2 -2
- package/dist/commands/__tests__/human.test.js +71 -114
- package/dist/commands/__tests__/node-message.test.js +14 -0
- package/dist/commands/attention.js +4 -4
- package/dist/commands/canvas-snapshot.js +1 -1
- package/dist/commands/canvas.js +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/human/{html.d.ts → components.d.ts} +1 -1
- package/dist/commands/human/components.js +77 -0
- package/dist/commands/human/feedback.d.ts +2 -0
- package/dist/commands/human/feedback.js +108 -0
- package/dist/commands/human/prompts.d.ts +13 -5
- package/dist/commands/human/prompts.js +160 -97
- package/dist/commands/human/queue.js +57 -88
- package/dist/commands/human/shared.d.ts +2 -12
- package/dist/commands/human/shared.js +17 -11
- package/dist/commands/human.js +29 -21
- package/dist/commands/memory/origin.js +2 -2
- package/dist/commands/node/bash.js +4 -4
- package/dist/commands/node/inspect.js +3 -3
- package/dist/commands/node/lifecycle.js +1 -1
- package/dist/commands/node/message.js +2 -2
- package/dist/commands/node-worktree.js +8 -8
- package/dist/commands/pkg/browse.js +1 -1
- package/dist/commands/pkg/plugin-manage.js +129 -10
- package/dist/commands/profile/delete.js +41 -15
- package/dist/commands/profile.js +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/commands/surface/node/focus.js +29 -14
- package/dist/commands/surface-edit.js +3 -3
- package/dist/commands/surface-inbox.d.ts +2 -0
- package/dist/commands/{human/inbox.js → surface-inbox.js} +14 -18
- package/dist/commands/surface.js +2 -1
- package/dist/commands/sys/doctor.js +60 -3
- package/dist/commands/sys/feedback.js +79 -25
- package/dist/commands/sys/settings.js +1 -1
- package/dist/core/__tests__/cron-broker-capacity.test.js +1 -1
- package/dist/core/__tests__/extension-abort.test.js +5 -2
- package/dist/core/__tests__/fixtures/fake-engine.d.ts +13 -2
- package/dist/core/__tests__/fixtures/fake-engine.js +47 -3
- package/dist/core/__tests__/helpers/harness.js +17 -55
- package/dist/core/__tests__/human-cancel-guard.test.js +31 -10
- package/dist/core/__tests__/human-deliver.test.js +31 -26
- package/dist/core/__tests__/human-node-not-supervised.test.js +1 -1
- package/dist/core/__tests__/plugin-page-components.test.js +157 -0
- package/dist/core/__tests__/seam/broker-crash-teardown.test.js +4 -5
- package/dist/core/__tests__/seam/dormancy-release.test.js +40 -0
- package/dist/core/__tests__/serial/flagship-lifecycle.test.js +2 -2
- package/dist/core/__tests__/serial/human-deliver-e2e.test.js +12 -6
- package/dist/core/__tests__/serial/live-mutation.test.js +1 -1
- package/dist/core/__tests__/serial/tmux-surface.test.js +4 -2
- package/dist/core/__tests__/serial/worktree.test.js +24 -198
- package/dist/core/__tests__/session-cycles.test.js +22 -0
- package/dist/core/__tests__/stop-guard.test.js +4 -4
- package/dist/core/__tests__/watchdog-abort-arms-retry.test.js +19 -4
- package/dist/core/bash-jobs.d.ts +6 -0
- package/dist/core/bash-jobs.js +10 -0
- package/dist/core/canvas/__tests__/attention.test.js +8 -5
- package/dist/core/canvas/__tests__/render-remote.test.js +5 -5
- package/dist/core/canvas/attention.js +8 -6
- package/dist/core/canvas/browse/model.d.ts +8 -2
- package/dist/core/canvas/browse/model.js +11 -4
- package/dist/core/canvas/canvas.d.ts +7 -0
- package/dist/core/canvas/canvas.js +37 -0
- package/dist/core/canvas/crons.d.ts +9 -0
- package/dist/core/canvas/crons.js +51 -0
- package/dist/core/canvas/node-order.d.ts +22 -1
- package/dist/core/canvas/node-order.js +26 -1
- package/dist/core/canvas/render-source.d.ts +5 -0
- package/dist/core/canvas/render-source.js +1 -0
- package/dist/core/canvas/types.d.ts +9 -3
- package/dist/core/command-plugins/bundle.d.ts +6 -1
- package/dist/core/command-plugins/bundle.js +26 -13
- package/dist/core/command.js +2 -1
- package/dist/core/config.d.ts +47 -1
- package/dist/core/config.js +137 -4
- package/dist/core/help.js +1 -1
- package/dist/core/human/__tests__/page-catalog.test.js +4 -0
- package/dist/core/human/__tests__/page-tickets.test.js +65 -52
- package/dist/core/human/__tests__/page.test.js +56 -98
- package/dist/core/human/__tests__/serial/inbox-core.test.js +6 -6
- package/dist/core/human/answer-text.js +3 -3
- package/dist/core/human/answer.d.ts +6 -4
- package/dist/core/human/answer.js +4 -10
- package/dist/core/human/component-docs.d.ts +11 -7
- package/dist/core/human/component-docs.js +361 -88
- package/dist/core/human/convention.d.ts +17 -3
- package/dist/core/human/convention.js +36 -5
- package/dist/core/human/feedback-companion.d.ts +20 -0
- package/dist/core/human/feedback-companion.js +98 -0
- package/dist/core/human/feedback.d.ts +65 -0
- package/dist/core/human/feedback.js +116 -0
- package/dist/core/human/page-catalog.d.ts +40 -5
- package/dist/core/human/page-catalog.js +102 -30
- package/dist/core/human/page-errors.d.ts +4 -0
- package/dist/core/human/page-errors.js +7 -0
- package/dist/core/human/page-eval.d.ts +20 -0
- package/dist/core/human/page-eval.js +123 -0
- package/dist/core/human/page-schema.d.ts +23 -191
- package/dist/core/human/page-schema.js +60 -89
- package/dist/core/human/page-synth.d.ts +1 -1
- package/dist/core/human/page-synth.js +15 -18
- package/dist/core/human/page.d.ts +12 -27
- package/dist/core/human/page.js +142 -474
- package/dist/core/human/root.d.ts +6 -2
- package/dist/core/human/root.js +12 -4
- package/dist/core/human/scan.d.ts +3 -4
- package/dist/core/human/scan.js +16 -15
- package/dist/core/human/summary.d.ts +1 -2
- package/dist/core/human/summary.js +2 -2
- package/dist/core/human/tickets.d.ts +20 -14
- package/dist/core/human/tickets.js +91 -31
- package/dist/core/human/types.d.ts +10 -2
- package/dist/core/preview-registry.js +8 -10
- package/dist/core/profiles/default-binding.d.ts +4 -0
- package/dist/core/profiles/default-binding.js +24 -0
- package/dist/core/profiles/deletion-reservation.d.ts +8 -0
- package/dist/core/profiles/deletion-reservation.js +38 -0
- package/dist/core/profiles/manifest.d.ts +3 -0
- package/dist/core/profiles/manifest.js +12 -0
- package/dist/core/profiles/select.js +2 -2
- package/dist/core/review/realize.js +3 -3
- package/dist/core/review/store.d.ts +6 -0
- package/dist/core/review/store.js +31 -0
- package/dist/core/runtime/bearings.d.ts +0 -4
- package/dist/core/runtime/bearings.js +4 -62
- package/dist/core/runtime/bin-contributions.d.ts +44 -0
- package/dist/core/runtime/bin-contributions.js +186 -0
- package/dist/core/runtime/broker/client-registry.d.ts +4 -0
- package/dist/core/runtime/broker/client-registry.js +13 -1
- package/dist/core/runtime/broker/extension-abort.d.ts +1 -1
- package/dist/core/runtime/broker/extension-abort.js +4 -2
- package/dist/core/runtime/broker/fault-retry.js +4 -0
- package/dist/core/runtime/broker/frame-dispatch.d.ts +3 -1
- package/dist/core/runtime/broker/frame-dispatch.js +5 -6
- package/dist/core/runtime/broker/read-ops.d.ts +1 -1
- package/dist/core/runtime/broker/read-ops.js +2 -2
- package/dist/core/runtime/broker/rebind.d.ts +1 -0
- package/dist/core/runtime/broker/rebind.js +6 -1
- package/dist/core/runtime/broker-extension-render.js +19 -0
- package/dist/core/runtime/broker-protocol.d.ts +14 -0
- package/dist/core/runtime/broker.d.ts +1 -1
- package/dist/core/runtime/broker.js +17 -6
- package/dist/core/runtime/front-door-env.d.ts +5 -0
- package/dist/core/runtime/front-door-env.js +16 -0
- package/dist/core/runtime/front-door.d.ts +1 -5
- package/dist/core/runtime/front-door.js +2 -5
- package/dist/core/runtime/host.d.ts +1 -1
- package/dist/core/runtime/invocation.d.ts +6 -0
- package/dist/core/runtime/invocation.js +10 -0
- package/dist/core/runtime/kickoff.js +34 -0
- package/dist/core/runtime/launch.d.ts +2 -6
- package/dist/core/runtime/node-read.js +4 -1
- package/dist/core/runtime/nodes.js +2 -0
- package/dist/core/runtime/promote.d.ts +1 -0
- package/dist/core/runtime/promote.js +3 -1
- package/dist/core/runtime/session-cycles.d.ts +6 -0
- package/dist/core/runtime/session-cycles.js +15 -1
- package/dist/core/runtime/session-visibility.d.ts +17 -8
- package/dist/core/runtime/session-visibility.js +19 -10
- package/dist/core/runtime/spawn-env.d.ts +9 -1
- package/dist/core/runtime/spawn-env.js +62 -2
- package/dist/core/runtime/stop-guard.d.ts +2 -2
- package/dist/core/runtime/stop-guard.js +2 -2
- package/dist/core/runtime/stop-signals.d.ts +1 -1
- package/dist/core/runtime/stop-signals.js +2 -2
- package/dist/core/runtime/tmux-bindings.js +1 -1
- package/dist/core/session-model/session-state.d.ts +4 -3
- package/dist/core/session-model/session-state.js +14 -1
- package/dist/core/user-settings.d.ts +21 -2
- package/dist/core/user-settings.js +32 -11
- package/dist/core/worktree.d.ts +15 -45
- package/dist/core/worktree.js +59 -261
- package/dist/daemon/api/__tests__/seam/profile-delete.test.d.ts +1 -0
- package/dist/daemon/api/__tests__/seam/profile-delete.test.js +386 -0
- package/dist/daemon/api/handlers/bash-jobs.js +1 -1
- package/dist/daemon/api/handlers/broker-ops.js +9 -5
- package/dist/daemon/api/handlers/feedback-comments.d.ts +2 -0
- package/dist/daemon/api/handlers/feedback-comments.js +207 -0
- package/dist/daemon/api/handlers/human.js +24 -20
- package/dist/daemon/api/handlers/inbox.d.ts +10 -0
- package/dist/daemon/api/handlers/inbox.js +39 -115
- package/dist/daemon/api/handlers/profiles.js +11 -29
- package/dist/daemon/api/map.d.ts +6 -1
- package/dist/daemon/api/map.js +23 -0
- package/dist/daemon/api/server.js +3 -1
- package/dist/daemon/companion-retire.d.ts +2 -0
- package/dist/daemon/companion-retire.js +33 -0
- package/dist/daemon/cron-run.js +14 -16
- package/dist/daemon/human/finish.d.ts +12 -7
- package/dist/daemon/human/finish.js +101 -38
- package/dist/daemon/human/sweep.js +5 -1
- package/dist/daemon/profile-delete.d.ts +7 -0
- package/dist/daemon/profile-delete.js +306 -0
- package/dist/daemon/reconcilers/broker-supervision.js +3 -1
- package/dist/daemon/review/deliver.js +3 -3
- package/dist/daemon/review/finish.d.ts +0 -2
- package/dist/daemon/review/finish.js +1 -29
- package/dist/pi-extensions/__tests__/canvas-bash-valve.test.js +56 -1
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +4 -4
- package/dist/pi-extensions/canvas-bash-valve.js +19 -5
- package/dist/pi-extensions/canvas-inbox-watcher.js +1 -1
- package/dist/pi-extensions/canvas-review-boundary.d.ts +4 -0
- package/dist/pi-extensions/canvas-review-boundary.js +18 -9
- package/dist/pi-extensions/canvas-stophook.js +4 -4
- package/dist/shared/generated-context.js +2 -2
- package/dist/types.d.ts +44 -2
- package/dist/types.js +7 -2
- package/package.json +6 -5
- package/runtime.lock.json +5 -33
- package/dist/builtin-memory/init.md +0 -38
- package/dist/builtin-memory/plan.md +0 -19
- package/dist/builtin-memory/spec.md +0 -19
- package/dist/commands/human/doc.d.ts +0 -2
- package/dist/commands/human/doc.js +0 -91
- package/dist/commands/human/html.js +0 -81
- package/dist/commands/human/inbox.d.ts +0 -2
- package/dist/core/human/__tests__/html-markdown.test.js +0 -52
- package/dist/core/human/__tests__/page-render.test.js +0 -66
- package/dist/core/human/html-markdown.d.ts +0 -3
- package/dist/core/human/html-markdown.js +0 -288
- package/dist/core/human/page-render.d.ts +0 -4
- package/dist/core/human/page-render.js +0 -105
- package/dist/pages/bundle.css +0 -1
- package/dist/pages/bundle.js +0 -1778
- package/dist/pages/comments.d.ts +0 -72
- package/dist/pages/comments.js +0 -176
- package/dist/pages/controls.d.ts +0 -98
- package/dist/pages/controls.js +0 -261
- package/dist/pages/elements/cards.d.ts +0 -28
- package/dist/pages/elements/cards.js +0 -915
- package/dist/pages/elements/chart.d.ts +0 -23
- package/dist/pages/elements/chart.js +0 -664
- package/dist/pages/elements/options.d.ts +0 -30
- package/dist/pages/elements/options.js +0 -742
- package/dist/pages/elements/pages.d.ts +0 -30
- package/dist/pages/elements/pages.js +0 -377
- package/dist/pages/elements/slot.d.ts +0 -26
- package/dist/pages/elements/slot.js +0 -112
- package/dist/pages/elements/table.d.ts +0 -36
- package/dist/pages/elements/table.js +0 -1043
- package/dist/pages/elements/text.d.ts +0 -31
- package/dist/pages/elements/text.js +0 -1175
- package/dist/pages/entry.d.ts +0 -8
- package/dist/pages/entry.js +0 -8
- package/dist/pages/host.d.ts +0 -134
- package/dist/pages/host.js +0 -165
- package/dist/pages/readonly.d.ts +0 -24
- package/dist/pages/readonly.js +0 -31
- package/dist/pages/register.d.ts +0 -2
- package/dist/pages/register.js +0 -3
- package/dist/pages/responses.d.ts +0 -37
- package/dist/pages/responses.js +0 -56
- package/dist/pages/slot-config.d.ts +0 -36
- package/dist/pages/slot-config.js +0 -50
- package/dist/pages/types.d.ts +0 -98
- package/dist/pages/types.js +0 -23
- /package/dist/{core/human/__tests__/html-markdown.test.d.ts → commands/__tests__/node-message.test.d.ts} +0 -0
- /package/dist/core/{human/__tests__/page-render.test.d.ts → __tests__/plugin-page-components.test.d.ts} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `<crtr-pages>` / `<crtr-page>` — the page's own pager, and the only thing that submits.
|
|
3
|
-
*
|
|
4
|
-
* A response-bearing page wraps its slots in exactly one `<crtr-pages>` containing one or
|
|
5
|
-
* more `<crtr-page>` steps. This element shows one step at a time, carries the step
|
|
6
|
-
* progress and the forward/back affordances, and renders the submit affordance on the
|
|
7
|
-
* final step — the in-document chrome, and nothing else. Dismiss and save are host chrome
|
|
8
|
-
* (a frame around the page, not markup inside it) and never appear here.
|
|
9
|
-
*
|
|
10
|
-
* **Flipping steps is the same motion as flipping tickets, one level down.** The inbox is
|
|
11
|
-
* a pager over pending pages; this is a pager over the steps of one page. So the grammar is
|
|
12
|
-
* deliberately the narrow one both levels share — go to the next unit of work, go back to
|
|
13
|
-
* the previous one, submit — with no third way to move. `n` / `p` are the keys, matching the
|
|
14
|
-
* terminal page panel's within-page motion (`src/clients/inbox/tui/input.ts`), because the
|
|
15
|
-
* kit's `j` / `k` / `x` / `c` belong to the items *inside* a slot and a pager that stole them
|
|
16
|
-
* would make one keystroke mean two levels at once. Submit is `⌘`/`Ctrl` + `Enter` — the
|
|
17
|
-
* inbox's own submit chord, unchanged, because submitting an answer is literally the same
|
|
18
|
-
* act at both levels. The step dots are an indicator, not a control: a page is answered by
|
|
19
|
-
* walking it, not by jumping around it.
|
|
20
|
-
*
|
|
21
|
-
* A single-step page renders no pager chrome at all — no progress, no forward/back — just
|
|
22
|
-
* the submit affordance, because there is nothing to flip.
|
|
23
|
-
*
|
|
24
|
-
* Both elements paint entirely through `--crtr-page-*` component tokens — the same element
|
|
25
|
-
* scope `bundle.css` gives `crtr-pages` and `crtr-page`, because a person looking at the page
|
|
26
|
-
* sees one thing. The pager's buttons are the bundle's ordinary buttons, so their focus ring
|
|
27
|
-
* and their motion chain through the shared `--crtr-control-*` family before falling back to
|
|
28
|
-
* the kit default.
|
|
29
|
-
*/
|
|
30
|
-
export {};
|
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `<crtr-pages>` / `<crtr-page>` — the page's own pager, and the only thing that submits.
|
|
3
|
-
*
|
|
4
|
-
* A response-bearing page wraps its slots in exactly one `<crtr-pages>` containing one or
|
|
5
|
-
* more `<crtr-page>` steps. This element shows one step at a time, carries the step
|
|
6
|
-
* progress and the forward/back affordances, and renders the submit affordance on the
|
|
7
|
-
* final step — the in-document chrome, and nothing else. Dismiss and save are host chrome
|
|
8
|
-
* (a frame around the page, not markup inside it) and never appear here.
|
|
9
|
-
*
|
|
10
|
-
* **Flipping steps is the same motion as flipping tickets, one level down.** The inbox is
|
|
11
|
-
* a pager over pending pages; this is a pager over the steps of one page. So the grammar is
|
|
12
|
-
* deliberately the narrow one both levels share — go to the next unit of work, go back to
|
|
13
|
-
* the previous one, submit — with no third way to move. `n` / `p` are the keys, matching the
|
|
14
|
-
* terminal page panel's within-page motion (`src/clients/inbox/tui/input.ts`), because the
|
|
15
|
-
* kit's `j` / `k` / `x` / `c` belong to the items *inside* a slot and a pager that stole them
|
|
16
|
-
* would make one keystroke mean two levels at once. Submit is `⌘`/`Ctrl` + `Enter` — the
|
|
17
|
-
* inbox's own submit chord, unchanged, because submitting an answer is literally the same
|
|
18
|
-
* act at both levels. The step dots are an indicator, not a control: a page is answered by
|
|
19
|
-
* walking it, not by jumping around it.
|
|
20
|
-
*
|
|
21
|
-
* A single-step page renders no pager chrome at all — no progress, no forward/back — just
|
|
22
|
-
* the submit affordance, because there is nothing to flip.
|
|
23
|
-
*
|
|
24
|
-
* Both elements paint entirely through `--crtr-page-*` component tokens — the same element
|
|
25
|
-
* scope `bundle.css` gives `crtr-pages` and `crtr-page`, because a person looking at the page
|
|
26
|
-
* sees one thing. The pager's buttons are the bundle's ordinary buttons, so their focus ring
|
|
27
|
-
* and their motion chain through the shared `--crtr-control-*` family before falling back to
|
|
28
|
-
* the kit default.
|
|
29
|
-
*/
|
|
30
|
-
import { focusRingStyle } from '../controls.js';
|
|
31
|
-
import { registerElement } from '../register.js';
|
|
32
|
-
import { reportSlotResponses } from '../responses.js';
|
|
33
|
-
function hostBridge() {
|
|
34
|
-
return window.crtr;
|
|
35
|
-
}
|
|
36
|
-
const NO_HOST_REASON = 'Submit is unavailable — this page is not connected to a host.';
|
|
37
|
-
const PAGE_STYLE = `
|
|
38
|
-
:host {
|
|
39
|
-
display: block;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
:host([hidden]) {
|
|
43
|
-
display: none;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
[part="page"] {
|
|
47
|
-
display: grid;
|
|
48
|
-
gap: var(--crtr-page-step-gap, var(--crtr-space-3));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* A step takes focus programmatically when the pager flips to it, so it wears no ring by
|
|
52
|
-
default — a host that wants one sets the outline rather than patching around it. The
|
|
53
|
-
pager focuses the element itself, not the inner div, so the rule has to sit on the host:
|
|
54
|
-
on [part="page"] it would never match and every step change would paint a UA ring. */
|
|
55
|
-
:host(:focus) {
|
|
56
|
-
outline: var(--crtr-page-step-focus-outline, none);
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const PAGES_STYLE = `
|
|
60
|
-
:host {
|
|
61
|
-
display: block;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
[part="container"] {
|
|
65
|
-
display: grid;
|
|
66
|
-
gap: var(--crtr-page-container-gap, var(--crtr-space-4));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
[part="chrome"] {
|
|
70
|
-
display: flex;
|
|
71
|
-
flex-wrap: wrap;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: space-between;
|
|
74
|
-
gap: var(--crtr-page-chrome-gap, var(--crtr-space-3));
|
|
75
|
-
padding-top: var(--crtr-page-chrome-padding-top, var(--crtr-space-3));
|
|
76
|
-
border-top: var(--crtr-page-chrome-border-width, 1px)
|
|
77
|
-
var(--crtr-page-chrome-border-style, solid)
|
|
78
|
-
var(--crtr-page-chrome-border-color, var(--crtr-color-border));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
[part="container"][data-steps="1"] [part="chrome"] {
|
|
82
|
-
justify-content: flex-end;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
[part="progress"] {
|
|
86
|
-
display: flex;
|
|
87
|
-
align-items: center;
|
|
88
|
-
gap: var(--crtr-page-progress-gap, var(--crtr-space-2));
|
|
89
|
-
color: var(--crtr-page-progress-text-color, var(--crtr-color-text-muted));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
[part="progress-track"] {
|
|
93
|
-
display: flex;
|
|
94
|
-
align-items: center;
|
|
95
|
-
gap: var(--crtr-page-progress-track-gap, var(--crtr-space-1));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
[part="progress-step"] {
|
|
99
|
-
width: var(--crtr-page-progress-step-width, var(--crtr-space-2));
|
|
100
|
-
height: var(--crtr-page-progress-step-height, var(--crtr-space-1));
|
|
101
|
-
border-radius: var(--crtr-page-progress-step-radius, var(--crtr-radius-small));
|
|
102
|
-
background: var(--crtr-page-progress-step-fill, var(--crtr-color-border));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
[part="progress-step"][data-state="complete"] {
|
|
106
|
-
background: var(--crtr-page-progress-step-complete-fill, var(--crtr-color-text-muted));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
[part="progress-step"][data-state="current"] {
|
|
110
|
-
width: var(--crtr-page-progress-step-current-width, var(--crtr-space-4));
|
|
111
|
-
background: var(--crtr-page-progress-step-current-fill, var(--crtr-color-accent));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
[part="actions"] {
|
|
115
|
-
display: flex;
|
|
116
|
-
align-items: center;
|
|
117
|
-
gap: var(--crtr-page-actions-gap, var(--crtr-space-2));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
button {
|
|
121
|
-
font: var(--crtr-page-button-font, inherit);
|
|
122
|
-
color: var(--crtr-page-button-text-color, var(--crtr-color-text));
|
|
123
|
-
background: var(--crtr-page-button-fill, var(--crtr-color-surface));
|
|
124
|
-
border: var(--crtr-page-button-border-width, 1px)
|
|
125
|
-
var(--crtr-page-button-border-style, solid)
|
|
126
|
-
var(--crtr-page-button-border-color, var(--crtr-color-border));
|
|
127
|
-
border-radius: var(--crtr-page-button-radius, var(--crtr-radius-small));
|
|
128
|
-
padding: var(--crtr-page-button-padding, var(--crtr-space-2) var(--crtr-space-3));
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
transition: color var(--crtr-page-button-transition, var(--crtr-control-transition, 120ms ease)),
|
|
131
|
-
background-color var(--crtr-page-button-transition, var(--crtr-control-transition, 120ms ease)),
|
|
132
|
-
border-color var(--crtr-page-button-transition, var(--crtr-control-transition, 120ms ease));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
button:hover:not(:disabled) {
|
|
136
|
-
background: var(--crtr-page-button-hover-fill, var(--crtr-color-surface-hover));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
${focusRingStyle({ scope: 'page-button' }, 'button')}
|
|
140
|
-
button:disabled {
|
|
141
|
-
cursor: not-allowed;
|
|
142
|
-
opacity: var(--crtr-page-button-disabled-opacity, var(--crtr-control-disabled-opacity, 0.5));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
[part="submit"] {
|
|
146
|
-
color: var(--crtr-page-submit-text-color, var(--crtr-color-accent-contrast));
|
|
147
|
-
background: var(--crtr-page-submit-fill, var(--crtr-color-accent));
|
|
148
|
-
border-color: var(--crtr-page-submit-border-color, var(--crtr-color-accent));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/* Mixing the accent toward the text colour darkens on a light token set and lightens on a
|
|
152
|
-
dark one — a brightness filter moves the wrong way on one of them. */
|
|
153
|
-
[part="submit"]:hover:not(:disabled) {
|
|
154
|
-
background: var(--crtr-page-submit-hover-fill, color-mix(in srgb, var(--crtr-color-accent) 88%, var(--crtr-color-text)));
|
|
155
|
-
border-color: var(--crtr-page-submit-hover-border-color, color-mix(in srgb, var(--crtr-color-accent) 88%, var(--crtr-color-text)));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
[part="notice"] {
|
|
159
|
-
color: var(--crtr-page-notice-text-color, var(--crtr-color-text-muted));
|
|
160
|
-
font-size: var(--crtr-page-notice-font-size, 0.875em);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
[part="notice"][data-state="error"] {
|
|
164
|
-
color: var(--crtr-page-notice-error-text-color, var(--crtr-color-danger));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
[hidden] {
|
|
168
|
-
display: none !important;
|
|
169
|
-
}
|
|
170
|
-
`;
|
|
171
|
-
/** One step of a page. Bare on its own; the pager shows and hides it. */
|
|
172
|
-
class CrtrPageElement extends HTMLElement {
|
|
173
|
-
constructor() {
|
|
174
|
-
super();
|
|
175
|
-
const root = this.attachShadow({ mode: 'open' });
|
|
176
|
-
const style = document.createElement('style');
|
|
177
|
-
style.textContent = PAGE_STYLE;
|
|
178
|
-
const page = document.createElement('div');
|
|
179
|
-
page.part.add('page');
|
|
180
|
-
page.append(document.createElement('slot'));
|
|
181
|
-
root.append(style, page);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
class CrtrPagesElement extends HTMLElement {
|
|
185
|
-
static observedAttributes = ['disabled', 'submit-label'];
|
|
186
|
-
#steps = [];
|
|
187
|
-
#index = 0;
|
|
188
|
-
#state = 'idle';
|
|
189
|
-
#error = null;
|
|
190
|
-
#container = document.createElement('div');
|
|
191
|
-
#chrome = document.createElement('div');
|
|
192
|
-
#progress = document.createElement('div');
|
|
193
|
-
#progressLabel = document.createElement('span');
|
|
194
|
-
#progressTrack = document.createElement('span');
|
|
195
|
-
#actions = document.createElement('div');
|
|
196
|
-
#notice = document.createElement('span');
|
|
197
|
-
#prev = document.createElement('button');
|
|
198
|
-
#next = document.createElement('button');
|
|
199
|
-
#submit = document.createElement('button');
|
|
200
|
-
#children = new MutationObserver(() => {
|
|
201
|
-
this.#collectSteps();
|
|
202
|
-
this.#render();
|
|
203
|
-
});
|
|
204
|
-
constructor() {
|
|
205
|
-
super();
|
|
206
|
-
const root = this.attachShadow({ mode: 'open' });
|
|
207
|
-
const style = document.createElement('style');
|
|
208
|
-
style.textContent = PAGES_STYLE;
|
|
209
|
-
const steps = document.createElement('div');
|
|
210
|
-
steps.part.add('steps');
|
|
211
|
-
steps.append(document.createElement('slot'));
|
|
212
|
-
this.#container.part.add('container');
|
|
213
|
-
this.#chrome.part.add('chrome');
|
|
214
|
-
this.#progress.part.add('progress');
|
|
215
|
-
this.#progress.setAttribute('role', 'status');
|
|
216
|
-
this.#progress.setAttribute('aria-live', 'polite');
|
|
217
|
-
this.#progressLabel.part.add('progress-label');
|
|
218
|
-
this.#progressTrack.part.add('progress-track');
|
|
219
|
-
this.#progressTrack.setAttribute('aria-hidden', 'true');
|
|
220
|
-
this.#progress.append(this.#progressLabel, this.#progressTrack);
|
|
221
|
-
this.#prev.part.add('prev');
|
|
222
|
-
this.#prev.type = 'button';
|
|
223
|
-
this.#prev.textContent = 'Back';
|
|
224
|
-
this.#prev.addEventListener('click', () => this.#go(-1));
|
|
225
|
-
this.#next.part.add('next');
|
|
226
|
-
this.#next.type = 'button';
|
|
227
|
-
this.#next.textContent = 'Next';
|
|
228
|
-
this.#next.addEventListener('click', () => this.#go(1));
|
|
229
|
-
this.#submit.part.add('submit');
|
|
230
|
-
this.#submit.type = 'button';
|
|
231
|
-
this.#submit.addEventListener('click', () => void this.#runSubmit());
|
|
232
|
-
this.#notice.part.add('notice');
|
|
233
|
-
this.#actions.part.add('actions');
|
|
234
|
-
this.#actions.append(this.#notice, this.#prev, this.#next, this.#submit);
|
|
235
|
-
this.#chrome.append(this.#progress, this.#actions);
|
|
236
|
-
this.#container.append(steps, this.#chrome);
|
|
237
|
-
root.append(style, this.#container);
|
|
238
|
-
}
|
|
239
|
-
connectedCallback() {
|
|
240
|
-
this.#collectSteps();
|
|
241
|
-
this.#children.observe(this, { childList: true });
|
|
242
|
-
this.ownerDocument.addEventListener('keydown', this.#onKeydown);
|
|
243
|
-
this.#render();
|
|
244
|
-
}
|
|
245
|
-
disconnectedCallback() {
|
|
246
|
-
this.#children.disconnect();
|
|
247
|
-
this.ownerDocument.removeEventListener('keydown', this.#onKeydown);
|
|
248
|
-
}
|
|
249
|
-
attributeChangedCallback() {
|
|
250
|
-
if (this.isConnected)
|
|
251
|
-
this.#render();
|
|
252
|
-
}
|
|
253
|
-
#collectSteps() {
|
|
254
|
-
this.#steps = [...this.children].filter((child) => child instanceof HTMLElement && child.tagName === 'CRTR-PAGE');
|
|
255
|
-
for (const step of this.#steps) {
|
|
256
|
-
if (!step.hasAttribute('tabindex'))
|
|
257
|
-
step.setAttribute('tabindex', '-1');
|
|
258
|
-
}
|
|
259
|
-
this.#index = Math.min(this.#index, Math.max(0, this.#steps.length - 1));
|
|
260
|
-
}
|
|
261
|
-
get #isFinalStep() {
|
|
262
|
-
return this.#index >= this.#steps.length - 1;
|
|
263
|
-
}
|
|
264
|
-
#go(delta, focus = true) {
|
|
265
|
-
const next = this.#index + delta;
|
|
266
|
-
if (next < 0 || next >= this.#steps.length || next === this.#index)
|
|
267
|
-
return;
|
|
268
|
-
this.#index = next;
|
|
269
|
-
this.#error = null;
|
|
270
|
-
this.#render();
|
|
271
|
-
if (focus)
|
|
272
|
-
this.#steps[this.#index]?.focus();
|
|
273
|
-
}
|
|
274
|
-
async #runSubmit() {
|
|
275
|
-
if (this.#state !== 'idle' || this.hasAttribute('disabled') || !this.#isFinalStep)
|
|
276
|
-
return;
|
|
277
|
-
const bridge = hostBridge();
|
|
278
|
-
if (typeof bridge?.submit !== 'function') {
|
|
279
|
-
this.#error = NO_HOST_REASON;
|
|
280
|
-
this.#render();
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
this.#state = 'submitting';
|
|
284
|
-
this.#error = null;
|
|
285
|
-
this.#render();
|
|
286
|
-
try {
|
|
287
|
-
// The host has only heard from the slots the person changed. A submit sends the whole
|
|
288
|
-
// page, so every response-bearing slot reports what it is currently showing first —
|
|
289
|
-
// an untouched slot's answer is what it shows, not an omission.
|
|
290
|
-
reportSlotResponses();
|
|
291
|
-
await bridge.submit();
|
|
292
|
-
this.#state = 'submitted';
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
295
|
-
this.#state = 'idle';
|
|
296
|
-
this.#error = error instanceof Error ? error.message : 'Submit failed.';
|
|
297
|
-
}
|
|
298
|
-
this.#render();
|
|
299
|
-
}
|
|
300
|
-
#onKeydown = (event) => {
|
|
301
|
-
if (event.defaultPrevented)
|
|
302
|
-
return;
|
|
303
|
-
const path = event.composedPath();
|
|
304
|
-
// One `<crtr-pages>` per document, so the pager listens document-wide — but never steals
|
|
305
|
-
// a key that belongs to another pager's subtree (a page rendering a page).
|
|
306
|
-
if (path.some((node) => node instanceof HTMLElement && node.tagName === 'CRTR-PAGES' && node !== this))
|
|
307
|
-
return;
|
|
308
|
-
// The submit chord is modified, so it cannot type a character and fires even from a
|
|
309
|
-
// textarea — exactly the rule the inbox's own ⌘↵ follows.
|
|
310
|
-
if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {
|
|
311
|
-
if (!this.#isFinalStep)
|
|
312
|
-
return;
|
|
313
|
-
event.preventDefault();
|
|
314
|
-
void this.#runSubmit();
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
if (event.metaKey || event.ctrlKey || event.altKey || isTextEntry(path))
|
|
318
|
-
return;
|
|
319
|
-
const key = event.key.toLowerCase();
|
|
320
|
-
if (key !== 'n' && key !== 'p')
|
|
321
|
-
return;
|
|
322
|
-
event.preventDefault();
|
|
323
|
-
this.#go(key === 'n' ? 1 : -1);
|
|
324
|
-
};
|
|
325
|
-
#render() {
|
|
326
|
-
const total = this.#steps.length;
|
|
327
|
-
const multiStep = total > 1;
|
|
328
|
-
const current = Math.min(this.#index, Math.max(0, total - 1));
|
|
329
|
-
for (const [position, step] of this.#steps.entries()) {
|
|
330
|
-
step.toggleAttribute('hidden', position !== current);
|
|
331
|
-
}
|
|
332
|
-
this.#container.dataset['steps'] = String(Math.max(1, total));
|
|
333
|
-
this.#container.dataset['step'] = String(current + 1);
|
|
334
|
-
this.#progress.hidden = !multiStep;
|
|
335
|
-
if (multiStep) {
|
|
336
|
-
const label = this.#steps[current]?.getAttribute('label')?.trim();
|
|
337
|
-
this.#progressLabel.textContent = label
|
|
338
|
-
? `Step ${current + 1} of ${total} · ${label}`
|
|
339
|
-
: `Step ${current + 1} of ${total}`;
|
|
340
|
-
this.#progressTrack.replaceChildren(...this.#steps.map((_step, position) => {
|
|
341
|
-
const dot = document.createElement('span');
|
|
342
|
-
dot.part.add('progress-step');
|
|
343
|
-
dot.dataset['state'] = position === current ? 'current' : position < current ? 'complete' : 'upcoming';
|
|
344
|
-
return dot;
|
|
345
|
-
}));
|
|
346
|
-
}
|
|
347
|
-
this.#prev.hidden = !multiStep;
|
|
348
|
-
this.#prev.disabled = current === 0;
|
|
349
|
-
this.#next.hidden = !multiStep || this.#isFinalStep;
|
|
350
|
-
this.#next.disabled = false;
|
|
351
|
-
this.#submit.hidden = !this.#isFinalStep;
|
|
352
|
-
const bridgeReady = typeof hostBridge()?.submit === 'function';
|
|
353
|
-
this.#submit.disabled = !bridgeReady || this.#state !== 'idle' || this.hasAttribute('disabled');
|
|
354
|
-
this.#submit.textContent =
|
|
355
|
-
this.#state === 'submitting'
|
|
356
|
-
? 'Submitting…'
|
|
357
|
-
: this.#state === 'submitted'
|
|
358
|
-
? 'Submitted'
|
|
359
|
-
: this.getAttribute('submit-label')?.trim() || 'Submit';
|
|
360
|
-
const notice = this.#error ??
|
|
361
|
-
(this.#state === 'submitted'
|
|
362
|
-
? 'Your response was submitted.'
|
|
363
|
-
: !bridgeReady && this.#isFinalStep
|
|
364
|
-
? NO_HOST_REASON
|
|
365
|
-
: null);
|
|
366
|
-
this.#notice.hidden = notice === null;
|
|
367
|
-
this.#notice.textContent = notice ?? '';
|
|
368
|
-
this.#notice.dataset['state'] = this.#error === null ? 'info' : 'error';
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
/** A key typed into writing is writing, never navigation. */
|
|
372
|
-
function isTextEntry(path) {
|
|
373
|
-
return path.some((node) => node instanceof HTMLElement &&
|
|
374
|
-
(node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement || node.isContentEditable));
|
|
375
|
-
}
|
|
376
|
-
registerElement('crtr-page', CrtrPageElement);
|
|
377
|
-
registerElement('crtr-pages', CrtrPagesElement);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `<crtr-slot>` — the one escape element, for kinds crtr does not own.
|
|
3
|
-
*
|
|
4
|
-
* A page may carry a slot whose `kind` belongs to the product hosting the page (a Northlight
|
|
5
|
-
* workspace component, say) rather than to this kit. crtr validated only that such a slot has
|
|
6
|
-
* an id, a kind, and an object config; it never invents an element for a kind it cannot
|
|
7
|
-
* render. So every one of them arrives as
|
|
8
|
-
* `<crtr-slot kind="product-kind" slot-id="…"><script type="application/json">…</script></crtr-slot>`,
|
|
9
|
-
* and this element does exactly two things: ask the host to render the kind into a mount
|
|
10
|
-
* point, and — when the host has no renderer for it, or there is no host at all — say so by
|
|
11
|
-
* name instead of leaving a hole in the page.
|
|
12
|
-
*
|
|
13
|
-
* The mount point is a light-DOM child, surfaced through the shadow root's `<slot>`. Host
|
|
14
|
-
* content styles itself from the document it is mounted into, and putting it behind this
|
|
15
|
-
* element's shadow boundary would cut it off from that; the JSON config child stays where it
|
|
16
|
-
* is, untouched, so a re-mount reads the same config.
|
|
17
|
-
*
|
|
18
|
-
* A mounted component owns its own answer: it talks to `window.crtr` itself, and this element
|
|
19
|
-
* never invents a response shape for a kind whose shape only the product knows.
|
|
20
|
-
*
|
|
21
|
-
* The unavailable notice is the only thing this element paints, and every value in it is read
|
|
22
|
-
* through a `--crtr-slot-*` component token so a host can restyle the notice without touching
|
|
23
|
-
* crtr. There is no shared family behind these: nothing else in the bundle draws a notice, so
|
|
24
|
-
* each chain is one layer over the kit default.
|
|
25
|
-
*/
|
|
26
|
-
export {};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `<crtr-slot>` — the one escape element, for kinds crtr does not own.
|
|
3
|
-
*
|
|
4
|
-
* A page may carry a slot whose `kind` belongs to the product hosting the page (a Northlight
|
|
5
|
-
* workspace component, say) rather than to this kit. crtr validated only that such a slot has
|
|
6
|
-
* an id, a kind, and an object config; it never invents an element for a kind it cannot
|
|
7
|
-
* render. So every one of them arrives as
|
|
8
|
-
* `<crtr-slot kind="product-kind" slot-id="…"><script type="application/json">…</script></crtr-slot>`,
|
|
9
|
-
* and this element does exactly two things: ask the host to render the kind into a mount
|
|
10
|
-
* point, and — when the host has no renderer for it, or there is no host at all — say so by
|
|
11
|
-
* name instead of leaving a hole in the page.
|
|
12
|
-
*
|
|
13
|
-
* The mount point is a light-DOM child, surfaced through the shadow root's `<slot>`. Host
|
|
14
|
-
* content styles itself from the document it is mounted into, and putting it behind this
|
|
15
|
-
* element's shadow boundary would cut it off from that; the JSON config child stays where it
|
|
16
|
-
* is, untouched, so a re-mount reads the same config.
|
|
17
|
-
*
|
|
18
|
-
* A mounted component owns its own answer: it talks to `window.crtr` itself, and this element
|
|
19
|
-
* never invents a response shape for a kind whose shape only the product knows.
|
|
20
|
-
*
|
|
21
|
-
* The unavailable notice is the only thing this element paints, and every value in it is read
|
|
22
|
-
* through a `--crtr-slot-*` component token so a host can restyle the notice without touching
|
|
23
|
-
* crtr. There is no shared family behind these: nothing else in the bundle draws a notice, so
|
|
24
|
-
* each chain is one layer over the kit default.
|
|
25
|
-
*/
|
|
26
|
-
import { mountWorkspaceComponent } from '../host.js';
|
|
27
|
-
import { registerElement } from '../register.js';
|
|
28
|
-
import { readSlotConfig } from '../slot-config.js';
|
|
29
|
-
const STYLE = `
|
|
30
|
-
:host {
|
|
31
|
-
display: block;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* Flat: this sits in the flow of the page. A shadow in this bundle means floating. */
|
|
35
|
-
[part="unavailable"] {
|
|
36
|
-
padding: var(--crtr-slot-unavailable-padding, var(--crtr-space-3));
|
|
37
|
-
color: var(--crtr-slot-unavailable-text-color, var(--crtr-color-text-muted));
|
|
38
|
-
background: var(--crtr-slot-unavailable-fill, var(--crtr-color-surface));
|
|
39
|
-
border: var(--crtr-slot-unavailable-border-width, 1px)
|
|
40
|
-
var(--crtr-slot-unavailable-border-style, solid)
|
|
41
|
-
var(--crtr-slot-unavailable-border-color, var(--crtr-color-border));
|
|
42
|
-
border-radius: var(--crtr-slot-unavailable-radius, var(--crtr-radius-medium));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
[part="unavailable"][hidden] {
|
|
46
|
-
display: none;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[part="kind"] {
|
|
50
|
-
color: var(--crtr-slot-kind-text-color, var(--crtr-color-text));
|
|
51
|
-
font-family: var(--crtr-slot-kind-font-family, var(--crtr-font-mono));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
[part="reason"] {
|
|
55
|
-
display: block;
|
|
56
|
-
margin-top: var(--crtr-slot-reason-gap, var(--crtr-space-1));
|
|
57
|
-
font-size: var(--crtr-slot-reason-font-size, 0.875em);
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
class CrtrSlotElement extends HTMLElement {
|
|
61
|
-
#unavailable = document.createElement('div');
|
|
62
|
-
#kind = document.createElement('span');
|
|
63
|
-
#reason = document.createElement('span');
|
|
64
|
-
#mount = document.createElement('div');
|
|
65
|
-
#started = false;
|
|
66
|
-
constructor() {
|
|
67
|
-
super();
|
|
68
|
-
const root = this.attachShadow({ mode: 'open' });
|
|
69
|
-
const style = document.createElement('style');
|
|
70
|
-
style.textContent = STYLE;
|
|
71
|
-
this.#unavailable.part.add('unavailable');
|
|
72
|
-
this.#unavailable.setAttribute('role', 'status');
|
|
73
|
-
this.#kind.part.add('kind');
|
|
74
|
-
this.#reason.part.add('reason');
|
|
75
|
-
this.#unavailable.append('Component unavailable: ', this.#kind, this.#reason);
|
|
76
|
-
// Hidden until the mount attempt resolves, so a host that does render this kind never
|
|
77
|
-
// flashes an unavailable state on the way in.
|
|
78
|
-
this.#unavailable.hidden = true;
|
|
79
|
-
this.#mount.part.add('mount');
|
|
80
|
-
root.append(style, document.createElement('slot'), this.#unavailable);
|
|
81
|
-
}
|
|
82
|
-
connectedCallback() {
|
|
83
|
-
if (this.#started)
|
|
84
|
-
return;
|
|
85
|
-
this.#started = true;
|
|
86
|
-
const kind = this.getAttribute('kind')?.trim() ?? '';
|
|
87
|
-
this.#kind.textContent = kind === '' ? 'unknown' : kind;
|
|
88
|
-
if (kind === '') {
|
|
89
|
-
this.#showUnavailable('This slot names no component kind.');
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const read = readSlotConfig(this);
|
|
93
|
-
if (read.status !== 'ok') {
|
|
94
|
-
this.#showUnavailable(read.reason);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
this.append(this.#mount);
|
|
98
|
-
void this.#attemptMount(kind, read.config);
|
|
99
|
-
}
|
|
100
|
-
async #attemptMount(kind, config) {
|
|
101
|
-
const outcome = await mountWorkspaceComponent(this.#mount, kind, config);
|
|
102
|
-
if (outcome === 'mounted')
|
|
103
|
-
return;
|
|
104
|
-
this.#mount.remove();
|
|
105
|
-
this.#showUnavailable('This page is open somewhere that cannot render it.');
|
|
106
|
-
}
|
|
107
|
-
#showUnavailable(reason) {
|
|
108
|
-
this.#reason.textContent = reason;
|
|
109
|
-
this.#unavailable.hidden = false;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
registerElement('crtr-slot', CrtrSlotElement);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `<crtr-table>` — a dataset the agent wants the user to pick from.
|
|
3
|
-
*
|
|
4
|
-
* Rows and columns are independently selectable, single or multi, because the two questions
|
|
5
|
-
* an agent asks of a table are "which of these records" and "which of these fields", and they
|
|
6
|
-
* are not the same question. Row selection wears a real checkbox or radio in a leading cell;
|
|
7
|
-
* column selection turns the header into a pressed toggle, since a column has no natural row
|
|
8
|
-
* to hang a checkbox on and the header IS the column.
|
|
9
|
-
*
|
|
10
|
-
* Anchored comments use the same one-per-anchor algebra as every other element: a row anchor
|
|
11
|
-
* in each row's trailing cell, a column anchor beside each header label, and a `whole` anchor
|
|
12
|
-
* in the trailing header cell for the table itself. Triggers stay invisible until the row is
|
|
13
|
-
* hovered or focused, or until a comment is actually there.
|
|
14
|
-
*
|
|
15
|
-
* Ported from the agent interaction kit's `agent-table.tsx` (northlight `3705fe9e2`), with the
|
|
16
|
-
* kit's `classic-list-keys` grammar — j/k move, x selects, c comments — reimplemented here
|
|
17
|
-
* over the shadow root.
|
|
18
|
-
*
|
|
19
|
-
* ## Styling
|
|
20
|
-
*
|
|
21
|
-
* Every styling value below is read through a `--crtr-table-*` component token, so a host
|
|
22
|
-
* restyles this element without touching crtr — custom properties inherit through the shadow
|
|
23
|
-
* boundary, which is the whole mechanism. The parts a person can name each own a scope:
|
|
24
|
-
* `container`, `caption`, `header`, `column-toggle`, `row`, `cell`, `selection` (the row
|
|
25
|
-
* control and the header's select-all, deliberately one thing), `comment-trigger`,
|
|
26
|
-
* `comment-editor`, `comment-input`, `comment-button` and its `comment-cancel` /
|
|
27
|
-
* `comment-save` paint, `notice`, `reason`, `empty`. Where a shared recipe draws the value the
|
|
28
|
-
* chain is `--crtr-table-<part>-<knob>` over the family's `--crtr-control-*` and then the kit
|
|
29
|
-
* default; every default stays inline at the rule that spends it, and no token is declared
|
|
30
|
-
* anywhere, which is what keeps the kit's own look when a host sets nothing.
|
|
31
|
-
*
|
|
32
|
-
* Layout and behaviour stay literal: `display`, positioning, the shrink-to-content column
|
|
33
|
-
* widths, text alignment, and the trigger's reveal-on-hover `opacity` are anatomy rather than
|
|
34
|
-
* paint, so they are not knobs.
|
|
35
|
-
*/
|
|
36
|
-
export {};
|