@weasel-js/forge 1.6.1 → 1.7.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 +33 -0
- package/dist/{FrameController-BspC9Zr5.d.ts → FrameController-HEcTM04H.d.ts} +24 -1
- package/dist/{chunk-DIOLWCH7.js → chunk-7GQI2PDH.js} +7 -63
- package/dist/chunk-7GQI2PDH.js.map +1 -0
- package/dist/{chunk-CSAXZIMV.js → chunk-DDDCZ6XW.js} +98 -11
- package/dist/chunk-DDDCZ6XW.js.map +1 -0
- package/dist/{chunk-OLWZURU3.js → chunk-ERRLEH6S.js} +10 -11
- package/dist/chunk-ERRLEH6S.js.map +1 -0
- package/dist/chunk-LLGBNJAZ.js +77 -0
- package/dist/chunk-LLGBNJAZ.js.map +1 -0
- package/dist/chunk-WEQSLPKT.js +9 -0
- package/dist/chunk-WEQSLPKT.js.map +1 -0
- package/dist/{chunk-JXIWZFD4.js → chunk-YKN3IAEX.js} +12 -10
- package/dist/chunk-YKN3IAEX.js.map +1 -0
- package/dist/{config-C5Vq5Kjj.d.ts → config-pDbcbGco.d.ts} +15 -3
- package/dist/csf/preview-api.js +1 -1
- package/dist/frame/index.css +63 -7
- package/dist/frame/index.css.map +1 -1
- package/dist/frame/index.d.ts +4 -2
- package/dist/frame/index.js +10 -3
- package/dist/frame/index.js.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/shell/index.css +162 -3
- package/dist/shell/index.css.map +1 -1
- package/dist/shell/index.d.ts +34 -31
- package/dist/shell/index.js +166 -188
- package/dist/shell/index.js.map +1 -1
- package/dist/test/index.d.ts +1 -1
- package/dist/test/index.js +4 -3
- package/dist/test/index.js.map +1 -1
- package/dist/vite/index.js +344 -18
- package/dist/vite/index.js.map +1 -1
- package/package.json +10 -10
- package/dist/chunk-CSAXZIMV.js.map +0 -1
- package/dist/chunk-DIOLWCH7.js.map +0 -1
- package/dist/chunk-JXIWZFD4.js.map +0 -1
- package/dist/chunk-OLWZURU3.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/frame/a11y.ts","../src/frame/cssVars.ts","../src/frame/capture.ts","../src/frame/globalsTarget.ts","../src/frame/StoryHost.tsx","../src/csf/argsToSchema.ts","../src/csf/loadCsfModule.tsx","../src/story/native.ts","../src/story/load.ts"],"names":["value","config","f"],"mappings":";;;;;;;;AAqBA,IAAM,OAAA,uBAAc,GAAA,CAAI,CAAC,SAAS,UAAA,EAAY,SAAA,EAAW,UAAU,CAAC,CAAA;AAEpE,SAAS,QAAQ,IAAA,EAA+B;AAC9C,EAAA,MAAM,MAAA,GAAS,KAAK,MAAA,IAAU,EAAA;AAC9B,EAAA,OAAO;AAAA,IACL,IAAI,IAAA,CAAK,EAAA;AAAA,IACT,MAAA,EAAQ,OAAA,CAAQ,GAAA,CAAI,MAAM,IAAK,MAAA,GAAmC,IAAA;AAAA,IAClE,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,SAAS,IAAA,CAAK,OAAA;AAAA,IACd,aAAa,IAAA,CAAK,WAAA;AAAA,IAClB,KAAA,EAAO,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA;AAAA,MAE/B,QAAQ,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,CAAC,SAAU,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,GAAI,KAAK,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA,CAAO,IAAI,CAAE,CAAA;AAAA,MACvF,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,GAAI,KAAK,cAAA,KAAmB,MAAA,GAAY,EAAC,GAAI,EAAE,cAAA,EAAgB,IAAA,CAAK,cAAA;AAAe,KACrF,CAAE;AAAA,GACJ;AACF;AAEA,IAAI,OAAA,GAAqC,IAAA;AAGzC,SAAS,OAAA,GAA8B;AACrC,EAAA,OAAA,KAAY,OAAO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,cAAc,GAAA,EAAkD;AAC9E,EAAA,MAAM,OAAO,GAAA,CAAI,OAAA;AACjB,EAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAM,MAAM,IAAI,IAAA,EAAM,KAAA,GAAQ,IAAA,EAAM,UAAA,EAAY,KAAA,EAAO,KAAA;AAC/E,EAAA,OAAO,OAAO,MAAA,KAAW,UAAA,GAAc,MAAA,GAAyB,IAAA;AAClE","file":"chunk-ERRLEH6S.js","sourcesContent":["import type { A11yFinding, A11yReport } from '../protocol/messages';\n\n/** The shape of `axe.run`'s answer this module reads. */\ninterface AxeResult {\n violations: readonly AxeFinding[];\n incomplete: readonly AxeFinding[];\n passes: readonly unknown[];\n inapplicable: readonly unknown[];\n}\ninterface AxeFinding {\n id: string;\n impact?: string | null;\n help: string;\n helpUrl: string;\n description: string;\n nodes: readonly { target: readonly unknown[]; html: string; failureSummary?: string }[];\n}\ninterface AxeModule {\n run(context: Element, options?: unknown): Promise<AxeResult>;\n}\n\nconst IMPACTS = new Set(['minor', 'moderate', 'serious', 'critical']);\n\nfunction finding(from: AxeFinding): A11yFinding {\n const impact = from.impact ?? '';\n return {\n id: from.id,\n impact: IMPACTS.has(impact) ? (impact as A11yFinding['impact']) : null,\n help: from.help,\n helpUrl: from.helpUrl,\n description: from.description,\n nodes: from.nodes.map((node) => ({\n // An axe target entry is a selector, or an array of them for an element inside a shadow root.\n target: node.target.map((part) => (Array.isArray(part) ? part.join(' ') : String(part))),\n html: node.html,\n ...(node.failureSummary === undefined ? {} : { failureSummary: node.failureSummary }),\n })),\n };\n}\n\nlet loading: Promise<AxeModule> | null = null;\n\n/** axe is ~500 KB, so a frame that is never audited never pays for it. */\nfunction loadAxe(): Promise<AxeModule> {\n loading ??= import('axe-core').then((mod) => (mod as unknown as { default?: AxeModule }).default ?? (mod as unknown as AxeModule));\n return loading;\n}\n\n/** Rules that judge the page rather than the element audited; off when the element is one story on a page of many. */\nexport const PAGE_RULES: readonly string[] = [\n 'bypass',\n 'document-title',\n 'html-has-lang',\n 'html-lang-valid',\n 'html-xml-lang-mismatch',\n 'landmark-one-main',\n 'page-has-heading-one',\n 'region',\n];\n\nexport interface RunAxeOptions {\n /** Whether `element` stands for the whole page. False leaves `PAGE_RULES` out. Default true. */\n page?: boolean;\n}\n\n/** Runs axe over `element` and reduces its answer to what crosses the frame's channel. */\nexport async function runAxe(element: Element, { page = true }: RunAxeOptions = {}): Promise<A11yReport> {\n const axe = await loadAxe();\n const rules = page ? undefined : Object.fromEntries(PAGE_RULES.map((id) => [id, { enabled: false }]));\n const result = await axe.run(element, rules ? { rules } : undefined);\n return {\n violations: result.violations.map(finding),\n incomplete: result.incomplete.map(finding),\n passes: result.passes.length,\n inapplicable: result.inapplicable.length,\n };\n}\n","import type { CssVarReport } from '../protocol/messages';\n\nconst VAR_REF = /var\\(\\s*(--[\\w-]+)/g;\n\nfunction collect(text: string, names: Set<string>): void {\n if (!text.includes('var(')) return;\n for (const [, name] of text.matchAll(VAR_REF)) names.add(name!);\n}\n\n/** A grouping rule's text holds its children's; an `@import` holds only its URL, so its sheet is read too. */\nfunction walkRules(sheet: CSSStyleSheet, names: Set<string>): void {\n let rules: CSSRuleList;\n try {\n rules = sheet.cssRules;\n } catch {\n // A cross-origin sheet refuses to be read.\n return;\n }\n for (const rule of Array.from(rules)) {\n const imported = (rule as CSSRule & { styleSheet?: CSSStyleSheet | null }).styleSheet;\n if (imported) walkRules(imported, names);\n else collect(rule.cssText, names);\n }\n}\n\n/**\n * Every custom property the document references with `var()`, from inline styles and stylesheet rules — computed\n * styles have already substituted the reference away. Values resolve on `root`, the document's by default, or else\n * on the first element under it that declares one.\n */\nexport function scanCssVars(\n doc: Document,\n overridden: (name: string) => boolean = () => false,\n root: Element = doc.documentElement,\n): CssVarReport[] {\n const names = new Set<string>();\n for (const el of Array.from(doc.querySelectorAll('[style]'))) collect(el.getAttribute('style') ?? '', names);\n for (const sheet of Array.from(doc.styleSheets)) walkRules(sheet, names);\n\n const values = resolveValues(doc, names, root);\n return [...names]\n .sort()\n .map((name) => ({ name, value: values.get(name) ?? '', overridden: overridden(name) }));\n}\n\nfunction resolveValues(doc: Document, names: Iterable<string>, root: Element): Map<string, string> {\n const view = doc.defaultView;\n const values = new Map<string, string>();\n if (!view) return values;\n const own = view.getComputedStyle(root);\n const missing: string[] = [];\n for (const name of names) {\n const value = own.getPropertyValue(name).trim();\n if (value) values.set(name, value);\n else missing.push(name);\n }\n const under = root === doc.documentElement ? (doc.body ?? root) : root;\n for (const el of missing.length > 0 ? Array.from(under.querySelectorAll('*')) : []) {\n const style = view.getComputedStyle(el);\n for (let i = missing.length - 1; i >= 0; i--) {\n const value = style.getPropertyValue(missing[i]!).trim();\n if (!value) continue;\n values.set(missing[i]!, value);\n missing.splice(i, 1);\n }\n if (missing.length === 0) break;\n }\n return values;\n}\n\n/** One custom property's value, resolved the way `scanCssVars` resolves each. */\nexport function resolveCssVar(doc: Document, name: string, root: Element = doc.documentElement): string {\n return resolveValues(doc, [name], root).get(name) ?? '';\n}\n\nexport interface Overrides {\n set(name: string, value: string | null): void;\n has(name: string): boolean;\n /** Whether `node` is the override style element or inside it. */\n owns(node: Node): boolean;\n dispose(): void;\n}\n\n/**\n * Custom property overrides as one rule on `scope`, kept last in `<head>`. `:not(#fg-overrides)` adds an ID's weight\n * without `!important`, so the rule outranks a theme's attribute selectors; a stylesheet that lands after it sends\n * the element back to the end.\n */\nexport function createOverrides(doc: Document, scope = ':root'): Overrides {\n const values = new Map<string, string>();\n const style = doc.createElement('style');\n style.setAttribute('data-fg-overrides', '');\n\n // Another instance's style counts as last place too, or two instances would take turns moving forever.\n const keepLast = () => {\n if (style.parentNode === doc.head) {\n let next = style.nextElementSibling;\n while (next?.hasAttribute('data-fg-overrides')) next = next.nextElementSibling;\n if (next === null) return;\n }\n doc.head.append(style);\n };\n const write = () => {\n const decls = [...values].map(([name, value]) => ` ${name}: ${value};`);\n style.textContent = decls.length > 0 ? `:is(${scope}):not(#fg-overrides) {\\n${decls.join('\\n')}\\n}\\n` : '';\n };\n\n keepLast();\n const observer = typeof MutationObserver === 'undefined' ? null : new MutationObserver(keepLast);\n observer?.observe(doc.head, { childList: true });\n\n return {\n set(name, value) {\n if (value === null) values.delete(name);\n else values.set(name, value);\n write();\n },\n has: (name) => values.has(name),\n owns: (node) => style.contains(node),\n dispose() {\n observer?.disconnect();\n style.remove();\n },\n };\n}\n","import type { CapturedPicture } from '../protocol/messages';\nimport { scanCssVars } from './cssVars';\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n/** Every rule the document can read. A cross-origin sheet refuses, and is skipped. */\nfunction documentCss(doc: Document): string {\n const out: string[] = [];\n for (const sheet of Array.from(doc.styleSheets)) {\n try {\n for (const rule of Array.from(sheet.cssRules)) out.push(rule.cssText);\n } catch {\n // A cross-origin sheet refuses to be read.\n }\n }\n return out.join('\\n');\n}\n\n/**\n * The story's own subtree as an SVG picture: the DOM inside a `<foreignObject>`, with the document's\n * stylesheets beside it.\n *\n * The capture root is a `<div>`, so nothing a rule hangs off `:root`, `html` or `body` reaches the story —\n * hence the custom properties restated on the root, which is what theme tokens travel by.\n */\nexport function captureElement(element: HTMLElement): Extract<CapturedPicture, { kind: 'svg' }> {\n const doc = element.ownerDocument;\n const rect = element.getBoundingClientRect();\n const w = Math.max(1, Math.ceil(rect.width));\n const h = Math.max(1, Math.ceil(rect.height));\n\n const root = doc.createElement('div');\n root.setAttribute('data-fg-capture', '');\n const tokens = scanCssVars(doc)\n .filter((v) => v.value)\n .map((v) => `${v.name}: ${v.value};`)\n .join('');\n const style = doc.createElement('style');\n style.textContent = `${documentCss(doc)}\\n[data-fg-capture]{${tokens}}`;\n root.append(style, element.cloneNode(true));\n\n // XML, not HTML: an `<svg>` base is re-parsed as XML, where `<br>` and friends have to be closed.\n const inner = new XMLSerializer().serializeToString(root);\n return {\n kind: 'svg',\n markup: `<svg xmlns=\"${SVG_NS}\" width=\"${w}\" height=\"${h}\" viewBox=\"0 0 ${w} ${h}\"><foreignObject x=\"0\" y=\"0\" width=\"${w}\" height=\"${h}\">${inner}</foreignObject></svg>`,\n };\n}\n","/** What a setup's `applyGlobals` is handed: the element the globals apply to, and a way to style it alone. */\nexport interface GlobalsTarget {\n /** A frame document's root, or one story's host in the workshop document. */\n root: HTMLElement;\n /** A selector matching `root` and nothing else, so a rule written under it reaches only this target. */\n scope: string;\n /** Replaces the CSS forge keeps for this target. */\n style: (css: string) => void;\n}\n\n/** A target over `root`, owning one `<style>` in the document's head; `dispose` removes it. */\nexport function createGlobalsTarget(root: HTMLElement, scope: string): GlobalsTarget & { dispose: () => void } {\n const doc = root.ownerDocument;\n let style: HTMLStyleElement | null = null;\n return {\n root,\n scope,\n style(css) {\n if (!style) {\n style = doc.createElement('style');\n style.setAttribute('data-fg-globals', scope);\n doc.head.append(style);\n }\n style.textContent = css;\n },\n dispose() {\n style?.remove();\n style = null;\n },\n };\n}\n","import { Component, type ReactNode } from 'react';\nimport type { Decorator, LoadedStory, StoryContext } from '../story/types';\n\nexport interface StoryHostProps {\n story: LoadedStory;\n ctx: StoryContext;\n /** Outermost decorators, from the frame setup. */\n decorators: readonly Decorator[];\n /** A change clears a caught error, so new input retries the render. */\n resetKey: number;\n onError: (error: unknown) => void;\n}\n\nfunction RenderStory({ story, ctx }: { story: LoadedStory; ctx: StoryContext }): ReactNode {\n return story.render(ctx);\n}\n\nfunction Decorated({ story, ctx, decorators }: Omit<StoryHostProps, 'resetKey' | 'onError'>): ReactNode {\n let inner: () => ReactNode = () => <RenderStory story={story} ctx={ctx} />;\n for (const decorate of [...story.decorators, ...decorators]) {\n const wrapped = inner;\n inner = () => decorate(wrapped, ctx);\n }\n return inner();\n}\n\ninterface BoundaryState {\n error: unknown;\n failed: boolean;\n resetKey: number;\n}\n\nexport class StoryHost extends Component<StoryHostProps, BoundaryState> {\n override state: BoundaryState = { error: null, failed: false, resetKey: this.props.resetKey };\n\n static getDerivedStateFromProps(props: StoryHostProps, state: BoundaryState): Partial<BoundaryState> | null {\n return props.resetKey === state.resetKey ? null : { error: null, failed: false, resetKey: props.resetKey };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<BoundaryState> {\n return { error, failed: true };\n }\n\n override componentDidCatch(error: unknown): void {\n this.props.onError(error);\n }\n\n override render(): ReactNode {\n if (this.state.failed) {\n const { error } = this.state;\n return <pre className=\"fg-frame__fault\">{error instanceof Error ? error.message : String(error)}</pre>;\n }\n const { story, ctx, decorators } = this.props;\n return <Decorated story={story} ctx={ctx} decorators={decorators} />;\n }\n}\n","import { type ConfigNode, type ConfigSchema, type ConfigShape, f } from '@weasel-js/labkit/config';\nimport { isPlainObject } from './isPlainObject';\nimport { portSafePart } from './portSafe';\n\n/** Storybook's conditional control: shown only while an arg, or a global, meets the test. */\nexport type ArgCondition = ({ arg: string } | { global: string }) & {\n truthy?: boolean;\n exists?: boolean;\n eq?: unknown;\n neq?: unknown;\n};\n\n/** A CSF `argTypes` entry, as far as forge reads it. */\nexport interface ArgType {\n name?: string;\n description?: string;\n control?:\n | string\n | false\n | {\n type?: string;\n min?: number;\n max?: number;\n step?: number;\n /** forge's own: an icon (weasel-ui `IconName`) per option, drawn in place of its label. */\n icons?: Readonly<Record<string, string>>;\n };\n options?: readonly unknown[];\n table?: { disable?: boolean };\n if?: ArgCondition;\n}\n\ninterface Leaf extends ConfigNode<unknown> {\n hidden(): Leaf;\n describe(description: string): Leaf;\n label(name: string): Leaf;\n showIf(predicate: (config: Record<string, unknown>) => boolean): Leaf;\n}\n\ninterface Control {\n type: string | undefined;\n min?: number;\n max?: number;\n step?: number;\n icons?: Readonly<Record<string, string>>;\n}\n\nfunction controlOf(argType: ArgType): Control | false {\n const { control } = argType;\n if (control === false) return false;\n if (typeof control === 'string') return { type: control };\n return { type: control?.type, min: control?.min, max: control?.max, step: control?.step, icons: control?.icons };\n}\n\nfunction stringOptions(argType: ArgType): string[] | null {\n const opts = argType.options;\n return opts && opts.length > 0 && opts.every((o) => typeof o === 'string') ? (opts as string[]) : null;\n}\n\nfunction inferred(value: unknown): Leaf | null {\n switch (typeof value) {\n case 'number':\n return f.number(value);\n case 'boolean':\n return f.boolean(value);\n case 'string':\n return f.string(value);\n default:\n return Array.isArray(value) || isPlainObject(value) ? f.custom('json', value) : null;\n }\n}\n\nfunction bounded(node: ReturnType<typeof f.number>, control: Control) {\n let out = node;\n if (control.min !== undefined && control.max !== undefined) out = out.range(control.min, control.max);\n if (control.step !== undefined) out = out.step(control.step);\n return out;\n}\n\nfunction controlled(control: Control, argType: ArgType, has: boolean, value: unknown): Leaf | null {\n const options = stringOptions(argType);\n // Storybook passes an argTypes-only key as undefined, so the component's own default applies.\n const def = <T>() => (has ? value : undefined) as T;\n switch (control.type) {\n case 'number': {\n const node = bounded(f.number(def()), control);\n return control.min !== undefined && control.max !== undefined ? node.input() : node;\n }\n case 'range':\n case 'slider':\n return has ? bounded(f.number(def()), control).slider() : null;\n case 'boolean':\n return f.boolean(def());\n case 'switch':\n return f.boolean(def()).toggle();\n case 'text':\n case 'textarea':\n return f.string(def());\n case 'select':\n case 'radio':\n case 'inline-radio':\n case undefined: {\n if (!options) return control.type === undefined && has ? inferred(value) : null;\n const { icons } = control;\n const node = f.enum(\n def<string>(),\n icons ? options.map((value) => ({ value, label: value, ...(icons[value] ? { icon: icons[value] } : {}) })) : options,\n );\n return control.type === 'radio' || control.type === 'inline-radio' ? node.radio() : node;\n }\n case 'object':\n return has ? f.custom('json', value) : null;\n default:\n return has ? inferred(value) : null;\n }\n}\n\n/** The config predicate for an `if`; null for a condition on a global, which a story's config does not hold. */\nfunction conditionOf(condition: ArgCondition): ((config: Record<string, unknown>) => boolean) | null {\n if (!('arg' in condition)) return null;\n const { arg } = condition;\n return (config) => {\n const value = config[arg];\n if (condition.exists !== undefined) return (value !== undefined) === condition.exists;\n if ('eq' in condition) return Object.is(value, condition.eq);\n if ('neq' in condition) return !Object.is(value, condition.neq);\n return Boolean(value) === (condition.truthy ?? true);\n };\n}\n\n/** `parameters.controls.matchers`: arg names that pick a control when the arg's argType names none. */\nexport interface ControlMatchers {\n color?: RegExp;\n /** labkit has no date leaf, so a date match keeps the leaf its value infers. */\n date?: RegExp;\n}\n\n/** Storybook's rule: a string arg with no control or options whose name matches `color` gets a color picker. */\nfunction matched(key: string, value: unknown, argType: ArgType | undefined, matchers: ControlMatchers): Leaf | null {\n if (typeof value !== 'string' || argType?.control !== undefined || stringOptions(argType ?? {})) return null;\n return matchers.color?.test(key) ? f.color(value) : null;\n}\n\n/** A labkit schema for a CSF story's args, refined by its `argTypes`. */\nexport function argsToSchema(\n args: Readonly<Record<string, unknown>>,\n argTypes: Readonly<Record<string, ArgType | undefined>>,\n matchers: ControlMatchers = {},\n): ConfigSchema<unknown> {\n const nodes: Record<string, Leaf> = {};\n for (const key of new Set([...Object.keys(args), ...Object.keys(argTypes)])) {\n const has = key in args;\n // A control carries only what crosses the port; the frame puts the rest back from `args` (`withUnsent`).\n const part = has ? portSafePart(args[key]) : null;\n if (has && !part) continue;\n const value = part?.value;\n const argType = argTypes[key];\n const control = argType ? controlOf(argType) : false;\n\n let node: Leaf | null =\n (has ? matched(key, value, argType, matchers) : null) ??\n (control ? controlled(control, argType ?? {}, has, value) : has ? inferred(value) : null);\n if (!node) continue;\n if (argType && (argType.control === false || argType.table?.disable)) node = node.hidden();\n if (argType?.description) node = node.describe(argType.description);\n if (argType?.name) node = node.label(argType.name);\n const shownWhen = argType?.if ? conditionOf(argType.if) : null;\n if (shownWhen) node = node.showIf(shownWhen);\n nodes[key] = node;\n }\n return f.schema(nodes as ConfigShape);\n}\n","import {\n type ComponentType,\n createContext,\n createElement,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport type { Globals, Layout, Viewport } from '../protocol/messages';\nimport { storyId, storyNameFromExport } from '../story/ids';\nimport type { Decorator, LoadedStory, PlayContext, StoryContext } from '../story/types';\nimport { type ArgsScope, ArgsContext, appliedLocal, coverOf, type LocalArgs } from './argsContext';\nimport { type ArgType, argsToSchema, type ControlMatchers } from './argsToSchema';\nimport { isPlainObject } from './isPlainObject';\nimport { withUnsent } from './portSafe';\n\ntype Args = Record<string, unknown>;\ntype CsfContext = {\n args: Args;\n globals: Globals;\n parameters: Record<string, unknown>;\n title: string;\n name: string;\n id: string;\n viewMode: 'story';\n};\ntype CsfRender = (args: Args, context: CsfContext) => ReactNode;\ntype CsfDecorator = (Story: ComponentType, context: CsfContext) => ReactNode;\ntype CsfPlay = (context: CsfContext & { canvasElement: HTMLElement; step: CsfStep }) => void | Promise<void>;\ntype CsfStep = (label: string, fn: () => void | Promise<void>) => Promise<void>;\n\ninterface Annotations {\n title?: string;\n name?: string;\n storyName?: string;\n component?: ComponentType<Args>;\n args?: Args;\n argTypes?: Record<string, ArgType>;\n parameters?: Record<string, unknown>;\n globals?: Record<string, unknown>;\n decorators?: CsfDecorator | CsfDecorator[];\n render?: CsfRender;\n play?: CsfPlay;\n includeStories?: string[] | RegExp;\n excludeStories?: string[] | RegExp;\n}\n\nconst LAYOUTS: readonly Layout[] = ['centered', 'padded', 'fullscreen'];\n\nconst asArray = <T,>(value: T | T[] | undefined): T[] => (value === undefined ? [] : Array.isArray(value) ? value : [value]);\n\n/** Storybook's `deleteUndefined`, which its args store applies after every update. */\nconst withoutUndefined = (args: Args): Args =>\n Object.fromEntries(Object.entries(args).filter(([, value]) => value !== undefined));\n\n/** Storybook's `matches` from `isExportStory`. */\nconst matches = (key: string, filter: string[] | RegExp) =>\n Array.isArray(filter) ? filter.includes(key) : key.match(filter) !== null;\n\n/** Storybook's `combineParameters`: plain objects merge deeply, anything else is replaced. */\nfunction combineParameters(...sources: (Record<string, unknown> | undefined)[]): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source ?? {})) {\n if (value === undefined) continue;\n out[key] = isPlainObject(value) && isPlainObject(out[key]) ? combineParameters(out[key], value) : value;\n }\n }\n return out;\n}\n\nfunction resolveViewport(parameters: Record<string, unknown>, globals: Record<string, unknown>): Viewport | null {\n const selected = globals.viewport as { value?: string; isRotated?: boolean } | undefined;\n const options = (parameters.viewport as { options?: Record<string, { styles?: { width?: string; height?: string } }> } | undefined)\n ?.options;\n const styles = selected?.value ? options?.[selected.value]?.styles : undefined;\n const px = (v: string | undefined) => (v && /^\\d+(\\.\\d+)?px$/.test(v) ? Number.parseFloat(v) : Number.NaN);\n const width = px(styles?.width);\n const height = px(styles?.height);\n if (Number.isNaN(width) || Number.isNaN(height)) return null;\n return selected?.isRotated ? { width: height, height: width } : { width, height };\n}\n\nconst InnerStory = createContext<(() => ReactNode) | null>(null);\n\nfunction Story(): ReactNode {\n return useContext(InnerStory)?.() ?? null;\n}\n\nfunction Call({ fn }: { fn: () => ReactNode }): ReactNode {\n return fn();\n}\n\ninterface StoryLocals {\n story: string;\n local: LocalArgs;\n setLocal: Dispatch<SetStateAction<LocalArgs>>;\n}\n\nconst LocalArgsContext = createContext<StoryLocals | null>(null);\n\n/** The outermost scope of a story holds its frame-local args, so its decorators and render share them. */\nfunction Scoped({\n id,\n build,\n fn,\n}: {\n id: string;\n build: (local: StoryLocals) => [ArgsScope, CsfContext];\n fn: (context: CsfContext) => ReactNode;\n}): ReactNode {\n const outer = useContext(LocalArgsContext);\n const [local, setLocal] = useState<LocalArgs>({});\n const shared = outer?.story === id ? outer : { story: id, local, setLocal };\n const [scope, context] = build(shared);\n const { config } = scope;\n const prune = shared.setLocal;\n // An entry config has moved past must not come back if config later returns to the value it covered.\n useEffect(() => {\n prune((prev) => {\n const kept = Object.entries(prev).filter(([key, entry]) => coverOf(config[key]) === entry.over);\n return kept.length === Object.keys(prev).length ? prev : Object.fromEntries(kept);\n });\n }, [config, prune]);\n return createElement(\n LocalArgsContext.Provider,\n { value: shared },\n createElement(ArgsContext.Provider, { value: scope }, createElement(Call, { fn: () => fn(context) })),\n );\n}\n\n/**\n * Normalizes a Component Story Format module. `autoTitle` titles the stories when the meta names no title;\n * `parameters` are the project's, under the meta's and each story's.\n */\nexport function loadCsfModule(\n mod: Record<string, unknown>,\n autoTitle: string,\n projectParameters: Record<string, unknown> = {},\n): LoadedStory[] {\n const meta = (isPlainObject(mod.default) ? mod.default : {}) as Annotations;\n const title = meta.title ?? autoTitle;\n const stories: LoadedStory[] = [];\n\n for (const [exportName, value] of Object.entries(mod)) {\n if (exportName === 'default' || exportName === '__namedExportsOrder' || exportName === '__esModule') continue;\n if (meta.includeStories && !matches(exportName, meta.includeStories)) continue;\n if (meta.excludeStories && matches(exportName, meta.excludeStories)) continue;\n if (!value || (typeof value !== 'object' && typeof value !== 'function')) continue;\n\n // A CSF 2 function export hoists its annotations onto itself.\n const spec: Annotations = typeof value === 'function' ? { ...value, render: value as CsfRender } : (value as Annotations);\n const id = storyId(title, exportName);\n const name = spec.name || spec.storyName || storyNameFromExport(exportName);\n const args = { ...meta.args, ...spec.args };\n const parameters = combineParameters(projectParameters, meta.parameters, spec.parameters);\n const matchers = (parameters.controls as { matchers?: ControlMatchers } | undefined)?.matchers;\n const config = argsToSchema(\n args,\n combineParameters(meta.argTypes, spec.argTypes) as Record<string, ArgType>,\n isPlainObject(matchers) ? matchers : {},\n );\n const defaults = config.defaults() as Args;\n const storyGlobals = { ...meta.globals, ...spec.globals };\n const component = meta.component;\n const renderFn: CsfRender | undefined =\n spec.render ?? meta.render ?? (component ? (a) => createElement(component, a) : undefined);\n\n const withArgs = (config: Args): Args =>\n Object.fromEntries(\n Object.entries(withoutUndefined(config)).map(([key, value]) => [key, key in args ? withUnsent(value, args[key]) : value]),\n );\n const csfContext = (config: unknown, globals: Globals, local: LocalArgs = {}): CsfContext => ({\n args: withoutUndefined({ ...args, ...withArgs(config as Args), ...appliedLocal(local, config as Args) }),\n globals,\n parameters,\n title,\n name,\n id,\n viewMode: 'story',\n });\n const scoped = (ctx: StoryContext, fn: (context: CsfContext) => ReactNode): ReactNode =>\n createElement(Scoped, {\n id,\n build: ({ local, setLocal }: StoryLocals): [ArgsScope, CsfContext] => {\n const context = csfContext(ctx.config, ctx.globals, local);\n const scope: ArgsScope = {\n args: context.args,\n config: ctx.config as Args,\n defaults,\n original: args,\n setConfig: ctx.setConfig,\n setLocal,\n };\n return [scope, context];\n },\n fn,\n });\n\n const adapt =\n (decorator: CsfDecorator): Decorator =>\n (inner, ctx) =>\n createElement(\n InnerStory.Provider,\n { value: inner },\n scoped(ctx, (context) => decorator(Story, context)),\n );\n\n const layout = parameters.layout as Layout | undefined;\n const isolate = (parameters.forge as { isolate?: unknown } | undefined)?.isolate;\n const play = spec.play ?? meta.play;\n\n stories.push({\n id,\n title,\n name,\n exportName,\n config,\n initialState: null,\n render: (ctx) => {\n if (!renderFn) return null;\n return scoped(ctx, (context) => renderFn(context.args, context));\n },\n decorators: [...asArray(spec.decorators), ...asArray(meta.decorators)].map(adapt),\n layout: layout && LAYOUTS.includes(layout) ? layout : 'padded',\n viewport: resolveViewport(parameters, storyGlobals),\n isolate: typeof isolate === 'string' ? isolate : null,\n play: play\n ? ({ canvasElement, config, globals }: PlayContext) =>\n play({ ...csfContext(config, globals), canvasElement, step: async (_label, fn) => fn() })\n : null,\n });\n }\n return stories;\n}\n","import { f } from '@weasel-js/labkit/config';\nimport { isNative } from './define';\nimport { storyId, storyNameFromExport } from './ids';\nimport type { LoadedStory, MetaSpec, StorySpec } from './types';\n\n/** Normalizes a module written with `meta` and `story`; exports that are not stories are skipped. */\n/** `autoTitle` titles the stories when the meta names no title. */\nexport function loadNativeModule(mod: Record<string, unknown>, autoTitle: string): LoadedStory[] {\n const metaSpec: MetaSpec = isNative(mod.default, 'meta') ? (mod.default as MetaSpec) : {};\n const title = metaSpec.title ?? autoTitle;\n const stories: LoadedStory[] = [];\n for (const [exportName, value] of Object.entries(mod)) {\n if (exportName === 'default' || !isNative(value, 'story')) continue;\n const spec = value as StorySpec<unknown, unknown>;\n stories.push({\n id: storyId(title, exportName),\n title,\n name: spec.name ?? storyNameFromExport(exportName),\n exportName,\n config: spec.config ?? f.schema({}),\n initialState: spec.state ?? null,\n render: spec.render,\n decorators: [...(spec.decorators ?? []), ...(metaSpec.decorators ?? [])],\n layout: spec.layout ?? metaSpec.layout ?? 'centered',\n viewport: spec.viewport ?? null,\n isolate: spec.isolate ?? metaSpec.isolate ?? null,\n play: spec.play ?? null,\n });\n }\n return stories;\n}\n","import { loadCsfModule } from '../csf/loadCsfModule';\nimport { isNative } from './define';\nimport { loadNativeModule } from './native';\nimport type { IndexRender, LoadedStory } from './types';\n\n/**\n * A story module's stories: a module whose default export is a forge `meta` is native, anything else is CSF under\n * `parameters`. `autoTitle` titles the stories when the meta names no title.\n */\nexport function loadStories(\n mod: Record<string, unknown>,\n autoTitle: string,\n parameters?: Record<string, unknown>,\n): LoadedStory[] {\n return isNative(mod.default, 'meta')\n ? loadNativeModule(mod, autoTitle)\n : loadCsfModule(mod, autoTitle, parameters);\n}\n\n/** A module's own index page: a native meta's `index`, or a CSF meta's `parameters.forge.index`. */\nexport function indexRenderOf(mod: Record<string, unknown>): IndexRender | null {\n const meta = mod.default as { index?: unknown; parameters?: { forge?: { index?: unknown } } } | undefined;\n const render = isNative(meta, 'meta') ? meta?.index : meta?.parameters?.forge?.index;\n return typeof render === 'function' ? (render as IndexRender) : null;\n}\n"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { f } from '@weasel-js/labkit/config';
|
|
2
|
+
|
|
3
|
+
// src/shell/globals.ts
|
|
4
|
+
var GLOBALS_KEY = "$globals";
|
|
5
|
+
var FOLLOW_LAB = "lab";
|
|
6
|
+
var FOLLOW_APP = "app";
|
|
7
|
+
var APP_OPTION = { value: FOLLOW_APP, label: "App" };
|
|
8
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
|
+
var isGlobalsPath = (path) => path === GLOBALS_KEY || path.startsWith(`${GLOBALS_KEY}.`);
|
|
10
|
+
function shownOptions(declaration, globals) {
|
|
11
|
+
const { shows } = declaration;
|
|
12
|
+
return shows ? declaration.options.filter((option) => shows(option.value, globals)) : declaration.options;
|
|
13
|
+
}
|
|
14
|
+
function labOptions(declaration, globals) {
|
|
15
|
+
const shown = shownOptions(declaration, globals);
|
|
16
|
+
return declaration.follows ? [APP_OPTION, ...shown] : shown;
|
|
17
|
+
}
|
|
18
|
+
function followApp(declarations, values, chrome) {
|
|
19
|
+
const followed = Object.entries(declarations).flatMap(
|
|
20
|
+
([key, { follows }]) => follows && values[key] === FOLLOW_APP ? [[key, follows(chrome)]] : []
|
|
21
|
+
);
|
|
22
|
+
return followed.length === 0 ? values : { ...values, ...Object.fromEntries(followed) };
|
|
23
|
+
}
|
|
24
|
+
function labGlobals(declarations, stored) {
|
|
25
|
+
const from = isRecord(stored) ? stored : {};
|
|
26
|
+
const offered = Object.fromEntries(
|
|
27
|
+
Object.entries(declarations).map(([key, declaration]) => {
|
|
28
|
+
const value = from[key];
|
|
29
|
+
const known = declaration.options.some((option) => option.value === value) || declaration.follows && value === FOLLOW_APP;
|
|
30
|
+
return [key, known ? value : declaration.default];
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
return Object.fromEntries(
|
|
34
|
+
Object.entries(declarations).map(([key, declaration]) => {
|
|
35
|
+
const shown = shownOptions(declaration, offered);
|
|
36
|
+
const value = offered[key];
|
|
37
|
+
if (value === FOLLOW_APP && declaration.follows) return [key, value];
|
|
38
|
+
if (!declaration.shows || shown.length === 0 || shown.some((option) => option.value === value)) return [key, value];
|
|
39
|
+
const at = (v) => declaration.options.findIndex((option) => option.value === v);
|
|
40
|
+
const from2 = at(value);
|
|
41
|
+
const nearest = shown.reduce(
|
|
42
|
+
(best, option) => Math.abs(at(option.value) - from2) < Math.abs(at(best.value) - from2) ? option : best
|
|
43
|
+
);
|
|
44
|
+
return [key, nearest.value];
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function effectiveGlobals(lab, pins) {
|
|
49
|
+
if (!isRecord(pins)) return lab;
|
|
50
|
+
const pinned = Object.entries(pins).filter(([key, value]) => key in lab && value !== FOLLOW_LAB);
|
|
51
|
+
return pinned.length === 0 ? lab : { ...lab, ...Object.fromEntries(pinned) };
|
|
52
|
+
}
|
|
53
|
+
function storyConfig(config, previous) {
|
|
54
|
+
if (!isRecord(config) || !(GLOBALS_KEY in config)) return config;
|
|
55
|
+
const rest = Object.fromEntries(Object.entries(config).filter(([key]) => key !== GLOBALS_KEY));
|
|
56
|
+
if (isRecord(previous)) {
|
|
57
|
+
const keys = Object.keys(rest);
|
|
58
|
+
if (keys.length === Object.keys(previous).length && keys.every((key) => rest[key] === previous[key])) return previous;
|
|
59
|
+
}
|
|
60
|
+
return rest;
|
|
61
|
+
}
|
|
62
|
+
function withGlobals(schema, declarations) {
|
|
63
|
+
const entries = Object.entries(declarations);
|
|
64
|
+
if (entries.length === 0) return schema;
|
|
65
|
+
const leaves = Object.fromEntries(
|
|
66
|
+
entries.map(([key, declaration]) => [
|
|
67
|
+
key,
|
|
68
|
+
f.enum(FOLLOW_LAB, [{ value: FOLLOW_LAB, label: "Lab" }, ...declaration.options]).label(declaration.label)
|
|
69
|
+
])
|
|
70
|
+
);
|
|
71
|
+
const group = f.group(leaves).label("").section("Globals", { layout: "inline", pack: "pairs" });
|
|
72
|
+
return f.schema({ ...schema.nodes, [GLOBALS_KEY]: group });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { FOLLOW_APP, GLOBALS_KEY, effectiveGlobals, followApp, isGlobalsPath, labGlobals, labOptions, storyConfig, withGlobals };
|
|
76
|
+
//# sourceMappingURL=chunk-LLGBNJAZ.js.map
|
|
77
|
+
//# sourceMappingURL=chunk-LLGBNJAZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shell/globals.ts"],"names":["from"],"mappings":";;;AAgCO,IAAM,WAAA,GAAc;AAEpB,IAAM,UAAA,GAAa,KAAA;AAEnB,IAAM,UAAA,GAAa;AAE1B,IAAM,UAAA,GAAa,EAAE,KAAA,EAAO,UAAA,EAAY,OAAO,KAAA,EAAM;AAErD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AAW,MAAA,CAAO,KAAK,QAAQ,CAAA,CAAE,UAAU,IAAA,CAAK,KAAA,CAAM,CAAC,GAAA,KAAQ,KAAK,GAAG,CAAA,KAAM,SAAS,GAAG,CAAC,GAAG,OAAO,QAAA;AAAA,EAC/G;AACA,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,WAAA,CAAY,QAA+B,YAAA,EAAyD;AAClH,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,YAAY,CAAA;AAC3C,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AACjC,EAAA,MAAM,SAAS,MAAA,CAAO,WAAA;AAAA,IACpB,QAAQ,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,WAAW,CAAA,KAAM;AAAA,MAClC,GAAA;AAAA,MACA,EAAE,IAAA,CAAK,UAAA,EAAY,CAAC,EAAE,OAAO,UAAA,EAAY,KAAA,EAAO,KAAA,EAAM,EAAG,GAAG,WAAA,CAAY,OAAO,CAAC,CAAA,CAAE,KAAA,CAAM,YAAY,KAAK;AAAA,KAC1G;AAAA,GACH;AAEA,EAAA,MAAM,KAAA,GAAQ,CAAA,CAAE,KAAA,CAAM,MAAM,EAAE,KAAA,CAAM,EAAE,CAAA,CAAE,OAAA,CAAQ,WAAW,EAAE,MAAA,EAAQ,QAAA,EAAU,IAAA,EAAM,SAAS,CAAA;AAC9F,EAAA,OAAO,CAAA,CAAE,MAAA,CAAO,EAAE,GAAG,MAAA,CAAO,OAAO,CAAC,WAAW,GAAG,KAAA,EAAO,CAAA;AAC3D","file":"chunk-LLGBNJAZ.js","sourcesContent":["import type { LabMode } from '@weasel-js/labkit';\nimport { type ConfigSchema, f } from '@weasel-js/labkit/config';\nimport type { Globals } from '../protocol/messages';\n\n/** One global the workshop's toolbar sets for every story, and a trial may pin for its own. */\nexport interface GlobalDeclaration {\n label: string;\n options: readonly { value: string; label: string }[];\n default: string;\n /** Another global's key: the toolbar shows this one in a popover beside that one rather than in the bar itself. */\n under?: string;\n /**\n * Whether the toolbar offers `value` given the lab's other values; every option shows when absent. `globals` is\n * resolved without any declaration's `shows`, so one `shows` cannot depend on another's outcome.\n */\n shows?: (value: string, globals: Globals) => boolean;\n /**\n * What this global reads from the lab's own chrome. Given, the lab's value may be `App` (`FOLLOW_APP`), offered\n * first, and while it is the global follows that chrome control, as the header's mode switch sets it. A trial's\n * pin follows the lab or names a value; it cannot follow the app on its own.\n */\n follows?: (chrome: LabChrome) => string;\n}\n\n/** The lab chrome's own settings a global can follow. */\nexport interface LabChrome {\n mode: LabMode;\n}\n\nexport type GlobalDeclarations = Readonly<Record<string, GlobalDeclaration>>;\n\n/** The config group every story schema gains, holding the trial's pins. A story never sees it. */\nexport const GLOBALS_KEY = '$globals';\n/** A pin's value when the trial follows the lab. */\nexport const FOLLOW_LAB = 'lab';\n/** A lab value, for a declaration that `follows` the app, meaning whatever the app's chrome is set to. */\nexport const FOLLOW_APP = 'app';\n\nconst APP_OPTION = { value: FOLLOW_APP, label: 'App' } as const;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport const isGlobalsPath = (path: string): boolean => path === GLOBALS_KEY || path.startsWith(`${GLOBALS_KEY}.`);\n\n/** The options the toolbar offers for `declaration` at `globals`. */\nexport function shownOptions(declaration: GlobalDeclaration, globals: Globals): GlobalDeclaration['options'] {\n const { shows } = declaration;\n return shows ? declaration.options.filter((option) => shows(option.value, globals)) : declaration.options;\n}\n\n/** The options the lab's own control offers: `shownOptions`, after `App` where the declaration follows the app. */\nexport function labOptions(declaration: GlobalDeclaration, globals: Globals): GlobalDeclaration['options'] {\n const shown = shownOptions(declaration, globals);\n return declaration.follows ? [APP_OPTION, ...shown] : shown;\n}\n\n/** `values` with each `App` replaced by what its declaration reads from `chrome`; `values` itself when none is. */\nexport function followApp(declarations: GlobalDeclarations, values: Globals, chrome: LabChrome): Globals {\n const followed = Object.entries(declarations).flatMap(([key, { follows }]) =>\n follows && values[key] === FOLLOW_APP ? [[key, follows(chrome)] as const] : [],\n );\n return followed.length === 0 ? values : { ...values, ...Object.fromEntries(followed) };\n}\n\n/**\n * The lab's values from what was stored: declared keys only. A value no option offers falls back to the default, and\n * one its declaration's `shows` hides falls back to the shown option nearest it in `options`, the earlier on a tie.\n */\nexport function labGlobals(declarations: GlobalDeclarations, stored: unknown): Globals {\n const from = isRecord(stored) ? stored : {};\n const offered: Globals = Object.fromEntries(\n Object.entries(declarations).map(([key, declaration]) => {\n const value = from[key];\n const known =\n declaration.options.some((option) => option.value === value) || (declaration.follows && value === FOLLOW_APP);\n return [key, known ? value : declaration.default];\n }),\n );\n return Object.fromEntries(\n Object.entries(declarations).map(([key, declaration]) => {\n const shown = shownOptions(declaration, offered);\n const value = offered[key];\n if (value === FOLLOW_APP && declaration.follows) return [key, value];\n if (!declaration.shows || shown.length === 0 || shown.some((option) => option.value === value)) return [key, value];\n const at = (v: unknown) => declaration.options.findIndex((option) => option.value === v);\n const from = at(value);\n const nearest = shown.reduce((best, option) =>\n Math.abs(at(option.value) - from) < Math.abs(at(best.value) - from) ? option : best,\n );\n return [key, nearest.value];\n }),\n );\n}\n\n/** The lab's values, overridden by the pins in a trial's config that do not follow the lab. */\nexport function effectiveGlobals(lab: Globals, pins: unknown): Globals {\n if (!isRecord(pins)) return lab;\n const pinned = Object.entries(pins).filter(([key, value]) => key in lab && value !== FOLLOW_LAB);\n return pinned.length === 0 ? lab : { ...lab, ...Object.fromEntries(pinned) };\n}\n\n/**\n * The config a story receives: the trial's, without its pins. Returns `previous` when every other entry is the same,\n * so a change to a pin alone is not a change to the story's config.\n */\nexport function storyConfig(config: unknown, previous?: unknown): unknown {\n if (!isRecord(config) || !(GLOBALS_KEY in config)) return config;\n const rest = Object.fromEntries(Object.entries(config).filter(([key]) => key !== GLOBALS_KEY));\n if (isRecord(previous)) {\n const keys = Object.keys(rest);\n if (keys.length === Object.keys(previous).length && keys.every((key) => rest[key] === previous[key])) return previous;\n }\n return rest;\n}\n\n/** `schema` with a `$globals` group appended: one leaf per declaration, following the lab until pinned. */\nexport function withGlobals(schema: ConfigSchema<unknown>, declarations: GlobalDeclarations): ConfigSchema<unknown> {\n const entries = Object.entries(declarations);\n if (entries.length === 0) return schema;\n const leaves = Object.fromEntries(\n entries.map(([key, declaration]) => [\n key,\n f.enum(FOLLOW_LAB, [{ value: FOLLOW_LAB, label: 'Lab' }, ...declaration.options]).label(declaration.label),\n ]),\n );\n // An empty group name contributes rows without a heading of its own, under the section's.\n const group = f.group(leaves).label('').section('Globals', { layout: 'inline', pack: 'pairs' });\n return f.schema({ ...schema.nodes, [GLOBALS_KEY]: group }) as ConfigSchema<unknown>;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/story/tags.ts
|
|
2
|
+
var GALLERY_TAG = "gallery";
|
|
3
|
+
function isGallery(entry) {
|
|
4
|
+
return entry.tags?.includes(GALLERY_TAG) ?? false;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { GALLERY_TAG, isGallery };
|
|
8
|
+
//# sourceMappingURL=chunk-WEQSLPKT.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-WEQSLPKT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/tags.ts"],"names":[],"mappings":";AACO,IAAM,WAAA,GAAc;AAEpB,SAAS,UAAU,KAAA,EAA8C;AACtE,EAAA,OAAO,KAAA,CAAM,IAAA,EAAM,QAAA,CAAS,WAAW,CAAA,IAAK,KAAA;AAC9C","file":"chunk-WEQSLPKT.js","sourcesContent":["/** The meta tag marking a story file as a gallery: a catalog of many components, or of every permutation of one. */\nexport const GALLERY_TAG = 'gallery';\n\nexport function isGallery(entry: { tags?: readonly string[] }): boolean {\n return entry.tags?.includes(GALLERY_TAG) ?? false;\n}\n"]}
|
|
@@ -20,6 +20,13 @@ var appliedLocal = (local, config) => Object.fromEntries(
|
|
|
20
20
|
);
|
|
21
21
|
var ArgsContext = createContext(null);
|
|
22
22
|
|
|
23
|
+
// src/csf/isPlainObject.ts
|
|
24
|
+
var isPlainObject = (value) => {
|
|
25
|
+
if (typeof value !== "object" || value === null) return false;
|
|
26
|
+
const proto = Object.getPrototypeOf(value);
|
|
27
|
+
return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null;
|
|
28
|
+
};
|
|
29
|
+
|
|
23
30
|
// src/csf/portSafe.ts
|
|
24
31
|
var g = globalThis;
|
|
25
32
|
var CLONED_WHOLE = new Set(
|
|
@@ -66,12 +73,7 @@ function isPortSafe(value) {
|
|
|
66
73
|
return false;
|
|
67
74
|
}
|
|
68
75
|
}
|
|
69
|
-
var
|
|
70
|
-
if (!v || typeof v !== "object") return false;
|
|
71
|
-
const proto = Object.getPrototypeOf(v);
|
|
72
|
-
return proto === Object.prototype || proto === null;
|
|
73
|
-
};
|
|
74
|
-
var splittable = (v) => (Array.isArray(v) ? Object.getPrototypeOf(v) === Array.prototype : isPlainOrNull(v) && !("$$typeof" in v)) && hasOnlyClonedKeys(v);
|
|
76
|
+
var splittable = (v) => (Array.isArray(v) ? Object.getPrototypeOf(v) === Array.prototype : isPlainObject(v) && !("$$typeof" in v)) && hasOnlyClonedKeys(v);
|
|
75
77
|
function portSafePart(value) {
|
|
76
78
|
const walking = /* @__PURE__ */ new Set();
|
|
77
79
|
const part = (v) => {
|
|
@@ -101,7 +103,7 @@ function withUnsent(sent, original) {
|
|
|
101
103
|
if (sent === null && portSafePart(original) === null) return original;
|
|
102
104
|
if (Array.isArray(original) && Array.isArray(sent))
|
|
103
105
|
return sent.map((member, i) => i < original.length ? withUnsent(member, original[i]) : member);
|
|
104
|
-
if (!splittable(original) || Array.isArray(original) || !
|
|
106
|
+
if (!splittable(original) || Array.isArray(original) || !isPlainObject(sent)) return sent;
|
|
105
107
|
const out = {};
|
|
106
108
|
for (const [key, member] of Object.entries(original)) {
|
|
107
109
|
if (key in sent) out[key] = withUnsent(sent[key], member);
|
|
@@ -111,6 +113,6 @@ function withUnsent(sent, original) {
|
|
|
111
113
|
return out;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
export { ArgsContext, FRAME_HELLO, PORT_HANDOFF, PROTOCOL_VERSION, appliedLocal, coverOf, isPortSafe, portSafePart, stableStringify, withUnsent };
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
116
|
-
//# sourceMappingURL=chunk-
|
|
116
|
+
export { ArgsContext, FRAME_HELLO, PORT_HANDOFF, PROTOCOL_VERSION, appliedLocal, coverOf, isPlainObject, isPortSafe, portSafePart, stableStringify, withUnsent };
|
|
117
|
+
//# sourceMappingURL=chunk-YKN3IAEX.js.map
|
|
118
|
+
//# sourceMappingURL=chunk-YKN3IAEX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/protocol/messages.ts","../src/csf/argsContext.ts","../src/csf/isPlainObject.ts","../src/csf/portSafe.ts"],"names":[],"mappings":";;;;;AAEO,IAAM,gBAAA,GAAmB;AA8FzB,IAAM,YAAA,GAAe;AASrB,IAAM,WAAA,GAAc;AAGpB,SAAS,gBAAgB,KAAA,EAAwB;AACtD,EAAA,OAAO,IAAA,CAAK,SAAA;AAAA,IAAU,KAAA;AAAA,IAAO,CAAC,IAAA,EAAM,CAAA,KAClC,CAAA,IAAK,OAAO,CAAA,KAAM,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,GAC1C,OAAO,WAAA,CAAY,MAAA,CAAO,OAAA,CAAQ,CAAC,CAAA,CAAE,IAAA,CAAK,CAAC,CAAC,CAAC,CAAA,EAAG,CAAC,CAAC,CAAA,KAAO,CAAA,GAAI,CAAA,GAAI,EAAA,GAAK,CAAE,CAAC,CAAA,GACzE;AAAA,GACN;AACF;;;ACpGO,IAAM,OAAA,GAAU,CAAC,KAAA,KAA2B,eAAA,CAAgB,KAAK,CAAA,IAAK;AAGtE,IAAM,YAAA,GAAe,CAAC,KAAA,EAAkB,MA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AW,CAAC,GAAA,EAAK,MAAM,CAAA,IAAK,OAAO,OAAA,CAAQ,IAAI,CAAA,EAAG,IAAI,EAAE,GAAA,IAAO,QAAA,CAAA,EAAW,GAAA,CAAI,GAAG,CAAA,GAAI,MAAA;AACrF,EAAA,OAAO,GAAA;AACT","file":"chunk-YKN3IAEX.js","sourcesContent":["import type { SchemaDescription } from './schema.ts';\n\nexport const PROTOCOL_VERSION = 1;\n\nexport type Globals = Readonly<Record<string, unknown>>;\nexport type Layout = 'centered' | 'padded' | 'fullscreen';\nexport interface Viewport {\n width: number;\n height: number;\n}\nexport type FaultPhase = 'import' | 'render' | 'play' | 'protocol';\n\n/** One custom property as the frame found it. */\nexport interface CssVarReport {\n name: string;\n value: string;\n /** Whether a `vars.set` override is in force on it. */\n overridden: boolean;\n}\n\n/** Visibility and validation answers, keyed by the config they were computed for. */\nexport interface ConfigAnswers {\n /** `stableStringify(config)` of the config the frame evaluated. */\n configKey: string;\n hidden: string[];\n errors: Record<string, string[]>;\n}\n\n/** One element axe faulted on, inside the frame's own document. */\nexport interface A11yNode {\n /** The CSS selectors, outermost first, that reach the element in the frame. */\n target: readonly string[];\n html: string;\n failureSummary?: string;\n}\n\n/** One axe rule's outcome on the story, with the elements it names. */\nexport interface A11yFinding {\n id: string;\n impact: 'minor' | 'moderate' | 'serious' | 'critical' | null;\n help: string;\n helpUrl: string;\n description: string;\n nodes: readonly A11yNode[];\n}\n\n/** What axe found on one story: the rules it failed, and the ones it could not decide. */\nexport interface A11yReport {\n violations: readonly A11yFinding[];\n incomplete: readonly A11yFinding[];\n /** Rules that passed, and rules no element on the page could be judged by. */\n passes: number;\n inapplicable: number;\n}\n\n/** A picture of the story the frame can put in a message: labkit's `CaptureSource` without the canvas,\n * which no structured clone carries. */\nexport type CapturedPicture = { kind: 'svg'; markup: string } | { kind: 'image'; src: string };\n\nexport type ToFrame =\n | { type: 'init'; config: unknown; state: unknown; globals: Globals }\n | { type: 'config'; config: unknown }\n | { type: 'state'; state: unknown }\n | { type: 'globals'; globals: Globals }\n | { type: 'vars.set'; name: string; value: string | null }\n | { type: 'play' }\n /** Run axe over the story's own subtree. Answered by `a11y` carrying the same `id`. */\n | { type: 'a11y.run'; id: string }\n /** Serialize the story's own subtree as a picture. Answered by `capture` carrying the same `id`. */\n | { type: 'capture.run'; id: string };\n\nexport type FromFrame =\n | { type: 'ready'; schema: SchemaDescription; layout: Layout; viewport: Viewport | null }\n /** Sent once, when the story's first render after `init` has committed. */\n | { type: 'rendered' }\n | { type: 'answers'; answers: ConfigAnswers }\n | { type: 'setConfig'; path: string; value: unknown }\n | { type: 'setState'; state: unknown }\n | { type: 'size'; width: number; height: number }\n | { type: 'vars'; vars: CssVarReport[] }\n /** Asks the shell to show story `id` in this frame's trial in place of what it shows now. */\n | { type: 'open'; id: string }\n | { type: 'played'; ok: boolean; message?: string }\n | { type: 'a11y'; id: string; ok: true; report: A11yReport }\n | { type: 'a11y'; id: string; ok: false; message: string }\n | { type: 'capture'; id: string; ok: true; picture: CapturedPicture }\n | { type: 'capture'; id: string; ok: false; message: string }\n /** `seq`, on a render fault only: how many `init`/`config`/`state`/`globals` messages the frame had received. */\n | { type: 'fault'; phase: FaultPhase; message: string; stack?: string; seq?: number };\n\nexport interface Envelope<M> {\n v: number;\n msg: M;\n}\n\n/** Posted on the frame's window with the port transferred alongside it, as a `PortHandoff`. */\nexport const PORT_HANDOFF = 'weaselforge:port';\n\n/** What the shell posts with the port: `id` names what the frame shows, a story or an index. */\nexport interface PortHandoff {\n type: typeof PORT_HANDOFF;\n id: string;\n}\n\n/** Posted by a frame document to its parent as soon as its entry runs, asking for a port. */\nexport const FRAME_HELLO = 'weaselforge:hello';\n\n/** JSON with object keys sorted, so two equal configs produce one key. */\nexport function stableStringify(value: unknown): string {\n return JSON.stringify(value, (_key, v) =>\n v && typeof v === 'object' && !Array.isArray(v)\n ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => (a < b ? -1 : 1)))\n : v,\n );\n}\n","import { type Context, createContext, type Dispatch, type SetStateAction } from 'react';\nimport { stableStringify } from '../protocol/messages';\n\ntype Args = Record<string, unknown>;\n\n/** A frame-local arg, and the config value it was set over: it applies only while config still holds that. */\nexport interface LocalArg {\n value: unknown;\n over: string;\n}\n\nexport type LocalArgs = Record<string, LocalArg>;\n\n/** A config value in the form `LocalArg.over` records. */\nexport const coverOf = (value: unknown): string => stableStringify(value) ?? ' undefined';\n\n/** The frame-local values that still apply over `config`. */\nexport const appliedLocal = (local: LocalArgs, config: Args): Args =>\n Object.fromEntries(\n Object.entries(local)\n .filter(([key, entry]) => coverOf(config[key]) === entry.over)\n .map(([key, entry]) => [key, entry.value]),\n );\n\nexport interface ArgsScope {\n /** The args the story renders with: its own, then config, then the frame-local ones that still apply. */\n args: Args;\n /** The trial's config as it stands. An `undefined` key means the story's own arg. */\n config: Args;\n defaults: Args;\n /** The story's own args, before config and the frame-local ones. */\n original: Args;\n setConfig: (path: string, value: unknown) => void;\n /** Args a MessagePort would not deliver intact, kept in the frame because config crosses one. */\n setLocal: Dispatch<SetStateAction<LocalArgs>>;\n}\n\nexport const ArgsContext: Context<ArgsScope | null> = createContext<ArgsScope | null>(null);\n","/** Whether `value` is a plain object — a literal or `Object.create(null)` — from any\n * realm. A story's args can come from another frame, so this realm's\n * `Object.prototype` is not the only one a plain object can have. */\nexport const isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== 'object' || value === null) return false;\n const proto = Object.getPrototypeOf(value) as object | null;\n return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null;\n};\n","import { isPlainObject } from './isPlainObject';\n\nconst g = globalThis as Record<string, unknown>;\nconst CLONED_WHOLE = new Set<unknown>(\n [\n 'Date',\n 'RegExp',\n 'ArrayBuffer',\n 'DataView',\n 'Int8Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Int16Array',\n 'Uint16Array',\n 'Int32Array',\n 'Uint32Array',\n 'Float16Array',\n 'Float32Array',\n 'Float64Array',\n 'BigInt64Array',\n 'BigUint64Array',\n ]\n .map((name) => (g[name] as { prototype?: object } | undefined)?.prototype)\n .filter(Boolean),\n);\n\n/** Own keys a clone keeps: enumerable string keys, plus an array's `length`. */\nconst hasOnlyClonedKeys = (v: object): boolean =>\n Reflect.ownKeys(v).every(\n (key) =>\n typeof key === 'string' &&\n (Object.prototype.propertyIsEnumerable.call(v, key) || (Array.isArray(v) && key === 'length')),\n );\n\n/**\n * Whether a MessagePort delivers `value` as the same thing it was. `structuredClone` succeeding is\n * not enough: it copies a class instance's fields onto a plain object and drops its methods.\n */\nexport function isPortSafe(value: unknown): boolean {\n const seen = new Set<object>();\n const safe = (v: unknown): boolean => {\n if (v === null) return true;\n if (typeof v !== 'object') return typeof v !== 'function' && typeof v !== 'symbol';\n if (seen.has(v)) return true;\n seen.add(v);\n const proto = Object.getPrototypeOf(v);\n if (CLONED_WHOLE.has(proto)) return true;\n if (proto === Map.prototype)\n return hasOnlyClonedKeys(v) && [...(v as Map<unknown, unknown>)].every(([key, member]) => safe(key) && safe(member));\n if (proto === Set.prototype) return hasOnlyClonedKeys(v) && [...(v as Set<unknown>)].every(safe);\n if (proto !== Array.prototype && proto !== Object.prototype && proto !== null) return false;\n return hasOnlyClonedKeys(v) && Object.values(v).every(safe);\n };\n try {\n return safe(value);\n } catch {\n return false;\n }\n}\n\n/** A plain object or array whose members can be split: React elements are plain objects, but whole. */\nconst splittable = (v: unknown): v is Record<string, unknown> | unknown[] =>\n (Array.isArray(v) ? Object.getPrototypeOf(v) === Array.prototype : isPlainObject(v) && !('$$typeof' in v)) &&\n hasOnlyClonedKeys(v as object);\n\n/**\n * The part of `value` a port delivers intact, or null when none of it can cross. A plain object\n * keeps its port-safe fields; an array holds null where a member has no part.\n */\nexport function portSafePart(value: unknown): { value: unknown } | null {\n const walking = new Set<object>();\n const part = (v: unknown): { value: unknown } | null => {\n if (isPortSafe(v)) return { value: v };\n if (!splittable(v) || walking.has(v)) return null;\n walking.add(v);\n try {\n if (Array.isArray(v)) return { value: v.map((member) => part(member)?.value ?? null) };\n const out: Record<string, unknown> = {};\n for (const [key, member] of Object.entries(v)) {\n const kept = part(member);\n if (kept) out[key] = kept.value;\n }\n return { value: out };\n } finally {\n walking.delete(v);\n }\n };\n try {\n return part(value);\n } catch {\n return null;\n }\n}\n\n/** `sent`, a value that crossed the port as `portSafePart(original)` or an edit of it, with what the part left behind put back. */\nexport function withUnsent(sent: unknown, original: unknown): unknown {\n if (isPortSafe(original)) return sent;\n if (sent === null && portSafePart(original) === null) return original;\n if (Array.isArray(original) && Array.isArray(sent))\n return sent.map((member, i) => (i < original.length ? withUnsent(member, original[i]) : member));\n if (!splittable(original) || Array.isArray(original) || !isPlainObject(sent)) return sent;\n const out: Record<string, unknown> = {};\n for (const [key, member] of Object.entries(original)) {\n if (key in sent) out[key] = withUnsent(sent[key], member);\n else if (portSafePart(member) === null) out[key] = member;\n }\n for (const [key, member] of Object.entries(sent)) if (!(key in original)) out[key] = member;\n return out;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LabContribution, LabPage } from '@weasel-js/labkit';
|
|
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-
|
|
4
|
+
import { G as Globals, F as FrameSetup } from './FrameController-HEcTM04H.js';
|
|
5
5
|
|
|
6
6
|
/** One global the workshop's toolbar sets for every story, and a trial may pin for its own. */
|
|
7
7
|
interface GlobalDeclaration {
|
|
@@ -18,8 +18,20 @@ interface GlobalDeclaration {
|
|
|
18
18
|
* resolved without any declaration's `shows`, so one `shows` cannot depend on another's outcome.
|
|
19
19
|
*/
|
|
20
20
|
shows?: (value: string, globals: Globals) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* What this global reads from the lab's own chrome. Given, the lab's value may be `App` (`FOLLOW_APP`), offered
|
|
23
|
+
* first, and while it is the global follows that chrome control, as the header's mode switch sets it. A trial's
|
|
24
|
+
* pin follows the lab or names a value; it cannot follow the app on its own.
|
|
25
|
+
*/
|
|
26
|
+
follows?: (chrome: LabChrome) => string;
|
|
27
|
+
}
|
|
28
|
+
/** The lab chrome's own settings a global can follow. */
|
|
29
|
+
interface LabChrome {
|
|
30
|
+
mode: LabMode;
|
|
21
31
|
}
|
|
22
32
|
type GlobalDeclarations = Readonly<Record<string, GlobalDeclaration>>;
|
|
33
|
+
/** A lab value, for a declaration that `follows` the app, meaning whatever the app's chrome is set to. */
|
|
34
|
+
declare const FOLLOW_APP = "app";
|
|
23
35
|
|
|
24
36
|
/** A shell config module: what the workshop adds to the lab. Only the workshop page imports it. */
|
|
25
37
|
interface ShellConfig {
|
|
@@ -40,4 +52,4 @@ declare function defineFrameConfig(config: FrameSetup): FrameSetup;
|
|
|
40
52
|
/** A shell config module's default export. */
|
|
41
53
|
declare function defineShellConfig(config: ShellConfig): ShellConfig;
|
|
42
54
|
|
|
43
|
-
export { type GlobalDeclaration as G, type ShellConfig as S, type GlobalDeclarations as a, defineShellConfig as b, defineFrameConfig as d };
|
|
55
|
+
export { FOLLOW_APP as F, type GlobalDeclaration as G, type LabChrome as L, type ShellConfig as S, type GlobalDeclarations as a, defineShellConfig as b, defineFrameConfig as d };
|
package/dist/csf/preview-api.js
CHANGED
package/dist/frame/index.css
CHANGED
|
@@ -38,8 +38,8 @@ body {
|
|
|
38
38
|
box-sizing: border-box;
|
|
39
39
|
max-width: 1200px;
|
|
40
40
|
margin: 0 auto;
|
|
41
|
-
padding:
|
|
42
|
-
font-family: var(--wzl-font-
|
|
41
|
+
padding: var(--wzl-space-lg);
|
|
42
|
+
font-family: var(--wzl-font-ui);
|
|
43
43
|
font-size: var(--wzl-font-size);
|
|
44
44
|
color: var(--wzl-fg);
|
|
45
45
|
}
|
|
@@ -48,8 +48,7 @@ body {
|
|
|
48
48
|
}
|
|
49
49
|
.fg-index__path {
|
|
50
50
|
margin: 0 0 var(--wzl-space-2);
|
|
51
|
-
font-
|
|
52
|
-
font-size: var(--wzl-font-size-sm);
|
|
51
|
+
font-size: var(--wzl-font-size-lg);
|
|
53
52
|
color: var(--wzl-fg-muted);
|
|
54
53
|
}
|
|
55
54
|
.fg-index__title {
|
|
@@ -64,6 +63,7 @@ body {
|
|
|
64
63
|
.fg-index-story__description {
|
|
65
64
|
max-width: 72ch;
|
|
66
65
|
margin: var(--wzl-space-4) 0 0;
|
|
66
|
+
font-family: var(--wzl-font-body);
|
|
67
67
|
line-height: 1.5;
|
|
68
68
|
color: var(--wzl-fg-muted);
|
|
69
69
|
}
|
|
@@ -88,13 +88,15 @@ body {
|
|
|
88
88
|
}
|
|
89
89
|
.fg-index-cell {
|
|
90
90
|
margin: var(--wzl-space-8) 0 0;
|
|
91
|
+
width: fit-content;
|
|
92
|
+
max-width: 100%;
|
|
91
93
|
}
|
|
92
94
|
.fg-index-cell__stage {
|
|
93
95
|
display: flex;
|
|
94
96
|
align-items: center;
|
|
95
97
|
justify-content: center;
|
|
96
98
|
min-height: 96px;
|
|
97
|
-
padding: var(--wzl-space-
|
|
99
|
+
padding: var(--wzl-space-2);
|
|
98
100
|
border: var(--wzl-border-w) solid var(--wzl-border);
|
|
99
101
|
border-radius: var(--wzl-radius-md);
|
|
100
102
|
background: var(--wzl-surface);
|
|
@@ -103,6 +105,9 @@ body {
|
|
|
103
105
|
.fg-index-cell--padded > .fg-index-cell__stage {
|
|
104
106
|
display: block;
|
|
105
107
|
}
|
|
108
|
+
.fg-index-cell--fullscreen {
|
|
109
|
+
width: auto;
|
|
110
|
+
}
|
|
106
111
|
.fg-index-cell--fullscreen > .fg-index-cell__stage {
|
|
107
112
|
display: block;
|
|
108
113
|
height: 360px;
|
|
@@ -127,11 +132,62 @@ body {
|
|
|
127
132
|
color: var(--wzl-fg-muted);
|
|
128
133
|
}
|
|
129
134
|
.fg-index-variants__cells {
|
|
130
|
-
display:
|
|
131
|
-
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-wrap: wrap;
|
|
137
|
+
align-items: flex-start;
|
|
132
138
|
gap: var(--wzl-space-6);
|
|
133
139
|
}
|
|
134
140
|
.fg-index-variants__cells > .fg-index-cell {
|
|
135
141
|
margin-top: var(--wzl-space-4);
|
|
136
142
|
}
|
|
143
|
+
.fg-index__library {
|
|
144
|
+
margin-inline-end: var(--wzl-space-4);
|
|
145
|
+
vertical-align: middle;
|
|
146
|
+
}
|
|
147
|
+
.fg-index__title-row {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: var(--wzl-space-6);
|
|
151
|
+
}
|
|
152
|
+
.fg-index-deps {
|
|
153
|
+
display: grid;
|
|
154
|
+
grid-template-columns: max-content 1fr;
|
|
155
|
+
gap: var(--wzl-space-3) var(--wzl-space-8);
|
|
156
|
+
margin: var(--wzl-space-8) 0 0;
|
|
157
|
+
font-size: var(--wzl-font-size-sm);
|
|
158
|
+
}
|
|
159
|
+
.fg-index-deps__row {
|
|
160
|
+
display: contents;
|
|
161
|
+
}
|
|
162
|
+
.fg-index-deps__label {
|
|
163
|
+
color: var(--wzl-fg-muted);
|
|
164
|
+
}
|
|
165
|
+
.fg-index-deps__value {
|
|
166
|
+
margin: 0;
|
|
167
|
+
}
|
|
168
|
+
.fg-index-deps__list {
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-wrap: wrap;
|
|
171
|
+
gap: var(--wzl-space-2) var(--wzl-space-6);
|
|
172
|
+
margin: 0;
|
|
173
|
+
padding: 0;
|
|
174
|
+
list-style: none;
|
|
175
|
+
}
|
|
176
|
+
.fg-index-deps__link {
|
|
177
|
+
color: var(--wzl-accent-fg);
|
|
178
|
+
text-decoration: none;
|
|
179
|
+
}
|
|
180
|
+
.fg-index-deps__link:hover {
|
|
181
|
+
text-decoration: underline;
|
|
182
|
+
}
|
|
183
|
+
.fg-index-deps__prefix,
|
|
184
|
+
.fg-index-deps__empty,
|
|
185
|
+
.fg-index-deps__none {
|
|
186
|
+
color: var(--wzl-fg-muted);
|
|
187
|
+
}
|
|
188
|
+
.fg-index-deps__none {
|
|
189
|
+
max-width: 72ch;
|
|
190
|
+
margin: var(--wzl-space-8) 0 0;
|
|
191
|
+
font-size: var(--wzl-font-size-sm);
|
|
192
|
+
}
|
|
137
193
|
/*# sourceMappingURL=index.css.map */
|
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: 16px;\n}\n\n.fg-frame--fullscreen {\n padding: 0;\n}\n\n.fg-frame__fault {\n margin: 0;\n padding: 16px;\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:
|
|
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: 16px;\n}\n\n.fg-frame--fullscreen {\n padding: 0;\n}\n\n.fg-frame__fault {\n margin: 0;\n padding: 16px;\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 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.fg-index-cell--padded > .fg-index-cell__stage {\n display: block;\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-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-8) 0 0;\n font-size: var(--wzl-font-size-sm);\n}\n"],"mappings":";AAAA;AACA;AACE,UAAQ;AACV;AAEA,CAAC;AACC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EA,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-HEcTM04H.js';
|
|
2
|
+
export { m as StartFrameOptions, r as reportImportFault, s as startFrame } from '../FrameController-HEcTM04H.js';
|
|
3
3
|
import '@weasel-js/labkit/config';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
@@ -16,6 +16,8 @@ interface FrameIndexEntry {
|
|
|
16
16
|
description?: string;
|
|
17
17
|
/** The JSDoc above the file's meta, which heads the index page. */
|
|
18
18
|
componentDescription?: string;
|
|
19
|
+
/** The meta's `tags`. */
|
|
20
|
+
tags?: readonly string[];
|
|
19
21
|
}
|
|
20
22
|
interface MountFrameOptions {
|
|
21
23
|
index: readonly FrameIndexEntry[];
|
package/dist/frame/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { describeSchema, openChannel, isIndexId, indexId, answerSchema, IndexPage } from '../chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { describeSchema, openChannel, isIndexId, libraryOf, indexId, answerSchema, IndexPage } from '../chunk-DDDCZ6XW.js';
|
|
2
|
+
import { isGallery } from '../chunk-WEQSLPKT.js';
|
|
3
|
+
import { createOverrides, createGlobalsTarget, loadStories, indexRenderOf, scanCssVars, runAxe, captureElement, StoryHost, resolveCssVar } from '../chunk-ERRLEH6S.js';
|
|
3
4
|
import '../chunk-2GXKNXTJ.js';
|
|
4
5
|
import '../chunk-HRGPFQBW.js';
|
|
5
|
-
import { FRAME_HELLO, stableStringify, PORT_HANDOFF } from '../chunk-
|
|
6
|
+
import { FRAME_HELLO, stableStringify, PORT_HANDOFF } from '../chunk-YKN3IAEX.js';
|
|
6
7
|
import { flushSync } from 'react-dom';
|
|
7
8
|
import { createRoot } from 'react-dom/client';
|
|
8
9
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -229,9 +230,12 @@ function startIndex(options) {
|
|
|
229
230
|
if (!globals) return;
|
|
230
231
|
const env = {
|
|
231
232
|
title: options.title,
|
|
233
|
+
...options.library === void 0 ? {} : { library: options.library },
|
|
232
234
|
...options.description === void 0 ? {} : { description: options.description },
|
|
233
235
|
stories: options.stories,
|
|
234
236
|
descriptions: options.descriptions,
|
|
237
|
+
gallery: options.gallery ?? false,
|
|
238
|
+
galleries: options.galleries ?? [],
|
|
235
239
|
globals,
|
|
236
240
|
decorators: setup.decorators ?? [],
|
|
237
241
|
open: (id) => send({ type: "open", id }),
|
|
@@ -341,6 +345,9 @@ async function mountFrame(options) {
|
|
|
341
345
|
startIndex({
|
|
342
346
|
title,
|
|
343
347
|
...entries[0]?.componentDescription === void 0 ? {} : { description: entries[0].componentDescription },
|
|
348
|
+
library: libraryOf({ file: entries[0]?.file ?? "", title }),
|
|
349
|
+
gallery: entries.every(isGallery),
|
|
350
|
+
galleries: entries.filter(isGallery).map((e) => e.id),
|
|
344
351
|
stories: stories2,
|
|
345
352
|
descriptions: Object.fromEntries(entries.flatMap((e) => e.description ? [[e.id, e.description]] : [])),
|
|
346
353
|
render: mods.map(indexRenderOf).find((render) => render !== null) ?? null,
|