histoire 0.7.2 → 0.7.5

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 (112) hide show
  1. package/client.d.ts +1 -1
  2. package/dist/bundled/StoryView.js +22 -19
  3. package/dist/bundled/dark.js +4 -0
  4. package/dist/bundled/index.js +0 -1
  5. package/dist/bundled/index2.js +6 -6
  6. package/dist/bundled/mapping.js +78 -0
  7. package/dist/bundled/sandbox.js +7 -6
  8. package/dist/bundled/state.js +13 -44
  9. package/dist/bundled/style.css +3 -3
  10. package/dist/client/app/App.vue +2 -2
  11. package/dist/client/app/components/panel/ControlsComponentPropItem.vue +13 -6
  12. package/dist/client/app/components/panel/ControlsComponentProps.vue +2 -1
  13. package/dist/client/app/components/panel/StatePresets.vue +2 -1
  14. package/dist/client/app/components/panel/StoryControls.vue +1 -1
  15. package/dist/client/app/components/panel/StorySourceCode.vue +2 -2
  16. package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -1
  17. package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +1 -1
  18. package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -2
  19. package/dist/client/app/components/story/StoryVariantSingleView.vue +1 -1
  20. package/dist/client/app/components/toolbar/StoryVariantNewTab.vue +1 -1
  21. package/dist/client/app/components/tree/StoryGroup.vue +1 -1
  22. package/dist/client/app/index.js +0 -2
  23. package/dist/client/app/sandbox.js +4 -5
  24. package/dist/client/app/types.d.ts +1 -52
  25. package/dist/client/app/util/mapping.d.ts +1 -1
  26. package/dist/client/app/util/mapping.js +50 -36
  27. package/dist/client/app/{components/sandbox/lib.d.ts → util/sandbox.d.ts} +1 -1
  28. package/dist/client/app/{components/sandbox/lib.js → util/sandbox.js} +1 -1
  29. package/dist/client/app/util/state.d.ts +1 -5
  30. package/dist/client/app/util/state.js +12 -44
  31. package/dist/node/collect/index.d.ts +2 -2
  32. package/dist/node/collect/index.js +3 -0
  33. package/dist/node/collect/run.d.ts +2 -0
  34. package/dist/{client/server/index.js → node/collect/run.js} +1 -1
  35. package/dist/node/collect/worker.d.ts +3 -3
  36. package/dist/node/collect/worker.js +4 -1
  37. package/dist/node/config.d.ts +3 -3
  38. package/dist/node/context.d.ts +2 -2
  39. package/dist/node/plugin.d.ts +3 -3
  40. package/dist/node/stories.d.ts +4 -4
  41. package/dist/node/tree.d.ts +3 -22
  42. package/dist/node/vite.js +1 -0
  43. package/dist/style.css +76 -0
  44. package/package.json +4 -2
  45. package/src/client/app/App.vue +2 -2
  46. package/src/client/app/components/panel/ControlsComponentPropItem.vue +13 -6
  47. package/src/client/app/components/panel/ControlsComponentProps.vue +2 -1
  48. package/src/client/app/components/panel/StatePresets.vue +2 -1
  49. package/src/client/app/components/panel/StoryControls.vue +1 -1
  50. package/src/client/app/components/panel/StorySourceCode.vue +2 -2
  51. package/src/client/app/components/story/StoryVariantGridItem.vue +1 -1
  52. package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +1 -1
  53. package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -2
  54. package/src/client/app/components/story/StoryVariantSingleView.vue +1 -1
  55. package/src/client/app/components/toolbar/StoryVariantNewTab.vue +1 -1
  56. package/src/client/app/components/tree/StoryGroup.vue +1 -1
  57. package/src/client/app/index.ts +0 -2
  58. package/src/client/app/sandbox.ts +4 -5
  59. package/src/client/app/types.ts +6 -57
  60. package/src/client/app/util/mapping.ts +47 -34
  61. package/src/client/app/{components/sandbox/lib.ts → util/sandbox.ts} +2 -2
  62. package/src/client/app/util/state.ts +15 -44
  63. package/src/node/collect/index.ts +5 -2
  64. package/src/node/collect/run.ts +13 -0
  65. package/src/node/collect/worker.ts +8 -6
  66. package/src/node/config.ts +3 -3
  67. package/src/node/context.ts +2 -2
  68. package/src/node/plugin.ts +2 -2
  69. package/src/node/server.ts +2 -2
  70. package/src/node/stories.ts +4 -4
  71. package/src/node/tree.ts +7 -31
  72. package/src/node/vite.ts +1 -0
  73. package/vite.config.ts +12 -7
  74. package/dist/bundled/SandboxVue3.js +0 -706
  75. package/dist/bundled/global-components.js +0 -213
  76. package/dist/client/app/codegen/const.d.ts +0 -1
  77. package/dist/client/app/codegen/const.js +0 -3
  78. package/dist/client/app/codegen/serialize-js.d.ts +0 -1
  79. package/dist/client/app/codegen/serialize-js.js +0 -113
  80. package/dist/client/app/codegen/util.d.ts +0 -10
  81. package/dist/client/app/codegen/util.js +0 -70
  82. package/dist/client/app/codegen/vue3.d.ts +0 -4
  83. package/dist/client/app/codegen/vue3.js +0 -357
  84. package/dist/client/app/components/exposed/Story.vue +0 -106
  85. package/dist/client/app/components/exposed/Variant.vue +0 -78
  86. package/dist/client/app/components/sandbox/RouterLinkStub.d.ts +0 -21
  87. package/dist/client/app/components/sandbox/RouterLinkStub.js +0 -43
  88. package/dist/client/app/components/sandbox/SandboxVue3.vue +0 -185
  89. package/dist/client/app/global-components.d.ts +0 -2
  90. package/dist/client/app/global-components.js +0 -10
  91. package/dist/client/server/index.d.ts +0 -7
  92. package/dist/client/server/vue3/Story.vue +0 -120
  93. package/dist/client/server/vue3/Variant.vue +0 -52
  94. package/dist/client/server/vue3/run.d.ts +0 -2
  95. package/dist/client/server/vue3/run.js +0 -45
  96. package/dist/node/types.d.ts +0 -50
  97. package/dist/node/types.js +0 -1
  98. package/src/client/app/codegen/const.ts +0 -3
  99. package/src/client/app/codegen/serialize-js.ts +0 -119
  100. package/src/client/app/codegen/util.ts +0 -79
  101. package/src/client/app/codegen/vue3.ts +0 -361
  102. package/src/client/app/components/exposed/Story.vue +0 -106
  103. package/src/client/app/components/exposed/Variant.vue +0 -78
  104. package/src/client/app/components/sandbox/RouterLinkStub.ts +0 -49
  105. package/src/client/app/components/sandbox/SandboxVue3.vue +0 -185
  106. package/src/client/app/global-components.ts +0 -13
  107. package/src/client/server/index.ts +0 -19
  108. package/src/client/server/vue3/Story.vue +0 -120
  109. package/src/client/server/vue3/Variant.vue +0 -52
  110. package/src/client/server/vue3/run.ts +0 -55
  111. package/src/components.d.ts +0 -143
  112. package/src/node/types.ts +0 -53
