@weasel-js/forge 1.6.1 → 1.7.1

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.
Files changed (43) hide show
  1. package/README.md +35 -2
  2. package/dist/{FrameController-BspC9Zr5.d.ts → FrameController-RdGggdGA.d.ts} +34 -1
  3. package/dist/chunk-JNJGIUYU.js +77 -0
  4. package/dist/chunk-JNJGIUYU.js.map +1 -0
  5. package/dist/{chunk-CSAXZIMV.js → chunk-KIFCYY4F.js} +98 -11
  6. package/dist/chunk-KIFCYY4F.js.map +1 -0
  7. package/dist/{chunk-OLWZURU3.js → chunk-NYBMOSSR.js} +11 -12
  8. package/dist/chunk-NYBMOSSR.js.map +1 -0
  9. package/dist/{chunk-DIOLWCH7.js → chunk-SEK6EKHO.js} +38 -94
  10. package/dist/chunk-SEK6EKHO.js.map +1 -0
  11. package/dist/chunk-WEQSLPKT.js +9 -0
  12. package/dist/chunk-WEQSLPKT.js.map +1 -0
  13. package/dist/{chunk-2GXKNXTJ.js → chunk-Y3WZ2EWR.js} +2 -2
  14. package/dist/chunk-Y3WZ2EWR.js.map +1 -0
  15. package/dist/{chunk-JXIWZFD4.js → chunk-YKN3IAEX.js} +12 -10
  16. package/dist/chunk-YKN3IAEX.js.map +1 -0
  17. package/dist/{config-C5Vq5Kjj.d.ts → config-BJIgUhiI.d.ts} +16 -3
  18. package/dist/csf/preview-api.js +1 -1
  19. package/dist/frame/index.css +63 -7
  20. package/dist/frame/index.css.map +1 -1
  21. package/dist/frame/index.d.ts +7 -2
  22. package/dist/frame/index.js +11 -4
  23. package/dist/frame/index.js.map +1 -1
  24. package/dist/index.d.ts +14 -4
  25. package/dist/index.js +3 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/shell/index.css +165 -3
  28. package/dist/shell/index.css.map +1 -1
  29. package/dist/shell/index.d.ts +44 -31
  30. package/dist/shell/index.js +178 -202
  31. package/dist/shell/index.js.map +1 -1
  32. package/dist/test/index.d.ts +2 -1
  33. package/dist/test/index.js +5 -4
  34. package/dist/test/index.js.map +1 -1
  35. package/dist/vite/index.d.ts +7 -1
  36. package/dist/vite/index.js +367 -32
  37. package/dist/vite/index.js.map +1 -1
  38. package/package.json +10 -10
  39. package/dist/chunk-2GXKNXTJ.js.map +0 -1
  40. package/dist/chunk-CSAXZIMV.js.map +0 -1
  41. package/dist/chunk-DIOLWCH7.js.map +0 -1
  42. package/dist/chunk-JXIWZFD4.js.map +0 -1
  43. package/dist/chunk-OLWZURU3.js.map +0 -1
@@ -38,8 +38,8 @@ body {
38
38
  box-sizing: border-box;
39
39
  max-width: 1200px;
40
40
  margin: 0 auto;
41
- padding: calc(var(--wzl-space-lg) * 2) var(--wzl-space-lg) calc(var(--wzl-space-lg) * 4);
42
- font-family: var(--wzl-font-body);
41
+ padding: var(--wzl-space-lg);
42
+ font-family: var(--wzl-font-ui);
43
43
  font-size: var(--wzl-font-size);
44
44
  color: var(--wzl-fg);
45
45
  }
@@ -48,8 +48,7 @@ body {
48
48
  }
49
49
  .fg-index__path {
50
50
  margin: 0 0 var(--wzl-space-2);
51
- font-family: var(--wzl-font-ui);
52
- font-size: var(--wzl-font-size-sm);
51
+ font-size: var(--wzl-font-size-lg);
53
52
  color: var(--wzl-fg-muted);
54
53
  }
