@bison-lab/payload-core 4.12.4 → 4.15.0

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.
Files changed (45) hide show
  1. package/README.md +93 -5
  2. package/dist/admin.d.mts +14 -1
  3. package/dist/admin.d.mts.map +1 -1
  4. package/dist/admin.mjs +170 -22
  5. package/dist/admin.mjs.map +1 -1
  6. package/dist/block-library.d.mts +30 -2
  7. package/dist/block-library.d.mts.map +1 -0
  8. package/dist/block-library.mjs +33 -1
  9. package/dist/block-library.mjs.map +1 -0
  10. package/dist/{catalogue-9MO2jy69.d.mts → catalogue-CFXM1yAZ.d.mts} +8 -1
  11. package/dist/catalogue-CFXM1yAZ.d.mts.map +1 -0
  12. package/dist/{facet-field-DHpNdS_u.d.mts → facet-field-_8bYI1i0.d.mts} +1 -1
  13. package/dist/{facet-field-DHpNdS_u.d.mts.map → facet-field-_8bYI1i0.d.mts.map} +1 -1
  14. package/dist/index.d.mts +53 -6
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +199 -2
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/{looks-BbL309kO.mjs → island-97l5VY8l.mjs} +23 -2
  19. package/dist/island-97l5VY8l.mjs.map +1 -0
  20. package/dist/metadata.d.mts +1 -1
  21. package/dist/navigation.d.mts +1 -1
  22. package/dist/{preview-D-Psltpf.d.mts → preview-Vaa1KXJP.d.mts} +1 -1
  23. package/dist/{preview-D-Psltpf.d.mts.map → preview-Vaa1KXJP.d.mts.map} +1 -1
  24. package/dist/published-BjmUCpdY.mjs.map +1 -1
  25. package/dist/{published-DhARD4W8.d.mts → published-FUgC5Mc8.d.mts} +1 -1
  26. package/dist/{published-DhARD4W8.d.mts.map → published-FUgC5Mc8.d.mts.map} +1 -1
  27. package/dist/react.d.mts +21 -1
  28. package/dist/react.d.mts.map +1 -1
  29. package/dist/react.mjs +47 -3
  30. package/dist/react.mjs.map +1 -1
  31. package/dist/taxonomy.d.mts +1 -1
  32. package/dist/theme.d.mts +1 -1
  33. package/dist/{title-7VASfaFO.d.mts → title-ImlifZ_6.d.mts} +1 -1
  34. package/dist/{title-7VASfaFO.d.mts.map → title-ImlifZ_6.d.mts.map} +1 -1
  35. package/dist/wireframe-BTocmmyY.mjs +298 -0
  36. package/dist/wireframe-BTocmmyY.mjs.map +1 -0
  37. package/dist/wireframe-cli.d.mts +1 -0
  38. package/dist/wireframe-cli.mjs +110 -0
  39. package/dist/wireframe-cli.mjs.map +1 -0
  40. package/dist/wireframe.d.mts +119 -0
  41. package/dist/wireframe.d.mts.map +1 -0
  42. package/dist/wireframe.mjs +2 -0
  43. package/package.json +11 -4
  44. package/dist/catalogue-9MO2jy69.d.mts.map +0 -1
  45. package/dist/looks-BbL309kO.mjs.map +0 -1
