@12ui/design 0.2.76 → 0.2.78
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/SKILL.md +1 -1
- package/dist/cli-codex-readiness.d.ts +6 -0
- package/dist/cli-codex-readiness.d.ts.map +1 -1
- package/dist/cli-codex-readiness.js +12 -12
- package/dist/cli-codex-readiness.js.map +1 -1
- package/dist/cli-help/design.d.ts +2 -2
- package/dist/cli-help/design.d.ts.map +1 -1
- package/dist/cli-help/design.js +2 -0
- package/dist/cli-help/design.js.map +1 -1
- package/dist/cli-help/index.d.ts +2 -2
- package/dist/cli-review-command.d.ts.map +1 -1
- package/dist/cli-review-command.js +2 -0
- package/dist/cli-review-command.js.map +1 -1
- package/dist/cli-run.d.ts.map +1 -1
- package/dist/cli-run.js +6 -0
- package/dist/cli-run.js.map +1 -1
- package/dist/cli-workspace-draw.d.ts +1 -11
- package/dist/cli-workspace-draw.d.ts.map +1 -1
- package/dist/cli-workspace-draw.js +18 -18
- package/dist/cli-workspace-draw.js.map +1 -1
- package/dist/cli-workspace-runner.d.ts +30 -0
- package/dist/cli-workspace-runner.d.ts.map +1 -0
- package/dist/cli-workspace-runner.js +105 -0
- package/dist/cli-workspace-runner.js.map +1 -0
- package/dist/mcp-slate-image.js +1 -1
- package/dist/mcp-slate-image.js.map +1 -1
- package/dist/mcp-slate-tool-defs.js +1 -1
- package/dist/mcp-slate-tool-defs.js.map +1 -1
- package/dist/mcp-slate-ui-copy.d.ts +403 -33
- package/dist/mcp-slate-ui-copy.d.ts.map +1 -1
- package/dist/mcp-slate-ui-copy.js +247 -57
- package/dist/mcp-slate-ui-copy.js.map +1 -1
- package/dist/mcp-slate-ui-icu.d.ts +47 -0
- package/dist/mcp-slate-ui-icu.d.ts.map +1 -0
- package/dist/mcp-slate-ui-icu.js +229 -0
- package/dist/mcp-slate-ui-icu.js.map +1 -0
- package/dist/mcp-slate-ui-locale-match.d.ts +12 -0
- package/dist/mcp-slate-ui-locale-match.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locale-match.js +34 -0
- package/dist/mcp-slate-ui-locale-match.js.map +1 -0
- package/dist/mcp-slate-ui-locales/de-DE.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/de-DE.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/de-DE.js +217 -0
- package/dist/mcp-slate-ui-locales/de-DE.js.map +1 -0
- package/dist/mcp-slate-ui-locales/es-419.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/es-419.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/es-419.js +217 -0
- package/dist/mcp-slate-ui-locales/es-419.js.map +1 -0
- package/dist/mcp-slate-ui-locales/es-ES.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/es-ES.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/es-ES.js +217 -0
- package/dist/mcp-slate-ui-locales/es-ES.js.map +1 -0
- package/dist/mcp-slate-ui-locales/fr-FR.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/fr-FR.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/fr-FR.js +217 -0
- package/dist/mcp-slate-ui-locales/fr-FR.js.map +1 -0
- package/dist/mcp-slate-ui-locales/hi-IN.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/hi-IN.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/hi-IN.js +217 -0
- package/dist/mcp-slate-ui-locales/hi-IN.js.map +1 -0
- package/dist/mcp-slate-ui-locales/index.d.ts +11 -0
- package/dist/mcp-slate-ui-locales/index.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/index.js +34 -0
- package/dist/mcp-slate-ui-locales/index.js.map +1 -0
- package/dist/mcp-slate-ui-locales/it-IT.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/it-IT.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/it-IT.js +217 -0
- package/dist/mcp-slate-ui-locales/it-IT.js.map +1 -0
- package/dist/mcp-slate-ui-locales/ja-JP.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/ja-JP.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/ja-JP.js +217 -0
- package/dist/mcp-slate-ui-locales/ja-JP.js.map +1 -0
- package/dist/mcp-slate-ui-locales/ko-KR.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/ko-KR.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/ko-KR.js +217 -0
- package/dist/mcp-slate-ui-locales/ko-KR.js.map +1 -0
- package/dist/mcp-slate-ui-locales/pt-BR.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/pt-BR.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/pt-BR.js +217 -0
- package/dist/mcp-slate-ui-locales/pt-BR.js.map +1 -0
- package/dist/mcp-slate-ui-locales/zh-CN.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/zh-CN.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/zh-CN.js +217 -0
- package/dist/mcp-slate-ui-locales/zh-CN.js.map +1 -0
- package/dist/mcp-slate-ui-locales/zh-TW.d.ts +9 -0
- package/dist/mcp-slate-ui-locales/zh-TW.d.ts.map +1 -0
- package/dist/mcp-slate-ui-locales/zh-TW.js +217 -0
- package/dist/mcp-slate-ui-locales/zh-TW.js.map +1 -0
- package/dist/mcp-slate-ui-script-bridge.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-bridge.js +8 -9
- package/dist/mcp-slate-ui-script-bridge.js.map +1 -1
- package/dist/mcp-slate-ui-script-dialog.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-dialog.js +60 -30
- package/dist/mcp-slate-ui-script-dialog.js.map +1 -1
- package/dist/mcp-slate-ui-script-inline.d.ts +9 -6
- package/dist/mcp-slate-ui-script-inline.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-inline.js +91 -46
- package/dist/mcp-slate-ui-script-inline.js.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration-collage.d.ts +20 -0
- package/dist/mcp-slate-ui-script-inspiration-collage.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-inspiration-collage.js +68 -0
- package/dist/mcp-slate-ui-script-inspiration-collage.js.map +1 -0
- package/dist/mcp-slate-ui-script-inspiration-grid.d.ts +26 -0
- package/dist/mcp-slate-ui-script-inspiration-grid.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-inspiration-grid.js +246 -0
- package/dist/mcp-slate-ui-script-inspiration-grid.js.map +1 -0
- package/dist/mcp-slate-ui-script-inspiration.d.ts +10 -9
- package/dist/mcp-slate-ui-script-inspiration.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration.js +161 -120
- package/dist/mcp-slate-ui-script-inspiration.js.map +1 -1
- package/dist/mcp-slate-ui-script-l10n.d.ts +29 -0
- package/dist/mcp-slate-ui-script-l10n.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-l10n.js +135 -0
- package/dist/mcp-slate-ui-script-l10n.js.map +1 -0
- package/dist/mcp-slate-ui-script-more.d.ts +3 -2
- package/dist/mcp-slate-ui-script-more.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-more.js +19 -18
- package/dist/mcp-slate-ui-script-more.js.map +1 -1
- package/dist/mcp-slate-ui-script-pause.d.ts +33 -0
- package/dist/mcp-slate-ui-script-pause.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-pause.js +217 -0
- package/dist/mcp-slate-ui-script-pause.js.map +1 -0
- package/dist/mcp-slate-ui-script-remote.d.ts +2 -0
- package/dist/mcp-slate-ui-script-remote.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-remote.js +47 -6
- package/dist/mcp-slate-ui-script-remote.js.map +1 -1
- package/dist/mcp-slate-ui-script-scribble.js +1 -1
- package/dist/mcp-slate-ui-script-select.js +6 -6
- package/dist/mcp-slate-ui-script-stage.d.ts +3 -2
- package/dist/mcp-slate-ui-script-stage.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-stage.js +31 -19
- package/dist/mcp-slate-ui-script-stage.js.map +1 -1
- package/dist/mcp-slate-ui-script-state.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-state.js +77 -57
- package/dist/mcp-slate-ui-script-state.js.map +1 -1
- package/dist/mcp-slate-ui-script.d.ts +2 -2
- package/dist/mcp-slate-ui-script.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script.js +21 -7
- package/dist/mcp-slate-ui-script.js.map +1 -1
- package/dist/mcp-slate-ui-styles-dialog.d.ts +6 -7
- package/dist/mcp-slate-ui-styles-dialog.d.ts.map +1 -1
- package/dist/mcp-slate-ui-styles-dialog.js +13 -29
- package/dist/mcp-slate-ui-styles-dialog.js.map +1 -1
- package/dist/mcp-slate-ui-styles-inspiration.d.ts +18 -0
- package/dist/mcp-slate-ui-styles-inspiration.d.ts.map +1 -0
- package/dist/mcp-slate-ui-styles-inspiration.js +43 -0
- package/dist/mcp-slate-ui-styles-inspiration.js.map +1 -0
- package/dist/mcp-slate-ui-styles-pause.d.ts +10 -0
- package/dist/mcp-slate-ui-styles-pause.d.ts.map +1 -0
- package/dist/mcp-slate-ui-styles-pause.js +25 -0
- package/dist/mcp-slate-ui-styles-pause.js.map +1 -0
- package/dist/mcp-slate-ui-styles-stage.d.ts +10 -6
- package/dist/mcp-slate-ui-styles-stage.d.ts.map +1 -1
- package/dist/mcp-slate-ui-styles-stage.js +24 -16
- package/dist/mcp-slate-ui-styles-stage.js.map +1 -1
- package/dist/mcp-slate-ui-styles.d.ts +12 -5
- package/dist/mcp-slate-ui-styles.d.ts.map +1 -1
- package/dist/mcp-slate-ui-styles.js +38 -21
- package/dist/mcp-slate-ui-styles.js.map +1 -1
- package/dist/mcp-slate-ui.d.ts +11 -3
- package/dist/mcp-slate-ui.d.ts.map +1 -1
- package/dist/mcp-slate-ui.js +24 -16
- package/dist/mcp-slate-ui.js.map +1 -1
- package/dist/mosaic-bands.d.ts +44 -0
- package/dist/mosaic-bands.d.ts.map +1 -0
- package/dist/mosaic-bands.js +153 -0
- package/dist/mosaic-bands.js.map +1 -0
- package/dist/review-discovery.d.ts.map +1 -1
- package/dist/review-discovery.js +36 -54
- package/dist/review-discovery.js.map +1 -1
- package/dist/review-page.d.ts.map +1 -1
- package/dist/review-page.js +2 -1
- package/dist/review-page.js.map +1 -1
- package/dist/review-run-roots.d.ts +40 -0
- package/dist/review-run-roots.d.ts.map +1 -0
- package/dist/review-run-roots.js +94 -0
- package/dist/review-run-roots.js.map +1 -0
- package/dist/review-server.d.ts +2 -0
- package/dist/review-server.d.ts.map +1 -1
- package/dist/review-server.js +2 -0
- package/dist/review-server.js.map +1 -1
- package/dist/review-types.d.ts +10 -0
- package/dist/review-types.d.ts.map +1 -1
- package/dist/slate-actions.d.ts +3 -3
- package/dist/slate-actions.d.ts.map +1 -1
- package/dist/slate-actions.js +9 -8
- package/dist/slate-actions.js.map +1 -1
- package/dist/slate-browser-host-script.d.ts +4 -0
- package/dist/slate-browser-host-script.d.ts.map +1 -1
- package/dist/slate-browser-host-script.js +25 -6
- package/dist/slate-browser-host-script.js.map +1 -1
- package/dist/slate-browser-host.d.ts +2 -1
- package/dist/slate-browser-host.d.ts.map +1 -1
- package/dist/slate-browser-host.js +18 -5
- package/dist/slate-browser-host.js.map +1 -1
- package/dist/slate-commit.js +7 -7
- package/dist/slate-commit.js.map +1 -1
- package/dist/slate-corpus.d.ts.map +1 -1
- package/dist/slate-corpus.js +3 -2
- package/dist/slate-corpus.js.map +1 -1
- package/dist/slate-edit-runner.d.ts.map +1 -1
- package/dist/slate-edit-runner.js +5 -4
- package/dist/slate-edit-runner.js.map +1 -1
- package/dist/slate-editability.d.ts +2 -0
- package/dist/slate-editability.d.ts.map +1 -1
- package/dist/slate-editability.js +1 -1
- package/dist/slate-editability.js.map +1 -1
- package/dist/slate-errors.d.ts +7 -1
- package/dist/slate-errors.d.ts.map +1 -1
- package/dist/slate-errors.js +3 -2
- package/dist/slate-errors.js.map +1 -1
- package/dist/slate-handoff-options.d.ts +2 -1
- package/dist/slate-handoff-options.d.ts.map +1 -1
- package/dist/slate-handoff-options.js +2 -2
- package/dist/slate-handoff-options.js.map +1 -1
- package/dist/slate-handoff.js +1 -1
- package/dist/slate-handoff.js.map +1 -1
- package/dist/slate-image-executor.d.ts +28 -3
- package/dist/slate-image-executor.d.ts.map +1 -1
- package/dist/slate-image-executor.js +55 -11
- package/dist/slate-image-executor.js.map +1 -1
- package/dist/slate-inspiration.js +2 -2
- package/dist/slate-inspiration.js.map +1 -1
- package/dist/slate-local-image.d.ts.map +1 -1
- package/dist/slate-local-image.js +4 -1
- package/dist/slate-local-image.js.map +1 -1
- package/dist/slate-lock.js +1 -1
- package/dist/slate-lock.js.map +1 -1
- package/dist/slate-resume.js +6 -6
- package/dist/slate-resume.js.map +1 -1
- package/dist/slate-round-params.d.ts +3 -0
- package/dist/slate-round-params.d.ts.map +1 -1
- package/dist/slate-round-params.js +5 -0
- package/dist/slate-round-params.js.map +1 -1
- package/dist/slate-round-prompt.d.ts +15 -3
- package/dist/slate-round-prompt.d.ts.map +1 -1
- package/dist/slate-round-prompt.js +14 -5
- package/dist/slate-round-prompt.js.map +1 -1
- package/dist/slate-round-queries.d.ts +18 -0
- package/dist/slate-round-queries.d.ts.map +1 -0
- package/dist/slate-round-queries.js +29 -0
- package/dist/slate-round-queries.js.map +1 -0
- package/dist/slate-round-runner.d.ts.map +1 -1
- package/dist/slate-round-runner.js +12 -9
- package/dist/slate-round-runner.js.map +1 -1
- package/dist/slate-round-search.js +5 -5
- package/dist/slate-round-search.js.map +1 -1
- package/dist/slate-run-action.d.ts.map +1 -1
- package/dist/slate-run-action.js +2 -1
- package/dist/slate-run-action.js.map +1 -1
- package/dist/slate-runner-context.d.ts +3 -1
- package/dist/slate-runner-context.d.ts.map +1 -1
- package/dist/slate-runner-context.js +4 -3
- package/dist/slate-runner-context.js.map +1 -1
- package/dist/slate-runner-failure.d.ts +7 -1
- package/dist/slate-runner-failure.d.ts.map +1 -1
- package/dist/slate-runner-failure.js +6 -5
- package/dist/slate-runner-failure.js.map +1 -1
- package/dist/slate-runtime.d.ts.map +1 -1
- package/dist/slate-runtime.js +1 -0
- package/dist/slate-runtime.js.map +1 -1
- package/dist/slate-versions.js +3 -3
- package/dist/slate-versions.js.map +1 -1
- package/dist/slate-view-contract.d.ts +62 -1
- package/dist/slate-view-contract.d.ts.map +1 -1
- package/dist/slate-view-contract.js +30 -0
- package/dist/slate-view-contract.js.map +1 -1
- package/dist/slate-view.d.ts.map +1 -1
- package/dist/slate-view.js +19 -3
- package/dist/slate-view.js.map +1 -1
- package/dist/slate-workspace-parse.d.ts.map +1 -1
- package/dist/slate-workspace-parse.js +22 -0
- package/dist/slate-workspace-parse.js.map +1 -1
- package/dist/slate-workspace-types.d.ts +3 -1
- package/dist/slate-workspace-types.d.ts.map +1 -1
- package/dist/workspace-draw-client.d.ts +58 -5
- package/dist/workspace-draw-client.d.ts.map +1 -1
- package/dist/workspace-draw-client.js +82 -9
- package/dist/workspace-draw-client.js.map +1 -1
- package/dist/workspace-draw-codex.d.ts +9 -4
- package/dist/workspace-draw-codex.d.ts.map +1 -1
- package/dist/workspace-draw-codex.js +17 -3
- package/dist/workspace-draw-codex.js.map +1 -1
- package/dist/workspace-draw-messages.d.ts +31 -0
- package/dist/workspace-draw-messages.d.ts.map +1 -1
- package/dist/workspace-draw-messages.js +30 -0
- package/dist/workspace-draw-messages.js.map +1 -1
- package/dist/workspace-draw-run.d.ts +19 -1
- package/dist/workspace-draw-run.d.ts.map +1 -1
- package/dist/workspace-draw-run.js +98 -5
- package/dist/workspace-draw-run.js.map +1 -1
- package/dist/workspace-draw-store.d.ts +2 -0
- package/dist/workspace-draw-store.d.ts.map +1 -1
- package/dist/workspace-draw-store.js +3 -1
- package/dist/workspace-draw-store.js.map +1 -1
- package/dist/workspace-draw-types.d.ts +2 -0
- package/dist/workspace-draw-types.d.ts.map +1 -1
- package/dist/workspace-draw-types.js +2 -0
- package/dist/workspace-draw-types.js.map +1 -1
- package/dist/workspace-origin.d.ts +15 -0
- package/dist/workspace-origin.d.ts.map +1 -0
- package/dist/workspace-origin.js +36 -0
- package/dist/workspace-origin.js.map +1 -0
- package/dist/workspace-runner-children.d.ts +39 -0
- package/dist/workspace-runner-children.d.ts.map +1 -0
- package/dist/workspace-runner-children.js +139 -0
- package/dist/workspace-runner-children.js.map +1 -0
- package/dist/workspace-runner-client.d.ts +43 -0
- package/dist/workspace-runner-client.d.ts.map +1 -0
- package/dist/workspace-runner-client.js +72 -0
- package/dist/workspace-runner-client.js.map +1 -0
- package/dist/workspace-runner-main.d.ts +56 -0
- package/dist/workspace-runner-main.d.ts.map +1 -0
- package/dist/workspace-runner-main.js +378 -0
- package/dist/workspace-runner-main.js.map +1 -0
- package/dist/workspace-runner-policy.d.ts +40 -0
- package/dist/workspace-runner-policy.d.ts.map +1 -0
- package/dist/workspace-runner-policy.js +47 -0
- package/dist/workspace-runner-policy.js.map +1 -0
- package/dist/workspace-runner-spawn.d.ts +42 -0
- package/dist/workspace-runner-spawn.d.ts.map +1 -0
- package/dist/workspace-runner-spawn.js +60 -0
- package/dist/workspace-runner-spawn.js.map +1 -0
- package/dist/workspace-runner-stop.d.ts +25 -0
- package/dist/workspace-runner-stop.d.ts.map +1 -0
- package/dist/workspace-runner-stop.js +44 -0
- package/dist/workspace-runner-stop.js.map +1 -0
- package/dist/workspace-runner-store.d.ts +26 -0
- package/dist/workspace-runner-store.d.ts.map +1 -0
- package/dist/workspace-runner-store.js +114 -0
- package/dist/workspace-runner-store.js.map +1 -0
- package/open-design.json +2 -2
- package/package.json +1 -1
- package/runtime/codex-conversion/src/images/native-frame.mjs +103 -0
- package/runtime/codex-conversion/src/images/native-invoke.mjs +24 -5
- package/runtime/codex-conversion/src/images/native.mjs +14 -5
- package/runtime/codex-conversion/src/run-store.mjs +21 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Inspiration tab's page, the same in the card and the workspace: the
|
|
3
|
+
* search row, a line that says whose words are in the box, the status line,
|
|
4
|
+
* a line that says how many results the grid shows and why no more, the grid,
|
|
5
|
+
* and, while references are selected, Generate.
|
|
6
|
+
*
|
|
7
|
+
* - The grid: the search of the words in the box at the top (skeleton tiles
|
|
8
|
+
* while it runs, a line when it found nothing), then one section per round,
|
|
9
|
+
* newest first, with the references that produced its options. Every grid is
|
|
10
|
+
* a collage (`mcp-slate-ui-script-inspiration-collage.ts`): each picture at
|
|
11
|
+
* its own aspect ratio, every band as wide as the grid.
|
|
12
|
+
* - Every reference a round used carries a badge that says where, from the
|
|
13
|
+
* round records only: a reference is used when the round lists it
|
|
14
|
+
* (`rounds[].referenceIds`), and the options are those whose `referenceId`
|
|
15
|
+
* is it, e.g. "Used in round 1, option B". Nothing is inferred.
|
|
16
|
+
* - Generate asks for one new round drawn from exactly the selected
|
|
17
|
+
* references: it is Generate more's own request (`startRound`, which first
|
|
18
|
+
* waits for the selection write, then `design.slate.run` with a new round),
|
|
19
|
+
* so the server freezes the selection into the round and the person's agent
|
|
20
|
+
* or the local runner is told the same way. It draws the panel's default
|
|
21
|
+
* count, or the next count up when more references are selected, so every
|
|
22
|
+
* selected reference is drawn from at least once. While a round runs it is
|
|
23
|
+
* off and says why.
|
|
24
|
+
*/
|
|
25
|
+
export const SLATE_UI_INSPIRATION_GRID = String.raw `
|
|
26
|
+
// ---- where a reference was used, from the round records ----
|
|
27
|
+
function labelOrder(a, b) { return a.length - b.length || (a < b ? -1 : a > b ? 1 : 0); }
|
|
28
|
+
function usedText(id) {
|
|
29
|
+
var v = state.view;
|
|
30
|
+
// A round that still waits for the person has used nothing yet: its references are only chosen (the pause).
|
|
31
|
+
var places = v.rounds.slice().sort(function (a, b) { return b.index - a.index; }).filter(function (r) {
|
|
32
|
+
return r.referenceIds.indexOf(id) >= 0 && !(pauseActive() && r.roundId === pause.roundId);
|
|
33
|
+
}).map(function (r) {
|
|
34
|
+
var labels = v.candidates.filter(function (c) { return c.roundId === r.roundId && c.referenceId === id; }).map(function (c) { return c.label; }).sort(labelOrder);
|
|
35
|
+
return t("usedPlace", { options: labels.length, round: r.index, labels: labels.length ? listOf(labels) : "" });
|
|
36
|
+
});
|
|
37
|
+
return places.length ? t("usedIn", { places: places.join(t("usedSeparator")) }) : "";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ---- the tiles ----
|
|
41
|
+
function refButton(id) {
|
|
42
|
+
var b = button("", "refbtn");
|
|
43
|
+
b.setAttribute("aria-label", refName(id));
|
|
44
|
+
b.setAttribute("data-ref", id);
|
|
45
|
+
collageShape(b, id);
|
|
46
|
+
// The picture's own skeleton shows until it lands, so a tile that has arrived never flashes a grey square.
|
|
47
|
+
var img = el("img", "thumb empty shimmer");
|
|
48
|
+
img.alt = "";
|
|
49
|
+
b.appendChild(img);
|
|
50
|
+
bindReference(img, id, "thumb");
|
|
51
|
+
var check = el("span", "check");
|
|
52
|
+
check.innerHTML = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
|
|
53
|
+
b.appendChild(check);
|
|
54
|
+
var used = usedText(id);
|
|
55
|
+
if (used) {
|
|
56
|
+
b.classList.add("used");
|
|
57
|
+
b.title = used;
|
|
58
|
+
b.appendChild(el("span", "usedbadge", used));
|
|
59
|
+
}
|
|
60
|
+
b.addEventListener("click", function () { toggleRef(id); });
|
|
61
|
+
return b;
|
|
62
|
+
}
|
|
63
|
+
function refSection(heading, title, ids) {
|
|
64
|
+
var sec = el("section", "refsec");
|
|
65
|
+
if (heading) {
|
|
66
|
+
var h = el("h2", "refhead", heading);
|
|
67
|
+
if (title) h.title = title;
|
|
68
|
+
sec.appendChild(h);
|
|
69
|
+
}
|
|
70
|
+
var grid = el("div", "refgrid");
|
|
71
|
+
ids.forEach(function (id) { grid.appendChild(refButton(id)); });
|
|
72
|
+
sec.appendChild(grid);
|
|
73
|
+
return sec;
|
|
74
|
+
}
|
|
75
|
+
// Tiles where the results will land, packed by the same collage, each a 16:10 landscape until the pictures are known.
|
|
76
|
+
var SKELETON_TILES = 12;
|
|
77
|
+
function skeletonSection() {
|
|
78
|
+
var sec = el("section", "refsec");
|
|
79
|
+
var grid = el("div", "refgrid");
|
|
80
|
+
for (var i = 0; i < SKELETON_TILES; i++) {
|
|
81
|
+
var tile = el("div", "skeleton shimmer");
|
|
82
|
+
collageShape(tile, null);
|
|
83
|
+
grid.appendChild(tile);
|
|
84
|
+
}
|
|
85
|
+
sec.appendChild(grid);
|
|
86
|
+
return sec;
|
|
87
|
+
}
|
|
88
|
+
function buildResults(box) {
|
|
89
|
+
var v = state.view;
|
|
90
|
+
var any = false;
|
|
91
|
+
var search = shownSearch();
|
|
92
|
+
// The search's slot: skeleton tiles while it runs, else its references, or the line that it found none.
|
|
93
|
+
// A round that waits for the person comes first, with the references it will be drawn from as they stand now.
|
|
94
|
+
var waiting = pauseRound();
|
|
95
|
+
if (waiting) { box.appendChild(refSection(t("roundHeading", { n: waiting.index }), roundTitle(waiting), pauseChosen())); any = true; }
|
|
96
|
+
if (state.insp.searching) { box.appendChild(skeletonSection()); any = true; }
|
|
97
|
+
else if (search && search.referenceIds.length === 0 && state.insp.noMatch === search.searchId) { box.appendChild(el("div", "placeholder", t("inspirationNoMatches"))); any = true; }
|
|
98
|
+
else if (search && search.referenceIds.length > 0) { box.appendChild(refSection("", "", search.referenceIds)); any = true; }
|
|
99
|
+
v.rounds.slice().sort(function (a, b) { return b.index - a.index; }).forEach(function (round) {
|
|
100
|
+
if (round.referenceIds.length === 0 || (waiting && round.roundId === waiting.roundId)) return;
|
|
101
|
+
box.appendChild(refSection(t("roundHeading", { n: round.index }), roundTitle(round), round.referenceIds));
|
|
102
|
+
any = true;
|
|
103
|
+
});
|
|
104
|
+
if (!any) box.appendChild(el("div", "placeholder", t("inspirationEmpty")));
|
|
105
|
+
}
|
|
106
|
+
// How many the search shows, and, at the cap, that one search returns no more.
|
|
107
|
+
function resultsText() {
|
|
108
|
+
var search = shownSearch();
|
|
109
|
+
if (state.insp.searching || !search || search.referenceIds.length === 0) return "";
|
|
110
|
+
var n = search.referenceIds.length;
|
|
111
|
+
return t(n >= SEARCH_COUNT ? "resultsMax" : "resultsCount", { n: n });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ---- Generate: one new round from exactly the selected references ----
|
|
115
|
+
function generateCount(selected) {
|
|
116
|
+
var want = Math.max(selected, MORE.initial);
|
|
117
|
+
var fit = MORE.choices.filter(function (n) { return n >= want; })[0];
|
|
118
|
+
return fit || MORE.choices[MORE.choices.length - 1];
|
|
119
|
+
}
|
|
120
|
+
function generateFromSelection() {
|
|
121
|
+
var chosen = currentSelected();
|
|
122
|
+
if (chosen.length === 0 || state.insp.generating || moreBusy() || !localImage().ready) return;
|
|
123
|
+
state.insp.generating = true;
|
|
124
|
+
setInspStatus("", "");
|
|
125
|
+
renderAll();
|
|
126
|
+
startRound(uuid4(), { mode: "new", note: "", count: generateCount(chosen.length) }).then(function () {
|
|
127
|
+
state.insp.generating = false;
|
|
128
|
+
// The new round's options are pending in the designs: show them.
|
|
129
|
+
if (state.tab === "inspiration") setTab("designs"); else renderAll();
|
|
130
|
+
}, function (err) {
|
|
131
|
+
state.insp.generating = false;
|
|
132
|
+
setInspStatus(errText(err), "err");
|
|
133
|
+
renderAll();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function syncGenerate(pane) {
|
|
137
|
+
var chosen = currentSelected();
|
|
138
|
+
pane.__bar.classList.toggle("hidden", chosen.length === 0);
|
|
139
|
+
if (chosen.length === 0) return;
|
|
140
|
+
var running = moreBusy() && !state.insp.generating;
|
|
141
|
+
var local = localImage();
|
|
142
|
+
var line = t("selectionDraws", { m: chosen.length, n: generateCount(chosen.length) });
|
|
143
|
+
if (running) line = t("roundRunning");
|
|
144
|
+
else if (!local.ready && localReason()) line = localReason();
|
|
145
|
+
pane.__barText.textContent = line;
|
|
146
|
+
pane.__generate.disabled = state.insp.generating || running || !local.ready;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ---- the tab ----
|
|
150
|
+
function buildInspirationShell(pane, where) {
|
|
151
|
+
pane.__built = true;
|
|
152
|
+
pane.__where = where;
|
|
153
|
+
pane.classList.add("insp", where);
|
|
154
|
+
var row = el("div", "searchrow");
|
|
155
|
+
var input = el("input");
|
|
156
|
+
input.type = "text";
|
|
157
|
+
input.className = "query";
|
|
158
|
+
input.autocomplete = "off";
|
|
159
|
+
input.placeholder = t("inspirationPlaceholder");
|
|
160
|
+
input.setAttribute("aria-label", t("inspirationLabel"));
|
|
161
|
+
input.value = state.query;
|
|
162
|
+
input.addEventListener("input", function () {
|
|
163
|
+
state.query = input.value;
|
|
164
|
+
state.insp.typed = true;
|
|
165
|
+
var panes = document.querySelectorAll(".insp");
|
|
166
|
+
for (var i = 0; i < panes.length; i++) { syncSearchButton(panes[i]); syncHow(panes[i]); }
|
|
167
|
+
});
|
|
168
|
+
input.addEventListener("keydown", function (e) { if (e.key === "Enter") doSearch(); });
|
|
169
|
+
var search = button(t("search"), "primary", doSearch);
|
|
170
|
+
row.appendChild(input);
|
|
171
|
+
row.appendChild(search);
|
|
172
|
+
var how = el("p", "insphow");
|
|
173
|
+
var status = el("div", "status");
|
|
174
|
+
status.setAttribute("data-istatus", "");
|
|
175
|
+
status.setAttribute("role", "status");
|
|
176
|
+
status.setAttribute("aria-live", "polite");
|
|
177
|
+
if (state.inspMsg) { status.textContent = state.inspMsg.text; if (state.inspMsg.kind) status.className = "status " + state.inspMsg.kind; }
|
|
178
|
+
var count = el("p", "insphow inspcount");
|
|
179
|
+
var pauseHost = el("div", "pausebar hidden");
|
|
180
|
+
var pauseChoice = el("p", "help pausechoice");
|
|
181
|
+
pauseChoice.setAttribute("aria-live", "polite");
|
|
182
|
+
var bar = el("div", "inspbar hidden");
|
|
183
|
+
var barText = el("p", "help");
|
|
184
|
+
barText.setAttribute("aria-live", "polite");
|
|
185
|
+
var generate = button(t("generate"), "primary", generateFromSelection);
|
|
186
|
+
bar.appendChild(barText);
|
|
187
|
+
bar.appendChild(generate);
|
|
188
|
+
pane.__input = input;
|
|
189
|
+
pane.__search = search;
|
|
190
|
+
pane.__how = how;
|
|
191
|
+
pane.__count = count;
|
|
192
|
+
pane.__results = el("div", "results");
|
|
193
|
+
pane.__bar = bar;
|
|
194
|
+
pane.__barText = barText;
|
|
195
|
+
pane.__generate = generate;
|
|
196
|
+
pane.__pause = pauseHost;
|
|
197
|
+
pane.__pauseChoice = pauseChoice;
|
|
198
|
+
pane.appendChild(row);
|
|
199
|
+
pane.appendChild(how);
|
|
200
|
+
pane.appendChild(status);
|
|
201
|
+
pane.appendChild(count);
|
|
202
|
+
pane.appendChild(pane.__results);
|
|
203
|
+
pane.appendChild(bar);
|
|
204
|
+
pane.appendChild(pauseChoice);
|
|
205
|
+
pane.appendChild(pauseHost);
|
|
206
|
+
// The collage is measured: a new width (a resize, a scroll bar, the tab shown again) lays it out again.
|
|
207
|
+
new ResizeObserver(function () { layoutResults(pane); }).observe(pane.__results);
|
|
208
|
+
}
|
|
209
|
+
function syncHow(pane) {
|
|
210
|
+
var text = howText();
|
|
211
|
+
pane.__how.textContent = text;
|
|
212
|
+
pane.__how.classList.toggle("hidden", !text);
|
|
213
|
+
}
|
|
214
|
+
function renderInspiration(pane, where) {
|
|
215
|
+
if (!state.view) return;
|
|
216
|
+
if (!pane.__built) buildInspirationShell(pane, where);
|
|
217
|
+
syncQuery();
|
|
218
|
+
// The box shows the words, except while the person is in it: their caret and typing are never disturbed.
|
|
219
|
+
if (pane.__input.value !== state.query && document.activeElement !== pane.__input) pane.__input.value = state.query;
|
|
220
|
+
// Words longer than the field are all in its tooltip.
|
|
221
|
+
if (pane.__input.scrollWidth > pane.__input.clientWidth) pane.__input.title = state.query; else pane.__input.removeAttribute("title");
|
|
222
|
+
syncSearchButton(pane);
|
|
223
|
+
syncHow(pane);
|
|
224
|
+
var v = state.view;
|
|
225
|
+
var search = shownSearch();
|
|
226
|
+
pane.__results.setAttribute("aria-busy", state.insp.searching ? "true" : "false");
|
|
227
|
+
var count = resultsText();
|
|
228
|
+
pane.__count.textContent = count;
|
|
229
|
+
pane.__count.classList.toggle("hidden", !count);
|
|
230
|
+
var sig = JSON.stringify([pause.roundId, pauseActive() ? pauseChosen() : null, state.insp.searching, state.insp.noMatch, search && [search.searchId, search.referenceIds],
|
|
231
|
+
v.rounds.map(function (r) { return [r.index, r.kind, r.fromVersionId, r.referenceIds]; }),
|
|
232
|
+
v.candidates.map(function (c) { return [c.roundId, c.label, c.referenceId]; }), v.references]);
|
|
233
|
+
setIfChanged(pane.__results, sig, buildResults);
|
|
234
|
+
layoutResults(pane);
|
|
235
|
+
var chosen = pauseActive() ? pauseChosen() : currentSelected();
|
|
236
|
+
var buttons = pane.__results.querySelectorAll(".refbtn");
|
|
237
|
+
for (var i = 0; i < buttons.length; i++) buttons[i].setAttribute("aria-pressed", chosen.indexOf(buttons[i].getAttribute("data-ref")) >= 0 ? "true" : "false");
|
|
238
|
+
// While a round waits for the person, the tab's bar is the pause's: how the options take the references, and Continue.
|
|
239
|
+
syncPauseHost(pane.__pause, false);
|
|
240
|
+
pane.__pauseChoice.textContent = pauseActive() ? pauseChoiceText() : "";
|
|
241
|
+
pane.__pauseChoice.classList.toggle("hidden", !pauseActive());
|
|
242
|
+
if (pauseActive()) pane.__bar.classList.add("hidden"); else syncGenerate(pane);
|
|
243
|
+
autoSearch();
|
|
244
|
+
}
|
|
245
|
+
`;
|
|
246
|
+
//# sourceMappingURL=mcp-slate-ui-script-inspiration-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inspiration-grid.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4NlD,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* produced its options. Every reference is a toggle. The selection lives in
|
|
6
|
-
* the view (`inspiration.selected`, at most eight, in click order) and is
|
|
7
|
-
* written whole through the inspiration tool, one write in flight at a time,
|
|
8
|
-
* last click wins locally; the next round reads it at commit. Nothing in this
|
|
9
|
-
* tab starts work. While a search runs the newest-search slot is skeleton
|
|
10
|
-
* tiles; a search with no results says so.
|
|
2
|
+
* How many references the Inspiration tab asks one search for: the most the free corpus returns for one query (the
|
|
3
|
+
* public tier's cap, which both servers' inspire tools also cap at). The corpus has no paging, so this is all one search
|
|
4
|
+
* can show; the tab says so next to the results.
|
|
11
5
|
*/
|
|
6
|
+
export declare const SLATE_INSPIRATION_SEARCH_COUNT = 24;
|
|
7
|
+
/**
|
|
8
|
+
* The longest words one search takes, in characters (code points): both servers' inspire tools refuse longer. A round
|
|
9
|
+
* searches with the whole brief and its note, which can be longer, so the box shows the round's words in full and the
|
|
10
|
+
* search takes their first 500 characters, cut at a space, and the tab says so.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SLATE_INSPIRATION_QUERY_CHARS = 500;
|
|
12
13
|
export declare const SLATE_UI_INSPIRATION: string;
|
|
13
14
|
//# sourceMappingURL=mcp-slate-ui-script-inspiration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-inspiration.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inspiration.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,KAA0B,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAuQjD,eAAO,MAAM,oBAAoB,QAA2F,CAAC"}
|
|
@@ -1,23 +1,59 @@
|
|
|
1
|
+
import { PUBLIC_CORPUS_MAX_COUNT } from './corpus-access.js';
|
|
2
|
+
import { SLATE_UI_INSPIRATION_COLLAGE } from './mcp-slate-ui-script-inspiration-collage.js';
|
|
3
|
+
import { SLATE_UI_INSPIRATION_GRID } from './mcp-slate-ui-script-inspiration-grid.js';
|
|
4
|
+
/**
|
|
5
|
+
* How many references the Inspiration tab asks one search for: the most the free corpus returns for one query (the
|
|
6
|
+
* public tier's cap, which both servers' inspire tools also cap at). The corpus has no paging, so this is all one search
|
|
7
|
+
* can show; the tab says so next to the results.
|
|
8
|
+
*/
|
|
9
|
+
export const SLATE_INSPIRATION_SEARCH_COUNT = PUBLIC_CORPUS_MAX_COUNT;
|
|
10
|
+
/**
|
|
11
|
+
* The longest words one search takes, in characters (code points): both servers' inspire tools refuse longer. A round
|
|
12
|
+
* searches with the whole brief and its note, which can be longer, so the box shows the round's words in full and the
|
|
13
|
+
* search takes their first 500 characters, cut at a space, and the tab says so.
|
|
14
|
+
*/
|
|
15
|
+
export const SLATE_INSPIRATION_QUERY_CHARS = 500;
|
|
1
16
|
/**
|
|
2
17
|
* The tabs (Designs and Inspiration, in the card and the workspace) and the
|
|
3
|
-
* Inspiration tab, which
|
|
4
|
-
* search
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
18
|
+
* Inspiration tab's words and work, which are the same in both places: the
|
|
19
|
+
* search box, the search, and the selection. The tab's grid, its badges and
|
|
20
|
+
* Generate are in mcp-slate-ui-script-inspiration-grid.ts.
|
|
21
|
+
*
|
|
22
|
+
* - The search box opens with the words that produced this workspace's
|
|
23
|
+
* references: the newest round's own search words, which the server states
|
|
24
|
+
* in `inspiration.roundQueries` (stored or derived, never searched again),
|
|
25
|
+
* else the newest recorded search. A line under it says whose words they are,
|
|
26
|
+
* and when rounds searched different words, that these are the newest. Once
|
|
27
|
+
* the person types, the box is theirs.
|
|
28
|
+
* - The grid shows the search of the words in the box. When the record has no
|
|
29
|
+
* search of the newest round's words, opening the tab runs that one search
|
|
30
|
+
* (free, at most once per workspace and words; an identical search is
|
|
31
|
+
* answered from the record by both servers). Every search asks for the most
|
|
32
|
+
* one search returns.
|
|
33
|
+
* - Every reference is a toggle. The selection lives in the view
|
|
34
|
+
* (`inspiration.selected`, at most eight, in click order) and is written
|
|
35
|
+
* whole through the inspiration tool, one write in flight at a time, last
|
|
36
|
+
* click wins locally; the next round reads it at commit. Nothing here starts
|
|
37
|
+
* a round: Generate does, through the same request as Generate more.
|
|
11
38
|
*/
|
|
12
|
-
|
|
39
|
+
const SEARCH_AND_SELECTION = String.raw `
|
|
13
40
|
var MAX_SELECTED = 8;
|
|
41
|
+
var SEARCH_COUNT = ${JSON.stringify(SLATE_INSPIRATION_SEARCH_COUNT)};
|
|
42
|
+
var QUERY_CHARS = ${JSON.stringify(SLATE_INSPIRATION_QUERY_CHARS)};
|
|
43
|
+
// Per workspace: whether the person typed in the box, the search the grid shows, the automatic searches already asked.
|
|
44
|
+
state.insp.runDir = null;
|
|
45
|
+
state.insp.typed = false;
|
|
46
|
+
state.insp.shownQuery = null;
|
|
47
|
+
state.insp.searchId = "";
|
|
48
|
+
state.insp.auto = {};
|
|
49
|
+
state.insp.generating = false;
|
|
14
50
|
|
|
15
51
|
// A tab strip for the workspace header. The card's own strip is static markup; both carry data-tab.
|
|
16
52
|
function buildTabs() {
|
|
17
53
|
var tabs = el("div", "tabs");
|
|
18
54
|
tabs.setAttribute("role", "tablist");
|
|
19
|
-
tabs.setAttribute("aria-label",
|
|
20
|
-
[["designs",
|
|
55
|
+
tabs.setAttribute("aria-label", t("title"));
|
|
56
|
+
[["designs", t("tabDesigns")], ["inspiration", t("tabInspiration")]].forEach(function (t) {
|
|
21
57
|
var b = button(t[1], "tab");
|
|
22
58
|
b.setAttribute("role", "tab");
|
|
23
59
|
b.setAttribute("data-tab", t[0]);
|
|
@@ -49,9 +85,10 @@ export const SLATE_UI_INSPIRATION = String.raw `
|
|
|
49
85
|
var m = refMeta(id);
|
|
50
86
|
return String((m && m.description) || id).slice(0, 40);
|
|
51
87
|
}
|
|
52
|
-
function refName(id) { return
|
|
88
|
+
function refName(id) { return t("referenceName", { description: refDescription(id) }); }
|
|
89
|
+
function searchList() { return (state.view.inspiration && state.view.inspiration.searches) || []; }
|
|
53
90
|
function newestSearch() {
|
|
54
|
-
var searches = (
|
|
91
|
+
var searches = searchList();
|
|
55
92
|
var best = null;
|
|
56
93
|
// The hosted server sends no time, only the order: the last search is the newest.
|
|
57
94
|
if (TARGET === "remote") return searches.length ? searches[searches.length - 1] : null;
|
|
@@ -59,11 +96,91 @@ export const SLATE_UI_INSPIRATION = String.raw `
|
|
|
59
96
|
return best;
|
|
60
97
|
}
|
|
61
98
|
function roundTitle(round) {
|
|
62
|
-
if (round.kind === "new") return
|
|
63
|
-
if (round.kind === "like") { var from = ver(round.fromVersionId); return
|
|
99
|
+
if (round.kind === "new") return t("newOptionsTitle");
|
|
100
|
+
if (round.kind === "like") { var from = ver(round.fromVersionId); return t("likeTitle", { label: from ? from.label : "" }); }
|
|
64
101
|
return "";
|
|
65
102
|
}
|
|
66
103
|
|
|
104
|
+
// ---- whose words are in the box ----
|
|
105
|
+
// Two sets of words are the same search when both servers would key them alike: whitespace collapsed, case ignored.
|
|
106
|
+
function norm(text) { return String(text || "").replace(/\s+/g, " ").trim().toLowerCase(); }
|
|
107
|
+
function collapsed(text) { return String(text || "").replace(/\s+/g, " ").trim(); }
|
|
108
|
+
// What one search can take of these words: all of them, or the first QUERY_CHARS characters, cut at the last space.
|
|
109
|
+
function searchable(text) {
|
|
110
|
+
var chars = Array.from(collapsed(text));
|
|
111
|
+
if (chars.length <= QUERY_CHARS) return chars.join("");
|
|
112
|
+
var cut = chars.slice(0, QUERY_CHARS).join("");
|
|
113
|
+
var space = cut.lastIndexOf(" ");
|
|
114
|
+
return (chars[QUERY_CHARS] === " " || space < 0 ? cut : cut.slice(0, space)).trim();
|
|
115
|
+
}
|
|
116
|
+
function tooLong(text) { return Array.from(collapsed(text)).length > QUERY_CHARS; }
|
|
117
|
+
// The newest round's search words, the rounds that searched them, and the rounds that searched other words.
|
|
118
|
+
function roundWords() {
|
|
119
|
+
var queries = (state.view.inspiration && state.view.inspiration.roundQueries) || [];
|
|
120
|
+
if (queries.length === 0) return null;
|
|
121
|
+
var latest = queries.reduce(function (a, b) { return b.roundIndex > a.roundIndex ? b : a; });
|
|
122
|
+
var key = norm(latest.query);
|
|
123
|
+
var byIndex = function (a, b) { return a - b; };
|
|
124
|
+
return {
|
|
125
|
+
query: latest.query,
|
|
126
|
+
same: queries.filter(function (q) { return norm(q.query) === key; }).map(function (q) { return q.roundIndex; }).sort(byIndex),
|
|
127
|
+
other: queries.filter(function (q) { return norm(q.query) !== key; }).map(function (q) { return q.roundIndex; }).sort(byIndex)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function defaultQuery() {
|
|
131
|
+
var words = roundWords();
|
|
132
|
+
if (words) return words.query;
|
|
133
|
+
var newest = newestSearch();
|
|
134
|
+
return newest ? newest.query : "";
|
|
135
|
+
}
|
|
136
|
+
function howText() {
|
|
137
|
+
var shown = norm(state.query);
|
|
138
|
+
if (!shown) return "";
|
|
139
|
+
var words = roundWords();
|
|
140
|
+
var line = "";
|
|
141
|
+
if (words && norm(words.query) === shown) {
|
|
142
|
+
line = words.other.length === 0
|
|
143
|
+
? t("queryFrom", { count: words.same.length, rounds: listOf(words.same) })
|
|
144
|
+
: t("queryNewestOthers", { count: words.same.length, rounds: listOf(words.same), otherCount: words.other.length, others: listOf(words.other) });
|
|
145
|
+
} else {
|
|
146
|
+
var newest = newestSearch();
|
|
147
|
+
if (!state.insp.typed && newest && norm(newest.query) === shown) line = t("queryLastSearch");
|
|
148
|
+
}
|
|
149
|
+
if (tooLong(state.query)) line = sentences(line, t("queryCut", { n: QUERY_CHARS }));
|
|
150
|
+
return line;
|
|
151
|
+
}
|
|
152
|
+
// A new workspace starts clean; until the person types, the box follows the workspace's own words, and the grid with it.
|
|
153
|
+
function syncQuery() {
|
|
154
|
+
var v = state.view;
|
|
155
|
+
var i = state.insp;
|
|
156
|
+
if (i.runDir !== v.runDir) {
|
|
157
|
+
i.runDir = v.runDir;
|
|
158
|
+
i.typed = false;
|
|
159
|
+
i.shownQuery = null;
|
|
160
|
+
i.searchId = "";
|
|
161
|
+
i.noMatch = "";
|
|
162
|
+
}
|
|
163
|
+
if (i.typed) return;
|
|
164
|
+
var words = defaultQuery();
|
|
165
|
+
if (norm(words) !== norm(state.query)) { i.shownQuery = null; i.searchId = ""; }
|
|
166
|
+
state.query = words;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ---- the search the grid shows: the one the person ran, else the record's search of the words in the box ----
|
|
170
|
+
function findSearch(words) {
|
|
171
|
+
var key = norm(words);
|
|
172
|
+
var hit = null;
|
|
173
|
+
searchList().forEach(function (s) { if (norm(s.query) === key) hit = s; });
|
|
174
|
+
return hit;
|
|
175
|
+
}
|
|
176
|
+
function shownSearch() {
|
|
177
|
+
var i = state.insp;
|
|
178
|
+
var ran = i.searchId ? searchList().filter(function (s) { return s.searchId === i.searchId; })[0] : null;
|
|
179
|
+
if (ran) return ran;
|
|
180
|
+
var words = i.shownQuery !== null ? i.shownQuery : defaultQuery();
|
|
181
|
+
return words ? findSearch(searchable(words)) : newestSearch();
|
|
182
|
+
}
|
|
183
|
+
|
|
67
184
|
// ---- the status line of this tab ----
|
|
68
185
|
function setInspStatus(text, kind) {
|
|
69
186
|
var nodes = document.querySelectorAll("[data-istatus]");
|
|
@@ -73,11 +190,13 @@ export const SLATE_UI_INSPIRATION = String.raw `
|
|
|
73
190
|
|
|
74
191
|
// ---- selection: optimistic, serialized, last write wins ----
|
|
75
192
|
function toggleRef(id) {
|
|
193
|
+
// While a round waits for the person, a tile is a reference for that round, not the selection for a later one.
|
|
194
|
+
if (pauseActive()) { togglePauseRef(id); return; }
|
|
76
195
|
var cur = currentSelected().slice();
|
|
77
196
|
var at = cur.indexOf(id);
|
|
78
197
|
if (at >= 0) cur.splice(at, 1);
|
|
79
198
|
else {
|
|
80
|
-
if (cur.length >= MAX_SELECTED) { setInspStatus(
|
|
199
|
+
if (cur.length >= MAX_SELECTED) { setInspStatus(t("eightAtMost"), ""); return; }
|
|
81
200
|
cur.push(id);
|
|
82
201
|
}
|
|
83
202
|
setInspStatus("", "");
|
|
@@ -118,119 +237,41 @@ export const SLATE_UI_INSPIRATION = String.raw `
|
|
|
118
237
|
if (pane.__search) pane.__search.disabled = !state.query.trim() || state.insp.searching;
|
|
119
238
|
}
|
|
120
239
|
function doSearch() {
|
|
121
|
-
var q = state.query
|
|
240
|
+
var q = searchable(state.query);
|
|
122
241
|
if (!q || state.insp.searching || !state.view) return;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
242
|
+
runSearch(q);
|
|
243
|
+
}
|
|
244
|
+
function runSearch(q) {
|
|
245
|
+
var i = state.insp;
|
|
246
|
+
i.searching = true;
|
|
247
|
+
i.noMatch = "";
|
|
248
|
+
setInspStatus(t("searching"), "");
|
|
126
249
|
renderAll();
|
|
127
|
-
callTool(TOOLS.inspire, { runDir: state.view.runDir, query: q }).then(function (result) {
|
|
250
|
+
callTool(TOOLS.inspire, { runDir: state.view.runDir, query: q, count: SEARCH_COUNT }).then(function (result) {
|
|
128
251
|
var sc = result.structuredContent || {};
|
|
252
|
+
// The grid shows what this search found from now on, even when the view's newest search is another one.
|
|
253
|
+
if (sc.search) { i.searchId = sc.search.searchId; i.shownQuery = sc.search.query; }
|
|
129
254
|
if (sc.view) applyView(sc.view, true);
|
|
130
255
|
setInspStatus("", "");
|
|
131
256
|
var found = sc.search || newestSearch();
|
|
132
|
-
if (found && found.referenceIds.length === 0)
|
|
257
|
+
if (found && found.referenceIds.length === 0) i.noMatch = found.searchId;
|
|
133
258
|
}, function (err) {
|
|
134
|
-
setInspStatus(err.code === "rate_limited" && err.retryAfterSeconds !== undefined ?
|
|
135
|
-
}).then(function () {
|
|
259
|
+
setInspStatus(err.code === "rate_limited" && err.retryAfterSeconds !== undefined ? t("tryAgain", { n: err.retryAfterSeconds }) : t("searchFailed", { message: errText(err) }), "err");
|
|
260
|
+
}).then(function () { i.searching = false; renderAll(); });
|
|
136
261
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
function refButton(id) {
|
|
140
|
-
var b = button("", "refbtn");
|
|
141
|
-
b.setAttribute("aria-label", refName(id));
|
|
142
|
-
b.setAttribute("data-ref", id);
|
|
143
|
-
// The picture's own skeleton shows until it lands, so a tile that has arrived never flashes a grey square.
|
|
144
|
-
var img = el("img", "thumb empty shimmer");
|
|
145
|
-
img.alt = "";
|
|
146
|
-
b.appendChild(img);
|
|
147
|
-
bindReference(img, id, "thumb");
|
|
148
|
-
var check = el("span", "check");
|
|
149
|
-
check.innerHTML = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
|
|
150
|
-
b.appendChild(check);
|
|
151
|
-
b.addEventListener("click", function () { toggleRef(id); });
|
|
152
|
-
return b;
|
|
153
|
-
}
|
|
154
|
-
function refSection(heading, title, ids) {
|
|
155
|
-
var sec = el("section", "refsec");
|
|
156
|
-
if (heading) {
|
|
157
|
-
var h = el("h2", "refhead", heading);
|
|
158
|
-
if (title) h.title = title;
|
|
159
|
-
sec.appendChild(h);
|
|
160
|
-
}
|
|
161
|
-
var grid = el("div", "refgrid");
|
|
162
|
-
ids.forEach(function (id) { grid.appendChild(refButton(id)); });
|
|
163
|
-
sec.appendChild(grid);
|
|
164
|
-
return sec;
|
|
165
|
-
}
|
|
166
|
-
// The same tiles as the results, at the same size, where the results will land.
|
|
167
|
-
var SKELETON_TILES = 12;
|
|
168
|
-
function skeletonSection() {
|
|
169
|
-
var sec = el("section", "refsec");
|
|
170
|
-
var grid = el("div", "refgrid");
|
|
171
|
-
for (var i = 0; i < SKELETON_TILES; i++) grid.appendChild(el("div", "skeleton shimmer"));
|
|
172
|
-
sec.appendChild(grid);
|
|
173
|
-
return sec;
|
|
174
|
-
}
|
|
175
|
-
function buildResults(box) {
|
|
176
|
-
var v = state.view;
|
|
177
|
-
var any = false;
|
|
178
|
-
var search = newestSearch();
|
|
179
|
-
// The newest search's slot: skeleton tiles while it runs, else its references, or the line that it found none.
|
|
180
|
-
if (state.insp.searching) { box.appendChild(skeletonSection()); any = true; }
|
|
181
|
-
else if (search && search.referenceIds.length === 0 && state.insp.noMatch === search.searchId) { box.appendChild(el("div", "placeholder", COPY.inspirationNoMatches)); any = true; }
|
|
182
|
-
else if (search && search.referenceIds.length > 0) { box.appendChild(refSection("", "", search.referenceIds)); any = true; }
|
|
183
|
-
v.rounds.slice().sort(function (a, b) { return b.index - a.index; }).forEach(function (round) {
|
|
184
|
-
if (round.referenceIds.length === 0) return;
|
|
185
|
-
box.appendChild(refSection(COPY.roundPrefix + round.index, roundTitle(round), round.referenceIds));
|
|
186
|
-
any = true;
|
|
187
|
-
});
|
|
188
|
-
if (!any) box.appendChild(el("div", "placeholder", COPY.inspirationEmpty));
|
|
189
|
-
}
|
|
190
|
-
function buildInspirationShell(pane, where) {
|
|
191
|
-
pane.__built = true;
|
|
192
|
-
pane.classList.add("insp", where);
|
|
193
|
-
var row = el("div", "searchrow");
|
|
194
|
-
var input = el("input");
|
|
195
|
-
input.type = "text";
|
|
196
|
-
input.className = "query";
|
|
197
|
-
input.autocomplete = "off";
|
|
198
|
-
input.placeholder = COPY.inspirationPlaceholder;
|
|
199
|
-
input.setAttribute("aria-label", COPY.inspirationLabel);
|
|
200
|
-
input.value = state.query;
|
|
201
|
-
input.addEventListener("input", function () {
|
|
202
|
-
state.query = input.value;
|
|
203
|
-
var panes = document.querySelectorAll(".insp");
|
|
204
|
-
for (var i = 0; i < panes.length; i++) syncSearchButton(panes[i]);
|
|
205
|
-
});
|
|
206
|
-
input.addEventListener("keydown", function (e) { if (e.key === "Enter") doSearch(); });
|
|
207
|
-
var search = button(COPY.search, "primary", doSearch);
|
|
208
|
-
row.appendChild(input);
|
|
209
|
-
row.appendChild(search);
|
|
210
|
-
var status = el("div", "status");
|
|
211
|
-
status.setAttribute("data-istatus", "");
|
|
212
|
-
status.setAttribute("role", "status");
|
|
213
|
-
status.setAttribute("aria-live", "polite");
|
|
214
|
-
if (state.inspMsg) { status.textContent = state.inspMsg.text; if (state.inspMsg.kind) status.className = "status " + state.inspMsg.kind; }
|
|
215
|
-
pane.__input = input;
|
|
216
|
-
pane.__search = search;
|
|
217
|
-
pane.__results = el("div", "results");
|
|
218
|
-
pane.appendChild(row);
|
|
219
|
-
pane.appendChild(status);
|
|
220
|
-
pane.appendChild(pane.__results);
|
|
221
|
-
}
|
|
222
|
-
function renderInspiration(pane, where) {
|
|
223
|
-
if (!state.view) return;
|
|
224
|
-
if (!pane.__built) buildInspirationShell(pane, where);
|
|
225
|
-
syncSearchButton(pane);
|
|
262
|
+
// Opening the tab shows the newest round's words with their results: when the record has none, it asks once.
|
|
263
|
+
function autoSearch() {
|
|
226
264
|
var v = state.view;
|
|
227
|
-
var
|
|
228
|
-
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
var
|
|
233
|
-
|
|
265
|
+
var i = state.insp;
|
|
266
|
+
if (!v || !v.runDir || i.searching || i.typed || !visible()) return;
|
|
267
|
+
var words = roundWords();
|
|
268
|
+
var q = words ? searchable(words.query) : "";
|
|
269
|
+
if (!q || findSearch(q)) return;
|
|
270
|
+
var key = v.runDir + "\n" + norm(q);
|
|
271
|
+
if (i.auto[key]) return;
|
|
272
|
+
i.auto[key] = true;
|
|
273
|
+
runSearch(q);
|
|
234
274
|
}
|
|
235
275
|
`;
|
|
276
|
+
export const SLATE_UI_INSPIRATION = `${SEARCH_AND_SELECTION}\n${SLATE_UI_INSPIRATION_COLLAGE}\n${SLATE_UI_INSPIRATION_GRID}`;
|
|
236
277
|
//# sourceMappingURL=mcp-slate-ui-script-inspiration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-inspiration.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inspiration.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAEtF;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,uBAAuB,CAAC;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;;uBAEhB,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC;sBAC/C,IAAI,CAAC,SAAS,CAAC,6BAA6B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyOlE,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,oBAAoB,KAAK,4BAA4B,KAAK,yBAAyB,EAAE,CAAC"}
|