@12ui/design 0.2.80 → 0.2.81
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/README.md +1 -3
- package/SKILL.md +2 -8
- package/dist/cli-help/design.d.ts +1 -1
- package/dist/cli-help/design.d.ts.map +1 -1
- package/dist/cli-help/design.js +0 -1
- package/dist/cli-help/design.js.map +1 -1
- package/dist/cli-help/index.d.ts +1 -1
- package/dist/cli-workspace-draw.d.ts.map +1 -1
- package/dist/cli-workspace-draw.js +2 -0
- package/dist/cli-workspace-draw.js.map +1 -1
- package/dist/cli-workspace-runner.d.ts.map +1 -1
- package/dist/cli-workspace-runner.js +2 -1
- package/dist/cli-workspace-runner.js.map +1 -1
- package/dist/corpus-client.d.ts +3 -0
- package/dist/corpus-client.d.ts.map +1 -1
- package/dist/corpus-client.js +2 -0
- package/dist/corpus-client.js.map +1 -1
- package/dist/corpus-public-renditions.d.ts +33 -0
- package/dist/corpus-public-renditions.d.ts.map +1 -0
- package/dist/corpus-public-renditions.js +55 -0
- package/dist/corpus-public-renditions.js.map +1 -0
- package/dist/legacy-skill-catalog.d.ts.map +1 -1
- package/dist/legacy-skill-catalog.js +11 -0
- package/dist/legacy-skill-catalog.js.map +1 -1
- package/dist/mcp-slate-command.d.ts +0 -2
- package/dist/mcp-slate-command.d.ts.map +1 -1
- package/dist/mcp-slate-command.js +0 -4
- package/dist/mcp-slate-command.js.map +1 -1
- package/dist/mcp-slate-resource.d.ts.map +1 -1
- package/dist/mcp-slate-resource.js +6 -4
- package/dist/mcp-slate-resource.js.map +1 -1
- package/dist/mcp-slate-tool-defs.d.ts.map +1 -1
- package/dist/mcp-slate-tool-defs.js +8 -6
- package/dist/mcp-slate-tool-defs.js.map +1 -1
- package/dist/mcp-slate-tools.d.ts.map +1 -1
- package/dist/mcp-slate-tools.js +8 -1
- package/dist/mcp-slate-tools.js.map +1 -1
- package/dist/mcp-slate-ui-copy.d.ts +88 -208
- package/dist/mcp-slate-ui-copy.d.ts.map +1 -1
- package/dist/mcp-slate-ui-copy.js +58 -159
- package/dist/mcp-slate-ui-copy.js.map +1 -1
- package/dist/mcp-slate-ui-locales/de-DE.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/de-DE.js +44 -83
- package/dist/mcp-slate-ui-locales/de-DE.js.map +1 -1
- package/dist/mcp-slate-ui-locales/es-419.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/es-419.js +44 -83
- package/dist/mcp-slate-ui-locales/es-419.js.map +1 -1
- package/dist/mcp-slate-ui-locales/es-ES.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/es-ES.js +44 -83
- package/dist/mcp-slate-ui-locales/es-ES.js.map +1 -1
- package/dist/mcp-slate-ui-locales/fr-FR.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/fr-FR.js +44 -83
- package/dist/mcp-slate-ui-locales/fr-FR.js.map +1 -1
- package/dist/mcp-slate-ui-locales/hi-IN.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/hi-IN.js +44 -83
- package/dist/mcp-slate-ui-locales/hi-IN.js.map +1 -1
- package/dist/mcp-slate-ui-locales/it-IT.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/it-IT.js +44 -83
- package/dist/mcp-slate-ui-locales/it-IT.js.map +1 -1
- package/dist/mcp-slate-ui-locales/ja-JP.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/ja-JP.js +44 -83
- package/dist/mcp-slate-ui-locales/ja-JP.js.map +1 -1
- package/dist/mcp-slate-ui-locales/ko-KR.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/ko-KR.js +44 -83
- package/dist/mcp-slate-ui-locales/ko-KR.js.map +1 -1
- package/dist/mcp-slate-ui-locales/pt-BR.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/pt-BR.js +44 -83
- package/dist/mcp-slate-ui-locales/pt-BR.js.map +1 -1
- package/dist/mcp-slate-ui-locales/zh-CN.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/zh-CN.js +44 -83
- package/dist/mcp-slate-ui-locales/zh-CN.js.map +1 -1
- package/dist/mcp-slate-ui-locales/zh-TW.d.ts.map +1 -1
- package/dist/mcp-slate-ui-locales/zh-TW.js +44 -83
- package/dist/mcp-slate-ui-locales/zh-TW.js.map +1 -1
- package/dist/mcp-slate-ui-script-bridge.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-bridge.js +19 -7
- package/dist/mcp-slate-ui-script-bridge.js.map +1 -1
- package/dist/mcp-slate-ui-script-browser.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-browser.js +0 -3
- package/dist/mcp-slate-ui-script-browser.js.map +1 -1
- package/dist/mcp-slate-ui-script-designs.d.ts +17 -0
- package/dist/mcp-slate-ui-script-designs.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-designs.js +365 -0
- package/dist/mcp-slate-ui-script-designs.js.map +1 -0
- package/dist/mcp-slate-ui-script-edit.d.ts +9 -0
- package/dist/mcp-slate-ui-script-edit.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-edit.js +71 -0
- package/dist/mcp-slate-ui-script-edit.js.map +1 -0
- package/dist/mcp-slate-ui-script-inline.d.ts +3 -9
- package/dist/mcp-slate-ui-script-inline.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-inline.js +28 -155
- package/dist/mcp-slate-ui-script-inline.js.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration-collage.d.ts +13 -12
- package/dist/mcp-slate-ui-script-inspiration-collage.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration-collage.js +24 -24
- package/dist/mcp-slate-ui-script-inspiration-collage.js.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration-gallery.d.ts +23 -0
- package/dist/mcp-slate-ui-script-inspiration-gallery.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-inspiration-gallery.js +221 -0
- package/dist/mcp-slate-ui-script-inspiration-gallery.js.map +1 -0
- package/dist/mcp-slate-ui-script-inspiration-grid.d.ts +14 -21
- package/dist/mcp-slate-ui-script-inspiration-grid.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration-grid.js +124 -196
- package/dist/mcp-slate-ui-script-inspiration-grid.js.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration.d.ts +8 -9
- package/dist/mcp-slate-ui-script-inspiration.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-inspiration.js +213 -130
- package/dist/mcp-slate-ui-script-inspiration.js.map +1 -1
- package/dist/mcp-slate-ui-script-l10n.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-l10n.js +2 -0
- package/dist/mcp-slate-ui-script-l10n.js.map +1 -1
- package/dist/mcp-slate-ui-script-more.d.ts +4 -33
- package/dist/mcp-slate-ui-script-more.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-more.js +6 -279
- package/dist/mcp-slate-ui-script-more.js.map +1 -1
- package/dist/mcp-slate-ui-script-pause.d.ts +10 -6
- package/dist/mcp-slate-ui-script-pause.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-pause.js +45 -30
- package/dist/mcp-slate-ui-script-pause.js.map +1 -1
- package/dist/mcp-slate-ui-script-references.d.ts +19 -0
- package/dist/mcp-slate-ui-script-references.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-references.js +102 -0
- package/dist/mcp-slate-ui-script-references.js.map +1 -0
- package/dist/mcp-slate-ui-script-remote.d.ts +13 -12
- package/dist/mcp-slate-ui-script-remote.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-remote.js +46 -27
- package/dist/mcp-slate-ui-script-remote.js.map +1 -1
- package/dist/mcp-slate-ui-script-scribble.d.ts +2 -2
- package/dist/mcp-slate-ui-script-scribble.js +7 -7
- package/dist/mcp-slate-ui-script-select.d.ts +4 -9
- package/dist/mcp-slate-ui-script-select.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-select.js +13 -37
- package/dist/mcp-slate-ui-script-select.js.map +1 -1
- package/dist/mcp-slate-ui-script-stage.d.ts +4 -10
- package/dist/mcp-slate-ui-script-stage.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-stage.js +28 -141
- package/dist/mcp-slate-ui-script-stage.js.map +1 -1
- package/dist/mcp-slate-ui-script-state.d.ts +1 -1
- package/dist/mcp-slate-ui-script-state.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script-state.js +9 -4
- package/dist/mcp-slate-ui-script-state.js.map +1 -1
- package/dist/mcp-slate-ui-script-viewer.d.ts +18 -0
- package/dist/mcp-slate-ui-script-viewer.d.ts.map +1 -0
- package/dist/mcp-slate-ui-script-viewer.js +405 -0
- package/dist/mcp-slate-ui-script-viewer.js.map +1 -0
- package/dist/mcp-slate-ui-script.d.ts +4 -5
- package/dist/mcp-slate-ui-script.d.ts.map +1 -1
- package/dist/mcp-slate-ui-script.js +12 -13
- package/dist/mcp-slate-ui-script.js.map +1 -1
- package/dist/mcp-slate-ui-styles-designs.d.ts +10 -0
- package/dist/mcp-slate-ui-styles-designs.d.ts.map +1 -0
- package/dist/mcp-slate-ui-styles-designs.js +121 -0
- package/dist/mcp-slate-ui-styles-designs.js.map +1 -0
- package/dist/mcp-slate-ui-styles-inspiration.d.ts +13 -13
- package/dist/mcp-slate-ui-styles-inspiration.d.ts.map +1 -1
- package/dist/mcp-slate-ui-styles-inspiration.js +67 -33
- package/dist/mcp-slate-ui-styles-inspiration.js.map +1 -1
- package/dist/mcp-slate-ui-styles-pause.d.ts +2 -2
- package/dist/mcp-slate-ui-styles-pause.d.ts.map +1 -1
- package/dist/mcp-slate-ui-styles-pause.js +4 -8
- package/dist/mcp-slate-ui-styles-pause.js.map +1 -1
- package/dist/mcp-slate-ui-styles-stage.d.ts +3 -22
- package/dist/mcp-slate-ui-styles-stage.d.ts.map +1 -1
- package/dist/mcp-slate-ui-styles-stage.js +6 -74
- package/dist/mcp-slate-ui-styles-stage.js.map +1 -1
- package/dist/mcp-slate-ui-styles.d.ts +12 -19
- package/dist/mcp-slate-ui-styles.d.ts.map +1 -1
- package/dist/mcp-slate-ui-styles.js +97 -100
- package/dist/mcp-slate-ui-styles.js.map +1 -1
- package/dist/mcp-slate-ui.d.ts +12 -12
- package/dist/mcp-slate-ui.d.ts.map +1 -1
- package/dist/mcp-slate-ui.js +24 -23
- package/dist/mcp-slate-ui.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/dist/slate-actions.d.ts +22 -1
- package/dist/slate-actions.d.ts.map +1 -1
- package/dist/slate-actions.js +46 -2
- package/dist/slate-actions.js.map +1 -1
- package/dist/slate-browser-host.d.ts +8 -7
- package/dist/slate-browser-host.d.ts.map +1 -1
- package/dist/slate-browser-host.js +13 -10
- package/dist/slate-browser-host.js.map +1 -1
- package/dist/slate-browser-server.d.ts.map +1 -1
- package/dist/slate-browser-server.js +10 -4
- package/dist/slate-browser-server.js.map +1 -1
- package/dist/slate-commit.d.ts.map +1 -1
- package/dist/slate-commit.js +12 -5
- package/dist/slate-commit.js.map +1 -1
- package/dist/slate-handoff.d.ts.map +1 -1
- package/dist/slate-handoff.js +2 -3
- package/dist/slate-handoff.js.map +1 -1
- package/dist/slate-ids.d.ts +2 -1
- package/dist/slate-ids.d.ts.map +1 -1
- package/dist/slate-ids.js +3 -2
- package/dist/slate-ids.js.map +1 -1
- package/dist/slate-reference-ids.d.ts.map +1 -1
- package/dist/slate-reference-ids.js +1 -0
- package/dist/slate-reference-ids.js.map +1 -1
- package/dist/slate-round-prompt.d.ts +19 -0
- package/dist/slate-round-prompt.d.ts.map +1 -1
- package/dist/slate-round-prompt.js +22 -0
- package/dist/slate-round-prompt.js.map +1 -1
- package/dist/slate-round-runner.d.ts.map +1 -1
- package/dist/slate-round-runner.js +16 -12
- package/dist/slate-round-runner.js.map +1 -1
- package/dist/slate-round-search.d.ts.map +1 -1
- package/dist/slate-round-search.js +2 -0
- package/dist/slate-round-search.js.map +1 -1
- package/dist/slate-runtime.d.ts +3 -0
- 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-site-references-capture.d.ts +20 -0
- package/dist/slate-site-references-capture.d.ts.map +1 -0
- package/dist/slate-site-references-capture.js +119 -0
- package/dist/slate-site-references-capture.js.map +1 -0
- package/dist/slate-site-references-client.d.ts +35 -0
- package/dist/slate-site-references-client.d.ts.map +1 -0
- package/dist/slate-site-references-client.js +36 -0
- package/dist/slate-site-references-client.js.map +1 -0
- package/dist/slate-site-references-local.d.ts +6 -0
- package/dist/slate-site-references-local.d.ts.map +1 -0
- package/dist/slate-site-references-local.js +63 -0
- package/dist/slate-site-references-local.js.map +1 -0
- package/dist/slate-site-references-suggest.d.ts +36 -0
- package/dist/slate-site-references-suggest.d.ts.map +1 -0
- package/dist/slate-site-references-suggest.js +144 -0
- package/dist/slate-site-references-suggest.js.map +1 -0
- package/dist/slate-site-references.d.ts +57 -0
- package/dist/slate-site-references.d.ts.map +1 -0
- package/dist/slate-site-references.js +129 -0
- package/dist/slate-site-references.js.map +1 -0
- package/dist/slate-view-contract.d.ts +29 -1
- package/dist/slate-view-contract.d.ts.map +1 -1
- package/dist/slate-view.d.ts.map +1 -1
- package/dist/slate-view.js +5 -0
- package/dist/slate-view.js.map +1 -1
- package/dist/slate-workspace-parse.d.ts +2 -0
- package/dist/slate-workspace-parse.d.ts.map +1 -1
- package/dist/slate-workspace-parse.js +20 -3
- package/dist/slate-workspace-parse.js.map +1 -1
- package/dist/slate-workspace-types.d.ts +17 -2
- package/dist/slate-workspace-types.d.ts.map +1 -1
- package/dist/workspace-draw-messages.d.ts +27 -5
- package/dist/workspace-draw-messages.d.ts.map +1 -1
- package/dist/workspace-draw-messages.js +29 -3
- package/dist/workspace-draw-messages.js.map +1 -1
- package/dist/workspace-draw-run.d.ts +12 -0
- package/dist/workspace-draw-run.d.ts.map +1 -1
- package/dist/workspace-draw-run.js +47 -18
- package/dist/workspace-draw-run.js.map +1 -1
- package/dist/workspace-draw-types.d.ts +2 -1
- package/dist/workspace-draw-types.d.ts.map +1 -1
- package/dist/workspace-draw-types.js +1 -0
- package/dist/workspace-draw-types.js.map +1 -1
- package/dist/workspace-runner-main.d.ts +5 -0
- package/dist/workspace-runner-main.d.ts.map +1 -1
- package/dist/workspace-runner-main.js +15 -3
- package/dist/workspace-runner-main.js.map +1 -1
- package/open-design.json +2 -13
- package/package.json +1 -1
- package/skills/12ui-design/SKILL.md +7 -8
- package/dist/mcp-slate-ui-script-dialog.d.ts +0 -21
- package/dist/mcp-slate-ui-script-dialog.d.ts.map +0 -1
- package/dist/mcp-slate-ui-script-dialog.js +0 -351
- package/dist/mcp-slate-ui-script-dialog.js.map +0 -1
- package/dist/mcp-slate-ui-script-progress.d.ts +0 -7
- package/dist/mcp-slate-ui-script-progress.d.ts.map +0 -1
- package/dist/mcp-slate-ui-script-progress.js +0 -9
- package/dist/mcp-slate-ui-script-progress.js.map +0 -1
- package/dist/mcp-slate-ui-styles-dialog.d.ts +0 -20
- package/dist/mcp-slate-ui-styles-dialog.d.ts.map +0 -1
- package/dist/mcp-slate-ui-styles-dialog.js +0 -87
- package/dist/mcp-slate-ui-styles-dialog.js.map +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The picture gallery and its large view: the Inspiration grid, and the References grid (lane W1) reuses both.
|
|
3
|
+
*
|
|
4
|
+
* `createGallery({ where, root, isSelected, onToggle })` returns `{ node, set(key, items), sync(), layout() }`.
|
|
5
|
+
*
|
|
6
|
+
* - An item is `{ id, label, thumbUrl, imageUrl, title?, sourceUrl?, srcset?, width?, height?, aspect?, load? }`:
|
|
7
|
+
* `thumbUrl` for the tile and `imageUrl` for the large view, straight from their origin (`srcset` lets the browser
|
|
8
|
+
* pick by the tile's laid-out width); `load(img, size)` fills a picture another way when there is no URL.
|
|
9
|
+
* - `set(key, items)`: a new key is a new list (the tiles are built again from the top); the same key with a longer
|
|
10
|
+
* list only adds what is new at the end. The first page shows at once and the next page appears as the person nears
|
|
11
|
+
* the end of the grid (an IntersectionObserver on a marker after the last block, under `root()`, the element that
|
|
12
|
+
* scrolls the grid, or the window), until the list ends. Each page is its own collage block, so nothing already on
|
|
13
|
+
* screen ever moves: not on a click, not when a page is added.
|
|
14
|
+
* - A click toggles the tile (`onToggle`); `sync()` sets every tile's pressed state in place, without a rebuild. A
|
|
15
|
+
* selected tile carries a ring hugging the picture and a check in its corner.
|
|
16
|
+
* - The expand control in a tile's corner, or a double click, opens the large view: the picture as large as the frame
|
|
17
|
+
* allows, previous and next, Select or Selected, Open site for an item with a `sourceUrl`, and close; Escape closes
|
|
18
|
+
* it, the arrow keys step through the list.
|
|
19
|
+
*
|
|
20
|
+
* Fragment of the view's script; String.raw, no backtick, no dollar-brace.
|
|
21
|
+
*/
|
|
22
|
+
export const SLATE_UI_INSPIRATION_GALLERY = String.raw `
|
|
23
|
+
var GALLERY_PAGE = 24;
|
|
24
|
+
var GLYPH = {
|
|
25
|
+
expand: "M14 4h6v6M10 20H4v-6M20 4l-6.5 6.5M4 20l6.5-6.5",
|
|
26
|
+
close: "M6 6l12 12M18 6L6 18",
|
|
27
|
+
prev: "M15 5l-7 7 7 7",
|
|
28
|
+
next: "M9 5l7 7-7 7",
|
|
29
|
+
check: "M5 12.5l4.5 4.5L19 7.5",
|
|
30
|
+
open: "M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"
|
|
31
|
+
};
|
|
32
|
+
function glyph(path, size, stroke) {
|
|
33
|
+
return '<svg viewBox="0 0 24 24" width="' + size + '" height="' + size + '" fill="none" stroke="currentColor" stroke-width="' + stroke + '" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="' + path + '"/></svg>';
|
|
34
|
+
}
|
|
35
|
+
function glyphButton(label, path, cls, onclick) {
|
|
36
|
+
var b = button("", cls, onclick);
|
|
37
|
+
b.setAttribute("aria-label", label);
|
|
38
|
+
b.title = label;
|
|
39
|
+
b.innerHTML = glyph(path, 18, 2);
|
|
40
|
+
return b;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function createGallery(opts) {
|
|
44
|
+
var g = { opts: opts, key: null, items: [], shown: 0, node: el("div", "gallery"), observer: null };
|
|
45
|
+
g.end = el("div", "gend");
|
|
46
|
+
g.end.setAttribute("aria-hidden", "true");
|
|
47
|
+
g.node.appendChild(g.end);
|
|
48
|
+
g.set = function (key, items) {
|
|
49
|
+
if (key !== g.key) {
|
|
50
|
+
g.key = key;
|
|
51
|
+
g.items = items.slice();
|
|
52
|
+
g.shown = 0;
|
|
53
|
+
Array.prototype.slice.call(g.node.querySelectorAll(".refgrid")).forEach(function (n) { g.node.removeChild(n); });
|
|
54
|
+
var scroller = g.opts.root ? g.opts.root() : null;
|
|
55
|
+
if (scroller) scroller.scrollTop = 0;
|
|
56
|
+
revealPage(g);
|
|
57
|
+
} else {
|
|
58
|
+
g.items = items.slice();
|
|
59
|
+
// The list had ended on screen (a short last page): what joins it shows at once, in that block.
|
|
60
|
+
if (g.shown % GALLERY_PAGE !== 0) revealPage(g);
|
|
61
|
+
}
|
|
62
|
+
watchEnd(g);
|
|
63
|
+
};
|
|
64
|
+
g.sync = function () {
|
|
65
|
+
var tiles = g.node.querySelectorAll(".refbtn");
|
|
66
|
+
for (var i = 0; i < tiles.length; i++) tiles[i].setAttribute("aria-pressed", g.opts.isSelected(tiles[i].getAttribute("data-ref")) ? "true" : "false");
|
|
67
|
+
if (largeView && largeView.g === g) syncLargeView();
|
|
68
|
+
};
|
|
69
|
+
g.layout = function () { layoutBlocks(g.node, g.opts.where); };
|
|
70
|
+
return g;
|
|
71
|
+
}
|
|
72
|
+
// The next page of the list as one collage block, before the end marker; a short last block is topped up first, so
|
|
73
|
+
// sites arriving one by one fill its rows instead of stacking short blocks. Returns whether anything was added.
|
|
74
|
+
function revealPage(g) {
|
|
75
|
+
if (g.shown >= g.items.length) return false;
|
|
76
|
+
var short = g.shown % GALLERY_PAGE !== 0;
|
|
77
|
+
var grid = short ? g.end.previousElementSibling : el("div", "refgrid");
|
|
78
|
+
var page = g.items.slice(g.shown, g.shown + (short ? GALLERY_PAGE - (g.shown % GALLERY_PAGE) : GALLERY_PAGE));
|
|
79
|
+
var start = g.shown;
|
|
80
|
+
page.forEach(function (item, i) { grid.appendChild(galleryTile(g, item, start + i)); });
|
|
81
|
+
if (!short) g.node.insertBefore(grid, g.end);
|
|
82
|
+
g.shown += page.length;
|
|
83
|
+
var width = grid.getBoundingClientRect().width;
|
|
84
|
+
if (width > 0) layoutGrid(grid, g.opts.where, width);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
function watchEnd(g) {
|
|
88
|
+
if (g.observer || typeof IntersectionObserver === "undefined") return;
|
|
89
|
+
var root = g.opts.root ? g.opts.root() : null;
|
|
90
|
+
g.observer = new IntersectionObserver(function (entries) {
|
|
91
|
+
if (!entries.some(function (e) { return e.isIntersecting; })) return;
|
|
92
|
+
if (!revealPage(g)) return;
|
|
93
|
+
reportSize();
|
|
94
|
+
// Still in reach after a short page: look again.
|
|
95
|
+
g.observer.unobserve(g.end);
|
|
96
|
+
g.observer.observe(g.end);
|
|
97
|
+
}, { root: root, rootMargin: "0px 0px 900px 0px" });
|
|
98
|
+
g.observer.observe(g.end);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function galleryTile(g, item, index) {
|
|
102
|
+
var tile = el("div", "gtile");
|
|
103
|
+
tile.__shape = { aspect: item.aspect || "landscape", width: item.width || null, height: item.height || null };
|
|
104
|
+
var b = button("", "refbtn");
|
|
105
|
+
b.setAttribute("data-ref", item.id);
|
|
106
|
+
b.setAttribute("aria-label", item.label || item.title || item.id);
|
|
107
|
+
b.setAttribute("aria-pressed", g.opts.isSelected(item.id) ? "true" : "false");
|
|
108
|
+
// The picture's own skeleton shows until it lands, so a tile that has arrived never flashes a grey square.
|
|
109
|
+
var img = el("img", "thumb empty shimmer");
|
|
110
|
+
img.alt = "";
|
|
111
|
+
img.decoding = "async";
|
|
112
|
+
img.addEventListener("load", function () { img.classList.remove("empty", "shimmer"); });
|
|
113
|
+
img.setAttribute("loading", "lazy");
|
|
114
|
+
img.setAttribute("draggable", "false");
|
|
115
|
+
img.addEventListener("error", function () { img.setAttribute("data-error", "1"); });
|
|
116
|
+
if (item.thumbUrl) {
|
|
117
|
+
if (item.srcset) img.srcset = item.srcset;
|
|
118
|
+
img.src = item.thumbUrl;
|
|
119
|
+
} else if (item.load) item.load(img, "thumb");
|
|
120
|
+
b.appendChild(img);
|
|
121
|
+
var check = el("span", "check");
|
|
122
|
+
check.innerHTML = glyph(GLYPH.check, 15, 3);
|
|
123
|
+
b.appendChild(check);
|
|
124
|
+
b.addEventListener("click", function () { g.opts.onToggle(item.id); });
|
|
125
|
+
b.addEventListener("dblclick", function (e) { e.preventDefault(); openLargeView(g, index); });
|
|
126
|
+
tile.appendChild(b);
|
|
127
|
+
tile.appendChild(glyphButton(t("expand"), GLYPH.expand, "zoombtn", function (e) { e.stopPropagation(); openLargeView(g, index); }));
|
|
128
|
+
return tile;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ---- the large view ----
|
|
132
|
+
var largeView = null;
|
|
133
|
+
function openLargeView(g, index) {
|
|
134
|
+
closeLargeView();
|
|
135
|
+
// As a design's large view does: from the card it asks for the workspace, so the picture has the whole window.
|
|
136
|
+
if (!isFullscreen() && canFullscreen()) requestMode("fullscreen");
|
|
137
|
+
var lv = { g: g, index: index, opener: document.activeElement, els: {} };
|
|
138
|
+
var box = el("div", "bigview");
|
|
139
|
+
box.setAttribute("role", "dialog");
|
|
140
|
+
box.setAttribute("aria-modal", "true");
|
|
141
|
+
var bar = el("div", "bvbar");
|
|
142
|
+
lv.els.count = el("span", "bvcount");
|
|
143
|
+
lv.els.pick = button("", "bvpick", function () { var item = g.items[lv.index]; if (item) g.opts.onToggle(item.id); syncLargeView(); });
|
|
144
|
+
lv.els.close = glyphButton(t("close"), GLYPH.close, "iconbtn bvclose", closeLargeView);
|
|
145
|
+
// A live site opens in the host's browser.
|
|
146
|
+
lv.els.open = glyphButton(t("referencesOpenSite"), GLYPH.open, "iconbtn bvopen", function () { var item = g.items[lv.index]; if (item && item.sourceUrl) openSite(item.sourceUrl); });
|
|
147
|
+
bar.appendChild(lv.els.count);
|
|
148
|
+
bar.appendChild(el("span", "spacer"));
|
|
149
|
+
bar.appendChild(lv.els.open);
|
|
150
|
+
bar.appendChild(lv.els.pick);
|
|
151
|
+
bar.appendChild(lv.els.close);
|
|
152
|
+
var view = el("div", "bvview");
|
|
153
|
+
lv.els.img = el("img", "bvimg");
|
|
154
|
+
lv.els.img.alt = "";
|
|
155
|
+
lv.els.img.setAttribute("draggable", "false");
|
|
156
|
+
lv.els.prev = glyphButton(t("previous"), GLYPH.prev, "bvnav bvprev", function () { stepLargeView(-1); });
|
|
157
|
+
lv.els.next = glyphButton(t("next"), GLYPH.next, "bvnav bvnext", function () { stepLargeView(1); });
|
|
158
|
+
view.appendChild(lv.els.img);
|
|
159
|
+
view.appendChild(lv.els.prev);
|
|
160
|
+
view.appendChild(lv.els.next);
|
|
161
|
+
box.appendChild(bar);
|
|
162
|
+
box.appendChild(view);
|
|
163
|
+
// A click on the dimmed space around the picture closes the view.
|
|
164
|
+
view.addEventListener("click", function (e) { if (e.target === view) closeLargeView(); });
|
|
165
|
+
lv.els.box = box;
|
|
166
|
+
document.body.appendChild(box);
|
|
167
|
+
largeView = lv;
|
|
168
|
+
syncLargeView();
|
|
169
|
+
lv.els.close.focus();
|
|
170
|
+
}
|
|
171
|
+
function syncLargeView() {
|
|
172
|
+
var lv = largeView;
|
|
173
|
+
if (!lv) return;
|
|
174
|
+
var item = lv.g.items[lv.index];
|
|
175
|
+
if (!item) { closeLargeView(); return; }
|
|
176
|
+
if (lv.shownId !== item.id) {
|
|
177
|
+
lv.shownId = item.id;
|
|
178
|
+
var fresh = el("img", "bvimg");
|
|
179
|
+
fresh.alt = item.label || "";
|
|
180
|
+
fresh.setAttribute("draggable", "false");
|
|
181
|
+
if (item.imageUrl) fresh.src = item.imageUrl;
|
|
182
|
+
else if (item.load) item.load(fresh, "ref");
|
|
183
|
+
lv.els.img.parentNode.replaceChild(fresh, lv.els.img);
|
|
184
|
+
lv.els.img = fresh;
|
|
185
|
+
lv.els.box.setAttribute("aria-label", item.label || "");
|
|
186
|
+
}
|
|
187
|
+
lv.els.open.classList.toggle("hidden", !item.sourceUrl);
|
|
188
|
+
var picked = lv.g.opts.isSelected(item.id);
|
|
189
|
+
lv.els.pick.innerHTML = picked ? glyph(GLYPH.check, 15, 3) : "";
|
|
190
|
+
lv.els.pick.appendChild(document.createTextNode(picked ? t("selected") : t("select")));
|
|
191
|
+
lv.els.pick.className = "bvpick" + (picked ? " on" : " primary");
|
|
192
|
+
lv.els.pick.setAttribute("aria-pressed", picked ? "true" : "false");
|
|
193
|
+
lv.els.count.textContent = (lv.index + 1) + " / " + lv.g.items.length;
|
|
194
|
+
lv.els.prev.disabled = lv.index <= 0;
|
|
195
|
+
lv.els.next.disabled = lv.index >= lv.g.items.length - 1;
|
|
196
|
+
}
|
|
197
|
+
function stepLargeView(delta) {
|
|
198
|
+
var lv = largeView;
|
|
199
|
+
if (!lv) return;
|
|
200
|
+
var next = Math.max(0, Math.min(lv.g.items.length - 1, lv.index + delta));
|
|
201
|
+
if (next === lv.index) return;
|
|
202
|
+
lv.index = next;
|
|
203
|
+
// Stepping past what the grid shows reveals it there too.
|
|
204
|
+
while (lv.g.shown <= next && revealPage(lv.g)) { /* keep revealing */ }
|
|
205
|
+
syncLargeView();
|
|
206
|
+
}
|
|
207
|
+
function closeLargeView() {
|
|
208
|
+
var lv = largeView;
|
|
209
|
+
if (!lv) return;
|
|
210
|
+
largeView = null;
|
|
211
|
+
if (lv.els.box.parentNode) lv.els.box.parentNode.removeChild(lv.els.box);
|
|
212
|
+
if (lv.opener && lv.opener.isConnected && lv.opener.focus) lv.opener.focus();
|
|
213
|
+
}
|
|
214
|
+
document.addEventListener("keydown", function (e) {
|
|
215
|
+
if (!largeView) return;
|
|
216
|
+
if (e.key === "Escape") { e.preventDefault(); e.stopImmediatePropagation(); closeLargeView(); }
|
|
217
|
+
else if (e.key === "ArrowLeft") { e.preventDefault(); stepLargeView(-1); }
|
|
218
|
+
else if (e.key === "ArrowRight") { e.preventDefault(); stepLargeView(1); }
|
|
219
|
+
}, true);
|
|
220
|
+
`;
|
|
221
|
+
//# sourceMappingURL=mcp-slate-ui-script-inspiration-gallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-slate-ui-script-inspiration-gallery.js","sourceRoot":"","sources":["../src/mcp-slate-ui-script-inspiration-gallery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsMrD,CAAC"}
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Inspiration tab's page, the same in the card and the workspace:
|
|
3
|
-
* search
|
|
4
|
-
* a line that says how many results the grid shows and why no more, the grid,
|
|
5
|
-
* and, while references are selected, Generate.
|
|
2
|
+
* The Inspiration tab's page, the same in the card and the workspace: one status line (what went wrong, when anything
|
|
3
|
+
* did), the gallery of the search's results, and the tray. The search itself is the prompt card above the tabs.
|
|
6
4
|
*
|
|
7
|
-
* - The
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* is
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
18
|
-
*
|
|
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.
|
|
5
|
+
* - The gallery (mcp-slate-ui-script-inspiration-gallery.ts) shows the search the grid follows, a page at a time as
|
|
6
|
+
* the person scrolls; the first search of a workspace without one shows skeleton tiles until it lands, and a new
|
|
7
|
+
* search keeps the old results, dimmed, until the new ones arrive.
|
|
8
|
+
* - The tray holds the picks the next drawing uses, so they stay in sight whatever the grid shows: a small picture of
|
|
9
|
+
* each (a click takes it out) and the one action (how many is said once, in the tab row). While a round waits for its references the picks are
|
|
10
|
+
* that round's, the action is Continue and the countdown shows beside it; otherwise the picks are the selection and
|
|
11
|
+
* the action is Generate: one new round drawn from exactly them, Generate more's own request (`startRound`, which
|
|
12
|
+
* first waits for the selection write), drawing the panel's default count, or the next count up when more are
|
|
13
|
+
* picked, so every pick is drawn from at least once. Either way the screen then moves on to Designs.
|
|
14
|
+
* - In the card the results scroll inside themselves (the host grows the frame and never scrolls the thread, so a long
|
|
15
|
+
* page would push the card out of sight) and the tray sits under them; in the workspace the page scrolls and the tray
|
|
16
|
+
* sticks to the bottom of the window.
|
|
24
17
|
*/
|
|
25
18
|
export declare const SLATE_UI_INSPIRATION_GRID: string;
|
|
26
19
|
//# sourceMappingURL=mcp-slate-ui-script-inspiration-grid.d.ts.map
|
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yBAAyB,QA2JrC,CAAC"}
|