@vscode/component-explorer 0.1.1-8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/SECURITY.md +14 -0
- package/dist/components/Explorer.d.ts +4 -3
- package/dist/components/Explorer.d.ts.map +1 -1
- package/dist/components/ExplorerModel.d.ts +18 -2
- package/dist/components/ExplorerModel.d.ts.map +1 -1
- package/dist/components/FixturePreviewItem.d.ts +1 -0
- package/dist/components/FixturePreviewItem.d.ts.map +1 -1
- 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.map +1 -1
- 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 +3 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/styles.d.ts +32 -32
- package/dist/components/treeFilter.d.ts +3 -0
- package/dist/components/treeFilter.d.ts.map +1 -0
- package/dist/components/types.d.ts +3 -1
- package/dist/components/types.d.ts.map +1 -1
- package/dist/core/ComponentRenderer.d.ts +17 -0
- package/dist/core/ComponentRenderer.d.ts.map +1 -0
- package/dist/core/ErrorInfo.d.ts +16 -0
- package/dist/core/ErrorInfo.d.ts.map +1 -0
- package/dist/core/FixtureNode.d.ts +16 -4
- package/dist/core/FixtureNode.d.ts.map +1 -1
- package/dist/core/FixturePath.d.ts +8 -0
- package/dist/core/FixturePath.d.ts.map +1 -0
- package/dist/core/FixtureRegistry.d.ts +3 -25
- package/dist/core/FixtureRegistry.d.ts.map +1 -1
- package/dist/core/fixtureApi.d.ts +358 -0
- package/dist/core/fixtureApi.d.ts.map +1 -0
- package/dist/core/fixtureApiConsumer.d.ts +84 -0
- package/dist/core/fixtureApiConsumer.d.ts.map +1 -0
- package/dist/core/index.d.ts +15 -8
- package/dist/core/index.d.ts.map +1 -1
- package/dist/daemon/DaemonConfig.d.ts +5 -11
- package/dist/daemon/DaemonConfig.d.ts.map +1 -1
- package/dist/daemon/DaemonModel.d.ts +7 -4
- package/dist/daemon/DaemonModel.d.ts.map +1 -1
- package/dist/daemon/index.d.ts +1 -2
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/index.d.ts +9 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3506
- package/dist/index.js.map +1 -1
- package/dist/lib/explorerQueryParams.d.ts +4 -0
- package/dist/lib/explorerQueryParams.d.ts.map +1 -0
- package/dist/lib/explorerShadowHost.d.ts +3 -0
- package/dist/lib/explorerShadowHost.d.ts.map +1 -0
- package/dist/lib/fixtureFocusTrap.d.ts +2 -0
- package/dist/lib/fixtureFocusTrap.d.ts.map +1 -0
- package/dist/lib/fixtureSizeCache.d.ts +3 -0
- 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/modes/EmbeddedMode.d.ts +15 -0
- package/dist/modes/EmbeddedMode.d.ts.map +1 -0
- package/dist/modes/ExplorerUIMode.d.ts +16 -0
- package/dist/modes/ExplorerUIMode.d.ts.map +1 -0
- package/dist/{core/CliRuntime.d.ts → modes/HeadlessMode.d.ts} +20 -25
- package/dist/modes/HeadlessMode.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 +26 -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/runtimeVersion-CnnW4nSy.js +84 -0
- package/dist/runtimeVersion-CnnW4nSy.js.map +1 -0
- package/dist/runtimeVersion.d.ts +3 -0
- package/dist/runtimeVersion.d.ts.map +1 -0
- package/dist/viewer.d.ts +34 -0
- package/dist/viewer.d.ts.map +1 -0
- package/dist/viewer.js +4104 -0
- package/dist/viewer.js.map +1 -0
- package/package.json +29 -9
- package/dist/core/CliRuntime.d.ts.map +0 -1
- 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,358 @@
|
|
|
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
|
+
* Arbitrary data to include in the render report.
|
|
40
|
+
* Visible to the CLI and MCP tools.
|
|
41
|
+
*/
|
|
42
|
+
readonly data?: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What the render function can return.
|
|
46
|
+
* - undefined: no cleanup needed, immediately ready
|
|
47
|
+
* - RenderResult: object with optional ready/dispose
|
|
48
|
+
* - Promise<...>: async render that resolves to undefined or RenderResult
|
|
49
|
+
*/
|
|
50
|
+
export type RenderReturn = RenderResult | undefined | void | Promise<RenderResult | undefined | void>;
|
|
51
|
+
/**
|
|
52
|
+
* Context passed to the render function.
|
|
53
|
+
*/
|
|
54
|
+
export interface RenderContext {
|
|
55
|
+
/** Property values based on the property schema */
|
|
56
|
+
readonly props: Record<string, unknown>;
|
|
57
|
+
/** AbortSignal for cancellation; check signal.aborted or listen to 'abort' event */
|
|
58
|
+
readonly signal: AbortSignal;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Style definition for shadow DOM injection.
|
|
62
|
+
*/
|
|
63
|
+
export type StyleDefinition = {
|
|
64
|
+
readonly type: 'css';
|
|
65
|
+
readonly content: string;
|
|
66
|
+
} | {
|
|
67
|
+
readonly type: 'url';
|
|
68
|
+
readonly href: string;
|
|
69
|
+
} | {
|
|
70
|
+
readonly type: 'adopted';
|
|
71
|
+
readonly sheet: CSSStyleSheet;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Display mode for a component.
|
|
75
|
+
*/
|
|
76
|
+
export type DisplayMode = PageMode | ComponentMode;
|
|
77
|
+
/**
|
|
78
|
+
* Page mode - component fills a viewport with device presets.
|
|
79
|
+
*/
|
|
80
|
+
export interface PageMode {
|
|
81
|
+
readonly type: 'page';
|
|
82
|
+
readonly viewports: ViewportPreset[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Component mode - renders at natural size.
|
|
86
|
+
*/
|
|
87
|
+
export interface ComponentMode {
|
|
88
|
+
readonly type: 'component';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Viewport preset - either a named preset or custom dimensions.
|
|
92
|
+
*/
|
|
93
|
+
export type ViewportPreset = ViewportPresetName | {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly width: number;
|
|
96
|
+
readonly height: number;
|
|
97
|
+
};
|
|
98
|
+
export type ViewportPresetName = 'mobile' | 'tablet' | 'desktop';
|
|
99
|
+
/**
|
|
100
|
+
* Schema for a component property.
|
|
101
|
+
*/
|
|
102
|
+
export type PropertySchema = BooleanProperty | StringProperty | NumberProperty | EnumProperty;
|
|
103
|
+
export interface BooleanProperty {
|
|
104
|
+
readonly type: 'boolean';
|
|
105
|
+
readonly name: string;
|
|
106
|
+
readonly defaultValue: boolean;
|
|
107
|
+
readonly description?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface StringProperty {
|
|
110
|
+
readonly type: 'string';
|
|
111
|
+
readonly name: string;
|
|
112
|
+
readonly defaultValue: string;
|
|
113
|
+
readonly description?: string;
|
|
114
|
+
readonly multiline?: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface NumberProperty {
|
|
117
|
+
readonly type: 'number';
|
|
118
|
+
readonly name: string;
|
|
119
|
+
readonly defaultValue: number;
|
|
120
|
+
readonly description?: string;
|
|
121
|
+
readonly min?: number;
|
|
122
|
+
readonly max?: number;
|
|
123
|
+
readonly step?: number;
|
|
124
|
+
}
|
|
125
|
+
export interface EnumProperty {
|
|
126
|
+
readonly type: 'enum';
|
|
127
|
+
readonly name: string;
|
|
128
|
+
readonly defaultValue: string;
|
|
129
|
+
readonly description?: string;
|
|
130
|
+
readonly options: readonly string[];
|
|
131
|
+
}
|
|
132
|
+
/** Brand symbol to identify single fixtures */
|
|
133
|
+
export declare const singleFixtureBrand: unique symbol;
|
|
134
|
+
/** Brand symbol to identify fixture groups */
|
|
135
|
+
export declare const fixtureGroupBrand: unique symbol;
|
|
136
|
+
/** Brand symbol to identify fixture variants */
|
|
137
|
+
export declare const fixtureVariantsBrand: unique symbol;
|
|
138
|
+
/**
|
|
139
|
+
* Options for defining a single component fixture.
|
|
140
|
+
*/
|
|
141
|
+
export interface DefineFixtureOptions {
|
|
142
|
+
/**
|
|
143
|
+
* Path in the explorer tree.
|
|
144
|
+
* - `undefined` (default): use fixture filename only
|
|
145
|
+
* - `'Foo/Bar'`: exact path (fixture filename NOT appended)
|
|
146
|
+
* - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})
|
|
147
|
+
*
|
|
148
|
+
* @throws Error if path contains empty segments (e.g., '/foo', 'foo//bar')
|
|
149
|
+
*/
|
|
150
|
+
path?: string;
|
|
151
|
+
/** Optional description for documentation */
|
|
152
|
+
description?: string;
|
|
153
|
+
/** How to isolate: 'none' (default) renders in light DOM, 'shadow-dom' for CSS isolation, 'iframe' for full isolation */
|
|
154
|
+
isolation?: 'none' | 'shadow-dom' | 'iframe';
|
|
155
|
+
/** Display mode: defaults to { type: 'component' } */
|
|
156
|
+
displayMode?: DisplayMode;
|
|
157
|
+
/** Styles to inject (into document head for 'none', into shadow root for 'shadow-dom', into iframe head for 'iframe') */
|
|
158
|
+
styles?: StyleDefinition[];
|
|
159
|
+
/** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */
|
|
160
|
+
background?: 'light' | 'dark';
|
|
161
|
+
/** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */
|
|
162
|
+
labels?: readonly string[];
|
|
163
|
+
/** Property definitions */
|
|
164
|
+
properties?: PropertySchema[];
|
|
165
|
+
/**
|
|
166
|
+
* Render the component into the container.
|
|
167
|
+
*
|
|
168
|
+
* @param container - The DOM element to render into
|
|
169
|
+
* @param context - Render context containing props and abort signal
|
|
170
|
+
* @returns Optional RenderResult, or a Promise that resolves to one
|
|
171
|
+
*/
|
|
172
|
+
render: (container: HTMLElement, context: RenderContext) => RenderReturn;
|
|
173
|
+
}
|
|
174
|
+
/** @deprecated Use DefineFixtureOptions instead */
|
|
175
|
+
export type DefineComponentOptions = DefineFixtureOptions;
|
|
176
|
+
/**
|
|
177
|
+
* A single fixture export created by defineFixture().
|
|
178
|
+
*/
|
|
179
|
+
export interface SingleFixtureExport {
|
|
180
|
+
readonly [singleFixtureBrand]: true;
|
|
181
|
+
readonly _options: DefineFixtureOptions;
|
|
182
|
+
readonly _path?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Group entry: either a single fixture, a nested group, or variants.
|
|
186
|
+
*/
|
|
187
|
+
export type FixtureGroupEntry = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;
|
|
188
|
+
/**
|
|
189
|
+
* A fixture group export created by defineFixtureGroup().
|
|
190
|
+
*/
|
|
191
|
+
export interface FixtureGroupExport {
|
|
192
|
+
readonly [fixtureGroupBrand]: true;
|
|
193
|
+
readonly _entries: {
|
|
194
|
+
[key: string]: FixtureGroupEntry;
|
|
195
|
+
};
|
|
196
|
+
readonly _path?: string;
|
|
197
|
+
readonly _labels?: readonly string[];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* A fixture variants export created by defineFixtureVariants().
|
|
201
|
+
*/
|
|
202
|
+
export interface FixtureVariantsExport {
|
|
203
|
+
readonly [fixtureVariantsBrand]: true;
|
|
204
|
+
readonly _variants: {
|
|
205
|
+
[key: string]: SingleFixtureExport;
|
|
206
|
+
};
|
|
207
|
+
readonly _path?: string;
|
|
208
|
+
readonly _labels?: readonly string[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Fixture export type - a single fixture, a group, or variants.
|
|
212
|
+
*/
|
|
213
|
+
export type FixtureExport = SingleFixtureExport | FixtureGroupExport | FixtureVariantsExport;
|
|
214
|
+
/**
|
|
215
|
+
* Input for defineFixtureGroup.
|
|
216
|
+
*/
|
|
217
|
+
export type FixtureGroupInput = {
|
|
218
|
+
[key: string]: FixtureGroupEntry;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Options for defineFixtureGroup with optional path.
|
|
222
|
+
*/
|
|
223
|
+
export interface DefineFixtureGroupOptions {
|
|
224
|
+
/**
|
|
225
|
+
* Path in the explorer tree.
|
|
226
|
+
* - `undefined` (default): use fixture filename only
|
|
227
|
+
* - `'Foo/Bar'`: exact path (fixture filename NOT appended)
|
|
228
|
+
* - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})
|
|
229
|
+
*/
|
|
230
|
+
path?: string;
|
|
231
|
+
/** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */
|
|
232
|
+
labels?: readonly string[];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Input for defineFixtureVariants (only single fixtures, no nesting).
|
|
236
|
+
*/
|
|
237
|
+
export type FixtureVariantsInput = {
|
|
238
|
+
[key: string]: SingleFixtureExport;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Options for defineFixtureVariants with optional path.
|
|
242
|
+
*/
|
|
243
|
+
export interface DefineFixtureVariantsOptions {
|
|
244
|
+
/**
|
|
245
|
+
* Path in the explorer tree.
|
|
246
|
+
* - `undefined` (default): use fixture filename only
|
|
247
|
+
* - `'Foo/Bar'`: exact path (fixture filename NOT appended)
|
|
248
|
+
* - `'Foo/Bar/'`: prefix (fixture filename IS appended → Foo/Bar/{filename})
|
|
249
|
+
*/
|
|
250
|
+
path?: string;
|
|
251
|
+
/** Labels for categorization and filtering (e.g. 'animation', 'blocks-ci') */
|
|
252
|
+
labels?: readonly string[];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Defines a single fixture.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* // Simple - no cleanup needed
|
|
260
|
+
* export default defineFixture({
|
|
261
|
+
* render: (container, { props }) => {
|
|
262
|
+
* container.innerHTML = `<button>${props.label}</button>`;
|
|
263
|
+
* },
|
|
264
|
+
* });
|
|
265
|
+
*
|
|
266
|
+
* // With cleanup
|
|
267
|
+
* export default defineFixture({
|
|
268
|
+
* render: (container, { props }) => {
|
|
269
|
+
* const root = createRoot(container);
|
|
270
|
+
* root.render(<Button label={props.label} />);
|
|
271
|
+
* return { dispose: () => root.unmount() };
|
|
272
|
+
* },
|
|
273
|
+
* });
|
|
274
|
+
*
|
|
275
|
+
* // Async render
|
|
276
|
+
* export default defineFixture({
|
|
277
|
+
* render: async (container, { props, signal }) => {
|
|
278
|
+
* const data = await fetch(props.url, { signal });
|
|
279
|
+
* container.innerHTML = await data.text();
|
|
280
|
+
* return { dispose: () => { container.innerHTML = ''; } };
|
|
281
|
+
* },
|
|
282
|
+
* });
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
export declare function defineFixture(options: DefineFixtureOptions): SingleFixtureExport;
|
|
286
|
+
/**
|
|
287
|
+
* Defines a group of fixtures with support for nesting.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* export default defineFixtureGroup({
|
|
292
|
+
* Primary: defineFixture({
|
|
293
|
+
* render: (container) => { ... },
|
|
294
|
+
* }),
|
|
295
|
+
* Variants: defineFixtureGroup({
|
|
296
|
+
* Small: defineFixture({ ... }),
|
|
297
|
+
* Large: defineFixture({ ... }),
|
|
298
|
+
* }),
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
export declare function defineFixtureGroup(entries: FixtureGroupInput): FixtureGroupExport;
|
|
303
|
+
export declare function defineFixtureGroup(options: DefineFixtureGroupOptions, entries: FixtureGroupInput): FixtureGroupExport;
|
|
304
|
+
/**
|
|
305
|
+
* Defines a group of fixture variants (no nesting allowed).
|
|
306
|
+
* Variants are rendered horizontally by default and have a distinct icon in the tree.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* export default defineFixtureGroup({
|
|
311
|
+
* Button: defineFixtureVariants({
|
|
312
|
+
* Small: defineFixture({ ... }),
|
|
313
|
+
* Medium: defineFixture({ ... }),
|
|
314
|
+
* Large: defineFixture({ ... }),
|
|
315
|
+
* }),
|
|
316
|
+
* });
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
export declare function defineFixtureVariants(variants: FixtureVariantsInput): FixtureVariantsExport;
|
|
320
|
+
export declare function defineFixtureVariants(options: DefineFixtureVariantsOptions, variants: FixtureVariantsInput): FixtureVariantsExport;
|
|
321
|
+
/**
|
|
322
|
+
* Helper for synchronous renders.
|
|
323
|
+
* Executes the render function immediately and wraps the cleanup in a RenderResult.
|
|
324
|
+
*
|
|
325
|
+
* @param doRender - Function that renders synchronously and returns a cleanup function
|
|
326
|
+
* @returns A RenderResult with an already-resolved ready promise
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* render: (container, { props }) => syncRender(() => {
|
|
331
|
+
* const el = document.createElement('button');
|
|
332
|
+
* el.textContent = props.label;
|
|
333
|
+
* container.appendChild(el);
|
|
334
|
+
* return () => el.remove();
|
|
335
|
+
* })
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
export declare function syncRender(doRender: () => (() => void) | IDisposable | void): RenderResult;
|
|
339
|
+
/**
|
|
340
|
+
* Helper for asynchronous renders with cancellation support.
|
|
341
|
+
*
|
|
342
|
+
* @param signal - AbortSignal for cancellation
|
|
343
|
+
* @param doRender - Async function that renders and returns a cleanup function.
|
|
344
|
+
* Should check signal.aborted periodically for long operations.
|
|
345
|
+
* @returns A RenderResult whose ready promise rejects with AbortError if cancelled
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```ts
|
|
349
|
+
* render: (container, { props, signal }) => asyncRender(signal, async () => {
|
|
350
|
+
* const data = await fetchData(props.url, { signal });
|
|
351
|
+
* if (signal.aborted) return;
|
|
352
|
+
* container.innerHTML = data;
|
|
353
|
+
* return () => { container.innerHTML = ''; };
|
|
354
|
+
* })
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
export declare function asyncRender(signal: AbortSignal, doRender: () => Promise<(() => void) | IDisposable | void>): RenderResult;
|
|
358
|
+
//# 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;IAEjB;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;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,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE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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,84 @@
|
|
|
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: 'none' | 'shadow-dom' | 'iframe';
|
|
57
|
+
/** How to display: page (device viewport) or component (natural size) */
|
|
58
|
+
readonly displayMode: DisplayMode;
|
|
59
|
+
/** Stylesheets to inject (into document head, shadow root, or iframe head depending on isolation mode) */
|
|
60
|
+
readonly styles?: readonly StyleDefinition[];
|
|
61
|
+
/** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */
|
|
62
|
+
readonly background: 'light' | 'dark';
|
|
63
|
+
/** Labels for categorization and filtering */
|
|
64
|
+
readonly labels: readonly string[];
|
|
65
|
+
/** Property schema for the component */
|
|
66
|
+
readonly properties: readonly PropertySchema[];
|
|
67
|
+
/** Source file path this fixture was defined in */
|
|
68
|
+
readonly sourceFile: string;
|
|
69
|
+
/**
|
|
70
|
+
* Render the component into the container.
|
|
71
|
+
* Returns an optional RenderResult or Promise for cleanup and async readiness.
|
|
72
|
+
*/
|
|
73
|
+
render(container: HTMLElement, context: RenderContext): RenderReturn;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates the component definition from a validated SingleFixtureExport.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createComponentDefinition(fixture: SingleFixtureExport, id: string, name: string, sourceFile: string): ComponentDefinition;
|
|
79
|
+
/**
|
|
80
|
+
* Type guard for checking if a value is a ComponentDefinition.
|
|
81
|
+
* @deprecated Use isSingleFixture or isFixtureGroup instead
|
|
82
|
+
*/
|
|
83
|
+
export declare function isComponentDefinition(value: unknown): value is ComponentDefinition;
|
|
84
|
+
//# 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,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAMD,MAAM,MAAM,WAAW,CAAC,CAAC,IACrB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;;GAGG;AACH,wBAAgB,kBAAkB,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5B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,mBAAmB,CAerB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CASlF"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
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 { ExceptionError, RenderEvent, RenderEventType, RenderReport, } from './ErrorInfo.js';
|
|
4
6
|
export type { FixtureNode, } from './FixtureNode.js';
|
|
5
|
-
export
|
|
7
|
+
export { FixturePath } from './FixturePath.js';
|
|
6
8
|
export { VIEWPORT_SIZES, resolveViewport } from './DisplayMode.js';
|
|
7
9
|
export { getDefaultPropertyValues } from './PropertySchema.js';
|
|
8
|
-
export { isComponentDefinition } from './ComponentDefinition.js';
|
|
9
10
|
export { createFixtureTree, findNodeByPath, collectComponents } from './FixtureNode.js';
|
|
10
|
-
export { defineFixture, defineFixtureGroup, defineFixtureVariants, isSingleFixture, isFixtureGroup, isFixtureVariants } from './defineFixture.js';
|
|
11
11
|
export { FixtureRegistry } from './FixtureRegistry.js';
|
|
12
|
-
export
|
|
13
|
-
|
|
12
|
+
export interface FixtureModules {
|
|
13
|
+
[path: string]: {
|
|
14
|
+
default?: unknown;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ExplorerRuntime {
|
|
18
|
+
updateFixtures(fixtureModules: FixtureModules): void;
|
|
19
|
+
bumpVersion(): void;
|
|
20
|
+
}
|
|
14
21
|
//# 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,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,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,MAAM,WAAW,cAAc;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACvC;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACrD,WAAW,IAAI,IAAI,CAAC;CACrB"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration injected by the daemon via the Vite plugin.
|
|
3
|
-
*
|
|
3
|
+
* Passed to ExplorerApp as `options.daemonConfig`.
|
|
4
4
|
*/
|
|
5
5
|
export interface DaemonConfig {
|
|
6
6
|
/** Name of the session this explorer instance belongs to (e.g. 'current' or 'baseline') */
|
|
7
7
|
readonly sessionName: string;
|
|
8
|
+
/** Daemon API version served by the daemon process. */
|
|
9
|
+
readonly daemonApiVersion: string;
|
|
10
|
+
/** Runtime version required by the vite plugin for the explorer bundle it serves. */
|
|
11
|
+
readonly runtimeVersionNeededByPlugin: string;
|
|
8
12
|
}
|
|
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
13
|
//# sourceMappingURL=DaemonConfig.d.ts.map
|
|
@@ -1 +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;
|
|
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;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,qFAAqF;IACrF,QAAQ,CAAC,4BAA4B,EAAE,MAAM,CAAC;CAC9C"}
|
|
@@ -7,6 +7,11 @@ export type DaemonScreenshotResult = DaemonApiType['screenshots']['take']['TResu
|
|
|
7
7
|
export type DaemonCompareResult = DaemonApiType['screenshots']['compare']['TResult'];
|
|
8
8
|
/** Fixture info from the daemon */
|
|
9
9
|
export type DaemonFixtureInfo = DaemonApiType['fixtures']['list']['TResult'][number];
|
|
10
|
+
export interface DaemonSession {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly serverUrl: string;
|
|
13
|
+
readonly sourceKind: 'current' | 'worktree';
|
|
14
|
+
}
|
|
10
15
|
/**
|
|
11
16
|
* Client-side model for interacting with the daemon.
|
|
12
17
|
* Manages source tree IDs, screenshot caching, and the event stream.
|
|
@@ -22,10 +27,7 @@ export declare class DaemonModel {
|
|
|
22
27
|
/** Observable map of sessionName → current sourceTreeId */
|
|
23
28
|
readonly sourceTreeIds: IObservable<ReadonlyMap<string, string>>;
|
|
24
29
|
/** Observable list of sessions from the daemon */
|
|
25
|
-
readonly sessions: IObservable<readonly
|
|
26
|
-
name: string;
|
|
27
|
-
serverUrl: string;
|
|
28
|
-
}[]>;
|
|
30
|
+
readonly sessions: IObservable<readonly DaemonSession[]>;
|
|
29
31
|
constructor(config: DaemonConfig);
|
|
30
32
|
/**
|
|
31
33
|
* Initializes the model: fetches initial session info and starts listening to events.
|
|
@@ -53,5 +55,6 @@ export declare class DaemonModel {
|
|
|
53
55
|
private _fetchSessionInfos;
|
|
54
56
|
private _startEventStream;
|
|
55
57
|
private _handleEvent;
|
|
58
|
+
private _validateProtocolVersions;
|
|
56
59
|
}
|
|
57
60
|
//# sourceMappingURL=DaemonModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DaemonModel.d.ts","sourceRoot":"","sources":["../../src/daemon/DaemonModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"DaemonModel.d.ts","sourceRoot":"","sources":["../../src/daemon/DaemonModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGxE,OAAO,EACN,KAAK,aAAa,EAElB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,wCAAwC;AACxC,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;AAErF,wCAAwC;AACxC,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;AAErF,mCAAmC;AACnC,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,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,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAM9D,OAAO,IAAI,IAAI;YASD,kBAAkB;YAelB,iBAAiB;IAuB/B,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,yBAAyB;CAgBjC"}
|
package/dist/daemon/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { DaemonModel } from './DaemonModel.js';
|
|
2
|
-
export type { DaemonScreenshotResult, DaemonCompareResult, DaemonFixtureInfo } from './DaemonModel.js';
|
|
3
|
-
export { getDaemonConfig } from './DaemonConfig.js';
|
|
2
|
+
export type { DaemonScreenshotResult, DaemonCompareResult, DaemonFixtureInfo, DaemonSession } from './DaemonModel.js';
|
|
4
3
|
export type { DaemonConfig } from './DaemonConfig.js';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/daemon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/daemon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtH,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
import { FixtureModules } from './core/index.js';
|
|
2
|
-
export * from './core/index.js';
|
|
3
|
-
export { Explorer, ExplorerWithDefaults, ExplorerModel } from './components/index.js';
|
|
4
|
-
export type { ExplorerTreeNode } from './components/index.js';
|
|
5
|
-
export { toExplorerTree } from './components/index.js';
|
|
6
|
-
export { TitleBar, TitleBarButton, LeftSidebar, RightSidebar, TreeView, TreeItem, } from './components/index.js';
|
|
7
|
-
export * from './components/icons.js';
|
|
8
|
-
export { styles, mergeStyles } from './components/index.js';
|
|
9
|
-
export { DaemonModel } from './daemon/index.js';
|
|
10
|
-
export type { DaemonScreenshotResult, DaemonCompareResult, DaemonFixtureInfo } from './daemon/DaemonModel.js';
|
|
11
1
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
2
|
+
* @vscode/component-explorer
|
|
3
|
+
*
|
|
4
|
+
* This is the public API for defining fixtures.
|
|
5
|
+
* Projects import from this module to define their fixtures.
|
|
6
|
+
*
|
|
7
|
+
* For the viewer/explorer UI, import from '@vscode/component-explorer/viewer' instead.
|
|
14
8
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
private readonly _daemonModel?;
|
|
19
|
-
constructor(element: HTMLElement, fixtureModules: FixtureModules);
|
|
20
|
-
private _initializeDaemonModel;
|
|
21
|
-
private _populateRegistry;
|
|
22
|
-
/**
|
|
23
|
-
* Updates the fixtures. The UI will update automatically since the registry is observable.
|
|
24
|
-
*/
|
|
25
|
-
updateFixtures(fixtureModules: FixtureModules): void;
|
|
26
|
-
/**
|
|
27
|
-
* No-op for ExplorerApp (only meaningful for CliRuntime).
|
|
28
|
-
* Present so the plugin's HMR wiring can call it polymorphically.
|
|
29
|
-
*/
|
|
30
|
-
bumpVersion(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Unmounts the explorer and cleans up resources.
|
|
33
|
-
*/
|
|
34
|
-
dispose(): void;
|
|
35
|
-
}
|
|
9
|
+
export { defineFixture, defineFixtureGroup, defineFixtureVariants, singleFixtureBrand, fixtureGroupBrand, fixtureVariantsBrand, } from './core/fixtureApi.js';
|
|
10
|
+
export type { DefineFixtureOptions, DefineComponentOptions, FixtureExport, SingleFixtureExport, FixtureGroupExport, FixtureVariantsExport, FixtureGroupEntry, FixtureGroupInput, FixtureVariantsInput, IDisposable, Disposable, StyleDefinition, DisplayMode, PageMode, ComponentMode, ViewportPreset, ViewportPresetName, PropertySchema, BooleanProperty, StringProperty, NumberProperty, EnumProperty, } from './core/fixtureApi.js';
|
|
11
|
+
export { runtimeVersion, } from './runtimeVersion.js';
|
|
36
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEL,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EAGrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EAEV,oBAAoB,EACpB,sBAAsB,EAGtB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EAGpB,WAAW,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,QAAQ,EACR,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,GACf,MAAM,qBAAqB,CAAC"}
|