@vscode/component-explorer 0.1.1-1 → 0.1.1-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @vscode/component-explorer
2
+
3
+ Core library for the [Component Explorer](../../README.md). Contains the fixture API, property schemas, fixture registry, and the Explorer React UI.
4
+
5
+ ## Fixture API
6
+
7
+ ### `defineFixture(options)`
8
+
9
+ Defines a single component fixture.
10
+
11
+ ```tsx
12
+ import { defineFixture } from '@vscode/component-explorer';
13
+
14
+ export default defineFixture({
15
+ properties: [
16
+ { type: 'string', name: 'label', defaultValue: 'Click me' },
17
+ { type: 'boolean', name: 'disabled', defaultValue: false },
18
+ ],
19
+ render: (container, props) => {
20
+ const root = createRoot(container);
21
+ root.render(<Button label={props.label as string} disabled={props.disabled as boolean} />);
22
+ return { dispose: () => root.unmount() };
23
+ },
24
+ });
25
+ ```
26
+
27
+ Options:
28
+
29
+ | Option | Type | Default | Description |
30
+ |---|---|---|---|
31
+ | `render` | `(container, props) => Disposable` | **(required)** | Renders the component. Must return `{ dispose() }` for cleanup. |
32
+ | `properties` | `PropertySchema[]` | `[]` | Configurable properties shown in the properties panel. |
33
+ | `isolation` | `'shadow-dom' \| 'iframe'` | `'shadow-dom'` | Component isolation strategy. |
34
+ | `displayMode` | `DisplayMode` | `{ type: 'component' }` | `'component'` for natural size, or `'page'` with viewport presets. |
35
+ | `styles` | `StyleDefinition[]` | — | Stylesheets injected into the shadow root (shadow-dom isolation only). |
36
+ | `background` | `'light' \| 'dark'` | `'light'` | Preview canvas background pattern. |
37
+ | `description` | `string` | — | Documentation description. |
38
+
39
+ ### `defineFixtureGroup(entries)`
40
+
41
+ Groups multiple fixtures (supports nesting):
42
+
43
+ ```tsx
44
+ import { defineFixture, defineFixtureGroup } from '@vscode/component-explorer';
45
+
46
+ export default defineFixtureGroup({
47
+ Primary: defineFixture({ render: (c) => { /* ... */ } }),
48
+ Secondary: defineFixture({ render: (c) => { /* ... */ } }),
49
+ Nested: defineFixtureGroup({
50
+ Small: defineFixture({ render: (c) => { /* ... */ } }),
51
+ }),
52
+ });
53
+ ```
54
+
55
+ ### `defineFixtureVariants(variants)`
56
+
57
+ Defines a flat set of variants rendered side-by-side:
58
+
59
+ ```tsx
60
+ import { defineFixture, defineFixtureVariants } from '@vscode/component-explorer';
61
+
62
+ defineFixtureVariants({
63
+ Small: defineFixture({ render: (c) => { /* ... */ } }),
64
+ Medium: defineFixture({ render: (c) => { /* ... */ } }),
65
+ Large: defineFixture({ render: (c) => { /* ... */ } }),
66
+ });
67
+ ```
68
+
69
+ ## Property Types
70
+
71
+ | Type | Fields | Description |
72
+ |---|---|---|
73
+ | `boolean` | `name`, `defaultValue` | Toggle checkbox |
74
+ | `string` | `name`, `defaultValue`, `multiline?` | Text input (or textarea) |
75
+ | `number` | `name`, `defaultValue`, `min?`, `max?`, `step?` | Number input with optional range |
76
+ | `enum` | `name`, `defaultValue`, `options` | Dropdown select |
77
+
78
+ All property types support an optional `description` field.
79
+
80
+ ## Explorer UI Components
81
+
82
+ The package exports the full Explorer UI as React components:
83
+
84
+ | Export | Description |
85
+ |---|---|
86
+ | `Explorer` | Main explorer component (tree + preview + properties panel). |
87
+ | `ExplorerApp` | Standalone class that mounts the explorer into a DOM element. |
88
+ | `ExplorerModel` | Observable-based view model powering the explorer state. |
89
+ | `TreeView`, `TreeItem` | Tree navigation components. |
90
+ | `TitleBar`, `TitleBarButton` | Title bar chrome. |
91
+ | `LeftSidebar`, `RightSidebar` | Layout sidebar panels. |
92
+
93
+ ## Core Utilities
94
+
95
+ | Export | Description |
96
+ |---|---|
97
+ | `FixtureRegistry` | Observable registry of discovered fixtures. |
98
+ | `createFixtureTree` | Builds a `FixtureNode` tree from registered fixtures. |
99
+ | `getDefaultPropertyValues` | Extracts default values from a `PropertySchema[]`. |
100
+ | `VIEWPORT_SIZES` | Built-in viewport preset dimensions (`mobile`, `tablet`, `desktop`). |
101
+
102
+ ## Styles
103
+
104
+ Import `@vscode/component-explorer/styles.css` for the default explorer stylesheet. VS Code theme stylesheets are also available under `@vscode/component-explorer/vscode-styles/*`.
@@ -2,7 +2,6 @@ import { FixtureItem } from './ExplorerModel.js';
2
2
  import * as React from 'react';
3
3
  export declare const FixturePreviewItem: React.ComponentType<{
4
4
  fixture: FixtureItem;
5
- onSizeChange: (id: string, width: number, height: number) => void;
6
5
  compact: boolean | undefined;
7
6
  } & {} & {} & {}>;
8
7
  //# sourceMappingURL=FixturePreviewItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FixturePreviewItem.d.ts","sourceRoot":"","sources":["../../src/components/FixturePreviewItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAuItD,eAAO,MAAM,kBAAkB;;uBAnIC,MAAM,SAAS,MAAM,UAAU,MAAM,KAAK,IAAI;;iBAoL7E,CAAC"}
1
+ {"version":3,"file":"FixturePreviewItem.d.ts","sourceRoot":"","sources":["../../src/components/FixturePreviewItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAkItD,eAAO,MAAM,kBAAkB;;;iBAiD9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewArea.d.ts","sourceRoot":"","sources":["../../src/components/PreviewArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC;AA2KjF,eAAO,MAAM,WAAW;;iBAoDvB,CAAC"}
1
+ {"version":3,"file":"PreviewArea.d.ts","sourceRoot":"","sources":["../../src/components/PreviewArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,oBAAoB,CAAC;AAgRpE,eAAO,MAAM,WAAW;;iBA+CvB,CAAC"}