@weasel-js/forge 1.16.0 → 1.16.2
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 +14 -0
- package/dist/{FrameController-BM6xuEfY.d.ts → FrameController-DQTN1ytP.d.ts} +4 -1
- package/dist/{chunk-PPB7VP6R.js → chunk-5B4RDEF3.js} +87 -7
- package/dist/chunk-5B4RDEF3.js.map +1 -0
- package/dist/{chunk-MRYXJTDO.js → chunk-7YVJS4QS.js} +3 -3
- package/dist/{chunk-MRYXJTDO.js.map → chunk-7YVJS4QS.js.map} +1 -1
- package/dist/{chunk-PGLOYXDP.js → chunk-EVPVBDHM.js} +31 -5
- package/dist/chunk-EVPVBDHM.js.map +1 -0
- package/dist/{chunk-SZ2SMRE6.js → chunk-KNBEHCFD.js} +3 -29
- package/dist/chunk-KNBEHCFD.js.map +1 -0
- package/dist/{chunk-5WS67HMU.js → chunk-PN4IFL5E.js} +6 -3
- package/dist/chunk-PN4IFL5E.js.map +1 -0
- package/dist/{chunk-RVJHUY7W.js → chunk-ZGELUE2H.js} +3 -3
- package/dist/{chunk-RVJHUY7W.js.map → chunk-ZGELUE2H.js.map} +1 -1
- package/dist/{config-DOjWyIui.d.ts → config-BaC0Cbyj.d.ts} +3 -2
- package/dist/frame/index.css +100 -0
- package/dist/frame/index.css.map +1 -1
- package/dist/frame/index.d.ts +9 -6
- package/dist/frame/index.js +4 -4
- package/dist/index.d.ts +5 -4
- package/dist/{mountFrame-CRPAjg1M.d.ts → mountFrame-CrIdX6nD.d.ts} +3 -2
- package/dist/shell/index.css +100 -0
- package/dist/shell/index.css.map +1 -1
- package/dist/shell/index.d.ts +8 -5
- package/dist/shell/index.js +7 -7
- package/dist/test/index.d.ts +3 -2
- package/dist/test/index.js +3 -3
- package/dist/vite/index.d.ts +7 -1
- package/dist/vite/index.js +272 -56
- package/dist/vite/index.js.map +1 -1
- package/package.json +15 -12
- package/dist/chunk-5WS67HMU.js.map +0 -1
- package/dist/chunk-PGLOYXDP.js.map +0 -1
- package/dist/chunk-PPB7VP6R.js.map +0 -1
- package/dist/chunk-SZ2SMRE6.js.map +0 -1
package/README.md
CHANGED
|
@@ -298,6 +298,20 @@ file's own package's tags (`@scope/pkg@1.2.0`) and unscoped ones (`v1.2.0`).
|
|
|
298
298
|
A file not yet in a tagged release reads `Unreleased`, and a file git has
|
|
299
299
|
never committed shows nothing. A custom page gets it as `History`.
|
|
300
300
|
|
|
301
|
+
Beside the stories, the page lists the component's API: each prop with its
|
|
302
|
+
type as written, whether it is required, its default and its JSDoc, then what
|
|
303
|
+
its `ref` takes. A ref to a handle lists the handle's methods and properties; a
|
|
304
|
+
ref to an element names the element. A default is the one the component's own
|
|
305
|
+
function gives when it destructures its props, else the prop's `@default` tag.
|
|
306
|
+
Props declared in React's or TypeScript's own types, or in a file the
|
|
307
|
+
`propControls` `skip` option matches, are counted, one line per type that
|
|
308
|
+
declares them, rather than listed. The API is read through the project's
|
|
309
|
+
TypeScript, from the component the meta's `component` names; a component the
|
|
310
|
+
story file declares itself, such as a wrapper mapping args to props, gives way
|
|
311
|
+
to the import the title's last segment names, as it does for the dependency
|
|
312
|
+
lists. Below 560 pixels of page width the API moves above the stories. The
|
|
313
|
+
plugin's `api: false` turns it off. A custom page gets it as `Api`.
|
|
314
|
+
|
|
301
315
|
## Galleries
|
|
302
316
|
|
|
303
317
|
A story file that catalogs many components, or every permutation of one, tags
|
|
@@ -262,6 +262,8 @@ interface IndexContext {
|
|
|
262
262
|
/** The release the component first shipped in and when its source was created and last changed, as the generated
|
|
263
263
|
* page shows them. */
|
|
264
264
|
History: ComponentType;
|
|
265
|
+
/** The component's props and what its `ref` exposes, as the generated page shows them beside its stories. */
|
|
266
|
+
Api: ComponentType;
|
|
265
267
|
/** Whether the meta is tagged `gallery`. */
|
|
266
268
|
gallery: boolean;
|
|
267
269
|
/** Shows story `id` in this page's trial in its place. */
|
|
@@ -404,4 +406,5 @@ declare function startFrame({ story, channel, container, setup }: StartFrameOpti
|
|
|
404
406
|
/** Reports an import failure — there is no story to start. */
|
|
405
407
|
declare function reportImportFault(channel: Channel<ToFrame, FromFrame>, error: unknown): void;
|
|
406
408
|
|
|
407
|
-
export {
|
|
409
|
+
export { reportImportFault as r, startFrame as s };
|
|
410
|
+
export type { A11yFinding as A, Channel as C, DepGraph as D, FrameSetup as F, Globals as G, IndexEntry as I, Layout as L, MetaSpec as M, PlayContext as P, StartFrameOptions as S, ToFrame as T, Viewport as V, ConfigAnswers as a, FaultPhase as b, FromFrame as c, StorySpec as d, Span as e, SpanOverride as f, A11yNode as g, A11yReport as h, ComponentDeps as i, ComponentHistory as j, Decorator as k, GlobalsTarget as l, IndexContext as m, IndexRender as n, IndexStoryProps as o, LoadedStory as p, StoryContext as q, TimelineSpec as t, CssVarReport as u, A11yOutcome as v, DescribedEntry as w, DescribedShape as x, SchemaDescription as y, SectionDescription as z };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { isIndexId, indexId, byComponent } from './chunk-
|
|
1
|
+
import { isIndexId, indexId, byComponent } from './chunk-ZGELUE2H.js';
|
|
2
2
|
import { taggedIds, isGallery } from './chunk-VUPN73JP.js';
|
|
3
|
-
import { loadStories, indexRenderOf, StoryHost } from './chunk-
|
|
3
|
+
import { loadStories, indexRenderOf, useOverflowing, StoryHost } from './chunk-EVPVBDHM.js';
|
|
4
|
+
import { API_EXPORT } from './chunk-PN4IFL5E.js';
|
|
4
5
|
import { PROTOCOL_VERSION } from './chunk-STK2AZH2.js';
|
|
5
6
|
import { createRoot } from 'react-dom/client';
|
|
6
7
|
import { IconRegistryProvider, isPlainObject } from '@weasel-js/core';
|
|
@@ -144,6 +145,11 @@ var commonTags = (entries) => {
|
|
|
144
145
|
const common = (first?.tags ?? []).filter((tag) => rest.every((e) => e.tags?.includes(tag)));
|
|
145
146
|
return common.length > 0 ? common : void 0;
|
|
146
147
|
};
|
|
148
|
+
function apiOf(mod) {
|
|
149
|
+
const api = mod?.[API_EXPORT];
|
|
150
|
+
if (api === null) return null;
|
|
151
|
+
return typeof api === "object" && Array.isArray(api.props) ? api : void 0;
|
|
152
|
+
}
|
|
147
153
|
async function loadIndexBundle(id, source) {
|
|
148
154
|
const { importOf, load = loadStories, parameters, prepare, libraries = TITLE_LIBRARIES } = source;
|
|
149
155
|
const entries = source.index.filter((e) => !isIndexId(e.id) && indexId(e.title) === id);
|
|
@@ -156,6 +162,7 @@ async function loadIndexBundle(id, source) {
|
|
|
156
162
|
const stories = entries.flatMap((e) => byFile.get(e.file)?.find((s) => s.exportName === e.exportName) ?? []);
|
|
157
163
|
for (const story of stories) await prepare?.(story);
|
|
158
164
|
const tags = commonTags(entries);
|
|
165
|
+
const api = apiOf(mods[files.indexOf(primary.file)]);
|
|
159
166
|
return {
|
|
160
167
|
title,
|
|
161
168
|
library: libraries.of(primary),
|
|
@@ -164,7 +171,8 @@ async function loadIndexBundle(id, source) {
|
|
|
164
171
|
...taggedIds(entries),
|
|
165
172
|
stories,
|
|
166
173
|
descriptions: Object.fromEntries(entries.flatMap((e) => e.description ? [[e.id, e.description]] : [])),
|
|
167
|
-
render: mods.map(indexRenderOf).find((render) => render !== null) ?? null
|
|
174
|
+
render: mods.map(indexRenderOf).find((render) => render !== null) ?? null,
|
|
175
|
+
...api === void 0 ? {} : { api }
|
|
168
176
|
};
|
|
169
177
|
}
|
|
170
178
|
|
|
@@ -185,6 +193,7 @@ function indexEnvOf(bundle, { graph, globals, decorators, open }) {
|
|
|
185
193
|
galleries: bundle.galleries,
|
|
186
194
|
labs: bundle.labs,
|
|
187
195
|
...dependencies ? { dependencies } : {},
|
|
196
|
+
...gallery || bundle.api === void 0 ? {} : { api: bundle.api },
|
|
188
197
|
globals,
|
|
189
198
|
decorators,
|
|
190
199
|
open,
|
|
@@ -253,6 +262,72 @@ function useEnv() {
|
|
|
253
262
|
if (!env) throw new Error("An index page part rendered outside its index page");
|
|
254
263
|
return env;
|
|
255
264
|
}
|
|
265
|
+
function Entry({ name, badge, children }) {
|
|
266
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
267
|
+
/* @__PURE__ */ jsxs("dt", { className: "fg-index-api__name", children: [
|
|
268
|
+
/* @__PURE__ */ jsx("code", { children: name }),
|
|
269
|
+
badge ? /* @__PURE__ */ jsx(Badge, { variant: "subtle", size: "sm", children: badge }) : null
|
|
270
|
+
] }),
|
|
271
|
+
/* @__PURE__ */ jsx("dd", { className: "fg-index-api__entry", children })
|
|
272
|
+
] });
|
|
273
|
+
}
|
|
274
|
+
function PropEntry({ prop }) {
|
|
275
|
+
return /* @__PURE__ */ jsxs(Entry, { name: prop.name, badge: prop.required ? "required" : void 0, children: [
|
|
276
|
+
/* @__PURE__ */ jsx("code", { className: "fg-index-api__type", children: prop.type }),
|
|
277
|
+
prop.default === void 0 ? null : /* @__PURE__ */ jsxs("p", { className: "fg-index-api__default", children: [
|
|
278
|
+
"Default: ",
|
|
279
|
+
/* @__PURE__ */ jsx("code", { children: prop.default })
|
|
280
|
+
] }),
|
|
281
|
+
prop.deprecated === void 0 ? null : /* @__PURE__ */ jsx("p", { className: "fg-index-api__deprecated", children: prop.deprecated ? `Deprecated: ${prop.deprecated}` : "Deprecated" }),
|
|
282
|
+
prop.description ? /* @__PURE__ */ jsx(Description, { text: prop.description, className: "fg-index-api__description" }) : null
|
|
283
|
+
] });
|
|
284
|
+
}
|
|
285
|
+
function MemberEntry({ member }) {
|
|
286
|
+
return /* @__PURE__ */ jsxs(Entry, { name: member.name, badge: member.readonly ? "readonly" : void 0, children: [
|
|
287
|
+
/* @__PURE__ */ jsx("code", { className: "fg-index-api__type", children: member.signature }),
|
|
288
|
+
member.description ? /* @__PURE__ */ jsx(Description, { text: member.description, className: "fg-index-api__description" }) : null
|
|
289
|
+
] });
|
|
290
|
+
}
|
|
291
|
+
var methodsFirst = (members) => [
|
|
292
|
+
...members.filter((m) => m.kind === "method"),
|
|
293
|
+
...members.filter((m) => m.kind === "property")
|
|
294
|
+
];
|
|
295
|
+
function RefSection({ handle }) {
|
|
296
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
297
|
+
/* @__PURE__ */ jsx("h2", { className: "fg-index-api__heading", children: "Ref" }),
|
|
298
|
+
/* @__PURE__ */ jsx("p", { className: "fg-index-api__ref", children: /* @__PURE__ */ jsx("code", { className: "fg-index-api__type", children: handle.type }) }),
|
|
299
|
+
handle.members.length === 0 ? null : /* @__PURE__ */ jsx("dl", { className: "fg-index-api__list", children: methodsFirst(handle.members).map((member) => /* @__PURE__ */ jsx(MemberEntry, { member }, member.name)) })
|
|
300
|
+
] });
|
|
301
|
+
}
|
|
302
|
+
function ApiBody({ api }) {
|
|
303
|
+
const none = api.props.length === 0 && api.inherited.length === 0;
|
|
304
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
305
|
+
/* @__PURE__ */ jsx("h2", { className: "fg-index-api__heading", children: "Props" }),
|
|
306
|
+
none ? /* @__PURE__ */ jsx("p", { className: "fg-index-api__note", children: "Takes no props." }) : null,
|
|
307
|
+
api.props.length === 0 ? null : /* @__PURE__ */ jsx("dl", { className: "fg-index-api__list", children: api.props.map((prop) => /* @__PURE__ */ jsx(PropEntry, { prop }, prop.name)) }),
|
|
308
|
+
api.inherited.map(({ from, count }) => /* @__PURE__ */ jsxs("p", { className: "fg-index-api__inherited", children: [
|
|
309
|
+
"+ ",
|
|
310
|
+
count,
|
|
311
|
+
" from ",
|
|
312
|
+
/* @__PURE__ */ jsx("code", { children: from })
|
|
313
|
+
] }, from)),
|
|
314
|
+
api.ref ? /* @__PURE__ */ jsx(RefSection, { handle: api.ref }) : null
|
|
315
|
+
] });
|
|
316
|
+
}
|
|
317
|
+
function IndexApi() {
|
|
318
|
+
const { api } = useEnv();
|
|
319
|
+
const [el, setEl] = useState(null);
|
|
320
|
+
const overflowing = useOverflowing(el);
|
|
321
|
+
if (api === void 0) return null;
|
|
322
|
+
return (
|
|
323
|
+
// While it scrolls on its own beside the stories, it is a tab stop for the keyboard to scroll it.
|
|
324
|
+
/* @__PURE__ */ jsx("aside", { ref: setEl, className: "fg-index-api", "aria-label": "API", ...overflowing ? { tabIndex: 0 } : {}, children: api === null ? /* @__PURE__ */ jsxs("p", { className: "fg-index-api__note", children: [
|
|
325
|
+
"forge found no component for this page, so it shows no API. It reads the meta\u2019s ",
|
|
326
|
+
/* @__PURE__ */ jsx("code", { children: "component" }),
|
|
327
|
+
", or else the import the title\u2019s last segment names."
|
|
328
|
+
] }) : /* @__PURE__ */ jsx(ApiBody, { api }) })
|
|
329
|
+
);
|
|
330
|
+
}
|
|
256
331
|
var NEAR_MARGIN = "100%";
|
|
257
332
|
function IndexStory({ story, config: over, label }) {
|
|
258
333
|
const env = useEnv();
|
|
@@ -408,7 +483,8 @@ function DefaultIndex() {
|
|
|
408
483
|
const name = segments.pop();
|
|
409
484
|
const { library } = env;
|
|
410
485
|
if (library !== void 0 && segments[0] === library) segments.shift();
|
|
411
|
-
|
|
486
|
+
const withApi = env.api !== void 0;
|
|
487
|
+
return /* @__PURE__ */ jsxs("article", { className: withApi ? "fg-index fg-index--api" : "fg-index", children: [
|
|
412
488
|
/* @__PURE__ */ jsxs("header", { className: "fg-index__head", children: [
|
|
413
489
|
segments.length > 0 || library !== void 0 ? /* @__PURE__ */ jsxs("p", { className: "fg-index__path", children: [
|
|
414
490
|
library !== void 0 ? /* @__PURE__ */ jsx(LibraryBadge, { library, className: "fg-index__library" }) : null,
|
|
@@ -422,7 +498,10 @@ function DefaultIndex() {
|
|
|
422
498
|
/* @__PURE__ */ jsx(IndexHistory, {}),
|
|
423
499
|
/* @__PURE__ */ jsx(IndexDependencies, {})
|
|
424
500
|
] }),
|
|
425
|
-
|
|
501
|
+
/* @__PURE__ */ jsxs("div", { className: "fg-index__body", children: [
|
|
502
|
+
/* @__PURE__ */ jsx(IndexApi, {}),
|
|
503
|
+
/* @__PURE__ */ jsx("div", { className: "fg-index__stories", children: env.stories.map((story) => /* @__PURE__ */ jsx(StorySection, { story, variants: withVariants.has(story.id) }, story.id)) })
|
|
504
|
+
] })
|
|
426
505
|
] });
|
|
427
506
|
}
|
|
428
507
|
function indexContext(env) {
|
|
@@ -436,6 +515,7 @@ function indexContext(env) {
|
|
|
436
515
|
DefaultIndex,
|
|
437
516
|
Dependencies: IndexDependencies,
|
|
438
517
|
History: IndexHistory,
|
|
518
|
+
Api: IndexApi,
|
|
439
519
|
gallery: env.gallery ?? false,
|
|
440
520
|
open: env.open
|
|
441
521
|
};
|
|
@@ -445,5 +525,5 @@ function IndexPage({ env, render }) {
|
|
|
445
525
|
}
|
|
446
526
|
|
|
447
527
|
export { Description, IndexPage, LAB_DENSITY, LabBadge, LibrariesContext, LibraryBadge, TITLE_LIBRARIES, answerSchema, createKitRoot, describeSchema, indexEnvOf, librariesFrom, loadIndexBundle, openChannel, schemaFromDescription };
|
|
448
|
-
//# sourceMappingURL=chunk-
|
|
449
|
-
//# sourceMappingURL=chunk-
|
|
528
|
+
//# sourceMappingURL=chunk-5B4RDEF3.js.map
|
|
529
|
+
//# sourceMappingURL=chunk-5B4RDEF3.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/story/indexBundle.ts","../src/shell/labDensity.ts","../src/frame/index/indexEnv.ts","../src/frame/index/LabBadge.tsx","../src/frame/index/LibraryBadge.tsx","../src/frame/index/variants.ts","../src/frame/index/Description.tsx","../src/frame/index/envContext.ts","../src/frame/index/IndexApi.tsx","../src/frame/index/IndexPage.tsx"],"names":["jsx","Badge","resolveConfigSchema","isEntryShown","isConfigBranch","createContext","useContext","Fragment","useState","jsxs"],"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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,EAAA,EAA4B,KAAA,EAAc,QAAA,EAAU,YAAA,CAAa,GAAA,CAAI,KAAA,CAAM,EAAE,CAAA,EAAA,EAA3D,KAAA,CAAM,EAAwD,CAClF,CAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,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,GAAA,EAAK,QAAA;AAAA,IACL,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-5B4RDEF3.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","import { API_EXPORT, type ApiTable } from './api';\nimport { byComponent, indexId, isIndexId } from './indexPages';\nimport { type Libraries, TITLE_LIBRARIES } from './library';\nimport { indexRenderOf, loadStories } from './load';\nimport { taggedIds } from './tags';\nimport type { IndexRender, LoadedStory } from './types';\n\n/** A component's index page as it loads: its stories in index order, and the page's own render. */\nexport interface IndexBundle {\n title: string;\n /** The package the component ships in. */\n library: string;\n description?: string;\n /** The tags every story of the component carries. */\n tags?: readonly string[];\n /** The ids of the stories tagged `gallery`. */\n galleries: readonly string[];\n /** The ids of the stories tagged `lab`. */\n labs: readonly string[];\n stories: readonly LoadedStory[];\n descriptions: Readonly<Record<string, string>>;\n render: IndexRender | null;\n /** The component's API, from its primary file: null where forge found no component, absent where it read none. */\n api?: ApiTable | null;\n}\n\n/** What a document has loaded for an entry: one story, or a component's index page. */\nexport type Loaded = { kind: 'story'; story: LoadedStory } | { kind: 'index'; bundle: IndexBundle };\n\n/** One story as an index page's loader finds it. */\nexport interface BundleEntry {\n id: string;\n title: string;\n file: string;\n exportName: string;\n description?: string;\n componentDescription?: string;\n tags?: readonly string[];\n}\n\n/** Where `loadIndexBundle` reads a component's stories from. */\nexport interface IndexBundleSource {\n index: readonly BundleEntry[];\n /** The module of a story file; called once per file the component's stories live in. */\n importOf: (file: string) => Promise<Record<string, unknown>>;\n load?: ((mod: Record<string, unknown>, title: string, parameters?: Record<string, unknown>) => LoadedStory[]) | undefined;\n parameters?: Record<string, unknown> | undefined;\n prepare?: ((story: LoadedStory) => void | Promise<void>) | undefined;\n libraries?: Libraries | undefined;\n}\n\nconst commonTags = (entries: readonly BundleEntry[]): string[] | undefined => {\n const [first, ...rest] = entries;\n const common = (first?.tags ?? []).filter((tag) => rest.every((e) => e.tags?.includes(tag)));\n return common.length > 0 ? common : undefined;\n};\n\n/** A story module's API export: null as the plugin wrote it, undefined when it wrote none. */\nfunction apiOf(mod: Record<string, unknown> | undefined): ApiTable | null | undefined {\n const api = mod?.[API_EXPORT];\n if (api === null) return null;\n return typeof api === 'object' && Array.isArray((api as ApiTable).props) ? (api as ApiTable) : undefined;\n}\n\n/**\n * The index page `id` names, loaded from every file its component's stories live in. Its description and library are\n * its primary file's. Rejects when no story of `index` belongs to the component.\n */\nexport async function loadIndexBundle(id: string, source: IndexBundleSource): Promise<IndexBundle> {\n const { importOf, load = loadStories, parameters, prepare, libraries = TITLE_LIBRARIES } = source;\n const entries = source.index.filter((e) => !isIndexId(e.id) && indexId(e.title) === id);\n const primary = byComponent(entries)[0];\n if (!primary) throw new Error(`No component with index \"${id}\"`);\n const { title } = primary;\n const files = [...new Set(entries.map((e) => e.file))];\n const mods = await Promise.all(files.map(importOf));\n const byFile = new Map(files.map((file, i) => [file, load(mods[i] ?? {}, title, parameters)]));\n const stories = entries.flatMap((e) => byFile.get(e.file)?.find((s) => s.exportName === e.exportName) ?? []);\n for (const story of stories) await prepare?.(story);\n const tags = commonTags(entries);\n const api = apiOf(mods[files.indexOf(primary.file)]);\n return {\n title,\n library: libraries.of(primary),\n ...(primary.componentDescription === undefined ? {} : { description: primary.componentDescription }),\n ...(tags === undefined ? {} : { tags }),\n ...taggedIds(entries),\n stories,\n descriptions: Object.fromEntries(entries.flatMap((e) => (e.description ? [[e.id, e.description]] : []))),\n render: mods.map(indexRenderOf).find((render) => render !== null) ?? null,\n ...(api === undefined ? {} : { api }),\n };\n}\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","import type { Globals } from '../../protocol/messages';\nimport type { IndexBundle } from '../../story/indexBundle';\nimport { isGallery } from '../../story/tags';\nimport type { Decorator, DepGraph } from '../../story/types';\nimport type { IndexEnv } from './IndexPage';\n\n/** What an index page's document adds to its bundle. */\nexport interface IndexEnvInputs {\n /** The component graph, or null where it has not arrived or the document has none. */\n graph: DepGraph | null;\n globals: Globals;\n /** The frame config's, outermost. */\n decorators: readonly Decorator[];\n open: (id: string) => void;\n}\n\n/** What every cell of `bundle`'s page shares, in whichever document renders it. */\nexport function indexEnvOf(bundle: IndexBundle, { graph, globals, decorators, open }: IndexEnvInputs): IndexEnv {\n const gallery = isGallery(bundle);\n const dependencies = gallery ? undefined : graph?.[bundle.title];\n return {\n title: bundle.title,\n library: bundle.library,\n ...(bundle.description === undefined ? {} : { description: bundle.description }),\n stories: bundle.stories,\n descriptions: bundle.descriptions,\n gallery,\n galleries: bundle.galleries,\n labs: bundle.labs,\n ...(dependencies ? { dependencies } : {}),\n ...(gallery || bundle.api === undefined ? {} : { api: bundle.api }),\n globals,\n decorators,\n open,\n // A story that throws shows its error in its own cell; the rest of the page is still worth reading.\n onError: (error) => console.error(error),\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';\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","import { createContext, useContext } from 'react';\nimport type { Globals } from '../../protocol/messages';\nimport type { ApiTable } from '../../story/api';\nimport type { ComponentDeps, Decorator, LoadedStory } from '../../story/types';\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 /** The component's props and ref: null where forge found no component, absent where it read none or for a gallery. */\n api?: ApiTable | null;\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\nexport function 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","// 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 { type ReactNode, useState } from 'react';\nimport { useOverflowing } from '../../shell/useOverflowing';\nimport type { ApiMember, ApiProp, ApiRef, ApiTable } from '../../story/api';\nimport { Description } from './Description';\nimport { useEnv } from './envContext';\nimport './api.css';\n\nfunction Entry({ name, badge, children }: { name: string; badge?: string | undefined; children: ReactNode }) {\n return (\n <>\n <dt className=\"fg-index-api__name\">\n <code>{name}</code>\n {badge ? (\n <Badge variant=\"subtle\" size=\"sm\">\n {badge}\n </Badge>\n ) : null}\n </dt>\n <dd className=\"fg-index-api__entry\">{children}</dd>\n </>\n );\n}\n\nfunction PropEntry({ prop }: { prop: ApiProp }) {\n return (\n <Entry name={prop.name} badge={prop.required ? 'required' : undefined}>\n <code className=\"fg-index-api__type\">{prop.type}</code>\n {prop.default === undefined ? null : (\n <p className=\"fg-index-api__default\">\n Default: <code>{prop.default}</code>\n </p>\n )}\n {prop.deprecated === undefined ? null : (\n <p className=\"fg-index-api__deprecated\">{prop.deprecated ? `Deprecated: ${prop.deprecated}` : 'Deprecated'}</p>\n )}\n {prop.description ? <Description text={prop.description} className=\"fg-index-api__description\" /> : null}\n </Entry>\n );\n}\n\nfunction MemberEntry({ member }: { member: ApiMember }) {\n return (\n <Entry name={member.name} badge={member.readonly ? 'readonly' : undefined}>\n <code className=\"fg-index-api__type\">{member.signature}</code>\n {member.description ? <Description text={member.description} className=\"fg-index-api__description\" /> : null}\n </Entry>\n );\n}\n\nconst methodsFirst = (members: readonly ApiMember[]): ApiMember[] => [\n ...members.filter((m) => m.kind === 'method'),\n ...members.filter((m) => m.kind === 'property'),\n];\n\nfunction RefSection({ handle }: { handle: ApiRef }) {\n return (\n <>\n <h2 className=\"fg-index-api__heading\">Ref</h2>\n <p className=\"fg-index-api__ref\">\n <code className=\"fg-index-api__type\">{handle.type}</code>\n </p>\n {handle.members.length === 0 ? null : (\n <dl className=\"fg-index-api__list\">\n {methodsFirst(handle.members).map((member) => (\n <MemberEntry key={member.name} member={member} />\n ))}\n </dl>\n )}\n </>\n );\n}\n\nfunction ApiBody({ api }: { api: ApiTable }) {\n const none = api.props.length === 0 && api.inherited.length === 0;\n return (\n <>\n <h2 className=\"fg-index-api__heading\">Props</h2>\n {none ? <p className=\"fg-index-api__note\">Takes no props.</p> : null}\n {api.props.length === 0 ? null : (\n <dl className=\"fg-index-api__list\">\n {api.props.map((prop) => (\n <PropEntry key={prop.name} prop={prop} />\n ))}\n </dl>\n )}\n {api.inherited.map(({ from, count }) => (\n <p key={from} className=\"fg-index-api__inherited\">\n + {count} from <code>{from}</code>\n </p>\n ))}\n {api.ref ? <RefSection handle={api.ref} /> : null}\n </>\n );\n}\n\n/** The component's props and what its `ref` exposes, read from its types. Nothing where none was read, as for a gallery. */\nexport function IndexApi() {\n const { api } = useEnv();\n const [el, setEl] = useState<HTMLElement | null>(null);\n const overflowing = useOverflowing(el);\n if (api === undefined) return null;\n return (\n // While it scrolls on its own beside the stories, it is a tab stop for the keyboard to scroll it.\n <aside ref={setEl} className=\"fg-index-api\" aria-label=\"API\" {...(overflowing ? { tabIndex: 0 } : {})}>\n {api === null ? (\n <p className=\"fg-index-api__note\">\n forge found no component for this page, so it shows no API. It reads the meta’s <code>component</code>,\n or else the import the title’s last segment names.\n </p>\n ) : (\n <ApiBody api={api} />\n )}\n </aside>\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 type MouseEvent,\n type ReactNode,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { indexId } from '../../story/indexPages';\nimport type { IndexContext, IndexStoryProps, LoadedStory, StoryContext } from '../../story/types';\nimport { StoryHost } from '../StoryHost';\nimport { useNearViewport } from '@weasel-js/react';\nimport { mergeConfig, variantRows, withValueAt } from './variants';\nimport './index.css';\nimport { Description } from './Description';\nimport { type IndexEnv, IndexEnvContext, useEnv } from './envContext';\nimport { IndexApi } from './IndexApi';\nimport { LabBadge } from './LabBadge';\nimport { LibraryBadge } from './LibraryBadge';\nimport num from '@weasel-js/theme/numeric.module.css';\n\nexport { type IndexEnv, IndexEnvContext } from './envContext';\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. Each row is headed one\n * level below the story's `h2`, and named for the story as well, since every story's rows share labels. */\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={`${story.name}: ${row.label}`}>\n <h3 className=\"fg-index-variants__label\">{row.label}</h3>\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 const withApi = env.api !== undefined;\n return (\n <article className={withApi ? 'fg-index fg-index--api' : '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 <div className=\"fg-index__body\">\n <IndexApi />\n <div className=\"fg-index__stories\">\n {env.stories.map((story) => (\n <StorySection key={story.id} story={story} variants={withVariants.has(story.id)} />\n ))}\n </div>\n </div>\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 Api: IndexApi,\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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSafeOverride } from './chunk-
|
|
1
|
+
import { isSafeOverride } from './chunk-PN4IFL5E.js';
|
|
2
2
|
|
|
3
3
|
// src/title.ts
|
|
4
4
|
var DEFAULT_TITLE = "weaselforge";
|
|
@@ -59,5 +59,5 @@ function parsePayload(body) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export { CAPTURE_PAGES, CAPTURE_PATH, DEFAULT_TITLE, ISSUES_PATH, MAX_DPR, MIN_DPR, issueLabel, messageOf, parsePayload };
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-7YVJS4QS.js.map
|
|
63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GAAA,KAAQ,QAAA,IAAY,EAAE,OAAO,OAAA,IAAW,GAAA,IAAO,OAAA,CAAA,EAAU,OAAO,EAAE,KAAA,EAAO,CAAA,gBAAA,EAAmB,OAAO,CAAA,EAAA,EAAK,OAAO,CAAA,CAAA,CAAA,EAAI;AAC9H,EAAA,IAAI,CAAC,QAAA,CAAS,MAAM,CAAA,IAAK,CAAC,OAAO,MAAA,CAAO,IAAI,CAAA,IAAK,CAAC,OAAO,MAAA,CAAO,GAAG,GAAG,OAAO,EAAE,OAAO,wCAAA,EAAyC;AAC/H,EAAA,IAAI,CAAC,QAAA,CAAS,GAAG,CAAA,IAAK,CAAC,QAAA,CAAS,GAAA,CAAI,OAAO,CAAA,IAAM,GAAA,CAAI,IAAA,KAAS,OAAA,IAAW,GAAA,CAAI,SAAS,MAAA,EAAS;AAC7F,IAAA,OAAO,EAAE,OAAO,mDAAA,EAAoD;AAAA,EACtE;AACA,EAAA,IAAI,gBAAgB,OAAA,IAAW,WAAA,KAAgB,QAAQ,OAAO,EAAE,OAAO,mCAAA,EAAoC;AAC3G,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,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-7YVJS4QS.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","/** Where the issues endpoint answers, under the dev server's base. */\nexport const ISSUES_PATH = '__forge/issues';\n\n/** The label a component's issues carry. */\nexport const issueLabel = (component: string): string => `forge:${component}`;\n\n/** An open issue filed against a component. */\nexport interface ForgeIssue {\n number: number;\n title: string;\n url: string;\n /** When it was opened, as an ISO date. */\n opened: string;\n}\n\n/** The GitHub repository the dev server's checkout pushes to. */\nexport interface IssueRepo {\n /** `owner/name`. */\n slug: string;\n /** Its page, such as `https://github.com/owner/name`. */\n url: string;\n}\n\n/**\n * What a GET of the endpoint answers. `repo`, `branch` and `commit` describe the checkout whether or not `gh` can\n * list anything; exactly one of `issues`, `unavailable` and `error` is set.\n */\nexport interface IssuesAnswer {\n /** Null when `origin` names no GitHub repository. */\n repo: IssueRepo | null;\n /** Null on a detached head. */\n branch: string | null;\n commit: string | null;\n issues?: ForgeIssue[];\n /** Why nothing can be listed, when that is the machine's setup rather than a fault: no `gh`, no login, no repo. */\n unavailable?: string;\n /** What went wrong when `gh` was there and failed. */\n error?: string;\n}\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clockSpecOf, isNative, ClockContext } from './chunk-TT4ZOYB6.js';
|
|
2
|
-
import { isSafeOverride, storyNameFromExport, storyId, PROP_ARG_TYPES_EXPORT } from './chunk-
|
|
2
|
+
import { isSafeOverride, storyNameFromExport, storyId, PROP_ARG_TYPES_EXPORT, API_EXPORT } from './chunk-PN4IFL5E.js';
|
|
3
3
|
import { portSafePart, appliedLocal, withUnsent, coverOf, ArgsContext } from './chunk-B26DWEYT.js';
|
|
4
4
|
import { DEFAULT_LAYOUT } from './chunk-STK2AZH2.js';
|
|
5
5
|
import { createContext, useState, useRef, useEffect, Component, useLayoutEffect, useContext, createElement } from 'react';
|
|
@@ -783,7 +783,7 @@ function loadCsfModule(mod, title, projectParameters = {}) {
|
|
|
783
783
|
const stories = [];
|
|
784
784
|
const propArgTypes = isPlainObject(mod[PROP_ARG_TYPES_EXPORT]) ? mod[PROP_ARG_TYPES_EXPORT] : void 0;
|
|
785
785
|
for (const [exportName, value] of Object.entries(mod)) {
|
|
786
|
-
if (exportName === PROP_ARG_TYPES_EXPORT) continue;
|
|
786
|
+
if (exportName === PROP_ARG_TYPES_EXPORT || exportName === API_EXPORT) continue;
|
|
787
787
|
if (exportName === "default" || exportName === "__namedExportsOrder" || exportName === "__esModule") continue;
|
|
788
788
|
if (meta.includeStories && !matches(exportName, meta.includeStories)) continue;
|
|
789
789
|
if (meta.excludeStories && matches(exportName, meta.excludeStories)) continue;
|
|
@@ -934,7 +934,33 @@ function useHostConditions(host, opts) {
|
|
|
934
934
|
);
|
|
935
935
|
return overridesRef;
|
|
936
936
|
}
|
|
937
|
+
var overflows = (el) => el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth;
|
|
938
|
+
function useOverflowing(el) {
|
|
939
|
+
const [overflowing, setOverflowing] = useState(false);
|
|
940
|
+
useLayoutEffect(() => {
|
|
941
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
942
|
+
const check = () => setOverflowing(overflows(el));
|
|
943
|
+
const sizes = new ResizeObserver(check);
|
|
944
|
+
const watch = () => {
|
|
945
|
+
sizes.disconnect();
|
|
946
|
+
sizes.observe(el);
|
|
947
|
+
for (const child of el.children) sizes.observe(child, { box: "border-box" });
|
|
948
|
+
};
|
|
949
|
+
const children = new MutationObserver(() => {
|
|
950
|
+
watch();
|
|
951
|
+
check();
|
|
952
|
+
});
|
|
953
|
+
children.observe(el, { childList: true });
|
|
954
|
+
watch();
|
|
955
|
+
check();
|
|
956
|
+
return () => {
|
|
957
|
+
children.disconnect();
|
|
958
|
+
sizes.disconnect();
|
|
959
|
+
};
|
|
960
|
+
}, [el]);
|
|
961
|
+
return overflowing;
|
|
962
|
+
}
|
|
937
963
|
|
|
938
|
-
export { StoryHost, applyGlobalsTo, auditElement, createA11yHighlighter, createGlobalsTarget, createOverrides, cssRulesOf, indexRenderOf, loadStories, resolveCssVar, runAxe, scanCssVars, useHostConditions, useOwnClock, varRefs };
|
|
939
|
-
//# sourceMappingURL=chunk-
|
|
940
|
-
//# sourceMappingURL=chunk-
|
|
964
|
+
export { StoryHost, applyGlobalsTo, auditElement, createA11yHighlighter, createGlobalsTarget, createOverrides, cssRulesOf, indexRenderOf, loadStories, resolveCssVar, runAxe, scanCssVars, useHostConditions, useOverflowing, useOwnClock, varRefs };
|
|
965
|
+
//# sourceMappingURL=chunk-EVPVBDHM.js.map
|
|
966
|
+
//# sourceMappingURL=chunk-EVPVBDHM.js.map
|