@histoire/shared 0.8.4 → 0.9.2

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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './codegen/index.js';
2
2
  export * from './types.js';
3
3
  export * from './state.js';
4
+ export * from './type-utils.js';
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './codegen/index.js';
2
2
  export * from './types.js';
3
3
  export * from './state.js';
4
+ export * from './type-utils.js';
@@ -0,0 +1 @@
1
+ export declare type Awaitable<T> = Promise<T> | T;
@@ -0,0 +1 @@
1
+ export {};
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface StoryFile {
2
2
  id: string;
3
- framework: string;
3
+ supportPluginId: string;
4
4
  component: any;
5
5
  story: Story;
6
6
  path: string[];
@@ -12,6 +12,25 @@ export declare type StoryLayout = {
12
12
  type: 'grid';
13
13
  width?: number | string;
14
14
  };
15
+ export interface CommonProps {
16
+ id?: string;
17
+ title?: string;
18
+ icon?: string;
19
+ iconColor?: string;
20
+ }
21
+ export interface InheritedProps {
22
+ setupApp?: (payload: any) => unknown;
23
+ source?: string;
24
+ responsiveDisabled?: boolean;
25
+ autoPropsDisabled?: boolean;
26
+ }
27
+ export interface VariantProps extends CommonProps, InheritedProps {
28
+ }
29
+ export interface StoryProps extends CommonProps, InheritedProps {
30
+ group?: string;
31
+ layout?: StoryLayout;
32
+ docsOnly?: boolean;
33
+ }
15
34
  export interface Story {
16
35
  id: string;
17
36
  title: string;
@@ -23,7 +42,7 @@ export interface Story {
23
42
  docsOnly?: boolean;
24
43
  file?: StoryFile;
25
44
  lastSelectedVariant?: Variant;
26
- slots?: () => Readonly<any>;
45
+ slots?: () => any;
27
46
  }
28
47
  export interface Variant {
29
48
  id: string;
@@ -31,7 +50,10 @@ export interface Variant {
31
50
  icon?: string;
32
51
  iconColor?: string;
33
52
  setupApp?: (payload: any) => unknown;
34
- slots?: () => Readonly<any>;
53
+ slots?: () => {
54
+ default: any;
55
+ controls: any;
56
+ };
35
57
  state: any;
36
58
  source?: string;
37
59
  responsiveDisabled?: boolean;
@@ -60,6 +82,10 @@ export interface ServerStoryFile {
60
82
  * File name without extension
61
83
  */
62
84
  fileName: string;
85
+ /**
86
+ * Support plugin (Vue, Svelte, etc.)
87
+ */
88
+ supportPluginId: string;
63
89
  /**
64
90
  * Generated path for tree UI
65
91
  */
@@ -123,3 +149,12 @@ export interface ServerRunPayload {
123
149
  storyData: ServerStory[];
124
150
  el: HTMLElement;
125
151
  }
152
+ export interface SupportPlugin {
153
+ id: string;
154
+ moduleName: string;
155
+ setupFn: string;
156
+ importStoriesPrepend?: string;
157
+ importStoryComponent: (file: ServerStoryFile, index: number) => string;
158
+ }
159
+ export interface FinalSupportPlugin extends SupportPlugin {
160
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/shared",
3
- "version": "0.8.4",
3
+ "version": "0.9.2",
4
4
  "description": "Shared utilities for Histoire",
5
5
  "license": "MIT",
6
6
  "author": {
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './codegen/index.js'
2
2
  export * from './types.js'
3
3
  export * from './state.js'
4
+ export * from './type-utils.js'
@@ -0,0 +1 @@
1
+ export type Awaitable<T> = Promise<T> | T
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface StoryFile {
2
2
  id: string
3
- framework: string
3
+ supportPluginId: string
4
4
  component: any
5
5
  story: Story
6
6
  path: string[]
@@ -14,6 +14,30 @@ export type StoryLayout = {
14
14
  width?: number | string
15
15
  }
16
16
 
17
+ export interface CommonProps {
18
+ id?: string
19
+ title?: string
20
+ icon?: string
21
+ iconColor?: string
22
+ }
23
+
24
+ export interface InheritedProps {
25
+ setupApp?: (payload: any) => unknown
26
+ source?: string
27
+ responsiveDisabled?: boolean
28
+ autoPropsDisabled?: boolean
29
+ }
30
+
31
+ export interface VariantProps extends CommonProps, InheritedProps {
32
+ // No additional properties
33
+ }
34
+
35
+ export interface StoryProps extends CommonProps, InheritedProps {
36
+ group?: string
37
+ layout?: StoryLayout
38
+ docsOnly?: boolean
39
+ }
40
+
17
41
  export interface Story {
18
42
  id: string
19
43
  title: string
@@ -25,7 +49,7 @@ export interface Story {
25
49
  docsOnly?: boolean
26
50
  file?: StoryFile
27
51
  lastSelectedVariant?: Variant
28
- slots?: () => Readonly<any>
52
+ slots?: () => any
29
53
  }
30
54
 
31
55
  export interface Variant {
@@ -34,7 +58,7 @@ export interface Variant {
34
58
  icon?: string
35
59
  iconColor?: string
36
60
  setupApp?: (payload: any) => unknown
37
- slots?: () => Readonly<any>
61
+ slots?: () => { default: any, controls: any }
38
62
  state: any
39
63
  source?: string
40
64
  responsiveDisabled?: boolean
@@ -68,6 +92,10 @@ export interface ServerStoryFile {
68
92
  * File name without extension
69
93
  */
70
94
  fileName: string
95
+ /**
96
+ * Support plugin (Vue, Svelte, etc.)
97
+ */
98
+ supportPluginId: string
71
99
  /**
72
100
  * Generated path for tree UI
73
101
  */
@@ -139,3 +167,15 @@ export interface ServerRunPayload {
139
167
  storyData: ServerStory[]
140
168
  el: HTMLElement
141
169
  }
170
+
171
+ export interface SupportPlugin {
172
+ id: string
173
+ moduleName: string
174
+ setupFn: string
175
+ importStoriesPrepend?: string
176
+ importStoryComponent: (file: ServerStoryFile, index: number) => string
177
+ }
178
+
179
+ export interface FinalSupportPlugin extends SupportPlugin {
180
+ // For now, no additional properties
181
+ }
package/tsconfig.json CHANGED
@@ -10,10 +10,6 @@
10
10
  "removeComments": false,
11
11
  "resolveJsonModule": true,
12
12
  "skipLibCheck": true,
13
- "types": [
14
- "node",
15
- "@peeky/test"
16
- ],
17
13
  "lib": [
18
14
  "ESNext",
19
15
  "DOM"