@@ -1,185 +0,0 @@
1
- <script lang="ts" setup>
2
- import { App, createApp, onMounted, onUnmounted, PropType, ref, watch } from 'vue'
3
- import { Story, Variant, PropDefinition, AutoPropComponentDefinition } from '../../types'
4
- import { getTagName } from '../../codegen/vue3'
5
- import { applyStateToVariant } from '../../util/state'
6
- import { RouterLinkStub } from './RouterLinkStub'
7
- // @ts-expect-error virtual module id
8
- import * as setup from '$histoire-setup'
9
- // @ts-expect-error virtual module id
10
- import * as generatedSetup from '$histoire-generated-global-setup'
11
-
12
- const props = defineProps({
13
- variant: {
14
- type: Object as PropType<Variant>,
15
- required: true,
16
- },
17
-
18
- story: {
19
- type: Object as PropType<Story>,
20
- required: true,
21
- },
22
-
23
- slotName: {
24
- type: String,
25
- default: 'default',
26
- },
27
- })
28
-
29
- const emit = defineEmits({
30
- ready: () => true,
31
- })
32
-
33
- const sandbox = ref<HTMLDivElement>()
34
- let app: App
35
- let mounting = false
36
-
37
- async function mountVariant () {
38
- mounting = true
39
-
40
- await props.variant.initState()
41
-
42
- let lastPropsTypesSnapshot: string
43
-
44
- app = createApp({
45
- name: 'SandboxVue3',
46
-
47
- render: () => {
48
- const vnodes = props.variant.slots()?.[props.slotName]?.({
49
- state: props.variant.state ?? {},
50
- }) ?? props.story.slots()?.[props.slotName]?.({
51
- state: props.variant.state ?? {},
52
- })
53
-
54
- // Auto detect props
55
- if (props.slotName === 'default') {
56
- const propsTypes: AutoPropComponentDefinition[] = vnodes.filter(vnode => typeof vnode.type === 'object').map((vnode, index) => {
57
- const propDefs: PropDefinition[] = []
58
- for (const key in vnode.type.props) {
59
- const prop = vnode.type.props[key]
60
- let types
61
- let defaultValue
62
- if (prop) {
63
- const rawTypes = Array.isArray(prop.type) ? prop.type : [prop.type]
64
- types = rawTypes.map(t => {
65
- switch (t) {
66
- case String:
67
- return 'string'
68
- case Number:
69
- return 'number'
70
- case Boolean:
71
- return 'boolean'
72
- case Object:
73
- return 'object'
74
- case Array:
75
- return 'array'
76
- default:
77
- return 'unknown'
78
- }
79
- })
80
- defaultValue = typeof prop.default === 'function' ? prop.default.toString() : prop.default
81
- }
82
- propDefs.push({
83
- name: key,
84
- types,
85
- required: prop?.required,
86
- default: defaultValue,
87
- })
88
-
89
- // Props overrides
90
- if (props.variant.state?._hPropState?.[index]?.[key]) {
91
- if (!vnode.props) {
92
- vnode.props = {}
93
- }
94
- vnode.props[key] = props.variant.state._hPropState[index][key]
95
- if (!vnode.dynamicProps) {
96
- vnode.dynamicProps = []
97
- }
98
- if (!vnode.dynamicProps.includes(key)) {
99
- vnode.dynamicProps.push(key)
100
- }
101
- }
102
- }
103
-
104
- return {
105
- name: getTagName(vnode),
106
- index,
107
- props: propDefs,
108
- } as AutoPropComponentDefinition
109
- }).filter(def => def.props.length)
110
-
111
- const snapshot = JSON.stringify(propsTypes)
112
- if (!lastPropsTypesSnapshot || lastPropsTypesSnapshot !== snapshot) {
113
- applyStateToVariant(props.variant, {
114
- _hPropDefs: propsTypes,
115
- })
116
- if (!props.variant.state._hPropState) {
117
- applyStateToVariant(props.variant, {
118
- _hPropState: {},
119
- })
120
- }
121
- lastPropsTypesSnapshot = snapshot
122
- }
123
- }
124
-
125
- return vnodes
126
- },
127
- })
128
-
129
- // Stubs
130
- app.component('RouterLink', RouterLinkStub)
131
-
132
- if (typeof generatedSetup?.setupVue3 === 'function') {
133
- await generatedSetup.setupVue3({
134
- app,
135
- story: props.story,
136
- variant: props.variant,
137
- })
138
- }
139
-
140
- if (typeof setup?.setupVue3 === 'function') {
141
- await setup.setupVue3({
142
- app,
143
- story: props.story,
144
- variant: props.variant,
145
- })
146
- }
147
-
148
- if (typeof props.variant.setupApp === 'function') {
149
- await props.variant.setupApp({
150
- app,
151
- story: props.story,
152
- variant: props.variant,
153
- })
154
- }
155
-
156
- const target = document.createElement('div')
157
- sandbox.value.appendChild(target)
158
- app.mount(target)
159
-
160
- emit('ready')
161
- }
162
-
163
- onMounted(async () => {
164
- if (props.variant.initState) {
165
- await mountVariant()
166
- }
167
- })
168
-
169
- watch(() => props.variant.initState, value => {
170
- if (value && !mounting) {
171
- mountVariant()
172
- }
173
- })
174
-
175
- onUnmounted(() => {
176
- app?.unmount()
177
- })
178
- </script>
179
-
180
- <template>
181
- <div
182
- ref="sandbox"
183
- class="__histoire-sandbox htw-overflow-auto"
184
- />
185
- </template>
@@ -1,13 +0,0 @@
1
- import { App } from 'vue'
2
- import { registerVueComponents } from '@histoire/controls'
3
- import Story from './components/exposed/Story.vue'
4
- import Variant from './components/exposed/Variant.vue'
5
-
6
- export function registerGlobalComponents (app: App) {
7
- // eslint-disable-next-line vue/multi-word-component-names
8
- app.component('Story', Story)
9
- // eslint-disable-next-line vue/multi-word-component-names
10
- app.component('Variant', Variant)
11
-
12
- registerVueComponents(app)
13
- }
@@ -1,19 +0,0 @@
1
- import type { StoryFile, Story } from '../../node/types'
2
-
3
- export interface ServerRunPayload {
4
- file: StoryFile
5
- storyData: Story[]
6
- el: HTMLElement
7
- }
8
-
9
- export async function run (payload: ServerRunPayload) {
10
- let result: any
11
-
12
- // @TODO if (vue3)
13
- {
14
- const { run } = await import('./vue3/run.js')
15
- result = await run(payload)
16
- }
17
-
18
- return result
19
- }
@@ -1,120 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent, inject, onMounted, PropType, provide, useAttrs } from 'vue'
3
- import type { StoryFile, Story, Variant } from '../../../node/types'
4
-
5
- const stub = { name: 'StubbedComponent', render: () => null }
6
-
7
- export default defineComponent({
8
- name: 'HistoireStory',
9
-
10
- inheritAttrs: false,
11
-
12
- props: {
13
- title: {
14
- type: String,
15
- default: null,
16
- },
17
-
18
- id: {
19
- type: String,
20
- default: null,
21
- },
22
-
23
- group: {
24
- type: String,
25
- default: null,
26
- },
27
-
28
- layout: {
29
- type: Object as PropType<Story['layout']>,
30
- default: () => ({ type: 'single', iframe: true }),
31
- },
32
-
33
- icon: {
34
- type: String,
35
- default: null,
36
- },
37
-
38
- iconColor: {
39
- type: String,
40
- default: null,
41
- },
42
-
43
- docsOnly: {
44
- type: Boolean,
45
- default: false,
46
- },
47
- },
48
-
49
- setup (props) {
50
- const attrs = useAttrs() as {
51
- data: StoryFile
52
- }
53
-
54
- // Story
55
-
56
- const story: Story = {
57
- id: props.id ?? attrs.data.id,
58
- title: props.title ?? attrs.data.fileName,
59
- group: props.group,
60
- layout: props.layout,
61
- icon: props.icon,
62
- iconColor: props.iconColor,
63
- docsOnly: props.docsOnly,
64
- variants: [],
65
- }
66
- const addStory = inject('addStory', null)
67
- addStory?.(story)
68
-
69
- // Variants
70
-
71
- provide('story', story)
72
-
73
- provide('addVariant', (variant: Variant) => {
74
- story.variants.push(variant)
75
- })
76
-
77
- onMounted(() => {
78
- if (!story.variants.length) {
79
- story.variants.push({
80
- id: '_default',
81
- title: 'default',
82
- })
83
- }
84
- })
85
-
86
- return {
87
- story,
88
- }
89
- },
90
-
91
- render () {
92
- let suppressError = false
93
- try {
94
- const vnodes = this.$slots.default?.({
95
- get state () {
96
- // No variant tags
97
- suppressError = true
98
- return {}
99
- },
100
- })
101
-
102
- // Auto stub components
103
- if (Array.isArray(vnodes)) {
104
- for (const vnode of vnodes) {
105
- if (typeof vnode.type === 'object' && (vnode.type as any).name !== 'HistoireVariant') {
106
- vnode.type = stub
107
- }
108
- }
109
- }
110
-
111
- return vnodes
112
- } catch (e) {
113
- if (!suppressError) {
114
- console.error(e)
115
- }
116
- return null
117
- }
118
- },
119
- })
120
- </script>
@@ -1,52 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent, inject } from 'vue'
3
- import type { Story, Variant } from '../../../node/types'
4
-
5
- export default defineComponent({
6
- name: 'HistoireVariant',
7
-
8
- props: {
9
- title: {
10
- type: String,
11
- default: 'untitled',
12
- },
13
-
14
- id: {
15
- type: String,
16
- default: null,
17
- },
18
-
19
- icon: {
20
- type: String,
21
- default: null,
22
- },
23
-
24
- iconColor: {
25
- type: String,
26
- default: null,
27
- },
28
- },
29
-
30
- setup (props) {
31
- const story = inject<Story>('story')
32
-
33
- function generateId () {
34
- return `${story.id}-${story.variants.length}`
35
- }
36
-
37
- const variant: Variant = {
38
- id: props.id ?? generateId(),
39
- title: props.title,
40
- icon: props.icon,
41
- iconColor: props.iconColor,
42
- }
43
-
44
- const addVariant = inject('addVariant') as (variant: Variant) => void
45
- addVariant(variant)
46
- },
47
-
48
- render () {
49
- return null
50
- },
51
- })
52
- </script>
@@ -1,55 +0,0 @@
1
- import { createApp, h } from 'vue'
2
- import { registerVueComponents } from '@histoire/controls'
3
- import type { ServerRunPayload } from '../index.js'
4
- import Story from './Story.vue'
5
- import Variant from './Variant.vue'
6
- // @ts-expect-error virtual module id
7
- import * as setup from '$histoire-setup'
8
- // @ts-expect-error virtual module id
9
- import * as generatedSetup from '$histoire-generated-global-setup'
10
-
11
- export async function run ({ file, storyData, el }: ServerRunPayload) {
12
- const { default: Comp } = await import(file.moduleId)
13
-
14
- const app = createApp({
15
- provide: {
16
- addStory (data) {
17
- storyData.push(data)
18
- },
19
- },
20
- render () {
21
- return h(Comp, {
22
- ref: 'comp',
23
- data: file,
24
- })
25
- },
26
- })
27
-
28
- if (typeof generatedSetup?.setupVue3 === 'function') {
29
- await generatedSetup.setupVue3({ app })
30
- }
31
-
32
- if (typeof setup?.setupVue3 === 'function') {
33
- await setup.setupVue3({ app })
34
- }
35
-
36
- // eslint-disable-next-line vue/multi-word-component-names
37
- app.component('Story', Story)
38
- // eslint-disable-next-line vue/multi-word-component-names
39
- app.component('Variant', Variant)
40
-
41
- registerVueComponents(app)
42
-
43
- app.mount(el)
44
-
45
- if (Comp.doc) {
46
- const el = document.createElement('div')
47
- el.innerHTML = Comp.doc
48
- const text = el.textContent
49
- storyData.forEach(s => {
50
- s.docsText = text
51
- })
52
- }
53
-
54
- app.unmount()
55
- }
@@ -1,143 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
-
3
- import type {
4
- StoryLayout,
5
- Story,
6
- Variant,
7
- } from './client/app/types'
8
- import type {
9
- HstCheckbox,
10
- HstText,
11
- HstTextarea,
12
- HstNumber,
13
- HstTokenGrid,
14
- HstTokenList,
15
- HstColorShades,
16
- } from '@histoire/controls'
17
-
18
- // Utils
19
-
20
- declare type NonUndefinedable<T> = T extends undefined ? never : T
21
- declare type TypePropsToRuntimeProps<T> = {
22
- [K in keyof T]-?: {} extends Pick<T, K> ? {
23
- type: import('vue').PropType<NonUndefinedable<T[K]>>
24
- } : {
25
- type: import('vue').PropType<T[K]>
26
- required: true
27
- }
28
- }
29
-
30
- // <Story>
31
-
32
- interface VueStoryProps {
33
- /**
34
- * Title of the story.
35
- */
36
- title?: string
37
- /**
38
- * Id of the story used in the URL. By default, the id is automatically generated from the file path. Setting an id manually will ensure the URL parameter doesn't change with the order of the variants in the story.
39
- */
40
- id?: string
41
- /**
42
- * Layout of the story.
43
- */
44
- layout?: StoryLayout
45
- /**
46
- * Function that returns the intial state. Will be used as default value for variants.
47
- */
48
- initState?: () => Record<string, any>
49
- /**
50
- * A function to configure the Vue application. This will be the default for the variants in the story.
51
- */
52
- setupApp?: (payload: { app: import('vue').App, story: Story, variant: Variant }) => void | Promise<void>
53
- /**
54
- * The id of a group to include the story in.
55
- */
56
- group?: string
57
- /**
58
- * An Iconify id to customize the story icon in the tree.
59
- * https://icones.js.org/
60
- */
61
- icon?: string
62
- /**
63
- * The icon color.
64
- * Example: `#8B5CF6`
65
- */
66
- iconColor?: string
67
- /**
68
- * This story will only render a documentation page.
69
- */
70
- docsOnly?: boolean
71
- /**
72
- * The copiable source code of the story.
73
- */
74
- source?: string
75
- /**
76
- * Disables the responsive menu, preview resize handles and makes the preview laways fit the available space.
77
- */
78
- responsiveDisabled?: boolean
79
- }
80
-
81
- declare const VueStoryComponent: import('vue').DefineComponent<
82
- TypePropsToRuntimeProps<VueStoryProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<TypePropsToRuntimeProps<VueStoryProps>>> & {}, {}
83
- >
84
-
85
- // <Variant>
86
-
87
- interface VueVariantProps {
88
- /**
89
- * Title of the variant.
90
- */
91
- title?: string
92
- /**
93
- * Id of the variant used in the URL. By default, the id is automatically generated with the index of the variant in the list. Setting an id manually will ensure the URL parameter doesn't change with the order of the variants in the story.
94
- */
95
- id?: string
96
- /**
97
- * Function that returns the intial state.
98
- */
99
- initState?: () => Record<string, any>
100
- /**
101
- * A function to configure the Vue application.
102
- */
103
- setupApp?: (payload: { app: import('vue').App, story: Story, variant: Variant }) => void | Promise<void>
104
- /**
105
- * An Iconify id to customize the variant icon in the UI.
106
- * https://icones.js.org/
107
- */
108
- icon?: string
109
- /**
110
- * The icon color.
111
- * Example: `#8B5CF6`
112
- */
113
- iconColor?: string
114
- /**
115
- * The copiable source code of the variant.
116
- */
117
- source?: string
118
- /**
119
- * Disables the responsive menu, preview resize handles and makes the preview laways fit the available space.
120
- */
121
- responsiveDisabled?: boolean
122
- }
123
-
124
- declare const VueVariantComponent: import('vue').DefineComponent<
125
- TypePropsToRuntimeProps<VueVariantProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<TypePropsToRuntimeProps<VueVariantProps>>> & {}, {}
126
- >
127
-
128
- // Register global components
129
-
130
- declare module '@vue/runtime-core' {
131
- export interface GlobalComponents {
132
- Story: typeof VueStoryComponent
133
- Variant: typeof VueVariantComponent
134
- // Controls
135
- HstCheckbox: typeof HstCheckbox
136
- HstText: typeof HstText
137
- HstTextarea: typeof HstTextarea
138
- HstNumber: typeof HstNumber
139
- HstTokenGrid: typeof HstTokenGrid
140
- HstTokenList: typeof HstTokenList
141
- HstColorShades: typeof HstColorShades
142
- }
143
- }
package/src/node/types.ts DELETED
@@ -1,53 +0,0 @@
1
- import type { TreeFile } from './tree.js'
2
-
3
- export interface StoryFile {
4
- id: string
5
- /**
6
- * Absolute path
7
- */
8
- path: string
9
- /**
10
- * File name without extension
11
- */
12
- fileName: string
13
- /**
14
- * Generated path for tree UI
15
- */
16
- treePath?: string[]
17
- /**
18
- * Use the module id in imports to allow HMR
19
- */
20
- moduleId: string
21
- /**
22
- * Resolved story data from story file execution
23
- */
24
- story?: Story
25
- /**
26
- * Data sent to user tree config functions
27
- */
28
- treeFile?: TreeFile
29
- }
30
-
31
- export interface Story {
32
- id: string
33
- title: string
34
- group?: string
35
- variants: Variant[]
36
- layout?: {
37
- type: 'single'
38
- } | {
39
- type: 'grid'
40
- width?: number | string
41
- }
42
- icon?: string
43
- iconColor?: string
44
- docsOnly?: boolean
45
- docsText?: string
46
- }
47
-
48
- export interface Variant {
49
- id: string
50
- title: string
51
- icon?: string
52
- iconColor?: string
53
- }