histoire 0.5.0 → 0.5.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/client.d.ts +2 -0
- package/dist/client/app/types.d.ts +8 -7
- package/index.d.ts +3 -0
- package/package.json +3 -3
- package/src/client/app/types.ts +9 -7
- package/src/components.d.ts +135 -0
package/client.d.ts
CHANGED
|
@@ -6,18 +6,19 @@ export interface StoryFile {
|
|
|
6
6
|
story: Story;
|
|
7
7
|
path: string[];
|
|
8
8
|
}
|
|
9
|
+
export declare type StoryLayout = {
|
|
10
|
+
type: 'single';
|
|
11
|
+
iframe?: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'grid';
|
|
14
|
+
width?: number | string;
|
|
15
|
+
};
|
|
9
16
|
export interface Story {
|
|
10
17
|
id: string;
|
|
11
18
|
title: string;
|
|
12
19
|
group?: string;
|
|
13
20
|
variants: Variant[];
|
|
14
|
-
layout?:
|
|
15
|
-
type: 'single';
|
|
16
|
-
iframe?: boolean;
|
|
17
|
-
} | {
|
|
18
|
-
type: 'grid';
|
|
19
|
-
width?: number | string;
|
|
20
|
-
};
|
|
21
|
+
layout?: StoryLayout;
|
|
21
22
|
icon?: string;
|
|
22
23
|
iconColor?: string;
|
|
23
24
|
docsOnly?: boolean;
|
package/index.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "histoire",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A fast story book powered by Vite",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
},
|
|
29
29
|
"main": "./dist/node/index.js",
|
|
30
30
|
"module": "./dist/node/index.js",
|
|
31
|
-
"types": "./
|
|
31
|
+
"types": "./index.d.ts",
|
|
32
32
|
"bin": {
|
|
33
33
|
"histoire": "./bin.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@histoire/controls": "^0.5.
|
|
36
|
+
"@histoire/controls": "^0.5.1",
|
|
37
37
|
"@iconify/vue": "^3.2.1",
|
|
38
38
|
"@types/markdown-it": "^12.2.3",
|
|
39
39
|
"@vueuse/core": "^8.2.5",
|
package/src/client/app/types.ts
CHANGED
|
@@ -9,18 +9,20 @@ export interface StoryFile {
|
|
|
9
9
|
path: string[]
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
export type StoryLayout = {
|
|
13
|
+
type: 'single'
|
|
14
|
+
iframe?: boolean
|
|
15
|
+
} | {
|
|
16
|
+
type: 'grid'
|
|
17
|
+
width?: number | string
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
export interface Story {
|
|
13
21
|
id: string
|
|
14
22
|
title: string
|
|
15
23
|
group?: string
|
|
16
24
|
variants: Variant[]
|
|
17
|
-
layout?:
|
|
18
|
-
type: 'single'
|
|
19
|
-
iframe?: boolean
|
|
20
|
-
} | {
|
|
21
|
-
type: 'grid'
|
|
22
|
-
width?: number | string
|
|
23
|
-
}
|
|
25
|
+
layout?: StoryLayout
|
|
24
26
|
icon?: string
|
|
25
27
|
iconColor?: string
|
|
26
28
|
docsOnly?: boolean
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
StoryLayout,
|
|
5
|
+
Story,
|
|
6
|
+
Variant,
|
|
7
|
+
} from './dist/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
|
+
declare type NonUndefinedable<T> = T extends undefined ? never : T
|
|
19
|
+
declare type TypePropsToRuntimeProps<T> = {
|
|
20
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
21
|
+
type: import('vue').PropType<NonUndefinedable<T[K]>>
|
|
22
|
+
} : {
|
|
23
|
+
type: import('vue').PropType<T[K]>
|
|
24
|
+
required: true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface VueStoryProps {
|
|
29
|
+
/**
|
|
30
|
+
* Title of the story.
|
|
31
|
+
*/
|
|
32
|
+
title?: string
|
|
33
|
+
/**
|
|
34
|
+
* 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.
|
|
35
|
+
*/
|
|
36
|
+
id?: string
|
|
37
|
+
/**
|
|
38
|
+
* Layout of the story.
|
|
39
|
+
*/
|
|
40
|
+
layout?: StoryLayout
|
|
41
|
+
/**
|
|
42
|
+
* Function that returns the intial state. Will be used as default value for variants.
|
|
43
|
+
*/
|
|
44
|
+
initState?: () => Record<string, any>
|
|
45
|
+
/**
|
|
46
|
+
* A function to configure the Vue application. This will be the default for the variants in the story.
|
|
47
|
+
*/
|
|
48
|
+
setupApp?: (payload: { app: import('vue').App, story: Story, variant: Variant }) => void | Promise<void>
|
|
49
|
+
/**
|
|
50
|
+
* The id of a group to include the story in.
|
|
51
|
+
*/
|
|
52
|
+
group?: string
|
|
53
|
+
/**
|
|
54
|
+
* An Iconify id to customize the story icon in the tree.
|
|
55
|
+
* https://icones.js.org/
|
|
56
|
+
*/
|
|
57
|
+
icon?: string
|
|
58
|
+
/**
|
|
59
|
+
* The icon color.
|
|
60
|
+
* Example: `#8B5CF6`
|
|
61
|
+
*/
|
|
62
|
+
iconColor?: string
|
|
63
|
+
/**
|
|
64
|
+
* This story will only render a documentation page.
|
|
65
|
+
*/
|
|
66
|
+
docsOnly?: boolean
|
|
67
|
+
/**
|
|
68
|
+
* The copiable source code of the story.
|
|
69
|
+
*/
|
|
70
|
+
source?: string
|
|
71
|
+
/**
|
|
72
|
+
* Disables the responsive menu, preview resize handles and makes the preview laways fit the available space.
|
|
73
|
+
*/
|
|
74
|
+
responsiveDisabled?: boolean
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare const VueStoryComponent: import('vue').DefineComponent<
|
|
78
|
+
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>>> & {}, {}
|
|
79
|
+
>
|
|
80
|
+
|
|
81
|
+
interface VueVariantProps {
|
|
82
|
+
/**
|
|
83
|
+
* Title of the variant.
|
|
84
|
+
*/
|
|
85
|
+
title?: string
|
|
86
|
+
/**
|
|
87
|
+
* 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.
|
|
88
|
+
*/
|
|
89
|
+
id?: string
|
|
90
|
+
/**
|
|
91
|
+
* Function that returns the intial state.
|
|
92
|
+
*/
|
|
93
|
+
initState?: () => Record<string, any>
|
|
94
|
+
/**
|
|
95
|
+
* A function to configure the Vue application.
|
|
96
|
+
*/
|
|
97
|
+
setupApp?: (payload: { app: import('vue').App, story: Story, variant: Variant }) => void | Promise<void>
|
|
98
|
+
/**
|
|
99
|
+
* An Iconify id to customize the variant icon in the UI.
|
|
100
|
+
* https://icones.js.org/
|
|
101
|
+
*/
|
|
102
|
+
icon?: string
|
|
103
|
+
/**
|
|
104
|
+
* The icon color.
|
|
105
|
+
* Example: `#8B5CF6`
|
|
106
|
+
*/
|
|
107
|
+
iconColor?: string
|
|
108
|
+
/**
|
|
109
|
+
* The copiable source code of the variant.
|
|
110
|
+
*/
|
|
111
|
+
source?: string
|
|
112
|
+
/**
|
|
113
|
+
* Disables the responsive menu, preview resize handles and makes the preview laways fit the available space.
|
|
114
|
+
*/
|
|
115
|
+
responsiveDisabled?: boolean
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare const VueVariantComponent: import('vue').DefineComponent<
|
|
119
|
+
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>>> & {}, {}
|
|
120
|
+
>
|
|
121
|
+
|
|
122
|
+
declare module '@vue/runtime-core' {
|
|
123
|
+
export interface GlobalComponents {
|
|
124
|
+
Story: typeof VueStoryComponent
|
|
125
|
+
Variant: typeof VueVariantComponent
|
|
126
|
+
// Controls
|
|
127
|
+
HstCheckbox: typeof HstCheckbox
|
|
128
|
+
HstText: typeof HstText
|
|
129
|
+
HstTextarea: typeof HstTextarea
|
|
130
|
+
HstNumber: typeof HstNumber
|
|
131
|
+
HstTokenGrid: typeof HstTokenGrid
|
|
132
|
+
HstTokenList: typeof HstTokenList
|
|
133
|
+
HstColorShades: typeof HstColorShades
|
|
134
|
+
}
|
|
135
|
+
}
|