histoire 0.0.0 → 0.0.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.
- package/LICENSE +21 -0
- package/client.d.ts +2 -0
- package/dist/client/app/App.vue +84 -21
- package/dist/client/app/assets/histoire-text-dark.svg +89 -0
- package/dist/client/app/assets/histoire-text.svg +89 -0
- package/dist/client/app/assets/histoire.svg +51 -0
- package/dist/client/app/codegen/serialize-js.d.ts +1 -0
- package/dist/client/app/codegen/serialize-js.js +114 -0
- package/dist/client/app/codegen/serialize-js.js.map +1 -0
- package/dist/client/app/codegen/serialize-js.ts +119 -0
- package/dist/client/app/codegen/util.d.ts +10 -0
- package/dist/client/app/codegen/util.js +71 -0
- package/dist/client/app/codegen/util.js.map +1 -0
- package/dist/client/app/codegen/util.ts +79 -0
- package/dist/client/app/codegen/vue3.d.ts +2 -0
- package/dist/client/app/codegen/vue3.js +239 -0
- package/dist/client/app/codegen/vue3.js.map +1 -0
- package/dist/client/app/codegen/vue3.ts +240 -0
- package/dist/client/app/components/HomeView.vue +15 -1
- package/dist/client/app/components/StoryControls.vue +7 -2
- package/dist/client/app/components/StoryList.vue +20 -13
- package/dist/client/app/components/StoryListFolder.vue +80 -0
- package/dist/client/app/components/StoryListItem.vue +38 -12
- package/dist/client/app/components/StorySourceCode.vue +121 -0
- package/dist/client/app/components/StoryVariantGridItem.vue +32 -17
- package/dist/client/app/components/StoryVariantListItem.vue +46 -0
- package/dist/client/app/components/StoryVariantSingleView.vue +117 -15
- package/dist/client/app/components/StoryView.vue +88 -54
- package/dist/client/app/components/app/AppHeader.vue +56 -0
- package/dist/client/app/components/app/AppLogo.vue +24 -0
- package/dist/client/app/components/base/BaseEmpty.vue +1 -1
- package/dist/client/app/components/base/BaseListItemLink.vue +55 -0
- package/dist/client/app/components/base/BaseSplitPane.vue +57 -21
- package/dist/client/app/components/exposed/Story.vue +23 -58
- package/dist/client/app/components/exposed/Variant.vue +24 -47
- package/dist/client/app/components/misc/HatchedPattern.vue +25 -0
- package/dist/client/app/components/{SandboxVue.vue → sandbox/SandboxVue3.vue} +31 -12
- package/dist/client/app/components/search/SearchItem.vue +110 -0
- package/dist/client/app/components/search/SearchModal.vue +179 -0
- package/dist/client/app/composable/variant.ts +20 -0
- package/dist/client/app/global-components.ts +10 -0
- package/dist/client/app/index.d.ts +1 -0
- package/dist/client/app/index.js +4 -1
- package/dist/client/app/index.js.map +1 -1
- package/dist/client/app/index.ts +18 -0
- package/dist/client/app/router.ts +17 -0
- package/dist/client/app/sandbox.d.ts +1 -0
- package/dist/client/app/sandbox.js +54 -0
- package/dist/client/app/sandbox.js.map +1 -0
- package/dist/client/app/sandbox.ts +60 -0
- package/dist/client/app/stores/story.d.ts +161 -50
- package/dist/client/app/stores/story.js +5 -16
- package/dist/client/app/stores/story.js.map +1 -1
- package/dist/client/app/stores/story.ts +22 -0
- package/dist/client/app/style/main.css +16 -2
- package/dist/client/app/style/sandbox.css +14 -0
- package/dist/client/app/types.d.ts +36 -4
- package/dist/client/app/types.ts +45 -0
- package/dist/client/app/util/config.d.ts +3 -0
- package/dist/client/app/util/config.js +5 -0
- package/dist/client/app/util/config.js.map +1 -0
- package/dist/client/app/util/config.ts +6 -0
- package/dist/client/app/util/const.d.ts +1 -0
- package/dist/client/app/util/const.js +2 -0
- package/dist/client/app/util/const.js.map +1 -0
- package/dist/client/app/util/const.ts +1 -0
- package/dist/client/app/util/dark.d.ts +2 -0
- package/dist/client/app/util/dark.js +4 -0
- package/dist/client/app/util/dark.js.map +1 -0
- package/dist/client/app/util/dark.ts +4 -0
- package/dist/client/app/util/env.d.ts +1 -0
- package/dist/client/app/util/env.js +2 -0
- package/dist/client/app/util/env.js.map +1 -0
- package/dist/client/app/util/keyboard.d.ts +8 -0
- package/dist/client/app/util/keyboard.js +83 -0
- package/dist/client/app/util/keyboard.js.map +1 -0
- package/dist/client/app/util/mapping.d.ts +3 -0
- package/dist/client/app/util/mapping.js +37 -0
- package/dist/client/app/util/mapping.js.map +1 -0
- package/dist/client/app/util/mapping.ts +38 -0
- package/dist/client/app/util/tooltip.d.ts +6 -0
- package/dist/client/app/util/tooltip.js +12 -0
- package/dist/client/app/util/tooltip.js.map +1 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.ts +12 -0
- package/dist/client/server/Story.server.vue +65 -0
- package/dist/client/server/Variant.server.vue +50 -0
- package/dist/client/server/index.d.ts +2 -0
- package/dist/client/server/index.js +26 -0
- package/dist/client/server/index.js.map +1 -0
- package/dist/client/server/index.ts +29 -0
- package/dist/client/shim.d.ts +5 -0
- package/dist/node/bin.js +8 -2
- package/dist/node/bin.js.map +1 -1
- package/dist/node/build.d.ts +2 -0
- package/dist/node/build.js +72 -0
- package/dist/node/build.js.map +1 -0
- package/dist/node/collect.d.ts +12 -0
- package/dist/node/collect.js +66 -0
- package/dist/node/collect.js.map +1 -0
- package/dist/node/colors.d.ts +274 -0
- package/dist/node/colors.js +313 -0
- package/dist/node/colors.js.map +1 -0
- package/dist/node/commands/build.d.ts +1 -0
- package/dist/node/commands/build.js +11 -0
- package/dist/node/commands/build.js.map +1 -0
- package/dist/node/commands/dev.d.ts +1 -1
- package/dist/node/commands/dev.js +6 -11
- package/dist/node/commands/dev.js.map +1 -1
- package/dist/node/config.d.ts +99 -1
- package/dist/node/config.js +90 -1
- package/dist/node/config.js.map +1 -1
- package/dist/node/context.d.ts +13 -0
- package/dist/node/context.js +12 -1
- package/dist/node/context.js.map +1 -1
- package/dist/node/dom/dom-keys.d.ts +4 -0
- package/dist/node/dom/dom-keys.js +224 -0
- package/dist/node/dom/dom-keys.js.map +1 -0
- package/dist/node/dom/env.d.ts +5 -0
- package/dist/node/dom/env.js +23 -0
- package/dist/node/dom/env.js.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/plugin.d.ts +8 -2
- package/dist/node/plugin.js +142 -21
- package/dist/node/plugin.js.map +1 -1
- package/dist/node/server.d.ts +4 -1
- package/dist/node/server.js +80 -20
- package/dist/node/server.js.map +1 -1
- package/dist/node/stories.d.ts +8 -9
- package/dist/node/stories.js +42 -22
- package/dist/node/stories.js.map +1 -1
- package/dist/node/tree.d.ts +19 -0
- package/dist/node/tree.js +55 -0
- package/dist/node/tree.js.map +1 -0
- package/dist/node/types.d.ts +38 -0
- package/dist/node/types.js +2 -0
- package/dist/node/types.js.map +1 -0
- package/dist/style.css +558 -52
- package/package.json +42 -25
- package/scripts/copy.mjs +11 -0
- package/src/client/app/App.vue +84 -21
- package/src/client/app/assets/histoire-text-dark.svg +89 -0
- package/src/client/app/assets/histoire-text.svg +89 -0
- package/src/client/app/assets/histoire.svg +51 -0
- package/src/client/app/codegen/serialize-js.ts +119 -0
- package/src/client/app/codegen/util.ts +79 -0
- package/src/client/app/codegen/vue3.ts +240 -0
- package/src/client/app/components/HomeView.vue +15 -1
- package/src/client/app/components/StoryControls.vue +7 -2
- package/src/client/app/components/StoryList.vue +20 -13
- package/src/client/app/components/StoryListFolder.vue +80 -0
- package/src/client/app/components/StoryListItem.vue +38 -12
- package/src/client/app/components/StorySourceCode.vue +121 -0
- package/src/client/app/components/StoryVariantGridItem.vue +32 -17
- package/src/client/app/components/StoryVariantListItem.vue +46 -0
- package/src/client/app/components/StoryVariantSingleView.vue +117 -15
- package/src/client/app/components/StoryView.vue +88 -54
- package/src/client/app/components/app/AppHeader.vue +56 -0
- package/src/client/app/components/app/AppLogo.vue +24 -0
- package/src/client/app/components/base/BaseEmpty.vue +1 -1
- package/src/client/app/components/base/BaseListItemLink.vue +55 -0
- package/src/client/app/components/base/BaseSplitPane.vue +57 -21
- package/src/client/app/components/exposed/Story.vue +23 -58
- package/src/client/app/components/exposed/Variant.vue +24 -47
- package/src/client/app/components/misc/HatchedPattern.vue +25 -0
- package/src/client/app/components/{SandboxVue.vue → sandbox/SandboxVue3.vue} +31 -12
- package/src/client/app/components/search/SearchItem.vue +110 -0
- package/src/client/app/components/search/SearchModal.vue +179 -0
- package/src/client/app/index.ts +4 -1
- package/src/client/app/sandbox.ts +60 -0
- package/src/client/app/stores/story.ts +6 -18
- package/src/client/app/style/main.css +16 -2
- package/src/client/app/style/sandbox.css +14 -0
- package/src/client/app/types.ts +42 -4
- package/src/client/app/util/config.ts +6 -0
- package/src/client/app/util/const.ts +1 -0
- package/src/client/app/util/dark.ts +4 -0
- package/src/client/app/util/env.ts +1 -0
- package/src/client/app/util/keyboard.ts +99 -0
- package/src/client/app/util/mapping.ts +38 -0
- package/src/client/app/util/tooltip.ts +13 -0
- package/src/client/index.ts +12 -0
- package/src/client/server/Story.server.vue +65 -0
- package/src/client/server/Variant.server.vue +50 -0
- package/src/client/server/index.ts +29 -0
- package/src/node/bin.ts +9 -2
- package/src/node/build.ts +80 -0
- package/src/node/collect.ts +78 -0
- package/src/node/colors.ts +328 -0
- package/src/node/commands/build.ts +12 -0
- package/src/node/commands/dev.ts +6 -13
- package/src/node/config.ts +193 -1
- package/src/node/context.ts +21 -1
- package/src/node/dom/dom-keys.ts +227 -0
- package/src/node/dom/env.ts +26 -0
- package/src/node/index.ts +2 -0
- package/src/node/plugin.ts +146 -22
- package/src/node/server.ts +95 -20
- package/src/node/stories.ts +53 -31
- package/src/node/tree.ts +88 -0
- package/src/node/types.ts +40 -0
- package/tailwind.config.cjs +41 -1
- package/dist/client/app/components/StoryVariantItem.vue +0 -29
- package/src/client/app/components/StoryVariantItem.vue +0 -29
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import './style/sandbox.css'
|
|
2
|
+
import { parseQuery } from 'vue-router'
|
|
3
|
+
import { computed, createApp, h, ref, toRaw, watch } from 'vue'
|
|
4
|
+
import { createPinia } from 'pinia'
|
|
5
|
+
import { registerGlobalComponents } from './global-components'
|
|
6
|
+
import SandboxVue3 from './components/sandbox/SandboxVue3.vue'
|
|
7
|
+
import type { StoryFile } from './types'
|
|
8
|
+
import { mapFile } from './util/mapping'
|
|
9
|
+
// @ts-expect-error virtual module
|
|
10
|
+
import { files } from '$histoire-stories'
|
|
11
|
+
import { STATE_SYNC } from './util/const.js'
|
|
12
|
+
|
|
13
|
+
const query = parseQuery(window.location.search)
|
|
14
|
+
const file = ref<StoryFile>(mapFile(files.find(f => f.id === query.storyId)))
|
|
15
|
+
|
|
16
|
+
const app = createApp({
|
|
17
|
+
setup () {
|
|
18
|
+
const story = computed(() => file.value.story)
|
|
19
|
+
const variant = computed(() => story.value?.variants.find(v => v.id === query.variantId))
|
|
20
|
+
|
|
21
|
+
window.addEventListener('message', event => {
|
|
22
|
+
if (event.data?.type === STATE_SYNC) {
|
|
23
|
+
Object.assign(variant.value.state, event.data.state)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
watch(() => variant.value.state, value => {
|
|
28
|
+
window.parent?.postMessage({
|
|
29
|
+
type: STATE_SYNC,
|
|
30
|
+
state: toRaw(value),
|
|
31
|
+
})
|
|
32
|
+
}, {
|
|
33
|
+
deep: true,
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
story,
|
|
38
|
+
variant,
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
render () {
|
|
43
|
+
return [
|
|
44
|
+
h('div', { class: 'htw-sandbox-hidden' }, [
|
|
45
|
+
h(file.value.component, {
|
|
46
|
+
story: file.value.story,
|
|
47
|
+
}),
|
|
48
|
+
]),
|
|
49
|
+
this.story && this.variant
|
|
50
|
+
? h(SandboxVue3, {
|
|
51
|
+
story: this.story,
|
|
52
|
+
variant: this.variant,
|
|
53
|
+
})
|
|
54
|
+
: null,
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
app.use(createPinia())
|
|
59
|
+
registerGlobalComponents(app)
|
|
60
|
+
app.mount('#app')
|
|
@@ -6,9 +6,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
6
6
|
variants: {
|
|
7
7
|
id: string;
|
|
8
8
|
title: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
icon?: string;
|
|
10
|
+
iconColor?: string;
|
|
11
|
+
initState?: () => any;
|
|
12
|
+
slots?: () => Readonly<any>;
|
|
13
|
+
state?: any;
|
|
14
|
+
source?: string;
|
|
12
15
|
}[];
|
|
13
16
|
layout?: {
|
|
14
17
|
type: "single";
|
|
@@ -16,26 +19,39 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
16
19
|
type: "grid";
|
|
17
20
|
width: number;
|
|
18
21
|
};
|
|
22
|
+
icon?: string;
|
|
23
|
+
iconColor?: string;
|
|
24
|
+
file?: {
|
|
25
|
+
id: string;
|
|
26
|
+
framework: string;
|
|
27
|
+
component: any;
|
|
28
|
+
story: any;
|
|
29
|
+
path: string[];
|
|
30
|
+
};
|
|
19
31
|
lastSelectedVariant?: {
|
|
20
32
|
id: string;
|
|
21
33
|
title: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
icon?: string;
|
|
35
|
+
iconColor?: string;
|
|
36
|
+
initState?: () => any;
|
|
37
|
+
slots?: () => Readonly<any>;
|
|
38
|
+
state?: any;
|
|
39
|
+
source?: string;
|
|
25
40
|
};
|
|
26
|
-
mountTime: number;
|
|
27
41
|
}[]>;
|
|
28
|
-
|
|
29
|
-
removeStory: (story: Story) => void;
|
|
42
|
+
setStories: (value: Story[]) => void;
|
|
30
43
|
currentStory: import("vue").ComputedRef<{
|
|
31
44
|
id: string;
|
|
32
45
|
title: string;
|
|
33
46
|
variants: {
|
|
34
47
|
id: string;
|
|
35
48
|
title: string;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
icon?: string;
|
|
50
|
+
iconColor?: string;
|
|
51
|
+
initState?: () => any;
|
|
52
|
+
slots?: () => Readonly<any>;
|
|
53
|
+
state?: any;
|
|
54
|
+
source?: string;
|
|
39
55
|
}[];
|
|
40
56
|
layout?: {
|
|
41
57
|
type: "single";
|
|
@@ -43,14 +59,35 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
43
59
|
type: "grid";
|
|
44
60
|
width: number;
|
|
45
61
|
};
|
|
62
|
+
icon?: string;
|
|
63
|
+
iconColor?: string;
|
|
64
|
+
file?: {
|
|
65
|
+
id: string;
|
|
66
|
+
framework: string;
|
|
67
|
+
component: any;
|
|
68
|
+
story: any;
|
|
69
|
+
path: string[];
|
|
70
|
+
};
|
|
46
71
|
lastSelectedVariant?: {
|
|
47
72
|
id: string;
|
|
48
73
|
title: string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
74
|
+
icon?: string;
|
|
75
|
+
iconColor?: string;
|
|
76
|
+
initState?: () => any;
|
|
77
|
+
slots?: () => Readonly<any>;
|
|
78
|
+
state?: any;
|
|
79
|
+
source?: string;
|
|
52
80
|
};
|
|
53
|
-
|
|
81
|
+
}>;
|
|
82
|
+
currentVariant: import("vue").ComputedRef<{
|
|
83
|
+
id: string;
|
|
84
|
+
title: string;
|
|
85
|
+
icon?: string;
|
|
86
|
+
iconColor?: string;
|
|
87
|
+
initState?: () => any;
|
|
88
|
+
slots?: () => Readonly<any>;
|
|
89
|
+
state?: any;
|
|
90
|
+
source?: string;
|
|
54
91
|
}>;
|
|
55
92
|
}, "stories">>, import("pinia")._UnwrapAll<Pick<{
|
|
56
93
|
stories: import("vue").Ref<{
|
|
@@ -59,9 +96,12 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
59
96
|
variants: {
|
|
60
97
|
id: string;
|
|
61
98
|
title: string;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
99
|
+
icon?: string;
|
|
100
|
+
iconColor?: string;
|
|
101
|
+
initState?: () => any;
|
|
102
|
+
slots?: () => Readonly<any>;
|
|
103
|
+
state?: any;
|
|
104
|
+
source?: string;
|
|
65
105
|
}[];
|
|
66
106
|
layout?: {
|
|
67
107
|
type: "single";
|
|
@@ -69,26 +109,39 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
69
109
|
type: "grid";
|
|
70
110
|
width: number;
|
|
71
111
|
};
|
|
112
|
+
icon?: string;
|
|
113
|
+
iconColor?: string;
|
|
114
|
+
file?: {
|
|
115
|
+
id: string;
|
|
116
|
+
framework: string;
|
|
117
|
+
component: any;
|
|
118
|
+
story: any;
|
|
119
|
+
path: string[];
|
|
120
|
+
};
|
|
72
121
|
lastSelectedVariant?: {
|
|
73
122
|
id: string;
|
|
74
123
|
title: string;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
124
|
+
icon?: string;
|
|
125
|
+
iconColor?: string;
|
|
126
|
+
initState?: () => any;
|
|
127
|
+
slots?: () => Readonly<any>;
|
|
128
|
+
state?: any;
|
|
129
|
+
source?: string;
|
|
78
130
|
};
|
|
79
|
-
mountTime: number;
|
|
80
131
|
}[]>;
|
|
81
|
-
|
|
82
|
-
removeStory: (story: Story) => void;
|
|
132
|
+
setStories: (value: Story[]) => void;
|
|
83
133
|
currentStory: import("vue").ComputedRef<{
|
|
84
134
|
id: string;
|
|
85
135
|
title: string;
|
|
86
136
|
variants: {
|
|
87
137
|
id: string;
|
|
88
138
|
title: string;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
139
|
+
icon?: string;
|
|
140
|
+
iconColor?: string;
|
|
141
|
+
initState?: () => any;
|
|
142
|
+
slots?: () => Readonly<any>;
|
|
143
|
+
state?: any;
|
|
144
|
+
source?: string;
|
|
92
145
|
}[];
|
|
93
146
|
layout?: {
|
|
94
147
|
type: "single";
|
|
@@ -96,25 +149,49 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
96
149
|
type: "grid";
|
|
97
150
|
width: number;
|
|
98
151
|
};
|
|
152
|
+
icon?: string;
|
|
153
|
+
iconColor?: string;
|
|
154
|
+
file?: {
|
|
155
|
+
id: string;
|
|
156
|
+
framework: string;
|
|
157
|
+
component: any;
|
|
158
|
+
story: any;
|
|
159
|
+
path: string[];
|
|
160
|
+
};
|
|
99
161
|
lastSelectedVariant?: {
|
|
100
162
|
id: string;
|
|
101
163
|
title: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
164
|
+
icon?: string;
|
|
165
|
+
iconColor?: string;
|
|
166
|
+
initState?: () => any;
|
|
167
|
+
slots?: () => Readonly<any>;
|
|
168
|
+
state?: any;
|
|
169
|
+
source?: string;
|
|
105
170
|
};
|
|
106
|
-
mountTime: number;
|
|
107
171
|
}>;
|
|
108
|
-
|
|
172
|
+
currentVariant: import("vue").ComputedRef<{
|
|
173
|
+
id: string;
|
|
174
|
+
title: string;
|
|
175
|
+
icon?: string;
|
|
176
|
+
iconColor?: string;
|
|
177
|
+
initState?: () => any;
|
|
178
|
+
slots?: () => Readonly<any>;
|
|
179
|
+
state?: any;
|
|
180
|
+
source?: string;
|
|
181
|
+
}>;
|
|
182
|
+
}, "currentStory" | "currentVariant">>, Pick<{
|
|
109
183
|
stories: import("vue").Ref<{
|
|
110
184
|
id: string;
|
|
111
185
|
title: string;
|
|
112
186
|
variants: {
|
|
113
187
|
id: string;
|
|
114
188
|
title: string;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
189
|
+
icon?: string;
|
|
190
|
+
iconColor?: string;
|
|
191
|
+
initState?: () => any;
|
|
192
|
+
slots?: () => Readonly<any>;
|
|
193
|
+
state?: any;
|
|
194
|
+
source?: string;
|
|
118
195
|
}[];
|
|
119
196
|
layout?: {
|
|
120
197
|
type: "single";
|
|
@@ -122,26 +199,39 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
122
199
|
type: "grid";
|
|
123
200
|
width: number;
|
|
124
201
|
};
|
|
202
|
+
icon?: string;
|
|
203
|
+
iconColor?: string;
|
|
204
|
+
file?: {
|
|
205
|
+
id: string;
|
|
206
|
+
framework: string;
|
|
207
|
+
component: any;
|
|
208
|
+
story: any;
|
|
209
|
+
path: string[];
|
|
210
|
+
};
|
|
125
211
|
lastSelectedVariant?: {
|
|
126
212
|
id: string;
|
|
127
213
|
title: string;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
214
|
+
icon?: string;
|
|
215
|
+
iconColor?: string;
|
|
216
|
+
initState?: () => any;
|
|
217
|
+
slots?: () => Readonly<any>;
|
|
218
|
+
state?: any;
|
|
219
|
+
source?: string;
|
|
131
220
|
};
|
|
132
|
-
mountTime: number;
|
|
133
221
|
}[]>;
|
|
134
|
-
|
|
135
|
-
removeStory: (story: Story) => void;
|
|
222
|
+
setStories: (value: Story[]) => void;
|
|
136
223
|
currentStory: import("vue").ComputedRef<{
|
|
137
224
|
id: string;
|
|
138
225
|
title: string;
|
|
139
226
|
variants: {
|
|
140
227
|
id: string;
|
|
141
228
|
title: string;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
229
|
+
icon?: string;
|
|
230
|
+
iconColor?: string;
|
|
231
|
+
initState?: () => any;
|
|
232
|
+
slots?: () => Readonly<any>;
|
|
233
|
+
state?: any;
|
|
234
|
+
source?: string;
|
|
145
235
|
}[];
|
|
146
236
|
layout?: {
|
|
147
237
|
type: "single";
|
|
@@ -149,13 +239,34 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
149
239
|
type: "grid";
|
|
150
240
|
width: number;
|
|
151
241
|
};
|
|
242
|
+
icon?: string;
|
|
243
|
+
iconColor?: string;
|
|
244
|
+
file?: {
|
|
245
|
+
id: string;
|
|
246
|
+
framework: string;
|
|
247
|
+
component: any;
|
|
248
|
+
story: any;
|
|
249
|
+
path: string[];
|
|
250
|
+
};
|
|
152
251
|
lastSelectedVariant?: {
|
|
153
252
|
id: string;
|
|
154
253
|
title: string;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
254
|
+
icon?: string;
|
|
255
|
+
iconColor?: string;
|
|
256
|
+
initState?: () => any;
|
|
257
|
+
slots?: () => Readonly<any>;
|
|
258
|
+
state?: any;
|
|
259
|
+
source?: string;
|
|
158
260
|
};
|
|
159
|
-
mountTime: number;
|
|
160
261
|
}>;
|
|
161
|
-
|
|
262
|
+
currentVariant: import("vue").ComputedRef<{
|
|
263
|
+
id: string;
|
|
264
|
+
title: string;
|
|
265
|
+
icon?: string;
|
|
266
|
+
iconColor?: string;
|
|
267
|
+
initState?: () => any;
|
|
268
|
+
slots?: () => Readonly<any>;
|
|
269
|
+
state?: any;
|
|
270
|
+
source?: string;
|
|
271
|
+
}>;
|
|
272
|
+
}, "setStories">>;
|
|
@@ -3,27 +3,16 @@ import { computed, ref } from 'vue';
|
|
|
3
3
|
import { router } from '../router';
|
|
4
4
|
export const useStoryStore = defineStore('story', () => {
|
|
5
5
|
const stories = ref([]);
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
if (existing) {
|
|
9
|
-
Object.assign(existing, story);
|
|
10
|
-
return existing;
|
|
11
|
-
}
|
|
12
|
-
stories.value.push(story);
|
|
13
|
-
return story;
|
|
14
|
-
}
|
|
15
|
-
function removeStory(story) {
|
|
16
|
-
const index = stories.value.findIndex(s => s.id === story.id);
|
|
17
|
-
if (index !== -1) {
|
|
18
|
-
stories.value.splice(index, 1);
|
|
19
|
-
}
|
|
6
|
+
function setStories(value) {
|
|
7
|
+
stories.value = value;
|
|
20
8
|
}
|
|
21
9
|
const currentStory = computed(() => stories.value.find(s => s.id === router.currentRoute.value.params.storyId));
|
|
10
|
+
const currentVariant = computed(() => currentStory.value?.variants.find(v => v.id === router.currentRoute.value.query.variantId));
|
|
22
11
|
return {
|
|
23
12
|
stories,
|
|
24
|
-
|
|
25
|
-
removeStory,
|
|
13
|
+
setStories,
|
|
26
14
|
currentStory,
|
|
15
|
+
currentVariant,
|
|
27
16
|
};
|
|
28
17
|
});
|
|
29
18
|
//# sourceMappingURL=story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../../src/client/app/stores/story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlC,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;IACrD,MAAM,OAAO,GAAG,GAAG,CAAU,EAAE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../../src/client/app/stores/story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlC,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;IACrD,MAAM,OAAO,GAAG,GAAG,CAAU,EAAE,CAAC,CAAA;IAChC,SAAS,UAAU,CAAE,KAAc;QACjC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;IACvB,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IAE/G,MAAM,cAAc,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;IAEjI,OAAO;QACL,OAAO;QACP,UAAU;QACV,YAAY;QACZ,cAAc;KACf,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { router } from '../router'
|
|
4
|
+
import { Story } from '../types'
|
|
5
|
+
|
|
6
|
+
export const useStoryStore = defineStore('story', () => {
|
|
7
|
+
const stories = ref<Story[]>([])
|
|
8
|
+
function setStories (value: Story[]) {
|
|
9
|
+
stories.value = value
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const currentStory = computed(() => stories.value.find(s => s.id === router.currentRoute.value.params.storyId))
|
|
13
|
+
|
|
14
|
+
const currentVariant = computed(() => currentStory.value?.variants.find(v => v.id === router.currentRoute.value.query.variantId))
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
stories,
|
|
18
|
+
setStories,
|
|
19
|
+
currentStory,
|
|
20
|
+
currentVariant,
|
|
21
|
+
}
|
|
22
|
+
})
|
|
@@ -11,16 +11,30 @@
|
|
|
11
11
|
border-color: #e5e7eb;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
a
|
|
14
|
+
a,
|
|
15
|
+
input {
|
|
15
16
|
color: inherit;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
a {
|
|
16
20
|
text-decoration: inherit;
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
input {
|
|
24
|
+
font-family: inherit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
a,
|
|
28
|
+
button {
|
|
29
|
+
user-select: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
@tailwind base;
|
|
20
33
|
@tailwind components;
|
|
21
34
|
@tailwind utilities;
|
|
22
35
|
|
|
23
|
-
body
|
|
36
|
+
body,
|
|
37
|
+
pre {
|
|
24
38
|
margin: 0;
|
|
25
39
|
}
|
|
26
40
|
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
2
|
+
export interface StoryFile {
|
|
3
|
+
id: string;
|
|
4
|
+
framework: string;
|
|
5
|
+
component: any;
|
|
6
|
+
story: Story;
|
|
7
|
+
path: string[];
|
|
8
|
+
}
|
|
1
9
|
export interface Story {
|
|
2
10
|
id: string;
|
|
3
11
|
title: string;
|
|
@@ -8,13 +16,37 @@ export interface Story {
|
|
|
8
16
|
type: 'grid';
|
|
9
17
|
width: number;
|
|
10
18
|
};
|
|
19
|
+
icon?: string;
|
|
20
|
+
iconColor?: string;
|
|
21
|
+
file?: StoryFile;
|
|
11
22
|
lastSelectedVariant?: Variant;
|
|
12
|
-
mountTime: number;
|
|
13
23
|
}
|
|
14
24
|
export interface Variant {
|
|
15
25
|
id: string;
|
|
16
26
|
title: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
icon?: string;
|
|
28
|
+
iconColor?: string;
|
|
29
|
+
initState?: () => any;
|
|
30
|
+
slots?: () => Readonly<any>;
|
|
31
|
+
state?: any;
|
|
32
|
+
source?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare type TreeLeaf = {
|
|
35
|
+
title: string;
|
|
36
|
+
index: number;
|
|
37
|
+
};
|
|
38
|
+
export declare type TreeFolder = {
|
|
39
|
+
title: string;
|
|
40
|
+
children: (TreeFolder | TreeLeaf)[];
|
|
41
|
+
};
|
|
42
|
+
export declare type Tree = (TreeFolder | TreeLeaf)[];
|
|
43
|
+
export interface SearchResult {
|
|
44
|
+
kind: 'story' | 'variant';
|
|
45
|
+
rank: number;
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
route: RouteLocationRaw;
|
|
49
|
+
path?: string[];
|
|
50
|
+
icon?: string;
|
|
51
|
+
iconColor?: string;
|
|
20
52
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface StoryFile {
|
|
2
|
+
id: string
|
|
3
|
+
framework: string
|
|
4
|
+
component: any
|
|
5
|
+
story: Story
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Story {
|
|
9
|
+
id: string
|
|
10
|
+
title: string
|
|
11
|
+
variants: Variant[]
|
|
12
|
+
layout?: {
|
|
13
|
+
type: 'single'
|
|
14
|
+
} | {
|
|
15
|
+
type: 'grid'
|
|
16
|
+
width: number
|
|
17
|
+
}
|
|
18
|
+
icon?: string
|
|
19
|
+
iconColor?: string
|
|
20
|
+
file?: StoryFile
|
|
21
|
+
lastSelectedVariant?: Variant
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Variant {
|
|
25
|
+
id: string
|
|
26
|
+
title: string
|
|
27
|
+
icon?: string
|
|
28
|
+
iconColor?: string
|
|
29
|
+
initState?: () => any
|
|
30
|
+
slots?: () => Readonly<any>
|
|
31
|
+
state?: any
|
|
32
|
+
source?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type TreeLeaf = {
|
|
36
|
+
title: string
|
|
37
|
+
index: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type TreeFolder = {
|
|
41
|
+
title: string
|
|
42
|
+
children: (TreeFolder | TreeLeaf)[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type Tree = (TreeFolder | TreeLeaf)[]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/client/app/util/config.ts"],"names":[],"mappings":"AACA,kCAAkC;AAClC,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEzE,MAAM,CAAC,MAAM,cAAc,GAAmB,SAAS,CAAA;AACvD,MAAM,CAAC,MAAM,WAAW,GAAoC,QAAQ,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HistoireConfig } from '../../../node/config'
|
|
2
|
+
// @ts-expect-error virtual module
|
|
3
|
+
import { config as configRaw, logos as logosRaw } from '$histoire-config'
|
|
4
|
+
|
|
5
|
+
export const histoireConfig: HistoireConfig = configRaw
|
|
6
|
+
export const customLogos: HistoireConfig['theme']['logo'] = logosRaw
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const STATE_SYNC = "__histoire:state-sync";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/client/app/util/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,uBAAuB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const STATE_SYNC = '__histoire:state-sync'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dark.js","sourceRoot":"","sources":["../../../../src/client/app/util/dark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAA;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isMac: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../src/client/app/util/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export declare type KeyboardShortcut = string[];
|
|
3
|
+
export declare type KeyboardHandler = (event: KeyboardEvent) => unknown;
|
|
4
|
+
export interface KeyboardShortcutOptions {
|
|
5
|
+
event?: 'keyup' | 'keydown' | 'keypress';
|
|
6
|
+
}
|
|
7
|
+
export declare function onKeyboardShortcut(shortcut: KeyboardShortcut | Ref<KeyboardShortcut>, handler: KeyboardHandler, options?: KeyboardShortcutOptions): void;
|
|
8
|
+
export declare function formatKey(key: string): string;
|