@weasel-js/forge 1.9.3 → 1.10.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 +34 -4
- package/dist/{FrameController-CpcY0DNB.d.ts → FrameController-UeTY7ubF.d.ts} +26 -36
- package/dist/{chunk-Q2EZXJFE.js → chunk-4NM3RTYK.js} +70 -56
- package/dist/chunk-4NM3RTYK.js.map +1 -0
- package/dist/chunk-5DXUNLV2.js +6 -0
- package/dist/chunk-5DXUNLV2.js.map +1 -0
- package/dist/{chunk-GZPQMGXJ.js → chunk-DFKCLZKS.js} +5 -4
- package/dist/chunk-DFKCLZKS.js.map +1 -0
- package/dist/{chunk-CJX3W5HY.js → chunk-DKWHGSBZ.js} +4 -3
- package/dist/chunk-DKWHGSBZ.js.map +1 -0
- package/dist/{chunk-BGOHALHO.js → chunk-ENXU34PI.js} +23 -111
- package/dist/chunk-ENXU34PI.js.map +1 -0
- package/dist/chunk-FL2MUPUL.js +10 -0
- package/dist/chunk-FL2MUPUL.js.map +1 -0
- package/dist/{chunk-MGQWCPYE.js → chunk-GB6PRJET.js} +4 -5
- package/dist/chunk-GB6PRJET.js.map +1 -0
- package/dist/{chunk-JVRHBI3V.js → chunk-V4RI7GWD.js} +53 -59
- package/dist/chunk-V4RI7GWD.js.map +1 -0
- package/dist/{chunk-HRGPFQBW.js → chunk-ZAWXMUGZ.js} +6 -3
- package/dist/chunk-ZAWXMUGZ.js.map +1 -0
- package/dist/{config-BfsYw5lg.d.ts → config-Cz7ZyGF-.d.ts} +28 -5
- package/dist/csf/preview-api.d.ts +5 -2
- package/dist/csf/preview-api.js +2 -2
- package/dist/csf/preview-api.js.map +1 -1
- package/dist/frame/index.css +19 -2
- package/dist/frame/index.css.map +1 -1
- package/dist/frame/index.d.ts +2 -2
- package/dist/frame/index.js +7 -41
- package/dist/frame/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/shell/index.css +93 -62
- package/dist/shell/index.css.map +1 -1
- package/dist/shell/index.d.ts +10 -17
- package/dist/shell/index.js +724 -587
- package/dist/shell/index.js.map +1 -1
- package/dist/test/index.d.ts +4 -2
- package/dist/test/index.js +8 -8
- package/dist/test/index.js.map +1 -1
- package/dist/test/play.d.ts +2 -4
- package/dist/test/play.js.map +1 -1
- package/dist/vite/index.d.ts +19 -2
- package/dist/vite/index.js +751 -162
- package/dist/vite/index.js.map +1 -1
- package/package.json +10 -5
- package/dist/chunk-BGOHALHO.js.map +0 -1
- package/dist/chunk-CJX3W5HY.js.map +0 -1
- package/dist/chunk-GZPQMGXJ.js.map +0 -1
- package/dist/chunk-HRGPFQBW.js.map +0 -1
- package/dist/chunk-JVRHBI3V.js.map +0 -1
- package/dist/chunk-KJGXJD3U.js +0 -15
- package/dist/chunk-KJGXJD3U.js.map +0 -1
- package/dist/chunk-MGQWCPYE.js.map +0 -1
- package/dist/chunk-Q2EZXJFE.js.map +0 -1
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { StoryHost } from './chunk-
|
|
2
|
-
import { sanitize } from './chunk-
|
|
3
|
-
import { PROTOCOL_VERSION
|
|
4
|
-
import { f,
|
|
1
|
+
import { useNearViewport, StoryHost } from './chunk-4NM3RTYK.js';
|
|
2
|
+
import { sanitize } from './chunk-ZAWXMUGZ.js';
|
|
3
|
+
import { PROTOCOL_VERSION } from './chunk-FL2MUPUL.js';
|
|
4
|
+
import { f, resolveConfigSchema, isEntryShown, isConfigBranch, schemaNodeAtPath, titleCase } from '@weasel-js/labkit/config';
|
|
5
|
+
import { createEmitter } from '@weasel-js/registry';
|
|
6
|
+
import { createContext, useContext, useMemo, useState, useRef, useEffect, useId } from 'react';
|
|
5
7
|
import { Badge } from '@weasel-js/ui/components/Badge';
|
|
6
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
9
|
import { Button } from '@weasel-js/ui/components/Button';
|
|
8
|
-
import {
|
|
10
|
+
import { isPlainObject } from '@weasel-js/core';
|
|
11
|
+
import num from '@weasel-js/theme/numeric.module.css';
|
|
9
12
|
|
|
10
13
|
var joinPath = (at, key) => at === "" ? key : `${at}.${key}`;
|
|
11
14
|
function describeShape(shape) {
|
|
@@ -65,18 +68,17 @@ function answerSchema(schema, config) {
|
|
|
65
68
|
const hidden = [];
|
|
66
69
|
const errors = {};
|
|
67
70
|
const record = config;
|
|
68
|
-
|
|
71
|
+
const { group } = resolveConfigSchema(schema);
|
|
69
72
|
const walk = (shape, at) => {
|
|
70
73
|
for (const [key, entry] of Object.entries(shape)) {
|
|
71
74
|
const path = joinPath(at, key);
|
|
72
|
-
if (entry
|
|
75
|
+
if (!isEntryShown(entry, record, group)) hidden.push(path);
|
|
73
76
|
if (isConfigBranch(entry)) {
|
|
74
77
|
walk(entry.children, path);
|
|
75
78
|
continue;
|
|
76
79
|
}
|
|
77
80
|
const { validate } = entry.options;
|
|
78
81
|
if (!validate) continue;
|
|
79
|
-
group ??= resolveConfigSchema(schema).group;
|
|
80
82
|
const leaf = schemaNodeAtPath(group, path);
|
|
81
83
|
if (!leaf || "children" in leaf) continue;
|
|
82
84
|
const found = validate(leaf, record);
|
|
@@ -86,10 +88,8 @@ function answerSchema(schema, config) {
|
|
|
86
88
|
walk(schema.nodes, "");
|
|
87
89
|
return { hidden, errors };
|
|
88
90
|
}
|
|
89
|
-
|
|
90
|
-
// src/protocol/channel.ts
|
|
91
91
|
function openChannel(port, options = {}) {
|
|
92
|
-
const
|
|
92
|
+
const messages = createEmitter();
|
|
93
93
|
const onMessage = (event) => {
|
|
94
94
|
const data = event.data;
|
|
95
95
|
if (typeof data !== "object" || data === null || !("msg" in data)) {
|
|
@@ -101,19 +101,15 @@ function openChannel(port, options = {}) {
|
|
|
101
101
|
options.onMismatch?.({ reason: "version", version: envelope.v });
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
messages.emit(envelope.msg);
|
|
105
105
|
};
|
|
106
106
|
port.addEventListener("message", onMessage);
|
|
107
107
|
port.start?.();
|
|
108
108
|
return {
|
|
109
109
|
send: (msg) => port.postMessage({ v: PROTOCOL_VERSION, msg }),
|
|
110
|
-
on:
|
|
111
|
-
listeners.add(fn);
|
|
112
|
-
return () => listeners.delete(fn);
|
|
113
|
-
},
|
|
110
|
+
on: messages.subscribe,
|
|
114
111
|
close: () => {
|
|
115
112
|
port.removeEventListener("message", onMessage);
|
|
116
|
-
listeners.clear();
|
|
117
113
|
port.close();
|
|
118
114
|
}
|
|
119
115
|
};
|
|
@@ -153,43 +149,33 @@ function indexEntries(stories) {
|
|
|
153
149
|
}
|
|
154
150
|
return [...byTitle.values()];
|
|
155
151
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
];
|
|
165
|
-
function libraryOf(entry) {
|
|
166
|
-
const file = entry.file.replaceAll("\\", "/");
|
|
167
|
-
for (const [marker, label] of LIBRARIES) {
|
|
168
|
-
if (file.includes(marker)) return label;
|
|
169
|
-
}
|
|
170
|
-
return entry.title.split("/")[0] ?? entry.title;
|
|
152
|
+
function librariesFrom(table = []) {
|
|
153
|
+
return {
|
|
154
|
+
of(entry) {
|
|
155
|
+
const file = entry.file.replaceAll("\\", "/");
|
|
156
|
+
return table.find((library) => file.includes(library.path))?.label ?? entry.title.split("/")[0] ?? entry.title;
|
|
157
|
+
},
|
|
158
|
+
toneOf: (label) => table.find((library) => library.label === label)?.tone
|
|
159
|
+
};
|
|
171
160
|
}
|
|
172
|
-
var
|
|
173
|
-
var
|
|
174
|
-
ui: tone("amber", 55, 40),
|
|
175
|
-
labkit: tone("teal", 55, 45),
|
|
176
|
-
forge: tone("blue", 55, 35),
|
|
177
|
-
draw: tone("rose", 55, 35)
|
|
178
|
-
};
|
|
161
|
+
var TITLE_LIBRARIES = librariesFrom();
|
|
162
|
+
var LibrariesContext = createContext(TITLE_LIBRARIES);
|
|
179
163
|
function LibraryBadge({ library, className }) {
|
|
180
|
-
|
|
164
|
+
const tone = useContext(LibrariesContext).toneOf(library);
|
|
165
|
+
return /* @__PURE__ */ jsx(Badge, { status: "muted", ...tone === void 0 ? {} : { tone }, variant: "subtle", size: "sm", ...className ? { className } : {}, children: library });
|
|
181
166
|
}
|
|
182
167
|
var MAX_ENUM_OPTIONS = 8;
|
|
183
168
|
var MAX_ROWS = 6;
|
|
184
169
|
var labelOf = (key, name) => name ?? titleCase(key);
|
|
185
170
|
function variantRows(schema) {
|
|
186
171
|
const defaults = schema.defaults();
|
|
172
|
+
const { group } = resolveConfigSchema(schema);
|
|
187
173
|
const rows = [];
|
|
188
174
|
const walk = (shape, at) => {
|
|
189
175
|
for (const [key, entry] of Object.entries(shape)) {
|
|
190
176
|
if (rows.length >= MAX_ROWS) return;
|
|
191
177
|
const path = at === "" ? key : `${at}.${key}`;
|
|
192
|
-
if (entry
|
|
178
|
+
if (!isEntryShown(entry, defaults, group)) continue;
|
|
193
179
|
if (isConfigBranch(entry)) {
|
|
194
180
|
walk(entry.children, path);
|
|
195
181
|
continue;
|
|
@@ -227,26 +213,12 @@ function useEnv() {
|
|
|
227
213
|
return env;
|
|
228
214
|
}
|
|
229
215
|
var NEAR_MARGIN = "100%";
|
|
230
|
-
function useNearViewport(ref) {
|
|
231
|
-
const [near, setNear] = useState(typeof IntersectionObserver === "undefined");
|
|
232
|
-
useEffect(() => {
|
|
233
|
-
const el = ref.current;
|
|
234
|
-
if (!el || typeof IntersectionObserver === "undefined") return;
|
|
235
|
-
const observer = new IntersectionObserver((entries) => {
|
|
236
|
-
const last = entries.at(-1);
|
|
237
|
-
if (last) setNear(last.isIntersecting);
|
|
238
|
-
}, { rootMargin: NEAR_MARGIN });
|
|
239
|
-
observer.observe(el);
|
|
240
|
-
return () => observer.disconnect();
|
|
241
|
-
}, [ref]);
|
|
242
|
-
return near;
|
|
243
|
-
}
|
|
244
216
|
function IndexStory({ story, config: over, label }) {
|
|
245
217
|
const env = useEnv();
|
|
246
218
|
const [config, setConfig] = useState(() => mergeConfig(story.config.defaults(), over));
|
|
247
219
|
const [state, setState] = useState(() => story.initialState?.(config) ?? null);
|
|
248
220
|
const cell = useRef(null);
|
|
249
|
-
const near = useNearViewport(cell);
|
|
221
|
+
const near = useNearViewport(cell, NEAR_MARGIN, false);
|
|
250
222
|
const [height, setHeight] = useState(null);
|
|
251
223
|
useEffect(() => {
|
|
252
224
|
const el = cell.current;
|
|
@@ -332,6 +304,26 @@ function IndexDependencies() {
|
|
|
332
304
|
/* @__PURE__ */ jsx(DependencyList, { label: "Used by", titles: dependencies.usedBy, empty: "No listed component uses it." })
|
|
333
305
|
] });
|
|
334
306
|
}
|
|
307
|
+
var DAY = new Intl.DateTimeFormat(void 0, { dateStyle: "medium" });
|
|
308
|
+
function HistoryDate({ label, iso }) {
|
|
309
|
+
return /* @__PURE__ */ jsxs("div", { className: "fg-index-history__item", children: [
|
|
310
|
+
/* @__PURE__ */ jsx("dt", { className: "fg-index-history__label", children: label }),
|
|
311
|
+
/* @__PURE__ */ jsx("dd", { className: `fg-index-history__value ${num.numeric}`, children: /* @__PURE__ */ jsx("time", { dateTime: iso, children: DAY.format(new Date(iso)) }) })
|
|
312
|
+
] });
|
|
313
|
+
}
|
|
314
|
+
function IndexHistory() {
|
|
315
|
+
const { gallery, dependencies } = useEnv();
|
|
316
|
+
const history = gallery ? void 0 : dependencies?.history;
|
|
317
|
+
if (!history) return null;
|
|
318
|
+
return /* @__PURE__ */ jsxs("dl", { className: "fg-index-history", "aria-label": "History", children: [
|
|
319
|
+
/* @__PURE__ */ jsxs("div", { className: "fg-index-history__item", children: [
|
|
320
|
+
/* @__PURE__ */ jsx("dt", { className: "fg-index-history__label", children: "Since" }),
|
|
321
|
+
/* @__PURE__ */ jsx("dd", { className: `fg-index-history__value ${num.numeric}`, children: history.introduced ?? "Unreleased" })
|
|
322
|
+
] }),
|
|
323
|
+
/* @__PURE__ */ jsx(HistoryDate, { label: "Created", iso: history.created }),
|
|
324
|
+
/* @__PURE__ */ jsx(HistoryDate, { label: "Modified", iso: history.modified })
|
|
325
|
+
] });
|
|
326
|
+
}
|
|
335
327
|
function StorySection({ story, variants }) {
|
|
336
328
|
const env = useEnv();
|
|
337
329
|
const headingId = useId();
|
|
@@ -377,6 +369,7 @@ function DefaultIndex() {
|
|
|
377
369
|
env.gallery ? /* @__PURE__ */ jsx(GalleryBadge, {}) : null
|
|
378
370
|
] }),
|
|
379
371
|
env.description ? /* @__PURE__ */ jsx("p", { className: "fg-index__description", children: env.description }) : null,
|
|
372
|
+
/* @__PURE__ */ jsx(IndexHistory, {}),
|
|
380
373
|
/* @__PURE__ */ jsx(IndexDependencies, {})
|
|
381
374
|
] }),
|
|
382
375
|
env.stories.map((story) => /* @__PURE__ */ jsx(StorySection, { story, variants: withVariants.has(story.id) }, story.id))
|
|
@@ -392,6 +385,7 @@ function indexContext(env) {
|
|
|
392
385
|
Variants: IndexVariants,
|
|
393
386
|
DefaultIndex,
|
|
394
387
|
Dependencies: IndexDependencies,
|
|
388
|
+
History: IndexHistory,
|
|
395
389
|
gallery: env.gallery ?? false,
|
|
396
390
|
open: env.open
|
|
397
391
|
};
|
|
@@ -400,6 +394,6 @@ function IndexPage({ env, render }) {
|
|
|
400
394
|
return /* @__PURE__ */ jsx(IndexEnvContext.Provider, { value: env, children: render ? render(indexContext(env)) : /* @__PURE__ */ jsx(DefaultIndex, {}) });
|
|
401
395
|
}
|
|
402
396
|
|
|
403
|
-
export { IndexPage, LibraryBadge, answerSchema, describeSchema, indexEntries, indexId, isIndexId,
|
|
404
|
-
//# sourceMappingURL=chunk-
|
|
405
|
-
//# sourceMappingURL=chunk-
|
|
397
|
+
export { IndexPage, LibrariesContext, LibraryBadge, TITLE_LIBRARIES, answerSchema, describeSchema, indexEntries, indexId, isIndexId, librariesFrom, openChannel, schemaFromDescription };
|
|
398
|
+
//# sourceMappingURL=chunk-V4RI7GWD.js.map
|
|
399
|
+
//# sourceMappingURL=chunk-V4RI7GWD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/protocol/schema.ts","../src/protocol/channel.ts","../src/story/indexPages.ts","../src/story/library.ts","../src/frame/index/LibraryBadge.tsx","../src/frame/index/variants.ts","../src/frame/index/IndexPage.tsx"],"names":["resolveConfigSchema","isEntryShown","isConfigBranch","createContext","useContext","jsx","Badge"],"mappings":";;;;;;;;;;;;AAyDA,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,WAAA,EAAY;AAAA,MACpC,GAAI,OAAA,KAAY,MAAA,GAAY,EAAC,GAAI,EAAE,OAAA,EAAS,EAAE,GAAG,OAAA,EAAQ,EAAE;AAAA,MAC3D,aAAa,MAAA,KAAW;AAAA,KAC1B;AACA,IAAA,GAAA,CAAI,GAAG,CAAA,GAAI,cAAA,CAAe,KAAK,IAC3B,EAAE,MAAA,EAAQ,IAAA,EAAM,GAAG,QAAQ,QAAA,EAAU,aAAA,CAAc,KAAA,CAAM,QAAQ,GAAE,GACnE;AAAA,MACE,MAAA,EAAQ,KAAA;AAAA,MACR,MAAM,KAAA,CAAM,IAAA;AAAA,MACZ,SAAS,KAAA,CAAM,OAAA;AAAA,MACf,GAAG,MAAA;AAAA,MACH,SAAA,EAAW,KAAA,CAAM,OAAA,CAAQ,QAAA,KAAa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I,KAAA,CAAM,EAAE,CAAA,EAAA,EAA3D,KAAA,CAAM,EAAwD,CAClF;AAAA,GAAA,EACH,CAAA;AAEJ;AAGO,SAAS,aAAa,GAAA,EAA6B;AACxD,EAAA,OAAO;AAAA,IACL,OAAO,GAAA,CAAI,KAAA;AAAA,IACX,GAAI,IAAI,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,WAAA,EAAa,GAAA,CAAI,WAAA,EAAY;AAAA,IACxE,SAAS,GAAA,CAAI,OAAA;AAAA,IACb,SAAS,GAAA,CAAI,OAAA;AAAA,IACb,KAAA,EAAO,UAAA;AAAA,IACP,QAAA,EAAU,aAAA;AAAA,IACV,YAAA;AAAA,IACA,YAAA,EAAc,iBAAA;AAAA,IACd,OAAA,EAAS,YAAA;AAAA,IACT,OAAA,EAAS,IAAI,OAAA,IAAW,KAAA;AAAA,IACxB,MAAM,GAAA,CAAI;AAAA,GACZ;AACF;AAGO,SAAS,SAAA,CAAU,EAAE,GAAA,EAAK,MAAA,EAAO,EAAyE;AAC/G,EAAA,uBACEA,GAAAA,CAAC,eAAA,CAAgB,QAAA,EAAhB,EAAyB,OAAO,GAAA,EAAM,QAAA,EAAA,MAAA,GAAS,MAAA,CAAO,YAAA,CAAa,GAAG,CAAC,CAAA,mBAAIA,GAAAA,CAAC,gBAAa,CAAA,EAAG,CAAA;AAEjG","file":"chunk-V4RI7GWD.js","sourcesContent":["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 { sanitize } from './ids';\nimport type { IndexEntry } from './types';\n\nconst SUFFIX = ':index';\n\n/** The name an index page goes by in the sidebar and in its trial's title. */\nexport const INDEX_NAME = 'Index';\n\n/** The id of `title`'s index page. A colon never survives `sanitize`, so no story id can collide with it. */\nexport function indexId(title: string): string {\n return `${sanitize(title)}${SUFFIX}`;\n}\n\nexport function isIndexId(id: string): boolean {\n return id.endsWith(SUFFIX);\n}\n\n/**\n * One index-page entry per title in `stories`, in the order titles first appear. It routes and runs like a story:\n * its `file` is the title's first story file, its descriptions are the title's own, and its tags are those every story\n * of the title carries.\n */\nexport function indexEntries(stories: readonly IndexEntry[]): IndexEntry[] {\n const byTitle = new Map<string, IndexEntry>();\n for (const entry of stories) {\n const page = byTitle.get(entry.title);\n if (page) {\n if (page.tags) {\n const common = page.tags.filter((tag) => entry.tags?.includes(tag));\n if (common.length > 0) page.tags = common;\n else delete page.tags;\n }\n continue;\n }\n byTitle.set(entry.title, {\n id: indexId(entry.title),\n title: entry.title,\n name: INDEX_NAME,\n exportName: '',\n file: entry.file,\n ...(entry.componentDescription === undefined ? {} : { componentDescription: entry.componentDescription }),\n ...(entry.componentName === undefined ? {} : { componentName: entry.componentName }),\n ...(entry.tags === undefined ? {} : { tags: entry.tags }),\n });\n }\n return [...byTitle.values()];\n}\n","import type { StanceProps } from '@weasel-js/ui';\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 tone of the library's badge, as a `<Badge>` takes one. Default: the badge's own muted tone. */\n tone?: StanceProps['tone'];\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 toneOf(label: string): StanceProps['tone'];\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 toneOf: (label) => table.find((library) => library.label === label)?.tone,\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 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 tone the project gave that library. */\nexport function LibraryBadge({ library, className }: { library: string; className?: string }) {\n const tone = useContext(LibrariesContext).toneOf(library);\n return (\n <Badge status=\"muted\" {...(tone === undefined ? {} : { tone })} 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 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 { Button } from '@weasel-js/ui/components/Button';\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 { 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 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 status=\"accent\" variant=\"subtle\" size=\"sm\">\n Gallery\n </Badge>\n );\n}\n\nfunction DependencyList({ label, titles, empty }: { label: string; titles: readonly string[]; empty: string }) {\n const env = useEnv();\n const labelId = useId();\n const follow = (event: MouseEvent, id: string) => {\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 <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 const id = indexId(title);\n return (\n <li key={title}>\n <a className=\"fg-index-deps__link\" href={`#/${encodeURIComponent(id)}`} onClick={(event) => follow(event, id)}>\n <span className=\"fg-index-deps__prefix\">{title.slice(0, cut)}</span>\n {title.slice(cut)}\n </a>\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 }: { label: string; iso: string }) {\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>\n </dd>\n </div>\n );\n}\n\n/** The release the component first shipped in, and when its source file was created and last changed, 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 <div className=\"fg-index-history__item\">\n <dt className=\"fg-index-history__label\">Since</dt>\n <dd className={`fg-index-history__value ${num.numeric}`}>{history.introduced ?? 'Unreleased'}</dd>\n </div>\n <HistoryDate label=\"Created\" iso={history.created} />\n <HistoryDate label=\"Modified\" iso={history.modified} />\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 return (\n <section className=\"fg-index-story\" aria-labelledby={headingId}>\n <header className=\"fg-index-story__head\">\n <h2 id={headingId} className=\"fg-index-story__name\">\n {story.name}\n </h2>\n {gallery ? <GalleryBadge /> : null}\n <Button variant=\"secondary\" size=\"sm\" onClick={() => env.open(story.id)}>\n Open\n </Button>\n </header>\n {description ? <p className=\"fg-index-story__description\">{description}</p> : null}\n <IndexStory story={story} />\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. Stories of one CSF file share their\n * meta's controls, and the same rows under every story would only repeat. */\nfunction firstOfEachControlSet(stories: readonly LoadedStory[]): Set<string> {\n const seen = new Set<string>();\n const shown = new Set<string>();\n for (const story of stories) {\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.stories]);\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 ? <p className=\"fg-index__description\">{env.description}</p> : 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"]}
|
|
@@ -14,6 +14,9 @@ function storyNameFromExport(exportName) {
|
|
|
14
14
|
return exportName.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (_, a, b, c) => `${a} ${b}${c}`).replace(/([a-z])([A-Z])/g, (_, a, b) => `${a} ${b}`).replace(/([a-z])([0-9])/gi, (_, a, b) => `${a} ${b}`).replace(/([0-9])([a-z])/gi, (_, a, b) => `${a} ${b}`).replace(/(\s|^)(\w)/g, (_, a, b) => `${a}${b.toUpperCase()}`).replace(/ +/g, " ").trim();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// src/csf/propArgTypes.ts
|
|
18
|
+
var PROP_ARG_TYPES_EXPORT = "__forgeArgTypes";
|
|
19
|
+
|
|
20
|
+
export { PROP_ARG_TYPES_EXPORT, sanitize, storyId, storyNameFromExport };
|
|
21
|
+
//# sourceMappingURL=chunk-ZAWXMUGZ.js.map
|
|
22
|
+
//# sourceMappingURL=chunk-ZAWXMUGZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/ids.ts","../src/csf/propArgTypes.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,EAAE,CAAA;AACtB;AAEA,SAAS,YAAA,CAAa,MAAc,IAAA,EAA+B;AACjE,EAAA,MAAM,SAAA,GAAY,SAAS,IAAI,CAAA;AAC/B,EAAA,IAAI,SAAA,KAAc,IAAI,MAAM,IAAI,MAAM,CAAA,QAAA,EAAW,IAAI,CAAA,EAAA,EAAK,IAAI,CAAA,uCAAA,CAAyC,CAAA;AACvG,EAAA,OAAO,SAAA;AACT;AAEO,SAAS,OAAA,CAAQ,OAAe,UAAA,EAA4B;AACjE,EAAA,OAAO,CAAA,EAAG,aAAa,KAAA,EAAO,MAAM,CAAC,CAAA,EAAA,EAAK,YAAA,CAAa,UAAA,EAAY,MAAM,CAAC,CAAA,CAAA;AAC5E;AAGO,SAAS,oBAAoB,UAAA,EAA4B;AAC9D,EAAA,OAAO,WACJ,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA,CACjB,QAAQ,IAAA,EAAM,GAAG,CAAA,CACjB,OAAA,CAAQ,OAAO,GAAG,CAAA,CAClB,QAAQ,wBAAA,EAA0B,CAAC,GAAG,CAAA,EAAW,CAAA,EAAW,CAAA,KAAc,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,CAAC,GAAG,CAAC,CAAA,CAAE,EACzF,OAAA,CAAQ,iBAAA,EAAmB,CAAC,CAAA,EAAG,GAAW,CAAA,KAAc,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,CAAC,EAAE,CAAA,CACnE,OAAA,CAAQ,kBAAA,EAAoB,CAAC,GAAG,CAAA,EAAW,CAAA,KAAc,CAAA,EAAG,CAAC,IAAI,CAAC,CAAA,CAAE,CAAA,CACpE,OAAA,CAAQ,oBAAoB,CAAC,CAAA,EAAG,GAAW,CAAA,KAAc,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,CAAC,CAAA,CAAE,CAAA,CACpE,QAAQ,aAAA,EAAe,CAAC,GAAG,CAAA,EAAW,CAAA,KAAc,GAAG,CAAC,CAAA,EAAG,CAAA,CAAE,WAAA,EAAa,CAAA,CAAE,CAAA,CAC5E,QAAQ,KAAA,EAAO,GAAG,EAClB,IAAA,EAAK;AACV;;;ACnCO,IAAM,qBAAA,GAAwB","file":"chunk-ZAWXMUGZ.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"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LabMode, LabContribution, LabPage } from '@weasel-js/labkit';
|
|
2
2
|
import { Theme } from '@weasel-js/theme';
|
|
3
3
|
import { ControlRenderer } from '@weasel-js/labkit/config';
|
|
4
|
-
import { G as Globals, F as FrameSetup } from './FrameController-
|
|
5
|
-
import { IconName } from '@weasel-js/ui';
|
|
4
|
+
import { G as Globals, F as FrameSetup } from './FrameController-UeTY7ubF.js';
|
|
5
|
+
import { IconName, StanceProps } from '@weasel-js/ui';
|
|
6
6
|
|
|
7
7
|
/** One global the workshop's toolbar sets for every story, and a trial may pin for its own. */
|
|
8
8
|
interface GlobalDeclaration {
|
|
@@ -37,9 +37,29 @@ type GlobalDeclarations = Readonly<Record<string, GlobalDeclaration>>;
|
|
|
37
37
|
/** A lab value, for a declaration that `follows` the app, meaning whatever the app's chrome is set to. */
|
|
38
38
|
declare const FOLLOW_APP = "app";
|
|
39
39
|
|
|
40
|
+
/** One library of a project: the story files under `path` carry `label`. */
|
|
41
|
+
interface Library {
|
|
42
|
+
/** A stretch of path every story file of the library has, with forward slashes: `/packages/ui/`. */
|
|
43
|
+
path: string;
|
|
44
|
+
label: string;
|
|
45
|
+
/** The tone of the library's badge, as a `<Badge>` takes one. Default: the badge's own muted tone. */
|
|
46
|
+
tone?: StanceProps['tone'];
|
|
47
|
+
}
|
|
48
|
+
/** A project's libraries, as the tree's package filter, the index page header, and Get Info ask about them. */
|
|
49
|
+
interface Libraries {
|
|
50
|
+
/** The label of the first library whose `path` the story's file holds, else its title's first segment. */
|
|
51
|
+
of(entry: {
|
|
52
|
+
file: string;
|
|
53
|
+
title: string;
|
|
54
|
+
}): string;
|
|
55
|
+
toneOf(label: string): StanceProps['tone'];
|
|
56
|
+
}
|
|
57
|
+
|
|
40
58
|
/** A shell config module: what the workshop adds to the lab. Only the workshop page imports it. */
|
|
41
59
|
interface ShellConfig {
|
|
42
|
-
/** The workshop's name, in its header and as the document title. Default `weaselforge`.
|
|
60
|
+
/** The workshop's name, in its header and as the document title. Default `weaselforge`. The served page reads
|
|
61
|
+
* it from this module's source, so write it as a string or a `const` of this file; a computed one titles the
|
|
62
|
+
* page only once the workshop has loaded. */
|
|
43
63
|
title?: string;
|
|
44
64
|
/** Whether the lab offers the CSS Vars panel. Default true. */
|
|
45
65
|
cssVars?: boolean;
|
|
@@ -50,14 +70,17 @@ interface ShellConfig {
|
|
|
50
70
|
/** The theme the workshop's own chrome takes at the lab's current globals, so a global can restyle the workshop
|
|
51
71
|
* as well as the stories. Default: labkit's. */
|
|
52
72
|
labTheme?: (globals: Globals) => Theme;
|
|
73
|
+
/** The project's libraries, each a stretch of file path and the label its stories carry in the tree's package
|
|
74
|
+
* filter, on index pages, and in Get Info. A story under none of them takes its title's first segment. */
|
|
75
|
+
libraries?: readonly Library[];
|
|
53
76
|
/** The project's other labs, offered in the workshop's title menu. */
|
|
54
77
|
pages?: readonly LabPage[];
|
|
55
78
|
/** Which of `pages` the workshop is, when the URL alone cannot say, as across dev servers on different ports. */
|
|
56
79
|
path?: string;
|
|
57
80
|
}
|
|
58
|
-
/** A frame config module's default export.
|
|
81
|
+
/** A frame config module's default export. The workshop page imports it as well as every frame document, so CSS it imports reaches both; the plugin's `frameStyles` is for CSS meant for frames alone. */
|
|
59
82
|
declare function defineFrameConfig(config: FrameSetup): FrameSetup;
|
|
60
83
|
/** A shell config module's default export. */
|
|
61
84
|
declare function defineShellConfig(config: ShellConfig): ShellConfig;
|
|
62
85
|
|
|
63
|
-
export { FOLLOW_APP as F, type GlobalDeclaration as G, type LabChrome as L, type ShellConfig as S, type GlobalDeclarations as a,
|
|
86
|
+
export { FOLLOW_APP as F, type GlobalDeclaration as G, type LabChrome as L, type ShellConfig as S, type GlobalDeclarations as a, type Library as b, defineShellConfig as c, defineFrameConfig as d, type Libraries as e };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
type Args = Record<string, unknown>;
|
|
2
1
|
/**
|
|
3
2
|
* Storybook's `useArgs`, writing through the trial's config. Stands in for `storybook/preview-api`.
|
|
4
3
|
* A value a MessagePort would not deliver intact, such as a function, a React element or a class
|
|
5
4
|
* instance, stays in the frame.
|
|
6
5
|
*/
|
|
7
|
-
declare function useArgs(): [
|
|
6
|
+
declare function useArgs(): [
|
|
7
|
+
Record<string, unknown>,
|
|
8
|
+
(patch: Record<string, unknown>) => void,
|
|
9
|
+
(argNames?: string[]) => void
|
|
10
|
+
];
|
|
8
11
|
|
|
9
12
|
export { useArgs };
|
package/dist/csf/preview-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ArgsContext, coverOf, isPortSafe } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
import { ArgsContext, coverOf, isPortSafe } from '../chunk-GB6PRJET.js';
|
|
2
|
+
import '../chunk-FL2MUPUL.js';
|
|
3
3
|
import { useContext } from 'react';
|
|
4
4
|
|
|
5
5
|
var sendable = (value) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/csf/shims/preview-api.ts"],"names":[],"m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AG,CAAA,GAAI,EAAE,KAAA,EAAO,QAAA,CAAS,GAAG,CAAA,EAAG,IAAA,EAAM,OAAA,CAAQ,MAAA,CAAO,GAAG,CAAC,CAAA,EAAE;AAClE,MAAA,SAAA,CAAU,KAAK,MAAS,CAAA;AAAA,IAC1B;AACA,IAAA,QAAA,CAAS,CAAC,IAAA,MAAU,EAAE,GAAI,QAAA,GAAW,OAAA,CAAQ,IAAA,EAAM,IAAI,CAAA,GAAI,EAAC,EAAI,GAAG,SAAQ,CAAE,CAAA;AAAA,EAC/E,CAAA;AACA,EAAA,OAAO,CAAC,IAAA,EAAM,UAAA,EAAY,SAAS,CAAA;AACrC","file":"preview-api.js","sourcesContent":["import { useContext } from 'react';\nimport { ArgsContext, coverOf, type LocalArgs } from '../argsContext';\nimport { isPortSafe } from '../portSafe';\n\ntype Args = Record<string, unknown>;\n\n/** A Proxy passes `isPortSafe` and still makes `structuredClone` throw. */\nconst sendable = (value: unknown): boolean => {\n if (!isPortSafe(value)) return false;\n try {\n structuredClone(value);\n return true;\n } catch {\n return false;\n }\n};\n\nconst without = (local: LocalArgs, keys: string[]): LocalArgs =>\n Object.fromEntries(Object.entries(local).filter(([key]) => !keys.includes(key)));\n\n/**\n * Storybook's `useArgs`, writing through the trial's config. Stands in for `storybook/preview-api`.\n * A value a MessagePort would not deliver intact, such as a function, a React element or a class\n * instance, stays in the frame.\n */\nexport function useArgs(): [\n Record<string, unknown>,\n (patch: Record<string, unknown>) => void,\n (argNames?: string[]) => void,\n] {\n const scope = useContext(ArgsContext);\n if (!scope) throw new Error('useArgs must be called inside a CSF story loaded by forge');\n const { args, config, defaults, original, setConfig, setLocal } = scope;\n const updateArgs = (patch: Args) => {\n const sent: [string, unknown][] = [];\n const kept: LocalArgs = {};\n for (const [key, value] of Object.entries(patch)) {\n if (sendable(value)) sent.push([key, value]);\n else kept[key] = { value, over: coverOf(config[key]) };\n }\n setLocal((prev) => ({ ...without(prev, Object.keys(patch)), ...kept }));\n for (const [key, value] of sent) setConfig(key, value);\n };\n const resetArgs = (argNames?: string[]) => {\n const keys = argNames ?? [...new Set([...Object.keys(defaults), ...Object.keys(args)])];\n // A key with no control shows its original from the frame, so the render does not wait on the port.\n const overlay: LocalArgs = {};\n for (const key of keys) {\n if (key in defaults) {\n setConfig(key, defaults[key]);\n continue;\n }\n if (config[key] === undefined) continue;\n overlay[key] = { value: original[key], over: coverOf(config[key]) };\n setConfig(key, undefined);\n }\n setLocal((prev) => ({ ...(argNames ? without(prev, keys) : {}), ...overlay }));\n };\n return [args, updateArgs, resetArgs];\n}\n"]}
|
package/dist/frame/index.css
CHANGED
|
@@ -13,14 +13,14 @@ body {
|
|
|
13
13
|
min-height: 100vh;
|
|
14
14
|
}
|
|
15
15
|
.fg-frame--padded {
|
|
16
|
-
padding:
|
|
16
|
+
padding: var(--wzl-space-8);
|
|
17
17
|
}
|
|
18
18
|
.fg-frame--fullscreen {
|
|
19
19
|
padding: 0;
|
|
20
20
|
}
|
|
21
21
|
.fg-frame__fault {
|
|
22
22
|
margin: 0;
|
|
23
|
-
padding:
|
|
23
|
+
padding: var(--wzl-space-8);
|
|
24
24
|
white-space: pre-wrap;
|
|
25
25
|
border: 1px solid #f2b8b5;
|
|
26
26
|
border-radius: 4px;
|
|
@@ -154,6 +154,23 @@ body {
|
|
|
154
154
|
align-items: center;
|
|
155
155
|
gap: var(--wzl-space-6);
|
|
156
156
|
}
|
|
157
|
+
.fg-index-history {
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-wrap: wrap;
|
|
160
|
+
gap: var(--wzl-space-2) var(--wzl-space-8);
|
|
161
|
+
margin: var(--wzl-space-8) 0 0;
|
|
162
|
+
font-size: var(--wzl-font-size-sm);
|
|
163
|
+
}
|
|
164
|
+
.fg-index-history__item {
|
|
165
|
+
display: flex;
|
|
166
|
+
gap: var(--wzl-space-3);
|
|
167
|
+
}
|
|
168
|
+
.fg-index-history__label {
|
|
169
|
+
color: var(--wzl-fg-muted);
|
|
170
|
+
}
|
|
171
|
+
.fg-index-history__value {
|
|
172
|
+
margin: 0;
|
|
173
|
+
}
|
|
157
174
|
.fg-index-deps {
|
|
158
175
|
display: grid;
|
|
159
176
|
grid-template-columns: max-content 1fr;
|
package/dist/frame/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/frame/frame.css","../../src/frame/index/index.css"],"sourcesContent":["html,\nbody {\n margin: 0;\n}\n\n.fg-frame {\n box-sizing: border-box;\n}\n\n.fg-frame--centered {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n}\n\n.fg-frame--padded {\n padding:
|
|
1
|
+
{"version":3,"sources":["../../src/frame/frame.css","../../src/frame/index/index.css"],"sourcesContent":["html,\nbody {\n margin: 0;\n}\n\n.fg-frame {\n box-sizing: border-box;\n}\n\n.fg-frame--centered {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n}\n\n.fg-frame--padded {\n padding: var(--wzl-space-8);\n}\n\n.fg-frame--fullscreen {\n padding: 0;\n}\n\n.fg-frame__fault {\n margin: 0;\n padding: var(--wzl-space-8);\n white-space: pre-wrap;\n border: 1px solid #f2b8b5;\n border-radius: 4px;\n background: #fdecea;\n color: #8c1d18;\n font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n",".fg-index {\n box-sizing: border-box;\n max-width: 1200px;\n margin: 0 auto;\n padding: var(--wzl-space-lg);\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size);\n color: var(--wzl-fg);\n}\n\n.fg-index__head {\n margin-bottom: calc(var(--wzl-space-lg) * 2);\n}\n\n.fg-index__path {\n margin: 0 0 var(--wzl-space-2);\n font-size: var(--wzl-font-size-lg);\n color: var(--wzl-fg-muted);\n}\n\n.fg-index__title {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: calc(var(--wzl-font-size-xl) * 1.6);\n font-weight: var(--wzl-font-weight-medium);\n letter-spacing: var(--wzl-panel-title-tracking);\n text-transform: var(--wzl-panel-title-case);\n}\n\n.fg-index__description,\n.fg-index-story__description {\n max-width: 72ch;\n margin: var(--wzl-space-4) 0 0;\n font-family: var(--wzl-font-body);\n line-height: 1.5;\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-story {\n padding-top: calc(var(--wzl-space-lg) * 1.5);\n margin-top: calc(var(--wzl-space-lg) * 1.5);\n border-top: var(--wzl-border-w) solid var(--wzl-border);\n}\n\n.fg-index-story__head {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-6);\n}\n\n.fg-index-story__name {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: var(--wzl-font-size-xl);\n font-weight: var(--wzl-panel-title-weight);\n letter-spacing: var(--wzl-panel-title-tracking);\n text-transform: var(--wzl-panel-title-case);\n color: var(--wzl-panel-title-color);\n}\n\n.fg-index-cell {\n margin: var(--wzl-space-8) 0 0;\n width: fit-content;\n /* A fluid specimen (a slider, a tiled workspace) has no width of its own,\n so hugging it alone collapses the cell to its padding. */\n min-width: min(100%, 20rem);\n max-width: 100%;\n}\n\n.fg-index-cell__stage {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 96px;\n padding: var(--wzl-space-2);\n border: var(--wzl-border-w) solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n background: var(--wzl-surface);\n overflow: auto;\n}\n\n/* A padded story sits top-left as it would on a page: the column's width, and\n none of the minimum height that gives a centered one presence. */\n.fg-index-cell--padded {\n width: auto;\n}\n\n.fg-index-cell--padded > .fg-index-cell__stage {\n display: block;\n min-height: 0;\n}\n\n.fg-index-cell--fullscreen {\n width: auto;\n}\n\n.fg-index-cell--fullscreen > .fg-index-cell__stage {\n display: block;\n height: 360px;\n padding: 0;\n}\n\n.fg-index-cell__label {\n margin-top: var(--wzl-space-3);\n font-family: var(--wzl-font-mono);\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-variants__row {\n margin-top: calc(var(--wzl-space-lg) * 1.25);\n}\n\n/* Set as the kit's panel titles are, at the small size. */\n.fg-index-variants__label {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: var(--wzl-font-size-sm);\n font-weight: var(--wzl-panel-title-weight);\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-variants__cells {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: var(--wzl-space-6);\n}\n\n.fg-index-variants__cells > .fg-index-cell {\n margin-top: var(--wzl-space-4);\n}\n\n.fg-index__library {\n margin-inline-end: var(--wzl-space-4);\n vertical-align: middle;\n}\n\n.fg-index__title-row {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-6);\n}\n\n.fg-index-history {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wzl-space-2) var(--wzl-space-8);\n margin: var(--wzl-space-8) 0 0;\n font-size: var(--wzl-font-size-sm);\n}\n\n.fg-index-history__item {\n display: flex;\n gap: var(--wzl-space-3);\n}\n\n.fg-index-history__label {\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-history__value {\n margin: 0;\n}\n\n.fg-index-deps {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--wzl-space-3) var(--wzl-space-8);\n margin: var(--wzl-space-8) 0 0;\n font-size: var(--wzl-font-size-sm);\n}\n\n.fg-index-deps__row {\n display: contents;\n}\n\n.fg-index-deps__label {\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-deps__value {\n margin: 0;\n}\n\n.fg-index-deps__list {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wzl-space-2) var(--wzl-space-6);\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.fg-index-deps__link {\n color: var(--wzl-accent-fg);\n text-decoration: none;\n}\n\n.fg-index-deps__link:hover {\n text-decoration: underline;\n}\n\n.fg-index-deps__prefix,\n.fg-index-deps__empty,\n.fg-index-deps__none {\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-deps__none {\n max-width: 72ch;\n margin: var(--wzl-space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b;AAEA,CAAC;AACC,UAAQ;AACV;AAEA,CAAC;AACC,WAAS;AACT,yBAAuB,YAAY;AACnC,OAAK,IAAI,eAAe,IAAI;AAC5B,UAAQ,IAAI,eAAe,EAAE;AAC7B,aAAW,IAAI;AACjB;AAEA,CAAC;AACC,WAAS;AACX;AAEA,CAAC;AACC,SAAO,IAAI;AACb;AAEA,CAAC;AACC,UAAQ;AACV;AAEA,CAAC;AACC,WAAS;AACT,aAAW;AACX,OAAK,IAAI,eAAe,IAAI;AAC5B,UAAQ;AACR,WAAS;AACT,cAAY;AACd;AAEA,CAAC;AACC,SAAO,IAAI;AACX,mBAAiB;AACnB;AAEA,CALC,mBAKmB;AAClB,mBAAiB;AACnB;AAEA,CAAC;AACD,CAAC;AACD,CAAC;AACC,SAAO,IAAI;AACb;AAEA,CAJC;AAKC,aAAW;AACX,UAAQ,IAAI,eAAe,EAAE;AAC7B,aAAW,IAAI;AACjB;","names":[]}
|
package/dist/frame/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FrameSetup, L as LoadedStory } from '../FrameController-
|
|
2
|
-
export {
|
|
1
|
+
import { F as FrameSetup, L as LoadedStory } from '../FrameController-UeTY7ubF.js';
|
|
2
|
+
export { u as Channel, v as ConfigAnswers, w as FaultPhase, n as FromFrame, x as StartFrameOptions, o as ToFrame, y as reportImportFault, z as startFrame } from '../FrameController-UeTY7ubF.js';
|
|
3
3
|
import '@weasel-js/labkit/config';
|
|
4
4
|
import 'react';
|
|
5
5
|
|