@@ -0,0 +1,298 @@
1
+ //#region src/wireframe.ts
2
+ /**
3
+ * Black-and-white wireframes of Block library samples, for Payload's Add
4
+ * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a
5
+ * script drives a browser to each block's preview (`previewPath(slug)`),
6
+ * `extractWireframe` reads where the headings, text, images, buttons and
7
+ * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.
8
+ * No copy and no brand color reach the picture, so it does not go stale
9
+ * when Theme changes; rerun it when a block's layout does.
10
+ */
11
+ /** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */
12
+ const WIREFRAME_WIDTH = 480;
13
+ const WIREFRAME_HEIGHT = 320;
14
+ /** Desktop width, so the picture is the layout most visitors see. */
15
+ const WIREFRAME_VIEWPORT = {
16
+ width: 1280,
17
+ height: 900
18
+ };
19
+ /** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */
20
+ const WIREFRAME_ROOT = "[data-block-library-island]";
21
+ /**
22
+ * Runs in the page (Playwright's `page.evaluate`), so it closes over
23
+ * nothing: every helper is declared inside. Boxes are relative to the
24
+ * element `selector` names (the preview's island), in CSS pixels.
25
+ */
26
+ function extractWireframe(selector) {
27
+ const root = document.querySelector(selector);
28
+ if (!root) throw new Error(`no element matches ${selector}`);
29
+ const origin = root.getBoundingClientRect();
30
+ const shapes = [];
31
+ const taken = /* @__PURE__ */ new Set();
32
+ const parseColor = (value) => {
33
+ const match = value.match(/rgba?\(([^)]+)\)/);
34
+ if (!match) return null;
35
+ const parts = match[1].split(/[\s,/]+/).filter(Boolean).map(Number);
36
+ return [
37
+ parts[0] ?? 0,
38
+ parts[1] ?? 0,
39
+ parts[2] ?? 0,
40
+ parts[3] ?? 1
41
+ ];
42
+ };
43
+ const luminance = (rgb) => (.2126 * rgb[0] + .7152 * rgb[1] + .0722 * rgb[2]) / 255;
44
+ const style = (element) => getComputedStyle(element);
45
+ const shown = (element) => {
46
+ const css = style(element);
47
+ return css.display !== "none" && css.visibility !== "hidden" && Number(css.opacity || "1") > .05;
48
+ };
49
+ const box = (element) => {
50
+ const rect = element.getBoundingClientRect();
51
+ return {
52
+ x: Math.round(rect.left - origin.left),
53
+ y: Math.round(rect.top - origin.top),
54
+ w: Math.round(rect.width),
55
+ h: Math.round(rect.height)
56
+ };
57
+ };
58
+ /** The fill an element paints, if any: a solid color, or a gradient's first stop. */
59
+ const fillOf = (element) => {
60
+ const css = style(element);
61
+ const solid = parseColor(css.backgroundColor);
62
+ if (solid && solid[3] >= .5) return solid;
63
+ if (css.backgroundImage.includes("gradient")) return parseColor(css.backgroundImage);
64
+ return null;
65
+ };
66
+ /** Light marks when the nearest painted ancestor is dark. */
67
+ const toneUnder = (element) => {
68
+ for (let node = element; node; node = node.parentElement) {
69
+ const fill = fillOf(node);
70
+ if (fill) return luminance(fill) < .45 ? "light" : "dark";
71
+ if (node === root) break;
72
+ }
73
+ return "dark";
74
+ };
75
+ const insideTaken = (element) => {
76
+ for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;
77
+ return false;
78
+ };
79
+ const page = parseColor(style(document.body).backgroundColor);
80
+ const pageLum = page && page[3] >= .5 ? luminance(page) : 1;
81
+ const elements = root.querySelectorAll("*");
82
+ for (const element of Array.from(elements)) {
83
+ if (insideTaken(element.parentElement) || !shown(element)) continue;
84
+ const at = box(element);
85
+ if (at.w < 2 || at.h < 2) continue;
86
+ const tag = element.tagName.toLowerCase();
87
+ const css = style(element);
88
+ if (tag === "img" || tag === "picture" || tag === "video" || tag === "canvas" || tag === "iframe") {
89
+ shapes.push({
90
+ kind: "image",
91
+ ...at
92
+ });
93
+ taken.add(element);
94
+ continue;
95
+ }
96
+ if (tag === "svg") {
97
+ if (at.w >= 48 && at.h >= 48) shapes.push({
98
+ kind: "image",
99
+ ...at
100
+ });
101
+ else {
102
+ const color = parseColor(css.color);
103
+ shapes.push({
104
+ kind: "icon",
105
+ ...at,
106
+ tone: color && luminance(color) > .5 ? "light" : "dark"
107
+ });
108
+ }
109
+ taken.add(element);
110
+ continue;
111
+ }
112
+ if (tag === "input" || tag === "select" || tag === "textarea") {
113
+ if (element.type !== "hidden") shapes.push({
114
+ kind: "field",
115
+ ...at
116
+ });
117
+ taken.add(element);
118
+ continue;
119
+ }
120
+ const fill = fillOf(element);
121
+ const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== "none";
122
+ if ((tag === "a" || tag === "button" || element.getAttribute("role") === "button") && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {
123
+ shapes.push({
124
+ kind: "button",
125
+ ...at,
126
+ filled: Boolean(fill),
127
+ tone: toneUnder(element.parentElement ?? element)
128
+ });
129
+ taken.add(element);
130
+ continue;
131
+ }
132
+ if (/url\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {
133
+ shapes.push({
134
+ kind: "image",
135
+ ...at
136
+ });
137
+ continue;
138
+ }
139
+ if (fill && at.w >= 160 && at.h >= 80) {
140
+ const lum = luminance(fill);
141
+ if (lum < .45) shapes.push({
142
+ kind: "surface",
143
+ ...at,
144
+ tone: "dark"
145
+ });
146
+ else if (Math.abs(lum - pageLum) > .03) shapes.push({
147
+ kind: "surface",
148
+ ...at,
149
+ tone: "light"
150
+ });
151
+ continue;
152
+ }
153
+ if (!fill && border && at.w >= 120 && at.h >= 60) shapes.push({
154
+ kind: "frame",
155
+ ...at,
156
+ tone: toneUnder(element)
157
+ });
158
+ }
159
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
160
+ const lines = [];
161
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) {
162
+ const parent = node.parentElement;
163
+ if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;
164
+ const css = style(parent);
165
+ const size = parseFloat(css.fontSize) || 16;
166
+ const heading = Boolean(parent.closest("h1,h2,h3,h4,h5,h6")) || size >= 22;
167
+ const color = parseColor(css.color);
168
+ const tone = color && luminance(color) > .5 ? "light" : "dark";
169
+ const range = document.createRange();
170
+ range.selectNodeContents(node);
171
+ for (const rect of Array.from(range.getClientRects())) {
172
+ if (rect.width < 2 || rect.height < 2) continue;
173
+ const bar = Math.max(3, Math.round(size * (heading ? .62 : .5)));
174
+ const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);
175
+ const x = Math.round(rect.left - origin.left);
176
+ const w = Math.round(rect.width);
177
+ const kind = heading ? "heading" : "text";
178
+ const previous = lines[lines.length - 1];
179
+ if (previous && previous.kind === kind && "tone" in previous && previous.tone === tone && Math.abs(previous.y - y) <= 3 && x - (previous.x + previous.w) <= 14) {
180
+ previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;
181
+ continue;
182
+ }
183
+ lines.push({
184
+ kind,
185
+ x,
186
+ y,
187
+ w,
188
+ h: bar,
189
+ tone
190
+ });
191
+ }
192
+ }
193
+ return {
194
+ width: Math.round(origin.width),
195
+ height: Math.round(origin.height),
196
+ shapes: [...shapes, ...lines]
197
+ };
198
+ }
199
+ const PAPER = "#ffffff";
200
+ const INK = "#262626";
201
+ const LIGHT_INK = "#f5f5f5";
202
+ const PALETTE = {
203
+ frame: "#d4d4d4",
204
+ imageFill: "#e5e5e5",
205
+ imageLine: "#a3a3a3",
206
+ tint: "#f0f0f0",
207
+ textOnPaper: "#a3a3a3",
208
+ textOnDark: "#8a8a8a",
209
+ buttonOnPaper: "#525252",
210
+ buttonOnDark: "#d4d4d4"
211
+ };
212
+ const DRAW_ORDER = {
213
+ surface: 0,
214
+ frame: 1,
215
+ image: 2,
216
+ field: 3,
217
+ button: 4,
218
+ icon: 5,
219
+ heading: 6,
220
+ text: 7
221
+ };
222
+ const n = (value) => String(Math.round(value * 10) / 10);
223
+ /**
224
+ * A capture as a 480 × 320 greyscale SVG. The block is scaled to the
225
+ * width; a short block is centered, a tall one keeps its top and is clipped.
226
+ * Surfaces first, text last, so marks sit on what they sit on in the page.
227
+ */
228
+ function wireframeSvg(capture) {
229
+ const scale = capture.width > 0 ? 480 / capture.width : 1;
230
+ const drawn = capture.height * scale;
231
+ const offset = drawn < 320 ? (320 - drawn) / 2 : 0;
232
+ const at = (shape) => ({
233
+ x: n(shape.x * scale),
234
+ y: n(shape.y * scale + offset),
235
+ w: n(Math.max(shape.w * scale, 1)),
236
+ h: n(Math.max(shape.h * scale, 1))
237
+ });
238
+ const marks = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]).map((shape) => {
239
+ const { x, y, w, h } = at(shape);
240
+ const r = (radius) => `rx='${n(radius)}'`;
241
+ switch (shape.kind) {
242
+ case "surface": return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === "dark" ? INK : PALETTE.tint}'/>`;
243
+ case "frame": return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === "light" ? PALETTE.textOnDark : PALETTE.frame}'/>`;
244
+ case "image": {
245
+ const x2 = n(Number(x) + Number(w));
246
+ const y2 = n(Number(y) + Number(h));
247
+ return `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/><path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`;
248
+ }
249
+ case "field": return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;
250
+ case "button": {
251
+ const color = shape.tone === "light" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;
252
+ const pill = r(Number(h) / 2);
253
+ return shape.filled ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>` : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;
254
+ }
255
+ case "icon": return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === "light" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;
256
+ case "heading": return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === "light" ? LIGHT_INK : INK}'/>`;
257
+ case "text": return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === "light" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;
258
+ }
259
+ });
260
+ return `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 320'><defs><clipPath id='c'><rect width='480' height='320'/></clipPath></defs><rect width='480' height='320' fill='${PAPER}'/><g clip-path='url(#c)'>` + marks.join("") + `</g></svg>`;
261
+ }
262
+ /**
263
+ * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters
264
+ * a URI cannot carry are escaped, so the string stays close to the SVG's
265
+ * own size; the SVG must use single quotes.
266
+ */
267
+ function svgDataUri(svg) {
268
+ return `data:image/svg+xml,${svg.replace(/"/g, "'").replace(/\s+/g, " ").replace(/[%#<>{}|\\^`\r\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`)}`;
269
+ }
270
+ /**
271
+ * Opens each preview at desktop width, waits for its fonts, and returns
272
+ * one SVG per slug. The page must already be signed in when the preview
273
+ * route needs it (the Block library's does). A preview that answers 400 or
274
+ * more, or renders no element `selector` matches, throws: nothing is
275
+ * written for a page that did not draw its sample.
276
+ */
277
+ async function captureWireframes(page, previews, { selector = WIREFRAME_ROOT } = {}) {
278
+ await page.setViewportSize({ ...WIREFRAME_VIEWPORT });
279
+ const out = {};
280
+ for (const { slug, url } of previews) {
281
+ const response = await page.goto(url, { waitUntil: "networkidle" });
282
+ const status = response ? response.status() : 200;
283
+ if (status >= 400) throw new Error(`${slug}: ${url} answered ${status}; is the server up, the slug right, and the login one the route accepts?`);
284
+ await page.evaluate(() => document.fonts.ready.then(() => void 0), void 0);
285
+ let capture;
286
+ try {
287
+ capture = await page.evaluate(extractWireframe, selector);
288
+ } catch (error) {
289
+ throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });
290
+ }
291
+ out[slug] = wireframeSvg(capture);
292
+ }
293
+ return out;
294
+ }
295
+ //#endregion
296
+ export { captureWireframes as a, wireframeSvg as c, WIREFRAME_WIDTH as i, WIREFRAME_ROOT as n, extractWireframe as o, WIREFRAME_VIEWPORT as r, svgDataUri as s, WIREFRAME_HEIGHT as t };
297
+
298
+ //# sourceMappingURL=wireframe-BTocmmyY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireframe-BTocmmyY.mjs","names":[],"sources":["../src/wireframe.ts"],"sourcesContent":["/**\n * Black-and-white wireframes of Block library samples, for Payload's Add\n * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a\n * script drives a browser to each block's preview (`previewPath(slug)`),\n * `extractWireframe` reads where the headings, text, images, buttons and\n * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.\n * No copy and no brand color reach the picture, so it does not go stale\n * when Theme changes; rerun it when a block's layout does.\n */\n\n/** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */\nexport const WIREFRAME_WIDTH = 480;\nexport const WIREFRAME_HEIGHT = 320;\n\n/** Desktop width, so the picture is the layout most visitors see. */\nexport const WIREFRAME_VIEWPORT = { width: 1280, height: 900 } as const;\n\n/** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */\nexport const WIREFRAME_ROOT = \"[data-block-library-island]\";\n\n/** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */\nexport type WireframeTone = \"light\" | \"dark\";\n\nexport type WireframeShape =\n /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */\n | { kind: \"surface\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n /** A bordered card with no fill of its own. */\n | { kind: \"frame\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"image\"; x: number; y: number; w: number; h: number }\n | { kind: \"heading\" | \"text\" | \"icon\"; x: number; y: number; w: number; h: number; tone: WireframeTone }\n | { kind: \"button\"; x: number; y: number; w: number; h: number; filled: boolean; tone: WireframeTone }\n | { kind: \"field\"; x: number; y: number; w: number; h: number };\n\nexport type WireframeCapture = { width: number; height: number; shapes: WireframeShape[] };\n\n/**\n * Runs in the page (Playwright's `page.evaluate`), so it closes over\n * nothing: every helper is declared inside. Boxes are relative to the\n * element `selector` names (the preview's island), in CSS pixels.\n */\nexport function extractWireframe(selector: string): WireframeCapture {\n const root = document.querySelector(selector);\n // No sample on the page (a sign-in wall, a 404, a wrong selector): refuse,\n // rather than draw whatever page came back as the block's picture.\n if (!root) throw new Error(`no element matches ${selector}`);\n const origin = root.getBoundingClientRect();\n const shapes: WireframeShape[] = [];\n const taken = new Set<Element>();\n\n const parseColor = (value: string): [number, number, number, number] | null => {\n const match = value.match(/rgba?\\(([^)]+)\\)/);\n if (!match) return null;\n const parts = match[1]!.split(/[\\s,/]+/).filter(Boolean).map(Number);\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0, parts[3] ?? 1];\n };\n const luminance = (rgb: [number, number, number, number]) => (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;\n const style = (element: Element) => getComputedStyle(element);\n const shown = (element: Element) => {\n const css = style(element);\n return css.display !== \"none\" && css.visibility !== \"hidden\" && Number(css.opacity || \"1\") > 0.05;\n };\n const box = (element: Element) => {\n const rect = element.getBoundingClientRect();\n return {\n x: Math.round(rect.left - origin.left),\n y: Math.round(rect.top - origin.top),\n w: Math.round(rect.width),\n h: Math.round(rect.height),\n };\n };\n /** The fill an element paints, if any: a solid color, or a gradient's first stop. */\n const fillOf = (element: Element) => {\n const css = style(element);\n const solid = parseColor(css.backgroundColor);\n if (solid && solid[3] >= 0.5) return solid;\n if (css.backgroundImage.includes(\"gradient\")) return parseColor(css.backgroundImage);\n return null;\n };\n /** Light marks when the nearest painted ancestor is dark. */\n const toneUnder = (element: Element): WireframeTone => {\n for (let node: Element | null = element; node; node = node.parentElement) {\n const fill = fillOf(node);\n if (fill) return luminance(fill) < 0.45 ? \"light\" : \"dark\";\n if (node === root) break;\n }\n return \"dark\";\n };\n const insideTaken = (element: Element | null) => {\n for (let node = element; node && node !== root; node = node.parentElement) if (taken.has(node)) return true;\n return false;\n };\n\n const page = parseColor(style(document.body).backgroundColor);\n const pageLum = page && page[3] >= 0.5 ? luminance(page) : 1;\n\n const elements = root.querySelectorAll(\"*\");\n for (const element of Array.from(elements)) {\n if (insideTaken(element.parentElement) || !shown(element)) continue;\n const at = box(element);\n if (at.w < 2 || at.h < 2) continue;\n const tag = element.tagName.toLowerCase();\n const css = style(element);\n\n if (tag === \"img\" || tag === \"picture\" || tag === \"video\" || tag === \"canvas\" || tag === \"iframe\") {\n shapes.push({ kind: \"image\", ...at });\n taken.add(element);\n continue;\n }\n if (tag === \"svg\") {\n if (at.w >= 48 && at.h >= 48) shapes.push({ kind: \"image\", ...at });\n else {\n const color = parseColor(css.color);\n shapes.push({ kind: \"icon\", ...at, tone: color && luminance(color) > 0.5 ? \"light\" : \"dark\" });\n }\n taken.add(element);\n continue;\n }\n if (tag === \"input\" || tag === \"select\" || tag === \"textarea\") {\n if ((element as HTMLInputElement).type !== \"hidden\") shapes.push({ kind: \"field\", ...at });\n taken.add(element);\n continue;\n }\n\n const fill = fillOf(element);\n const border = parseFloat(css.borderTopWidth) >= 1 && css.borderTopStyle !== \"none\";\n const action = tag === \"a\" || tag === \"button\" || element.getAttribute(\"role\") === \"button\";\n if (action && (fill || border) && at.h >= 24 && at.h <= 80 && at.w <= 480) {\n shapes.push({ kind: \"button\", ...at, filled: Boolean(fill), tone: toneUnder(element.parentElement ?? element) });\n taken.add(element);\n continue;\n }\n if (/url\\(/.test(css.backgroundImage) && at.w >= 48 && at.h >= 48) {\n shapes.push({ kind: \"image\", ...at });\n continue;\n }\n if (fill && at.w >= 160 && at.h >= 80) {\n const lum = luminance(fill);\n if (lum < 0.45) shapes.push({ kind: \"surface\", ...at, tone: \"dark\" });\n else if (Math.abs(lum - pageLum) > 0.03) shapes.push({ kind: \"surface\", ...at, tone: \"light\" });\n continue;\n }\n if (!fill && border && at.w >= 120 && at.h >= 60) {\n shapes.push({ kind: \"frame\", ...at, tone: toneUnder(element) });\n }\n }\n\n // Text, one bar per rendered line, merged along the line.\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n const lines: WireframeShape[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const parent = node.parentElement;\n if (!parent || !node.textContent?.trim() || insideTaken(parent) || !shown(parent)) continue;\n const css = style(parent);\n const size = parseFloat(css.fontSize) || 16;\n const heading = Boolean(parent.closest(\"h1,h2,h3,h4,h5,h6\")) || size >= 22;\n const color = parseColor(css.color);\n const tone: WireframeTone = color && luminance(color) > 0.5 ? \"light\" : \"dark\";\n const range = document.createRange();\n range.selectNodeContents(node);\n for (const rect of Array.from(range.getClientRects())) {\n if (rect.width < 2 || rect.height < 2) continue;\n const bar = Math.max(3, Math.round(size * (heading ? 0.62 : 0.5)));\n const y = Math.round(rect.top - origin.top + (rect.height - bar) / 2);\n const x = Math.round(rect.left - origin.left);\n const w = Math.round(rect.width);\n const kind = heading ? \"heading\" : \"text\";\n const previous = lines[lines.length - 1];\n if (\n previous &&\n previous.kind === kind &&\n \"tone\" in previous &&\n previous.tone === tone &&\n Math.abs(previous.y - y) <= 3 &&\n x - (previous.x + previous.w) <= 14\n ) {\n previous.w = Math.max(previous.x + previous.w, x + w) - previous.x;\n continue;\n }\n lines.push({ kind, x, y, w, h: bar, tone });\n }\n }\n\n return { width: Math.round(origin.width), height: Math.round(origin.height), shapes: [...shapes, ...lines] };\n}\n\nconst PAPER = \"#ffffff\";\nconst INK = \"#262626\";\nconst LIGHT_INK = \"#f5f5f5\";\nconst PALETTE = {\n frame: \"#d4d4d4\",\n imageFill: \"#e5e5e5\",\n imageLine: \"#a3a3a3\",\n tint: \"#f0f0f0\",\n textOnPaper: \"#a3a3a3\",\n textOnDark: \"#8a8a8a\",\n buttonOnPaper: \"#525252\",\n buttonOnDark: \"#d4d4d4\",\n} as const;\n\nconst DRAW_ORDER: Record<WireframeShape[\"kind\"], number> = {\n surface: 0,\n frame: 1,\n image: 2,\n field: 3,\n button: 4,\n icon: 5,\n heading: 6,\n text: 7,\n};\n\nconst n = (value: number) => String(Math.round(value * 10) / 10);\n\n/**\n * A capture as a 480 × 320 greyscale SVG. The block is scaled to the\n * width; a short block is centered, a tall one keeps its top and is clipped.\n * Surfaces first, text last, so marks sit on what they sit on in the page.\n */\nexport function wireframeSvg(capture: WireframeCapture): string {\n const scale = capture.width > 0 ? WIREFRAME_WIDTH / capture.width : 1;\n const drawn = capture.height * scale;\n const offset = drawn < WIREFRAME_HEIGHT ? (WIREFRAME_HEIGHT - drawn) / 2 : 0;\n const at = (shape: { x: number; y: number; w: number; h: number }) => ({\n x: n(shape.x * scale),\n y: n(shape.y * scale + offset),\n w: n(Math.max(shape.w * scale, 1)),\n h: n(Math.max(shape.h * scale, 1)),\n });\n const shapes = [...capture.shapes].sort((a, b) => DRAW_ORDER[a.kind] - DRAW_ORDER[b.kind]);\n\n const marks = shapes.map((shape) => {\n const { x, y, w, h } = at(shape);\n const r = (radius: number) => `rx='${n(radius)}'`;\n switch (shape.kind) {\n case \"surface\":\n return `<rect data-k='surface' x='${x}' y='${y}' width='${w}' height='${h}' fill='${shape.tone === \"dark\" ? INK : PALETTE.tint}'/>`;\n case \"frame\":\n return `<rect data-k='frame' x='${x}' y='${y}' width='${w}' height='${h}' ${r(4)} fill='none' stroke='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.frame}'/>`;\n case \"image\": {\n const x2 = n(Number(x) + Number(w));\n const y2 = n(Number(y) + Number(h));\n return (\n `<rect data-k='image' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PALETTE.imageFill}' stroke='${PALETTE.imageLine}'/>` +\n `<path data-k='image-x' d='M${x} ${y}L${x2} ${y2}M${x2} ${y}L${x} ${y2}' stroke='${PALETTE.imageLine}' stroke-width='0.75'/>`\n );\n }\n case \"field\":\n return `<rect data-k='field' x='${x}' y='${y}' width='${w}' height='${h}' ${r(3)} fill='${PAPER}' stroke='${PALETTE.imageLine}'/>`;\n case \"button\": {\n const color = shape.tone === \"light\" ? PALETTE.buttonOnDark : PALETTE.buttonOnPaper;\n const pill = r(Number(h) / 2);\n return shape.filled\n ? `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='${color}'/>`\n : `<rect data-k='button' x='${x}' y='${y}' width='${w}' height='${h}' ${pill} fill='none' stroke='${color}' stroke-width='1.25'/>`;\n }\n case \"icon\":\n return `<circle data-k='icon' cx='${n(Number(x) + Number(w) / 2)}' cy='${n(Number(y) + Number(h) / 2)}' r='${n(Math.min(Number(w), Number(h)) / 2)}' fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n case \"heading\":\n return `<rect data-k='heading' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? LIGHT_INK : INK}'/>`;\n case \"text\":\n return `<rect data-k='text' x='${x}' y='${y}' width='${w}' height='${h}' ${r(Number(h) / 2)} fill='${shape.tone === \"light\" ? PALETTE.textOnDark : PALETTE.textOnPaper}'/>`;\n }\n });\n\n return (\n `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${WIREFRAME_WIDTH} ${WIREFRAME_HEIGHT}'>` +\n `<defs><clipPath id='c'><rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}'/></clipPath></defs>` +\n `<rect width='${WIREFRAME_WIDTH}' height='${WIREFRAME_HEIGHT}' fill='${PAPER}'/>` +\n `<g clip-path='url(#c)'>` +\n marks.join(\"\") +\n `</g></svg>`\n );\n}\n\n/**\n * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters\n * a URI cannot carry are escaped, so the string stays close to the SVG's\n * own size; the SVG must use single quotes.\n */\nexport function svgDataUri(svg: string): string {\n const body = svg\n .replace(/\"/g, \"'\")\n .replace(/\\s+/g, \" \")\n .replace(/[%#<>{}|\\\\^`\\r\\n]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\")}`);\n return `data:image/svg+xml,${body}`;\n}\n\n/** The slice of Playwright's `Page` this needs; a site passes its own. */\nexport interface WireframePage {\n setViewportSize(size: { width: number; height: number }): Promise<void>;\n /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */\n goto(\n url: string,\n options?: { waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" },\n ): Promise<{ status(): number } | null | void>;\n evaluate<R, A>(fn: (arg: A) => R | Promise<R>, arg: A): Promise<R>;\n}\n\n/**\n * Opens each preview at desktop width, waits for its fonts, and returns\n * one SVG per slug. The page must already be signed in when the preview\n * route needs it (the Block library's does). A preview that answers 400 or\n * more, or renders no element `selector` matches, throws: nothing is\n * written for a page that did not draw its sample.\n */\nexport async function captureWireframes(\n page: WireframePage,\n previews: readonly { slug: string; url: string }[],\n { selector = WIREFRAME_ROOT }: { selector?: string } = {},\n): Promise<Record<string, string>> {\n await page.setViewportSize({ ...WIREFRAME_VIEWPORT });\n const out: Record<string, string> = {};\n for (const { slug, url } of previews) {\n const response = await page.goto(url, { waitUntil: \"networkidle\" });\n const status = response ? response.status() : 200;\n if (status >= 400) throw new Error(`${slug}: ${url} answered ${status}; is the server up, the slug right, and the login one the route accepts?`);\n await page.evaluate(() => document.fonts.ready.then(() => undefined), undefined);\n let capture: WireframeCapture;\n try {\n capture = await page.evaluate(extractWireframe, selector);\n } catch (error) {\n throw new Error(`${slug}: ${url} has no ${selector}; it did not render the sample`, { cause: error });\n }\n out[slug] = wireframeSvg(capture);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;;AAGhC,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;CAAK;;AAG9D,MAAa,iBAAiB;;;;;;AAsB9B,SAAgB,iBAAiB,UAAoC;CACnE,MAAM,OAAO,SAAS,cAAc,SAAS;AAG7C,KAAI,CAAC,KAAM,OAAM,IAAI,MAAM,sBAAsB,WAAW;CAC5D,MAAM,SAAS,KAAK,uBAAuB;CAC3C,MAAM,SAA2B,EAAE;CACnC,MAAM,wBAAQ,IAAI,KAAc;CAEhC,MAAM,cAAc,UAA2D;EAC7E,MAAM,QAAQ,MAAM,MAAM,mBAAmB;AAC7C,MAAI,CAAC,MAAO,QAAO;EACnB,MAAM,QAAQ,MAAM,GAAI,MAAM,UAAU,CAAC,OAAO,QAAQ,CAAC,IAAI,OAAO;AACpE,SAAO;GAAC,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAG,MAAM,MAAM;GAAE;;CAErE,MAAM,aAAa,SAA2C,QAAS,IAAI,KAAK,QAAS,IAAI,KAAK,QAAS,IAAI,MAAM;CACrH,MAAM,SAAS,YAAqB,iBAAiB,QAAQ;CAC7D,MAAM,SAAS,YAAqB;EAClC,MAAM,MAAM,MAAM,QAAQ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,EACxB;AACjC,OAAM,KAAK,gBAAgB,EAAE,GAAG,oBAAoB,CAAC;CACrD,MAAM,MAA8B,EAAE;AACtC,MAAK,MAAM,EAAE,MAAM,SAAS,UAAU;EACpC,MAAM,WAAW,MAAM,KAAK,KAAK,KAAK,EAAE,WAAW,eAAe,CAAC;EACnE,MAAM,SAAS,WAAW,SAAS,QAAQ,GAAG;AAC9C,MAAI,UAAU,IAAK,OAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,YAAY,OAAO,0EAA0E;AAChJ,QAAM,KAAK,eAAe,SAAS,MAAM,MAAM,WAAW,KAAA,EAAU,EAAE,KAAA,EAAU;EAChF,IAAI;AACJ,MAAI;AACF,aAAU,MAAM,KAAK,SAAS,kBAAkB,SAAS;WAClD,OAAO;AACd,SAAM,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,UAAU,SAAS,iCAAiC,EAAE,OAAO,OAAO,CAAC;;AAEvG,MAAI,QAAQ,aAAa,QAAQ;;AAEnC,QAAO"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env node
2
+ import { a as captureWireframes, s as svgDataUri } from "./wireframe-BTocmmyY.mjs";
3
+ import { createRequire } from "node:module";
4
+ import { mkdirSync, writeFileSync } from "node:fs";
5
+ import { dirname, join, resolve } from "node:path";
6
+ import { parseArgs } from "node:util";
7
+ //#region src/wireframe-cli.ts
8
+ /**
9
+ * `bison-wireframes`: writes a module of Add Block drawer thumbnails, one
10
+ * black-and-white wireframe per block, from a running site's Block library
11
+ * preview route. Run it from the site, which supplies Playwright and its
12
+ * browser; this package does not depend on either.
13
+ *
14
+ * WIREFRAME_EMAIL=… WIREFRAME_PASSWORD=… bison-wireframes \
15
+ * --base http://localhost:3039 \
16
+ * --slugs ctaBand,productMap \
17
+ * --out src/blocks/wireframes.generated.ts
18
+ *
19
+ * `--preview /block-library/{slug}` is the route (the default), `--selector`
20
+ * the element that holds the sample (default: `BlockLibraryIsland`'s), and
21
+ * `--users users` the auth collection to sign in to. The login is read from the
22
+ * environment, never from arguments, so it stays out of shell history, and
23
+ * is required unless `--no-login` names a public route. A preview that
24
+ * answers an error or renders no sample fails the run; nothing is written.
25
+ */
26
+ const { values } = parseArgs({ options: {
27
+ base: { type: "string" },
28
+ preview: {
29
+ type: "string",
30
+ default: "/block-library/{slug}"
31
+ },
32
+ selector: { type: "string" },
33
+ slugs: { type: "string" },
34
+ out: { type: "string" },
35
+ "svg-dir": { type: "string" },
36
+ users: {
37
+ type: "string",
38
+ default: "users"
39
+ },
40
+ export: {
41
+ type: "string",
42
+ default: "BLOCK_WIREFRAMES"
43
+ },
44
+ "no-login": {
45
+ type: "boolean",
46
+ default: false
47
+ }
48
+ } });
49
+ function fail(message) {
50
+ console.error(`bison-wireframes: ${message}`);
51
+ process.exit(1);
52
+ }
53
+ const base = values.base?.replace(/\/$/, "") ?? fail("--base is required");
54
+ const slugs = (values.slugs ?? fail("--slugs is required")).split(",").map((slug) => slug.trim()).filter(Boolean);
55
+ const out = values.out ?? fail("--out is required");
56
+ const email = process.env.WIREFRAME_EMAIL;
57
+ const password = process.env.WIREFRAME_PASSWORD;
58
+ if (!values["no-login"] && !(email && password)) fail("set WIREFRAME_EMAIL and WIREFRAME_PASSWORD, or pass --no-login for a public preview route");
59
+ const require = createRequire(join(process.cwd(), "package.json"));
60
+ let chromium;
61
+ try {
62
+ ({chromium} = require("playwright"));
63
+ } catch {
64
+ try {
65
+ ({chromium} = require("@playwright/test"));
66
+ } catch {
67
+ fail("needs playwright (or @playwright/test) installed in the project it runs from");
68
+ }
69
+ }
70
+ const browser = await chromium.launch();
71
+ try {
72
+ const context = await browser.newContext();
73
+ if (!values["no-login"]) {
74
+ const login = await context.request.post(`${base}/api/${values.users}/login`, { data: {
75
+ email,
76
+ password
77
+ } });
78
+ if (!login.ok()) fail(`sign-in to ${base} failed (${login.status()})`);
79
+ }
80
+ const svgs = await captureWireframes(await context.newPage(), slugs.map((slug) => ({
81
+ slug,
82
+ url: `${base}${values.preview.replace("{slug}", slug)}`
83
+ })), values.selector ? { selector: values.selector } : {});
84
+ if (values["svg-dir"]) {
85
+ mkdirSync(values["svg-dir"], { recursive: true });
86
+ for (const [slug, svg] of Object.entries(svgs)) writeFileSync(join(values["svg-dir"], `${slug}.svg`), svg);
87
+ }
88
+ const lines = Object.entries(svgs).map(([slug, svg]) => ` ${JSON.stringify(slug)}: ${JSON.stringify(svgDataUri(svg))},`);
89
+ const module = [
90
+ "// Generated by `bison-wireframes` (@bison-lab/payload-core) from each block's",
91
+ "// Block library preview. Do not edit by hand: rerun it when a layout changes.",
92
+ `export const ${values.export}: Record<string, string> = {`,
93
+ ...lines,
94
+ "};",
95
+ ""
96
+ ].join("\n");
97
+ const target = resolve(out);
98
+ mkdirSync(dirname(target), { recursive: true });
99
+ writeFileSync(target, module);
100
+ console.log(`bison-wireframes: wrote ${slugs.length} wireframes to ${out}`);
101
+ } catch (error) {
102
+ await browser.close();
103
+ fail(error instanceof Error ? error.message : String(error));
104
+ } finally {
105
+ await browser.close();
106
+ }
107
+ //#endregion
108
+ export {};
109
+
110
+ //# sourceMappingURL=wireframe-cli.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireframe-cli.mjs","names":[],"sources":["../src/wireframe-cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `bison-wireframes`: writes a module of Add Block drawer thumbnails, one\n * black-and-white wireframe per block, from a running site's Block library\n * preview route. Run it from the site, which supplies Playwright and its\n * browser; this package does not depend on either.\n *\n * WIREFRAME_EMAIL=… WIREFRAME_PASSWORD=… bison-wireframes \\\n * --base http://localhost:3039 \\\n * --slugs ctaBand,productMap \\\n * --out src/blocks/wireframes.generated.ts\n *\n * `--preview /block-library/{slug}` is the route (the default), `--selector`\n * the element that holds the sample (default: `BlockLibraryIsland`'s), and\n * `--users users` the auth collection to sign in to. The login is read from the\n * environment, never from arguments, so it stays out of shell history, and\n * is required unless `--no-login` names a public route. A preview that\n * answers an error or renders no sample fails the run; nothing is written.\n */\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\n\nimport { captureWireframes, svgDataUri, type WireframePage } from \"./wireframe\";\n\ntype Browser = {\n newContext(): Promise<{\n newPage(): Promise<WireframePage>;\n request: { post(url: string, options: { data: unknown }): Promise<{ ok(): boolean; status(): number }> };\n }>;\n close(): Promise<void>;\n};\n\nconst { values } = parseArgs({\n options: {\n base: { type: \"string\" },\n preview: { type: \"string\", default: \"/block-library/{slug}\" },\n selector: { type: \"string\" },\n slugs: { type: \"string\" },\n out: { type: \"string\" },\n \"svg-dir\": { type: \"string\" },\n users: { type: \"string\", default: \"users\" },\n export: { type: \"string\", default: \"BLOCK_WIREFRAMES\" },\n \"no-login\": { type: \"boolean\", default: false },\n },\n});\n\nfunction fail(message: string): never {\n console.error(`bison-wireframes: ${message}`);\n process.exit(1);\n}\n\nconst base = values.base?.replace(/\\/$/, \"\") ?? fail(\"--base is required\");\nconst slugs = (values.slugs ?? fail(\"--slugs is required\")).split(\",\").map((slug) => slug.trim()).filter(Boolean);\nconst out = values.out ?? fail(\"--out is required\");\nconst email = process.env.WIREFRAME_EMAIL;\nconst password = process.env.WIREFRAME_PASSWORD;\n// The Block library preview refuses a logged-out request, so a missing\n// login is an error unless the route is public (`--no-login`).\nif (!values[\"no-login\"] && !(email && password)) {\n fail(\"set WIREFRAME_EMAIL and WIREFRAME_PASSWORD, or pass --no-login for a public preview route\");\n}\n\n// Playwright from the site running this, not from this package.\nconst require = createRequire(join(process.cwd(), \"package.json\"));\nlet chromium: { launch(): Promise<Browser> };\ntry {\n ({ chromium } = require(\"playwright\") as { chromium: typeof chromium });\n} catch {\n try {\n ({ chromium } = require(\"@playwright/test\") as { chromium: typeof chromium });\n } catch {\n fail(\"needs playwright (or @playwright/test) installed in the project it runs from\");\n }\n}\n\nconst browser = await chromium.launch();\ntry {\n const context = await browser.newContext();\n if (!values[\"no-login\"]) {\n const login = await context.request.post(`${base}/api/${values.users}/login`, { data: { email, password } });\n if (!login.ok()) fail(`sign-in to ${base} failed (${login.status()})`);\n }\n const page = await context.newPage();\n const previews = slugs.map((slug) => ({ slug, url: `${base}${values.preview!.replace(\"{slug}\", slug)}` }));\n const svgs = await captureWireframes(page, previews, values.selector ? { selector: values.selector } : {});\n\n if (values[\"svg-dir\"]) {\n mkdirSync(values[\"svg-dir\"], { recursive: true });\n for (const [slug, svg] of Object.entries(svgs)) writeFileSync(join(values[\"svg-dir\"], `${slug}.svg`), svg);\n }\n\n const lines = Object.entries(svgs).map(([slug, svg]) => ` ${JSON.stringify(slug)}: ${JSON.stringify(svgDataUri(svg))},`);\n const module = [\n \"// Generated by `bison-wireframes` (@bison-lab/payload-core) from each block's\",\n \"// Block library preview. Do not edit by hand: rerun it when a layout changes.\",\n `export const ${values.export}: Record<string, string> = {`,\n ...lines,\n \"};\",\n \"\",\n ].join(\"\\n\");\n const target = resolve(out);\n mkdirSync(dirname(target), { recursive: true });\n writeFileSync(target, module);\n console.log(`bison-wireframes: wrote ${slugs.length} wireframes to ${out}`);\n} catch (error) {\n await browser.close();\n fail(error instanceof Error ? error.message : String(error));\n} finally {\n await browser.close();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,EAAE,WAAW,UAAU,EAC3B,SAAS;CACP,MAAM,EAAE,MAAM,UAAU;CACxB,SAAS;EAAE,MAAM;EAAU,SAAS;EAAyB;CAC7D,UAAU,EAAE,MAAM,UAAU;CAC5B,OAAO,EAAE,MAAM,UAAU;CACzB,KAAK,EAAE,MAAM,UAAU;CACvB,WAAW,EAAE,MAAM,UAAU;CAC7B,OAAO;EAAE,MAAM;EAAU,SAAS;EAAS;CAC3C,QAAQ;EAAE,MAAM;EAAU,SAAS;EAAoB;CACvD,YAAY;EAAE,MAAM;EAAW,SAAS;EAAO;CAChD,EACF,CAAC;AAEF,SAAS,KAAK,SAAwB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MAAM,CAAC;AACjD,OAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAE,eAAc,KAAK,OAAO,YAAY,GAAG,KAAK,MAAM,EAAE,IAAI;;CAG5G,MAAM,QAAQ,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,MAAM,SAAS,KAAK,KAAK,UAAU,KAAK,CAAC,IAAI,KAAK,UAAU,WAAW,IAAI,CAAC,CAAC,GAAG;CACzH,MAAM,SAAS;EACb;EACA;EACA,gBAAgB,OAAO,OAAO;EAC9B,GAAG;EACH;EACA;EACD,CAAC,KAAK,KAAK;CACZ,MAAM,SAAS,QAAQ,IAAI;AAC3B,WAAU,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AAC/C,eAAc,QAAQ,OAAO;AAC7B,SAAQ,IAAI,2BAA2B,MAAM,OAAO,iBAAiB,MAAM;SACpE,OAAO;AACd,OAAM,QAAQ,OAAO;AACrB,MAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;UACpD;AACR,OAAM,QAAQ,OAAO"}
@@ -0,0 +1,119 @@
1
+ //#region src/wireframe.d.ts
2
+ /**
3
+ * Black-and-white wireframes of Block library samples, for Payload's Add
4
+ * Block drawer (`admin.images.thumbnail`). React-free and Payload-free: a
5
+ * script drives a browser to each block's preview (`previewPath(slug)`),
6
+ * `extractWireframe` reads where the headings, text, images, buttons and
7
+ * surfaces sit, and `wireframeSvg` draws those boxes as greyscale shapes.
8
+ * No copy and no brand color reach the picture, so it does not go stale
9
+ * when Theme changes; rerun it when a block's layout does.
10
+ */
11
+ /** Payload's drawer card is 3:2; 480 × 320 is the size its docs suggest. */
12
+ declare const WIREFRAME_WIDTH = 480;
13
+ declare const WIREFRAME_HEIGHT = 320;
14
+ /** Desktop width, so the picture is the layout most visitors see. */
15
+ declare const WIREFRAME_VIEWPORT: {
16
+ readonly width: 1280;
17
+ readonly height: 900;
18
+ };
19
+ /** The element the Block library preview wraps each sample in (`BlockLibraryIsland`). */
20
+ declare const WIREFRAME_ROOT = "[data-block-library-island]";
21
+ /** `light` draws light marks (they sit on a dark surface); `dark` draws dark ones (on paper). */
22
+ type WireframeTone = "light" | "dark";
23
+ type WireframeShape = /** A band or panel the block paints. `dark` is a dark fill; `light` a pale tint. */{
24
+ kind: "surface";
25
+ x: number;
26
+ y: number;
27
+ w: number;
28
+ h: number;
29
+ tone: WireframeTone;
30
+ } /** A bordered card with no fill of its own. */ | {
31
+ kind: "frame";
32
+ x: number;
33
+ y: number;
34
+ w: number;
35
+ h: number;
36
+ tone: WireframeTone;
37
+ } | {
38
+ kind: "image";
39
+ x: number;
40
+ y: number;
41
+ w: number;
42
+ h: number;
43
+ } | {
44
+ kind: "heading" | "text" | "icon";
45
+ x: number;
46
+ y: number;
47
+ w: number;
48
+ h: number;
49
+ tone: WireframeTone;
50
+ } | {
51
+ kind: "button";
52
+ x: number;
53
+ y: number;
54
+ w: number;
55
+ h: number;
56
+ filled: boolean;
57
+ tone: WireframeTone;
58
+ } | {
59
+ kind: "field";
60
+ x: number;
61
+ y: number;
62
+ w: number;
63
+ h: number;
64
+ };
65
+ type WireframeCapture = {
66
+ width: number;
67
+ height: number;
68
+ shapes: WireframeShape[];
69
+ };
70
+ /**
71
+ * Runs in the page (Playwright's `page.evaluate`), so it closes over
72
+ * nothing: every helper is declared inside. Boxes are relative to the
73
+ * element `selector` names (the preview's island), in CSS pixels.
74
+ */
75
+ declare function extractWireframe(selector: string): WireframeCapture;
76
+ /**
77
+ * A capture as a 480 × 320 greyscale SVG. The block is scaled to the
78
+ * width; a short block is centered, a tall one keeps its top and is clipped.
79
+ * Surfaces first, text last, so marks sit on what they sit on in the page.
80
+ */
81
+ declare function wireframeSvg(capture: WireframeCapture): string;
82
+ /**
83
+ * An SVG as a `data:` URI for `admin.images.thumbnail`. Only the characters
84
+ * a URI cannot carry are escaped, so the string stays close to the SVG's
85
+ * own size; the SVG must use single quotes.
86
+ */
87
+ declare function svgDataUri(svg: string): string;
88
+ /** The slice of Playwright's `Page` this needs; a site passes its own. */
89
+ interface WireframePage {
90
+ setViewportSize(size: {
91
+ width: number;
92
+ height: number;
93
+ }): Promise<void>;
94
+ /** Playwright's `Response` (or `null`); a status of 400 or more refuses the capture. */
95
+ goto(url: string, options?: {
96
+ waitUntil?: "load" | "domcontentloaded" | "networkidle";
97
+ }): Promise<{
98
+ status(): number;
99
+ } | null | void>;
100
+ evaluate<R, A>(fn: (arg: A) => R | Promise<R>, arg: A): Promise<R>;
101
+ }
102
+ /**
103
+ * Opens each preview at desktop width, waits for its fonts, and returns
104
+ * one SVG per slug. The page must already be signed in when the preview
105
+ * route needs it (the Block library's does). A preview that answers 400 or
106
+ * more, or renders no element `selector` matches, throws: nothing is
107
+ * written for a page that did not draw its sample.
108
+ */
109
+ declare function captureWireframes(page: WireframePage, previews: readonly {
110
+ slug: string;
111
+ url: string;
112
+ }[], {
113
+ selector
114
+ }?: {
115
+ selector?: string;
116
+ }): Promise<Record<string, string>>;
117
+ //#endregion
118
+ export { WIREFRAME_HEIGHT, WIREFRAME_ROOT, WIREFRAME_VIEWPORT, WIREFRAME_WIDTH, WireframeCapture, WireframePage, WireframeShape, WireframeTone, captureWireframes, extractWireframe, svgDataUri, wireframeSvg };
119
+ //# sourceMappingURL=wireframe.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireframe.d.mts","names":[],"sources":["../src/wireframe.ts"],"mappings":";;AAWA;;;;;AACA;;;;cADa,eAAA;AAAA,cACA,gBAAA;;cAGA,kBAAA;EAAA,SAA0D,KAAA;EAAA,SAAA,MAAA;AAAA;;cAG1D,cAAA;;KAGD,aAAA;AAAA,KAEA,cAAA;EAEN,IAAA;EAAiB,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,IAAA,EAAM,aAAA;AAAA;EAEnE,IAAA;EAAe,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,IAAA,EAAM,aAAA;AAAA;EACjE,IAAA;EAAe,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,CAAA;AAAA;EAChD,IAAA;EAAmC,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,IAAA,EAAM,aAAA;AAAA;EACrF,IAAA;EAAgB,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,MAAA;EAAiB,IAAA,EAAM,aAAA;AAAA;EACnF,IAAA;EAAe,CAAA;EAAW,CAAA;EAAW,CAAA;EAAW,CAAA;AAAA;AAAA,KAE1C,gBAAA;EAAqB,KAAA;EAAe,MAAA;EAAgB,MAAA,EAAQ,cAAA;AAAA;;;;;AAAxE;iBAOgB,gBAAA,CAAiB,QAAA,WAAmB,gBAAA;;;;;;iBAiLpC,YAAA,CAAa,OAAA,EAAS,gBAAA;;;AAjLtC;;;iBA8OgB,UAAA,CAAW,GAAA;;UASV,aAAA;EACf,eAAA,CAAgB,IAAA;IAAQ,KAAA;IAAe,MAAA;EAAA,IAAmB,OAAA;EAV5C;EAYd,IAAA,CACE,GAAA,UACA,OAAA;IAAY,SAAA;EAAA,IACX,OAAA;IAAU,MAAA;EAAA;EACb,QAAA,OAAe,EAAA,GAAK,GAAA,EAAK,CAAA,KAAM,CAAA,GAAI,OAAA,CAAQ,CAAA,GAAI,GAAA,EAAK,CAAA,GAAI,OAAA,CAAQ,CAAA;AAAA;;;;;;;;iBAU5C,iBAAA,CACpB,IAAA,EAAM,aAAA,EACN,QAAA;EAAqB,IAAA;EAAc,GAAA;AAAA;EACjC;AAAA;EAA+B,QAAA;AAAA,IAChC,OAAA,CAAQ,MAAA"}
@@ -0,0 +1,2 @@
1
+ import { a as captureWireframes, c as wireframeSvg, i as WIREFRAME_WIDTH, n as WIREFRAME_ROOT, o as extractWireframe, r as WIREFRAME_VIEWPORT, s as svgDataUri, t as WIREFRAME_HEIGHT } from "./wireframe-BTocmmyY.mjs";
2
+ export { WIREFRAME_HEIGHT, WIREFRAME_ROOT, WIREFRAME_VIEWPORT, WIREFRAME_WIDTH, captureWireframes, extractWireframe, svgDataUri, wireframeSvg };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bison-lab/payload-core",
3
- "version": "4.12.4",
3
+ "version": "4.15.0",
4
4
  "description": "Site-agnostic Payload CMS configuration for Bison Lab sites: the SEO tab, the Theme global, the Roles Global, the brand-assets cupboard, and the metadata and theme readers for the pages they describe",
