@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
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* Nothing here shows or asks for money.
|
|
19
19
|
*/
|
|
20
20
|
export const SLATE_UI_DIALOG = String.raw `
|
|
21
|
-
|
|
22
|
-
var
|
|
21
|
+
// Catalogue keys: the dialog's title is its button's verb, and its primary says what confirming does.
|
|
22
|
+
var DIALOG_TITLES = { edit: "edit", branch: "branch", convert: "convert" };
|
|
23
|
+
var DIALOG_VERBS = { edit: "apply", branch: "send", convert: "send" };
|
|
23
24
|
|
|
24
25
|
function field(labelText, control, id) {
|
|
25
26
|
var wrap = el("div", "field");
|
|
@@ -66,8 +67,35 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
66
67
|
return row;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
// ---- the edit instruction, counted as the servers count it: UTF-8 bytes of the words, control characters stripped ----
|
|
71
|
+
var EDIT_PROMPT_MAX_BYTES = __EDIT_PROMPT_MAX_BYTES__;
|
|
72
|
+
function editWords(text) { return String(text || "").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, "").trim(); }
|
|
73
|
+
function utf8Bytes(text) {
|
|
74
|
+
var n = 0;
|
|
75
|
+
for (var i = 0; i < text.length; i++) {
|
|
76
|
+
var c = text.charCodeAt(i);
|
|
77
|
+
if (c < 0x80) n += 1;
|
|
78
|
+
else if (c < 0x800) n += 2;
|
|
79
|
+
else if (c >= 0xd800 && c <= 0xdbff && i + 1 < text.length && text.charCodeAt(i + 1) >= 0xdc00 && text.charCodeAt(i + 1) <= 0xdfff) { n += 4; i++; }
|
|
80
|
+
else n += 3;
|
|
81
|
+
}
|
|
82
|
+
return n;
|
|
83
|
+
}
|
|
84
|
+
// How many characters must go from the end of the instruction for it to fit; 0 when it fits.
|
|
85
|
+
function editOverBy(text) {
|
|
86
|
+
var words = editWords(text);
|
|
87
|
+
var over = utf8Bytes(words) - EDIT_PROMPT_MAX_BYTES;
|
|
88
|
+
if (over <= 0) return 0;
|
|
89
|
+
var chars = Array.from(words);
|
|
90
|
+
var cut = 0;
|
|
91
|
+
while (over > 0 && chars.length > 0) { over -= utf8Bytes(chars.pop()); cut++; }
|
|
92
|
+
return cut;
|
|
93
|
+
}
|
|
94
|
+
|
|
69
95
|
// ---- what this Mac can do now ----
|
|
70
96
|
function localImage() { return (state.view && state.view.local && state.view.local.image) || { ready: false, reason: null }; }
|
|
97
|
+
// Why this Mac cannot draw, in the person's language when the server named it by code.
|
|
98
|
+
function localReason() { var local = localImage(); return serverText(local.reasonL10n, local.reason); }
|
|
71
99
|
|
|
72
100
|
// ---- open and close ----
|
|
73
101
|
function openDialog(kind, opener) {
|
|
@@ -108,7 +136,7 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
108
136
|
return compositeMarked(version, d.strokes).then(function (marked) {
|
|
109
137
|
action.annotated = marked;
|
|
110
138
|
return action;
|
|
111
|
-
}, function (err) { throw new Error(
|
|
139
|
+
}, function (err) { throw new Error(t("markFailed", { detail: errText(err) })); });
|
|
112
140
|
}
|
|
113
141
|
function convertChoice(d) { return CONVERT.choices.filter(function (c) { return c.value === d.format; })[0]; }
|
|
114
142
|
// An empty width is fine (the service picks); anything else must be a whole number the CLI accepts.
|
|
@@ -133,7 +161,7 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
133
161
|
function dialogReady(d) {
|
|
134
162
|
var v = ver(d.versionId);
|
|
135
163
|
// An edit needs a drawing, words or both; Branch has no required field.
|
|
136
|
-
if (d.kind === "edit") return localImage().ready && !!v && v.editable && (d.strokes.length > 0 || !!d.prompt.trim());
|
|
164
|
+
if (d.kind === "edit") return localImage().ready && !!v && v.editable && (d.strokes.length > 0 || !!d.prompt.trim()) && editOverBy(d.prompt) === 0;
|
|
137
165
|
if (d.kind === "branch") return true;
|
|
138
166
|
return !!convertChoice(d) && widthOf(d).ok;
|
|
139
167
|
}
|
|
@@ -143,8 +171,9 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
143
171
|
return callTool(TOOLS.run, { runDir: state.view.runDir, opId: opId, action: action }).then(function (result) {
|
|
144
172
|
var sc = result.structuredContent || {};
|
|
145
173
|
if (sc.view) applyView(sc.view, true);
|
|
146
|
-
// The hosted server
|
|
147
|
-
|
|
174
|
+
// The hosted server draws nothing: the workspace runner on the person's Mac does, or else the person's agent,
|
|
175
|
+
// which is told here (best effort, like Select) only when no runner holds the workspace.
|
|
176
|
+
if (TARGET === "remote") remoteAfterRun(action, opId, sc.runner);
|
|
148
177
|
return sc;
|
|
149
178
|
});
|
|
150
179
|
}
|
|
@@ -181,7 +210,7 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
181
210
|
var wrap = el("div", "imgwrap");
|
|
182
211
|
wrap.style.setProperty("--ar", String(v.width / v.height));
|
|
183
212
|
var img = el("img", "stageimg empty");
|
|
184
|
-
img.alt =
|
|
213
|
+
img.alt = t("versionName", { label: v.label });
|
|
185
214
|
img.setAttribute("draggable", "false");
|
|
186
215
|
wrap.appendChild(img);
|
|
187
216
|
bindImage(img, v, "full", true);
|
|
@@ -191,54 +220,54 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
191
220
|
box.appendChild(wrap);
|
|
192
221
|
// Under the image: the hint that it can be drawn on, and the two drawing controls.
|
|
193
222
|
var tools = el("div", "dialogtools");
|
|
194
|
-
tools.appendChild(el("p", "hint",
|
|
195
|
-
d.els.undo = button(
|
|
196
|
-
d.els.clear = button(
|
|
223
|
+
tools.appendChild(el("p", "hint", t("scribbleHint")));
|
|
224
|
+
d.els.undo = button(t("undo"), "", function () { scribbleUndo(d); });
|
|
225
|
+
d.els.clear = button(t("clear"), "", function () { scribbleClear(d); });
|
|
197
226
|
tools.appendChild(d.els.undo);
|
|
198
227
|
tools.appendChild(d.els.clear);
|
|
199
228
|
box.appendChild(tools);
|
|
200
|
-
box.appendChild(textarea("dialogedit", 3,
|
|
229
|
+
box.appendChild(textarea("dialogedit", 3, t("editPlaceholder"), 6000, function (value) { d.prompt = value; }, t("editAria")));
|
|
201
230
|
d.els.help = helpLine("");
|
|
202
231
|
box.appendChild(d.els.help);
|
|
203
232
|
}
|
|
204
233
|
function branchBody(d, box) {
|
|
205
|
-
box.appendChild(textarea("dialogbranch", 4,
|
|
206
|
-
box.appendChild(helpLine(
|
|
234
|
+
box.appendChild(textarea("dialogbranch", 4, t("branchPlaceholder"), 2000, function (value) { d.explanation = value; }, t("branchAria")));
|
|
235
|
+
box.appendChild(helpLine(t("branchHelp")));
|
|
207
236
|
}
|
|
208
237
|
function convertBody(d, box) {
|
|
209
238
|
var select = el("select");
|
|
210
239
|
select.id = "dialogformat";
|
|
211
240
|
var service = el("optgroup");
|
|
212
|
-
service.setAttribute("label",
|
|
241
|
+
service.setAttribute("label", t("serviceGroup"));
|
|
213
242
|
CONVERT.choices.forEach(function (choice) {
|
|
214
|
-
var option = el("option", "", choice.label);
|
|
243
|
+
var option = el("option", "", choice.labelKey ? t(choice.labelKey) : choice.label);
|
|
215
244
|
option.setAttribute("value", choice.value);
|
|
216
245
|
if (choice.value === d.format) option.setAttribute("selected", "");
|
|
217
246
|
(choice.engine === "local" ? select : service).appendChild(option);
|
|
218
247
|
});
|
|
219
248
|
if (service.childNodes.length > 0) select.appendChild(service);
|
|
220
249
|
select.addEventListener("change", function () { d.format = select.value; updateDialogUi(); });
|
|
221
|
-
box.appendChild(field(
|
|
250
|
+
box.appendChild(field(t("convertLabel"), select, "dialogformat"));
|
|
222
251
|
// One line that follows the choice: what the person gets.
|
|
223
252
|
d.els.formatHelp = helpLine("");
|
|
224
253
|
box.appendChild(d.els.formatHelp);
|
|
225
254
|
// The hosted server builds from the image and has nothing else to ask: no quality, width or layouts.
|
|
226
255
|
if (TARGET === "remote") return;
|
|
227
256
|
// Only the options the chosen format has are shown; the rest are hidden, not disabled. Each says what it does in one line.
|
|
228
|
-
d.els.quality = group(
|
|
229
|
-
d.els.quality.appendChild(helpLine(
|
|
257
|
+
d.els.quality = group(t("qualityLabel"), radioRow("quality", [{ value: "fast", label: t("fast") }, { value: "standard", label: t("standard") }, { value: "pro", label: t("pro") }], d.quality, function (value) { d.quality = value; }));
|
|
258
|
+
d.els.quality.appendChild(helpLine(t("qualityHelp")));
|
|
230
259
|
var width = el("input");
|
|
231
260
|
width.type = "number";
|
|
232
261
|
width.id = "dialogwidth";
|
|
233
262
|
width.setAttribute("min", "1");
|
|
234
263
|
width.setAttribute("max", String(CONVERT.maxWidth));
|
|
235
|
-
width.setAttribute("placeholder",
|
|
264
|
+
width.setAttribute("placeholder", t("widthPlaceholder"));
|
|
236
265
|
width.setAttribute("inputmode", "numeric");
|
|
237
266
|
width.addEventListener("input", function () { d.width = width.value; updateDialogUi(); });
|
|
238
|
-
d.els.width = field(
|
|
239
|
-
d.els.width.appendChild(helpLine(
|
|
240
|
-
d.els.layouts = group(
|
|
241
|
-
d.els.layouts.appendChild(helpLine(
|
|
267
|
+
d.els.width = field(t("widthLabel"), width, "dialogwidth");
|
|
268
|
+
d.els.width.appendChild(helpLine(t("widthHelp")));
|
|
269
|
+
d.els.layouts = group(t("layoutsLabel"), radioRow("layouts", [{ value: "standard", label: t("standard") }, { value: "pro", label: t("pro") }], d.layouts, function (value) { d.layouts = value; }));
|
|
270
|
+
d.els.layouts.appendChild(helpLine(t("layoutsHelp")));
|
|
242
271
|
[d.els.quality, d.els.width, d.els.layouts].forEach(function (node) { box.appendChild(node); });
|
|
243
272
|
}
|
|
244
273
|
|
|
@@ -251,8 +280,8 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
251
280
|
var box = el("div", "modalbox" + (d.kind === "edit" ? " wide" : ""));
|
|
252
281
|
box.setAttribute("role", "dialog");
|
|
253
282
|
box.setAttribute("aria-modal", "true");
|
|
254
|
-
box.setAttribute("aria-label", DIALOG_TITLES[d.kind]);
|
|
255
|
-
box.appendChild(el("h2", "", DIALOG_TITLES[d.kind]));
|
|
283
|
+
box.setAttribute("aria-label", t(DIALOG_TITLES[d.kind]));
|
|
284
|
+
box.appendChild(el("h2", "", t(DIALOG_TITLES[d.kind])));
|
|
256
285
|
if (d.kind === "edit") editBody(d, box);
|
|
257
286
|
else if (d.kind === "branch") branchBody(d, box);
|
|
258
287
|
else convertBody(d, box);
|
|
@@ -261,8 +290,8 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
261
290
|
box.appendChild(d.els.alert);
|
|
262
291
|
var buttons = el("div", "dialogbtns");
|
|
263
292
|
buttons.appendChild(el("span", "spacer"));
|
|
264
|
-
buttons.appendChild(button(
|
|
265
|
-
d.els.primary = button(DIALOG_VERBS[d.kind], "primary", commitDialog);
|
|
293
|
+
buttons.appendChild(button(t("cancel"), "", closeDialog));
|
|
294
|
+
d.els.primary = button(t(DIALOG_VERBS[d.kind]), "primary", commitDialog);
|
|
266
295
|
buttons.appendChild(d.els.primary);
|
|
267
296
|
box.appendChild(buttons);
|
|
268
297
|
backdrop.appendChild(box);
|
|
@@ -280,17 +309,18 @@ export const SLATE_UI_DIALOG = String.raw `
|
|
|
280
309
|
// A dialog that cannot run on this Mac says why, in the same line an error would use.
|
|
281
310
|
var local = localImage();
|
|
282
311
|
var blockedByLocal = d.kind === "edit" && !local.ready;
|
|
283
|
-
|
|
312
|
+
var tooLong = d.kind === "edit" ? editOverBy(d.prompt) : 0;
|
|
313
|
+
d.els.alert.textContent = d.error || (blockedByLocal ? localReason() : "") || (tooLong > 0 ? t("editTooLong", { n: tooLong }) : "");
|
|
284
314
|
d.els.alert.classList.toggle("hidden", !d.els.alert.textContent);
|
|
285
315
|
if (d.els.undo) d.els.undo.disabled = d.strokes.length === 0 || d.committing;
|
|
286
316
|
if (d.els.clear) d.els.clear.disabled = d.strokes.length === 0 || d.committing;
|
|
287
317
|
if (d.els.help) {
|
|
288
318
|
var marksOnly = d.strokes.length > 0 && !d.prompt.trim();
|
|
289
|
-
d.els.help.textContent = marksOnly ?
|
|
319
|
+
d.els.help.textContent = marksOnly ? t("editHelpMarks") : t("editHelp", { label: (ver(d.versionId) || {}).label || "" });
|
|
290
320
|
}
|
|
291
321
|
if (d.kind === "convert") {
|
|
292
322
|
var choice = convertChoice(d);
|
|
293
|
-
d.els.formatHelp.textContent =
|
|
323
|
+
d.els.formatHelp.textContent = choice && CONVERT.descriptionKeys[choice.value] ? t(CONVERT.descriptionKeys[choice.value]) : "";
|
|
294
324
|
}
|
|
295
325
|
if (d.kind === "convert" && TARGET !== "remote") {
|
|
296
326
|
var isLocal = !!choice && choice.engine === "local";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-dialog.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-dialog.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0UxC,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The inline card: one large image of the selected option with a badge,
|
|
3
|
-
*
|
|
4
|
-
* or viewed option of an older round)
|
|
5
|
-
* an icon-only control opens the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The inline card: one large image of the selected option with a badge,
|
|
3
|
+
* Select under it, and the strip of thumbnails (the newest round, plus the
|
|
4
|
+
* picked or viewed option of an older round) on as many rows as it takes,
|
|
5
|
+
* ending with the Generate more tile; an icon-only control opens the
|
|
6
|
+
* workspace. There is no status line: an option being drawn shimmers, one
|
|
7
|
+
* that failed or stopped says why on its tile, and an error about a click
|
|
8
|
+
* shows beside Select. Also the view application, the large image and the
|
|
9
|
+
* thumbnail buttons shared with the workspace, and the tool-result entry
|
|
10
|
+
* point.
|
|
8
11
|
*/
|
|
9
12
|
export declare const SLATE_UI_INLINE: string;
|
|
10
13
|
//# sourceMappingURL=mcp-slate-ui-script-inline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-inline.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inline.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,QAgQ3B,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The inline card: one large image of the selected option with a badge,
|
|
3
|
-
*
|
|
4
|
-
* or viewed option of an older round)
|
|
5
|
-
* an icon-only control opens the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The inline card: one large image of the selected option with a badge,
|
|
3
|
+
* Select under it, and the strip of thumbnails (the newest round, plus the
|
|
4
|
+
* picked or viewed option of an older round) on as many rows as it takes,
|
|
5
|
+
* ending with the Generate more tile; an icon-only control opens the
|
|
6
|
+
* workspace. There is no status line: an option being drawn shimmers, one
|
|
7
|
+
* that failed or stopped says why on its tile, and an error about a click
|
|
8
|
+
* shows beside Select. Also the view application, the large image and the
|
|
9
|
+
* thumbnail buttons shared with the workspace, and the tool-result entry
|
|
10
|
+
* point.
|
|
8
11
|
*/
|
|
9
12
|
export const SLATE_UI_INLINE = String.raw `
|
|
10
13
|
// ---- apply a view: selection, announcements, polling, render ----
|
|
@@ -32,13 +35,14 @@ export const SLATE_UI_INLINE = String.raw `
|
|
|
32
35
|
state.awaitEdit = null;
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
|
-
|
|
38
|
+
syncStaleLine(view);
|
|
39
|
+
syncPause();
|
|
36
40
|
if (view.pick && pickRestored !== view.runDir) {
|
|
37
41
|
pickRestored = view.runDir;
|
|
38
42
|
var earlier = ver(view.pick.versionId);
|
|
39
43
|
if (earlier) state.sel = { candidateId: earlier.candidateId, versionId: earlier.versionId, followLatest: false };
|
|
40
|
-
if (!fromPoll && view.pick.fileState === "missing") setStatus(
|
|
41
|
-
else if (!fromPoll && view.pick.fileState === "changed") setStatus(
|
|
44
|
+
if (!fromPoll && view.pick.fileState === "missing") setStatus(t("pickMissing"), "err");
|
|
45
|
+
else if (!fromPoll && view.pick.fileState === "changed") setStatus(t("pickChanged"), "err");
|
|
42
46
|
}
|
|
43
47
|
ensureSelection();
|
|
44
48
|
renderAll();
|
|
@@ -55,9 +59,24 @@ export const SLATE_UI_INLINE = String.raw `
|
|
|
55
59
|
// A dialog that is open follows the view: what this Mac can do now, for one.
|
|
56
60
|
if (state.dialog) updateDialogUi();
|
|
57
61
|
syncMore();
|
|
62
|
+
if (pause.opId) syncPauseBars();
|
|
58
63
|
reportSize();
|
|
59
64
|
}
|
|
60
65
|
|
|
66
|
+
// A new language: every container is built again in it on the next render. An open dialog and the Generate more panel
|
|
67
|
+
// close, because they were built in the old words; what the person typed in the search box stays (state.query).
|
|
68
|
+
function relocalizeView() {
|
|
69
|
+
if (state.dialog) { state.dialog = null; if (stageEls.dialog) stageEls.dialog.textContent = ""; }
|
|
70
|
+
if (state.more) resetMore();
|
|
71
|
+
$("hero").__sig = null;
|
|
72
|
+
$("strip").__sig = null;
|
|
73
|
+
$("pausebar").__pause = null;
|
|
74
|
+
var pane = $("pane-inspiration");
|
|
75
|
+
pane.__built = false;
|
|
76
|
+
pane.textContent = "";
|
|
77
|
+
stageBuilt = false;
|
|
78
|
+
}
|
|
79
|
+
|
|
61
80
|
// Rebuild a container only when what it shows changed, so polling never steals focus or discards typing.
|
|
62
81
|
function setIfChanged(node, signature, build) {
|
|
63
82
|
if (node.__sig === signature) return false;
|
|
@@ -69,13 +88,14 @@ export const SLATE_UI_INLINE = String.raw `
|
|
|
69
88
|
|
|
70
89
|
// ---- the large image, shared by the card and the workspace ----
|
|
71
90
|
function pickable(version) { return !!version && version.fileState === "ok"; }
|
|
72
|
-
// Why an option has no picture to show, or "" when it has one.
|
|
91
|
+
// Why an option has no picture to show, or "" when it has one. One being drawn is named; the shimmer says the rest.
|
|
73
92
|
function optionNote(c) {
|
|
74
93
|
var v = latestVersion(c);
|
|
75
|
-
if (c.state === "failed") return c.error || optionName(c);
|
|
76
|
-
if (c
|
|
77
|
-
if (
|
|
78
|
-
if (v && v.fileState === "
|
|
94
|
+
if (c.state === "failed") return serverText(c.errorL10n, c.error) || optionName(c);
|
|
95
|
+
if (pausedFor(c)) return pausedRef(c) ? t("pauseDrawsFrom", { label: c.label }) : t("pauseNoReference");
|
|
96
|
+
if (c.state === "pending") return drawing(c) ? optionName(c) : stoppedReason(c);
|
|
97
|
+
if (v && v.fileState === "missing") return t("fileMissing");
|
|
98
|
+
if (v && v.fileState === "changed") return t("fileChanged");
|
|
79
99
|
return "";
|
|
80
100
|
}
|
|
81
101
|
// The full picture jumps the queue; while it loads, the thumbnail (already fetched) stands in.
|
|
@@ -87,16 +107,18 @@ export const SLATE_UI_INLINE = String.raw `
|
|
|
87
107
|
var shared = wrap.parentElement;
|
|
88
108
|
if (shared) shared.style.removeProperty("--ar");
|
|
89
109
|
if (!c) return;
|
|
110
|
+
var waitingRef = !v ? pausedRef(c) : null;
|
|
111
|
+
if (waitingRef) { pausedHeroInto(wrap, shared, c, waitingRef); return; }
|
|
90
112
|
if (!v || v.fileState !== "ok") {
|
|
91
113
|
wrap.classList.add("note");
|
|
92
|
-
var reason = !v ? optionNote(c) : v.fileState === "changed" ?
|
|
93
|
-
wrap.appendChild(el("div", "heronote" + (c
|
|
114
|
+
var reason = !v ? optionNote(c) : v.fileState === "changed" ? t("fileChanged") : t("fileMissing");
|
|
115
|
+
wrap.appendChild(el("div", "heronote" + (drawing(c) ? " shimmer" : ""), reason));
|
|
94
116
|
return;
|
|
95
117
|
}
|
|
96
118
|
wrap.style.setProperty("--ar", String(v.width / v.height));
|
|
97
119
|
if (shared) shared.style.setProperty("--ar", String(v.width / v.height));
|
|
98
120
|
var img = el("img", "heroimg empty");
|
|
99
|
-
img.alt =
|
|
121
|
+
img.alt = t("versionName", { label: v.label });
|
|
100
122
|
img.setAttribute("draggable", "false");
|
|
101
123
|
wrap.appendChild(img);
|
|
102
124
|
bindImage(img, v, "full", true);
|
|
@@ -105,11 +127,26 @@ export const SLATE_UI_INLINE = String.raw `
|
|
|
105
127
|
wrap.appendChild(el("span", "badge", v.label));
|
|
106
128
|
if (c.busy) wrap.appendChild(progressBar());
|
|
107
129
|
}
|
|
130
|
+
// An option of a round that waits for the person: the reference it will be drawn from, at that picture's ratio, named.
|
|
131
|
+
function pausedHeroInto(wrap, shared, c, referenceId) {
|
|
132
|
+
var meta = refMeta(referenceId);
|
|
133
|
+
var ratio = meta && meta.width > 0 && meta.height > 0 ? meta.width / meta.height : ratioOf(c);
|
|
134
|
+
wrap.style.setProperty("--ar", String(ratio));
|
|
135
|
+
if (shared) shared.style.setProperty("--ar", String(ratio));
|
|
136
|
+
var img = el("img", "heroimg empty");
|
|
137
|
+
img.alt = t("pauseDrawsFrom", { label: c.label });
|
|
138
|
+
img.setAttribute("draggable", "false");
|
|
139
|
+
wrap.appendChild(img);
|
|
140
|
+
fillImage(img, wantReference(referenceId, "thumb", true));
|
|
141
|
+
wrap.appendChild(el("span", "badge", t("pauseReferenceFor", { label: c.label })));
|
|
142
|
+
}
|
|
108
143
|
function heroSignature(c, v) {
|
|
109
|
-
return JSON.stringify([state.sel, v && [v.sha256, v.fileState, v.label], c && [c.state, c.error, c.busy]]);
|
|
144
|
+
return JSON.stringify([state.sel, v && [v.sha256, v.fileState, v.label], c && [c.state, c.error, c.busy, drawing(c), optionNote(c), pausedRef(c)]]);
|
|
110
145
|
}
|
|
111
146
|
|
|
112
|
-
// ---- a
|
|
147
|
+
// ---- a thumbnail button for an option: the strip in the card, the selection in the workspace ----
|
|
148
|
+
// The tile has the option's own ratio. With a picture it holds the picture (an <img> only once there is a file to
|
|
149
|
+
// show); being drawn it shimmers; without a picture otherwise it says why on the tile. Its code is always on it.
|
|
113
150
|
function thumbButton(c, cls) {
|
|
114
151
|
var b = button("", cls);
|
|
115
152
|
var selected = state.sel.candidateId === c.candidateId;
|
|
@@ -117,75 +154,83 @@ export const SLATE_UI_INLINE = String.raw `
|
|
|
117
154
|
b.setAttribute("aria-pressed", selected ? "true" : "false");
|
|
118
155
|
if (selected) b.classList.add("selected");
|
|
119
156
|
b.setAttribute("data-option", c.label);
|
|
157
|
+
b.style.setProperty("--ar", String(ratioOf(c)));
|
|
120
158
|
var v = latestVersion(c);
|
|
121
|
-
var
|
|
122
|
-
if (
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
159
|
+
var waitingRef = pausedRef(c);
|
|
160
|
+
if (drawing(c)) b.classList.add("shimmer");
|
|
161
|
+
else if (waitingRef) {
|
|
162
|
+
// Not drawn yet: the tile shows the reference this option will be drawn from.
|
|
163
|
+
b.classList.add("paused");
|
|
164
|
+
b.title = t("pauseDrawsFrom", { label: c.label });
|
|
165
|
+
var ref = el("img", "thumb empty");
|
|
166
|
+
ref.alt = "";
|
|
167
|
+
b.appendChild(ref);
|
|
168
|
+
bindReference(ref, waitingRef, "thumb");
|
|
169
|
+
} else if (c.state === "ready" && v && v.fileState === "ok") {
|
|
170
|
+
var img = el("img", "thumb empty");
|
|
171
|
+
img.alt = "";
|
|
172
|
+
b.appendChild(img);
|
|
173
|
+
bindImage(img, v, "thumb", false);
|
|
174
|
+
} else {
|
|
175
|
+
var note = optionNote(c);
|
|
176
|
+
b.title = note;
|
|
177
|
+
b.classList.add(c.state === "pending" ? "stopped" : "failed");
|
|
178
|
+
var words = el("span", "tilenote");
|
|
179
|
+
words.appendChild(el("span", "", note));
|
|
180
|
+
b.appendChild(words);
|
|
181
|
+
}
|
|
130
182
|
b.appendChild(el("b", "code", c.label));
|
|
131
183
|
b.addEventListener("click", function () { selectCandidate(c.candidateId); });
|
|
132
184
|
return b;
|
|
133
185
|
}
|
|
134
186
|
function thumbSignature(c) {
|
|
135
187
|
var lv = latestVersion(c);
|
|
136
|
-
return [c.candidateId, c.state, c.error, c.latestVersionId, c.versionIds.length, lv ? lv.fileState : ""];
|
|
188
|
+
return [c.candidateId, c.state, c.error, c.latestVersionId, c.versionIds.length, lv ? lv.fileState : "", drawing(c), optionNote(c), ratioOf(c), pausedRef(c)];
|
|
137
189
|
}
|
|
138
190
|
|
|
139
191
|
function renderInline() {
|
|
140
192
|
var v = state.view;
|
|
141
193
|
var empty = v.candidates.length === 0;
|
|
142
194
|
$("empty").classList.toggle("hidden", !empty);
|
|
143
|
-
$("empty").textContent =
|
|
195
|
+
$("empty").textContent = t("empty");
|
|
144
196
|
$("card").classList.toggle("hidden", empty);
|
|
145
197
|
if (empty) { reportSize(); return; }
|
|
146
198
|
syncTabs();
|
|
147
199
|
var onDesigns = state.tab === "designs";
|
|
148
200
|
$("pane-designs").classList.toggle("hidden", !onDesigns);
|
|
149
201
|
$("pane-inspiration").classList.toggle("hidden", onDesigns);
|
|
202
|
+
syncPauseHost($("pausebar"), true);
|
|
150
203
|
if (!onDesigns) {
|
|
151
204
|
renderInspiration($("pane-inspiration"), "card");
|
|
152
205
|
syncControls();
|
|
153
206
|
reportSize();
|
|
154
207
|
return;
|
|
155
208
|
}
|
|
156
|
-
syncProgressLine(v);
|
|
157
209
|
var c = selectedCandidate();
|
|
158
210
|
var sel = selectedVersion();
|
|
159
211
|
setIfChanged($("hero"), heroSignature(c, sel), function (node) { heroInto(node, c, sel); });
|
|
160
212
|
var strip = $("strip");
|
|
161
|
-
// Where keyboard focus sits among the strip's buttons (the thumbnails), so a rebuild can put it back.
|
|
213
|
+
// Where keyboard focus sits among the strip's buttons (the thumbnails and the tile), so a rebuild can put it back.
|
|
162
214
|
var focusAt = strip.contains(document.activeElement) ? Array.prototype.indexOf.call(strip.querySelectorAll("button"), document.activeElement) : -1;
|
|
163
215
|
var options = inlineCandidates();
|
|
164
216
|
var rebuilt = setIfChanged(strip, JSON.stringify([state.sel.candidateId, options.map(thumbSignature)]), function (node) {
|
|
165
217
|
options.forEach(function (x) { node.appendChild(thumbButton(x, "thumbbtn")); });
|
|
218
|
+
// The strip wraps onto as many rows as it needs, so the Generate more tile, last, is always in view after the options.
|
|
219
|
+
node.appendChild(moreTile());
|
|
220
|
+
setShape(node, ratioOf(options[0]));
|
|
166
221
|
});
|
|
167
|
-
// The Generate more tile is pinned beside the strip, outside its scroll, so it is never pushed out of view; built once.
|
|
168
|
-
var wrap = $("stripwrap");
|
|
169
|
-
if (!wrap.querySelector(".moretile")) wrap.appendChild(moreTile());
|
|
170
222
|
// Choosing a thumbnail rebuilds the strip: keep keyboard focus at the same place in it.
|
|
171
223
|
var stripButtons = strip.querySelectorAll("button");
|
|
172
224
|
if (rebuilt && focusAt >= 0 && stripButtons[focusAt]) stripButtons[focusAt].focus();
|
|
173
|
-
var shown = Array.prototype.filter.call(strip.children, function (b) { return b.classList.contains("selected"); })[0];
|
|
174
|
-
if (rebuilt && shown && shown.scrollIntoView && strip.scrollWidth > strip.clientWidth) { try { shown.scrollIntoView({ inline: "nearest", block: "nearest" }); } catch (e) { /* best effort */ } }
|
|
175
|
-
strip.classList.toggle("fade", strip.scrollWidth > strip.clientWidth + 1);
|
|
176
225
|
syncControls();
|
|
177
226
|
reportSize();
|
|
178
227
|
}
|
|
179
|
-
window.addEventListener("resize", function () {
|
|
180
|
-
var strip = $("strip");
|
|
181
|
-
if (strip) strip.classList.toggle("fade", strip.scrollWidth > strip.clientWidth + 1);
|
|
182
|
-
});
|
|
183
228
|
|
|
184
229
|
function syncControls() {
|
|
185
230
|
if (!state.view) return;
|
|
186
231
|
var v = selectedVersion();
|
|
187
232
|
var same = samePick(v);
|
|
188
|
-
var label = same ?
|
|
233
|
+
var label = same ? t("selected") : t("select");
|
|
189
234
|
var disabled = !(pickable(v) && !state.busy && !same);
|
|
190
235
|
if (!isFullscreen()) {
|
|
191
236
|
var expand = $("expand");
|
|
@@ -211,12 +256,12 @@ export const SLATE_UI_INLINE = String.raw `
|
|
|
211
256
|
// ---- tool result: the workspace ----
|
|
212
257
|
function onToolResult(result) {
|
|
213
258
|
if (!result || result.isError) {
|
|
214
|
-
var
|
|
215
|
-
fatal(
|
|
259
|
+
var said = result && result.content && result.content[0] && result.content[0].text;
|
|
260
|
+
fatal(said ? t("toolErrorDetail", { detail: said }) : t("toolError"));
|
|
216
261
|
return;
|
|
217
262
|
}
|
|
218
263
|
var data = result.structuredContent;
|
|
219
|
-
if (!data || !Array.isArray(data.candidates)) { fatal(
|
|
264
|
+
if (!data || !Array.isArray(data.candidates)) { fatal(t("noView")); return; }
|
|
220
265
|
applyView(data, false);
|
|
221
266
|
}
|
|
222
267
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-slate-ui-script-inline.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inline.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgQxC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Inspiration tab's collage: every grid of reference tiles (and the skeleton tiles of a search in flight) is laid
|
|
3
|
+
* out by the 12ui web gallery's own mosaic band solver, `packMosaicBands` from `mosaic-bands.ts`, whose source is
|
|
4
|
+
* embedded here as is. Each picture keeps its aspect ratio (from the reference's recorded width and height, else its
|
|
5
|
+
* recorded aspect, by the solver's own rule) and every band is exactly as wide as the grid.
|
|
6
|
+
*
|
|
7
|
+
* Only the packing is the screen's (the gallery's is sized for cards with an action strip on a whole page):
|
|
8
|
+
*
|
|
9
|
+
* - a band plans its pictures at least 192 px across in the card and 256 px in the workspace (the old square tiles'
|
|
10
|
+
* minimums), two across at the least, and holds at most four columns; the gap is 8 px, room for a selected tile's
|
|
11
|
+
* ring;
|
|
12
|
+
* - a section with fewer pictures than a row holds is as wide as those pictures would be in a full row, so a round
|
|
13
|
+
* with one reference shows one tile, not one picture as wide as the pane.
|
|
14
|
+
*
|
|
15
|
+
* The grid is measured, so it is laid out after it is built and again whenever the pane's width changes (a window
|
|
16
|
+
* resize, the card's scroll bar, the tab shown again). Tiles stay in result order in the document, so the keyboard
|
|
17
|
+
* walks them in the order the search ranked them.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SLATE_UI_INSPIRATION_COLLAGE: string;
|
|
20
|
+
//# sourceMappingURL=mcp-slate-ui-script-inspiration-collage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inspiration-collage.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration-collage.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,QA+CxC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { packMosaicBands } from './mosaic-bands.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Inspiration tab's collage: every grid of reference tiles (and the skeleton tiles of a search in flight) is laid
|
|
4
|
+
* out by the 12ui web gallery's own mosaic band solver, `packMosaicBands` from `mosaic-bands.ts`, whose source is
|
|
5
|
+
* embedded here as is. Each picture keeps its aspect ratio (from the reference's recorded width and height, else its
|
|
6
|
+
* recorded aspect, by the solver's own rule) and every band is exactly as wide as the grid.
|
|
7
|
+
*
|
|
8
|
+
* Only the packing is the screen's (the gallery's is sized for cards with an action strip on a whole page):
|
|
9
|
+
*
|
|
10
|
+
* - a band plans its pictures at least 192 px across in the card and 256 px in the workspace (the old square tiles'
|
|
11
|
+
* minimums), two across at the least, and holds at most four columns; the gap is 8 px, room for a selected tile's
|
|
12
|
+
* ring;
|
|
13
|
+
* - a section with fewer pictures than a row holds is as wide as those pictures would be in a full row, so a round
|
|
14
|
+
* with one reference shows one tile, not one picture as wide as the pane.
|
|
15
|
+
*
|
|
16
|
+
* The grid is measured, so it is laid out after it is built and again whenever the pane's width changes (a window
|
|
17
|
+
* resize, the card's scroll bar, the tab shown again). Tiles stay in result order in the document, so the keyboard
|
|
18
|
+
* walks them in the order the search ranked them.
|
|
19
|
+
*/
|
|
20
|
+
export const SLATE_UI_INSPIRATION_COLLAGE = String.raw `
|
|
21
|
+
// ---- the collage: the web gallery's mosaic bands (packages/12ui/src/mosaic-bands.ts) ----
|
|
22
|
+
var packMosaicBands = (${packMosaicBands.toString()});
|
|
23
|
+
var COLLAGE = { min: { card: 192, stage: 256 }, gap: 8, columns: 4 };
|
|
24
|
+
// How a grid of this many pictures packs at this width: the width it takes and the band packing.
|
|
25
|
+
function collagePacking(count, width, where) {
|
|
26
|
+
var gap = COLLAGE.gap;
|
|
27
|
+
var across = Math.max(2, Math.floor((width + gap) / (COLLAGE.min[where] + gap)));
|
|
28
|
+
if (count < across) {
|
|
29
|
+
var tile = (width - (across - 1) * gap) / across;
|
|
30
|
+
width = count * tile + (count - 1) * gap;
|
|
31
|
+
across = count;
|
|
32
|
+
}
|
|
33
|
+
return { width: width, packing: { columns: Math.min(across, COLLAGE.columns), across: across, gap: gap } };
|
|
34
|
+
}
|
|
35
|
+
// A tile's shape: the reference's recorded aspect and size, or a 16:10 landscape for a skeleton tile.
|
|
36
|
+
function collageShape(node, referenceId) {
|
|
37
|
+
var meta = referenceId && state.view.references ? state.view.references[referenceId] : null;
|
|
38
|
+
node.__shape = meta ? { aspect: meta.aspect, width: meta.width, height: meta.height } : { aspect: "landscape", width: null, height: null };
|
|
39
|
+
}
|
|
40
|
+
function layoutGrid(grid, where, width) {
|
|
41
|
+
var tiles = grid.children;
|
|
42
|
+
var items = [];
|
|
43
|
+
for (var i = 0; i < tiles.length; i++) {
|
|
44
|
+
var shape = tiles[i].__shape;
|
|
45
|
+
items.push({ id: String(i), aspect: shape.aspect, width: shape.width, height: shape.height });
|
|
46
|
+
}
|
|
47
|
+
var plan = collagePacking(items.length, width, where);
|
|
48
|
+
var layout = packMosaicBands(items, plan.width, plan.packing, 0);
|
|
49
|
+
layout.placements.forEach(function (p) {
|
|
50
|
+
var s = tiles[Number(p.id)].style;
|
|
51
|
+
s.left = p.left + "px";
|
|
52
|
+
s.top = p.top + "px";
|
|
53
|
+
s.width = p.width + "px";
|
|
54
|
+
s.height = p.height + "px";
|
|
55
|
+
});
|
|
56
|
+
grid.style.height = layout.height + "px";
|
|
57
|
+
grid.__laidAt = width;
|
|
58
|
+
}
|
|
59
|
+
// Lays out every grid in the pane that has a width and was not laid out at it (a hidden pane has none: it is laid out when shown).
|
|
60
|
+
function layoutResults(pane) {
|
|
61
|
+
var grids = pane.__results.querySelectorAll(".refgrid");
|
|
62
|
+
for (var i = 0; i < grids.length; i++) {
|
|
63
|
+
var width = grids[i].getBoundingClientRect().width;
|
|
64
|
+
if (width > 0 && grids[i].__laidAt !== width) layoutGrid(grids[i], pane.__where, width);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
//# sourceMappingURL=mcp-slate-ui-script-inspiration-collage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inspiration-collage.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration-collage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAA;;2BAE3B,eAAe,CAAC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CpD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 declare const SLATE_UI_INSPIRATION_GRID: string;
|
|
26
|
+
//# sourceMappingURL=mcp-slate-ui-script-inspiration-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inspiration-grid.d.ts","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration-grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,yBAAyB,QA4NrC,CAAC"}
|