@histoire/shared 0.11.8 → 0.12.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/state.d.ts +1 -1
- package/dist/state.js +8 -2
- package/dist/type-utils.d.ts +1 -1
- package/dist/types/config.d.ts +9 -4
- package/dist/types/plugin.d.ts +2 -2
- package/dist/types/story.d.ts +2 -2
- package/package.json +3 -3
- package/src/state.ts +7 -2
- package/src/types/config.ts +5 -0
package/dist/state.d.ts
CHANGED
package/dist/state.js
CHANGED
|
@@ -22,8 +22,14 @@ export function omit(data, keys) {
|
|
|
22
22
|
}
|
|
23
23
|
return copy;
|
|
24
24
|
}
|
|
25
|
-
export function applyState(target, state) {
|
|
25
|
+
export function applyState(target, state, override = false) {
|
|
26
26
|
for (const key in state) {
|
|
27
|
-
|
|
27
|
+
// iframe sync needs to update properties without overriding them
|
|
28
|
+
if (!override && target[key] && !key.startsWith('_h') && typeof target[key] === 'object' && !Array.isArray(target[key])) {
|
|
29
|
+
Object.assign(target[key], state[key]);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
target[key] = state[key];
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
}
|
package/dist/type-utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Awaitable<T> = Promise<T> | T;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export interface SupportMatchPattern {
|
|
|
7
7
|
patterns: string[];
|
|
8
8
|
pluginIds: string[];
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
10
|
+
export type CustomizableColors = 'primary' | 'gray';
|
|
11
|
+
export type ColorKeys = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
12
|
+
export type GrayColorKeys = ColorKeys | '750' | '850' | '950';
|
|
13
13
|
export interface ResponsivePreset {
|
|
14
14
|
label: string;
|
|
15
15
|
width: number;
|
|
@@ -201,5 +201,10 @@ export interface HistoireConfig {
|
|
|
201
201
|
*/
|
|
202
202
|
web?: RegExp[];
|
|
203
203
|
};
|
|
204
|
+
/**
|
|
205
|
+
* Maximum number of threads used to collect stories.
|
|
206
|
+
* By default based on available number of cores.
|
|
207
|
+
*/
|
|
208
|
+
collectMaxThreads?: number;
|
|
204
209
|
}
|
|
205
|
-
export
|
|
210
|
+
export type ConfigMode = 'build' | 'dev';
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ export interface PluginApiBase {
|
|
|
32
32
|
export interface PluginApiDev extends PluginApiBase {
|
|
33
33
|
watcher: typeof chokidar;
|
|
34
34
|
}
|
|
35
|
-
export
|
|
36
|
-
export
|
|
35
|
+
export type BuildEndCallback = () => Promise<void> | void;
|
|
36
|
+
export type PreviewStoryCallback = (payload: {
|
|
37
37
|
file: string;
|
|
38
38
|
story: ServerStory;
|
|
39
39
|
variant: ServerVariant;
|
package/dist/types/story.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface StoryFile {
|
|
|
9
9
|
default: string;
|
|
10
10
|
}>;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export type StoryLayout = {
|
|
13
13
|
type: 'single';
|
|
14
14
|
iframe?: boolean;
|
|
15
15
|
} | {
|
|
@@ -170,7 +170,7 @@ export interface ServerTreeGroup {
|
|
|
170
170
|
title: string;
|
|
171
171
|
children: (ServerTreeFolder | ServerTreeLeaf)[];
|
|
172
172
|
}
|
|
173
|
-
export
|
|
173
|
+
export type ServerTree = (ServerTreeGroup | ServerTreeFolder | ServerTreeLeaf)[];
|
|
174
174
|
export interface ServerRunPayload {
|
|
175
175
|
file: ServerStoryFile;
|
|
176
176
|
storyData: ServerStory[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@histoire/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Shared utilities for Histoire",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"picocolors": "^1.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"vite": "^2.9.0 || ^3.0.0"
|
|
35
|
+
"vite": "^2.9.0 || ^3.0.0 || ^4.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"typescript": "^4.7.4",
|
|
39
|
-
"vite": "^
|
|
39
|
+
"vite": "^4.0.0"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "rimraf dist && tsc -d",
|
package/src/state.ts
CHANGED
|
@@ -22,8 +22,13 @@ export function omit (data, keys: string[]) {
|
|
|
22
22
|
return copy
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function applyState (target: any, state: any) {
|
|
25
|
+
export function applyState (target: any, state: any, override = false) {
|
|
26
26
|
for (const key in state) {
|
|
27
|
-
|
|
27
|
+
// iframe sync needs to update properties without overriding them
|
|
28
|
+
if (!override && target[key] && !key.startsWith('_h') && typeof target[key] === 'object' && !Array.isArray(target[key])) {
|
|
29
|
+
Object.assign(target[key], state[key])
|
|
30
|
+
} else {
|
|
31
|
+
target[key] = state[key]
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
}
|
package/src/types/config.ts
CHANGED
|
@@ -210,6 +210,11 @@ export interface HistoireConfig {
|
|
|
210
210
|
*/
|
|
211
211
|
web?: RegExp[]
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Maximum number of threads used to collect stories.
|
|
215
|
+
* By default based on available number of cores.
|
|
216
|
+
*/
|
|
217
|
+
collectMaxThreads?: number
|
|
213
218
|
}
|
|
214
219
|
|
|
215
220
|
export type ConfigMode = 'build' | 'dev'
|