@vscode/component-explorer 0.2.1-83 → 0.2.1-85

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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as e } from "./runtimeVersion-CYbVWGhh.js";
2
- import { d as n, a as s, b as t, c as u, f, e as d, i as o, r as x, s as l } from "./runtimeVersion-CYbVWGhh.js";
1
+ import { _ as e } from "./runtimeVersion-ByhWJutT.js";
2
+ import { d as n, a as s, b as t, c as u, f, e as d, i as o, r as x, s as l } from "./runtimeVersion-ByhWJutT.js";
3
3
  globalThis._buildInfo = e;
4
4
  export {
5
5
  n as defineDebugPanel,
@@ -2,7 +2,7 @@ var x = Object.defineProperty;
2
2
  var v = (r, e, t) => e in r ? x(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var o = (r, e, t) => v(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { z as S } from "zod";
5
- const R = { version: "0.3.0", date: "2026-07-28T20:39:21.859Z" }, d = Symbol.for("@vscode/component-explorer/interactiveOutput/v1"), g = Symbol.for("@vscode/component-explorer/singleFixture/v1"), l = Symbol.for("@vscode/component-explorer/fixtureGroup/v1"), h = Symbol.for("@vscode/component-explorer/fixtureVariants/v1");
5
+ const R = { version: "0.3.0", date: "2026-07-28T23:39:27.365Z" }, d = Symbol.for("@vscode/component-explorer/interactiveOutput/v1"), g = Symbol.for("@vscode/component-explorer/singleFixture/v1"), l = Symbol.for("@vscode/component-explorer/fixtureGroup/v1"), h = Symbol.for("@vscode/component-explorer/fixtureVariants/v1");
6
6
  function f(r) {
7
7
  if (r)
8
8
  return S.toJSONSchema(r, { unrepresentable: "any" });
@@ -233,4 +233,4 @@ export {
233
233
  J as r,
234
234
  g as s
235
235
  };
236
- //# sourceMappingURL=runtimeVersion-CYbVWGhh.js.map
236
+ //# sourceMappingURL=runtimeVersion-ByhWJutT.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeVersion-CYbVWGhh.js","sources":["../src/core/fixtureApi.ts","../../semver/dist/index.js","../src/runtimeVersion.ts"],"sourcesContent":["/**\n * Public Fixture API\n * \n * This module is the public API for defining fixtures.\n * It's designed to be stable across versions - projects can use a different\n * @vscode/component-explorer version than the explorer viewer uses.\n * \n * Use Symbol.for() instead of Symbol() so the same symbol is shared across\n * different versions of this package.\n *\n * @module fixtureApi\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Types for fixture definition (re-exported for convenience)\n// ============================================================================\n\n/**\n * Disposable resource that can be cleaned up.\n * `dispose` may be sync or async; the framework awaits the returned promise (if any)\n * and captures any thrown errors.\n */\nexport interface IDisposable {\n dispose(): void | Promise<void>;\n}\n\nexport type DebugPanelPlacement = 'canvas-right' | 'bottom-panel';\n\nexport interface DebugPanelViewContext<TAction> {\n sendAction(action: TAction): void;\n}\n\nexport interface DebugPanelViewInstance<TState> extends IDisposable {\n update(state: TState): void;\n}\n\nexport interface DefineDebugPanelOptions<TState, TAction> {\n readonly id: string;\n readonly title: string;\n readonly placement?: DebugPanelPlacement;\n render(\n container: HTMLElement,\n context: DebugPanelViewContext<TAction>,\n ): DebugPanelViewInstance<TState>;\n}\n\ninterface ErasedDebugPanelViewInstance extends IDisposable {\n update(state: unknown): void;\n}\n\n/**\n * A statically declared custom panel. `TState` is published by the fixture and\n * `TAction` is sent back by the panel UI.\n */\nexport interface DebugPanelDefinition<TState = unknown, TAction = unknown> {\n readonly id: string;\n readonly title: string;\n readonly placement?: DebugPanelPlacement;\n /** @internal Viewer-side, type-erased renderer produced by defineDebugPanel. */\n readonly _render: (\n container: HTMLElement,\n sendAction: (action: unknown) => void,\n ) => ErasedDebugPanelViewInstance;\n /** @internal Carries types for inference without affecting the runtime shape. */\n readonly _types?: { readonly state: TState; readonly action: TAction };\n}\n\nexport interface DebugPanelChannel<TState, TAction> {\n publish(state: TState): void;\n onAction(listener: (action: TAction) => void): IDisposable;\n}\n\nexport type DebugPanelActivation<TState, TAction> = (\n channel: DebugPanelChannel<TState, TAction>,\n) => void | IDisposable;\n\nexport interface FixtureDebugApi {\n connect<TState, TAction>(\n panel: DebugPanelDefinition<TState, TAction>,\n activate: DebugPanelActivation<TState, TAction>,\n ): IDisposable;\n}\n\nexport interface FixtureInputControlOptions {\n readonly placement?: 'sidebar' | 'toolbar' | 'both';\n readonly label?: string;\n readonly title?: string;\n}\n\n/** Brand for an output that can be observed and edited while its Output panel is visible. */\nexport const interactiveOutputBrand = Symbol.for('@vscode/component-explorer/interactiveOutput/v1');\n\nexport interface InteractiveOutput<T> {\n readonly [interactiveOutputBrand]: true;\n getSnapshot(): T;\n activate(channel: DebugPanelChannel<T, T>): void | IDisposable;\n}\n\n/**\n * Result of a render operation.\n * Supports both sync and async rendering with cancellation.\n * All fields are optional for simple use cases.\n */\nexport interface RenderResult {\n /**\n * Resolves when the component is fully rendered and ready.\n * For sync renders, this can be omitted (treated as immediately ready).\n * Rejects if the render is aborted via the AbortSignal.\n */\n readonly ready?: Promise<void>;\n\n /**\n * Cleanup function. Called when the fixture is unmounted.\n * May be sync or async; the framework awaits the returned promise (if any).\n * Errors thrown (sync or async) are captured and surfaced via the\n * `previousDispose` field of the next render report (or `currentDispose`\n * if `disposeAfter` was requested).\n * Can be omitted if no cleanup is needed.\n */\n dispose?(): void | Promise<void>;\n\n /**\n * Arbitrary data to include in the render report.\n * Visible to the CLI and MCP tools (surfaced as `output`).\n *\n * Symmetric counterpart of `RenderContext.input`: input flows in, output flows out.\n */\n readonly output?: unknown;\n}\n\n/**\n * What the render function can return.\n * - undefined: no cleanup needed, immediately ready\n * - RenderResult: object with optional ready/dispose\n * - Promise<...>: async render that resolves to undefined or RenderResult\n */\nexport type RenderReturn = RenderResult | undefined | void | Promise<RenderResult | undefined | void>;\n\n/**\n * Context passed to the render function.\n *\n * @typeParam TInput - Shape of `input`, inferred from the fixture's zod `inputSchema`\n * (defaults to `unknown` when no schema is declared).\n */\nexport interface RenderContext<TInput = unknown> {\n /**\n * Unique identifier of the fixture being rendered.\n * Stable across renders of the same fixture; useful for keying caches,\n * logging, or distinguishing between sibling fixtures sharing a render function.\n */\n readonly fixtureId: string;\n\n /** AbortSignal for cancellation; check signal.aborted or listen to 'abort' event */\n readonly signal: AbortSignal;\n\n /** Register a disposable to be cleaned up when the fixture is unmounted. Returns the same disposable for chaining. */\n addDisposable<T extends IDisposable>(disposable: T): T;\n\n /**\n * Observes one input property without remounting the fixture. The listener is\n * invoked immediately and again for subsequent changes to this property.\n * Input properties without a watcher retain the default remount behavior.\n */\n watchInput<TKey extends Extract<keyof TInput, string>>(\n key: TKey,\n listener: (value: TInput[TKey], input: TInput) => void,\n ): IDisposable;\n\n /** Connects statically declared debug panels to this live fixture instance. */\n readonly debug: FixtureDebugApi;\n\n /**\n * Describes where this fixture is being rendered. Use this to enable dev-only affordances\n * (e.g. extra controls, logging) without affecting screenshots or embedded views.\n */\n readonly host: RenderHost;\n\n /**\n * Data passed in by the caller (CLI/MCP screenshot tool, explorer UI). Use this to\n * parameterize the fixture: e.g. switch theme, vary props, select a scenario.\n *\n * When the fixture declares a zod `inputSchema`, this is typed as `z.infer<typeof schema>`\n * and populated with the schema's defaults for any keys the caller omitted. Without a\n * schema it is `unknown` (and `undefined` when no input was provided).\n *\n * Symmetric with `RenderResult.output` (which flows back out to the caller).\n */\n readonly input: TInput;\n}\n\n/**\n * Describes the environment a fixture is rendered in.\n */\nexport type RenderHost =\n /** Rendered in the Component Explorer UI (visible to a human). */\n | { readonly kind: 'explorer-ui'; readonly interactive: true }\n /** Headless render for CLI/MCP screenshots. */\n | { readonly kind: 'headless'; readonly interactive: false }\n /** Rendered inside an isolation iframe (user-facing standalone view). */\n | { readonly kind: 'embedded'; readonly interactive: false };\n\n/**\n * Style definition for shadow DOM injection.\n */\nexport type StyleDefinition =\n | { readonly type: 'css'; readonly content: string }\n | { readonly type: 'url'; readonly href: string }\n | { readonly type: 'adopted'; readonly sheet: CSSStyleSheet };\n\n/**\n * Display mode for a component.\n */\nexport type DisplayMode = PageMode | ComponentMode;\n\n/**\n * Page mode - component fills a viewport with device presets.\n */\nexport interface PageMode {\n readonly type: 'page';\n readonly viewports: ViewportPreset[];\n}\n\n/**\n * Component mode - renders at natural size.\n */\nexport interface ComponentMode {\n readonly type: 'component';\n}\n\n/**\n * Viewport preset - either a named preset or custom dimensions.\n */\nexport type ViewportPreset =\n | ViewportPresetName\n | { readonly name: string; readonly width: number; readonly height: number };\n\nexport type ViewportPresetName = 'mobile' | 'tablet' | 'desktop';\n\n// ============================================================================\n// JSON Schema (subset, intentionally permissive)\n// ============================================================================\n\n/**\n * Minimal JSON Schema interface used to describe a fixture's expected `input` shape.\n *\n * This is the *derived* form: fixtures declare their input with a zod schema\n * (`DefineFixtureOptions.inputSchema`) and the framework converts it to this JSON Schema\n * at define time. Tools (CLI/MCP/explorer UI) read it for validation, autocompletion, or\n * to generate input-editing controls.\n *\n * Intentionally a structural, recursive type covering the subset of JSON Schema we\n * actually surface to tools — the index signature lets any additional standard JSON Schema\n * keywords (`format`, `pattern`, `oneOf`, `$ref`, …) flow through without changing this interface.\n */\nexport interface IJsonSchema {\n readonly type?: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null';\n readonly properties?: { readonly [key: string]: IJsonSchema };\n readonly required?: readonly string[];\n readonly items?: IJsonSchema;\n readonly enum?: readonly unknown[];\n readonly const?: unknown;\n readonly default?: unknown;\n readonly description?: string;\n readonly title?: string;\n readonly additionalProperties?: boolean | IJsonSchema;\n readonly anyOf?: readonly IJsonSchema[];\n readonly oneOf?: readonly IJsonSchema[];\n readonly allOf?: readonly IJsonSchema[];\n readonly [key: string]: unknown;\n}\n\n// ============================================================================\n// Brand symbols - use Symbol.for() for cross-version compatibility\n// ============================================================================\n\n/** Brand symbol to identify single fixtures */\nexport const singleFixtureBrand = Symbol.for('@vscode/component-explorer/singleFixture/v1');\n\n/** Brand symbol to identify fixture groups */\nexport const fixtureGroupBrand = Symbol.for('@vscode/component-explorer/fixtureGroup/v1');\n\n/** Brand symbol to identify fixture variants */\nexport const fixtureVariantsBrand = Symbol.for('@vscode/component-explorer/fixtureVariants/v1');\n\n// ============================================================================\n// Define fixture options\n// ============================================================================\n\n/**\n * Options for defining a single component fixture.\n *\n * @typeParam TInput - Shape of the fixture's `input`, inferred from `inputSchema`.\n */\nexport interface DefineFixtureOptions<TInput = unknown> {\n /**\n * Path in the explorer tree.\n * - `undefined` (default): use fixture filename only\n * - `'Foo/Bar'`: exact path (fixture filename NOT appended)\n * - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})\n * \n * @throws Error if path contains empty segments (e.g., '/foo', 'foo//bar')\n */\n path?: string;\n\n /** Optional description for documentation */\n description?: string;\n\n /** How to isolate: 'none' (default) renders in light DOM, 'shadow-dom' for CSS isolation, 'iframe' for full isolation */\n isolation?: 'none' | 'shadow-dom' | 'iframe';\n\n /** Display mode: defaults to { type: 'component' } */\n displayMode?: DisplayMode;\n\n /** Styles to inject (into document head for 'none', into shadow root for 'shadow-dom', into iframe head for 'iframe') */\n styles?: StyleDefinition[];\n\n /** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */\n background?: 'light' | 'dark';\n\n /** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */\n labels?: readonly string[];\n\n /** Human/AI-readable description(s) of expected visual appearance. Inherited from parent group/variants and accumulated into a string[]. */\n expectedVisualDescriptions?: string | readonly string[];\n\n /**\n * Zod schema describing the expected shape of `RenderContext.input`.\n *\n * Declaring it gives two things:\n * 1. **Type safety** — `render`'s `context.input` is typed as `z.infer<typeof schema>`.\n * 2. **Tooling** — the framework converts the schema to JSON Schema at define time so the\n * CLI/MCP/explorer UI can validate, autocomplete, or render input-editing controls.\n *\n * The schema must describe an object (`z.object({...})`) — `input` is always a JSON object\n * (or `undefined`). Property-level `.default(...)` values are surfaced to tooling and used\n * to populate omitted keys before `render` runs.\n *\n * @example\n * ```ts\n * inputSchema: z.object({\n * theme: z.enum(['light', 'dark']).default('light'),\n * count: z.number().int().default(1),\n * })\n * ```\n */\n inputSchema?: z.ZodType<TInput>;\n\n /** Controls how selected input properties are presented in the Explorer UI. */\n inputControls?: {\n readonly [TKey in Extract<keyof TInput, string>]?: FixtureInputControlOptions;\n };\n\n /** Custom debug panels contributed by this fixture. */\n debugPanels?: readonly DebugPanelDefinition<unknown, unknown>[];\n\n /**\n * Render the component into the container.\n * \n * @param container - The DOM element to render into\n * @param context - Render context containing input and abort signal\n * @returns Optional RenderResult, or a Promise that resolves to one\n */\n render: (container: HTMLElement, context: RenderContext<TInput>) => RenderReturn;\n}\n\n/** @deprecated Use DefineFixtureOptions instead */\nexport type DefineComponentOptions = DefineFixtureOptions;\n\n// ============================================================================\n// Fixture export types (opaque to the user, consumed by fixtureApiConsumer)\n// ============================================================================\n\n/**\n * A single fixture export created by defineFixture().\n */\nexport interface SingleFixtureExport {\n readonly [singleFixtureBrand]: true;\n readonly _options: DefineFixtureOptions;\n readonly _path?: string;\n /** JSON Schema derived from `_options.inputSchema` at define time (cross-version safe). */\n readonly _inputSchemaJson?: IJsonSchema;\n}\n\n/**\n * Group entry: either a single fixture, a nested group, or variants.\n */\nexport type FixtureGroupEntry = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;\n\n/**\n * A fixture group export created by defineFixtureGroup().\n */\nexport interface FixtureGroupExport {\n readonly [fixtureGroupBrand]: true;\n readonly _entries: { [key: string]: FixtureGroupEntry };\n readonly _path?: string;\n readonly _labels?: readonly string[];\n readonly _expectedVisualDescriptions?: string | readonly string[];\n /** JSON Schema derived from the group's `inputSchema`; merged into every descendant fixture. */\n readonly _inputSchemaJson?: IJsonSchema;\n}\n\n/**\n * A fixture variants export created by defineFixtureVariants().\n */\nexport interface FixtureVariantsExport {\n readonly [fixtureVariantsBrand]: true;\n readonly _variants: { [key: string]: SingleFixtureExport };\n readonly _path?: string;\n readonly _labels?: readonly string[];\n readonly _expectedVisualDescriptions?: string | readonly string[];\n /** JSON Schema derived from the variants group's `inputSchema`; merged into every variant. */\n readonly _inputSchemaJson?: IJsonSchema;\n}\n\n/**\n * Fixture export type - a single fixture, a group, or variants.\n */\nexport type FixtureExport = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;\n\n/**\n * Input for defineFixtureGroup.\n */\nexport type FixtureGroupInput = { [key: string]: FixtureGroupEntry };\n\n/**\n * Options for defineFixtureGroup with optional path.\n */\nexport interface DefineFixtureGroupOptions {\n /**\n * Path in the explorer tree.\n * - `undefined` (default): use fixture filename only\n * - `'Foo/Bar'`: exact path (fixture filename NOT appended)\n * - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})\n */\n path?: string;\n\n /** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */\n labels?: readonly string[];\n\n /** Human/AI-readable description(s) of expected visual appearance. Inherited by nested fixtures. */\n expectedVisualDescriptions?: string | readonly string[];\n\n /**\n * Zod schema describing `input` shared by every fixture in this group. It is converted to\n * JSON Schema at define time and merged into each descendant fixture's own schema (the\n * descendant's properties win on conflict). Use it to declare common input — e.g. a `theme`\n * switch — once for a whole group instead of repeating it on each fixture.\n */\n inputSchema?: z.ZodType;\n}\n\n/**\n * Input for defineFixtureVariants (only single fixtures, no nesting).\n */\nexport type FixtureVariantsInput = { [key: string]: SingleFixtureExport };\n\n/**\n * Options for defineFixtureVariants with optional path.\n */\nexport interface DefineFixtureVariantsOptions {\n /**\n * Path in the explorer tree.\n * - `undefined` (default): use fixture filename only \n * - `'Foo/Bar'`: exact path (fixture filename NOT appended)\n * - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})\n */\n path?: string;\n\n /** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */\n labels?: readonly string[];\n\n /** Human/AI-readable description(s) of expected visual appearance. Inherited by nested fixtures. */\n expectedVisualDescriptions?: string | readonly string[];\n\n /**\n * Zod schema describing `input` shared by every variant in this group. Converted to JSON\n * Schema at define time and merged into each variant's own schema (the variant's properties\n * win on conflict).\n */\n inputSchema?: z.ZodType;\n}\n\n// ============================================================================\n// Define fixture functions\n// ============================================================================\n\n/**\n * Converts a zod schema to the JSON Schema form surfaced to tooling.\n * Runs at define time (in the project's runtime) so only plain JSON crosses the\n * version boundary to the viewer. Returns `undefined` when no schema is given.\n */\nfunction toInputJsonSchema(schema: z.ZodType | undefined): IJsonSchema | undefined {\n if (!schema) { return undefined; }\n return z.toJSONSchema(schema, { unrepresentable: 'any' }) as IJsonSchema;\n}\n\n/**\n * Defines a single fixture.\n * \n * @example\n * ```ts\n * // Simple - no cleanup needed\n * export default defineFixture({\n * render: (container) => {\n * container.innerHTML = `<button>Click me</button>`;\n * },\n * });\n * \n * // Typed, parameterizable input via a zod schema\n * export default defineFixture({\n * inputSchema: z.object({ label: z.string().default('Click me') }),\n * render: (container, { input }) => {\n * const root = createRoot(container);\n * root.render(<Button label={input.label} />);\n * return { dispose: () => root.unmount() };\n * },\n * });\n * \n * // Async render\n * export default defineFixture({\n * inputSchema: z.object({ url: z.string() }),\n * render: async (container, { input, signal }) => {\n * const data = await fetch(input.url, { signal });\n * container.innerHTML = await data.text();\n * return { dispose: () => { container.innerHTML = ''; } };\n * },\n * });\n * ```\n */\nexport function defineFixture<TInput = unknown>(options: DefineFixtureOptions<TInput>): SingleFixtureExport {\n return {\n [singleFixtureBrand]: true,\n _options: options as unknown as DefineFixtureOptions,\n _path: options.path,\n _inputSchemaJson: toInputJsonSchema(options.inputSchema as z.ZodType | undefined),\n };\n}\n\nexport function defineDebugPanel<TState, TAction = never>(\n options: DefineDebugPanelOptions<TState, TAction>,\n): DebugPanelDefinition<TState, TAction> {\n return {\n id: options.id,\n title: options.title,\n placement: options.placement,\n _render: (container, sendAction) => {\n const view = options.render(container, {\n sendAction: (action) => sendAction(action),\n });\n return {\n update: (state) => view.update(state as TState),\n dispose: () => view.dispose(),\n };\n },\n };\n}\n\nexport function interactiveOutput<T>(options: {\n readonly getSnapshot: () => T;\n readonly activate: DebugPanelActivation<T, T>;\n}): InteractiveOutput<T> {\n return {\n [interactiveOutputBrand]: true,\n getSnapshot: options.getSnapshot,\n activate: options.activate,\n };\n}\n\nexport function isInteractiveOutput(value: unknown): value is InteractiveOutput<unknown> {\n return typeof value === 'object'\n && value !== null\n && interactiveOutputBrand in value\n && (value as Record<symbol, unknown>)[interactiveOutputBrand] === true;\n}\n\n/**\n * Defines a group of fixtures with support for nesting.\n * \n * @example\n * ```ts\n * export default defineFixtureGroup({\n * Primary: defineFixture({\n * render: (container) => { ... },\n * }),\n * Variants: defineFixtureGroup({\n * Small: defineFixture({ ... }),\n * Large: defineFixture({ ... }),\n * }),\n * });\n * ```\n */\nexport function defineFixtureGroup(entries: FixtureGroupInput): FixtureGroupExport;\nexport function defineFixtureGroup(options: DefineFixtureGroupOptions, entries: FixtureGroupInput): FixtureGroupExport;\nexport function defineFixtureGroup(optionsOrEntries: DefineFixtureGroupOptions | FixtureGroupInput, maybeEntries?: FixtureGroupInput): FixtureGroupExport {\n if (maybeEntries !== undefined) {\n const opts = optionsOrEntries as DefineFixtureGroupOptions;\n return {\n [fixtureGroupBrand]: true,\n _entries: maybeEntries,\n _path: opts.path,\n _labels: opts.labels,\n _expectedVisualDescriptions: opts.expectedVisualDescriptions,\n _inputSchemaJson: toInputJsonSchema(opts.inputSchema),\n };\n }\n return {\n [fixtureGroupBrand]: true,\n _entries: optionsOrEntries as FixtureGroupInput,\n };\n}\n\n/**\n * Defines a group of fixture variants (no nesting allowed).\n * Variants are rendered horizontally by default and have a distinct icon in the tree.\n * \n * @example\n * ```ts\n * export default defineFixtureGroup({\n * Button: defineFixtureVariants({\n * Small: defineFixture({ ... }),\n * Medium: defineFixture({ ... }),\n * Large: defineFixture({ ... }),\n * }),\n * });\n * ```\n */\nexport function defineFixtureVariants(variants: FixtureVariantsInput): FixtureVariantsExport;\nexport function defineFixtureVariants(options: DefineFixtureVariantsOptions, variants: FixtureVariantsInput): FixtureVariantsExport;\nexport function defineFixtureVariants(optionsOrVariants: DefineFixtureVariantsOptions | FixtureVariantsInput, maybeVariants?: FixtureVariantsInput): FixtureVariantsExport {\n if (maybeVariants !== undefined) {\n const opts = optionsOrVariants as DefineFixtureVariantsOptions;\n return {\n [fixtureVariantsBrand]: true,\n _variants: maybeVariants,\n _path: opts.path,\n _labels: opts.labels,\n _expectedVisualDescriptions: opts.expectedVisualDescriptions,\n _inputSchemaJson: toInputJsonSchema(opts.inputSchema),\n };\n }\n return {\n [fixtureVariantsBrand]: true,\n _variants: optionsOrVariants as FixtureVariantsInput,\n };\n}\n\n// ============================================================================\n// Render helpers\n// ============================================================================\n\n/** Already-resolved promise, reused for efficiency */\nconst resolvedPromise = Promise.resolve();\n\n/**\n * Helper for synchronous renders.\n * Executes the render function immediately and wraps the cleanup in a RenderResult.\n * \n * @param doRender - Function that renders synchronously and returns a cleanup function\n * @returns A RenderResult with an already-resolved ready promise\n * \n * @example\n * ```ts\n * render: (container, { input }) => syncRender(() => {\n * const el = document.createElement('button');\n * el.textContent = input.label;\n * container.appendChild(el);\n * return () => el.remove();\n * })\n * ```\n */\nexport function syncRender(doRender: () => (() => void) | IDisposable | void): RenderResult {\n const cleanup = doRender();\n return {\n ready: resolvedPromise,\n dispose: () => {\n if (typeof cleanup === 'function') {\n cleanup();\n } else if (cleanup && typeof cleanup.dispose === 'function') {\n cleanup.dispose();\n }\n },\n };\n}\n\n/**\n * Helper for asynchronous renders with cancellation support.\n * \n * @param signal - AbortSignal for cancellation\n * @param doRender - Async function that renders and returns a cleanup function.\n * Should check signal.aborted periodically for long operations.\n * @returns A RenderResult whose ready promise rejects with AbortError if cancelled\n * \n * @example\n * ```ts\n * render: (container, { input, signal }) => asyncRender(signal, async () => {\n * const data = await fetchData(input.url, { signal });\n * if (signal.aborted) return;\n * container.innerHTML = data;\n * return () => { container.innerHTML = ''; };\n * })\n * ```\n */\nexport function asyncRender(\n signal: AbortSignal,\n doRender: () => Promise<(() => void) | IDisposable | void>\n): RenderResult {\n let cleanup: (() => void) | IDisposable | void;\n let disposed = false;\n\n function isAborted(): boolean {\n return signal.aborted;\n }\n\n const ready = (async () => {\n if (isAborted()) {\n throw new DOMException('Render aborted', 'AbortError');\n }\n cleanup = await doRender();\n if (isAborted() || disposed) {\n // Cleanup immediately if aborted/disposed during render\n doCleanup();\n if (isAborted()) {\n throw new DOMException('Render aborted', 'AbortError');\n }\n }\n })();\n\n function doCleanup(): void {\n if (typeof cleanup === 'function') {\n cleanup();\n } else if (cleanup && typeof cleanup.dispose === 'function') {\n cleanup.dispose();\n }\n cleanup = undefined;\n }\n\n return {\n ready,\n dispose: () => {\n disposed = true;\n doCleanup();\n },\n };\n}\n","/**\n * Taken from https://semver.org/spec/v2.0.0.html.\n */\nexport const semanticVersionRegexEmbeddable = /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?/;\n/**\n * Taken from https://semver.org/spec/v2.0.0.html.\n */\nexport const semanticVersionRegex = new RegExp(`^${semanticVersionRegexEmbeddable.source}$`);\nconst numberRegex = /0|[1-9][0-9]*/;\nexport function semanticVersionRegexGroupsToVersion(groups) {\n const prereleaseMatch = groups[4];\n const buildMatch = groups[5];\n let prereleaseInfo = null;\n if (prereleaseMatch) {\n prereleaseInfo = new PreReleaseInfo(prereleaseMatch\n .split(\".\")\n .map((r) => (r.match(numberRegex) ? parseInt(r) : r)));\n }\n const buildInfo = buildMatch !== undefined ? new BuildInfo(buildMatch.split(\".\")) : null;\n return new SemanticVersion(parseInt(groups[1]), parseInt(groups[2]), parseInt(groups[3]), prereleaseInfo, buildInfo);\n}\n/**\n * Represents a valid semantic version.\n * See https://semver.org/spec/v2.0.0.html.\n */\nexport class SemanticVersion {\n major;\n minor;\n patch;\n prerelease;\n build;\n static parse(text) {\n const exec = semanticVersionRegex.exec(text);\n if (!exec) {\n throw new Error(`Could not parse semantic version. \"${text}\" is not valid.`);\n }\n return semanticVersionRegexGroupsToVersion(exec);\n }\n constructor(major, minor, patch, prerelease, build) {\n this.major = major;\n this.minor = minor;\n this.patch = patch;\n this.prerelease = prerelease;\n this.build = build;\n function testValidNumber(n, arg) {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error(`Invalid input. \"${n}\" is not valid for ${arg}`);\n }\n }\n testValidNumber(major, \"major\");\n testValidNumber(minor, \"minor\");\n testValidNumber(patch, \"patch\");\n }\n get isStable() {\n return this.major > 0;\n }\n toString() {\n let result = `${this.major}.${this.minor}.${this.patch}`;\n if (this.prerelease) {\n result += `-${this.prerelease.toString()}`;\n }\n if (this.build) {\n result += `+${this.build.toString()}`;\n }\n return result;\n }\n equals(other) {\n return this.toString() === other.toString();\n }\n with(update) {\n function defaultIfUndefined(val, defaultVal) {\n return val !== undefined ? val : defaultVal;\n }\n function defaultIfUndefinedNumber(val, defaultVal) {\n if (val === \"increment\") {\n return defaultVal + 1;\n }\n return val !== undefined ? val : defaultVal;\n }\n return new SemanticVersion(defaultIfUndefinedNumber(update.major, this.major), defaultIfUndefinedNumber(update.minor, this.minor), defaultIfUndefinedNumber(update.patch, this.patch), defaultIfUndefined(update.prerelease, this.prerelease), defaultIfUndefined(update.build, this.build));\n }\n toJSON() {\n return {\n major: this.major,\n minor: this.minor,\n patch: this.patch,\n ...(this.prerelease ? { prerelease: this.prerelease.parts } : {}),\n ...(this.build ? { build: this.build.parts } : {}),\n };\n }\n /**\n * Returns -1 if this version is older than the other version, 0 if they are equal, or 1 if this version is newer.\n */\n compareTo(other) {\n if (this.major != other.major) {\n return comparePrimitives(this.major, other.major);\n }\n if (this.minor != other.minor) {\n return comparePrimitives(this.minor, other.minor);\n }\n if (this.patch != other.patch) {\n return comparePrimitives(this.patch, other.patch);\n }\n return PreReleaseInfo.compare(this.prerelease, other.prerelease);\n }\n}\nfunction comparePrimitives(a, b) {\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n}\nexport class PreReleaseInfo {\n parts;\n static compare(a, b) {\n if (!a && !b) {\n return 0;\n }\n if (!a) {\n // prefer non-prerelease version.\n return 1;\n }\n if (!b) {\n return -1;\n }\n return a.compareTo(b);\n }\n constructor(parts) {\n this.parts = parts;\n if (parts.length === 0) {\n throw new Error(\"Must have at least one part!\");\n }\n for (const p of parts) {\n if (typeof p === \"string\") {\n if (!/^[0-9a-zA-Z-]*[a-zA-Z-][0-9a-zA-Z-]*$/.exec(p)) {\n throw new Error(\"Invalid input! Non-number parts must have at least one non-digit!\");\n }\n }\n }\n }\n toString() {\n return this.parts.map((p) => p.toString()).join(\".\");\n }\n isNewer(other) {\n return this.compareTo(other) === 1;\n }\n isOlder(other) {\n return this.compareTo(other) === -1;\n }\n compareTo(other) {\n for (let i = 0; i < Math.max(this.parts.length, other.parts.length); i++) {\n const a = this.parts[i];\n const b = other.parts[i];\n if (a === undefined) {\n // Other has longer prerelease\n return -1;\n }\n if (b === undefined) {\n // This has longer prerelease\n return 1;\n }\n if (a !== b) {\n return comparePrimitives(a, b);\n }\n }\n return 0;\n }\n}\nexport class BuildInfo {\n parts;\n constructor(parts) {\n this.parts = parts;\n if (parts.length === 0) {\n throw new Error(\"Must have at least one part!\");\n }\n }\n toString() {\n return this.parts.join(\".\");\n }\n}\n//# sourceMappingURL=index.js.map","import { SemanticVersion } from 'semver';\n\nexport const runtimeVersion = SemanticVersion.parse('1.1.0');\n\n"],"names":["interactiveOutputBrand","singleFixtureBrand","fixtureGroupBrand","fixtureVariantsBrand","toInputJsonSchema","schema","z","defineFixture","options","defineDebugPanel","container","sendAction","view","action","state","interactiveOutput","isInteractiveOutput","value","defineFixtureGroup","optionsOrEntries","maybeEntries","opts","defineFixtureVariants","optionsOrVariants","maybeVariants","resolvedPromise","syncRender","doRender","cleanup","asyncRender","signal","disposed","isAborted","ready","doCleanup","semanticVersionRegexEmbeddable","semanticVersionRegex","numberRegex","semanticVersionRegexGroupsToVersion","groups","prereleaseMatch","buildMatch","prereleaseInfo","PreReleaseInfo","r","buildInfo","BuildInfo","SemanticVersion","major","minor","patch","prerelease","build","__publicField","testValidNumber","n","arg","text","exec","result","other","update","defaultIfUndefined","val","defaultVal","defaultIfUndefinedNumber","comparePrimitives","a","b","parts","p","i","runtimeVersion"],"mappings":";;;;kEA4FaA,IAAyB,OAAO,IAAI,iDAAiD,GA0LrFC,IAAqB,OAAO,IAAI,6CAA6C,GAG7EC,IAAoB,OAAO,IAAI,4CAA4C,GAG3EC,IAAuB,OAAO,IAAI,+CAA+C;AAiN9F,SAASC,EAAkBC,GAAwD;AACjF,MAAKA;AACL,WAAOC,EAAE,aAAaD,GAAQ,EAAE,iBAAiB,OAAO;AAC1D;AAmCO,SAASE,EAAgCC,GAA4D;AAC1G,SAAO;AAAA,IACL,CAACP,CAAkB,GAAG;AAAA,IACtB,UAAUO;AAAA,IACV,OAAOA,EAAQ;AAAA,IACf,kBAAkBJ,EAAkBI,EAAQ,WAAoC;AAAA,EAAA;AAEpF;AAEO,SAASC,EACdD,GACuC;AACvC,SAAO;AAAA,IACL,IAAIA,EAAQ;AAAA,IACZ,OAAOA,EAAQ;AAAA,IACf,WAAWA,EAAQ;AAAA,IACnB,SAAS,CAACE,GAAWC,MAAe;AAClC,YAAMC,IAAOJ,EAAQ,OAAOE,GAAW;AAAA,QACrC,YAAY,CAACG,MAAWF,EAAWE,CAAM;AAAA,MAAA,CAC1C;AACD,aAAO;AAAA,QACL,QAAQ,CAACC,MAAUF,EAAK,OAAOE,CAAe;AAAA,QAC9C,SAAS,MAAMF,EAAK,QAAA;AAAA,MAAQ;AAAA,IAEhC;AAAA,EAAA;AAEJ;AAEO,SAASG,EAAqBP,GAGZ;AACvB,SAAO;AAAA,IACL,CAACR,CAAsB,GAAG;AAAA,IAC1B,aAAaQ,EAAQ;AAAA,IACrB,UAAUA,EAAQ;AAAA,EAA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D;AAAA,EACA,QAAQV,GAAO;AACX,WAAO,KAAK,UAAUA,CAAK,MAAM;AAAA,EACrC;AAAA,EACA,QAAQA,GAAO;AACX,WAAO,KAAK,UAAUA,CAAK,MAAM;AAAA,EACrC;AAAA,EACA,UAAUA,GAAO;AACb,aAASW,IAAI,GAAGA,IAAI,KAAK,IAAI,KAAK,MAAM,QAAQX,EAAM,MAAM,MAAM,GAAGW,KAAK;AACtE,YAAMJ,IAAI,KAAK,MAAMI,CAAC,GAChBH,IAAIR,EAAM,MAAMW,CAAC;AACvB,UAAIJ,MAAM;AAEN,eAAO;AAEX,UAAIC,MAAM;AAEN,eAAO;AAEX,UAAID,MAAMC;AACN,eAAOF,EAAkBC,GAAGC,CAAC;AAAA,IAErC;AACA,WAAO;AAAA,EACX;AACJ;AACO,MAAMtB,EAAU;AAAA,EAEnB,YAAYuB,GAAO;AADnB,IAAAhB,EAAA;AAGI,QADA,KAAK,QAAQgB,GACTA,EAAM,WAAW;AACjB,YAAM,IAAI,MAAM,8BAA8B;AAAA,EAEtD;AAAA,EACA,WAAW;AACP,WAAO,KAAK,MAAM,KAAK,GAAG;AAAA,EAC9B;AACJ;ACpLO,MAAMG,IAAiBzB,EAAgB,MAAM,OAAO;"}
1
+ {"version":3,"file":"runtimeVersion-ByhWJutT.js","sources":["../src/core/fixtureApi.ts","../../semver/dist/index.js","../src/runtimeVersion.ts"],"sourcesContent":["/**\n * Public Fixture API\n * \n * This module is the public API for defining fixtures.\n * It's designed to be stable across versions - projects can use a different\n * @vscode/component-explorer version than the explorer viewer uses.\n * \n * Use Symbol.for() instead of Symbol() so the same symbol is shared across\n * different versions of this package.\n *\n * @module fixtureApi\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Types for fixture definition (re-exported for convenience)\n// ============================================================================\n\n/**\n * Disposable resource that can be cleaned up.\n * `dispose` may be sync or async; the framework awaits the returned promise (if any)\n * and captures any thrown errors.\n */\nexport interface IDisposable {\n dispose(): void | Promise<void>;\n}\n\nexport type DebugPanelPlacement = 'canvas-right' | 'bottom-panel';\n\nexport interface DebugPanelViewContext<TAction> {\n sendAction(action: TAction): void;\n}\n\nexport interface DebugPanelViewInstance<TState> extends IDisposable {\n update(state: TState): void;\n}\n\nexport interface DefineDebugPanelOptions<TState, TAction> {\n readonly id: string;\n readonly title: string;\n readonly placement?: DebugPanelPlacement;\n render(\n container: HTMLElement,\n context: DebugPanelViewContext<TAction>,\n ): DebugPanelViewInstance<TState>;\n}\n\ninterface ErasedDebugPanelViewInstance extends IDisposable {\n update(state: unknown): void;\n}\n\n/**\n * A statically declared custom panel. `TState` is published by the fixture and\n * `TAction` is sent back by the panel UI.\n */\nexport interface DebugPanelDefinition<TState = unknown, TAction = unknown> {\n readonly id: string;\n readonly title: string;\n readonly placement?: DebugPanelPlacement;\n /** @internal Viewer-side, type-erased renderer produced by defineDebugPanel. */\n readonly _render: (\n container: HTMLElement,\n sendAction: (action: unknown) => void,\n ) => ErasedDebugPanelViewInstance;\n /** @internal Carries types for inference without affecting the runtime shape. */\n readonly _types?: { readonly state: TState; readonly action: TAction };\n}\n\nexport interface DebugPanelChannel<TState, TAction> {\n publish(state: TState): void;\n onAction(listener: (action: TAction) => void): IDisposable;\n}\n\nexport type DebugPanelActivation<TState, TAction> = (\n channel: DebugPanelChannel<TState, TAction>,\n) => void | IDisposable;\n\nexport interface FixtureDebugApi {\n connect<TState, TAction>(\n panel: DebugPanelDefinition<TState, TAction>,\n activate: DebugPanelActivation<TState, TAction>,\n ): IDisposable;\n}\n\nexport interface FixtureInputControlOptions {\n readonly placement?: 'sidebar' | 'toolbar' | 'both';\n readonly label?: string;\n readonly title?: string;\n}\n\n/** Brand for an output that can be observed and edited while its Output panel is visible. */\nexport const interactiveOutputBrand = Symbol.for('@vscode/component-explorer/interactiveOutput/v1');\n\nexport interface InteractiveOutput<T> {\n readonly [interactiveOutputBrand]: true;\n getSnapshot(): T;\n activate(channel: DebugPanelChannel<T, T>): void | IDisposable;\n}\n\n/**\n * Result of a render operation.\n * Supports both sync and async rendering with cancellation.\n * All fields are optional for simple use cases.\n */\nexport interface RenderResult {\n /**\n * Resolves when the component is fully rendered and ready.\n * For sync renders, this can be omitted (treated as immediately ready).\n * Rejects if the render is aborted via the AbortSignal.\n */\n readonly ready?: Promise<void>;\n\n /**\n * Cleanup function. Called when the fixture is unmounted.\n * May be sync or async; the framework awaits the returned promise (if any).\n * Errors thrown (sync or async) are captured and surfaced via the\n * `previousDispose` field of the next render report (or `currentDispose`\n * if `disposeAfter` was requested).\n * Can be omitted if no cleanup is needed.\n */\n dispose?(): void | Promise<void>;\n\n /**\n * Arbitrary data to include in the render report.\n * Visible to the CLI and MCP tools (surfaced as `output`).\n *\n * Symmetric counterpart of `RenderContext.input`: input flows in, output flows out.\n */\n readonly output?: unknown;\n}\n\n/**\n * What the render function can return.\n * - undefined: no cleanup needed, immediately ready\n * - RenderResult: object with optional ready/dispose\n * - Promise<...>: async render that resolves to undefined or RenderResult\n */\nexport type RenderReturn = RenderResult | undefined | void | Promise<RenderResult | undefined | void>;\n\n/**\n * Context passed to the render function.\n *\n * @typeParam TInput - Shape of `input`, inferred from the fixture's zod `inputSchema`\n * (defaults to `unknown` when no schema is declared).\n */\nexport interface RenderContext<TInput = unknown> {\n /**\n * Unique identifier of the fixture being rendered.\n * Stable across renders of the same fixture; useful for keying caches,\n * logging, or distinguishing between sibling fixtures sharing a render function.\n */\n readonly fixtureId: string;\n\n /** AbortSignal for cancellation; check signal.aborted or listen to 'abort' event */\n readonly signal: AbortSignal;\n\n /** Register a disposable to be cleaned up when the fixture is unmounted. Returns the same disposable for chaining. */\n addDisposable<T extends IDisposable>(disposable: T): T;\n\n /**\n * Observes one input property without remounting the fixture. The listener is\n * invoked immediately and again for subsequent changes to this property.\n * Input properties without a watcher retain the default remount behavior.\n */\n watchInput<TKey extends Extract<keyof TInput, string>>(\n key: TKey,\n listener: (value: TInput[TKey], input: TInput) => void,\n ): IDisposable;\n\n /** Connects statically declared debug panels to this live fixture instance. */\n readonly debug: FixtureDebugApi;\n\n /**\n * Describes where this fixture is being rendered. Use this to enable dev-only affordances\n * (e.g. extra controls, logging) without affecting screenshots or embedded views.\n */\n readonly host: RenderHost;\n\n /**\n * Data passed in by the caller (CLI/MCP screenshot tool, explorer UI). Use this to\n * parameterize the fixture: e.g. switch theme, vary props, select a scenario.\n *\n * When the fixture declares a zod `inputSchema`, this is typed as `z.infer<typeof schema>`\n * and populated with the schema's defaults for any keys the caller omitted. Without a\n * schema it is `unknown` (and `undefined` when no input was provided).\n *\n * Symmetric with `RenderResult.output` (which flows back out to the caller).\n */\n readonly input: TInput;\n}\n\n/**\n * Describes the environment a fixture is rendered in.\n */\nexport type RenderHost =\n /** Rendered in the Component Explorer UI (visible to a human). */\n | { readonly kind: 'explorer-ui'; readonly interactive: true }\n /** Headless render for CLI/MCP screenshots. */\n | { readonly kind: 'headless'; readonly interactive: false }\n /** Rendered inside an isolation iframe (user-facing standalone view). */\n | { readonly kind: 'embedded'; readonly interactive: false };\n\n/**\n * Style definition for shadow DOM injection.\n */\nexport type StyleDefinition =\n | { readonly type: 'css'; readonly content: string }\n | { readonly type: 'url'; readonly href: string }\n | { readonly type: 'adopted'; readonly sheet: CSSStyleSheet };\n\n/**\n * Display mode for a component.\n */\nexport type DisplayMode = PageMode | ComponentMode;\n\n/**\n * Page mode - component fills a viewport with device presets.\n */\nexport interface PageMode {\n readonly type: 'page';\n readonly viewports: ViewportPreset[];\n}\n\n/**\n * Component mode - renders at natural size.\n */\nexport interface ComponentMode {\n readonly type: 'component';\n}\n\n/**\n * Viewport preset - either a named preset or custom dimensions.\n */\nexport type ViewportPreset =\n | ViewportPresetName\n | { readonly name: string; readonly width: number; readonly height: number };\n\nexport type ViewportPresetName = 'mobile' | 'tablet' | 'desktop';\n\n// ============================================================================\n// JSON Schema (subset, intentionally permissive)\n// ============================================================================\n\n/**\n * Minimal JSON Schema interface used to describe a fixture's expected `input` shape.\n *\n * This is the *derived* form: fixtures declare their input with a zod schema\n * (`DefineFixtureOptions.inputSchema`) and the framework converts it to this JSON Schema\n * at define time. Tools (CLI/MCP/explorer UI) read it for validation, autocompletion, or\n * to generate input-editing controls.\n *\n * Intentionally a structural, recursive type covering the subset of JSON Schema we\n * actually surface to tools — the index signature lets any additional standard JSON Schema\n * keywords (`format`, `pattern`, `oneOf`, `$ref`, …) flow through without changing this interface.\n */\nexport interface IJsonSchema {\n readonly type?: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null';\n readonly properties?: { readonly [key: string]: IJsonSchema };\n readonly required?: readonly string[];\n readonly items?: IJsonSchema;\n readonly enum?: readonly unknown[];\n readonly const?: unknown;\n readonly default?: unknown;\n readonly description?: string;\n readonly title?: string;\n readonly additionalProperties?: boolean | IJsonSchema;\n readonly anyOf?: readonly IJsonSchema[];\n readonly oneOf?: readonly IJsonSchema[];\n readonly allOf?: readonly IJsonSchema[];\n readonly [key: string]: unknown;\n}\n\n// ============================================================================\n// Brand symbols - use Symbol.for() for cross-version compatibility\n// ============================================================================\n\n/** Brand symbol to identify single fixtures */\nexport const singleFixtureBrand = Symbol.for('@vscode/component-explorer/singleFixture/v1');\n\n/** Brand symbol to identify fixture groups */\nexport const fixtureGroupBrand = Symbol.for('@vscode/component-explorer/fixtureGroup/v1');\n\n/** Brand symbol to identify fixture variants */\nexport const fixtureVariantsBrand = Symbol.for('@vscode/component-explorer/fixtureVariants/v1');\n\n// ============================================================================\n// Define fixture options\n// ============================================================================\n\n/**\n * Options for defining a single component fixture.\n *\n * @typeParam TInput - Shape of the fixture's `input`, inferred from `inputSchema`.\n */\nexport interface DefineFixtureOptions<TInput = unknown> {\n /**\n * Path in the explorer tree.\n * - `undefined` (default): use fixture filename only\n * - `'Foo/Bar'`: exact path (fixture filename NOT appended)\n * - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})\n * \n * @throws Error if path contains empty segments (e.g., '/foo', 'foo//bar')\n */\n path?: string;\n\n /** Optional description for documentation */\n description?: string;\n\n /** How to isolate: 'none' (default) renders in light DOM, 'shadow-dom' for CSS isolation, 'iframe' for full isolation */\n isolation?: 'none' | 'shadow-dom' | 'iframe';\n\n /** Display mode: defaults to { type: 'component' } */\n displayMode?: DisplayMode;\n\n /** Styles to inject (into document head for 'none', into shadow root for 'shadow-dom', into iframe head for 'iframe') */\n styles?: StyleDefinition[];\n\n /** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */\n background?: 'light' | 'dark';\n\n /** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */\n labels?: readonly string[];\n\n /** Human/AI-readable description(s) of expected visual appearance. Inherited from parent group/variants and accumulated into a string[]. */\n expectedVisualDescriptions?: string | readonly string[];\n\n /**\n * Zod schema describing the expected shape of `RenderContext.input`.\n *\n * Declaring it gives two things:\n * 1. **Type safety** — `render`'s `context.input` is typed as `z.infer<typeof schema>`.\n * 2. **Tooling** — the framework converts the schema to JSON Schema at define time so the\n * CLI/MCP/explorer UI can validate, autocomplete, or render input-editing controls.\n *\n * The schema must describe an object (`z.object({...})`) — `input` is always a JSON object\n * (or `undefined`). Property-level `.default(...)` values are surfaced to tooling and used\n * to populate omitted keys before `render` runs.\n *\n * @example\n * ```ts\n * inputSchema: z.object({\n * theme: z.enum(['light', 'dark']).default('light'),\n * count: z.number().int().default(1),\n * })\n * ```\n */\n inputSchema?: z.ZodType<TInput>;\n\n /** Controls how selected input properties are presented in the Explorer UI. */\n inputControls?: {\n readonly [TKey in Extract<keyof TInput, string>]?: FixtureInputControlOptions;\n };\n\n /** Custom debug panels contributed by this fixture. */\n debugPanels?: readonly DebugPanelDefinition<unknown, unknown>[];\n\n /**\n * Render the component into the container.\n * \n * @param container - The DOM element to render into\n * @param context - Render context containing input and abort signal\n * @returns Optional RenderResult, or a Promise that resolves to one\n */\n render: (container: HTMLElement, context: RenderContext<TInput>) => RenderReturn;\n}\n\n/** @deprecated Use DefineFixtureOptions instead */\nexport type DefineComponentOptions = DefineFixtureOptions;\n\n// ============================================================================\n// Fixture export types (opaque to the user, consumed by fixtureApiConsumer)\n// ============================================================================\n\n/**\n * A single fixture export created by defineFixture().\n */\nexport interface SingleFixtureExport {\n readonly [singleFixtureBrand]: true;\n readonly _options: DefineFixtureOptions;\n readonly _path?: string;\n /** JSON Schema derived from `_options.inputSchema` at define time (cross-version safe). */\n readonly _inputSchemaJson?: IJsonSchema;\n}\n\n/**\n * Group entry: either a single fixture, a nested group, or variants.\n */\nexport type FixtureGroupEntry = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;\n\n/**\n * A fixture group export created by defineFixtureGroup().\n */\nexport interface FixtureGroupExport {\n readonly [fixtureGroupBrand]: true;\n readonly _entries: { [key: string]: FixtureGroupEntry };\n readonly _path?: string;\n readonly _labels?: readonly string[];\n readonly _expectedVisualDescriptions?: string | readonly string[];\n /** JSON Schema derived from the group's `inputSchema`; merged into every descendant fixture. */\n readonly _inputSchemaJson?: IJsonSchema;\n}\n\n/**\n * A fixture variants export created by defineFixtureVariants().\n */\nexport interface FixtureVariantsExport {\n readonly [fixtureVariantsBrand]: true;\n readonly _variants: { [key: string]: SingleFixtureExport };\n readonly _path?: string;\n readonly _labels?: readonly string[];\n readonly _expectedVisualDescriptions?: string | readonly string[];\n /** JSON Schema derived from the variants group's `inputSchema`; merged into every variant. */\n readonly _inputSchemaJson?: IJsonSchema;\n}\n\n/**\n * Fixture export type - a single fixture, a group, or variants.\n */\nexport type FixtureExport = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;\n\n/**\n * Input for defineFixtureGroup.\n */\nexport type FixtureGroupInput = { [key: string]: FixtureGroupEntry };\n\n/**\n * Options for defineFixtureGroup with optional path.\n */\nexport interface DefineFixtureGroupOptions {\n /**\n * Path in the explorer tree.\n * - `undefined` (default): use fixture filename only\n * - `'Foo/Bar'`: exact path (fixture filename NOT appended)\n * - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})\n */\n path?: string;\n\n /** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */\n labels?: readonly string[];\n\n /** Human/AI-readable description(s) of expected visual appearance. Inherited by nested fixtures. */\n expectedVisualDescriptions?: string | readonly string[];\n\n /**\n * Zod schema describing `input` shared by every fixture in this group. It is converted to\n * JSON Schema at define time and merged into each descendant fixture's own schema (the\n * descendant's properties win on conflict). Use it to declare common input — e.g. a `theme`\n * switch — once for a whole group instead of repeating it on each fixture.\n */\n inputSchema?: z.ZodType;\n}\n\n/**\n * Input for defineFixtureVariants (only single fixtures, no nesting).\n */\nexport type FixtureVariantsInput = { [key: string]: SingleFixtureExport };\n\n/**\n * Options for defineFixtureVariants with optional path.\n */\nexport interface DefineFixtureVariantsOptions {\n /**\n * Path in the explorer tree.\n * - `undefined` (default): use fixture filename only \n * - `'Foo/Bar'`: exact path (fixture filename NOT appended)\n * - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})\n */\n path?: string;\n\n /** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */\n labels?: readonly string[];\n\n /** Human/AI-readable description(s) of expected visual appearance. Inherited by nested fixtures. */\n expectedVisualDescriptions?: string | readonly string[];\n\n /**\n * Zod schema describing `input` shared by every variant in this group. Converted to JSON\n * Schema at define time and merged into each variant's own schema (the variant's properties\n * win on conflict).\n */\n inputSchema?: z.ZodType;\n}\n\n// ============================================================================\n// Define fixture functions\n// ============================================================================\n\n/**\n * Converts a zod schema to the JSON Schema form surfaced to tooling.\n * Runs at define time (in the project's runtime) so only plain JSON crosses the\n * version boundary to the viewer. Returns `undefined` when no schema is given.\n */\nfunction toInputJsonSchema(schema: z.ZodType | undefined): IJsonSchema | undefined {\n if (!schema) { return undefined; }\n return z.toJSONSchema(schema, { unrepresentable: 'any' }) as IJsonSchema;\n}\n\n/**\n * Defines a single fixture.\n * \n * @example\n * ```ts\n * // Simple - no cleanup needed\n * export default defineFixture({\n * render: (container) => {\n * container.innerHTML = `<button>Click me</button>`;\n * },\n * });\n * \n * // Typed, parameterizable input via a zod schema\n * export default defineFixture({\n * inputSchema: z.object({ label: z.string().default('Click me') }),\n * render: (container, { input }) => {\n * const root = createRoot(container);\n * root.render(<Button label={input.label} />);\n * return { dispose: () => root.unmount() };\n * },\n * });\n * \n * // Async render\n * export default defineFixture({\n * inputSchema: z.object({ url: z.string() }),\n * render: async (container, { input, signal }) => {\n * const data = await fetch(input.url, { signal });\n * container.innerHTML = await data.text();\n * return { dispose: () => { container.innerHTML = ''; } };\n * },\n * });\n * ```\n */\nexport function defineFixture<TInput = unknown>(options: DefineFixtureOptions<TInput>): SingleFixtureExport {\n return {\n [singleFixtureBrand]: true,\n _options: options as unknown as DefineFixtureOptions,\n _path: options.path,\n _inputSchemaJson: toInputJsonSchema(options.inputSchema as z.ZodType | undefined),\n };\n}\n\nexport function defineDebugPanel<TState, TAction = never>(\n options: DefineDebugPanelOptions<TState, TAction>,\n): DebugPanelDefinition<TState, TAction> {\n return {\n id: options.id,\n title: options.title,\n placement: options.placement,\n _render: (container, sendAction) => {\n const view = options.render(container, {\n sendAction: (action) => sendAction(action),\n });\n return {\n update: (state) => view.update(state as TState),\n dispose: () => view.dispose(),\n };\n },\n };\n}\n\nexport function interactiveOutput<T>(options: {\n readonly getSnapshot: () => T;\n readonly activate: DebugPanelActivation<T, T>;\n}): InteractiveOutput<T> {\n return {\n [interactiveOutputBrand]: true,\n getSnapshot: options.getSnapshot,\n activate: options.activate,\n };\n}\n\nexport function isInteractiveOutput(value: unknown): value is InteractiveOutput<unknown> {\n return typeof value === 'object'\n && value !== null\n && interactiveOutputBrand in value\n && (value as Record<symbol, unknown>)[interactiveOutputBrand] === true;\n}\n\n/**\n * Defines a group of fixtures with support for nesting.\n * \n * @example\n * ```ts\n * export default defineFixtureGroup({\n * Primary: defineFixture({\n * render: (container) => { ... },\n * }),\n * Variants: defineFixtureGroup({\n * Small: defineFixture({ ... }),\n * Large: defineFixture({ ... }),\n * }),\n * });\n * ```\n */\nexport function defineFixtureGroup(entries: FixtureGroupInput): FixtureGroupExport;\nexport function defineFixtureGroup(options: DefineFixtureGroupOptions, entries: FixtureGroupInput): FixtureGroupExport;\nexport function defineFixtureGroup(optionsOrEntries: DefineFixtureGroupOptions | FixtureGroupInput, maybeEntries?: FixtureGroupInput): FixtureGroupExport {\n if (maybeEntries !== undefined) {\n const opts = optionsOrEntries as DefineFixtureGroupOptions;\n return {\n [fixtureGroupBrand]: true,\n _entries: maybeEntries,\n _path: opts.path,\n _labels: opts.labels,\n _expectedVisualDescriptions: opts.expectedVisualDescriptions,\n _inputSchemaJson: toInputJsonSchema(opts.inputSchema),\n };\n }\n return {\n [fixtureGroupBrand]: true,\n _entries: optionsOrEntries as FixtureGroupInput,\n };\n}\n\n/**\n * Defines a group of fixture variants (no nesting allowed).\n * Variants are rendered horizontally by default and have a distinct icon in the tree.\n * \n * @example\n * ```ts\n * export default defineFixtureGroup({\n * Button: defineFixtureVariants({\n * Small: defineFixture({ ... }),\n * Medium: defineFixture({ ... }),\n * Large: defineFixture({ ... }),\n * }),\n * });\n * ```\n */\nexport function defineFixtureVariants(variants: FixtureVariantsInput): FixtureVariantsExport;\nexport function defineFixtureVariants(options: DefineFixtureVariantsOptions, variants: FixtureVariantsInput): FixtureVariantsExport;\nexport function defineFixtureVariants(optionsOrVariants: DefineFixtureVariantsOptions | FixtureVariantsInput, maybeVariants?: FixtureVariantsInput): FixtureVariantsExport {\n if (maybeVariants !== undefined) {\n const opts = optionsOrVariants as DefineFixtureVariantsOptions;\n return {\n [fixtureVariantsBrand]: true,\n _variants: maybeVariants,\n _path: opts.path,\n _labels: opts.labels,\n _expectedVisualDescriptions: opts.expectedVisualDescriptions,\n _inputSchemaJson: toInputJsonSchema(opts.inputSchema),\n };\n }\n return {\n [fixtureVariantsBrand]: true,\n _variants: optionsOrVariants as FixtureVariantsInput,\n };\n}\n\n// ============================================================================\n// Render helpers\n// ============================================================================\n\n/** Already-resolved promise, reused for efficiency */\nconst resolvedPromise = Promise.resolve();\n\n/**\n * Helper for synchronous renders.\n * Executes the render function immediately and wraps the cleanup in a RenderResult.\n * \n * @param doRender - Function that renders synchronously and returns a cleanup function\n * @returns A RenderResult with an already-resolved ready promise\n * \n * @example\n * ```ts\n * render: (container, { input }) => syncRender(() => {\n * const el = document.createElement('button');\n * el.textContent = input.label;\n * container.appendChild(el);\n * return () => el.remove();\n * })\n * ```\n */\nexport function syncRender(doRender: () => (() => void) | IDisposable | void): RenderResult {\n const cleanup = doRender();\n return {\n ready: resolvedPromise,\n dispose: () => {\n if (typeof cleanup === 'function') {\n cleanup();\n } else if (cleanup && typeof cleanup.dispose === 'function') {\n cleanup.dispose();\n }\n },\n };\n}\n\n/**\n * Helper for asynchronous renders with cancellation support.\n * \n * @param signal - AbortSignal for cancellation\n * @param doRender - Async function that renders and returns a cleanup function.\n * Should check signal.aborted periodically for long operations.\n * @returns A RenderResult whose ready promise rejects with AbortError if cancelled\n * \n * @example\n * ```ts\n * render: (container, { input, signal }) => asyncRender(signal, async () => {\n * const data = await fetchData(input.url, { signal });\n * if (signal.aborted) return;\n * container.innerHTML = data;\n * return () => { container.innerHTML = ''; };\n * })\n * ```\n */\nexport function asyncRender(\n signal: AbortSignal,\n doRender: () => Promise<(() => void) | IDisposable | void>\n): RenderResult {\n let cleanup: (() => void) | IDisposable | void;\n let disposed = false;\n\n function isAborted(): boolean {\n return signal.aborted;\n }\n\n const ready = (async () => {\n if (isAborted()) {\n throw new DOMException('Render aborted', 'AbortError');\n }\n cleanup = await doRender();\n if (isAborted() || disposed) {\n // Cleanup immediately if aborted/disposed during render\n doCleanup();\n if (isAborted()) {\n throw new DOMException('Render aborted', 'AbortError');\n }\n }\n })();\n\n function doCleanup(): void {\n if (typeof cleanup === 'function') {\n cleanup();\n } else if (cleanup && typeof cleanup.dispose === 'function') {\n cleanup.dispose();\n }\n cleanup = undefined;\n }\n\n return {\n ready,\n dispose: () => {\n disposed = true;\n doCleanup();\n },\n };\n}\n","/**\n * Taken from https://semver.org/spec/v2.0.0.html.\n */\nexport const semanticVersionRegexEmbeddable = /(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?/;\n/**\n * Taken from https://semver.org/spec/v2.0.0.html.\n */\nexport const semanticVersionRegex = new RegExp(`^${semanticVersionRegexEmbeddable.source}$`);\nconst numberRegex = /0|[1-9][0-9]*/;\nexport function semanticVersionRegexGroupsToVersion(groups) {\n const prereleaseMatch = groups[4];\n const buildMatch = groups[5];\n let prereleaseInfo = null;\n if (prereleaseMatch) {\n prereleaseInfo = new PreReleaseInfo(prereleaseMatch\n .split(\".\")\n .map((r) => (r.match(numberRegex) ? parseInt(r) : r)));\n }\n const buildInfo = buildMatch !== undefined ? new BuildInfo(buildMatch.split(\".\")) : null;\n return new SemanticVersion(parseInt(groups[1]), parseInt(groups[2]), parseInt(groups[3]), prereleaseInfo, buildInfo);\n}\n/**\n * Represents a valid semantic version.\n * See https://semver.org/spec/v2.0.0.html.\n */\nexport class SemanticVersion {\n major;\n minor;\n patch;\n prerelease;\n build;\n static parse(text) {\n const exec = semanticVersionRegex.exec(text);\n if (!exec) {\n throw new Error(`Could not parse semantic version. \"${text}\" is not valid.`);\n }\n return semanticVersionRegexGroupsToVersion(exec);\n }\n constructor(major, minor, patch, prerelease, build) {\n this.major = major;\n this.minor = minor;\n this.patch = patch;\n this.prerelease = prerelease;\n this.build = build;\n function testValidNumber(n, arg) {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error(`Invalid input. \"${n}\" is not valid for ${arg}`);\n }\n }\n testValidNumber(major, \"major\");\n testValidNumber(minor, \"minor\");\n testValidNumber(patch, \"patch\");\n }\n get isStable() {\n return this.major > 0;\n }\n toString() {\n let result = `${this.major}.${this.minor}.${this.patch}`;\n if (this.prerelease) {\n result += `-${this.prerelease.toString()}`;\n }\n if (this.build) {\n result += `+${this.build.toString()}`;\n }\n return result;\n }\n equals(other) {\n return this.toString() === other.toString();\n }\n with(update) {\n function defaultIfUndefined(val, defaultVal) {\n return val !== undefined ? val : defaultVal;\n }\n function defaultIfUndefinedNumber(val, defaultVal) {\n if (val === \"increment\") {\n return defaultVal + 1;\n }\n return val !== undefined ? val : defaultVal;\n }\n return new SemanticVersion(defaultIfUndefinedNumber(update.major, this.major), defaultIfUndefinedNumber(update.minor, this.minor), defaultIfUndefinedNumber(update.patch, this.patch), defaultIfUndefined(update.prerelease, this.prerelease), defaultIfUndefined(update.build, this.build));\n }\n toJSON() {\n return {\n major: this.major,\n minor: this.minor,\n patch: this.patch,\n ...(this.prerelease ? { prerelease: this.prerelease.parts } : {}),\n ...(this.build ? { build: this.build.parts } : {}),\n };\n }\n /**\n * Returns -1 if this version is older than the other version, 0 if they are equal, or 1 if this version is newer.\n */\n compareTo(other) {\n if (this.major != other.major) {\n return comparePrimitives(this.major, other.major);\n }\n if (this.minor != other.minor) {\n return comparePrimitives(this.minor, other.minor);\n }\n if (this.patch != other.patch) {\n return comparePrimitives(this.patch, other.patch);\n }\n return PreReleaseInfo.compare(this.prerelease, other.prerelease);\n }\n}\nfunction comparePrimitives(a, b) {\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n}\nexport class PreReleaseInfo {\n parts;\n static compare(a, b) {\n if (!a && !b) {\n return 0;\n }\n if (!a) {\n // prefer non-prerelease version.\n return 1;\n }\n if (!b) {\n return -1;\n }\n return a.compareTo(b);\n }\n constructor(parts) {\n this.parts = parts;\n if (parts.length === 0) {\n throw new Error(\"Must have at least one part!\");\n }\n for (const p of parts) {\n if (typeof p === \"string\") {\n if (!/^[0-9a-zA-Z-]*[a-zA-Z-][0-9a-zA-Z-]*$/.exec(p)) {\n throw new Error(\"Invalid input! Non-number parts must have at least one non-digit!\");\n }\n }\n }\n }\n toString() {\n return this.parts.map((p) => p.toString()).join(\".\");\n }\n isNewer(other) {\n return this.compareTo(other) === 1;\n }\n isOlder(other) {\n return this.compareTo(other) === -1;\n }\n compareTo(other) {\n for (let i = 0; i < Math.max(this.parts.length, other.parts.length); i++) {\n const a = this.parts[i];\n const b = other.parts[i];\n if (a === undefined) {\n // Other has longer prerelease\n return -1;\n }\n if (b === undefined) {\n // This has longer prerelease\n return 1;\n }\n if (a !== b) {\n return comparePrimitives(a, b);\n }\n }\n return 0;\n }\n}\nexport class BuildInfo {\n parts;\n constructor(parts) {\n this.parts = parts;\n if (parts.length === 0) {\n throw new Error(\"Must have at least one part!\");\n }\n }\n toString() {\n return this.parts.join(\".\");\n }\n}\n//# sourceMappingURL=index.js.map","import { SemanticVersion } from 'semver';\n\nexport const runtimeVersion = SemanticVersion.parse('1.1.0');\n\n"],"names":["interactiveOutputBrand","singleFixtureBrand","fixtureGroupBrand","fixtureVariantsBrand","toInputJsonSchema","schema","z","defineFixture","options","defineDebugPanel","container","sendAction","view","action","state","interactiveOutput","isInteractiveOutput","value","defineFixtureGroup","optionsOrEntries","maybeEntries","opts","defineFixtureVariants","optionsOrVariants","maybeVariants","resolvedPromise","syncRender","doRender","cleanup","asyncRender","signal","disposed","isAborted","ready","doCleanup","semanticVersionRegexEmbeddable","semanticVersionRegex","numberRegex","semanticVersionRegexGroupsToVersion","groups","prereleaseMatch","buildMatch","prereleaseInfo","PreReleaseInfo","r","buildInfo","BuildInfo","SemanticVersion","major","minor","patch","prerelease","build","__publicField","testValidNumber","n","arg","text","exec","result","other","update","defaultIfUndefined","val","defaultVal","defaultIfUndefinedNumber","comparePrimitives","a","b","parts","p","i","runtimeVersion"],"mappings":";;;;kEA4FaA,IAAyB,OAAO,IAAI,iDAAiD,GA0LrFC,IAAqB,OAAO,IAAI,6CAA6C,GAG7EC,IAAoB,OAAO,IAAI,4CAA4C,GAG3EC,IAAuB,OAAO,IAAI,+CAA+C;AAiN9F,SAASC,EAAkBC,GAAwD;AACjF,MAAKA;AACL,WA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ErC;AACA,WAAO;AAAA,EACX;AACJ;AACO,MAAMtB,EAAU;AAAA,EAEnB,YAAYuB,GAAO;AADnB,IAAAhB,EAAA;AAGI,QADA,KAAK,QAAQgB,GACTA,EAAM,WAAW;AACjB,YAAM,IAAI,MAAM,8BAA8B;AAAA,EAEtD;AAAA,EACA,WAAW;AACP,WAAO,KAAK,MAAM,KAAK,GAAG;AAAA,EAC9B;AACJ;ACpLO,MAAMG,IAAiBzB,EAAgB,MAAM,OAAO;"}
package/dist/viewer.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var ut = Object.defineProperty;
2
2
  var gt = (r, e, o) => e in r ? ut(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
3
3
  var p = (r, e, o) => gt(r, typeof e != "symbol" ? e + "" : e, o);
4
- import { f as Co, e as Io, s as Fo, g as We, S as $e, r as Te, _ as mt } from "./runtimeVersion-CYbVWGhh.js";
5
- import { h as _s, d as Ss, a as Bs, b as Cs, c as Is, i as Fs, j as Es } from "./runtimeVersion-CYbVWGhh.js";
4
+ import { f as Co, e as Io, s as Fo, g as We, S as $e, r as Te, _ as mt } from "./runtimeVersion-ByhWJutT.js";
5
+ import { h as _s, d as Ss, a as Bs, b as Cs, c as Is, i as Fs, j as Es } from "./runtimeVersion-ByhWJutT.js";
6
6
  import { createRoot as go } from "react-dom/client";
7
7
  import * as hr from "react";
8
8
  import { createContext as fr, useReducer as ht, useState as ft, useContext as bt, useEffect as Eo, createElement as xt } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/component-explorer",
3
- "version": "0.2.1-83",
3
+ "version": "0.2.1-85",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",