@vscode/component-explorer 0.1.1-2 → 0.1.1-21
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/LICENSE +21 -0
- package/SECURITY.md +14 -0
- package/dist/component-explorer.css +1 -0
- package/dist/components/Explorer.d.ts +9 -4
- package/dist/components/Explorer.d.ts.map +1 -1
- package/dist/components/ExplorerModel.d.ts +45 -3
- package/dist/components/ExplorerModel.d.ts.map +1 -1
- package/dist/components/FixturePreviewItem.d.ts +1 -1
- package/dist/components/FixturePreviewItem.d.ts.map +1 -1
- package/dist/components/FixtureScreenshotView.d.ts +12 -0
- package/dist/components/FixtureScreenshotView.d.ts.map +1 -0
- package/dist/components/LeftSidebar.d.ts.map +1 -1
- package/dist/components/PreviewArea.d.ts.map +1 -1
- package/dist/components/ReportComparisonRow.d.ts +16 -0
- package/dist/components/ReportComparisonRow.d.ts.map +1 -0
- package/dist/components/ScreenshotComparisonRow.d.ts +12 -0
- package/dist/components/ScreenshotComparisonRow.d.ts.map +1 -0
- package/dist/components/SearchInput.d.ts +6 -0
- package/dist/components/SearchInput.d.ts.map +1 -0
- package/dist/components/TitleBar.d.ts.map +1 -1
- package/dist/components/TreeView.d.ts.map +1 -1
- package/dist/components/index.d.ts +6 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/treeFilter.d.ts +3 -0
- package/dist/components/treeFilter.d.ts.map +1 -0
- package/dist/components/types.d.ts +1 -0
- package/dist/components/types.d.ts.map +1 -1
- package/dist/core/CliRuntime.d.ts +50 -0
- package/dist/core/CliRuntime.d.ts.map +1 -0
- package/dist/core/ComponentRenderer.d.ts +14 -0
- package/dist/core/ComponentRenderer.d.ts.map +1 -0
- package/dist/core/ErrorInfo.d.ts +29 -0
- package/dist/core/ErrorInfo.d.ts.map +1 -0
- package/dist/core/FixtureNode.d.ts +4 -1
- package/dist/core/FixtureNode.d.ts.map +1 -1
- package/dist/core/FixtureRegistry.d.ts +2 -1
- package/dist/core/FixtureRegistry.d.ts.map +1 -1
- package/dist/core/fixtureApi.d.ts +353 -0
- package/dist/core/fixtureApi.d.ts.map +1 -0
- package/dist/core/fixtureApiConsumer.d.ts +85 -0
- package/dist/core/fixtureApiConsumer.d.ts.map +1 -0
- package/dist/core/index.d.ts +7 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/daemon/DaemonConfig.d.ts +19 -0
- package/dist/daemon/DaemonConfig.d.ts.map +1 -0
- package/dist/daemon/DaemonModel.d.ts +59 -0
- package/dist/daemon/DaemonModel.d.ts.map +1 -0
- package/dist/daemon/index.d.ts +5 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/index-BsQr630j.js +80 -0
- package/dist/index-BsQr630j.js.map +1 -0
- package/dist/index.d.ts +8 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -8693
- package/dist/index.js.map +1 -1
- package/dist/lib/fixtureFocusTrap.d.ts +2 -0
- package/dist/lib/fixtureFocusTrap.d.ts.map +1 -0
- package/dist/lib/fixtureSizeCache.d.ts +1 -10
- package/dist/lib/fixtureSizeCache.d.ts.map +1 -1
- package/dist/lib/queryParamObservable.d.ts +4 -0
- package/dist/lib/queryParamObservable.d.ts.map +1 -0
- package/dist/report/ReportModel.d.ts +23 -0
- package/dist/report/ReportModel.d.ts.map +1 -0
- package/dist/report/ScreenshotReport.d.ts +25 -0
- package/dist/report/ScreenshotReport.d.ts.map +1 -0
- package/dist/report/index.d.ts +3 -0
- package/dist/report/index.d.ts.map +1 -0
- package/dist/viewer.d.ts +52 -0
- package/dist/viewer.d.ts.map +1 -0
- package/dist/viewer.js +3903 -0
- package/dist/viewer.js.map +1 -0
- package/package.json +25 -4
- package/dist/core/ComponentDefinition.d.ts +0 -70
- package/dist/core/ComponentDefinition.d.ts.map +0 -1
- package/dist/core/defineFixture.d.ts +0 -109
- package/dist/core/defineFixture.d.ts.map +0 -1
- package/dist/index.css +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { RenderReport } from './ErrorInfo.js';
|
|
2
|
+
export interface FixtureModules {
|
|
3
|
+
[path: string]: {
|
|
4
|
+
default?: unknown;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
interface FlatFixture {
|
|
8
|
+
readonly fixtureId: string;
|
|
9
|
+
readonly fixtureName: string;
|
|
10
|
+
readonly groupPath: string[];
|
|
11
|
+
readonly background: 'light' | 'dark';
|
|
12
|
+
readonly labels: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
interface CliApi {
|
|
15
|
+
readonly sessionId: string;
|
|
16
|
+
readonly updateVersion: number;
|
|
17
|
+
listFixtures(): FlatFixture[];
|
|
18
|
+
renderFixture(fixtureId: string): Promise<RenderReport>;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface Window {
|
|
22
|
+
__componentExplorerCli__?: CliApi;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Runtime for the CLI/screenshot mode.
|
|
27
|
+
* Manages fixture registration, rendering, and HMR versioning.
|
|
28
|
+
* Installs itself as `window.__componentExplorerCli__`.
|
|
29
|
+
*/
|
|
30
|
+
export declare class CliRuntime {
|
|
31
|
+
private readonly _containerElement;
|
|
32
|
+
readonly sessionId: string;
|
|
33
|
+
private _updateVersion;
|
|
34
|
+
private _root;
|
|
35
|
+
private _fixtureModules;
|
|
36
|
+
private _currentRendering;
|
|
37
|
+
private _currentContainer;
|
|
38
|
+
constructor(_containerElement: HTMLElement, fixtureModules: FixtureModules);
|
|
39
|
+
get updateVersion(): number;
|
|
40
|
+
updateFixtures(fixtureModules: FixtureModules): void;
|
|
41
|
+
bumpVersion(): void;
|
|
42
|
+
listFixtures(): FlatFixture[];
|
|
43
|
+
renderFixture(fixtureId: string): Promise<RenderReport>;
|
|
44
|
+
private _buildRegistry;
|
|
45
|
+
private _flattenFixtures;
|
|
46
|
+
private _findFixtureNode;
|
|
47
|
+
private _installGlobalApi;
|
|
48
|
+
}
|
|
49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c,EAAE,cAAc;IAU/B,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IAQpD,WAAW,IAAI,IAAI;IAKnB,YAAY,IAAI,WAAW,EAAE;IAIvB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAgG7D,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,iBAAiB;CAYzB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentDefinition } from './fixtureApiConsumer.js';
|
|
2
|
+
import { RenderReturn } from './fixtureApi.js';
|
|
3
|
+
export declare class ComponentRendering {
|
|
4
|
+
readonly component: ComponentDefinition;
|
|
5
|
+
readonly renderTarget: HTMLElement;
|
|
6
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
7
|
+
private readonly _abortController;
|
|
8
|
+
private readonly _rawResult;
|
|
9
|
+
private _resolvedResult;
|
|
10
|
+
get result(): RenderReturn;
|
|
11
|
+
constructor(host: HTMLElement, component: ComponentDefinition);
|
|
12
|
+
dispose(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ComponentRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentRenderer.d.ts","sourceRoot":"","sources":["../../src/core/ComponentRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AAGlE,qBAAa,kBAAkB;IASC,QAAQ,CAAC,SAAS,EAAE,mBAAmB;IARtE,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IACvC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAyB;IAC1D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,eAAe,CAA2B;IAElD,IAAI,MAAM,IAAI,YAAY,CAA4B;gBAE1C,IAAI,EAAE,WAAW,EAAW,SAAS,EAAE,mBAAmB;IA6DtE,OAAO,IAAI,IAAI;CAKf"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error captured during fixture rendering.
|
|
3
|
+
* Can be either an unhandled exception or a console error/warning.
|
|
4
|
+
*/
|
|
5
|
+
export type ErrorInfo = ExceptionError | ConsoleError;
|
|
6
|
+
/**
|
|
7
|
+
* Unhandled exception thrown during render.
|
|
8
|
+
*/
|
|
9
|
+
export interface ExceptionError {
|
|
10
|
+
readonly kind: 'exception';
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly stack?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Console error or warning captured during render.
|
|
16
|
+
*/
|
|
17
|
+
export interface ConsoleError {
|
|
18
|
+
readonly kind: 'console';
|
|
19
|
+
readonly level: 'error' | 'warn';
|
|
20
|
+
readonly message: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Result of rendering a fixture, including any captured errors.
|
|
24
|
+
*/
|
|
25
|
+
export interface RenderReport {
|
|
26
|
+
/** Errors captured during rendering (exceptions and console.error/warn) */
|
|
27
|
+
readonly errors: ErrorInfo[];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ErrorInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorInfo.d.ts","sourceRoot":"","sources":["../../src/core/ErrorInfo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,YAAY,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;CAC7B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FixtureExport } from './fixtureApi.js';
|
|
2
|
+
import { ComponentDefinition } from './fixtureApiConsumer.js';
|
|
2
3
|
/**
|
|
3
4
|
* A node in the fixture tree.
|
|
4
5
|
* Can be a folder (with children), variants (with children, horizontal layout), or a component leaf.
|
|
@@ -14,6 +15,8 @@ export interface FixtureNode {
|
|
|
14
15
|
readonly children?: readonly FixtureNode[];
|
|
15
16
|
/** Component definition (only for component nodes) */
|
|
16
17
|
readonly component?: ComponentDefinition;
|
|
18
|
+
/** Labels for categorization and filtering */
|
|
19
|
+
readonly labels: readonly string[];
|
|
17
20
|
}
|
|
18
21
|
/**
|
|
19
22
|
* Creates a fixture tree from a map of fixture exports.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixtureNode.d.ts","sourceRoot":"","sources":["../../src/core/FixtureNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"FixtureNode.d.ts","sourceRoot":"","sources":["../../src/core/FixtureNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAKH,KAAK,mBAAmB,EAC3B,MAAM,yBAAyB,CAAC;AA8CjC;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,kGAAkG;IAClG,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;IAEnD,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAE3C,sDAAsD;IACtD,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEzC,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,WAAW,CAiBnF;AA6HD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,GAAG,SAAS,CAezF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,mBAAmB,EAAE,CAU1E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IObservable, IReader } from '@vscode/observables';
|
|
2
|
-
import {
|
|
2
|
+
import { FixtureExport } from './fixtureApi.js';
|
|
3
|
+
import { ComponentDefinition } from './fixtureApiConsumer.js';
|
|
3
4
|
import { FixtureNode } from './FixtureNode.js';
|
|
4
5
|
/**
|
|
5
6
|
* Registry for discovered fixtures.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixtureRegistry.d.ts","sourceRoot":"","sources":["../../src/core/FixtureRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"FixtureRegistry.d.ts","sourceRoot":"","sources":["../../src/core/FixtureRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAqC,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEvF;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgE;IAE1F,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,WAAW,CAAC,CAGpC;IAEH;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,IAAI;IAM1D;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAO9B;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,GAAG,SAAS;IAKjE;;;OAGG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,mBAAmB,GAAG,SAAS;CAMpE"}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public Fixture API
|
|
3
|
+
*
|
|
4
|
+
* This module is the public API for defining fixtures.
|
|
5
|
+
* It's designed to be stable across versions - projects can use a different
|
|
6
|
+
* @vscode/component-explorer version than the explorer viewer uses.
|
|
7
|
+
*
|
|
8
|
+
* Use Symbol.for() instead of Symbol() so the same symbol is shared across
|
|
9
|
+
* different versions of this package.
|
|
10
|
+
*
|
|
11
|
+
* @module fixtureApi
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Disposable resource that can be cleaned up.
|
|
15
|
+
*/
|
|
16
|
+
export interface IDisposable {
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
/** @deprecated Use IDisposable instead */
|
|
20
|
+
export type Disposable = IDisposable;
|
|
21
|
+
/**
|
|
22
|
+
* Result of a render operation.
|
|
23
|
+
* Supports both sync and async rendering with cancellation.
|
|
24
|
+
* All fields are optional for simple use cases.
|
|
25
|
+
*/
|
|
26
|
+
export interface RenderResult {
|
|
27
|
+
/**
|
|
28
|
+
* Resolves when the component is fully rendered and ready.
|
|
29
|
+
* For sync renders, this can be omitted (treated as immediately ready).
|
|
30
|
+
* Rejects if the render is aborted via the AbortSignal.
|
|
31
|
+
*/
|
|
32
|
+
readonly ready?: Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Cleanup function. Called when the fixture is unmounted.
|
|
35
|
+
* Can be omitted if no cleanup is needed.
|
|
36
|
+
*/
|
|
37
|
+
dispose?(): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* What the render function can return.
|
|
41
|
+
* - undefined: no cleanup needed, immediately ready
|
|
42
|
+
* - RenderResult: object with optional ready/dispose
|
|
43
|
+
* - Promise<...>: async render that resolves to undefined or RenderResult
|
|
44
|
+
*/
|
|
45
|
+
export type RenderReturn = RenderResult | undefined | void | Promise<RenderResult | undefined | void>;
|
|
46
|
+
/**
|
|
47
|
+
* Context passed to the render function.
|
|
48
|
+
*/
|
|
49
|
+
export interface RenderContext {
|
|
50
|
+
/** Property values based on the property schema */
|
|
51
|
+
readonly props: Record<string, unknown>;
|
|
52
|
+
/** AbortSignal for cancellation; check signal.aborted or listen to 'abort' event */
|
|
53
|
+
readonly signal: AbortSignal;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Style definition for shadow DOM injection.
|
|
57
|
+
*/
|
|
58
|
+
export type StyleDefinition = {
|
|
59
|
+
readonly type: 'css';
|
|
60
|
+
readonly content: string;
|
|
61
|
+
} | {
|
|
62
|
+
readonly type: 'url';
|
|
63
|
+
readonly href: string;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: 'adopted';
|
|
66
|
+
readonly sheet: CSSStyleSheet;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Display mode for a component.
|
|
70
|
+
*/
|
|
71
|
+
export type DisplayMode = PageMode | ComponentMode;
|
|
72
|
+
/**
|
|
73
|
+
* Page mode - component fills a viewport with device presets.
|
|
74
|
+
*/
|
|
75
|
+
export interface PageMode {
|
|
76
|
+
readonly type: 'page';
|
|
77
|
+
readonly viewports: ViewportPreset[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Component mode - renders at natural size.
|
|
81
|
+
*/
|
|
82
|
+
export interface ComponentMode {
|
|
83
|
+
readonly type: 'component';
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Viewport preset - either a named preset or custom dimensions.
|
|
87
|
+
*/
|
|
88
|
+
export type ViewportPreset = ViewportPresetName | {
|
|
89
|
+
readonly name: string;
|
|
90
|
+
readonly width: number;
|
|
91
|
+
readonly height: number;
|
|
92
|
+
};
|
|
93
|
+
export type ViewportPresetName = 'mobile' | 'tablet' | 'desktop';
|
|
94
|
+
/**
|
|
95
|
+
* Schema for a component property.
|
|
96
|
+
*/
|
|
97
|
+
export type PropertySchema = BooleanProperty | StringProperty | NumberProperty | EnumProperty;
|
|
98
|
+
export interface BooleanProperty {
|
|
99
|
+
readonly type: 'boolean';
|
|
100
|
+
readonly name: string;
|
|
101
|
+
readonly defaultValue: boolean;
|
|
102
|
+
readonly description?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface StringProperty {
|
|
105
|
+
readonly type: 'string';
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly defaultValue: string;
|
|
108
|
+
readonly description?: string;
|
|
109
|
+
readonly multiline?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface NumberProperty {
|
|
112
|
+
readonly type: 'number';
|
|
113
|
+
readonly name: string;
|
|
114
|
+
readonly defaultValue: number;
|
|
115
|
+
readonly description?: string;
|
|
116
|
+
readonly min?: number;
|
|
117
|
+
readonly max?: number;
|
|
118
|
+
readonly step?: number;
|
|
119
|
+
}
|
|
120
|
+
export interface EnumProperty {
|
|
121
|
+
readonly type: 'enum';
|
|
122
|
+
readonly name: string;
|
|
123
|
+
readonly defaultValue: string;
|
|
124
|
+
readonly description?: string;
|
|
125
|
+
readonly options: readonly string[];
|
|
126
|
+
}
|
|
127
|
+
/** Brand symbol to identify single fixtures */
|
|
128
|
+
export declare const singleFixtureBrand: unique symbol;
|
|
129
|
+
/** Brand symbol to identify fixture groups */
|
|
130
|
+
export declare const fixtureGroupBrand: unique symbol;
|
|
131
|
+
/** Brand symbol to identify fixture variants */
|
|
132
|
+
export declare const fixtureVariantsBrand: unique symbol;
|
|
133
|
+
/**
|
|
134
|
+
* Options for defining a single component fixture.
|
|
135
|
+
*/
|
|
136
|
+
export interface DefineFixtureOptions {
|
|
137
|
+
/**
|
|
138
|
+
* Path in the explorer tree.
|
|
139
|
+
* - `undefined` (default): use fixture filename only
|
|
140
|
+
* - `'Foo/Bar'`: exact path (fixture filename NOT appended)
|
|
141
|
+
* - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})
|
|
142
|
+
*
|
|
143
|
+
* @throws Error if path contains empty segments (e.g., '/foo', 'foo//bar')
|
|
144
|
+
*/
|
|
145
|
+
path?: string;
|
|
146
|
+
/** Optional description for documentation */
|
|
147
|
+
description?: string;
|
|
148
|
+
/** How to isolate: 'iframe' for full isolation, 'shadow-dom' (default) for lighter isolation */
|
|
149
|
+
isolation?: 'iframe' | 'shadow-dom';
|
|
150
|
+
/** Display mode: defaults to { type: 'component' } */
|
|
151
|
+
displayMode?: DisplayMode;
|
|
152
|
+
/** Styles to inject (for shadow-dom isolation) */
|
|
153
|
+
styles?: StyleDefinition[];
|
|
154
|
+
/** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */
|
|
155
|
+
background?: 'light' | 'dark';
|
|
156
|
+
/** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */
|
|
157
|
+
labels?: readonly string[];
|
|
158
|
+
/** Property definitions */
|
|
159
|
+
properties?: PropertySchema[];
|
|
160
|
+
/**
|
|
161
|
+
* Render the component into the container.
|
|
162
|
+
*
|
|
163
|
+
* @param container - The DOM element to render into
|
|
164
|
+
* @param context - Render context containing props and abort signal
|
|
165
|
+
* @returns Optional RenderResult, or a Promise that resolves to one
|
|
166
|
+
*/
|
|
167
|
+
render: (container: HTMLElement, context: RenderContext) => RenderReturn;
|
|
168
|
+
}
|
|
169
|
+
/** @deprecated Use DefineFixtureOptions instead */
|
|
170
|
+
export type DefineComponentOptions = DefineFixtureOptions;
|
|
171
|
+
/**
|
|
172
|
+
* A single fixture export created by defineFixture().
|
|
173
|
+
*/
|
|
174
|
+
export interface SingleFixtureExport {
|
|
175
|
+
readonly [singleFixtureBrand]: true;
|
|
176
|
+
readonly _options: DefineFixtureOptions;
|
|
177
|
+
readonly _path?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Group entry: either a single fixture, a nested group, or variants.
|
|
181
|
+
*/
|
|
182
|
+
export type FixtureGroupEntry = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;
|
|
183
|
+
/**
|
|
184
|
+
* A fixture group export created by defineFixtureGroup().
|
|
185
|
+
*/
|
|
186
|
+
export interface FixtureGroupExport {
|
|
187
|
+
readonly [fixtureGroupBrand]: true;
|
|
188
|
+
readonly _entries: {
|
|
189
|
+
[key: string]: FixtureGroupEntry;
|
|
190
|
+
};
|
|
191
|
+
readonly _path?: string;
|
|
192
|
+
readonly _labels?: readonly string[];
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A fixture variants export created by defineFixtureVariants().
|
|
196
|
+
*/
|
|
197
|
+
export interface FixtureVariantsExport {
|
|
198
|
+
readonly [fixtureVariantsBrand]: true;
|
|
199
|
+
readonly _variants: {
|
|
200
|
+
[key: string]: SingleFixtureExport;
|
|
201
|
+
};
|
|
202
|
+
readonly _path?: string;
|
|
203
|
+
readonly _labels?: readonly string[];
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Fixture export type - a single fixture, a group, or variants.
|
|
207
|
+
*/
|
|
208
|
+
export type FixtureExport = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;
|
|
209
|
+
/**
|
|
210
|
+
* Input for defineFixtureGroup.
|
|
211
|
+
*/
|
|
212
|
+
export type FixtureGroupInput = {
|
|
213
|
+
[key: string]: FixtureGroupEntry;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Options for defineFixtureGroup with optional path.
|
|
217
|
+
*/
|
|
218
|
+
export interface DefineFixtureGroupOptions {
|
|
219
|
+
/**
|
|
220
|
+
* Path in the explorer tree.
|
|
221
|
+
* - `undefined` (default): use fixture filename only
|
|
222
|
+
* - `'Foo/Bar'`: exact path (fixture filename NOT appended)
|
|
223
|
+
* - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})
|
|
224
|
+
*/
|
|
225
|
+
path?: string;
|
|
226
|
+
/** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */
|
|
227
|
+
labels?: readonly string[];
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Input for defineFixtureVariants (only single fixtures, no nesting).
|
|
231
|
+
*/
|
|
232
|
+
export type FixtureVariantsInput = {
|
|
233
|
+
[key: string]: SingleFixtureExport;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Options for defineFixtureVariants with optional path.
|
|
237
|
+
*/
|
|
238
|
+
export interface DefineFixtureVariantsOptions {
|
|
239
|
+
/**
|
|
240
|
+
* Path in the explorer tree.
|
|
241
|
+
* - `undefined` (default): use fixture filename only
|
|
242
|
+
* - `'Foo/Bar'`: exact path (fixture filename NOT appended)
|
|
243
|
+
* - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})
|
|
244
|
+
*/
|
|
245
|
+
path?: string;
|
|
246
|
+
/** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */
|
|
247
|
+
labels?: readonly string[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Defines a single fixture.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* // Simple - no cleanup needed
|
|
255
|
+
* export default defineFixture({
|
|
256
|
+
* render: (container, { props }) => {
|
|
257
|
+
* container.innerHTML = `<button>${props.label}</button>`;
|
|
258
|
+
* },
|
|
259
|
+
* });
|
|
260
|
+
*
|
|
261
|
+
* // With cleanup
|
|
262
|
+
* export default defineFixture({
|
|
263
|
+
* render: (container, { props }) => {
|
|
264
|
+
* const root = createRoot(container);
|
|
265
|
+
* root.render(<Button label={props.label} />);
|
|
266
|
+
* return { dispose: () => root.unmount() };
|
|
267
|
+
* },
|
|
268
|
+
* });
|
|
269
|
+
*
|
|
270
|
+
* // Async render
|
|
271
|
+
* export default defineFixture({
|
|
272
|
+
* render: async (container, { props, signal }) => {
|
|
273
|
+
* const data = await fetch(props.url, { signal });
|
|
274
|
+
* container.innerHTML = await data.text();
|
|
275
|
+
* return { dispose: () => { container.innerHTML = ''; } };
|
|
276
|
+
* },
|
|
277
|
+
* });
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
export declare function defineFixture(options: DefineFixtureOptions): SingleFixtureExport;
|
|
281
|
+
/**
|
|
282
|
+
* Defines a group of fixtures with support for nesting.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* export default defineFixtureGroup({
|
|
287
|
+
* Primary: defineFixture({
|
|
288
|
+
* render: (container) => { ... },
|
|
289
|
+
* }),
|
|
290
|
+
* Variants: defineFixtureGroup({
|
|
291
|
+
* Small: defineFixture({ ... }),
|
|
292
|
+
* Large: defineFixture({ ... }),
|
|
293
|
+
* }),
|
|
294
|
+
* });
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
export declare function defineFixtureGroup(entries: FixtureGroupInput): FixtureGroupExport;
|
|
298
|
+
export declare function defineFixtureGroup(options: DefineFixtureGroupOptions, entries: FixtureGroupInput): FixtureGroupExport;
|
|
299
|
+
/**
|
|
300
|
+
* Defines a group of fixture variants (no nesting allowed).
|
|
301
|
+
* Variants are rendered horizontally by default and have a distinct icon in the tree.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* export default defineFixtureGroup({
|
|
306
|
+
* Button: defineFixtureVariants({
|
|
307
|
+
* Small: defineFixture({ ... }),
|
|
308
|
+
* Medium: defineFixture({ ... }),
|
|
309
|
+
* Large: defineFixture({ ... }),
|
|
310
|
+
* }),
|
|
311
|
+
* });
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
export declare function defineFixtureVariants(variants: FixtureVariantsInput): FixtureVariantsExport;
|
|
315
|
+
export declare function defineFixtureVariants(options: DefineFixtureVariantsOptions, variants: FixtureVariantsInput): FixtureVariantsExport;
|
|
316
|
+
/**
|
|
317
|
+
* Helper for synchronous renders.
|
|
318
|
+
* Executes the render function immediately and wraps the cleanup in a RenderResult.
|
|
319
|
+
*
|
|
320
|
+
* @param doRender - Function that renders synchronously and returns a cleanup function
|
|
321
|
+
* @returns A RenderResult with an already-resolved ready promise
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```ts
|
|
325
|
+
* render: (container, { props }) => syncRender(() => {
|
|
326
|
+
* const el = document.createElement('button');
|
|
327
|
+
* el.textContent = props.label;
|
|
328
|
+
* container.appendChild(el);
|
|
329
|
+
* return () => el.remove();
|
|
330
|
+
* })
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
export declare function syncRender(doRender: () => (() => void) | IDisposable | void): RenderResult;
|
|
334
|
+
/**
|
|
335
|
+
* Helper for asynchronous renders with cancellation support.
|
|
336
|
+
*
|
|
337
|
+
* @param signal - AbortSignal for cancellation
|
|
338
|
+
* @param doRender - Async function that renders and returns a cleanup function.
|
|
339
|
+
* Should check signal.aborted periodically for long operations.
|
|
340
|
+
* @returns A RenderResult whose ready promise rejects with AbortError if cancelled
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```ts
|
|
344
|
+
* render: (container, { props, signal }) => asyncRender(signal, async () => {
|
|
345
|
+
* const data = await fetchData(props.url, { signal });
|
|
346
|
+
* if (signal.aborted) return;
|
|
347
|
+
* container.innerHTML = data;
|
|
348
|
+
* return () => { container.innerHTML = ''; };
|
|
349
|
+
* })
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
export declare function asyncRender(signal: AbortSignal, doRender: () => Promise<(() => void) | IDisposable | void>): RenderResult;
|
|
353
|
+
//# sourceMappingURL=fixtureApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtureApi.d.ts","sourceRoot":"","sources":["../../src/core/fixtureApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,0CAA0C;AAC1C,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;AAErC;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;;OAGG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,oFAA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C7F,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,oBAAoB,GAAG,qBAAqB,CAAC;AAwBpI;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,WAAW,GAAG,IAAI,GAAG,YAAY,CAY1F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,GACzD,YAAY,CAsCd"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { FixtureExport, SingleFixtureExport, FixtureGroupExport, FixtureVariantsExport, DisplayMode, StyleDefinition, PropertySchema, RenderReturn, RenderContext } from './fixtureApi.js';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard for SingleFixtureExport.
|
|
4
|
+
* Uses the global symbol brand for cross-version compatibility.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isSingleFixture(value: unknown): value is SingleFixtureExport;
|
|
7
|
+
/**
|
|
8
|
+
* Type guard for FixtureGroupExport.
|
|
9
|
+
* Uses the global symbol brand for cross-version compatibility.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isFixtureGroup(value: unknown): value is FixtureGroupExport;
|
|
12
|
+
/**
|
|
13
|
+
* Type guard for FixtureVariantsExport.
|
|
14
|
+
* Uses the global symbol brand for cross-version compatibility.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isFixtureVariants(value: unknown): value is FixtureVariantsExport;
|
|
17
|
+
/**
|
|
18
|
+
* Type guard for any fixture export type.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isFixtureExport(value: unknown): value is FixtureExport;
|
|
21
|
+
export type ParseResult<T> = {
|
|
22
|
+
success: true;
|
|
23
|
+
data: T;
|
|
24
|
+
} | {
|
|
25
|
+
success: false;
|
|
26
|
+
error: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Parses and validates a potential fixture export.
|
|
30
|
+
* Returns a ParseResult with either the validated data or an error message.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseFixtureExport(value: unknown): ParseResult<FixtureExport>;
|
|
33
|
+
/**
|
|
34
|
+
* Parses and validates a single fixture export.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseSingleFixture(value: unknown): ParseResult<SingleFixtureExport>;
|
|
37
|
+
/**
|
|
38
|
+
* Parses and validates a fixture group export.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseFixtureGroup(value: unknown): ParseResult<FixtureGroupExport>;
|
|
41
|
+
/**
|
|
42
|
+
* Parses and validates a fixture variants export.
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseFixtureVariants(value: unknown): ParseResult<FixtureVariantsExport>;
|
|
45
|
+
/**
|
|
46
|
+
* Definition of a component fixture (internal representation).
|
|
47
|
+
*/
|
|
48
|
+
export interface ComponentDefinition {
|
|
49
|
+
/** Unique identifier within the fixture file */
|
|
50
|
+
readonly id: string;
|
|
51
|
+
/** Display name shown in the tree */
|
|
52
|
+
readonly name: string;
|
|
53
|
+
/** Optional description for documentation */
|
|
54
|
+
readonly description?: string;
|
|
55
|
+
/** How to isolate this component from other components */
|
|
56
|
+
readonly isolation: 'iframe' | 'shadow-dom';
|
|
57
|
+
/** How to display: page (device viewport) or component (natural size) */
|
|
58
|
+
readonly displayMode: DisplayMode;
|
|
59
|
+
/**
|
|
60
|
+
* Stylesheets to inject into shadow root (for shadow-dom isolation).
|
|
61
|
+
* Ignored when isolation is 'iframe'.
|
|
62
|
+
*/
|
|
63
|
+
readonly styles?: readonly StyleDefinition[];
|
|
64
|
+
/** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */
|
|
65
|
+
readonly background: 'light' | 'dark';
|
|
66
|
+
/** Labels for categorization and filtering */
|
|
67
|
+
readonly labels: readonly string[];
|
|
68
|
+
/** Property schema for the component */
|
|
69
|
+
readonly properties: readonly PropertySchema[];
|
|
70
|
+
/**
|
|
71
|
+
* Render the component into the container.
|
|
72
|
+
* Returns an optional RenderResult or Promise for cleanup and async readiness.
|
|
73
|
+
*/
|
|
74
|
+
render(container: HTMLElement, context: RenderContext): RenderReturn;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Creates the component definition from a validated SingleFixtureExport.
|
|
78
|
+
*/
|
|
79
|
+
export declare function createComponentDefinition(fixture: SingleFixtureExport, id: string, name: string): ComponentDefinition;
|
|
80
|
+
/**
|
|
81
|
+
* Type guard for checking if a value is a ComponentDefinition.
|
|
82
|
+
* @deprecated Use isSingleFixture or isFixtureGroup instead
|
|
83
|
+
*/
|
|
84
|
+
export declare function isComponentDefinition(value: unknown): value is ComponentDefinition;
|
|
85
|
+
//# sourceMappingURL=fixtureApiConsumer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtureApiConsumer.d.ts","sourceRoot":"","sources":["../../src/core/fixtureApiConsumer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIH,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EACrB,MAAM,iBAAiB,CAAC;AAOzB;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAS5E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAS1E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAShF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,E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U,EAAE,SAAS,cAAc,EAAE,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC;CACtE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,EAC5B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GACX,mBAAmB,CAcrB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CASlF"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export
|
|
3
|
-
export type { ComponentDefinition,
|
|
1
|
+
export type { IDisposable, StyleDefinition, DisplayMode, PageMode, ComponentMode, ViewportPreset, ViewportPresetName, PropertySchema, BooleanProperty, StringProperty, NumberProperty, EnumProperty, DefineFixtureOptions, DefineComponentOptions, FixtureGroupEntry, FixtureGroupInput, FixtureVariantsInput, FixtureExport, SingleFixtureExport, FixtureGroupExport, FixtureVariantsExport, RenderResult, RenderReturn, RenderContext, } from './fixtureApi.js';
|
|
2
|
+
export { singleFixtureBrand, fixtureGroupBrand, fixtureVariantsBrand, defineFixture, defineFixtureGroup, defineFixtureVariants, syncRender, asyncRender, } from './fixtureApi.js';
|
|
3
|
+
export type { ComponentDefinition, ParseResult } from './fixtureApiConsumer.js';
|
|
4
|
+
export { isSingleFixture, isFixtureGroup, isFixtureVariants, parseFixtureExport, parseSingleFixture, parseFixtureGroup, parseFixtureVariants, createComponentDefinition, isComponentDefinition, } from './fixtureApiConsumer.js';
|
|
5
|
+
export type { ErrorInfo, ExceptionError, ConsoleError, RenderReport, } from './ErrorInfo.js';
|
|
4
6
|
export type { FixtureNode, } from './FixtureNode.js';
|
|
5
|
-
export type { DefineFixtureOptions, DefineComponentOptions, FixtureGroupEntry, FixtureGroupInput, FixtureVariantsInput, } from './defineFixture.js';
|
|
6
7
|
export { VIEWPORT_SIZES, resolveViewport } from './DisplayMode.js';
|
|
7
8
|
export { getDefaultPropertyValues } from './PropertySchema.js';
|
|
8
|
-
export { isComponentDefinition } from './ComponentDefinition.js';
|
|
9
9
|
export { createFixtureTree, findNodeByPath, collectComponents } from './FixtureNode.js';
|
|
10
|
-
export { defineFixture, defineFixtureGroup, defineFixtureVariants, isSingleFixture, isFixtureGroup, isFixtureVariants } from './defineFixture.js';
|
|
11
10
|
export { FixtureRegistry } from './FixtureRegistry.js';
|
|
11
|
+
export { CliRuntime } from './CliRuntime.js';
|
|
12
|
+
export type { FixtureModules } from './CliRuntime.js';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,WAAW,EACX,eAAe,EACf,WAAW,EACX,QAAQ,EACR,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAKzB,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAKjC,YAAY,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGxF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration injected by the daemon via the Vite plugin.
|
|
3
|
+
* Set as `window.__EXPLORER_DAEMON__` when the explorer is served from a daemon-managed Vite server.
|
|
4
|
+
*/
|
|
5
|
+
export interface DaemonConfig {
|
|
6
|
+
/** Name of the session this explorer instance belongs to (e.g. 'current' or 'baseline') */
|
|
7
|
+
readonly sessionName: string;
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
__EXPLORER_DAEMON__?: DaemonConfig;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reads daemon config from the global window object.
|
|
16
|
+
* Returns undefined if the explorer is not running under a daemon.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getDaemonConfig(): DaemonConfig | undefined;
|
|
19
|
+
//# sourceMappingURL=DaemonConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DaemonConfig.d.ts","sourceRoot":"","sources":["../../src/daemon/DaemonConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,mBAAmB,CAAC,EAAE,YAAY,CAAC;KACnC;CACD;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,CAE1D"}
|