@histoire/shared 0.11.8 → 0.11.9
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 +4 -4
- package/dist/types/plugin.d.ts +2 -2
- package/dist/types/story.d.ts +2 -2
- package/package.json +1 -1
- package/src/state.ts +7 -2
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;
|
|
@@ -202,4 +202,4 @@ export interface HistoireConfig {
|
|
|
202
202
|
web?: RegExp[];
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
export
|
|
205
|
+
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
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
|
}
|