histoire 0.3.1 → 0.4.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/dist/bundled/BaseEmpty.js +13 -0
- package/dist/bundled/HomeView.js +23 -0
- package/dist/bundled/MobileOverlay.js +303 -0
- package/dist/bundled/SearchPane.js +504 -0
- package/dist/bundled/StoryView.js +2330 -0
- package/dist/bundled/api.js +32 -0
- package/dist/bundled/config.js +4 -0
- package/dist/bundled/const.js +5 -0
- package/dist/bundled/dark.js +4 -0
- package/dist/bundled/events.js +29 -0
- package/dist/bundled/global-components.js +203 -0
- package/dist/bundled/index.js +7 -0
- package/dist/bundled/index2.js +762 -0
- package/dist/bundled/reactivity.js +96 -0
- package/dist/bundled/sandbox.js +97 -0
- package/dist/bundled/search-docs-data.js +7 -0
- package/dist/bundled/story.js +59 -0
- package/dist/bundled/style.css +102 -0
- package/dist/client/app/App.vue +2 -2
- package/dist/client/app/api.d.ts +1 -0
- package/dist/client/app/api.js +1 -0
- package/dist/client/app/codegen/vue3.js +1 -2
- package/dist/client/app/components/HomeView.vue +1 -1
- package/dist/client/app/components/app/AppLogo.vue +1 -1
- package/dist/client/app/components/app/MobileOverlay.vue +0 -1
- package/dist/client/app/components/base/BaseEmpty.vue +1 -1
- package/dist/client/app/components/base/BaseOverflowMenu.vue +118 -0
- package/dist/client/app/components/base/BaseOverflowTab.vue +46 -0
- package/dist/client/app/components/exposed/Story.vue +13 -2
- package/dist/client/app/components/exposed/Variant.vue +6 -0
- package/dist/client/app/components/panel/PaneTabs.vue +64 -0
- package/{src/client/app/components/story → dist/client/app/components/panel}/StoryControls.vue +1 -1
- package/dist/client/app/components/{story → panel}/StoryDocs.vue +0 -0
- package/dist/client/app/components/{story → panel}/StoryEvent.vue +1 -0
- package/dist/client/app/components/{story → panel}/StoryEvents.vue +0 -0
- package/dist/client/app/components/{story → panel}/StorySidePanel.vue +3 -31
- package/dist/client/app/components/{story → panel}/StorySourceCode.vue +0 -0
- package/dist/client/app/components/sandbox/SandboxVue3.vue +10 -0
- package/dist/client/app/components/search/SearchItem.vue +1 -1
- package/dist/client/app/components/search/SearchPane.vue +108 -25
- package/dist/client/app/components/search/search-docs-data.d.ts +3 -0
- package/dist/client/app/components/search/{search-data.js → search-docs-data.js} +1 -1
- package/dist/client/app/components/search/search-title-data.d.ts +3 -0
- package/dist/client/app/components/search/search-title-data.js +7 -0
- package/dist/client/app/components/search/types.d.ts +7 -0
- package/dist/client/app/components/search/types.js +1 -0
- package/dist/client/app/components/story/StoryResponsivePreview.vue +9 -131
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantSingle.vue +109 -0
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +42 -0
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
- package/dist/client/app/components/story/StoryVariantSingleView.vue +13 -6
- package/dist/client/app/components/story/StoryView.vue +2 -2
- package/dist/client/app/components/story/StoryViewer.vue +2 -92
- package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantBackground.vue +3 -3
- package/dist/client/app/components/{story/toolbar → toolbar}/StoryVariantNewTab.vue +2 -2
- package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantResponsiveSize.vue +3 -3
- package/dist/client/app/components/{story/toolbar → toolbar}/StoryVariantTitle.vue +1 -1
- package/dist/client/app/components/tree/StoryListItem.vue +1 -1
- package/dist/client/app/index.d.ts +1 -1
- package/dist/client/app/index.js +21 -18
- package/dist/client/app/sandbox.d.ts +1 -1
- package/dist/client/app/sandbox.js +0 -1
- package/dist/client/app/stores/events.js +1 -1
- package/dist/client/app/stores/story.d.ts +27 -0
- package/dist/client/app/style/transitions.pcss +13 -0
- package/dist/client/app/types.d.ts +3 -0
- package/dist/client/app/util/events.d.ts +1 -1
- package/dist/client/app/util/events.js +2 -2
- package/dist/client/app/util/mapping.js +2 -0
- package/dist/client/bundle-index.js +5 -0
- package/dist/client/bundle-main.js +5 -0
- package/dist/client/bundle-sandbox.js +3 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/server/vue3/Story.vue +1 -1
- package/dist/client/server/vue3/run.js +8 -0
- package/dist/node/alias.js +1 -1
- package/dist/node/build.js +4 -4
- package/dist/node/builtin-plugins/tailwind-tokens.js +1 -1
- package/dist/node/search.d.ts +15 -1
- package/dist/node/search.js +78 -32
- package/dist/node/server.js +2 -2
- package/dist/node/types.d.ts +1 -0
- package/dist/node/vite.d.ts +4 -2
- package/dist/node/vite.js +24 -28
- package/dist/style.css +93 -69
- package/package.json +10 -10
- package/src/client/app/App.vue +2 -2
- package/src/client/app/api.ts +1 -0
- package/src/client/app/codegen/vue3.ts +1 -2
- package/src/client/app/components/HomeView.vue +1 -1
- package/src/client/app/components/app/AppLogo.vue +1 -1
- package/src/client/app/components/app/MobileOverlay.vue +0 -1
- package/src/client/app/components/base/BaseEmpty.vue +1 -1
- package/src/client/app/components/base/BaseOverflowMenu.vue +118 -0
- package/src/client/app/components/base/BaseOverflowTab.vue +46 -0
- package/src/client/app/components/exposed/Story.vue +13 -2
- package/src/client/app/components/exposed/Variant.vue +6 -0
- package/src/client/app/components/panel/PaneTabs.vue +64 -0
- package/{dist/client/app/components/story → src/client/app/components/panel}/StoryControls.vue +1 -1
- package/src/client/app/components/{story → panel}/StoryDocs.vue +0 -0
- package/src/client/app/components/{story → panel}/StoryEvent.vue +1 -0
- package/src/client/app/components/{story → panel}/StoryEvents.vue +0 -0
- package/src/client/app/components/{story → panel}/StorySidePanel.vue +3 -31
- package/src/client/app/components/{story → panel}/StorySourceCode.vue +0 -0
- package/src/client/app/components/sandbox/SandboxVue3.vue +10 -0
- package/src/client/app/components/search/SearchItem.vue +1 -1
- package/src/client/app/components/search/SearchPane.vue +108 -25
- package/src/client/app/components/search/search-docs-data.ts +10 -0
- package/src/client/app/components/search/search-title-data.ts +10 -0
- package/src/client/app/components/search/types.ts +4 -0
- package/src/client/app/components/story/StoryResponsivePreview.vue +9 -131
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantSingle.vue +109 -0
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +42 -0
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
- package/src/client/app/components/story/StoryVariantSingleView.vue +13 -6
- package/src/client/app/components/story/StoryView.vue +2 -2
- package/src/client/app/components/story/StoryViewer.vue +2 -92
- package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantBackground.vue +3 -3
- package/src/client/app/components/{story/toolbar → toolbar}/StoryVariantNewTab.vue +2 -2
- package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantResponsiveSize.vue +3 -3
- package/src/client/app/components/{story/toolbar → toolbar}/StoryVariantTitle.vue +1 -1
- package/src/client/app/components/tree/StoryListItem.vue +1 -1
- package/src/client/app/index.ts +23 -19
- package/src/client/app/sandbox.ts +1 -2
- package/src/client/app/stores/events.ts +1 -1
- package/src/client/app/style/transitions.pcss +13 -0
- package/src/client/app/types.ts +4 -0
- package/src/client/app/util/events.ts +2 -2
- package/src/client/app/util/mapping.ts +2 -0
- package/src/client/bundle-index.js +5 -0
- package/src/client/bundle-main.js +5 -0
- package/src/client/bundle-sandbox.js +3 -0
- package/src/client/index.ts +1 -1
- package/src/client/server/vue3/Story.vue +1 -1
- package/src/client/server/vue3/run.ts +11 -0
- package/src/node/alias.ts +1 -1
- package/src/node/build.ts +4 -4
- package/src/node/builtin-plugins/tailwind-tokens.ts +1 -1
- package/src/node/search.ts +87 -32
- package/src/node/server.ts +2 -2
- package/src/node/types.ts +1 -0
- package/src/node/vite.ts +24 -29
- package/vite.config.ts +46 -0
- package/dist/client/app/components/search/search-data.d.ts +0 -2
- package/src/client/app/components/search/search-data.ts +0 -9
|
@@ -10,6 +10,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
10
10
|
icon?: string;
|
|
11
11
|
iconColor?: string;
|
|
12
12
|
initState?: () => any;
|
|
13
|
+
setupApp?: (payload: any) => unknown;
|
|
13
14
|
slots?: () => Readonly<any>;
|
|
14
15
|
state?: any;
|
|
15
16
|
source?: string;
|
|
@@ -19,6 +20,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
19
20
|
}[];
|
|
20
21
|
layout?: {
|
|
21
22
|
type: "single";
|
|
23
|
+
iframe?: boolean;
|
|
22
24
|
} | {
|
|
23
25
|
type: "grid";
|
|
24
26
|
width?: string | number;
|
|
@@ -39,6 +41,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
39
41
|
icon?: string;
|
|
40
42
|
iconColor?: string;
|
|
41
43
|
initState?: () => any;
|
|
44
|
+
setupApp?: (payload: any) => unknown;
|
|
42
45
|
slots?: () => Readonly<any>;
|
|
43
46
|
state?: any;
|
|
44
47
|
source?: string;
|
|
@@ -46,6 +49,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
46
49
|
configReady?: boolean;
|
|
47
50
|
previewReady?: boolean;
|
|
48
51
|
};
|
|
52
|
+
slots?: () => Readonly<any>;
|
|
49
53
|
}[]>;
|
|
50
54
|
setStories: (value: Story[]) => void;
|
|
51
55
|
currentStory: import("vue").ComputedRef<{
|
|
@@ -58,6 +62,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
58
62
|
icon?: string;
|
|
59
63
|
iconColor?: string;
|
|
60
64
|
initState?: () => any;
|
|
65
|
+
setupApp?: (payload: any) => unknown;
|
|
61
66
|
slots?: () => Readonly<any>;
|
|
62
67
|
state?: any;
|
|
63
68
|
source?: string;
|
|
@@ -67,6 +72,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
67
72
|
}[];
|
|
68
73
|
layout?: {
|
|
69
74
|
type: "single";
|
|
75
|
+
iframe?: boolean;
|
|
70
76
|
} | {
|
|
71
77
|
type: "grid";
|
|
72
78
|
width?: string | number;
|
|
@@ -87,6 +93,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
87
93
|
icon?: string;
|
|
88
94
|
iconColor?: string;
|
|
89
95
|
initState?: () => any;
|
|
96
|
+
setupApp?: (payload: any) => unknown;
|
|
90
97
|
slots?: () => Readonly<any>;
|
|
91
98
|
state?: any;
|
|
92
99
|
source?: string;
|
|
@@ -94,6 +101,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
94
101
|
configReady?: boolean;
|
|
95
102
|
previewReady?: boolean;
|
|
96
103
|
};
|
|
104
|
+
slots?: () => Readonly<any>;
|
|
97
105
|
}>;
|
|
98
106
|
currentVariant: import("vue").ComputedRef<{
|
|
99
107
|
id: string;
|
|
@@ -101,6 +109,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
101
109
|
icon?: string;
|
|
102
110
|
iconColor?: string;
|
|
103
111
|
initState?: () => any;
|
|
112
|
+
setupApp?: (payload: any) => unknown;
|
|
104
113
|
slots?: () => Readonly<any>;
|
|
105
114
|
state?: any;
|
|
106
115
|
source?: string;
|
|
@@ -121,6 +130,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
121
130
|
icon?: string;
|
|
122
131
|
iconColor?: string;
|
|
123
132
|
initState?: () => any;
|
|
133
|
+
setupApp?: (payload: any) => unknown;
|
|
124
134
|
slots?: () => Readonly<any>;
|
|
125
135
|
state?: any;
|
|
126
136
|
source?: string;
|
|
@@ -130,6 +140,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
130
140
|
}[];
|
|
131
141
|
layout?: {
|
|
132
142
|
type: "single";
|
|
143
|
+
iframe?: boolean;
|
|
133
144
|
} | {
|
|
134
145
|
type: "grid";
|
|
135
146
|
width?: string | number;
|
|
@@ -150,6 +161,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
150
161
|
icon?: string;
|
|
151
162
|
iconColor?: string;
|
|
152
163
|
initState?: () => any;
|
|
164
|
+
setupApp?: (payload: any) => unknown;
|
|
153
165
|
slots?: () => Readonly<any>;
|
|
154
166
|
state?: any;
|
|
155
167
|
source?: string;
|
|
@@ -157,6 +169,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
157
169
|
configReady?: boolean;
|
|
158
170
|
previewReady?: boolean;
|
|
159
171
|
};
|
|
172
|
+
slots?: () => Readonly<any>;
|
|
160
173
|
}[]>;
|
|
161
174
|
setStories: (value: Story[]) => void;
|
|
162
175
|
currentStory: import("vue").ComputedRef<{
|
|
@@ -169,6 +182,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
169
182
|
icon?: string;
|
|
170
183
|
iconColor?: string;
|
|
171
184
|
initState?: () => any;
|
|
185
|
+
setupApp?: (payload: any) => unknown;
|
|
172
186
|
slots?: () => Readonly<any>;
|
|
173
187
|
state?: any;
|
|
174
188
|
source?: string;
|
|
@@ -178,6 +192,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
178
192
|
}[];
|
|
179
193
|
layout?: {
|
|
180
194
|
type: "single";
|
|
195
|
+
iframe?: boolean;
|
|
181
196
|
} | {
|
|
182
197
|
type: "grid";
|
|
183
198
|
width?: string | number;
|
|
@@ -198,6 +213,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
198
213
|
icon?: string;
|
|
199
214
|
iconColor?: string;
|
|
200
215
|
initState?: () => any;
|
|
216
|
+
setupApp?: (payload: any) => unknown;
|
|
201
217
|
slots?: () => Readonly<any>;
|
|
202
218
|
state?: any;
|
|
203
219
|
source?: string;
|
|
@@ -205,6 +221,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
205
221
|
configReady?: boolean;
|
|
206
222
|
previewReady?: boolean;
|
|
207
223
|
};
|
|
224
|
+
slots?: () => Readonly<any>;
|
|
208
225
|
}>;
|
|
209
226
|
currentVariant: import("vue").ComputedRef<{
|
|
210
227
|
id: string;
|
|
@@ -212,6 +229,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
212
229
|
icon?: string;
|
|
213
230
|
iconColor?: string;
|
|
214
231
|
initState?: () => any;
|
|
232
|
+
setupApp?: (payload: any) => unknown;
|
|
215
233
|
slots?: () => Readonly<any>;
|
|
216
234
|
state?: any;
|
|
217
235
|
source?: string;
|
|
@@ -232,6 +250,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
232
250
|
icon?: string;
|
|
233
251
|
iconColor?: string;
|
|
234
252
|
initState?: () => any;
|
|
253
|
+
setupApp?: (payload: any) => unknown;
|
|
235
254
|
slots?: () => Readonly<any>;
|
|
236
255
|
state?: any;
|
|
237
256
|
source?: string;
|
|
@@ -241,6 +260,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
241
260
|
}[];
|
|
242
261
|
layout?: {
|
|
243
262
|
type: "single";
|
|
263
|
+
iframe?: boolean;
|
|
244
264
|
} | {
|
|
245
265
|
type: "grid";
|
|
246
266
|
width?: string | number;
|
|
@@ -261,6 +281,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
261
281
|
icon?: string;
|
|
262
282
|
iconColor?: string;
|
|
263
283
|
initState?: () => any;
|
|
284
|
+
setupApp?: (payload: any) => unknown;
|
|
264
285
|
slots?: () => Readonly<any>;
|
|
265
286
|
state?: any;
|
|
266
287
|
source?: string;
|
|
@@ -268,6 +289,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
268
289
|
configReady?: boolean;
|
|
269
290
|
previewReady?: boolean;
|
|
270
291
|
};
|
|
292
|
+
slots?: () => Readonly<any>;
|
|
271
293
|
}[]>;
|
|
272
294
|
setStories: (value: Story[]) => void;
|
|
273
295
|
currentStory: import("vue").ComputedRef<{
|
|
@@ -280,6 +302,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
280
302
|
icon?: string;
|
|
281
303
|
iconColor?: string;
|
|
282
304
|
initState?: () => any;
|
|
305
|
+
setupApp?: (payload: any) => unknown;
|
|
283
306
|
slots?: () => Readonly<any>;
|
|
284
307
|
state?: any;
|
|
285
308
|
source?: string;
|
|
@@ -289,6 +312,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
289
312
|
}[];
|
|
290
313
|
layout?: {
|
|
291
314
|
type: "single";
|
|
315
|
+
iframe?: boolean;
|
|
292
316
|
} | {
|
|
293
317
|
type: "grid";
|
|
294
318
|
width?: string | number;
|
|
@@ -309,6 +333,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
309
333
|
icon?: string;
|
|
310
334
|
iconColor?: string;
|
|
311
335
|
initState?: () => any;
|
|
336
|
+
setupApp?: (payload: any) => unknown;
|
|
312
337
|
slots?: () => Readonly<any>;
|
|
313
338
|
state?: any;
|
|
314
339
|
source?: string;
|
|
@@ -316,6 +341,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
316
341
|
configReady?: boolean;
|
|
317
342
|
previewReady?: boolean;
|
|
318
343
|
};
|
|
344
|
+
slots?: () => Readonly<any>;
|
|
319
345
|
}>;
|
|
320
346
|
currentVariant: import("vue").ComputedRef<{
|
|
321
347
|
id: string;
|
|
@@ -323,6 +349,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
323
349
|
icon?: string;
|
|
324
350
|
iconColor?: string;
|
|
325
351
|
initState?: () => any;
|
|
352
|
+
setupApp?: (payload: any) => unknown;
|
|
326
353
|
slots?: () => Readonly<any>;
|
|
327
354
|
state?: any;
|
|
328
355
|
source?: string;
|
|
@@ -11,6 +11,19 @@
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
.__histoire-scale-y {
|
|
15
|
+
&-enter-active,
|
|
16
|
+
&-leave-active {
|
|
17
|
+
transition: transform .15s, opacity .15s;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-enter-from,
|
|
21
|
+
&-leave-to {
|
|
22
|
+
transform: scaleY(0);
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
14
27
|
.__histoire-fade {
|
|
15
28
|
&-enter-active,
|
|
16
29
|
&-leave-active {
|
|
@@ -13,6 +13,7 @@ export interface Story {
|
|
|
13
13
|
variants: Variant[];
|
|
14
14
|
layout?: {
|
|
15
15
|
type: 'single';
|
|
16
|
+
iframe?: boolean;
|
|
16
17
|
} | {
|
|
17
18
|
type: 'grid';
|
|
18
19
|
width?: number | string;
|
|
@@ -22,6 +23,7 @@ export interface Story {
|
|
|
22
23
|
docsOnly?: boolean;
|
|
23
24
|
file?: StoryFile;
|
|
24
25
|
lastSelectedVariant?: Variant;
|
|
26
|
+
slots?: () => Readonly<any>;
|
|
25
27
|
}
|
|
26
28
|
export interface Variant {
|
|
27
29
|
id: string;
|
|
@@ -29,6 +31,7 @@ export interface Variant {
|
|
|
29
31
|
icon?: string;
|
|
30
32
|
iconColor?: string;
|
|
31
33
|
initState?: () => any;
|
|
34
|
+
setupApp?: (payload: any) => unknown;
|
|
32
35
|
slots?: () => Readonly<any>;
|
|
33
36
|
state?: any;
|
|
34
37
|
source?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function hstEvent(name: string, argument: any): void
|
|
1
|
+
export declare function hstEvent(name: string, argument: any): Promise<void>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { useEventsStore } from '../stores/events.js';
|
|
2
1
|
import { EVENT_SEND } from './const';
|
|
3
|
-
export function hstEvent(name, argument) {
|
|
2
|
+
export async function hstEvent(name, argument) {
|
|
4
3
|
console.log('[histoire] Event fired', { name, argument });
|
|
5
4
|
const event = {
|
|
6
5
|
name,
|
|
@@ -13,6 +12,7 @@ export function hstEvent(name, argument) {
|
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
14
|
else {
|
|
15
|
+
const { useEventsStore } = await import('../stores/events.js');
|
|
16
16
|
useEventsStore().addEvent(event);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -8,6 +8,7 @@ export function mapFile(file, existingFile) {
|
|
|
8
8
|
title: file.story.title,
|
|
9
9
|
file: markRaw(file),
|
|
10
10
|
variants: file.story.variants.map(v => mapVariant(v)),
|
|
11
|
+
slots: () => ({}),
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
14
|
if (existingFile) {
|
|
@@ -37,6 +38,7 @@ export function mapVariant(variant) {
|
|
|
37
38
|
...variant,
|
|
38
39
|
state: null,
|
|
39
40
|
initState: null,
|
|
41
|
+
setupApp: null,
|
|
40
42
|
slots: () => ({}),
|
|
41
43
|
previewReady: false,
|
|
42
44
|
};
|
package/dist/client/index.d.ts
CHANGED
package/dist/client/index.js
CHANGED
|
@@ -28,5 +28,13 @@ export async function run({ file, storyData, el }) {
|
|
|
28
28
|
app.component('Variant', Variant);
|
|
29
29
|
registerVueComponents(app);
|
|
30
30
|
app.mount(el);
|
|
31
|
+
if (Comp.doc) {
|
|
32
|
+
const el = document.createElement('div');
|
|
33
|
+
el.innerHTML = Comp.doc;
|
|
34
|
+
const text = el.textContent;
|
|
35
|
+
storyData.forEach(s => {
|
|
36
|
+
s.docsText = text;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
31
39
|
app.unmount();
|
|
32
40
|
}
|
package/dist/node/alias.js
CHANGED
|
@@ -2,5 +2,5 @@ import { dirname, join } from 'pathe';
|
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
4
4
|
export const DIST_PATH = join(__dirname, '../');
|
|
5
|
-
export const APP_PATH = join(DIST_PATH, 'client'
|
|
5
|
+
export const APP_PATH = join(DIST_PATH, 'client');
|
|
6
6
|
export const TEMP_PATH = join(process.cwd(), 'node_modules', '.histoire');
|
package/dist/node/build.js
CHANGED
|
@@ -57,8 +57,8 @@ export async function build(ctx) {
|
|
|
57
57
|
build: {
|
|
58
58
|
rollupOptions: {
|
|
59
59
|
input: [
|
|
60
|
-
join(APP_PATH, '
|
|
61
|
-
join(APP_PATH, 'sandbox.js'),
|
|
60
|
+
join(APP_PATH, 'bundle-main.js'),
|
|
61
|
+
join(APP_PATH, 'bundle-sandbox.js'),
|
|
62
62
|
],
|
|
63
63
|
output: {
|
|
64
64
|
manualChunks(id) {
|
|
@@ -86,13 +86,13 @@ export async function build(ctx) {
|
|
|
86
86
|
const prefetchOutputs = result.output.filter(o => PREFETCHED_MODULES.includes(o.name) && o.type === 'chunk');
|
|
87
87
|
const prefetchHtml = generateScriptLinks(prefetchOutputs.map(o => o.fileName), 'prefetch', ctx, resolvedViteConfig);
|
|
88
88
|
// Index
|
|
89
|
-
const indexOutput = result.output.find(o => o.name === '
|
|
89
|
+
const indexOutput = result.output.find(o => o.name === 'bundle-main' && o.type === 'chunk');
|
|
90
90
|
const indexHtml = generateEntryHtml(indexOutput.fileName, styleOutput.fileName, {
|
|
91
91
|
HEAD: `${preloadHtml}${prefetchHtml}`,
|
|
92
92
|
}, ctx, resolvedViteConfig);
|
|
93
93
|
await writeFile('index.html', indexHtml, ctx);
|
|
94
94
|
// Sandbox
|
|
95
|
-
const sandboxOutput = result.output.find(o => o.name === 'sandbox' && o.type === 'chunk');
|
|
95
|
+
const sandboxOutput = result.output.find(o => o.name === 'bundle-sandbox' && o.type === 'chunk');
|
|
96
96
|
const sandboxHtml = generateEntryHtml(sandboxOutput.fileName, styleOutput.fileName, {}, ctx, resolvedViteConfig);
|
|
97
97
|
await writeFile('__sandbox.html', sandboxHtml, ctx);
|
|
98
98
|
const duration = performance.now() - startTime;
|
|
@@ -83,7 +83,7 @@ defineExpose({
|
|
|
83
83
|
})
|
|
84
84
|
</script>
|
|
85
85
|
<template>
|
|
86
|
-
<Story id="tailwind" title="Tailwind" group="design-system" icon="mdi:tailwind" responsiveDisabled>
|
|
86
|
+
<Story id="tailwind" title="Tailwind" group="design-system" icon="mdi:tailwind" responsiveDisabled :layout="{ type: 'single', iframe: false }">
|
|
87
87
|
<Variant id="background-color" title="Background Color" icon="carbon:color-palette">
|
|
88
88
|
<HstColorShades
|
|
89
89
|
v-for="(shades, key) of config.theme.backgroundColor"
|
package/dist/node/search.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
import { Context } from './context.js';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function generateTitleSearchData(ctx: Context): Promise<{
|
|
3
|
+
index: unknown;
|
|
4
|
+
idMap: Record<number, {
|
|
5
|
+
id: string;
|
|
6
|
+
kind: string;
|
|
7
|
+
}>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function generateDocSearchData(ctx: Context): Promise<{
|
|
10
|
+
index: unknown;
|
|
11
|
+
idMap: Record<number, {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function getSearchDataJS(data: any): string;
|
package/dist/node/search.js
CHANGED
|
@@ -1,54 +1,80 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import flexsearch from 'flexsearch';
|
|
3
3
|
import path from 'pathe';
|
|
4
|
+
import Case from 'case';
|
|
4
5
|
import { loadModule } from './load.js';
|
|
5
6
|
const require = createRequire(import.meta.url);
|
|
6
|
-
export async function
|
|
7
|
+
export async function generateTitleSearchData(ctx) {
|
|
8
|
+
const searchIndex = await createIndex();
|
|
9
|
+
const { idMap, addToIdMap } = createIdMap();
|
|
10
|
+
for (const storyFile of ctx.storyFiles) {
|
|
11
|
+
if (storyFile.story) {
|
|
12
|
+
searchIndex.add({
|
|
13
|
+
id: addToIdMap(storyFile.story.id, 'story'),
|
|
14
|
+
text: convertTitleToSentence(storyFile.story.title),
|
|
15
|
+
});
|
|
16
|
+
for (const variant of storyFile.story.variants) {
|
|
17
|
+
searchIndex.add({
|
|
18
|
+
id: addToIdMap(`${storyFile.story.id}:${variant.id}`, 'variant'),
|
|
19
|
+
text: convertTitleToSentence(`${storyFile.story.title} ${variant.title}`),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
index: await exportSearchIndex(searchIndex),
|
|
26
|
+
idMap,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export async function generateDocSearchData(ctx) {
|
|
30
|
+
const searchIndex = await createIndex();
|
|
31
|
+
const { idMap, addToIdMap } = createIdMap();
|
|
32
|
+
for (const storyFile of ctx.storyFiles) {
|
|
33
|
+
if (storyFile.story && storyFile.story.docsText) {
|
|
34
|
+
searchIndex.add({
|
|
35
|
+
id: addToIdMap(storyFile.story.id, 'story'),
|
|
36
|
+
text: storyFile.story.docsText,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
index: await exportSearchIndex(searchIndex),
|
|
42
|
+
idMap,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async function createIndex() {
|
|
7
46
|
const flexsearchRoot = path.dirname(require.resolve('flexsearch/package.json'));
|
|
8
|
-
|
|
47
|
+
return new flexsearch.Document({
|
|
9
48
|
preset: 'match',
|
|
10
49
|
document: {
|
|
11
50
|
id: 'id',
|
|
12
51
|
index: [
|
|
13
|
-
'
|
|
14
|
-
'docs',
|
|
15
|
-
],
|
|
16
|
-
store: [
|
|
17
|
-
'kind',
|
|
52
|
+
'text',
|
|
18
53
|
],
|
|
19
54
|
},
|
|
20
55
|
charset: await loadModule(`${flexsearchRoot}/dist/module/lang/latin/advanced.js`),
|
|
21
56
|
language: await loadModule(`${flexsearchRoot}/dist/module/lang/en.js`),
|
|
22
|
-
tokenize: '
|
|
57
|
+
tokenize: 'forward',
|
|
23
58
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
for (const variant of storyFile.story.variants) {
|
|
33
|
-
searchIndex.add({
|
|
34
|
-
id: `${storyFile.story.id}:${variant.id}`,
|
|
35
|
-
kind: 'variant',
|
|
36
|
-
title: `${storyFile.story.title} ${variant.title}`,
|
|
37
|
-
docs: '', // @TODO
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
59
|
+
}
|
|
60
|
+
function createIdMap() {
|
|
61
|
+
let uid = 0;
|
|
62
|
+
const idMap = {};
|
|
63
|
+
function addToIdMap(id, kind) {
|
|
64
|
+
const n = uid++;
|
|
65
|
+
idMap[n] = { id, kind };
|
|
66
|
+
return n;
|
|
41
67
|
}
|
|
42
|
-
return
|
|
68
|
+
return {
|
|
69
|
+
idMap,
|
|
70
|
+
addToIdMap,
|
|
71
|
+
};
|
|
43
72
|
}
|
|
44
73
|
const exportKeys = new Set([
|
|
45
74
|
'reg',
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'docs.cfg',
|
|
50
|
-
'docs.map',
|
|
51
|
-
'docs.ctx',
|
|
75
|
+
'text.cfg',
|
|
76
|
+
'text.map',
|
|
77
|
+
'text.ctx',
|
|
52
78
|
'tag',
|
|
53
79
|
'store',
|
|
54
80
|
]);
|
|
@@ -66,3 +92,23 @@ async function exportSearchIndex(index) {
|
|
|
66
92
|
});
|
|
67
93
|
});
|
|
68
94
|
}
|
|
95
|
+
function convertTitleToSentence(text) {
|
|
96
|
+
return text.split(' ').map(str => Case.lower(str)).join(' ');
|
|
97
|
+
}
|
|
98
|
+
// @TODO clear handlers when SearchPane unmounts
|
|
99
|
+
export function getSearchDataJS(data) {
|
|
100
|
+
return `export let searchData = ${JSON.stringify(data)}
|
|
101
|
+
const handlers = []
|
|
102
|
+
export function onUpdate (cb) {
|
|
103
|
+
handlers.push(cb)
|
|
104
|
+
}
|
|
105
|
+
if (import.meta.hot) {
|
|
106
|
+
import.meta.hot.accept(newModule => {
|
|
107
|
+
searchData = newModule.searchData
|
|
108
|
+
handlers.forEach(h => {
|
|
109
|
+
h(newModule.searchData)
|
|
110
|
+
newModule.onUpdate(h)
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
}`;
|
|
114
|
+
}
|
package/dist/node/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createServer as createViteServer } from 'vite';
|
|
2
|
-
import { createVitePlugins,
|
|
2
|
+
import { createVitePlugins, RESOLVED_SEARCH_TITLE_DATA_ID, RESOLVED_STORIES_ID } from './vite.js';
|
|
3
3
|
import { notifyStoryChange, onStoryChange, watchStories } from './stories.js';
|
|
4
4
|
import { useCollectStories } from './collect/index.js';
|
|
5
5
|
import { DevPluginApi } from './plugin.js';
|
|
@@ -94,7 +94,7 @@ export async function createServer(ctx, port) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
invalidateModule(RESOLVED_STORIES_ID);
|
|
97
|
-
invalidateModule(
|
|
97
|
+
invalidateModule(RESOLVED_SEARCH_TITLE_DATA_ID);
|
|
98
98
|
});
|
|
99
99
|
async function close() {
|
|
100
100
|
for (const cb of pluginOnCleanups) {
|
package/dist/node/types.d.ts
CHANGED
package/dist/node/vite.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare const CONFIG_ID = "$histoire-config";
|
|
|
8
8
|
export declare const RESOLVED_CONFIG_ID: string;
|
|
9
9
|
export declare const THEME_ID = "$histoire-theme";
|
|
10
10
|
export declare const RESOLVED_THEME_ID: string;
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
11
|
+
export declare const SEARCH_TITLE_DATA_ID = "$histoire-search-title-data";
|
|
12
|
+
export declare const RESOLVED_SEARCH_TITLE_DATA_ID: string;
|
|
13
|
+
export declare const SEARCH_DOCS_DATA_ID = "$histoire-search-docs-data";
|
|
14
|
+
export declare const RESOLVED_SEARCH_DOCS_DATA_ID: string;
|
|
13
15
|
export declare function createVitePlugins(ctx: Context): Promise<VitePlugin[]>;
|