5
5
  "keywords": [
6
6
  "bison-lab",
@@ -23,6 +23,9 @@
23
23
  "url": "https://github.com/Bison-Lab-LLC/bisonlab-component-library/issues"
24
24
  },
25
25
  "type": "module",
26
+ "bin": {
27
+ "bison-wireframes": "./dist/wireframe-cli.mjs"
28
+ },
26
29
  "main": "./dist/index.mjs",
27
30
  "types": "./dist/index.d.mts",
28
31
  "exports": {
@@ -50,6 +53,10 @@
50
53
  "import": "./dist/taxonomy.mjs",
51
54
  "types": "./dist/taxonomy.d.mts"
52
55
  },
56
+ "./wireframe": {
57
+ "import": "./dist/wireframe.mjs",
58
+ "types": "./dist/wireframe.d.mts"
59
+ },
53
60
  "./admin": {
54
61
  "import": "./dist/admin.mjs",
55
62
  "types": "./dist/admin.d.mts"
@@ -64,7 +71,7 @@
64
71
  ],
65
72
  "dependencies": {
66
73
  "react-colorful": "^5.8.1",
67
- "@bison-lab/admin-ui": "4.9.2"
74
+ "@bison-lab/admin-ui": "4.15.0"
68
75
  },
69
76
  "peerDependencies": {
70
77
  "@bison-lab/fonts": "^3.0.0 || ^4.0.0",
@@ -123,9 +130,9 @@
123
130
  "tsdown": "^0.21.0",
124
131
  "typescript": "^5.9.3",
125
132
  "vitest": "^4.1.2",
126
- "@bison-lab/fonts": "3.27.1",
127
133
  "@bison-lab/tokens": "4.5.0",
128
- "@bison-lab/ui": "4.10.2"
134
+ "@bison-lab/ui": "4.13.0",
135
+ "@bison-lab/fonts": "3.27.1"
129
136
  },
130
137
  "publishConfig": {
131
138
  "access": "public"