@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,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The person's language: which locale the screen speaks, and every word it shows, through `t(key, values)`.
|
|
3
|
+
*
|
|
4
|
+
* Where the locale comes from, first answer wins (each value must be a valid BCP 47 tag, else the next is asked):
|
|
5
|
+
* 1. `hostContext.locale` (MCP Apps), from `ui/initialize` and every `host-context-changed`;
|
|
6
|
+
* 2. `window.openai.locale` (the ChatGPT and Codex compatibility global);
|
|
7
|
+
* 3. the document's own `lang` as the host left it before this script ran (the screen's markup carries none, so a
|
|
8
|
+
* value there is the host's: Codex sets it on the app's document before writing the screen into it);
|
|
9
|
+
* 4. the `locale` parameter of the frame's address (Codex's sandbox page carries it, and the app's document shares
|
|
10
|
+
* that address);
|
|
11
|
+
* 5. `navigator.language` (in Codex the app's Accept-Language, not its UI language, so it comes last);
|
|
12
|
+
* 6. English.
|
|
13
|
+
*
|
|
14
|
+
* Read from Codex Desktop's own sandbox code on 2026-10-01: 1 to 4 all carry the Codex UI locale there (the shell
|
|
15
|
+
* builds `hostContext.locale`, sets `window.openai` and `lang` on the app's document from its address's `locale`, then
|
|
16
|
+
* writes the screen into that document). A tag maps to the closest shipped locale by language and script (zh-HK to Traditional, es-MX to
|
|
17
|
+
* Latin American Spanish, pt-PT to Brazilian Portuguese); a language that is not shipped is English, the source.
|
|
18
|
+
* `en-XA` is the pseudo-locale of the layout tests: English with every letter accented, bracketed and lengthened.
|
|
19
|
+
*
|
|
20
|
+
* Every catalogue ships in the document (no network under the host's policy). English stays baked in the static
|
|
21
|
+
* markup, so the first paint is never blank; `applyLocale` re-words it, and the view is drawn in the person's language
|
|
22
|
+
* from its first render. A locale that changes later (a host-context change) re-draws everything.
|
|
23
|
+
*
|
|
24
|
+
* Fragment of the view's script; String.raw, no backtick, no dollar-brace.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SLATE_UI_L10N: string;
|
|
27
|
+
/** The fragment with its catalogues and the embedded ICU functions in place. */
|
|
28
|
+
export declare const buildSlateUiL10n: (messages: Record<string, Record<string, string>>) => string;
|
|
29
|
+
//# sourceMappingURL=mcp-slate-ui-script-l10n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-l10n.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-l10n.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa,QAmGzB,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAG,MAKjB,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { formatIcu, parseIcu, pseudoIcu } from './mcp-slate-ui-icu.js';
|
|
2
|
+
import { matchShippedLocale } from './mcp-slate-ui-locale-match.js';
|
|
3
|
+
/**
|
|
4
|
+
* The person's language: which locale the screen speaks, and every word it shows, through `t(key, values)`.
|
|
5
|
+
*
|
|
6
|
+
* Where the locale comes from, first answer wins (each value must be a valid BCP 47 tag, else the next is asked):
|
|
7
|
+
* 1. `hostContext.locale` (MCP Apps), from `ui/initialize` and every `host-context-changed`;
|
|
8
|
+
* 2. `window.openai.locale` (the ChatGPT and Codex compatibility global);
|
|
9
|
+
* 3. the document's own `lang` as the host left it before this script ran (the screen's markup carries none, so a
|
|
10
|
+
* value there is the host's: Codex sets it on the app's document before writing the screen into it);
|
|
11
|
+
* 4. the `locale` parameter of the frame's address (Codex's sandbox page carries it, and the app's document shares
|
|
12
|
+
* that address);
|
|
13
|
+
* 5. `navigator.language` (in Codex the app's Accept-Language, not its UI language, so it comes last);
|
|
14
|
+
* 6. English.
|
|
15
|
+
*
|
|
16
|
+
* Read from Codex Desktop's own sandbox code on 2026-10-01: 1 to 4 all carry the Codex UI locale there (the shell
|
|
17
|
+
* builds `hostContext.locale`, sets `window.openai` and `lang` on the app's document from its address's `locale`, then
|
|
18
|
+
* writes the screen into that document). A tag maps to the closest shipped locale by language and script (zh-HK to Traditional, es-MX to
|
|
19
|
+
* Latin American Spanish, pt-PT to Brazilian Portuguese); a language that is not shipped is English, the source.
|
|
20
|
+
* `en-XA` is the pseudo-locale of the layout tests: English with every letter accented, bracketed and lengthened.
|
|
21
|
+
*
|
|
22
|
+
* Every catalogue ships in the document (no network under the host's policy). English stays baked in the static
|
|
23
|
+
* markup, so the first paint is never blank; `applyLocale` re-words it, and the view is drawn in the person's language
|
|
24
|
+
* from its first render. A locale that changes later (a host-context change) re-draws everything.
|
|
25
|
+
*
|
|
26
|
+
* Fragment of the view's script; String.raw, no backtick, no dollar-brace.
|
|
27
|
+
*/
|
|
28
|
+
export const SLATE_UI_L10N = String.raw `
|
|
29
|
+
var MESSAGES = __MESSAGES__;
|
|
30
|
+
var parseIcu = (__PARSE_ICU__);
|
|
31
|
+
var formatIcu = (__FORMAT_ICU__);
|
|
32
|
+
var pseudoIcu = (__PSEUDO_ICU__);
|
|
33
|
+
var matchShippedLocale = (__MATCH_LOCALE__);
|
|
34
|
+
var PSEUDO_LOCALE = "en-XA";
|
|
35
|
+
var l10n = { tag: "", from: "", asked: "", hostLang: document.documentElement.getAttribute("lang") || "", parsed: {}, fmt: null, list: null };
|
|
36
|
+
|
|
37
|
+
function canonicalTag(value) {
|
|
38
|
+
if (typeof value !== "string" || !value.trim()) return null;
|
|
39
|
+
try { return Intl.getCanonicalLocales(value.trim().replace(/_/g, "-"))[0] || null; } catch (err) { return null; }
|
|
40
|
+
}
|
|
41
|
+
function frameLocale() {
|
|
42
|
+
try { return typeof location !== "undefined" && location.search ? new URLSearchParams(location.search).get("locale") : null; } catch (err) { return null; }
|
|
43
|
+
}
|
|
44
|
+
function localeChannels() {
|
|
45
|
+
var openai = typeof window.openai === "object" && window.openai ? window.openai.locale : null;
|
|
46
|
+
var nav = typeof navigator !== "undefined" && navigator ? ((navigator.languages && navigator.languages[0]) || navigator.language) : null;
|
|
47
|
+
return [["host", state.host.locale], ["openai", openai], ["lang", l10n.hostLang], ["url", frameLocale()], ["navigator", nav]];
|
|
48
|
+
}
|
|
49
|
+
function resolveLocale() {
|
|
50
|
+
var channels = localeChannels();
|
|
51
|
+
for (var i = 0; i < channels.length; i++) {
|
|
52
|
+
var tag = canonicalTag(channels[i][1]);
|
|
53
|
+
if (tag) return { tag: matchShippedLocale(tag, Object.keys(MESSAGES)), from: channels[i][0], asked: tag };
|
|
54
|
+
}
|
|
55
|
+
return { tag: "en", from: "default", asked: "" };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ---- words ----
|
|
59
|
+
function hasMessage(key) { return Object.prototype.hasOwnProperty.call(MESSAGES.en, key); }
|
|
60
|
+
function t(key, values) {
|
|
61
|
+
var nodes = l10n.parsed[key];
|
|
62
|
+
if (!nodes) {
|
|
63
|
+
if (!hasMessage(key)) throw new Error("the catalogue has no message " + key);
|
|
64
|
+
var own = MESSAGES[l10n.tag];
|
|
65
|
+
var source = own && Object.prototype.hasOwnProperty.call(own, key) ? own[key] : MESSAGES.en[key];
|
|
66
|
+
nodes = parseIcu(source);
|
|
67
|
+
if (l10n.tag === PSEUDO_LOCALE) nodes = pseudoIcu(nodes);
|
|
68
|
+
l10n.parsed[key] = nodes;
|
|
69
|
+
}
|
|
70
|
+
return formatIcu(nodes, values || {}, l10n.fmt);
|
|
71
|
+
}
|
|
72
|
+
// A server's sentence in the person's language: its code's message with its values, or "" when the catalogue has no
|
|
73
|
+
// words for the code (or for a sentence inside its values), and the caller shows the server's own English instead.
|
|
74
|
+
function said(ref) {
|
|
75
|
+
if (!ref || typeof ref.code !== "string" || !hasMessage("server." + ref.code)) return "";
|
|
76
|
+
var values = {};
|
|
77
|
+
var params = ref.params || {};
|
|
78
|
+
for (var name in params) {
|
|
79
|
+
if (!Object.prototype.hasOwnProperty.call(params, name)) continue;
|
|
80
|
+
var value = params[name];
|
|
81
|
+
if (value && typeof value === "object") { value = said(value); if (!value) return ""; }
|
|
82
|
+
values[name] = value;
|
|
83
|
+
}
|
|
84
|
+
return t("server." + ref.code, values);
|
|
85
|
+
}
|
|
86
|
+
// Items joined as the person's language lists them ("A, B and C").
|
|
87
|
+
function listOf(items) { return l10n.list.format(items.map(String)); }
|
|
88
|
+
// Two whole sentences on one line, spaced as the language spaces them.
|
|
89
|
+
function sentences(first, second) { return first && second ? t("sentenceJoin", { first: first, second: second }) : first || second || ""; }
|
|
90
|
+
|
|
91
|
+
// ---- the static markup: data-l10n (words), data-l10n-aria (accessible name), data-l10n-label (name and tooltip) ----
|
|
92
|
+
function localizeStatic(root) {
|
|
93
|
+
var words = root.querySelectorAll("[data-l10n]");
|
|
94
|
+
for (var i = 0; i < words.length; i++) words[i].textContent = t(words[i].getAttribute("data-l10n"));
|
|
95
|
+
var named = root.querySelectorAll("[data-l10n-aria]");
|
|
96
|
+
for (var j = 0; j < named.length; j++) named[j].setAttribute("aria-label", t(named[j].getAttribute("data-l10n-aria")));
|
|
97
|
+
var labelled = root.querySelectorAll("[data-l10n-label]");
|
|
98
|
+
for (var k = 0; k < labelled.length; k++) {
|
|
99
|
+
var label = t(labelled[k].getAttribute("data-l10n-label"));
|
|
100
|
+
labelled[k].setAttribute("aria-label", label);
|
|
101
|
+
labelled[k].setAttribute("title", label);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Applies the locale the channels name now. Returns true when it changed.
|
|
106
|
+
function applyLocale() {
|
|
107
|
+
var found = resolveLocale();
|
|
108
|
+
// Which channel decided, for the tests and for anyone inspecting a host: the host can confirm the language the
|
|
109
|
+
// screen already speaks (English from the browser, then English from the host), and that is news too.
|
|
110
|
+
l10n.from = found.from;
|
|
111
|
+
l10n.asked = found.asked;
|
|
112
|
+
document.documentElement.setAttribute("data-locale-from", found.from);
|
|
113
|
+
if (found.tag === l10n.tag) return false;
|
|
114
|
+
var intlTag = found.tag === PSEUDO_LOCALE ? "en" : found.tag;
|
|
115
|
+
var rules = new Intl.PluralRules(intlTag);
|
|
116
|
+
var numbers = new Intl.NumberFormat(intlTag);
|
|
117
|
+
l10n.tag = found.tag;
|
|
118
|
+
l10n.parsed = {};
|
|
119
|
+
l10n.fmt = { plural: function (n) { return rules.select(n); }, number: function (n) { return numbers.format(n); } };
|
|
120
|
+
l10n.list = new Intl.ListFormat(intlTag, { style: "long", type: "conjunction" });
|
|
121
|
+
document.documentElement.setAttribute("lang", found.tag);
|
|
122
|
+
document.title = t("title");
|
|
123
|
+
localizeStatic(document);
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
applyLocale();
|
|
127
|
+
`;
|
|
128
|
+
/** The fragment with its catalogues and the embedded ICU functions in place. */
|
|
129
|
+
export const buildSlateUiL10n = (messages) => SLATE_UI_L10N
|
|
130
|
+
.replace('__MESSAGES__', () => JSON.stringify(messages))
|
|
131
|
+
.replace('__PARSE_ICU__', () => parseIcu.toString())
|
|
132
|
+
.replace('__FORMAT_ICU__', () => formatIcu.toString())
|
|
133
|
+
.replace('__PSEUDO_ICU__', () => pseudoIcu.toString())
|
|
134
|
+
.replace('__MATCH_LOCALE__', () => matchShippedLocale.toString());
|
|
135
|
+
//# sourceMappingURL=mcp-slate-ui-script-l10n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-l10n.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-l10n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGtC,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAgD,EAAU,EAAE,CAAC,aAAa;KACxG,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;KACvD,OAAO,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;KACnD,OAAO,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;KACrD,OAAO,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;KACrD,OAAO,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate more: the last tile of the thumbnails (the card's strip, the
|
|
3
3
|
* workspace's selection) and the panel it opens directly below them. The tile
|
|
4
|
-
* is a dashed, thumbnail-sized box with a plus and the words Generate more,
|
|
4
|
+
* is a dashed, thumbnail-sized box with a plus and the words Generate more, the last tile of thumbnails that wrap
|
|
5
|
+
* rather than scroll sideways, so it is always in view; the
|
|
5
6
|
* panel is the only way to start a round, and it says what it will do:
|
|
6
7
|
*
|
|
7
8
|
* - a heading and one helper line that follows the state (fresh references,
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
* - the selected inspiration as small chips, each with a remove button that is
|
|
13
14
|
* the same selection write as the Inspiration tab's toggle (adding is done
|
|
14
15
|
* in that tab);
|
|
15
|
-
* - an optional note, how many (1, 2, 4, 8 or 12, default
|
|
16
|
+
* - an optional note, how many (1, 2, 4, 6, 8 or 12, default 6) and Cancel and
|
|
16
17
|
* Generate.
|
|
17
18
|
*
|
|
18
19
|
* Clicking the tile again, Cancel or Escape collapses it. While a round runs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-more.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-more.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-more.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-more.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,aAAa,QAiQzB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate more: the last tile of the thumbnails (the card's strip, the
|
|
3
3
|
* workspace's selection) and the panel it opens directly below them. The tile
|
|
4
|
-
* is a dashed, thumbnail-sized box with a plus and the words Generate more,
|
|
4
|
+
* is a dashed, thumbnail-sized box with a plus and the words Generate more, the last tile of thumbnails that wrap
|
|
5
|
+
* rather than scroll sideways, so it is always in view; the
|
|
5
6
|
* panel is the only way to start a round, and it says what it will do:
|
|
6
7
|
*
|
|
7
8
|
* - a heading and one helper line that follows the state (fresh references,
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
* - the selected inspiration as small chips, each with a remove button that is
|
|
13
14
|
* the same selection write as the Inspiration tab's toggle (adding is done
|
|
14
15
|
* in that tab);
|
|
15
|
-
* - an optional note, how many (1, 2, 4, 8 or 12, default
|
|
16
|
+
* - an optional note, how many (1, 2, 4, 6, 8 or 12, default 6) and Cancel and
|
|
16
17
|
* Generate.
|
|
17
18
|
*
|
|
18
19
|
* Clicking the tile again, Cancel or Escape collapses it. While a round runs
|
|
@@ -40,12 +41,12 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
40
41
|
// One tile per row of thumbnails; the strip and the selection each build their own.
|
|
41
42
|
function moreTile() {
|
|
42
43
|
var b = button("", "moretile", toggleMore);
|
|
43
|
-
b.setAttribute("aria-label",
|
|
44
|
+
b.setAttribute("aria-label", t("generateMore"));
|
|
44
45
|
b.setAttribute("aria-expanded", "false");
|
|
45
46
|
b.setAttribute("aria-controls", "morepanel");
|
|
46
|
-
b.title =
|
|
47
|
+
b.title = t("generateMore");
|
|
47
48
|
b.innerHTML = '<svg viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><path d="' + ICON_PLUS + '"/></svg>';
|
|
48
|
-
b.appendChild(el("span", "",
|
|
49
|
+
b.appendChild(el("span", "", t("generateMore")));
|
|
49
50
|
return b;
|
|
50
51
|
}
|
|
51
52
|
function moreTiles() { return Array.prototype.slice.call(document.querySelectorAll(".moretile")); }
|
|
@@ -112,7 +113,7 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
112
113
|
var box = el("div", "morepanel");
|
|
113
114
|
box.id = "morepanel";
|
|
114
115
|
box.setAttribute("role", "group");
|
|
115
|
-
var title = el("h2", "morehead",
|
|
116
|
+
var title = el("h2", "morehead", t("generateMore"));
|
|
116
117
|
title.id = "morehead";
|
|
117
118
|
box.setAttribute("aria-labelledby", "morehead");
|
|
118
119
|
box.appendChild(title);
|
|
@@ -135,7 +136,7 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
135
136
|
|
|
136
137
|
// The inspiration that is selected, read back from the view; removing one is the tab's own selection write.
|
|
137
138
|
m.els.chipsWrap = el("div", "morechips hidden");
|
|
138
|
-
m.els.chipsWrap.appendChild(el("span", "lbl",
|
|
139
|
+
m.els.chipsWrap.appendChild(el("span", "lbl", t("moreInspirationLabel")));
|
|
139
140
|
m.els.chips = el("div", "refchips");
|
|
140
141
|
m.els.chipsWrap.appendChild(m.els.chips);
|
|
141
142
|
box.appendChild(m.els.chipsWrap);
|
|
@@ -143,14 +144,14 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
143
144
|
var note = el("textarea");
|
|
144
145
|
note.setAttribute("rows", "2");
|
|
145
146
|
note.setAttribute("maxlength", "600");
|
|
146
|
-
note.setAttribute("placeholder",
|
|
147
|
-
note.setAttribute("aria-label",
|
|
147
|
+
note.setAttribute("placeholder", t("moreNotePlaceholder"));
|
|
148
|
+
note.setAttribute("aria-label", t("moreNotePlaceholder"));
|
|
148
149
|
note.addEventListener("input", function () { m.note = note.value; });
|
|
149
150
|
box.appendChild(note);
|
|
150
151
|
var row = el("div", "morerow");
|
|
151
152
|
var seg = el("div", "seg");
|
|
152
153
|
seg.setAttribute("role", "radiogroup");
|
|
153
|
-
seg.setAttribute("aria-label",
|
|
154
|
+
seg.setAttribute("aria-label", t("moreCountLabel"));
|
|
154
155
|
MORE.choices.forEach(function (n) {
|
|
155
156
|
var option = el("label", "segopt");
|
|
156
157
|
var input = el("input");
|
|
@@ -166,8 +167,8 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
166
167
|
row.appendChild(seg);
|
|
167
168
|
// Cancel and Generate stay together: on a narrow card they drop to the next line as a pair, at the right.
|
|
168
169
|
var buttons = el("span", "morebtns");
|
|
169
|
-
buttons.appendChild(button(
|
|
170
|
-
m.els.primary = button(
|
|
170
|
+
buttons.appendChild(button(t("cancel"), "", function () { closeMore(true); }));
|
|
171
|
+
m.els.primary = button(t("generate"), "primary", commitMore);
|
|
171
172
|
buttons.appendChild(m.els.primary);
|
|
172
173
|
row.appendChild(buttons);
|
|
173
174
|
box.appendChild(row);
|
|
@@ -185,9 +186,9 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
185
186
|
var selected = currentSelected().slice(0, MAX_SELECTED);
|
|
186
187
|
m.els.toggle.checked = likeOn;
|
|
187
188
|
m.els.toggle.disabled = !base || m.committing;
|
|
188
|
-
m.els.switchText.textContent =
|
|
189
|
-
m.els.switchText.parentNode.title = base ? "" :
|
|
190
|
-
m.els.help.textContent = likeOn ?
|
|
189
|
+
m.els.switchText.textContent = t("moreBasedOn", { label: base ? base.label : (selectedVersion() ? selectedVersion().label : "") });
|
|
190
|
+
m.els.switchText.parentNode.title = base ? "" : t("moreLikeUnavailable");
|
|
191
|
+
m.els.help.textContent = likeOn ? t("moreHelpLike", { label: base.label }) : selected.length > 0 ? t("moreHelpSelected") : t("moreHelpFresh");
|
|
191
192
|
var shown = base || selectedVersion();
|
|
192
193
|
var thumbSig = shown ? shown.versionId + ":" + shown.sha256 : "";
|
|
193
194
|
if (m.thumbSig !== thumbSig) {
|
|
@@ -213,8 +214,8 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
213
214
|
chip.appendChild(img);
|
|
214
215
|
bindReference(img, id, "thumb");
|
|
215
216
|
var remove = button("", "refchipx", function () { toggleRef(id); });
|
|
216
|
-
remove.setAttribute("aria-label",
|
|
217
|
-
remove.title =
|
|
217
|
+
remove.setAttribute("aria-label", t("removeReference", { name: refDescription(id) }));
|
|
218
|
+
remove.title = t("removeReference", { name: refDescription(id) });
|
|
218
219
|
remove.innerHTML = '<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>';
|
|
219
220
|
chip.appendChild(remove);
|
|
220
221
|
m.els.chips.appendChild(chip);
|
|
@@ -273,7 +274,7 @@ export const SLATE_UI_MORE = String.raw `
|
|
|
273
274
|
syncMoreBody(m);
|
|
274
275
|
var local = localImage();
|
|
275
276
|
m.els.primary.disabled = m.committing || busy || !local.ready;
|
|
276
|
-
m.els.alert.textContent = m.error || (!local.ready
|
|
277
|
+
m.els.alert.textContent = m.error || (!local.ready ? localReason() : "");
|
|
277
278
|
m.els.alert.classList.toggle("hidden", !m.els.alert.textContent);
|
|
278
279
|
// Fitted before the size report, so the host never sees the taller card.
|
|
279
280
|
fitMore();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-more.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-more.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-more.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-more.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiQtC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The inspiration pause (hosted server only; `rounds[].pause` in the view): a normal round waits for the person
|
|
3
|
+
* before it is drawn while this screen is in sight. The server owns every rule (workers/api/src/slate/store/pause.ts);
|
|
4
|
+
* this fragment shows the wait and sends the person's two answers.
|
|
5
|
+
*
|
|
6
|
+
* - The pause bar (in the card above the large image, in the workspace above the picture, and in the Inspiration tab
|
|
7
|
+
* in place of Generate) says "Starting in 42 s. Change any reference, or press Continue." and counts down calmly:
|
|
8
|
+
* the words change once a second (a timer role, so assistive technology is not told every second) and a thin line
|
|
9
|
+
* shortens with them, without animation when motion is reduced. Change opens the Inspiration tab; Continue goes on.
|
|
10
|
+
* - Each option of the round shows the reference it will be drawn from, on its tile and in the large image, instead
|
|
11
|
+
* of the drawing shimmer: nothing is being drawn yet.
|
|
12
|
+
* - Any touch of the screen (a press or click, a key, a wheel or touch scroll of the picker, focus in the search box)
|
|
13
|
+
* holds the round. A wheel or touch counts only inside the picker's scrolling lists (the Inspiration results, the
|
|
14
|
+
* workspace's selection): elsewhere, the inline card's large image say, it is the conversation being scrolled past
|
|
15
|
+
* the card, which must not hold a round nobody then sees. A hold stops the countdown for good and the bar says
|
|
16
|
+
* "Paused. Press Continue when ready." One hold is sent to the server. A scroll the page makes by itself (a grid
|
|
17
|
+
* laid out again) is not a touch, so `scroll` is not listened to; the person's scrolling arrives as a wheel, a touch
|
|
18
|
+
* or a key.
|
|
19
|
+
* - In the Inspiration tab the round's references are the round's own list until the person changes it: a tile there
|
|
20
|
+
* adds or removes a reference (at most one per option), and Continue sends the list when it differs, which the
|
|
21
|
+
* server gives the options in order.
|
|
22
|
+
* - A round that awaits a screen (`awaiting`, recorded before this screen existed) is seen at once with one status
|
|
23
|
+
* call, which starts its countdown on the server.
|
|
24
|
+
*
|
|
25
|
+
* Fragment of the view's script; String.raw, no backtick, no dollar-brace.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SLATE_UI_PAUSE: string;
|
|
28
|
+
/**
|
|
29
|
+
* The local plugin's and the browser page's screens: their views never carry `rounds[].pause` (only the hosted server
|
|
30
|
+
* pauses), so the same names answer that nothing waits, and the document does not carry the pause's code.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SLATE_UI_NO_PAUSE: string;
|
|
33
|
+
//# sourceMappingURL=mcp-slate-ui-script-pause.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-pause.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-pause.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,QA4K1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAY7B,CAAC"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The inspiration pause (hosted server only; `rounds[].pause` in the view): a normal round waits for the person
|
|
3
|
+
* before it is drawn while this screen is in sight. The server owns every rule (workers/api/src/slate/store/pause.ts);
|
|
4
|
+
* this fragment shows the wait and sends the person's two answers.
|
|
5
|
+
*
|
|
6
|
+
* - The pause bar (in the card above the large image, in the workspace above the picture, and in the Inspiration tab
|
|
7
|
+
* in place of Generate) says "Starting in 42 s. Change any reference, or press Continue." and counts down calmly:
|
|
8
|
+
* the words change once a second (a timer role, so assistive technology is not told every second) and a thin line
|
|
9
|
+
* shortens with them, without animation when motion is reduced. Change opens the Inspiration tab; Continue goes on.
|
|
10
|
+
* - Each option of the round shows the reference it will be drawn from, on its tile and in the large image, instead
|
|
11
|
+
* of the drawing shimmer: nothing is being drawn yet.
|
|
12
|
+
* - Any touch of the screen (a press or click, a key, a wheel or touch scroll of the picker, focus in the search box)
|
|
13
|
+
* holds the round. A wheel or touch counts only inside the picker's scrolling lists (the Inspiration results, the
|
|
14
|
+
* workspace's selection): elsewhere, the inline card's large image say, it is the conversation being scrolled past
|
|
15
|
+
* the card, which must not hold a round nobody then sees. A hold stops the countdown for good and the bar says
|
|
16
|
+
* "Paused. Press Continue when ready." One hold is sent to the server. A scroll the page makes by itself (a grid
|
|
17
|
+
* laid out again) is not a touch, so `scroll` is not listened to; the person's scrolling arrives as a wheel, a touch
|
|
18
|
+
* or a key.
|
|
19
|
+
* - In the Inspiration tab the round's references are the round's own list until the person changes it: a tile there
|
|
20
|
+
* adds or removes a reference (at most one per option), and Continue sends the list when it differs, which the
|
|
21
|
+
* server gives the options in order.
|
|
22
|
+
* - A round that awaits a screen (`awaiting`, recorded before this screen existed) is seen at once with one status
|
|
23
|
+
* call, which starts its countdown on the server.
|
|
24
|
+
*
|
|
25
|
+
* Fragment of the view's script; String.raw, no backtick, no dollar-brace.
|
|
26
|
+
*/
|
|
27
|
+
export const SLATE_UI_PAUSE = String.raw `
|
|
28
|
+
var PAUSE_COUNTDOWN_MS = 60000;
|
|
29
|
+
var PAUSE_TICK_MS = 1000;
|
|
30
|
+
var pause = { opId: null, roundId: null, endsAt: 0, held: false, chosen: null, sending: false, error: "", timer: null, asked: false, sighted: false };
|
|
31
|
+
function pauseClock() { return typeof performance !== "undefined" && performance.now ? performance.now() : Date.now(); }
|
|
32
|
+
|
|
33
|
+
function waitingRound() {
|
|
34
|
+
if (!state.view) return null;
|
|
35
|
+
var rounds = state.view.rounds.filter(function (r) { return !!r.pause; });
|
|
36
|
+
return rounds.length ? rounds[rounds.length - 1] : null;
|
|
37
|
+
}
|
|
38
|
+
function opOfRound(round) {
|
|
39
|
+
return state.view.ops.filter(function (o) { return o.kind === "round" && roundOfOp(o) === round && isRunning(o); })[0] || null;
|
|
40
|
+
}
|
|
41
|
+
function pauseActive() { return !!pause.opId; }
|
|
42
|
+
function pauseRound() { return pause.roundId ? roundById(pause.roundId) : null; }
|
|
43
|
+
|
|
44
|
+
function syncPause() {
|
|
45
|
+
var round = waitingRound();
|
|
46
|
+
var op = round && opOfRound(round);
|
|
47
|
+
if (!round || !op) { if (pause.opId) endPause(); return; }
|
|
48
|
+
if (pause.opId !== op.opId) {
|
|
49
|
+
endPause();
|
|
50
|
+
pause.opId = op.opId;
|
|
51
|
+
pause.roundId = round.roundId;
|
|
52
|
+
}
|
|
53
|
+
if (round.pause.state === "held") pause.held = true;
|
|
54
|
+
else if (!pause.held && round.pause.state === "countdown") { pause.endsAt = pauseClock() + round.pause.remainingMs; pause.asked = false; }
|
|
55
|
+
else if (!pause.held && round.pause.state === "awaiting") {
|
|
56
|
+
if (!pause.endsAt) pause.endsAt = pauseClock() + PAUSE_COUNTDOWN_MS;
|
|
57
|
+
if (!pause.sighted) { pause.sighted = true; setTimeout(refreshOnce, 0); }
|
|
58
|
+
}
|
|
59
|
+
if (pause.timer === null) pause.timer = setInterval(tickPause, PAUSE_TICK_MS);
|
|
60
|
+
}
|
|
61
|
+
function endPause() {
|
|
62
|
+
if (pause.timer !== null) clearInterval(pause.timer);
|
|
63
|
+
pause = { opId: null, roundId: null, endsAt: 0, held: false, chosen: null, sending: false, error: "", timer: null, asked: false, sighted: false };
|
|
64
|
+
}
|
|
65
|
+
function pauseLeftMs() { return Math.max(0, pause.endsAt - pauseClock()); }
|
|
66
|
+
function pauseText() {
|
|
67
|
+
if (pause.error) return pause.error;
|
|
68
|
+
if (pause.sending) return t("pauseStarting");
|
|
69
|
+
if (pause.held) return t("pauseHeld");
|
|
70
|
+
var left = Math.ceil(pauseLeftMs() / 1000);
|
|
71
|
+
return left > 0 ? t("pauseCountdown", { n: left }) : t("pauseStarting");
|
|
72
|
+
}
|
|
73
|
+
function tickPause() {
|
|
74
|
+
if (!pause.opId) return;
|
|
75
|
+
syncPauseBars();
|
|
76
|
+
if (!pause.held && !pause.asked && pauseLeftMs() <= 0) { pause.asked = true; refreshOnce(); }
|
|
77
|
+
}
|
|
78
|
+
function syncPauseBars() {
|
|
79
|
+
var words = pauseText();
|
|
80
|
+
var share = pause.held ? 0 : pauseLeftMs() / PAUSE_COUNTDOWN_MS;
|
|
81
|
+
var nodes = document.querySelectorAll("[data-pause-text]");
|
|
82
|
+
for (var i = 0; i < nodes.length; i++) if (nodes[i].textContent !== words) nodes[i].textContent = words;
|
|
83
|
+
var lines = document.querySelectorAll(".pauseline > span");
|
|
84
|
+
for (var j = 0; j < lines.length; j++) lines[j].style.transform = "scaleX(" + (Math.round(share * 1000) / 1000) + ")";
|
|
85
|
+
var lineBoxes = document.querySelectorAll(".pauseline");
|
|
86
|
+
for (var k = 0; k < lineBoxes.length; k++) lineBoxes[k].classList.toggle("hidden", pause.held || pause.sending);
|
|
87
|
+
var goes = document.querySelectorAll("[data-continue]");
|
|
88
|
+
for (var m = 0; m < goes.length; m++) goes[m].disabled = pause.sending || pauseChosen().length === 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function pauseChosen() {
|
|
92
|
+
if (pause.chosen) return pause.chosen;
|
|
93
|
+
var round = pauseRound();
|
|
94
|
+
return round ? round.referenceIds.slice() : [];
|
|
95
|
+
}
|
|
96
|
+
function sameList(a, b) { return a.length === b.length && a.every(function (id, i) { return b[i] === id; }); }
|
|
97
|
+
function pauseChanged() { var round = pauseRound(); return !!pause.chosen && !!round && !sameList(pause.chosen, round.referenceIds); }
|
|
98
|
+
function togglePauseRef(id) {
|
|
99
|
+
var round = pauseRound();
|
|
100
|
+
if (!round) return;
|
|
101
|
+
var cur = pauseChosen().slice();
|
|
102
|
+
var at = cur.indexOf(id);
|
|
103
|
+
if (at >= 0) cur.splice(at, 1);
|
|
104
|
+
else {
|
|
105
|
+
if (cur.length >= round.count) { setInspStatus(t("pauseAtMost", { n: round.count }), ""); return; }
|
|
106
|
+
cur.push(id);
|
|
107
|
+
}
|
|
108
|
+
setInspStatus(cur.length === 0 ? t("pauseNone") : "", "");
|
|
109
|
+
pause.chosen = cur;
|
|
110
|
+
renderAll();
|
|
111
|
+
}
|
|
112
|
+
function pausedFor(c) { return pauseActive() && c.roundId === pause.roundId && c.state === "pending"; }
|
|
113
|
+
function pausedRef(c) {
|
|
114
|
+
if (!pausedFor(c)) return null;
|
|
115
|
+
if (!pause.chosen) return c.referenceId || null;
|
|
116
|
+
var own = state.view.candidates.filter(function (x) { return x.roundId === c.roundId; }).sort(byLabel);
|
|
117
|
+
var chosen = pause.chosen;
|
|
118
|
+
return chosen.length ? chosen[own.indexOf(c) % chosen.length] : null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function holdPause() {
|
|
122
|
+
if (!pause.opId || pause.held || pause.sending) return;
|
|
123
|
+
pause.held = true;
|
|
124
|
+
syncPauseBars();
|
|
125
|
+
callTool(TOOLS.run, { runDir: state.view.runDir, opId: pause.opId, action: { kind: "hold" } }).then(function (result) {
|
|
126
|
+
var sc = result.structuredContent || {};
|
|
127
|
+
if (sc.view) applyView(sc.view, true);
|
|
128
|
+
}, function (err) { setStatus(errText(err), "err"); });
|
|
129
|
+
}
|
|
130
|
+
function continuePause() {
|
|
131
|
+
if (!pause.opId || pause.sending || pauseChosen().length === 0) return;
|
|
132
|
+
var action = { kind: "continue" };
|
|
133
|
+
if (pauseChanged()) action.referenceIds = pause.chosen.slice();
|
|
134
|
+
pause.sending = true;
|
|
135
|
+
pause.error = "";
|
|
136
|
+
syncPauseBars();
|
|
137
|
+
callTool(TOOLS.run, { runDir: state.view.runDir, opId: pause.opId, action: action }).then(function (result) {
|
|
138
|
+
var sc = result.structuredContent || {};
|
|
139
|
+
if (sc.view) applyView(sc.view, true);
|
|
140
|
+
}, function (err) {
|
|
141
|
+
pause.sending = false;
|
|
142
|
+
pause.error = errText(err);
|
|
143
|
+
syncPauseBars();
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// A wheel or a touch counts only where it scrolls the picker: the Inspiration results and the workspace's
|
|
147
|
+
// selection. Anywhere else (the card's large image, say) it is the person scrolling the conversation past the card.
|
|
148
|
+
var PICKER_SCROLLERS = ".results, .rail";
|
|
149
|
+
function onScreenTouch(e) {
|
|
150
|
+
if (!pause.opId || pause.held || pause.sending) return;
|
|
151
|
+
var t = e.target;
|
|
152
|
+
var inside = function (css) { return !!(t && t.closest && t.closest(css)); };
|
|
153
|
+
if (inside("[data-continue]")) return;
|
|
154
|
+
if (e.type === "focusin" && !(t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA"))) return;
|
|
155
|
+
if ((e.type === "wheel" || e.type === "touchstart") && !inside(PICKER_SCROLLERS)) return;
|
|
156
|
+
holdPause();
|
|
157
|
+
}
|
|
158
|
+
["pointerdown", "click", "keydown", "wheel", "touchstart", "focusin"].forEach(function (type) {
|
|
159
|
+
document.addEventListener(type, onScreenTouch, true);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
function pauseBar(withChange) {
|
|
163
|
+
var bar = el("div", "pausebox");
|
|
164
|
+
bar.setAttribute("role", "group");
|
|
165
|
+
bar.setAttribute("aria-label", t("pauseLabel"));
|
|
166
|
+
var words = el("p", "pausetext", pauseText());
|
|
167
|
+
words.setAttribute("data-pause-text", "");
|
|
168
|
+
words.setAttribute("role", "timer");
|
|
169
|
+
bar.appendChild(words);
|
|
170
|
+
var actions = el("span", "pausebtns");
|
|
171
|
+
if (withChange) actions.appendChild(button(t("change"), "", function () { setTab("inspiration"); }));
|
|
172
|
+
var go = button(t("continueRound"), "primary", continuePause);
|
|
173
|
+
go.setAttribute("data-continue", "");
|
|
174
|
+
actions.appendChild(go);
|
|
175
|
+
bar.appendChild(actions);
|
|
176
|
+
var line = el("span", "pauseline");
|
|
177
|
+
line.setAttribute("aria-hidden", "true");
|
|
178
|
+
line.appendChild(el("span"));
|
|
179
|
+
bar.appendChild(line);
|
|
180
|
+
return bar;
|
|
181
|
+
}
|
|
182
|
+
function syncPauseHost(host, withChange) {
|
|
183
|
+
if (!host) return;
|
|
184
|
+
var sig = pause.opId ? pause.opId + (withChange ? ":change" : "") : "";
|
|
185
|
+
host.classList.toggle("hidden", !pause.opId);
|
|
186
|
+
if (host.__pause !== sig) {
|
|
187
|
+
host.__pause = sig;
|
|
188
|
+
host.textContent = "";
|
|
189
|
+
if (pause.opId) host.appendChild(pauseBar(withChange));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function pauseChoiceText() {
|
|
193
|
+
var round = pauseRound();
|
|
194
|
+
var chosen = pauseChosen();
|
|
195
|
+
if (!round) return "";
|
|
196
|
+
if (chosen.length === 0) return t("pauseNone");
|
|
197
|
+
return t("pauseFrom", { n: round.count, m: chosen.length });
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
/**
|
|
201
|
+
* The local plugin's and the browser page's screens: their views never carry `rounds[].pause` (only the hosted server
|
|
202
|
+
* pauses), so the same names answer that nothing waits, and the document does not carry the pause's code.
|
|
203
|
+
*/
|
|
204
|
+
export const SLATE_UI_NO_PAUSE = String.raw `
|
|
205
|
+
var pause = { opId: null };
|
|
206
|
+
function pauseActive() { return false; }
|
|
207
|
+
function pauseRound() { return null; }
|
|
208
|
+
function pauseChosen() { return []; }
|
|
209
|
+
function pausedFor() { return false; }
|
|
210
|
+
function pausedRef() { return null; }
|
|
211
|
+
function togglePauseRef() {}
|
|
212
|
+
function syncPause() {}
|
|
213
|
+
function syncPauseBars() {}
|
|
214
|
+
function syncPauseHost(host) { if (host) host.classList.add("hidden"); }
|
|
215
|
+
function pauseChoiceText() { return ""; }
|
|
216
|
+
`;
|
|
217
|
+
//# sourceMappingURL=mcp-slate-ui-script-pause.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-pause.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-pause.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4KvC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;CAY1C,CAAC"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The messages. The host wraps every app message as untrusted input, so each one
|
|
6
6
|
* names what happened and carries no command, flag, path, price or credit word;
|
|
7
|
+
* a Generate more or Edit click that the workspace runner on the person's Mac
|
|
8
|
+
* will draw sends none (remoteAfterRun);
|
|
7
9
|
* the agent confirms through the model-visible data tool, which returns the
|
|
8
10
|
* server's own trusted text. Six messages exist, one per click (spec v2 9.2):
|
|
9
11
|
* Generate more with new options, Generate more based on a design, Edit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-remote.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-remote.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-remote.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,eAAe,QA8J3B,CAAC"}
|