55
54
  .fg-index__title {
@@ -64,6 +63,7 @@ body {
64
63
  .fg-index-story__description {
65
64
  max-width: 72ch;
66
65
  margin: var(--wzl-space-4) 0 0;
66
+ font-family: var(--wzl-font-body);
67
67
  line-height: 1.5;
68
68
  color: var(--wzl-fg-muted);
69
69
  }
@@ -88,13 +88,15 @@ body {
88
88
  }
89
89
  .fg-index-cell {
90
90
  margin: var(--wzl-space-8) 0 0;
91
+ width: fit-content;
92
+ max-width: 100%;
91
93
  }
92
94
  .fg-index-cell__stage {
93
95
  display: flex;
94
96
  align-items: center;
95
97
  justify-content: center;
96
98
  min-height: 96px;
97
- padding: var(--wzl-space-8);
99
+ padding: var(--wzl-space-2);
98
100
  border: var(--wzl-border-w) solid var(--wzl-border);
99
101
  border-radius: var(--wzl-radius-md);
100
102
  background: var(--wzl-surface);
@@ -103,6 +105,9 @@ body {
103
105
  .fg-index-cell--padded > .fg-index-cell__stage {
104
106
  display: block;
105
107
  }
108
+ .fg-index-cell--fullscreen {
109
+ width: auto;
110
+ }
106
111
  .fg-index-cell--fullscreen > .fg-index-cell__stage {
107
112
  display: block;
108
113
  height: 360px;
@@ -127,11 +132,62 @@ body {
127
132
  color: var(--wzl-fg-muted);
128
133
  }
129
134
  .fg-index-variants__cells {
130
- display: grid;
131
- grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
135
+ display: flex;
136
+ flex-wrap: wrap;
137
+ align-items: flex-start;
132
138
  gap: var(--wzl-space-6);
133
139
  }
134
140
  .fg-index-variants__cells > .fg-index-cell {
135
141
  margin-top: var(--wzl-space-4);
136
142
  }
143
+ .fg-index__library {
144
+ margin-inline-end: var(--wzl-space-4);
145
+ vertical-align: middle;
146
+ }
147
+ .fg-index__title-row {
148
+ display: flex;
149
+ align-items: center;
150
+ gap: var(--wzl-space-6);
151
+ }
152
+ .fg-index-deps {
153
+ display: grid;
154
+ grid-template-columns: max-content 1fr;
155
+ gap: var(--wzl-space-3) var(--wzl-space-8);
156
+ margin: var(--wzl-space-8) 0 0;
157
+ font-size: var(--wzl-font-size-sm);
158
+ }
159
+ .fg-index-deps__row {
160
+ display: contents;
161
+ }
162
+ .fg-index-deps__label {
163
+ color: var(--wzl-fg-muted);
164
+ }
165
+ .fg-index-deps__value {
166
+ margin: 0;
167
+ }
168
+ .fg-index-deps__list {
169
+ display: flex;
170
+ flex-wrap: wrap;
171
+ gap: var(--wzl-space-2) var(--wzl-space-6);
172
+ margin: 0;
173
+ padding: 0;
174
+ list-style: none;
175
+ }
176
+ .fg-index-deps__link {
177
+ color: var(--wzl-accent-fg);
178
+ text-decoration: none;
179
+ }
180
+ .fg-index-deps__link:hover {
181
+ text-decoration: underline;
182
+ }
183
+ .fg-index-deps__prefix,
184
+ .fg-index-deps__empty,
185
+ .fg-index-deps__none {
186
+ color: var(--wzl-fg-muted);
187
+ }
188
+ .fg-index-deps__none {
189
+ max-width: 72ch;
190
+ margin: var(--wzl-space-8) 0 0;
191
+ font-size: var(--wzl-font-size-sm);
192
+ }
137
193
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/frame/frame.css","../../src/frame/index/index.css"],"sourcesContent":["html,\nbody {\n margin: 0;\n}\n\n.fg-frame {\n box-sizing: border-box;\n}\n\n.fg-frame--centered {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n}\n\n.fg-frame--padded {\n padding: 16px;\n}\n\n.fg-frame--fullscreen {\n padding: 0;\n}\n\n.fg-frame__fault {\n margin: 0;\n padding: 16px;\n white-space: pre-wrap;\n border: 1px solid #f2b8b5;\n border-radius: 4px;\n background: #fdecea;\n color: #8c1d18;\n font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n",".fg-index {\n box-sizing: border-box;\n max-width: 1200px;\n margin: 0 auto;\n padding: calc(var(--wzl-space-lg) * 2) var(--wzl-space-lg) calc(var(--wzl-space-lg) * 4);\n font-family: var(--wzl-font-body);\n font-size: var(--wzl-font-size);\n color: var(--wzl-fg);\n}\n\n.fg-index__head {\n margin-bottom: calc(var(--wzl-space-lg) * 2);\n}\n\n.fg-index__path {\n margin: 0 0 var(--wzl-space-2);\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n}\n\n.fg-index__title {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: calc(var(--wzl-font-size-xl) * 1.6);\n font-weight: var(--wzl-font-weight-medium);\n letter-spacing: var(--wzl-panel-title-tracking);\n text-transform: var(--wzl-panel-title-case);\n}\n\n.fg-index__description,\n.fg-index-story__description {\n max-width: 72ch;\n margin: var(--wzl-space-4) 0 0;\n line-height: 1.5;\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-story {\n padding-top: calc(var(--wzl-space-lg) * 1.5);\n margin-top: calc(var(--wzl-space-lg) * 1.5);\n border-top: var(--wzl-border-w) solid var(--wzl-border);\n}\n\n.fg-index-story__head {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-6);\n}\n\n.fg-index-story__name {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: var(--wzl-font-size-xl);\n font-weight: var(--wzl-panel-title-weight);\n letter-spacing: var(--wzl-panel-title-tracking);\n text-transform: var(--wzl-panel-title-case);\n color: var(--wzl-panel-title-color);\n}\n\n.fg-index-cell {\n margin: var(--wzl-space-8) 0 0;\n}\n\n.fg-index-cell__stage {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 96px;\n padding: var(--wzl-space-8);\n border: var(--wzl-border-w) solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n background: var(--wzl-surface);\n overflow: auto;\n}\n\n.fg-index-cell--padded > .fg-index-cell__stage {\n display: block;\n}\n\n.fg-index-cell--fullscreen > .fg-index-cell__stage {\n display: block;\n height: 360px;\n padding: 0;\n}\n\n.fg-index-cell__label {\n margin-top: var(--wzl-space-3);\n font-family: var(--wzl-font-mono);\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-variants__row {\n margin-top: calc(var(--wzl-space-lg) * 1.25);\n}\n\n/* Set as the kit's panel titles are, at the small size. */\n.fg-index-variants__label {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: var(--wzl-font-size-sm);\n font-weight: var(--wzl-panel-title-weight);\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-variants__cells {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));\n gap: var(--wzl-space-6);\n}\n\n.fg-index-variants__cells > .fg-index-cell {\n margin-top: var(--wzl-space-4);\n}\n"],"mappings":";AAAA;AACA;AACE,UAAQ;AACV;AAEA,CAAC;AACC,cA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I;AACpB,SAAO,IAAI;AACb;AAEA,CAAC;AACC,UAAQ,IAAI,eAAe,EAAE;AAC/B;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,cAAY;AACZ,WAAS,IAAI;AACb,UAAQ,IAAI,gBAAgB,MAAM,IAAI;AACtC,iBAAe,IAAI;AACnB,cAAY,IAAI;AAChB,YAAU;AACZ;AAEA,CAAC,sBAAsB,EAAE,CAZxB;AAaC,WAAS;AACX;AAEA,CAAC,0BAA0B,EAAE,CAhB5B;AAiBC,WAAS;AACT,UAAQ;AACR,WAAS;AACX;AAEA,CAAC;AACC,cAAY,IAAI;AAChB,eAAa,IAAI;AACjB,aAAW,IAAI;AACf,SAAO,IAAI;AACb;AAEA,CAAC;AACC,cAAY,KAAK,IAAI,gBAAgB,EAAE;AACzC;AAGA,CAAC;AACC,UAAQ;AACR,eAAa,IAAI;AACjB,aAAW,IAAI;AACf,eAAa,IAAI;AACjB,kBAAgB;AAChB,kBAAgB;AAChB,SAAO,IAAI;AACb;AAEA,CAAC;AACC,WAAS;AACT,yBAAuB,OAAO,SAAS,EAAE,OAAO,KAAK,EAAE;AACvD,OAAK,IAAI;AACX;AAEA,CANC,yBAMyB,EAAE,CAtD3B;AAuDC,cAAY,IAAI;AAClB;","names":[]}
1
+ {"version":3,"sources":["../../src/frame/frame.css","../../src/frame/index/index.css"],"sourcesContent":["html,\nbody {\n margin: 0;\n}\n\n.fg-frame {\n box-sizing: border-box;\n}\n\n.fg-frame--centered {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n}\n\n.fg-frame--padded {\n padding: 16px;\n}\n\n.fg-frame--fullscreen {\n padding: 0;\n}\n\n.fg-frame__fault {\n margin: 0;\n padding: 16px;\n white-space: pre-wrap;\n border: 1px solid #f2b8b5;\n border-radius: 4px;\n background: #fdecea;\n color: #8c1d18;\n font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n",".fg-index {\n box-sizing: border-box;\n max-width: 1200px;\n margin: 0 auto;\n padding: var(--wzl-space-lg);\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size);\n color: var(--wzl-fg);\n}\n\n.fg-index__head {\n margin-bottom: calc(var(--wzl-space-lg) * 2);\n}\n\n.fg-index__path {\n margin: 0 0 var(--wzl-space-2);\n font-size: var(--wzl-font-size-lg);\n color: var(--wzl-fg-muted);\n}\n\n.fg-index__title {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: calc(var(--wzl-font-size-xl) * 1.6);\n font-weight: var(--wzl-font-weight-medium);\n letter-spacing: var(--wzl-panel-title-tracking);\n text-transform: var(--wzl-panel-title-case);\n}\n\n.fg-index__description,\n.fg-index-story__description {\n max-width: 72ch;\n margin: var(--wzl-space-4) 0 0;\n font-family: var(--wzl-font-body);\n line-height: 1.5;\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-story {\n padding-top: calc(var(--wzl-space-lg) * 1.5);\n margin-top: calc(var(--wzl-space-lg) * 1.5);\n border-top: var(--wzl-border-w) solid var(--wzl-border);\n}\n\n.fg-index-story__head {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-6);\n}\n\n.fg-index-story__name {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: var(--wzl-font-size-xl);\n font-weight: var(--wzl-panel-title-weight);\n letter-spacing: var(--wzl-panel-title-tracking);\n text-transform: var(--wzl-panel-title-case);\n color: var(--wzl-panel-title-color);\n}\n\n.fg-index-cell {\n margin: var(--wzl-space-8) 0 0;\n width: fit-content;\n max-width: 100%;\n}\n\n.fg-index-cell__stage {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 96px;\n padding: var(--wzl-space-2);\n border: var(--wzl-border-w) solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n background: var(--wzl-surface);\n overflow: auto;\n}\n\n.fg-index-cell--padded > .fg-index-cell__stage {\n display: block;\n}\n\n.fg-index-cell--fullscreen {\n width: auto;\n}\n\n.fg-index-cell--fullscreen > .fg-index-cell__stage {\n display: block;\n height: 360px;\n padding: 0;\n}\n\n.fg-index-cell__label {\n margin-top: var(--wzl-space-3);\n font-family: var(--wzl-font-mono);\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-variants__row {\n margin-top: calc(var(--wzl-space-lg) * 1.25);\n}\n\n/* Set as the kit's panel titles are, at the small size. */\n.fg-index-variants__label {\n margin: 0;\n font-family: var(--wzl-panel-title-font);\n font-size: var(--wzl-font-size-sm);\n font-weight: var(--wzl-panel-title-weight);\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-variants__cells {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: var(--wzl-space-6);\n}\n\n.fg-index-variants__cells > .fg-index-cell {\n margin-top: var(--wzl-space-4);\n}\n\n.fg-index__library {\n margin-inline-end: var(--wzl-space-4);\n vertical-align: middle;\n}\n\n.fg-index__title-row {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-6);\n}\n\n.fg-index-deps {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--wzl-space-3) var(--wzl-space-8);\n margin: var(--wzl-space-8) 0 0;\n font-size: var(--wzl-font-size-sm);\n}\n\n.fg-index-deps__row {\n display: contents;\n}\n\n.fg-index-deps__label {\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-deps__value {\n margin: 0;\n}\n\n.fg-index-deps__list {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wzl-space-2) var(--wzl-space-6);\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.fg-index-deps__link {\n color: var(--wzl-accent-fg);\n text-decoration: none;\n}\n\n.fg-index-deps__link:hover {\n text-decoration: underline;\n}\n\n.fg-index-deps__prefix,\n.fg-index-deps__empty,\n.fg-index-deps__none {\n color: var(--wzl-fg-muted);\n}\n\n.fg-index-deps__none {\n max-width: 72ch;\n margin: var(--wzl-space-8) 0 0;\n font-size: var(--wzl-font-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ACT,cAAY;AACd;AAEA,CAAC;AACC,SAAO,IAAI;AACX,mBAAiB;AACnB;AAEA,CALC,mBAKmB;AAClB,mBAAiB;AACnB;AAEA,CAAC;AACD,CAAC;AACD,CAAC;AACC,SAAO,IAAI;AACb;AAEA,CAJC;AAKC,aAAW;AACX,UAAQ,IAAI,eAAe,EAAE;AAC7B,aAAW,IAAI;AACjB;","names":[]}
@@ -1,11 +1,13 @@
1
- import { F as FrameSetup, L as LoadedStory } from '../FrameController-BspC9Zr5.js';
2
- export { k as StartFrameOptions, r as reportImportFault, s as startFrame } from '../FrameController-BspC9Zr5.js';
1
+ import { F as FrameSetup, L as LoadedStory } from '../FrameController-RdGggdGA.js';
2
+ export { m as StartFrameOptions, r as reportImportFault, s as startFrame } from '../FrameController-RdGggdGA.js';
3
3
  import '@weasel-js/labkit/config';
4
4
  import 'react';
5
5
 
6
+ /** Story modules by file path, each loaded on first use. */
6
7
  interface FrameImporters {
7
8
  [file: string]: () => Promise<Record<string, unknown>>;
8
9
  }
10
+ /** One story as a frame document needs to find it, before its module is loaded. */
9
11
  interface FrameIndexEntry {
10
12
  id: string;
11
13
  /** The story's title as indexed, which titles the file's stories when its meta names none. */
@@ -16,7 +18,10 @@ interface FrameIndexEntry {
16
18
  description?: string;
17
19
  /** The JSDoc above the file's meta, which heads the index page. */
18
20
  componentDescription?: string;
21
+ /** The meta's `tags`. */
22
+ tags?: readonly string[];
19
23
  }
24
+ /** Inputs to `mountFrame`. `load` replaces the default module loader, `loadStories`. */
20
25
  interface MountFrameOptions {
21
26
  index: readonly FrameIndexEntry[];
22
27
  importers: FrameImporters;
@@ -1,8 +1,9 @@
1
- import { describeSchema, openChannel, isIndexId, indexId, answerSchema, IndexPage } from '../chunk-CSAXZIMV.js';
2
- import { createOverrides, createGlobalsTarget, loadStories, indexRenderOf, scanCssVars, runAxe, captureElement, StoryHost, resolveCssVar } from '../chunk-OLWZURU3.js';
3
- import '../chunk-2GXKNXTJ.js';
1
+ import { describeSchema, openChannel, isIndexId, libraryOf, indexId, answerSchema, IndexPage } from '../chunk-KIFCYY4F.js';
2
+ import { isGallery } from '../chunk-WEQSLPKT.js';
3
+ import { createOverrides, createGlobalsTarget, loadStories, indexRenderOf, scanCssVars, runAxe, captureElement, StoryHost, resolveCssVar } from '../chunk-NYBMOSSR.js';
4
+ import '../chunk-Y3WZ2EWR.js';
4
5
  import '../chunk-HRGPFQBW.js';
5
- import { FRAME_HELLO, stableStringify, PORT_HANDOFF } from '../chunk-JXIWZFD4.js';
6
+ import { FRAME_HELLO, stableStringify, PORT_HANDOFF } from '../chunk-YKN3IAEX.js';
6
7
  import { flushSync } from 'react-dom';
7
8
  import { createRoot } from 'react-dom/client';
8
9
  import { jsx } from 'react/jsx-runtime';
@@ -229,9 +230,12 @@ function startIndex(options) {
229
230
  if (!globals) return;
230
231
  const env = {
231
232
  title: options.title,
233
+ ...options.library === void 0 ? {} : { library: options.library },
232
234
  ...options.description === void 0 ? {} : { description: options.description },
233
235
  stories: options.stories,
234
236
  descriptions: options.descriptions,
237
+ gallery: options.gallery ?? false,
238
+ galleries: options.galleries ?? [],
235
239
  globals,
236
240
  decorators: setup.decorators ?? [],
237
241
  open: (id) => send({ type: "open", id }),
@@ -341,6 +345,9 @@ async function mountFrame(options) {
341
345
  startIndex({
342
346
  title,
343
347
  ...entries[0]?.componentDescription === void 0 ? {} : { description: entries[0].componentDescription },
348
+ library: libraryOf({ file: entries[0]?.file ?? "", title }),
349
+ gallery: entries.every(isGallery),
350
+ galleries: entries.filter(isGallery).map((e) => e.id),
344
351
  stories: stories2,
345
352
  descriptions: Object.fromEntries(entries.flatMap((e) => e.description ? [[e.id, e.description]] : [])),
346
353
  render: mods.map(indexRenderOf).find((render) => render !== null) ?? null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/frame/FrameController.tsx","../../src/frame/index/startIndex.tsx","../../src/frame/mountFrame.tsx"],"names":["createRoot","jsx","flushSync","id","stories","story"],"mappings":";;;;;;;;;;;AA8CA,I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AAM,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,OAAO,EAAE,CAAA;AACnD,IAAA,IAAI,CAAC,KAAA,EAAO,MAAM,IAAI,KAAA,CAAM,CAAA,kBAAA,EAAqB,EAAE,CAAA,CAAA,CAAG,CAAA;AACtD,IAAA,MAAM,GAAA,GAAM,MAAM,QAAA,CAAS,KAAA,CAAM,IAAI,CAAA;AACrC,IAAA,MAAM,OAAA,GAAA,CAAW,QAAQ,IAAA,IAAQ,WAAA,EAAa,KAAK,KAAA,CAAM,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAO,UAAU,CAAA;AACzF,IAAA,MAAM,KAAA,GAAQ,QAAQ,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,UAAA,KAAe,MAAM,UAAU,CAAA;AACnE,IAAA,IAAI,CAAC,KAAA,EAAO,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,KAAA,CAAM,IAAI,CAAA,sBAAA,EAAyB,KAAA,CAAM,UAAU,CAAA,CAAA,CAAG,CAAA;AACrF,IAAA,MAAM,OAAA,CAAQ,KAAA,EAAO,OAAA,GAAU,KAAK,CAAA;AACpC,IAAA,UAAA,CAAW,EAAE,KAAA,EAAO,OAAA,EAAS,WAAW,KAAA,EAAO,OAAA,CAAQ,OAAO,CAAA;AAAA,EAChE,SAAS,KAAA,EAAO;AACd,IAAA,iBAAA,CAAkB,SAAS,KAAK,CAAA;AAAA,EAClC;AACF","file":"index.js","sourcesContent":["import { flushSync } from 'react-dom';\nimport { createRoot } from 'react-dom/client';\nimport type { Channel } from '../protocol/channel';\nimport {\n type CssVarReport,\n type FaultPhase,\n type FromFrame,\n type Globals,\n stableStringify,\n type ToFrame,\n} from '../protocol/messages';\nimport { answerSchema, describeSchema } from '../protocol/schema';\nimport type { Decorator, LoadedStory, StoryContext } from '../story/types';\nimport { runAxe } from './a11y';\nimport { captureElement } from './capture';\nimport { createOverrides, resolveCssVar, scanCssVars } from './cssVars';\nimport { createGlobalsTarget, type GlobalsTarget } from './globalsTarget';\nimport { StoryHost } from './StoryHost';\n\nexport interface FrameSetup {\n /** Wraps every story, outermost; receives the globals. From the frame config (`frameConfig`). */\n decorators?: Decorator[];\n /** Applies globals to a target: theme mode, fonts. The target is a frame document's root, or one story's host in\n * the workshop document, so a rule the setup writes goes through `target.style` under `target.scope`. */\n applyGlobals?: (globals: Globals, target: GlobalsTarget) => void;\n /**\n * The elements a CSS variable override is declared on; `:root` by default. An override has to be declared on\n * whichever element declares the token itself — a theme wrapper, say — or that element's own value wins.\n */\n cssVarsScope?: string;\n /** Project-wide CSF parameters, Storybook's preview `parameters`: under each meta's and story's. */\n parameters?: Record<string, unknown>;\n /**\n * Awaited once a story is loaded and before it first renders — the place to import what only some stories\n * need, so the rest never load it.\n */\n prepare?: (story: LoadedStory) => void | Promise<void>;\n}\n\nexport interface StartFrameOptions {\n story: LoadedStory;\n channel: Channel<ToFrame, FromFrame>;\n container: HTMLElement;\n setup?: FrameSetup;\n}\n\nconst VARS_SETTLE_MS = 100;\n\nfunction fault(phase: FaultPhase, error: unknown, seq?: number): FromFrame {\n return {\n type: 'fault',\n phase,\n message: error instanceof Error ? error.message : String(error),\n ...(error instanceof Error && error.stack ? { stack: error.stack } : {}),\n ...(seq === undefined ? {} : { seq }),\n };\n}\n\n/** Sends `ready`, then renders the story on `init` and keeps it in step. Returns a stop function. */\nexport function startFrame({ story, channel, container, setup = {} }: StartFrameOptions): () => void {\n const { send } = channel;\n send({ type: 'ready', schema: describeSchema(story.config), layout: story.layout, viewport: story.viewport });\n\n const wrapper = document.createElement('div');\n wrapper.className = `fg-frame fg-frame--${story.layout}`;\n container.append(wrapper);\n const root = createRoot(wrapper);\n const decorators = setup.decorators ?? [];\n\n let initialized = false;\n let rendered = false;\n let config: unknown;\n let state: unknown = null;\n let globals: Globals = {};\n let answeredKey: string | null = null;\n let resetKey = 0;\n let seq = 0;\n\n const overrides = createOverrides(document, setup.cssVarsScope);\n const globalsTarget = createGlobalsTarget(document.documentElement, ':root');\n let lastVars: CssVarReport[] | null = null;\n let reported: string | null = null;\n const publishVars = (vars: CssVarReport[]) => {\n lastVars = vars;\n const key = JSON.stringify(vars);\n if (key === reported) return;\n reported = key;\n send({ type: 'vars', vars });\n };\n const reportVars = () => publishVars(scanCssVars(document, overrides.has));\n const ownMutation = (record: MutationRecord) =>\n overrides.owns(record.target) ||\n (record.type === 'childList' &&\n [...record.addedNodes, ...record.removedNodes].length > 0 &&\n [...record.addedNodes, ...record.removedNodes].every(overrides.owns));\n let settleTimer: ReturnType<typeof setTimeout> | undefined;\n const mutations =\n typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver((records) => {\n if (records.every(ownMutation)) return;\n clearTimeout(settleTimer);\n settleTimer = setTimeout(reportVars, VARS_SETTLE_MS);\n });\n // Every attribute, not just style and class: a stylesheet can select on any of them, `[data-wzl-mode]` included.\n mutations?.observe(document.documentElement, { subtree: true, childList: true, characterData: true, attributes: true });\n\n const setConfig = (path: string, value: unknown) => send({ type: 'setConfig', path, value });\n const setState = (next: unknown) => {\n state = typeof next === 'function' ? (next as (prev: unknown) => unknown)(state) : next;\n send({ type: 'setState', state });\n render();\n };\n\n const render = () => {\n const ctx: StoryContext = { config, setConfig, state, setState, globals, title: story.title, name: story.name };\n const at = seq;\n root.render(\n <StoryHost\n story={story}\n ctx={ctx}\n decorators={decorators}\n resetKey={resetKey}\n onError={(error) => send(fault('render', error, at))}\n />,\n );\n const key = stableStringify(config);\n if (key !== answeredKey) {\n answeredKey = key;\n send({ type: 'answers', answers: { configKey: key, ...answerSchema(story.config, config) } });\n }\n };\n\n // Input from the trial commits synchronously, so a `play` that follows sees the rendered story. A throw while\n // applying it faults like a render would; otherwise the trial would wait on a frame that never answers.\n const input = (apply: () => void) => {\n seq += 1;\n try {\n apply();\n if (!initialized) return;\n resetKey += 1;\n flushSync(render);\n } catch (error) {\n send(fault('render', error, seq));\n return;\n }\n if (!rendered) {\n rendered = true;\n announceRendered();\n }\n reportVars();\n };\n\n /**\n * The shell unhides the frame on `rendered` and fades it in, so whatever\n * reflows after that message reads as a glide rather than a jump. A webfont\n * swapping in is the reflow that does it: a `layout: 'padded'` story is\n * top-anchored, so the line-height change walks the whole story upward.\n * Waiting for the fonts and then one painted frame means the story the\n * shell reveals is the settled one.\n *\n * `document.fonts` is absent in jsdom, where there is no paint to wait for\n * and no font to swap — the message stays synchronous there, which is also\n * what `FrameController.test.tsx` observes. The deferral itself is only\n * exercised in a browser.\n */\n const announceRendered = () => {\n const { fonts } = document;\n if (!fonts) {\n send({ type: 'rendered' });\n return;\n }\n const afterPaint = () => requestAnimationFrame(() => send({ type: 'rendered' }));\n void fonts.ready.then(afterPaint, afterPaint);\n };\n\n const play = async () => {\n try {\n await story.play?.({ canvasElement: wrapper, config, globals });\n send({ type: 'played', ok: true });\n } catch (error) {\n send({ type: 'played', ok: false, message: error instanceof Error ? error.message : String(error) });\n send(fault('play', error));\n }\n };\n\n const audit = async (id: string) => {\n try {\n send({ type: 'a11y', id, ok: true, report: await runAxe(wrapper) });\n } catch (error) {\n send({ type: 'a11y', id, ok: false, message: error instanceof Error ? error.message : String(error) });\n }\n };\n\n const picture = (id: string) => {\n try {\n send({ type: 'capture', id, ok: true, picture: captureElement(wrapper) });\n } catch (error) {\n send({ type: 'capture', id, ok: false, message: error instanceof Error ? error.message : String(error) });\n }\n };\n\n const off = channel.on((msg) => {\n switch (msg.type) {\n case 'init':\n input(() => {\n initialized = true;\n config = msg.config;\n globals = msg.globals;\n state = msg.state;\n if (state === null && story.initialState) {\n state = story.initialState(config);\n send({ type: 'setState', state });\n }\n setup.applyGlobals?.(globals, globalsTarget);\n });\n break;\n case 'config':\n input(() => {\n config = msg.config;\n });\n break;\n case 'state':\n input(() => {\n state = msg.state;\n });\n break;\n case 'globals':\n input(() => {\n globals = msg.globals;\n setup.applyGlobals?.(globals, globalsTarget);\n });\n break;\n case 'vars.set': {\n overrides.set(msg.name, msg.value);\n const at = lastVars?.findIndex((v) => v.name === msg.name) ?? -1;\n if (!lastVars || at < 0) break;\n const vars = lastVars.slice();\n vars[at] = { name: msg.name, value: resolveCssVar(document, msg.name), overridden: overrides.has(msg.name) };\n publishVars(vars);\n break;\n }\n case 'play':\n void play();\n break;\n case 'a11y.run':\n void audit(msg.id);\n break;\n case 'capture.run':\n picture(msg.id);\n break;\n }\n });\n\n const observer =\n typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(() => {\n const { width, height } = wrapper.getBoundingClientRect();\n send({ type: 'size', width: Math.ceil(width), height: Math.ceil(height) });\n });\n observer?.observe(wrapper);\n\n return () => {\n off();\n observer?.disconnect();\n mutations?.disconnect();\n clearTimeout(settleTimer);\n overrides.dispose();\n globalsTarget.dispose();\n root.unmount();\n wrapper.remove();\n };\n}\n\n/** Reports an import failure — there is no story to start. */\nexport function reportImportFault(channel: Channel<ToFrame, FromFrame>, error: unknown): void {\n channel.send(fault('import', error));\n}\n","import { f } from '@weasel-js/labkit/config';\nimport { Component, type ReactNode } from 'react';\nimport { flushSync } from 'react-dom';\nimport { createRoot } from 'react-dom/client';\nimport type { Channel } from '../../protocol/channel';\nimport type { FromFrame, Globals, ToFrame } from '../../protocol/messages';\nimport { describeSchema } from '../../protocol/schema';\nimport type { IndexRender, LoadedStory } from '../../story/types';\nimport { runAxe } from '../a11y';\nimport { captureElement } from '../capture';\nimport type { FrameSetup } from '../FrameController';\nimport { createGlobalsTarget } from '../globalsTarget';\nimport { type IndexEnv, IndexPage } from './IndexPage';\nimport './index.css';\n\nexport interface StartIndexOptions {\n title: string;\n description?: string;\n /** In file order. */\n stories: readonly LoadedStory[];\n descriptions: Readonly<Record<string, string>>;\n /** The component's own page; null for the generated one. */\n render: IndexRender | null;\n channel: Channel<ToFrame, FromFrame>;\n container: HTMLElement;\n setup?: FrameSetup;\n}\n\nconst message = (error: unknown): string => (error instanceof Error ? error.message : String(error));\n\n/** Faults the frame when the page itself throws. A single story's throw stays in its own cell. */\nclass PageBoundary extends Component<{ onError: (error: unknown) => void; children: ReactNode }, { failed: unknown }> {\n override state = { failed: null as unknown };\n\n static getDerivedStateFromError(error: unknown) {\n return { failed: error ?? new Error('Index page failed') };\n }\n\n override componentDidCatch(error: unknown): void {\n this.props.onError(error);\n }\n\n override render(): ReactNode {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/**\n * Sends `ready` for a page with no controls, then renders the component's index on `init` and follows the lab's\n * globals. Returns a stop function.\n */\nexport function startIndex(options: StartIndexOptions): () => void {\n const { channel, container, setup = {} } = options;\n const { send } = channel;\n send({ type: 'ready', schema: describeSchema(f.schema({})), layout: 'fullscreen', viewport: null });\n\n const wrapper = document.createElement('div');\n wrapper.className = 'fg-frame fg-frame--fullscreen';\n container.append(wrapper);\n const root = createRoot(wrapper);\n const globalsTarget = createGlobalsTarget(document.documentElement, ':root');\n let globals: Globals | null = null;\n let announced = false;\n\n const render = (): void => {\n if (!globals) return;\n const env: IndexEnv = {\n title: options.title,\n ...(options.description === undefined ? {} : { description: options.description }),\n stories: options.stories,\n descriptions: options.descriptions,\n globals,\n decorators: setup.decorators ?? [],\n open: (id) => send({ type: 'open', id }),\n // A story that throws shows its error in its own cell; the rest of the page is still worth reading.\n onError: (error) => console.error(error),\n };\n root.render(\n <PageBoundary onError={(error) => send({ type: 'fault', phase: 'render', message: message(error) })}>\n <IndexPage env={env} render={options.render} />\n </PageBoundary>,\n );\n };\n\n const announce = (): void => {\n if (announced) return;\n announced = true;\n const { fonts } = document;\n if (!fonts) {\n send({ type: 'rendered' });\n return;\n }\n const afterPaint = () => requestAnimationFrame(() => send({ type: 'rendered' }));\n void fonts.ready.then(afterPaint, afterPaint);\n };\n\n const off = channel.on((msg) => {\n switch (msg.type) {\n case 'init':\n case 'globals':\n globals = msg.globals;\n setup.applyGlobals?.(globals, globalsTarget);\n flushSync(render);\n announce();\n break;\n case 'a11y.run':\n runAxe(wrapper).then(\n (report) => send({ type: 'a11y', id: msg.id, ok: true, report }),\n (error: unknown) => send({ type: 'a11y', id: msg.id, ok: false, message: message(error) }),\n );\n break;\n case 'capture.run':\n try {\n send({ type: 'capture', id: msg.id, ok: true, picture: captureElement(wrapper) });\n } catch (error) {\n send({ type: 'capture', id: msg.id, ok: false, message: message(error) });\n }\n break;\n default:\n break;\n }\n });\n\n return () => {\n off();\n globalsTarget.dispose();\n root.unmount();\n wrapper.remove();\n };\n}\n","import { openChannel } from '../protocol/channel';\nimport { FRAME_HELLO, type FromFrame, PORT_HANDOFF, type ToFrame } from '../protocol/messages';\nimport { indexId, isIndexId } from '../story/indexPages';\nimport { indexRenderOf, loadStories } from '../story/load';\nimport type { LoadedStory } from '../story/types';\nimport { type FrameSetup, reportImportFault, startFrame } from './FrameController';\nimport { startIndex } from './index/startIndex';\n\nexport interface FrameImporters {\n [file: string]: () => Promise<Record<string, unknown>>;\n}\n\nexport interface FrameIndexEntry {\n id: string;\n /** The story's title as indexed, which titles the file's stories when its meta names none. */\n title: string;\n file: string;\n exportName: string;\n /** The JSDoc above the story's export, which its index page shows. */\n description?: string;\n /** The JSDoc above the file's meta, which heads the index page. */\n componentDescription?: string;\n}\n\nexport interface MountFrameOptions {\n index: readonly FrameIndexEntry[];\n importers: FrameImporters;\n setup?: FrameSetup;\n load?: (mod: Record<string, unknown>, autoTitle: string, parameters?: Record<string, unknown>) => LoadedStory[];\n}\n\nexport { indexRenderOf, loadStories } from '../story/load';\n\nfunction waitForHandoff():Promise<{ port: MessagePort; id: string | null }> {\n return new Promise((resolve) => {\n const onMessage = (event: MessageEvent) => {\n const data = event.data as { type?: unknown; id?: unknown } | null;\n const port = event.ports[0];\n if (event.origin !== location.origin || event.source !== window.parent) return;\n if (typeof data !== 'object' || data === null || data.type !== PORT_HANDOFF || !port) return;\n window.removeEventListener('message', onMessage);\n resolve({ port, id: typeof data.id === 'string' ? data.id : null });\n };\n window.addEventListener('message', onMessage);\n });\n}\n\n/**\n * The frame document's entry: asks its parent for a port and shows what the handoff names, or, from a shell that\n * names nothing, what the hash does. The hash is read at once, so its module loads during the handshake.\n */\nexport async function mountFrame(options: MountFrameOptions): Promise<void> {\n const imports = new Map<string, Promise<Record<string, unknown>>>();\n const importOf = (file: string): Promise<Record<string, unknown>> => {\n let loading = imports.get(file);\n if (!loading) {\n const importer = options.importers[file];\n if (!importer) throw new Error(`No importer for ${file}`);\n loading = importer();\n imports.set(file, loading);\n }\n return loading;\n };\n /** The entries `id` shows: one story, or every story of the component an index id names. */\n const entriesOf = (id: string): FrameIndexEntry[] =>\n isIndexId(id)\n ? options.index.filter((e) => indexId(e.title) === id)\n : options.index.filter((e) => e.id === id);\n const early = location.hash.slice(1) || null;\n // Only starts the fetch; whoever awaits the import later sees its outcome.\n for (const file of new Set(early === null ? [] : entriesOf(early).map((e) => e.file))) {\n if (options.importers[file]) importOf(file).catch(() => {});\n }\n\n const handoff = waitForHandoff();\n window.parent.postMessage({ type: FRAME_HELLO }, location.origin);\n const { port, id: handed } = await handoff;\n const channel = openChannel<ToFrame, FromFrame>(port);\n const id = handed ?? early ?? '';\n const container = document.getElementById('root') ?? document.body;\n try {\n if (isIndexId(id)) {\n const entries = entriesOf(id);\n const title = entries[0]?.title;\n if (title === undefined) throw new Error(`No component with index \"${id}\"`);\n const files = [...new Set(entries.map((e) => e.file))];\n const mods = await Promise.all(files.map(importOf));\n const loaded = files.map((file, i) => ({\n file,\n stories: (options.load ?? loadStories)(mods[i] ?? {}, title, options.setup?.parameters),\n }));\n const stories = entries.flatMap(\n (e) => loaded.find((l) => l.file === e.file)?.stories.find((s) => s.exportName === e.exportName) ?? [],\n );\n for (const story of stories) await options.setup?.prepare?.(story);\n startIndex({\n title,\n ...(entries[0]?.componentDescription === undefined ? {} : { description: entries[0].componentDescription }),\n stories,\n descriptions: Object.fromEntries(entries.flatMap((e) => (e.description ? [[e.id, e.description]] : []))),\n render: mods.map(indexRenderOf).find((render) => render !== null) ?? null,\n channel,\n container,\n ...(options.setup ? { setup: options.setup } : {}),\n });\n return;\n }\n const entry = options.index.find((e) => e.id === id);\n if (!entry) throw new Error(`No story with id \"${id}\"`);\n const mod = await importOf(entry.file);\n const stories = (options.load ?? loadStories)(mod, entry.title, options.setup?.parameters);\n const story = stories.find((s) => s.exportName === entry.exportName);\n if (!story) throw new Error(`${entry.file} has no story export \"${entry.exportName}\"`);\n await options.setup?.prepare?.(story);\n startFrame({ story, channel, container, setup: options.setup });\n } catch (error) {\n reportImportFault(channel, error);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/frame/FrameController.tsx","../../src/frame/index/startIndex.tsx","../../src/frame/mountFrame.tsx"],"names":["createRoot","jsx","flushSync","id","stories","story"],"mappings":";;;;;;;;;;;;AAgDA,IAAM,cAAA,GAAiB,GAAA;AAEvB,SAAS,KAAA,CAAM,KAAA,EAAmB,KAAA,EAAgB,GAAA,EAAyB;AACzE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,OAAA;AAAA,IACN,KAAA;AAAA,IACA,SAAS,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AAAA,IAC9D,GAAI,KAAA,YAAiB,KAAA,IAAS,KAAA,CAAM,KAAA,GAAQ,EAAE,KAAA,EAAO,KAAA,CAAM,KAAA,EAAM,GAAI,EAAC;AAAA,IACtE,GAAI,GAAA,KAAQ,MAAA,GAAY,EAAC,GAAI,EAAE,GAAA;AAAI,GACrC;AACF;AAGO,SAAS,UAAA,CAAW,EAAE,KAAA,EAAO,OAAA,EAAS,WAAW,KAAA,GAAQ,IAAG,EAAkC;AACnG,EAAA,MAAM,EAAE,MAAK,GAAI,OAAA;AACjB,EAAA,IAAA,CAAK,EAAE,IAAA,EAAM,OAAA,EAAS,MAAA,EAAQ,eAAe,KAAA,CAAM,MAAM,CAAA,EAAG,MAAA,EAAQ,KAAA,CAAM,MAAA,EAAQ,QAAA,EAAU,KAAA,CAAM,UAAU,CAAA;AAE5G,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AAC5C,EAAA,OAAA,CAAQ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AM,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAO,UAAU,CAAA;AACzF,IAAA,MAAM,KAAA,GAAQ,QAAQ,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,UAAA,KAAe,MAAM,UAAU,CAAA;AACnE,IAAA,IAAI,CAAC,KAAA,EAAO,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,KAAA,CAAM,IAAI,CAAA,sBAAA,EAAyB,KAAA,CAAM,UAAU,CAAA,CAAA,CAAG,CAAA;AACrF,IAAA,MAAM,OAAA,CAAQ,KAAA,EAAO,OAAA,GAAU,KAAK,CAAA;AACpC,IAAA,UAAA,CAAW,EAAE,KAAA,EAAO,OAAA,EAAS,WAAW,KAAA,EAAO,OAAA,CAAQ,OAAO,CAAA;AAAA,EAChE,SAAS,KAAA,EAAO;AACd,IAAA,iBAAA,CAAkB,SAAS,KAAK,CAAA;AAAA,EAClC;AACF","file":"index.js","sourcesContent":["import { flushSync } from 'react-dom';\nimport { createRoot } from 'react-dom/client';\nimport type { Channel } from '../protocol/channel';\nimport {\n type CssVarReport,\n type FaultPhase,\n type FromFrame,\n type Globals,\n stableStringify,\n type ToFrame,\n} from '../protocol/messages';\nimport { answerSchema, describeSchema } from '../protocol/schema';\nimport type { Decorator, LoadedStory, StoryContext } from '../story/types';\nimport { runAxe } from './a11y';\nimport { captureElement } from './capture';\nimport { createOverrides, resolveCssVar, scanCssVars } from './cssVars';\nimport { createGlobalsTarget, type GlobalsTarget } from './globalsTarget';\nimport { StoryHost } from './StoryHost';\n\n/** The frame config: what `defineFrameConfig` returns and the `frameConfig` module default-exports. */\nexport interface FrameSetup {\n /** Wraps every story, outermost; receives the globals. From the frame config (`frameConfig`). */\n decorators?: Decorator[];\n /** Applies globals to a target: theme mode, fonts. The target is a frame document's root, or one story's host in\n * the workshop document, so a rule the setup writes goes through `target.style` under `target.scope`. */\n applyGlobals?: (globals: Globals, target: GlobalsTarget) => void;\n /**\n * The elements a CSS variable override is declared on; `:root` by default. An override has to be declared on\n * whichever element declares the token itself — a theme wrapper, say — or that element's own value wins.\n */\n cssVarsScope?: string;\n /** Project-wide CSF parameters, Storybook's preview `parameters`: under each meta's and story's. */\n parameters?: Record<string, unknown>;\n /**\n * Awaited once a story is loaded and before it first renders — the place to import what only some stories\n * need, so the rest never load it.\n */\n prepare?: (story: LoadedStory) => void | Promise<void>;\n}\n\n/** Inputs to `startFrame`: the story, the channel to the shell, and the element to render into. */\nexport interface StartFrameOptions {\n story: LoadedStory;\n channel: Channel<ToFrame, FromFrame>;\n container: HTMLElement;\n setup?: FrameSetup;\n}\n\nconst VARS_SETTLE_MS = 100;\n\nfunction fault(phase: FaultPhase, error: unknown, seq?: number): FromFrame {\n return {\n type: 'fault',\n phase,\n message: error instanceof Error ? error.message : String(error),\n ...(error instanceof Error && error.stack ? { stack: error.stack } : {}),\n ...(seq === undefined ? {} : { seq }),\n };\n}\n\n/** Sends `ready`, then renders the story on `init` and keeps it in step. Returns a stop function. */\nexport function startFrame({ story, channel, container, setup = {} }: StartFrameOptions): () => void {\n const { send } = channel;\n send({ type: 'ready', schema: describeSchema(story.config), layout: story.layout, viewport: story.viewport });\n\n const wrapper = document.createElement('div');\n wrapper.className = `fg-frame fg-frame--${story.layout}`;\n container.append(wrapper);\n const root = createRoot(wrapper);\n const decorators = setup.decorators ?? [];\n\n let initialized = false;\n let rendered = false;\n let config: unknown;\n let state: unknown = null;\n let globals: Globals = {};\n let answeredKey: string | null = null;\n let resetKey = 0;\n let seq = 0;\n\n const overrides = createOverrides(document, setup.cssVarsScope);\n const globalsTarget = createGlobalsTarget(document.documentElement, ':root');\n let lastVars: CssVarReport[] | null = null;\n let reported: string | null = null;\n const publishVars = (vars: CssVarReport[]) => {\n lastVars = vars;\n const key = JSON.stringify(vars);\n if (key === reported) return;\n reported = key;\n send({ type: 'vars', vars });\n };\n const reportVars = () => publishVars(scanCssVars(document, overrides.has));\n const ownMutation = (record: MutationRecord) =>\n overrides.owns(record.target) ||\n (record.type === 'childList' &&\n [...record.addedNodes, ...record.removedNodes].length > 0 &&\n [...record.addedNodes, ...record.removedNodes].every(overrides.owns));\n let settleTimer: ReturnType<typeof setTimeout> | undefined;\n const mutations =\n typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver((records) => {\n if (records.every(ownMutation)) return;\n clearTimeout(settleTimer);\n settleTimer = setTimeout(reportVars, VARS_SETTLE_MS);\n });\n // Every attribute, not just style and class: a stylesheet can select on any of them, `[data-wzl-mode]` included.\n mutations?.observe(document.documentElement, { subtree: true, childList: true, characterData: true, attributes: true });\n\n const setConfig = (path: string, value: unknown) => send({ type: 'setConfig', path, value });\n const setState = (next: unknown) => {\n state = typeof next === 'function' ? (next as (prev: unknown) => unknown)(state) : next;\n send({ type: 'setState', state });\n render();\n };\n\n const render = () => {\n const ctx: StoryContext = { config, setConfig, state, setState, globals, title: story.title, name: story.name };\n const at = seq;\n root.render(\n <StoryHost\n story={story}\n ctx={ctx}\n decorators={decorators}\n resetKey={resetKey}\n onError={(error) => send(fault('render', error, at))}\n />,\n );\n const key = stableStringify(config);\n if (key !== answeredKey) {\n answeredKey = key;\n send({ type: 'answers', answers: { configKey: key, ...answerSchema(story.config, config) } });\n }\n };\n\n // Input from the trial commits synchronously, so a `play` that follows sees the rendered story. A throw while\n // applying it faults like a render would; otherwise the trial would wait on a frame that never answers.\n const input = (apply: () => void) => {\n seq += 1;\n try {\n apply();\n if (!initialized) return;\n resetKey += 1;\n flushSync(render);\n } catch (error) {\n send(fault('render', error, seq));\n return;\n }\n if (!rendered) {\n rendered = true;\n announceRendered();\n }\n reportVars();\n };\n\n /**\n * The shell unhides the frame on `rendered` and fades it in, so whatever\n * reflows after that message reads as a glide rather than a jump. A webfont\n * swapping in is the reflow that does it: a `layout: 'padded'` story is\n * top-anchored, so the line-height change walks the whole story upward.\n * Waiting for the fonts and then one painted frame means the story the\n * shell reveals is the settled one.\n *\n * `document.fonts` is absent in jsdom, where there is no paint to wait for\n * and no font to swap — the message stays synchronous there, which is also\n * what `FrameController.test.tsx` observes. The deferral itself is only\n * exercised in a browser.\n */\n const announceRendered = () => {\n const { fonts } = document;\n if (!fonts) {\n send({ type: 'rendered' });\n return;\n }\n const afterPaint = () => requestAnimationFrame(() => send({ type: 'rendered' }));\n void fonts.ready.then(afterPaint, afterPaint);\n };\n\n const play = async () => {\n try {\n await story.play?.({ canvasElement: wrapper, config, globals });\n send({ type: 'played', ok: true });\n } catch (error) {\n send({ type: 'played', ok: false, message: error instanceof Error ? error.message : String(error) });\n send(fault('play', error));\n }\n };\n\n const audit = async (id: string) => {\n try {\n send({ type: 'a11y', id, ok: true, report: await runAxe(wrapper) });\n } catch (error) {\n send({ type: 'a11y', id, ok: false, message: error instanceof Error ? error.message : String(error) });\n }\n };\n\n const picture = (id: string) => {\n try {\n send({ type: 'capture', id, ok: true, picture: captureElement(wrapper) });\n } catch (error) {\n send({ type: 'capture', id, ok: false, message: error instanceof Error ? error.message : String(error) });\n }\n };\n\n const off = channel.on((msg) => {\n switch (msg.type) {\n case 'init':\n input(() => {\n initialized = true;\n config = msg.config;\n globals = msg.globals;\n state = msg.state;\n if (state === null && story.initialState) {\n state = story.initialState(config);\n send({ type: 'setState', state });\n }\n setup.applyGlobals?.(globals, globalsTarget);\n });\n break;\n case 'config':\n input(() => {\n config = msg.config;\n });\n break;\n case 'state':\n input(() => {\n state = msg.state;\n });\n break;\n case 'globals':\n input(() => {\n globals = msg.globals;\n setup.applyGlobals?.(globals, globalsTarget);\n });\n break;\n case 'vars.set': {\n overrides.set(msg.name, msg.value);\n const at = lastVars?.findIndex((v) => v.name === msg.name) ?? -1;\n if (!lastVars || at < 0) break;\n const vars = lastVars.slice();\n vars[at] = { name: msg.name, value: resolveCssVar(document, msg.name), overridden: overrides.has(msg.name) };\n publishVars(vars);\n break;\n }\n case 'play':\n void play();\n break;\n case 'a11y.run':\n void audit(msg.id);\n break;\n case 'capture.run':\n picture(msg.id);\n break;\n }\n });\n\n const observer =\n typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(() => {\n const { width, height } = wrapper.getBoundingClientRect();\n send({ type: 'size', width: Math.ceil(width), height: Math.ceil(height) });\n });\n observer?.observe(wrapper);\n\n return () => {\n off();\n observer?.disconnect();\n mutations?.disconnect();\n clearTimeout(settleTimer);\n overrides.dispose();\n globalsTarget.dispose();\n root.unmount();\n wrapper.remove();\n };\n}\n\n/** Reports an import failure — there is no story to start. */\nexport function reportImportFault(channel: Channel<ToFrame, FromFrame>, error: unknown): void {\n channel.send(fault('import', error));\n}\n","import { f } from '@weasel-js/labkit/config';\nimport { Component, type ReactNode } from 'react';\nimport { flushSync } from 'react-dom';\nimport { createRoot } from 'react-dom/client';\nimport type { Channel } from '../../protocol/channel';\nimport type { FromFrame, Globals, ToFrame } from '../../protocol/messages';\nimport { describeSchema } from '../../protocol/schema';\nimport type { IndexRender, LoadedStory } from '../../story/types';\nimport { runAxe } from '../a11y';\nimport { captureElement } from '../capture';\nimport type { FrameSetup } from '../FrameController';\nimport { createGlobalsTarget } from '../globalsTarget';\nimport { type IndexEnv, IndexPage } from './IndexPage';\n\nexport interface StartIndexOptions {\n title: string;\n /** The package the component ships in. */\n library?: string;\n description?: string;\n /** Whether the component is a gallery. */\n gallery?: boolean;\n /** The ids of the stories tagged `gallery`. */\n galleries?: readonly string[];\n /** In file order. */\n stories: readonly LoadedStory[];\n descriptions: Readonly<Record<string, string>>;\n /** The component's own page; null for the generated one. */\n render: IndexRender | null;\n channel: Channel<ToFrame, FromFrame>;\n container: HTMLElement;\n setup?: FrameSetup;\n}\n\nconst message = (error: unknown): string => (error instanceof Error ? error.message : String(error));\n\n/** Faults the frame when the page itself throws. A single story's throw stays in its own cell. */\nclass PageBoundary extends Component<{ onError: (error: unknown) => void; children: ReactNode }, { failed: unknown }> {\n override state = { failed: null as unknown };\n\n static getDerivedStateFromError(error: unknown) {\n return { failed: error ?? new Error('Index page failed') };\n }\n\n override componentDidCatch(error: unknown): void {\n this.props.onError(error);\n }\n\n override render(): ReactNode {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/**\n * Sends `ready` for a page with no controls, then renders the component's index on `init` and follows the lab's\n * globals. Returns a stop function.\n */\nexport function startIndex(options: StartIndexOptions): () => void {\n const { channel, container, setup = {} } = options;\n const { send } = channel;\n send({ type: 'ready', schema: describeSchema(f.schema({})), layout: 'fullscreen', viewport: null });\n\n const wrapper = document.createElement('div');\n wrapper.className = 'fg-frame fg-frame--fullscreen';\n container.append(wrapper);\n const root = createRoot(wrapper);\n const globalsTarget = createGlobalsTarget(document.documentElement, ':root');\n let globals: Globals | null = null;\n let announced = false;\n\n const render = (): void => {\n if (!globals) return;\n const env: IndexEnv = {\n title: options.title,\n ...(options.library === undefined ? {} : { library: options.library }),\n ...(options.description === undefined ? {} : { description: options.description }),\n stories: options.stories,\n descriptions: options.descriptions,\n gallery: options.gallery ?? false,\n galleries: options.galleries ?? [],\n globals,\n decorators: setup.decorators ?? [],\n open: (id) => send({ type: 'open', id }),\n // A story that throws shows its error in its own cell; the rest of the page is still worth reading.\n onError: (error) => console.error(error),\n };\n root.render(\n <PageBoundary onError={(error) => send({ type: 'fault', phase: 'render', message: message(error) })}>\n <IndexPage env={env} render={options.render} />\n </PageBoundary>,\n );\n };\n\n const announce = (): void => {\n if (announced) return;\n announced = true;\n const { fonts } = document;\n if (!fonts) {\n send({ type: 'rendered' });\n return;\n }\n const afterPaint = () => requestAnimationFrame(() => send({ type: 'rendered' }));\n void fonts.ready.then(afterPaint, afterPaint);\n };\n\n const off = channel.on((msg) => {\n switch (msg.type) {\n case 'init':\n case 'globals':\n globals = msg.globals;\n setup.applyGlobals?.(globals, globalsTarget);\n flushSync(render);\n announce();\n break;\n case 'a11y.run':\n runAxe(wrapper).then(\n (report) => send({ type: 'a11y', id: msg.id, ok: true, report }),\n (error: unknown) => send({ type: 'a11y', id: msg.id, ok: false, message: message(error) }),\n );\n break;\n case 'capture.run':\n try {\n send({ type: 'capture', id: msg.id, ok: true, picture: captureElement(wrapper) });\n } catch (error) {\n send({ type: 'capture', id: msg.id, ok: false, message: message(error) });\n }\n break;\n default:\n break;\n }\n });\n\n return () => {\n off();\n globalsTarget.dispose();\n root.unmount();\n wrapper.remove();\n };\n}\n","import { openChannel } from '../protocol/channel';\nimport { FRAME_HELLO, type FromFrame, PORT_HANDOFF, type ToFrame } from '../protocol/messages';\nimport { indexId, isIndexId } from '../story/indexPages';\nimport { libraryOf } from '../story/library';\nimport { isGallery } from '../story/tags';\nimport { indexRenderOf, loadStories } from '../story/load';\nimport type { LoadedStory } from '../story/types';\nimport { type FrameSetup, reportImportFault, startFrame } from './FrameController';\nimport { startIndex } from './index/startIndex';\n\n/** Story modules by file path, each loaded on first use. */\nexport interface FrameImporters {\n [file: string]: () => Promise<Record<string, unknown>>;\n}\n\n/** One story as a frame document needs to find it, before its module is loaded. */\nexport interface FrameIndexEntry {\n id: string;\n /** The story's title as indexed, which titles the file's stories when its meta names none. */\n title: string;\n file: string;\n exportName: string;\n /** The JSDoc above the story's export, which its index page shows. */\n description?: string;\n /** The JSDoc above the file's meta, which heads the index page. */\n componentDescription?: string;\n /** The meta's `tags`. */\n tags?: readonly string[];\n}\n\n/** Inputs to `mountFrame`. `load` replaces the default module loader, `loadStories`. */\nexport interface MountFrameOptions {\n index: readonly FrameIndexEntry[];\n importers: FrameImporters;\n setup?: FrameSetup;\n load?: (mod: Record<string, unknown>, autoTitle: string, parameters?: Record<string, unknown>) => LoadedStory[];\n}\n\nexport { indexRenderOf, loadStories } from '../story/load';\n\nfunction waitForHandoff():Promise<{ port: MessagePort; id: string | null }> {\n return new Promise((resolve) => {\n const onMessage = (event: MessageEvent) => {\n const data = event.data as { type?: unknown; id?: unknown } | null;\n const port = event.ports[0];\n if (event.origin !== location.origin || event.source !== window.parent) return;\n if (typeof data !== 'object' || data === null || data.type !== PORT_HANDOFF || !port) return;\n window.removeEventListener('message', onMessage);\n resolve({ port, id: typeof data.id === 'string' ? data.id : null });\n };\n window.addEventListener('message', onMessage);\n });\n}\n\n/**\n * The frame document's entry: asks its parent for a port and shows what the handoff names, or, from a shell that\n * names nothing, what the hash does. The hash is read at once, so its module loads during the handshake.\n */\nexport async function mountFrame(options: MountFrameOptions): Promise<void> {\n const imports = new Map<string, Promise<Record<string, unknown>>>();\n const importOf = (file: string): Promise<Record<string, unknown>> => {\n let loading = imports.get(file);\n if (!loading) {\n const importer = options.importers[file];\n if (!importer) throw new Error(`No importer for ${file}`);\n loading = importer();\n imports.set(file, loading);\n }\n return loading;\n };\n /** The entries `id` shows: one story, or every story of the component an index id names. */\n const entriesOf = (id: string): FrameIndexEntry[] =>\n isIndexId(id)\n ? options.index.filter((e) => indexId(e.title) === id)\n : options.index.filter((e) => e.id === id);\n const early = location.hash.slice(1) || null;\n // Only starts the fetch; whoever awaits the import later sees its outcome.\n for (const file of new Set(early === null ? [] : entriesOf(early).map((e) => e.file))) {\n if (options.importers[file]) importOf(file).catch(() => {});\n }\n\n const handoff = waitForHandoff();\n window.parent.postMessage({ type: FRAME_HELLO }, location.origin);\n const { port, id: handed } = await handoff;\n const channel = openChannel<ToFrame, FromFrame>(port);\n const id = handed ?? early ?? '';\n const container = document.getElementById('root') ?? document.body;\n try {\n if (isIndexId(id)) {\n const entries = entriesOf(id);\n const title = entries[0]?.title;\n if (title === undefined) throw new Error(`No component with index \"${id}\"`);\n const files = [...new Set(entries.map((e) => e.file))];\n const mods = await Promise.all(files.map(importOf));\n const loaded = files.map((file, i) => ({\n file,\n stories: (options.load ?? loadStories)(mods[i] ?? {}, title, options.setup?.parameters),\n }));\n const stories = entries.flatMap(\n (e) => loaded.find((l) => l.file === e.file)?.stories.find((s) => s.exportName === e.exportName) ?? [],\n );\n for (const story of stories) await options.setup?.prepare?.(story);\n startIndex({\n title,\n ...(entries[0]?.componentDescription === undefined ? {} : { description: entries[0].componentDescription }),\n library: libraryOf({ file: entries[0]?.file ?? '', title }),\n gallery: entries.every(isGallery),\n galleries: entries.filter(isGallery).map((e) => e.id),\n stories,\n descriptions: Object.fromEntries(entries.flatMap((e) => (e.description ? [[e.id, e.description]] : []))),\n render: mods.map(indexRenderOf).find((render) => render !== null) ?? null,\n channel,\n container,\n ...(options.setup ? { setup: options.setup } : {}),\n });\n return;\n }\n const entry = options.index.find((e) => e.id === id);\n if (!entry) throw new Error(`No story with id \"${id}\"`);\n const mod = await importOf(entry.file);\n const stories = (options.load ?? loadStories)(mod, entry.title, options.setup?.parameters);\n const story = stories.find((s) => s.exportName === entry.exportName);\n if (!story) throw new Error(`${entry.file} has no story export \"${entry.exportName}\"`);\n await options.setup?.prepare?.(story);\n startFrame({ story, channel, container, setup: options.setup });\n } catch (error) {\n reportImportFault(channel, error);\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { f } from '@weasel-js/labkit/config';
2
- export { G as GlobalDeclaration, a as GlobalDeclarations, S as ShellConfig, d as defineFrameConfig, b as defineShellConfig } from './config-C5Vq5Kjj.js';
2
+ export { F as FOLLOW_APP, G as GlobalDeclaration, a as GlobalDeclarations, L as LabChrome, S as ShellConfig, d as defineFrameConfig, b as defineShellConfig } from './config-BJIgUhiI.js';
3
3
  import { ComponentType, ReactNode } from 'react';
4
- import { G as Globals, M as MetaSpec, S as StorySpec } from './FrameController-BspC9Zr5.js';
5
- export { A as A11yFinding, a as A11yNode, b as A11yReport, D as Decorator, F as FrameSetup, c as GlobalsTarget, I as IndexContext, d as IndexRender, e as IndexStoryProps, L as LoadedStory, P as PlayContext, f as StoryContext } from './FrameController-BspC9Zr5.js';
4
+ import { G as Globals, M as MetaSpec, S as StorySpec } from './FrameController-RdGggdGA.js';
5
+ export { A as A11yFinding, a as A11yNode, b as A11yReport, C as ComponentDeps, D as Decorator, c as DepGraph, F as FrameSetup, d as GlobalsTarget, I as IndexContext, e as IndexRender, f as IndexStoryProps, L as LoadedStory, P as PlayContext, g as StoryContext } from './FrameController-RdGggdGA.js';
6
6
  import '@weasel-js/labkit';
7
7
  import '@weasel-js/theme';
8
8
 
@@ -26,6 +26,8 @@ interface ArgType {
26
26
  min?: number;
27
27
  max?: number;
28
28
  step?: number;
29
+ /** forge's own: an icon (weasel-ui `IconName`) per option, drawn in place of its label. */
30
+ icons?: Readonly<Record<string, string>>;
29
31
  };
30
32
  options?: readonly unknown[];
31
33
  table?: {
@@ -79,6 +81,9 @@ interface Shared<T> {
79
81
  decorators?: CsfDecorator | CsfDecorator[];
80
82
  render?: (args: ArgsOf<T>, context: CsfStoryContext) => ReactNode;
81
83
  play?: (context: CsfPlayContext) => void | Promise<void>;
84
+ /** A story carries its meta's tags and its own; `'!tag'` drops one. `'gallery'` marks a catalog or showcase, and
85
+ * on a meta, a whole file of them. Read from the source, so each must be a string literal. */
86
+ tags?: string[];
82
87
  }
83
88
  /** A CSF file's default export: what its stories share, and where they sit in
84
89
  * the sidebar. */
@@ -98,7 +103,12 @@ interface StoryObj<T = unknown> extends Shared<T> {
98
103
  storyName?: string;
99
104
  }
100
105
 
106
+ /** Declares a native story file's meta; default-export the result. */
101
107
  declare function meta(spec: MetaSpec): MetaSpec;
108
+ /** Declares one native story; export the result under the story's name. `C` and `S` come from `config` and `state`. */
102
109
  declare function story<C = Record<string, never>, S = undefined>(spec: StorySpec<C, S>): StorySpec<C, S>;
103
110
 
104
- export { type ArgType, type ArgsOf, type CsfDecorator, type CsfPlayContext, type CsfStep, type CsfStoryContext, type Meta, MetaSpec, type StoryObj, StorySpec, meta, story };
111
+ /** The meta tag marking a story file as a gallery: a catalog of many components, or of every permutation of one. */
112
+ declare const GALLERY_TAG = "gallery";
113
+
114
+ export { type ArgType, type ArgsOf, type CsfDecorator, type CsfPlayContext, type CsfStep, type CsfStoryContext, GALLERY_TAG, type Meta, MetaSpec, type StoryObj, StorySpec, meta, story };
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
- export { meta, story } from './chunk-2GXKNXTJ.js';
1
+ export { GALLERY_TAG } from './chunk-WEQSLPKT.js';
2
+ export { FOLLOW_APP } from './chunk-JNJGIUYU.js';
3
+ export { meta, story } from './chunk-Y3WZ2EWR.js';
2
4
  export { f } from '@weasel-js/labkit/config';
3
5
 
4
6
  // src/config.ts
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts"],"names":[],"mappings":";;;;AAuBO,SAAS,kBAAkB,MAAA,EAAgC;AAChE,EAAA,OAAO,MAAA;AACT;AAGO,SAAS,kBAAkB,MAAA,EAAkC;AAClE,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["import type { LabContribution, LabPage } from '@weasel-js/labkit';\nimport type { Theme } from '@weasel-js/theme';\nimport type { ControlRenderer } from '@weasel-js/labkit/config';\nimport type { FrameSetup } from './frame/FrameController';\nimport type { Globals } from './protocol/messages';\nimport type { GlobalDeclarations } from './shell/globals';\n\n/** A shell config module: what the workshop adds to the lab. Only the workshop page imports it. */\nexport interface ShellConfig {\n labChrome?: readonly LabContribution[];\n controls?: Record<string, ControlRenderer>;\n /** Globals the lab's header sets for every story, each pinnable per trial. Frames apply them with `applyGlobals`. */\n globals?: GlobalDeclarations;\n /** The theme the workshop's own chrome takes at the lab's current globals, so a global can restyle the workshop\n * as well as the stories. Default: labkit's. */\n labTheme?: (globals: Globals) => Theme;\n /** The project's other labs, offered in the workshop's title menu. */\n pages?: readonly LabPage[];\n /** Which of `pages` the workshop is, when the URL alone cannot say, as across dev servers on different ports. */\n path?: string;\n}\n\n/** A frame config module's default export. Only frame documents import it, so its CSS stays out of the workshop. */\nexport function defineFrameConfig(config: FrameSetup): FrameSetup {\n return config;\n}\n\n/** A shell config module's default export. */\nexport function defineShellConfig(config: ShellConfig): ShellConfig {\n return config;\n}\n"]}
1
+ {"version":3,"sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAuBO,SAAS,kBAAkB,MAAA,EAAgC;AAChE,EAAA,OAAO,MAAA;AACT;AAGO,SAAS,kBAAkB,MAAA,EAAkC;AAClE,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["import type { LabContribution, LabPage } from '@weasel-js/labkit';\nimport type { Theme } from '@weasel-js/theme';\nimport type { ControlRenderer } from '@weasel-js/labkit/config';\nimport type { FrameSetup } from './frame/FrameController';\nimport type { Globals } from './protocol/messages';\nimport type { GlobalDeclarations } from './shell/globals';\n\n/** A shell config module: what the workshop adds to the lab. Only the workshop page imports it. */\nexport interface ShellConfig {\n labChrome?: readonly LabContribution[];\n controls?: Record<string, ControlRenderer>;\n /** Globals the lab's header sets for every story, each pinnable per trial. Frames apply them with `applyGlobals`. */\n globals?: GlobalDeclarations;\n /** The theme the workshop's own chrome takes at the lab's current globals, so a global can restyle the workshop\n * as well as the stories. Default: labkit's. */\n labTheme?: (globals: Globals) => Theme;\n /** The project's other labs, offered in the workshop's title menu. */\n pages?: readonly LabPage[];\n /** Which of `pages` the workshop is, when the URL alone cannot say, as across dev servers on different ports. */\n path?: string;\n}\n\n/** A frame config module's default export. Only frame documents import it, so its CSS stays out of the workshop. */\nexport function defineFrameConfig(config: FrameSetup): FrameSetup {\n return config;\n}\n\n/** A shell config module's default export. */\nexport function defineShellConfig(config: ShellConfig): ShellConfig {\n return config;\n}\n"]}