@histoire/shared 0.10.6 → 0.11.0

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,4 +1,5 @@
1
1
  export * from './codegen/index.js';
2
2
  export * from './types/index.js';
3
3
  export * from './state.js';
4
+ export * from './story.js';
4
5
  export * from './type-utils.js';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './codegen/index.js';
2
2
  export * from './types/index.js';
3
3
  export * from './state.js';
4
+ export * from './story.js';
4
5
  export * from './type-utils.js';
@@ -0,0 +1 @@
1
+ export declare const omitInheritStoryProps: string[];
package/dist/story.js ADDED
@@ -0,0 +1,10 @@
1
+ export const omitInheritStoryProps = [
2
+ 'id',
3
+ 'title',
4
+ 'group',
5
+ 'layout',
6
+ 'variants',
7
+ 'file',
8
+ 'slots',
9
+ 'lastSelectedVariant',
10
+ ];
@@ -1,6 +1,6 @@
1
1
  import type { UserConfig as ViteConfig, ConfigEnv as ViteConfigEnv } from 'vite';
2
2
  import type MarkdownIt from 'markdown-it';
3
- import type { ServerTreeFile } from './story.js';
3
+ import type { ServerTreeFile, StoryProps } from './story.js';
4
4
  import type { Plugin } from './plugin.js';
5
5
  export interface SupportMatchPattern {
6
6
  id: string;
@@ -114,7 +114,16 @@ export interface HistoireConfig {
114
114
  *
115
115
  * Example: `'/src/histoire-setup.ts'`
116
116
  */
117
- setupFile?: string;
117
+ setupFile?: string | {
118
+ /**
119
+ * Only loaded in the browser client.
120
+ */
121
+ browser: string;
122
+ /**
123
+ * Only loaded while collecting stories in the node server.
124
+ */
125
+ server: string;
126
+ };
118
127
  /**
119
128
  * Setup code created by plugins
120
129
  */
@@ -131,6 +140,10 @@ export interface HistoireConfig {
131
140
  * Class added to the html root of the story preview when dark mode is enabled.
132
141
  */
133
142
  sandboxDarkClass?: string;
143
+ /**
144
+ * Default props for stories.
145
+ */
146
+ defaultStoryProps?: Omit<StoryProps, 'id' | 'setupApp' | 'title' | 'source'>;
134
147
  /**
135
148
  * Customize the markdown-it renderer
136
149
  */
@@ -5,6 +5,9 @@ export interface StoryFile {
5
5
  story: Story;
6
6
  path: string[];
7
7
  filePath: string;
8
+ source: () => Promise<{
9
+ default: string;
10
+ }>;
8
11
  }
9
12
  export declare type StoryLayout = {
10
13
  type: 'single';
@@ -54,6 +57,7 @@ export interface Variant {
54
57
  slots?: () => {
55
58
  default: any;
56
59
  controls: any;
60
+ source: any;
57
61
  };
58
62
  state: any;
59
63
  source?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/shared",
3
- "version": "0.10.6",
3
+ "version": "0.11.0",
4
4
  "description": "Shared utilities for Histoire",
5
5
  "license": "MIT",
6
6
  "author": {
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './codegen/index.js'
2
2
  export * from './types/index.js'
3
3
  export * from './state.js'
4
+ export * from './story.js'
4
5
  export * from './type-utils.js'
package/src/story.ts ADDED
@@ -0,0 +1,10 @@
1
+ export const omitInheritStoryProps = [
2
+ 'id',
3
+ 'title',
4
+ 'group',
5
+ 'layout',
6
+ 'variants',
7
+ 'file',
8
+ 'slots',
9
+ 'lastSelectedVariant',
10
+ ]
@@ -3,7 +3,7 @@ import type {
3
3
  ConfigEnv as ViteConfigEnv,
4
4
  } from 'vite'
5
5
  import type MarkdownIt from 'markdown-it'
6
- import type { ServerTreeFile } from './story.js'
6
+ import type { ServerTreeFile, StoryProps } from './story.js'
7
7
  import type { Plugin } from './plugin.js'
8
8
 
9
9
  export interface SupportMatchPattern {
@@ -123,7 +123,16 @@ export interface HistoireConfig {
123
123
  *
124
124
  * Example: `'/src/histoire-setup.ts'`
125
125
  */
126
- setupFile?: string
126
+ setupFile?: string | {
127
+ /**
128
+ * Only loaded in the browser client.
129
+ */
130
+ browser: string
131
+ /**
132
+ * Only loaded while collecting stories in the node server.
133
+ */
134
+ server: string
135
+ }
127
136
  /**
128
137
  * Setup code created by plugins
129
138
  */
@@ -140,6 +149,10 @@ export interface HistoireConfig {
140
149
  * Class added to the html root of the story preview when dark mode is enabled.
141
150
  */
142
151
  sandboxDarkClass?: string
152
+ /**
153
+ * Default props for stories.
154
+ */
155
+ defaultStoryProps?: Omit<StoryProps, 'id' | 'setupApp' | 'title' | 'source'>
143
156
  /**
144
157
  * Customize the markdown-it renderer
145
158
  */
@@ -5,6 +5,7 @@ export interface StoryFile {
5
5
  story: Story
6
6
  path: string[]
7
7
  filePath: string
8
+ source: () => Promise<{ default: string }>
8
9
  }
9
10
 
10
11
  export type StoryLayout = {
@@ -59,7 +60,7 @@ export interface Variant {
59
60
  icon?: string
60
61
  iconColor?: string
61
62
  setupApp?: (payload: any) => unknown
62
- slots?: () => { default: any, controls: any }
63
+ slots?: () => { default: any, controls: any, source: any }
63
64
  state: any
64
65
  source?: string
65
66
  responsiveDisabled?: boolean
package/tsconfig.json CHANGED
@@ -16,7 +16,6 @@
16
16
  ],
17
17
  "sourceMap": false,
18
18
  "preserveWatchOutput": true,
19
- "preserveSymlinks": true,
20
19
  // Strict
21
20
  "noImplicitAny": false,
22
21
  "noImplicitThis": true,