@vscode/component-explorer 0.2.1-4 → 0.2.1-6

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 r } from "./runtimeVersion-Dui0_X4f.js";
2
- import { d as s, a as n, b as t, f as u, c as f, r as o, s as d } from "./runtimeVersion-Dui0_X4f.js";
1
+ import { _ as r } from "./runtimeVersion-BpYdhxdg.js";
2
+ import { d as s, a as n, b as t, f as u, c as f, r as o, s as d } from "./runtimeVersion-BpYdhxdg.js";
3
3
  globalThis._buildInfo = r;
4
4
  export {
5
5
  s as defineFixture,
@@ -1,28 +1,14 @@
1
1
  import { RenderReport } from '../core/ErrorInfo.js';
2
2
  import { ExplorerRuntime, FixtureModules } from '../core/index.js';
3
+ import { HeadlessFlatFixture, IComponentExplorerGlobal } from '@vscode/component-explorer-common';
3
4
  declare global {
4
- interface Window {
5
- __componentExplorer__?: HeadlessApi;
5
+ interface Window extends IComponentExplorerGlobal {
6
6
  }
7
7
  }
8
- interface HeadlessApi {
9
- readonly sessionId: string;
10
- readonly updateVersion: number;
11
- readonly runtimeVersion: string;
12
- listFixtures(): Promise<FlatFixture[]>;
13
- renderFixture(fixtureId: string): Promise<RenderReport>;
14
- }
15
- interface FlatFixture {
16
- readonly fixtureId: string;
17
- readonly fixtureName: string;
18
- readonly groupPath: string[];
19
- readonly background: 'light' | 'dark';
20
- readonly labels: readonly string[];
21
- readonly expectedVisualDescriptions: readonly string[];
22
- }
23
8
  export declare class HeadlessMode implements ExplorerRuntime {
24
9
  private readonly _containerElement;
25
- readonly sessionId: string;
10
+ /** Random ID generated on construction — changes on full page reload. */
11
+ readonly pageInstanceId: string;
26
12
  private _updateVersion;
27
13
  private _root;
28
14
  private _fixtureModules;
@@ -34,12 +20,12 @@ export declare class HeadlessMode implements ExplorerRuntime {
34
20
  get updateVersion(): number;
35
21
  updateFixtures(fixtureModules: FixtureModules): void;
36
22
  bumpVersion(): void;
37
- listFixtures(): Promise<FlatFixture[]>;
23
+ listFixtures(): Promise<HeadlessFlatFixture[]>;
24
+ disposeCurrentFixture(): void;
38
25
  renderFixture(fixtureId: string): Promise<RenderReport>;
39
26
  private _buildTree;
40
27
  private _flattenFixtures;
41
28
  private _findFixtureNode;
42
29
  private _installGlobalApi;
43
30
  }
44
- export {};
45
31
  //# sourceMappingURL=HeadlessMode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeadlessMode.d.ts","sourceRoot":"","sources":["../../src/modes/HeadlessMode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA+B,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKxE,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,qBAAqB,CAAC,EAAE,WAAW,CAAC;KACpC;CACD;AAED,UAAU,WAAW;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACvC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACxD;AAED,UAAU,WAAW;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,0BAA0B,EAAE,SAAS,MAAM,EAAE,CAAC;CACvD;AAED,qBAAa,YAAa,YAAW,eA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AC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,iBAAiB,CAA0B;gBAGjC,iBAAiB,EAAE,WAAW,EAC/C,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC;IAwBtC,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IASpD,WAAW,IAAI,IAAI;IAKb,YAAY,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAQpD,qBAAqB,IAAI,IAAI;IAWvB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAoF7D,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,iBAAiB;CAYzB"}
@@ -1,7 +1,7 @@
1
1
  var m = Object.defineProperty;
2
2
  var b = (r, e, t) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var o = (r, e, t) => b(r, typeof e != "symbol" ? e + "" : e, t);
4
- const A = { version: "0.3.0", date: "2026-03-30T19:50:53.847Z" }, x = Symbol.for("@vscode/component-explorer/singleFixture/v1"), l = Symbol.for("@vscode/component-explorer/fixtureGroup/v1"), f = Symbol.for("@vscode/component-explorer/fixtureVariants/v1");
4
+ const A = { version: "0.3.0", date: "2026-03-31T13:23:59.020Z" }, x = Symbol.for("@vscode/component-explorer/singleFixture/v1"), l = Symbol.for("@vscode/component-explorer/fixtureGroup/v1"), f = Symbol.for("@vscode/component-explorer/fixtureVariants/v1");
5
5
  function y(r) {
6
6
  return {
7
7
  [x]: !0,
@@ -196,4 +196,4 @@ export {
196
196
  z as r,
197
197
  x as s
198
198
  };
199
- //# sourceMappingURL=runtimeVersion-Dui0_X4f.js.map
199
+ //# sourceMappingURL=runtimeVersion-BpYdhxdg.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeVersion-Dui0_X4f.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\n// ============================================================================\n// Types for fixture definition (re-exported for convenience)\n// ============================================================================\n\n/**\n * Disposable resource that can be cleaned up.\n */\nexport interface IDisposable {\n dispose(): void;\n}\n\n/** @deprecated Use IDisposable instead */\nexport type Disposable = IDisposable;\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 * Can be omitted if no cleanup is needed.\n */\n dispose?(): void;\n\n /**\n * Arbitrary data to include in the render report.\n * Visible to the CLI and MCP tools.\n */\n readonly data?: 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 */\nexport interface RenderContext {\n /** AbortSignal for cancellation; check signal.aborted or listen to 'abort' event */\n readonly signal: AbortSignal;\n}\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// 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 */\nexport interface DefineFixtureOptions {\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 * Render the component into the container.\n * \n * @param container - The DOM element to render into\n * @param context - Render context containing props and abort signal\n * @returns Optional RenderResult, or a Promise that resolves to one\n */\n render: (container: HTMLElement, context: RenderContext) => 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}\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}\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}\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/**\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// ============================================================================\n// Define fixture functions\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, { props }) => {\n * container.innerHTML = `<button>${props.label}</button>`;\n * },\n * });\n * \n * // With cleanup\n * export default defineFixture({\n * render: (container, { props }) => {\n * const root = createRoot(container);\n * root.render(<Button label={props.label} />);\n * return { dispose: () => root.unmount() };\n * },\n * });\n * \n * // Async render\n * export default defineFixture({\n * render: async (container, { props, signal }) => {\n * const data = await fetch(props.url, { signal });\n * container.innerHTML = await data.text();\n * return { dispose: () => { container.innerHTML = ''; } };\n * },\n * });\n * ```\n */\nexport function defineFixture(options: DefineFixtureOptions): SingleFixtureExport {\n return {\n [singleFixtureBrand]: true,\n _options: options,\n _path: options.path,\n };\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 };\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 };\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, { props }) => syncRender(() => {\n * const el = document.createElement('button');\n * el.textContent = props.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, { props, signal }) => asyncRender(signal, async () => {\n * const data = await fetchData(props.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.0.0');\n\n"],"names":["singleFixtureBrand","fixtureGroupBrand","fixtureVariantsBrand","defineFixture","options","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":";;;kEA+GaA,IAAqB,OAAO,IAAI,6CAA6C,GAG7EC,IAAoB,OAAO,IAAI,4CAA4C,GAG3EC,IAAuB,OAAO,IAAI,+CAA+C;AAsLvF,SAASC,EAAcC,GAAoD;AAChF,SAAO;AAAA,IAC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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-BpYdhxdg.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\n// ============================================================================\n// Types for fixture definition (re-exported for convenience)\n// ============================================================================\n\n/**\n * Disposable resource that can be cleaned up.\n */\nexport interface IDisposable {\n dispose(): void;\n}\n\n/** @deprecated Use IDisposable instead */\nexport type Disposable = IDisposable;\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 * Can be omitted if no cleanup is needed.\n */\n dispose?(): void;\n\n /**\n * Arbitrary data to include in the render report.\n * Visible to the CLI and MCP tools.\n */\n readonly data?: 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 */\nexport interface RenderContext {\n /** AbortSignal for cancellation; check signal.aborted or listen to 'abort' event */\n readonly signal: AbortSignal;\n}\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// 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 */\nexport interface DefineFixtureOptions {\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 * Render the component into the container.\n * \n * @param container - The DOM element to render into\n * @param context - Render context containing props and abort signal\n * @returns Optional RenderResult, or a Promise that resolves to one\n */\n render: (container: HTMLElement, context: RenderContext) => 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}\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}\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}\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/**\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// ============================================================================\n// Define fixture functions\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, { props }) => {\n * container.innerHTML = `<button>${props.label}</button>`;\n * },\n * });\n * \n * // With cleanup\n * export default defineFixture({\n * render: (container, { props }) => {\n * const root = createRoot(container);\n * root.render(<Button label={props.label} />);\n * return { dispose: () => root.unmount() };\n * },\n * });\n * \n * // Async render\n * export default defineFixture({\n * render: async (container, { props, signal }) => {\n * const data = await fetch(props.url, { signal });\n * container.innerHTML = await data.text();\n * return { dispose: () => { container.innerHTML = ''; } };\n * },\n * });\n * ```\n */\nexport function defineFixture(options: DefineFixtureOptions): SingleFixtureExport {\n return {\n [singleFixtureBrand]: true,\n _options: options,\n _path: options.path,\n };\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 };\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 };\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, { props }) => syncRender(() => {\n * const el = document.createElement('button');\n * el.textContent = props.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, { props, signal }) => asyncRender(signal, async () => {\n * const data = await fetchData(props.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.0.0');\n\n"],"names":["singleFixtureBrand","fixtureGroupBrand","fixtureVariantsBrand","defineFixture","options","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":";;;kEA+GaA,IAAqB,OAAO,IAAI,6CAA6C,GAG7EC,IAAoB,OAAO,IAAI,4CAA4C,GAG3EC,IAAuB,OAAO,IAAI,+CAA+C;AAsLvF,SAASC,EAAcC,GAAoD;AAChF,SAAO;AAAA,IACL,CAACJ,CAAkB,GAAG;AAAA,IACtB,UAAUI;AAAA,IACV,OAAOA,EAAQ;AAAA,EAAA;AAEnB;AAoBO,SAASC,EAAmBC,GAAiEC,GAAsD;AACxJ,MAAIA,MAAiB,QAAW;AAC9B,UAAMC,IAAOF;AACb,WAAO;AAAA,MACL,CAACL,CAAiB,GAAG;AAAA,MACrB,UAAUM;AAAA,MACV,OAAOC,EAAK;AAAA,MACZ,SAASA,EAAK;AAAA,MACd,6BAA6BA,EAAK;AAAA,IAAA;AAAA,EAEtC;AACA,SAAO;AAAA,IACL,CAACP,CAAiB,GAAG;AAAA,IACrB,UAAUK;AAAA,EAAA;AAEd;AAmBO,SAASG,EAAsBC,GAAwEC,GAA6D;AACzK,MAAIA,MAAkB,QAAW;AAC/B,UAAMH,IAAOE;AACb,WAAO;AAAA,MACL,CAACR,CAAoB,GAAG;AAAA,MACxB,WAAWS;AAAA,MACX,OAAOH,EAAK;AAAA,MACZ,SAASA,EAAK;AAAA,MACd,6BAA6BA,EAAK;AAAA,IAAA;AAAA,EAEtC;AACA,SAAO;AAAA,IACL,CAACN,CAAoB,G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
  var Ko = (r, e, o) => e in r ? Qo(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
3
3
  var l = (r, e, o) => Ko(r, typeof e != "symbol" ? e + "" : e, o);
4
- import { f as De, c as Ne, s as Ae, S as me, r as ae, _ as Jo } from "./runtimeVersion-Dui0_X4f.js";
5
- import { e as zt, d as Pt, a as Wt, b as $t, g as jt } from "./runtimeVersion-Dui0_X4f.js";
4
+ import { f as De, c as Ne, s as Ae, S as me, r as ae, _ as Jo } from "./runtimeVersion-BpYdhxdg.js";
5
+ import { e as zt, d as Pt, a as Wt, b as $t, g as jt } from "./runtimeVersion-BpYdhxdg.js";
6
6
  import { createRoot as Yo } from "react-dom/client";
7
7
  import * as uo from "react";
8
8
  import { createContext as mo, useReducer as Zo, useState as Xo, useContext as er, useEffect as Ge, createElement as or } from "react";
@@ -4163,7 +4163,8 @@ class wt {
4163
4163
  }
4164
4164
  class Bt {
4165
4165
  constructor(e, o) {
4166
- l(this, "sessionId", Math.random().toString(36).slice(2));
4166
+ /** Random ID generated on construction — changes on full page reload. */
4167
+ l(this, "pageInstanceId", Math.random().toString(36).slice(2));
4167
4168
  l(this, "_updateVersion", 0);
4168
4169
  l(this, "_root");
4169
4170
  l(this, "_fixtureModules");
@@ -4180,7 +4181,7 @@ class Bt {
4180
4181
  (n) => {
4181
4182
  this._loadError = n instanceof Error ? n.stack ?? n.message : String(n), this._updateVersion++, console.error("[headless] Failed to load fixtures:", this._loadError);
4182
4183
  }
4183
- ), this._installGlobalApi(), console.log("[headless] Initialized, sessionId:", this.sessionId);
4184
+ ), this._installGlobalApi(), console.log("[headless] Initialized, pageInstanceId:", this.pageInstanceId);
4184
4185
  }
4185
4186
  get updateVersion() {
4186
4187
  return this._updateVersion;
@@ -4198,11 +4199,14 @@ class Bt {
4198
4199
  throw new Error(this._loadError);
4199
4200
  return this._flattenFixtures(this._root);
4200
4201
  }
4202
+ disposeCurrentFixture() {
4203
+ this._currentRendering && (this._currentRendering.dispose(), this._currentRendering = void 0), this._currentContainer && (this._currentContainer.remove(), this._currentContainer = void 0);
4204
+ }
4201
4205
  async renderFixture(e) {
4202
4206
  const o = this._findFixtureNode(this._root, e);
4203
4207
  if (!o || !o.component)
4204
4208
  throw new Error("Fixture not found: " + e);
4205
- this._currentRendering && (this._currentRendering.dispose(), this._currentRendering = void 0), this._currentContainer && (this._currentContainer.remove(), this._currentContainer = void 0);
4209
+ this.disposeCurrentFixture();
4206
4210
  const n = document.createElement("div");
4207
4211
  n.style.display = "inline-block", this._containerElement.appendChild(n), this._currentContainer = n;
4208
4212
  const t = o.component, i = [];
@@ -4271,13 +4275,14 @@ class Bt {
4271
4275
  }
4272
4276
  _installGlobalApi() {
4273
4277
  const e = this, o = {
4274
- sessionId: this.sessionId,
4278
+ pageInstanceId: this.pageInstanceId,
4275
4279
  get updateVersion() {
4276
4280
  return e._updateVersion;
4277
4281
  },
4278
4282
  runtimeVersion: ae.toString(),
4279
4283
  listFixtures: () => this.listFixtures(),
4280
- renderFixture: (n) => this.renderFixture(n)
4284
+ renderFixture: (n) => this.renderFixture(n),
4285
+ disposeCurrentFixture: () => this.disposeCurrentFixture()
4281
4286
  };
4282
4287
  window.__componentExplorer__ = o;
4283
4288
  }