histoire 0.5.0 → 0.5.3

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 CHANGED
@@ -1,2 +1,4 @@
1
+ import './src/components'
2
+
1
3
  // https://github.com/microsoft/TypeScript/issues/33079
2
4
  export * from './dist/client/index'
@@ -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
@@ -0,0 +1,3 @@
1
+ import './src/components'
2
+
3
+ export * from './dist/node/index'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "histoire",
3
- "version": "0.5.0",
3
+ "version": "0.5.3",
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": "./dist/node/index.d.ts",
31
+ "types": "./index.d.ts",
32
32
  "bin": {
33
33
  "histoire": "./bin.mjs"
34
34
  },
35
35
  "dependencies": {
36
- "@histoire/controls": "^0.5.0",
36
+ "@histoire/controls": "^0.5.3",
37
37
  "@iconify/vue": "^3.2.1",
38
38
  "@types/markdown-it": "^12.2.3",
39
39
  "@vueuse/core": "^8.2.5",
@@ -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,143 @@
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
+ }