@weasel-js/forge 1.11.1 → 1.13.0-rc.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.
- package/README.md +110 -5
- package/dist/{FrameController-Cj_i-Rdk.d.ts → FrameController-Tv3jrHyT.d.ts} +3 -3
- package/dist/{chunk-JTCUIJPZ.js → chunk-35DOPXHZ.js} +119 -10
- package/dist/chunk-35DOPXHZ.js.map +1 -0
- package/dist/{chunk-7BQPHMA2.js → chunk-3BAM6M26.js} +2 -2
- package/dist/chunk-3BAM6M26.js.map +1 -0
- package/dist/{chunk-ZAWXMUGZ.js → chunk-5WS67HMU.js} +8 -3
- package/dist/chunk-5WS67HMU.js.map +1 -0
- package/dist/{chunk-BKPDKUDN.js → chunk-BUXUWAI4.js} +45 -60
- package/dist/chunk-BUXUWAI4.js.map +1 -0
- package/dist/chunk-ORMMZ5PV.js +59 -0
- package/dist/chunk-ORMMZ5PV.js.map +1 -0
- package/dist/chunk-RKQ277P5.js +501 -0
- package/dist/chunk-RKQ277P5.js.map +1 -0
- package/dist/chunk-STF6NQ5N.js +60 -0
- package/dist/chunk-STF6NQ5N.js.map +1 -0
- package/dist/chunk-VUPN73JP.js +16 -0
- package/dist/chunk-VUPN73JP.js.map +1 -0
- package/dist/{config-DN6IaNf6.d.ts → config-Bd6FVlh7.d.ts} +22 -5
- package/dist/frame/index.css +37 -0
- package/dist/frame/index.css.map +1 -1
- package/dist/frame/index.d.ts +62 -29
- package/dist/frame/index.js +138 -8
- package/dist/frame/index.js.map +1 -1
- package/dist/index.d.ts +28 -5
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mountFrame-FdJDb3TB.d.ts +35 -0
- package/dist/shell/index.css +147 -2
- package/dist/shell/index.css.map +1 -1
- package/dist/shell/index.d.ts +44 -8
- package/dist/shell/index.js +1614 -277
- package/dist/shell/index.js.map +1 -1
- package/dist/test/index.css +58 -0
- package/dist/test/index.css.map +1 -0
- package/dist/test/index.d.ts +1 -1
- package/dist/test/index.js +4 -4
- package/dist/vite/index.js +571 -121
- package/dist/vite/index.js.map +1 -1
- package/package.json +13 -8
- package/dist/chunk-5DXUNLV2.js +0 -6
- package/dist/chunk-5DXUNLV2.js.map +0 -1
- package/dist/chunk-7BQPHMA2.js.map +0 -1
- package/dist/chunk-BKPDKUDN.js.map +0 -1
- package/dist/chunk-FZNABWJC.js +0 -282
- package/dist/chunk-FZNABWJC.js.map +0 -1
- package/dist/chunk-JTCUIJPZ.js.map +0 -1
- package/dist/chunk-WEQSLPKT.js +0 -9
- package/dist/chunk-WEQSLPKT.js.map +0 -1
- package/dist/chunk-ZAWXMUGZ.js.map +0 -1
|
@@ -17,6 +17,11 @@ function storyNameFromExport(exportName) {
|
|
|
17
17
|
// src/csf/propArgTypes.ts
|
|
18
18
|
var PROP_ARG_TYPES_EXPORT = "__forgeArgTypes";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
// src/frame/safeOverride.ts
|
|
21
|
+
function isSafeOverride(name, value) {
|
|
22
|
+
return /^--[\w-]+$/.test(name) && !/[{};]/.test(value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { PROP_ARG_TYPES_EXPORT, isSafeOverride, sanitize, storyId, storyNameFromExport };
|
|
26
|
+
//# sourceMappingURL=chunk-5WS67HMU.js.map
|
|
27
|
+
//# sourceMappingURL=chunk-5WS67HMU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/ids.ts","../src/csf/propArgTypes.ts","../src/frame/safeOverride.ts"],"names":[],"mappings":";AAIO,SAAS,SAAS,IAAA,EAAsB;AAC7C,EAAA,OAAO,KACJ,WAAA,EAAY,CACZ,OAAA,CAAQ,iDAAA,EAAmD,GAAG,CAAA,CAC9D,OAAA,CAAQ,KAAA,EAAO,GAAG,EAClB,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA,CACjB,OAAA,CAAQ,OAAO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Aa,CAAA,CAAE,CAAA,CAC5E,QAAQ,KAAA,EAAO,GAAG,EAClB,IAAA,EAAK;AACV;;;ACnCO,IAAM,qBAAA,GAAwB;;;ACG9B,SAAS,cAAA,CAAe,MAAc,KAAA,EAAwB;AACnE,EAAA,OAAO,aAAa,IAAA,CAAK,IAAI,KAAK,CAAC,OAAA,CAAQ,KAAK,KAAK,CAAA;AACvD","file":"chunk-5WS67HMU.js","sourcesContent":["// sanitize, storyId and storyNameFromExport are ports of storybook/internal/csf (10.4.0)'s\n// sanitize, toId and storyNameFromExport; they must agree or links diverge.\n\n/** Lower-case; runs of the listed separators become one dash. Everything else, non-ASCII letters included, survives. */\nexport function sanitize(part: string): string {\n return part\n .toLowerCase()\n .replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\\-=?;:'\",.<>{}[\\]\\\\/]/gi, '-')\n .replace(/-+/g, '-')\n .replace(/^-+/, '')\n .replace(/-+$/, '');\n}\n\nfunction sanitizeSafe(part: string, kind: 'kind' | 'name'): string {\n const sanitized = sanitize(part);\n if (sanitized === '') throw new Error(`Invalid ${kind} '${part}', must include alphanumeric characters`);\n return sanitized;\n}\n\nexport function storyId(title: string, exportName: string): string {\n return `${sanitizeSafe(title, 'kind')}--${sanitizeSafe(exportName, 'name')}`;\n}\n\n/** `PrimaryButton` → `Primary Button`, `withIcon2` → `With Icon 2`. */\nexport function storyNameFromExport(exportName: string): string {\n return exportName\n .replace(/_/g, ' ')\n .replace(/-/g, ' ')\n .replace(/\\./g, ' ')\n .replace(/([^\\n])([A-Z])([a-z])/g, (_, a: string, b: string, c: string) => `${a} ${b}${c}`)\n .replace(/([a-z])([A-Z])/g, (_, a: string, b: string) => `${a} ${b}`)\n .replace(/([a-z])([0-9])/gi, (_, a: string, b: string) => `${a} ${b}`)\n .replace(/([0-9])([a-z])/gi, (_, a: string, b: string) => `${a} ${b}`)\n .replace(/(\\s|^)(\\w)/g, (_, a: string, b: string) => `${a}${b.toUpperCase()}`)\n .replace(/ +/g, ' ')\n .trim();\n}\n","/** The named export forge's vite plugin adds to a story module: argTypes read from the props of the meta's `component`. */\nexport const PROP_ARG_TYPES_EXPORT = '__forgeArgTypes';\n","/**\n * Whether a CSS variable override can be declared as given: a custom property name, and a value that cannot close\n * the declaration or the rule around it. A value that could would let whoever sets it write rules of their own.\n */\nexport function isSafeOverride(name: string, value: string): boolean {\n return /^--[\\w-]+$/.test(name) && !/[{};]/.test(value);\n}\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { indexId } from './chunk-STF6NQ5N.js';
|
|
2
|
+
import { useNearViewport, StoryHost } from './chunk-35DOPXHZ.js';
|
|
3
3
|
import { PROTOCOL_VERSION } from './chunk-GH5RE5X5.js';
|
|
4
4
|
import { createRoot } from 'react-dom/client';
|
|
5
5
|
import { IconRegistryProvider, isPlainObject } from '@weasel-js/core';
|
|
6
6
|
import { kitIcons } from '@weasel-js/ui/kit-icons';
|
|
7
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { f, resolveConfigSchema, isEntryShown, isConfigBranch, schemaNodeAtPath, titleCase } from '@weasel-js/labkit/config';
|
|
9
9
|
import { createEmitter } from '@weasel-js/registry';
|
|
10
10
|
import { createContext, useContext, useMemo, useState, useRef, useEffect, useId } from 'react';
|
|
11
11
|
import { Badge } from '@weasel-js/ui/components/Badge';
|
|
12
|
-
import {
|
|
12
|
+
import { InlineMarkdown } from '@weasel-js/ui/components/InlineMarkdown';
|
|
13
13
|
import num from '@weasel-js/theme/numeric.module.css';
|
|
14
14
|
|
|
15
15
|
function createKitRoot(container, extra = []) {
|
|
@@ -124,55 +124,26 @@ function openChannel(port, options = {}) {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
// src/story/indexPages.ts
|
|
129
|
-
var SUFFIX = ":index";
|
|
130
|
-
var INDEX_NAME = "Index";
|
|
131
|
-
function indexId(title) {
|
|
132
|
-
return `${sanitize(title)}${SUFFIX}`;
|
|
133
|
-
}
|
|
134
|
-
function isIndexId(id) {
|
|
135
|
-
return id.endsWith(SUFFIX);
|
|
136
|
-
}
|
|
137
|
-
function indexEntries(stories) {
|
|
138
|
-
const byTitle = /* @__PURE__ */ new Map();
|
|
139
|
-
for (const entry of stories) {
|
|
140
|
-
const page = byTitle.get(entry.title);
|
|
141
|
-
if (page) {
|
|
142
|
-
if (page.tags) {
|
|
143
|
-
const common = page.tags.filter((tag) => entry.tags?.includes(tag));
|
|
144
|
-
if (common.length > 0) page.tags = common;
|
|
145
|
-
else delete page.tags;
|
|
146
|
-
}
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
byTitle.set(entry.title, {
|
|
150
|
-
id: indexId(entry.title),
|
|
151
|
-
title: entry.title,
|
|
152
|
-
name: INDEX_NAME,
|
|
153
|
-
exportName: "",
|
|
154
|
-
file: entry.file,
|
|
155
|
-
...entry.componentDescription === void 0 ? {} : { componentDescription: entry.componentDescription },
|
|
156
|
-
...entry.componentName === void 0 ? {} : { componentName: entry.componentName },
|
|
157
|
-
...entry.tags === void 0 ? {} : { tags: entry.tags }
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
return [...byTitle.values()];
|
|
161
|
-
}
|
|
162
127
|
function librariesFrom(table = []) {
|
|
163
128
|
return {
|
|
164
129
|
of(entry) {
|
|
165
130
|
const file = entry.file.replaceAll("\\", "/");
|
|
166
131
|
return table.find((library) => file.includes(library.path))?.label ?? entry.title.split("/")[0] ?? entry.title;
|
|
167
132
|
},
|
|
168
|
-
|
|
133
|
+
tintOf: (label) => table.find((library) => library.label === label)?.tint
|
|
169
134
|
};
|
|
170
135
|
}
|
|
171
136
|
var TITLE_LIBRARIES = librariesFrom();
|
|
172
137
|
var LibrariesContext = createContext(TITLE_LIBRARIES);
|
|
138
|
+
|
|
139
|
+
// src/shell/labDensity.ts
|
|
140
|
+
var LAB_DENSITY = "roomy";
|
|
141
|
+
function LabBadge({ className }) {
|
|
142
|
+
return /* @__PURE__ */ jsx(Badge, { grade: "info", variant: "subtle", size: "sm", ...className ? { className } : {}, children: "Lab" });
|
|
143
|
+
}
|
|
173
144
|
function LibraryBadge({ library, className }) {
|
|
174
|
-
const
|
|
175
|
-
return /* @__PURE__ */ jsx(Badge, {
|
|
145
|
+
const tint = useContext(LibrariesContext).tintOf(library);
|
|
146
|
+
return /* @__PURE__ */ jsx(Badge, { emphasis: "low", ...tint === void 0 ? {} : { tint }, variant: "subtle", size: "sm", ...className ? { className } : {}, children: library });
|
|
176
147
|
}
|
|
177
148
|
var MAX_ENUM_OPTIONS = 8;
|
|
178
149
|
var MAX_ROWS = 6;
|
|
@@ -216,6 +187,12 @@ function withValueAt(config, path, value) {
|
|
|
216
187
|
const record = isPlainObject(config) ? config : {};
|
|
217
188
|
return { ...record, [head]: rest.length === 0 ? value : withValueAt(record[head], rest.join("."), value) };
|
|
218
189
|
}
|
|
190
|
+
function paragraphsOf(text) {
|
|
191
|
+
return text.split(/\n\s*\n/).map((paragraph) => paragraph.split("\n").map((line) => line.trim()).filter(Boolean).join(" ")).filter(Boolean);
|
|
192
|
+
}
|
|
193
|
+
function Description({ text, className }) {
|
|
194
|
+
return /* @__PURE__ */ jsx(Fragment, { children: paragraphsOf(text).map((paragraph, i) => /* @__PURE__ */ jsx("p", { className, children: /* @__PURE__ */ jsx(InlineMarkdown, { text: paragraph }) }, i)) });
|
|
195
|
+
}
|
|
219
196
|
var IndexEnvContext = createContext(null);
|
|
220
197
|
function useEnv() {
|
|
221
198
|
const env = useContext(IndexEnvContext);
|
|
@@ -277,22 +254,24 @@ function IndexVariants({ story }) {
|
|
|
277
254
|
] }, row.path)) });
|
|
278
255
|
}
|
|
279
256
|
function GalleryBadge() {
|
|
280
|
-
return /* @__PURE__ */ jsx(Badge, {
|
|
257
|
+
return /* @__PURE__ */ jsx(Badge, { emphasis: "high", variant: "subtle", size: "sm", children: "Gallery" });
|
|
281
258
|
}
|
|
282
|
-
function
|
|
259
|
+
function OpenLink({ id, className, children }) {
|
|
283
260
|
const env = useEnv();
|
|
284
|
-
const
|
|
285
|
-
const follow = (event, id) => {
|
|
261
|
+
const follow = (event) => {
|
|
286
262
|
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
287
263
|
event.preventDefault();
|
|
288
264
|
env.open(id);
|
|
289
265
|
};
|
|
266
|
+
return /* @__PURE__ */ jsx("a", { className, href: `#/${encodeURIComponent(id)}`, onClick: follow, children });
|
|
267
|
+
}
|
|
268
|
+
function DependencyList({ label, titles, empty }) {
|
|
269
|
+
const labelId = useId();
|
|
290
270
|
return /* @__PURE__ */ jsxs("div", { className: "fg-index-deps__row", children: [
|
|
291
271
|
/* @__PURE__ */ jsx("dt", { id: labelId, className: "fg-index-deps__label", children: label }),
|
|
292
272
|
/* @__PURE__ */ jsx("dd", { className: "fg-index-deps__value", children: titles.length === 0 ? /* @__PURE__ */ jsx("span", { className: "fg-index-deps__empty", children: empty }) : /* @__PURE__ */ jsx("ul", { className: "fg-index-deps__list", "aria-labelledby": labelId, children: titles.map((title) => {
|
|
293
273
|
const cut = title.lastIndexOf("/") + 1;
|
|
294
|
-
|
|
295
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", { className: "fg-index-deps__link", href: `#/${encodeURIComponent(id)}`, onClick: (event) => follow(event, id), children: [
|
|
274
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(OpenLink, { className: "fg-index-deps__link", id: indexId(title), children: [
|
|
296
275
|
/* @__PURE__ */ jsx("span", { className: "fg-index-deps__prefix", children: title.slice(0, cut) }),
|
|
297
276
|
title.slice(cut)
|
|
298
277
|
] }) }, title);
|
|
@@ -340,21 +319,27 @@ function StorySection({ story, variants }) {
|
|
|
340
319
|
const headingId = useId();
|
|
341
320
|
const description = env.descriptions[story.id];
|
|
342
321
|
const gallery = !env.gallery && env.galleries?.includes(story.id);
|
|
322
|
+
const lab = env.labs?.includes(story.id) ?? false;
|
|
343
323
|
return /* @__PURE__ */ jsxs("section", { className: "fg-index-story", "aria-labelledby": headingId, children: [
|
|
344
|
-
/* @__PURE__ */ jsxs("
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
|
|
347
|
-
|
|
324
|
+
/* @__PURE__ */ jsxs("div", { className: "fg-index-story__main", children: [
|
|
325
|
+
/* @__PURE__ */ jsxs("div", { className: "fg-index-story__text", children: [
|
|
326
|
+
/* @__PURE__ */ jsxs("header", { className: "fg-index-story__head", children: [
|
|
327
|
+
/* @__PURE__ */ jsx("h2", { id: headingId, className: "fg-index-story__name", children: /* @__PURE__ */ jsx(OpenLink, { className: "fg-index-story__link", id: story.id, children: story.name }) }),
|
|
328
|
+
gallery ? /* @__PURE__ */ jsx(GalleryBadge, {}) : null,
|
|
329
|
+
lab ? /* @__PURE__ */ jsx(LabBadge, {}) : null
|
|
330
|
+
] }),
|
|
331
|
+
description ? /* @__PURE__ */ jsx(Description, { text: description, className: "fg-index-story__description" }) : null
|
|
332
|
+
] }),
|
|
333
|
+
lab ? null : /* @__PURE__ */ jsx(IndexStory, { story })
|
|
348
334
|
] }),
|
|
349
|
-
description ? /* @__PURE__ */ jsx("p", { className: "fg-index-story__description", children: description }) : null,
|
|
350
|
-
/* @__PURE__ */ jsx(IndexStory, { story }),
|
|
351
335
|
variants ? /* @__PURE__ */ jsx(IndexVariants, { story }) : null
|
|
352
336
|
] });
|
|
353
337
|
}
|
|
354
|
-
function firstOfEachControlSet(stories) {
|
|
338
|
+
function firstOfEachControlSet(stories, labs) {
|
|
355
339
|
const seen = /* @__PURE__ */ new Set();
|
|
356
340
|
const shown = /* @__PURE__ */ new Set();
|
|
357
341
|
for (const story of stories) {
|
|
342
|
+
if (labs.includes(story.id)) continue;
|
|
358
343
|
const key = JSON.stringify(variantRows(story.config));
|
|
359
344
|
if (seen.has(key)) continue;
|
|
360
345
|
seen.add(key);
|
|
@@ -364,7 +349,7 @@ function firstOfEachControlSet(stories) {
|
|
|
364
349
|
}
|
|
365
350
|
function DefaultIndex() {
|
|
366
351
|
const env = useEnv();
|
|
367
|
-
const withVariants = useMemo(() => firstOfEachControlSet(env.stories), [env.stories]);
|
|
352
|
+
const withVariants = useMemo(() => firstOfEachControlSet(env.stories, env.labs ?? []), [env.stories, env.labs]);
|
|
368
353
|
const segments = env.title.split("/");
|
|
369
354
|
const name = segments.pop();
|
|
370
355
|
const { library } = env;
|
|
@@ -379,7 +364,7 @@ function DefaultIndex() {
|
|
|
379
364
|
/* @__PURE__ */ jsx("h1", { className: "fg-index__title", children: name }),
|
|
380
365
|
env.gallery ? /* @__PURE__ */ jsx(GalleryBadge, {}) : null
|
|
381
366
|
] }),
|
|
382
|
-
env.description ? /* @__PURE__ */ jsx(
|
|
367
|
+
env.description ? /* @__PURE__ */ jsx(Description, { text: env.description, className: "fg-index__description" }) : null,
|
|
383
368
|
/* @__PURE__ */ jsx(IndexHistory, {}),
|
|
384
369
|
/* @__PURE__ */ jsx(IndexDependencies, {})
|
|
385
370
|
] }),
|
|
@@ -405,6 +390,6 @@ function IndexPage({ env, render }) {
|
|
|
405
390
|
return /* @__PURE__ */ jsx(IndexEnvContext.Provider, { value: env, children: render ? render(indexContext(env)) : /* @__PURE__ */ jsx(DefaultIndex, {}) });
|
|
406
391
|
}
|
|
407
392
|
|
|
408
|
-
export { IndexPage, LibrariesContext, LibraryBadge, TITLE_LIBRARIES, answerSchema, createKitRoot, describeSchema,
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
410
|
-
//# sourceMappingURL=chunk-
|
|
393
|
+
export { Description, IndexPage, LAB_DENSITY, LabBadge, LibrariesContext, LibraryBadge, TITLE_LIBRARIES, answerSchema, createKitRoot, describeSchema, librariesFrom, openChannel, schemaFromDescription };
|
|
394
|
+
//# sourceMappingURL=chunk-BUXUWAI4.js.map
|
|
395
|
+
//# sourceMappingURL=chunk-BUXUWAI4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kitIcons.tsx","../src/protocol/schema.ts","../src/protocol/channel.ts","../src/story/library.ts","../src/shell/labDensity.ts","../src/frame/index/LabBadge.tsx","../src/frame/index/LibraryBadge.tsx","../src/frame/index/variants.ts","../src/frame/index/Description.tsx","../src/frame/index/IndexPage.tsx"],"names":["jsx","Badge","resolveConfigSchema","isEntryShown","isConfigBranch","createContext","useContext"],"mappings":";;;;;;;;;;;;;;AAQO,SAAS,aAAA,CAAc,SAAA,EAAoB,KAAA,GAA8B,EAAC,EAAqC;AACpH,EAAA,MAAM,IAAA,GAAO,WAAW,SAAS,CAAA;AACjC,EAAA,MAAM,KAAA,GAAQ,MAAM,MAAA,GAAS,CAAA,GAAI,CAAC,GAAG,QAAA,EAAU,GAAG,KAAK,CAAA,GAAI,QAAA;AAC3D,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,CAAC,IAAA,KAAoB,IAAA,CAAK,uBAAO,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAe,QAAA,EAAA,IAAA,EAAK,CAAuB,CAAA;AAAA,IAC1G,OAAA,EAAS,MAAM,IAAA,CAAK,OAAA;AAAQ,GAC9B;AACF;AC0CA,IAAM,QAAA,GAAW,CAAC,EAAA,EAAY,GAAA,KAAyB,EAAA,KAAO,KAAK,GAAA,GAAM,CAAA,EAAG,EAAE,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA;AAErF,SAAS,cAAc,KAAA,EAAoC;AACzD,EAAA,MAAM,MAAsB,EAAC;AAC7B,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,IAAA,MAAM,EAAE,OAAA,EAAS,MAAA,EAAO,GAAI,KAAA,CAAM,OAAA;AAClC,IAAA,MAAM,MAAA,GAAS;AAAA,MACb,WAAA,EAAa,EAAE,GAAG,KAAA,CAAM,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AA,mBAAIA,GAAAA,CAAC,gBAAa,CAAA,EAAG,CAAA;AAEjG","file":"chunk-BUXUWAI4.js","sourcesContent":["import type { ReactNode } from 'react';\nimport { createRoot, type Root } from 'react-dom/client';\nimport { IconRegistryProvider } from '@weasel-js/core';\nimport type { IconTable } from '@weasel-js/icons';\nimport { kitIcons } from '@weasel-js/ui/kit-icons';\n\n/** A React root whose every render draws its icons from the kit's tables, plus `extra` (an app's own): the\n * workshop's, and each story frame's. */\nexport function createKitRoot(container: Element, extra: readonly IconTable[] = []): Pick<Root, 'render' | 'unmount'> {\n const root = createRoot(container);\n const icons = extra.length > 0 ? [...kitIcons, ...extra] : kitIcons;\n return {\n render: (node: ReactNode) => root.render(<IconRegistryProvider icons={icons}>{node}</IconRegistryProvider>),\n unmount: () => root.unmount(),\n };\n}\n","import {\n f,\n isConfigBranch,\n isEntryShown,\n resolveConfigSchema,\n schemaNodeAtPath,\n type Annotations,\n type BranchAnnotations,\n type ConfigBranch,\n type ConfigEntry,\n type ConfigNode,\n type ConfigSchema,\n type ConfigShape,\n type NodeOptions,\n} from '@weasel-js/labkit/config';\n\n/** The section a described entry sits in, as structured-clone data. */\nexport interface SectionDescription {\n label: string;\n collapsed?: boolean;\n}\n\n/** One key of a described shape: a leaf, or a branch holding more. */\nexport type DescribedEntry =\n | {\n branch: true;\n annotations: BranchAnnotations;\n section?: SectionDescription;\n conditional: boolean;\n children: DescribedShape;\n }\n | {\n branch: false;\n kind: string | null;\n default: unknown;\n annotations: Annotations;\n section?: SectionDescription;\n conditional: boolean;\n validated: boolean;\n /** The node draws its own row with `.render`, which stays in the frame. */\n customControl: boolean;\n };\n\n/** A config shape as structured-clone data: each key's entry, described. */\nexport type DescribedShape = { [key: string]: DescribedEntry };\n\n/** A story's `f.schema` as structured-clone data. */\nexport interface SchemaDescription {\n nodes: DescribedShape;\n}\n\n/** Answers the workshop has for the rebuilt schema's predicates. */\nexport interface SchemaAnswers {\n hidden(path: string, config: unknown): boolean;\n errors(path: string, config: unknown): string[];\n}\n\nconst joinPath = (at: string, key: string): string => (at === '' ? key : `${at}.${key}`);\n\nfunction describeShape(shape: ConfigShape): DescribedShape {\n const out: DescribedShape = {};\n for (const [key, entry] of Object.entries(shape)) {\n const { section, showIf } = entry.options;\n const common = {\n annotations: { ...entry.annotations },\n ...(section === undefined ? {} : { section: { ...section } }),\n conditional: showIf !== undefined,\n };\n out[key] = isConfigBranch(entry)\n ? { branch: true, ...common, children: describeShape(entry.children) }\n : {\n branch: false,\n kind: entry.kind,\n default: entry.default,\n ...common,\n validated: entry.options.validate !== undefined,\n customControl: entry.options.render !== undefined,\n };\n }\n return out;\n}\n\nexport function describeSchema(schema: ConfigSchema<unknown>): SchemaDescription {\n return { nodes: describeShape(schema.nodes) };\n}\n\nfunction rebuildShape(shape: DescribedShape, at: string, answers: SchemaAnswers): ConfigShape {\n const out: Record<string, ConfigEntry> = {};\n for (const [key, entry] of Object.entries(shape)) {\n const path = joinPath(at, key);\n const options: NodeOptions = {\n ...(entry.section === undefined ? {} : { section: entry.section }),\n ...(entry.conditional ? { showIf: (config) => !answers.hidden(path, config) } : {}),\n };\n if (entry.branch) {\n const branch: ConfigBranch = {\n children: rebuildShape(entry.children, path, answers),\n annotations: entry.annotations,\n options,\n };\n out[key] = branch;\n } else {\n const node: ConfigNode = {\n kind: entry.kind,\n default: entry.default,\n annotations: entry.annotations,\n options: entry.validated ? { ...options, validate: (_leaf, config) => answers.errors(path, config) } : options,\n };\n out[key] = node;\n }\n }\n return out;\n}\n\nexport function schemaFromDescription(\n description: SchemaDescription,\n answers: SchemaAnswers,\n): ConfigSchema<unknown> {\n return f.schema(rebuildShape(description.nodes, '', answers)) as ConfigSchema<unknown>;\n}\n\n/** Evaluate a schema's own predicates for one config — the frame's half of `answers`. */\nexport function answerSchema(\n schema: ConfigSchema<unknown>,\n config: unknown,\n): { hidden: string[]; errors: Record<string, string[]> } {\n const hidden: string[] = [];\n const errors: Record<string, string[]> = {};\n const record = config as Record<string, unknown>;\n const { group } = resolveConfigSchema(schema);\n\n const walk = (shape: ConfigShape, at: string): void => {\n for (const [key, entry] of Object.entries(shape)) {\n const path = joinPath(at, key);\n if (!isEntryShown(entry, record, group)) hidden.push(path);\n if (isConfigBranch(entry)) {\n walk(entry.children, path);\n continue;\n }\n const { validate } = entry.options;\n if (!validate) continue;\n const leaf = schemaNodeAtPath(group, path);\n if (!leaf || 'children' in leaf) continue;\n const found = validate(leaf, record);\n if (found.length > 0) errors[path] = found;\n }\n };\n walk(schema.nodes, '');\n return { hidden, errors };\n}\n","import { createEmitter } from '@weasel-js/registry';\nimport { type Envelope, PROTOCOL_VERSION } from './messages';\n\nexport interface PortLike {\n postMessage(message: unknown): void;\n addEventListener(type: 'message', fn: (event: MessageEvent) => void): void;\n removeEventListener(type: 'message', fn: (event: MessageEvent) => void): void;\n start?(): void;\n close(): void;\n}\n\n/** One end of a two-way message link: sends `Out`, hears `In`. */\nexport interface Channel<In, Out> {\n send(msg: Out): void;\n on(fn: (msg: In) => void): () => void;\n close(): void;\n}\n\nexport type Mismatch = { reason: 'not-an-envelope' } | { reason: 'version'; version: unknown };\n\nexport interface ChannelOptions {\n onMismatch?: (mismatch: Mismatch) => void;\n}\n\nexport function openChannel<In, Out>(port: PortLike, options: ChannelOptions = {}): Channel<In, Out> {\n const messages = createEmitter<[msg: In]>();\n const onMessage = (event: MessageEvent) => {\n const data: unknown = event.data;\n if (typeof data !== 'object' || data === null || !('msg' in data)) {\n options.onMismatch?.({ reason: 'not-an-envelope' });\n return;\n }\n const envelope = data as Partial<Envelope<In>>;\n if (envelope.v !== PROTOCOL_VERSION) {\n options.onMismatch?.({ reason: 'version', version: envelope.v });\n return;\n }\n messages.emit(envelope.msg as In);\n };\n port.addEventListener('message', onMessage);\n port.start?.();\n return {\n send: (msg) => port.postMessage({ v: PROTOCOL_VERSION, msg } satisfies Envelope<Out>),\n on: messages.subscribe,\n close: () => {\n port.removeEventListener('message', onMessage);\n port.close();\n },\n };\n}\n","import type { AppearanceProps } from '@weasel-js/ui/appearance';\nimport { createContext } from 'react';\n\n/** One library of a project: the story files under `path` carry `label`. */\nexport interface Library {\n /** A stretch of path every story file of the library has, with forward slashes: `/packages/ui/`. */\n path: string;\n label: string;\n /** The tint of the library's badge, as a `<Badge>` takes one. Default: the badge's own low emphasis. */\n tint?: AppearanceProps['tint'];\n}\n\n/** A project's libraries, as the tree's package filter, the index page header, and Get Info ask about them. */\nexport interface Libraries {\n /** The label of the first library whose `path` the story's file holds, else its title's first segment. */\n of(entry: { file: string; title: string }): string;\n tintOf(label: string): AppearanceProps['tint'];\n}\n\nexport function librariesFrom(table: readonly Library[] = []): Libraries {\n return {\n of(entry) {\n const file = entry.file.replaceAll('\\\\', '/');\n return table.find((library) => file.includes(library.path))?.label ?? entry.title.split('/')[0] ?? entry.title;\n },\n tintOf: (label) => table.find((library) => library.label === label)?.tint,\n };\n}\n\n/** No table: every story's library is its title's first segment. */\nexport const TITLE_LIBRARIES = librariesFrom();\n\n/** The workshop's libraries, from `ShellConfig.libraries`. */\nexport const LibrariesContext = createContext<Libraries>(TITLE_LIBRARIES);\n","/** The density the workshop's lab is drawn at, and so the density a capture of a story in it takes. */\nexport const LAB_DENSITY = 'roomy';\n","// The component's own entry, not the barrel: the barrel would bring every weasel-ui component into each frame.\nimport { Badge } from '@weasel-js/ui/components/Badge';\n\n/** Marks a story tagged `lab`: opening it opens a whole screen, not a specimen. */\nexport function LabBadge({ className }: { className?: string }) {\n return (\n <Badge grade=\"info\" variant=\"subtle\" size=\"sm\" {...(className ? { className } : {})}>\n Lab\n </Badge>\n );\n}\n","// The component's own entry, not the barrel: the barrel would bring every weasel-ui component into each frame.\nimport { Badge } from '@weasel-js/ui/components/Badge';\nimport { useContext } from 'react';\nimport { LibrariesContext } from '../../story/library';\n\n/** A component's library, as a badge in the tint the project gave that library. */\nexport function LibraryBadge({ library, className }: { library: string; className?: string }) {\n const tint = useContext(LibrariesContext).tintOf(library);\n return (\n <Badge emphasis=\"low\" {...(tint === undefined ? {} : { tint })} variant=\"subtle\" size=\"sm\" {...(className ? { className } : {})}>\n {library}\n </Badge>\n );\n}\n","import { type ConfigSchema, type ConfigShape, isConfigBranch, isEntryShown, resolveConfigSchema, titleCase } from '@weasel-js/labkit/config';\nimport { isPlainObject } from '@weasel-js/core';\n\nexport interface VariantValue {\n value: unknown;\n label: string;\n}\n\n/** One control a story is shown varying along, with every other control at its default. */\nexport interface VariantRow {\n /** Dotted, as `setConfig` takes it. */\n path: string;\n label: string;\n values: VariantValue[];\n}\n\n/** Above this many choices a row stops being something to scan. */\nexport const MAX_ENUM_OPTIONS = 8;\nexport const MAX_ROWS = 6;\n\nconst labelOf = (key: string, name: string | undefined): string => name ?? titleCase(key);\n\n/**\n * The boolean and enum controls of `schema` a story can be shown varying along, in schema order: skipped are\n * controls that draw their own row, controls hidden at the defaults, and enums with more than\n * `MAX_ENUM_OPTIONS` choices. At most `MAX_ROWS`.\n */\nexport function variantRows(schema: ConfigSchema<unknown>): VariantRow[] {\n const defaults = schema.defaults() as Record<string, unknown>;\n const { group } = resolveConfigSchema(schema);\n const rows: VariantRow[] = [];\n const walk = (shape: ConfigShape, at: string): void => {\n for (const [key, entry] of Object.entries(shape)) {\n if (rows.length >= MAX_ROWS) return;\n const path = at === '' ? key : `${at}.${key}`;\n if (!isEntryShown(entry, defaults, group)) continue;\n if (isConfigBranch(entry)) {\n walk(entry.children, path);\n continue;\n }\n if (entry.annotations.hidden || entry.options.render) continue;\n const label = labelOf(key, entry.annotations.name);\n if (entry.kind === 'boolean') {\n rows.push({ path, label, values: [false, true].map((value) => ({ value, label: String(value) })) });\n } else if (entry.kind === 'enum') {\n const options = entry.annotations.options ?? [];\n if (options.length < 2 || options.length > MAX_ENUM_OPTIONS) continue;\n rows.push({ path, label, values: options.map((o) => ({ value: o.value, label: o.label })) });\n }\n }\n };\n walk(schema.nodes, '');\n return rows;\n}\n\n/** `over` merged into `base`: nested plain objects merge, anything else replaces. */\nexport function mergeConfig(base: unknown, over: unknown): unknown {\n if (!isPlainObject(base) || !isPlainObject(over)) return over === undefined ? base : over;\n const out: Record<string, unknown> = { ...base };\n for (const [key, value] of Object.entries(over)) out[key] = mergeConfig(base[key], value);\n return out;\n}\n\n/** `config` with `value` at dotted `path`, copying each object along the way. */\nexport function withValueAt(config: unknown, path: string, value: unknown): unknown {\n const [head, ...rest] = path.split('.');\n if (head === undefined) return value;\n const record = isPlainObject(config) ? config : {};\n return { ...record, [head]: rest.length === 0 ? value : withValueAt(record[head], rest.join('.'), value) };\n}\n","// The component's own entry, not the barrel: the barrel would bring every weasel-ui component into each frame.\nimport { InlineMarkdown } from '@weasel-js/ui/components/InlineMarkdown';\n\n/** Splits JSDoc prose into paragraphs at blank lines, rejoining the lines a comment wrapped. */\nexport function paragraphsOf(text: string): string[] {\n return text\n .split(/\\n\\s*\\n/)\n .map((paragraph) => paragraph.split('\\n').map((line) => line.trim()).filter(Boolean).join(' '))\n .filter(Boolean);\n}\n\n/** A story's or component's JSDoc description, a paragraph per `className`-ed `<p>`, its inline markdown drawn. */\nexport function Description({ text, className }: { text: string; className: string }) {\n return (\n <>\n {paragraphsOf(text).map((paragraph, i) => (\n <p key={i} className={className}>\n <InlineMarkdown text={paragraph} />\n </p>\n ))}\n </>\n );\n}\n","// The components' own entries, not the barrel: the barrel would bring every weasel-ui component into each frame.\nimport { Badge } from '@weasel-js/ui/components/Badge';\nimport {\n createContext,\n type MouseEvent,\n type ReactNode,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { Globals } from '../../protocol/messages';\nimport { indexId } from '../../story/indexPages';\nimport type { ComponentDeps, Decorator, IndexContext, IndexStoryProps, LoadedStory, StoryContext } from '../../story/types';\nimport { StoryHost } from '../StoryHost';\nimport { useNearViewport } from '../useNearViewport';\nimport { mergeConfig, variantRows, withValueAt } from './variants';\nimport './index.css';\nimport { Description } from './Description';\nimport { LabBadge } from './LabBadge';\nimport { LibraryBadge } from './LibraryBadge';\nimport num from '@weasel-js/theme/numeric.module.css';\n\n/** What every cell on an index page shares with the frame that hosts it. */\nexport interface IndexEnv {\n title: string;\n /** The package the component ships in. */\n library?: string;\n description?: string;\n stories: readonly LoadedStory[];\n /** Per story id, the JSDoc above its export. */\n descriptions: Readonly<Record<string, string>>;\n /** A catalog or showcase rather than one component: every story of it is tagged `gallery`. */\n gallery?: boolean;\n /** The ids of the stories tagged `gallery`. */\n galleries?: readonly string[];\n /** The ids of the stories tagged `lab`: whole screens, which the page links to but does not embed. */\n labs?: readonly string[];\n /** The component's place in the component graph; absent until the graph arrives, and for a gallery. */\n dependencies?: ComponentDeps;\n globals: Globals;\n /** The frame config's, outermost. */\n decorators: readonly Decorator[];\n open: (id: string) => void;\n onError: (error: unknown) => void;\n}\n\nexport const IndexEnvContext = createContext<IndexEnv | null>(null);\n\nfunction useEnv(): IndexEnv {\n const env = useContext(IndexEnvContext);\n if (!env) throw new Error('An index page part rendered outside its index page');\n return env;\n}\n\n/** How far past the viewport a cell stays mounted. */\nconst NEAR_MARGIN = '100%';\n\n/**\n * One story at its defaults with `config` over them. It keeps its own config and state, so it stays interactive, and\n * it mounts only while near the viewport, so a page of canvas stories stays under the browser's WebGL context cap.\n */\nexport function IndexStory({ story, config: over, label }: IndexStoryProps) {\n const env = useEnv();\n const [config, setConfig] = useState(() => mergeConfig(story.config.defaults(), over));\n const [state, setState] = useState<unknown>(() => story.initialState?.(config) ?? null);\n const cell = useRef<HTMLElement>(null);\n // Starts unmounted, so a page of canvas stories never mounts every cell at once.\n const near = useNearViewport(cell, NEAR_MARGIN, false);\n // Held while unmounted, so scrolling past a cell does not move everything after it.\n const [height, setHeight] = useState<number | null>(null);\n useEffect(() => {\n const el = cell.current;\n if (!near || !el || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(() => setHeight(el.getBoundingClientRect().height));\n observer.observe(el);\n return () => observer.disconnect();\n }, [near]);\n const ctx: StoryContext = {\n config,\n setConfig: (path, value) => setConfig((prev: unknown) => withValueAt(prev, path, value)),\n state,\n setState: (next) =>\n setState((prev: unknown) => (typeof next === 'function' ? (next as (p: unknown) => unknown)(prev) : next)),\n globals: env.globals,\n title: story.title,\n name: story.name,\n };\n return (\n <figure\n ref={cell}\n className={`fg-index-cell fg-index-cell--${story.layout}`}\n style={!near && height !== null ? { minHeight: height } : undefined}\n >\n <div className=\"fg-index-cell__stage\">\n {near ? (\n <StoryHost story={story} ctx={ctx} decorators={env.decorators} resetKey={0} onError={env.onError} />\n ) : null}\n </div>\n {label === undefined ? null : <figcaption className=\"fg-index-cell__label\">{label}</figcaption>}\n </figure>\n );\n}\n\n/** `story` once per value of each boolean and enum control, every other control at its default. */\nexport function IndexVariants({ story }: { story: LoadedStory }) {\n const rows = useMemo(() => variantRows(story.config), [story]);\n const defaults = useMemo(() => story.config.defaults(), [story]);\n if (rows.length === 0) return null;\n return (\n <div className=\"fg-index-variants\">\n {rows.map((row) => (\n <section key={row.path} className=\"fg-index-variants__row\" aria-label={row.label}>\n <h4 className=\"fg-index-variants__label\">{row.label}</h4>\n <div className=\"fg-index-variants__cells\">\n {row.values.map((v) => (\n <IndexStory\n key={String(v.value)}\n story={story}\n config={withValueAt(defaults, row.path, v.value) as Record<string, unknown>}\n label={v.label}\n />\n ))}\n </div>\n </section>\n ))}\n </div>\n );\n}\n\nfunction GalleryBadge() {\n return (\n <Badge emphasis=\"high\" variant=\"subtle\" size=\"sm\">\n Gallery\n </Badge>\n );\n}\n\n/** A link to `id` in the workshop. A plain click opens it in place; a modified one is left to the browser. */\nfunction OpenLink({ id, className, children }: { id: string; className: string; children: ReactNode }) {\n const env = useEnv();\n const follow = (event: MouseEvent) => {\n if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n event.preventDefault();\n env.open(id);\n };\n return (\n <a className={className} href={`#/${encodeURIComponent(id)}`} onClick={follow}>\n {children}\n </a>\n );\n}\n\nfunction DependencyList({ label, titles, empty }: { label: string; titles: readonly string[]; empty: string }) {\n const labelId = useId();\n return (\n <div className=\"fg-index-deps__row\">\n <dt id={labelId} className=\"fg-index-deps__label\">\n {label}\n </dt>\n <dd className=\"fg-index-deps__value\">\n {titles.length === 0 ? (\n <span className=\"fg-index-deps__empty\">{empty}</span>\n ) : (\n <ul className=\"fg-index-deps__list\" aria-labelledby={labelId}>\n {titles.map((title) => {\n const cut = title.lastIndexOf('/') + 1;\n return (\n <li key={title}>\n <OpenLink className=\"fg-index-deps__link\" id={indexId(title)}>\n <span className=\"fg-index-deps__prefix\">{title.slice(0, cut)}</span>\n {title.slice(cut)}\n </OpenLink>\n </li>\n );\n })}\n </ul>\n )}\n </dd>\n </div>\n );\n}\n\n/** The listed components this one uses and those that use it, read from source. Nothing for a gallery. */\nexport function IndexDependencies() {\n const { gallery, dependencies } = useEnv();\n if (gallery || !dependencies) return null;\n if (dependencies.source === null) {\n return (\n <p className=\"fg-index-deps__none\">\n forge found no source file for this component, so it lists none of its dependencies. It looks for the\n import the meta’s <code>component</code> names, or else the one the title’s last segment names.\n </p>\n );\n }\n return (\n <dl className=\"fg-index-deps\" aria-label=\"Dependencies\">\n <DependencyList label=\"Uses\" titles={dependencies.uses} empty=\"No listed component.\" />\n <DependencyList label=\"Used by\" titles={dependencies.usedBy} empty=\"No listed component uses it.\" />\n </dl>\n );\n}\n\nconst DAY = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium' });\n\nfunction HistoryDate({ label, iso, version }: { label: string; iso: string; version: string | null }) {\n return (\n <div className=\"fg-index-history__item\">\n <dt className=\"fg-index-history__label\">{label}</dt>\n <dd className={`fg-index-history__value ${num.numeric}`}>\n <time dateTime={iso}>{DAY.format(new Date(iso))}</time> ({version ?? 'unreleased'})\n </dd>\n </div>\n );\n}\n\n/** When the component's source file was created and last changed, each with the release that shipped it, read from\n * git. Nothing for a gallery, or for a source file git has never committed. */\nexport function IndexHistory() {\n const { gallery, dependencies } = useEnv();\n const history = gallery ? undefined : dependencies?.history;\n if (!history) return null;\n return (\n <dl className=\"fg-index-history\" aria-label=\"History\">\n <HistoryDate label=\"Created\" iso={history.created} version={history.introduced} />\n <HistoryDate label=\"Modified\" iso={history.modified} version={history.modifiedIn} />\n </dl>\n );\n}\n\nfunction StorySection({ story, variants }: { story: LoadedStory; variants: boolean }) {\n const env = useEnv();\n const headingId = useId();\n const description = env.descriptions[story.id];\n const gallery = !env.gallery && env.galleries?.includes(story.id);\n const lab = env.labs?.includes(story.id) ?? false;\n return (\n <section className=\"fg-index-story\" aria-labelledby={headingId}>\n <div className=\"fg-index-story__main\">\n <div className=\"fg-index-story__text\">\n <header className=\"fg-index-story__head\">\n <h2 id={headingId} className=\"fg-index-story__name\">\n <OpenLink className=\"fg-index-story__link\" id={story.id}>\n {story.name}\n </OpenLink>\n </h2>\n {gallery ? <GalleryBadge /> : null}\n {lab ? <LabBadge /> : null}\n </header>\n {description ? <Description text={description} className=\"fg-index-story__description\" /> : null}\n </div>\n {lab ? null : <IndexStory story={story} />}\n </div>\n {variants ? <IndexVariants story={story} /> : null}\n </section>\n );\n}\n\n/** Which of `stories` show their variants: the first of each set of controls, leaving out labs. Stories of one CSF\n * file share their meta's controls, and the same rows under every story would only repeat. */\nfunction firstOfEachControlSet(stories: readonly LoadedStory[], labs: readonly string[]): Set<string> {\n const seen = new Set<string>();\n const shown = new Set<string>();\n for (const story of stories) {\n if (labs.includes(story.id)) continue;\n const key = JSON.stringify(variantRows(story.config));\n if (seen.has(key)) continue;\n seen.add(key);\n shown.add(story.id);\n }\n return shown;\n}\n\n/** The generated page: the component's title and description, then each story, with the variants of the first of\n * each set of controls. */\nexport function DefaultIndex() {\n const env = useEnv();\n const withVariants = useMemo(() => firstOfEachControlSet(env.stories, env.labs ?? []), [env.stories, env.labs]);\n const segments = env.title.split('/');\n const name = segments.pop();\n const { library } = env;\n if (library !== undefined && segments[0] === library) segments.shift();\n return (\n <article className=\"fg-index\">\n <header className=\"fg-index__head\">\n {segments.length > 0 || library !== undefined ? (\n <p className=\"fg-index__path\">\n {library !== undefined ? <LibraryBadge library={library} className=\"fg-index__library\" /> : null}\n {segments.join(' / ')}\n </p>\n ) : null}\n <div className=\"fg-index__title-row\">\n <h1 className=\"fg-index__title\">{name}</h1>\n {env.gallery ? <GalleryBadge /> : null}\n </div>\n {env.description ? <Description text={env.description} className=\"fg-index__description\" /> : null}\n <IndexHistory />\n <IndexDependencies />\n </header>\n {env.stories.map((story) => (\n <StorySection key={story.id} story={story} variants={withVariants.has(story.id)} />\n ))}\n </article>\n );\n}\n\n/** What a component's own index page is handed. */\nexport function indexContext(env: IndexEnv): IndexContext {\n return {\n title: env.title,\n ...(env.description === undefined ? {} : { description: env.description }),\n stories: env.stories,\n globals: env.globals,\n Story: IndexStory,\n Variants: IndexVariants,\n DefaultIndex,\n Dependencies: IndexDependencies,\n History: IndexHistory,\n gallery: env.gallery ?? false,\n open: env.open,\n };\n}\n\n/** The page itself: the component's own, or the generated one. */\nexport function IndexPage({ env, render }: { env: IndexEnv; render: ((ctx: IndexContext) => ReactNode) | null }) {\n return (\n <IndexEnvContext.Provider value={env}>{render ? render(indexContext(env)) : <DefaultIndex />}</IndexEnvContext.Provider>\n );\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isSafeOverride } from './chunk-5WS67HMU.js';
|
|
2
|
+
|
|
3
|
+
// src/title.ts
|
|
4
|
+
var DEFAULT_TITLE = "weaselforge";
|
|
5
|
+
|
|
6
|
+
// src/vite/capture/payload.ts
|
|
7
|
+
var messageOf = (err) => err instanceof Error ? err.message : String(err);
|
|
8
|
+
var CAPTURE_PATH = "__forge/capture";
|
|
9
|
+
var CAPTURE_PAGES = { shell: "__forge/capture.html", frame: "__forge/capture-frame.html" };
|
|
10
|
+
var MIN_DPR = 1;
|
|
11
|
+
var MAX_DPR = 3;
|
|
12
|
+
var LAYOUTS = ["centered", "padded", "fullscreen"];
|
|
13
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
var finite = (n) => typeof n === "number" && Number.isFinite(n);
|
|
15
|
+
var positive = (n) => finite(n) && n > 0;
|
|
16
|
+
function parsePayload(body) {
|
|
17
|
+
if (!isRecord(body)) return { error: "a capture payload is an object" };
|
|
18
|
+
const { story, isolate, config, state, globals, overrides, playhead, box, layout, dpr, scroll, lab, colorScheme } = body;
|
|
19
|
+
if (typeof story !== "string" || story === "") return { error: "story must be an index id" };
|
|
20
|
+
if (typeof isolate !== "boolean") return { error: "isolate must be a boolean" };
|
|
21
|
+
if (!isRecord(globals)) return { error: "globals must be an object" };
|
|
22
|
+
if (!isRecord(overrides) || !Object.values(overrides).every((v) => typeof v === "string")) {
|
|
23
|
+
return { error: "overrides must map property names to strings" };
|
|
24
|
+
}
|
|
25
|
+
const unsafe = Object.entries(overrides).find(([name, value]) => !isSafeOverride(name, value));
|
|
26
|
+
if (unsafe) return { error: `overrides must name custom properties, with no { } or ; in a value: ${unsafe[0]}` };
|
|
27
|
+
if (playhead !== null && !(typeof playhead === "number" && Number.isFinite(playhead))) {
|
|
28
|
+
return { error: "playhead must be a number or null" };
|
|
29
|
+
}
|
|
30
|
+
if (!isRecord(box) || !positive(box.width) || !positive(box.height)) {
|
|
31
|
+
return { error: "box must have a positive width and height" };
|
|
32
|
+
}
|
|
33
|
+
if (typeof layout !== "string" || !LAYOUTS.includes(layout)) return { error: `layout must be one of ${LAYOUTS.join(", ")}` };
|
|
34
|
+
if (typeof dpr !== "number" || !(dpr >= MIN_DPR && dpr <= MAX_DPR)) return { error: `dpr must be in [${MIN_DPR}, ${MAX_DPR}]` };
|
|
35
|
+
if (!isRecord(scroll) || !finite(scroll.left) || !finite(scroll.top)) return { error: "scroll must hold a finite left and top" };
|
|
36
|
+
if (!isRecord(lab) || !isRecord(lab.globals) || lab.mode !== "light" && lab.mode !== "dark") {
|
|
37
|
+
return { error: "lab must hold globals and a mode of light or dark" };
|
|
38
|
+
}
|
|
39
|
+
if (colorScheme !== "light" && colorScheme !== "dark") return { error: "colorScheme must be light or dark" };
|
|
40
|
+
return {
|
|
41
|
+
story,
|
|
42
|
+
isolate,
|
|
43
|
+
config,
|
|
44
|
+
state,
|
|
45
|
+
globals,
|
|
46
|
+
overrides,
|
|
47
|
+
playhead,
|
|
48
|
+
box: { width: box.width, height: box.height },
|
|
49
|
+
layout,
|
|
50
|
+
dpr,
|
|
51
|
+
scroll: { left: scroll.left, top: scroll.top },
|
|
52
|
+
lab: { globals: lab.globals, mode: lab.mode },
|
|
53
|
+
colorScheme
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { CAPTURE_PAGES, CAPTURE_PATH, DEFAULT_TITLE, MAX_DPR, MIN_DPR, messageOf, parsePayload };
|
|
58
|
+
//# sourceMappingURL=chunk-ORMMZ5PV.js.map
|
|
59
|
+
//# sourceMappingURL=chunk-ORMMZ5PV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/title.ts","../src/vite/capture/payload.ts"],"names":[],"mappings":";;;AACO,IAAM,aAAA,GAAgB;;;ACiCtB,IAAM,SAAA,GAAY,CAAC,GAAA,KAA0B,GAAA,YAAe,QAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG;AAG5F,IAAM,YAAA,GAAe;AAGrB,IAAM,aAAA,GAAgB,EAAE,KAAA,EAAO,sBAAA,EAAwB,OAAO,4BAAA;AAE9D,IAAM,OAAA,GAAU;AAChB,IAAM,OAAA,GAAU;AAEvB,IAAM,OAAA,GAA6B,CAAC,UAAA,EAAY,QAAA,EAAU,YAAY,CAAA;AAEtE,IAAM,QAAA,GAAW,CAAC,KAAA,KAChB,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,IAAQ,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAErE,IAAM,MAAA,GAAS,CAAC,CAAA,KAA4B,OAAO,MAAM,QAAA,IAAY,MAAA,CAAO,SAAS,CAAC,CAAA;AACtF,IAAM,WAAW,CAAC,CAAA,KAA4B,MA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A,QAAA;AAAA,IACA,KAAK,EAAE,KAAA,EAAO,IAAI,KAAA,EAAO,MAAA,EAAQ,IAAI,MAAA,EAAO;AAAA,IAC5C,MAAA;AAAA,IACA,GAAA;AAAA,IACA,QAAQ,EAAE,IAAA,EAAM,OAAO,IAAA,EAAM,GAAA,EAAK,OAAO,GAAA,EAAI;AAAA,IAC7C,KAAK,EAAE,OAAA,EAAS,IAAI,OAAA,EAAS,IAAA,EAAM,IAAI,IAAA,EAAK;AAAA,IAC5C;AAAA,GACF;AACF","file":"chunk-ORMMZ5PV.js","sourcesContent":["/** The workshop's name when the shell config gives none: in its header, and as the document title. */\nexport const DEFAULT_TITLE = 'weaselforge';\n","import { isSafeOverride } from '../../frame/safeOverride.ts';\nimport type { Globals, Layout } from '../../protocol/messages.ts';\n\n/** Everything the screen renders a story from, as the capture endpoint takes it. */\nexport interface CapturePayload {\n /** The story's index id. */\n story: string;\n /** Picks the document: an isolated story renders under frame styles, any other under shell styles. */\n isolate: boolean;\n /** The story's config, with forge's `$` keys stripped and a comparison's args laid over. */\n config: unknown;\n /** Must survive JSON. */\n state: unknown;\n globals: Globals;\n /** CSS variable overrides, by property name. */\n overrides: Readonly<Record<string, string>>;\n /** Null for a story with no timeline, and for an isolated story. */\n playhead: number | null;\n /** The host's size in CSS pixels. */\n box: { width: number; height: number };\n layout: Layout;\n /** Device pixel ratio, in [1, 3]. */\n dpr: number;\n /** Where the story's scroller stands in its host, in CSS pixels, so the capture shows the patch the screen does. */\n scroll: { left: number; top: number };\n /** The workshop lab's theme as the screen shows it: the lab's globals, which the shell config's `labTheme` reads,\n * and its resolved color mode. An isolated story's document has no lab, and ignores it. */\n lab: { globals: Globals; mode: 'light' | 'dark' };\n /** The OS color scheme the screen sees, which the capture page emulates: a story or a lab in `auto` mode follows\n * `prefers-color-scheme`, and headless Chromium would otherwise answer light. */\n colorScheme: 'light' | 'dark';\n}\n\n/** What a capture failure says: an error's message, or anything else as a string. */\nexport const messageOf = (err: unknown): string => (err instanceof Error ? err.message : String(err));\n\n/** Where the endpoint answers, under the dev server's base. */\nexport const CAPTURE_PATH = '__forge/capture';\n\n/** The pages a capture renders on, under the dev server's base: one per document a story can render in. */\nexport const CAPTURE_PAGES = { shell: '__forge/capture.html', frame: '__forge/capture-frame.html' };\n\nexport const MIN_DPR = 1;\nexport const MAX_DPR = 3;\n\nconst LAYOUTS: readonly string[] = ['centered', 'padded', 'fullscreen'] satisfies readonly Layout[];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst finite = (n: unknown): n is number => typeof n === 'number' && Number.isFinite(n);\nconst positive = (n: unknown): n is number => finite(n) && n > 0;\n\n/** Reads a request body as a payload, or names the first field it rejects. */\nexport function parsePayload(body: unknown): CapturePayload | { error: string } {\n if (!isRecord(body)) return { error: 'a capture payload is an object' };\n const { story, isolate, config, state, globals, overrides, playhead, box, layout, dpr, scroll, lab, colorScheme } = body;\n if (typeof story !== 'string' || story === '') return { error: 'story must be an index id' };\n if (typeof isolate !== 'boolean') return { error: 'isolate must be a boolean' };\n if (!isRecord(globals)) return { error: 'globals must be an object' };\n if (!isRecord(overrides) || !Object.values(overrides).every((v) => typeof v === 'string')) {\n return { error: 'overrides must map property names to strings' };\n }\n const unsafe = Object.entries(overrides as Record<string, string>).find(([name, value]) => !isSafeOverride(name, value));\n if (unsafe) return { error: `overrides must name custom properties, with no { } or ; in a value: ${unsafe[0]}` };\n if (playhead !== null && !(typeof playhead === 'number' && Number.isFinite(playhead))) {\n return { error: 'playhead must be a number or null' };\n }\n if (!isRecord(box) || !positive(box.width) || !positive(box.height)) {\n return { error: 'box must have a positive width and height' };\n }\n if (typeof layout !== 'string' || !LAYOUTS.includes(layout)) return { error: `layout must be one of ${LAYOUTS.join(', ')}` };\n if (typeof dpr !== 'number' || !(dpr >= MIN_DPR && dpr <= MAX_DPR)) return { error: `dpr must be in [${MIN_DPR}, ${MAX_DPR}]` };\n if (!isRecord(scroll) || !finite(scroll.left) || !finite(scroll.top)) return { error: 'scroll must hold a finite left and top' };\n if (!isRecord(lab) || !isRecord(lab.globals) || (lab.mode !== 'light' && lab.mode !== 'dark')) {\n return { error: 'lab must hold globals and a mode of light or dark' };\n }\n if (colorScheme !== 'light' && colorScheme !== 'dark') return { error: 'colorScheme must be light or dark' };\n return {\n story,\n isolate,\n config,\n state,\n globals,\n overrides: overrides as Record<string, string>,\n playhead,\n box: { width: box.width, height: box.height },\n layout: layout as Layout,\n dpr,\n scroll: { left: scroll.left, top: scroll.top },\n lab: { globals: lab.globals, mode: lab.mode },\n colorScheme,\n };\n}\n"]}
|