@histoire/shared 0.17.16 → 1.0.0-alpha.1
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/codegen/const.d.ts +1 -0
- package/dist/codegen/const.d.ts.map +1 -0
- package/dist/codegen/const.js +15 -1
- package/dist/codegen/index.d.ts +1 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/serialize-js.d.ts +1 -0
- package/dist/codegen/serialize-js.d.ts.map +1 -0
- package/dist/codegen/serialize-js.js +6 -6
- package/dist/codegen/util.d.ts +1 -0
- package/dist/codegen/util.d.ts.map +1 -0
- package/dist/codegen/util.js +2 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/state.d.ts +1 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/story.d.ts +1 -0
- package/dist/story.d.ts.map +1 -0
- package/dist/type-utils.d.ts +1 -0
- package/dist/type-utils.d.ts.map +1 -0
- package/dist/types/command.d.ts +1 -0
- package/dist/types/command.d.ts.map +1 -0
- package/dist/types/config.d.ts +4 -3
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +8 -7
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/prompt.d.ts +2 -1
- package/dist/types/prompt.d.ts.map +1 -0
- package/dist/types/story.d.ts +1 -0
- package/dist/types/story.d.ts.map +1 -0
- package/package.json +17 -17
- package/src/codegen/const.ts +15 -1
- package/src/codegen/serialize-js.ts +33 -23
- package/src/codegen/util.ts +7 -9
- package/src/index.ts +1 -1
- package/src/state.ts +11 -7
- package/src/types/command.ts +1 -1
- package/src/types/config.ts +4 -4
- package/src/types/plugin.ts +12 -12
- package/src/types/prompt.ts +3 -2
- package/tsconfig.json +24 -21
package/dist/codegen/const.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/codegen/const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAgBxB,CAAA"}
|
package/dist/codegen/const.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
export const voidElements = [
|
|
2
|
-
'area',
|
|
2
|
+
'area',
|
|
3
|
+
'base',
|
|
4
|
+
'br',
|
|
5
|
+
'col',
|
|
6
|
+
'embed',
|
|
7
|
+
'hr',
|
|
8
|
+
'img',
|
|
9
|
+
'input',
|
|
10
|
+
'keygen',
|
|
11
|
+
'link',
|
|
12
|
+
'meta',
|
|
13
|
+
'param',
|
|
14
|
+
'source',
|
|
15
|
+
'track',
|
|
16
|
+
'wbr',
|
|
3
17
|
];
|
package/dist/codegen/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize-js.d.ts","sourceRoot":"","sources":["../../src/codegen/serialize-js.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CA4B9C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const KEY_ESCAPE_REG = /[\s
|
|
1
|
+
const KEY_ESCAPE_REG = /[\s\-.:|#@$£*%]/;
|
|
2
2
|
const MAX_SINGLE_LINE_ARRAY_LENGTH = 3;
|
|
3
3
|
export function serializeJs(value) {
|
|
4
4
|
const seen = new Set();
|
|
@@ -38,9 +38,9 @@ function objectToSourceLines(object, seen, indentCount = 0) {
|
|
|
38
38
|
else {
|
|
39
39
|
seen.add(object);
|
|
40
40
|
}
|
|
41
|
-
return createLines(indentCount, lines => {
|
|
41
|
+
return createLines(indentCount, (lines) => {
|
|
42
42
|
lines.push('{');
|
|
43
|
-
lines.push(...createLines(1, lines => {
|
|
43
|
+
lines.push(...createLines(1, (lines) => {
|
|
44
44
|
for (const key in object) {
|
|
45
45
|
const value = object[key];
|
|
46
46
|
let printedKey = key;
|
|
@@ -60,8 +60,8 @@ function arrayToSourceLines(array, seen, indentCount = 0) {
|
|
|
60
60
|
else {
|
|
61
61
|
seen.add(array);
|
|
62
62
|
}
|
|
63
|
-
return createLines(indentCount, lines => {
|
|
64
|
-
const contentLines = createLines(1, lines => {
|
|
63
|
+
return createLines(indentCount, (lines) => {
|
|
64
|
+
const contentLines = createLines(1, (lines) => {
|
|
65
65
|
for (const value of array) {
|
|
66
66
|
addLinesFromValue(lines, value, '', ',', seen);
|
|
67
67
|
}
|
|
@@ -84,7 +84,7 @@ function arrayToSourceLines(array, seen, indentCount = 0) {
|
|
|
84
84
|
function createLines(indentCount, handler) {
|
|
85
85
|
const lines = [];
|
|
86
86
|
handler(lines);
|
|
87
|
-
return lines.map(line => {
|
|
87
|
+
return lines.map((line) => {
|
|
88
88
|
if (line.spaces != null) {
|
|
89
89
|
line.spaces += indentCount;
|
|
90
90
|
return line;
|
package/dist/codegen/util.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ interface AutoBuildingOject {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function createAutoBuildingObject(format?: (key: string) => string, specialKeysHandler?: (target: any, p: string | symbol) => (() => unknown) | null, key?: string, depth?: number): AutoBuildingOject;
|
|
10
10
|
export {};
|
|
11
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/codegen/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,SAAI,YAEhD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,UAiBpC;AAED,UAAU,iBAAiB;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,iBAAiB,CAAC,CAAA;IACjD,MAAM,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,GAAG,CAAA;CACX;AAED,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,SAAK,EAAE,KAAK,SAAI,GAAG,iBAAiB,CA8CnM"}
|
package/dist/codegen/util.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
1
|
export function indent(lines, count = 1) {
|
|
3
2
|
return lines.map(line => `${' '.repeat(count)}${line}`);
|
|
4
3
|
}
|
|
@@ -25,7 +24,7 @@ export function createAutoBuildingObject(format, specialKeysHandler, key = '', d
|
|
|
25
24
|
if (depth > 32)
|
|
26
25
|
return { key, cache, target: {}, proxy: () => key };
|
|
27
26
|
const target = () => {
|
|
28
|
-
const k = key
|
|
27
|
+
const k = `${key}()`;
|
|
29
28
|
return format ? format(k) : k;
|
|
30
29
|
};
|
|
31
30
|
const proxy = new Proxy(target, {
|
|
@@ -43,7 +42,7 @@ export function createAutoBuildingObject(format, specialKeysHandler, key = '', d
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
if (p === 'toString') {
|
|
46
|
-
const k = key
|
|
45
|
+
const k = `${key}.toString()`;
|
|
47
46
|
return () => format ? format(k) : k;
|
|
48
47
|
}
|
|
49
48
|
if (p === Symbol.toPrimitive) {
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/state.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,IAAI,KAAA,OAczB;AAED,wBAAgB,IAAI,CAAC,IAAI,KAAA,EAAE,IAAI,EAAE,MAAM,EAAE,MAQxC;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,UAAQ,QAenE"}
|
package/dist/story.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../src/story.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UASjC,CAAA"}
|
package/dist/type-utils.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
package/dist/types/command.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/types/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEhD,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,OAAQ,SAAQ,oBAAoB;IACnD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAA;IAC/C,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAClG,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAA;CACnF;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,oBAAoB,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,6BAA6B,CAAA;IACpC,YAAY,EAAE,KAAK,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,aAAa,CAC5B,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAC7B,SAAQ,OAAO;IACf,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAA;IAC3C,eAAe,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CAChE"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { UserConfig as ViteConfig, ConfigEnv as ViteConfigEnv } from 'vite';
|
|
2
1
|
import type MarkdownIt from 'markdown-it';
|
|
3
|
-
import type {
|
|
2
|
+
import type { UserConfig as ViteConfig, ConfigEnv as ViteConfigEnv } from 'vite';
|
|
4
3
|
import type { Plugin } from './plugin.js';
|
|
4
|
+
import type { ServerTreeFile, StoryProps } from './story.js';
|
|
5
5
|
export interface SupportMatchPattern {
|
|
6
6
|
id: string;
|
|
7
7
|
patterns: string[];
|
|
@@ -13,7 +13,7 @@ export type GrayColorKeys = ColorKeys | '750' | '850' | '950';
|
|
|
13
13
|
export interface ResponsivePreset {
|
|
14
14
|
label: string;
|
|
15
15
|
width: number;
|
|
16
|
-
height
|
|
16
|
+
height?: number;
|
|
17
17
|
}
|
|
18
18
|
export interface BackgroundPreset {
|
|
19
19
|
label: string;
|
|
@@ -235,3 +235,4 @@ export interface HistoireConfig {
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
export type ConfigMode = 'build' | 'dev';
|
|
238
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EACV,UAAU,IAAI,UAAU,EACxB,SAAS,IAAI,aAAa,EAC3B,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5D,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAAA;AACnD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAA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AAC3B,cAAc,YAAY,CAAA"}
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type chokidar from 'chokidar';
|
|
2
2
|
import type fs from 'fs-extra';
|
|
3
|
+
import type path from 'pathe';
|
|
3
4
|
import type pc from 'picocolors';
|
|
4
|
-
import type chokidar from 'chokidar';
|
|
5
5
|
import type { InlineConfig as ViteInlineConfig } from 'vite';
|
|
6
|
-
import type { ServerStoryFile, ServerStory, ServerVariant } from './story.js';
|
|
7
|
-
import type { HistoireConfig, ConfigMode } from './config.js';
|
|
8
|
-
import type { PluginCommand } from './command.js';
|
|
9
6
|
import type { Awaitable } from '../type-utils.js';
|
|
7
|
+
import type { PluginCommand } from './command.js';
|
|
8
|
+
import type { ConfigMode, HistoireConfig } from './config.js';
|
|
9
|
+
import type { ServerStory, ServerStoryFile, ServerVariant } from './story.js';
|
|
10
10
|
export interface SupportPlugin {
|
|
11
11
|
id: string;
|
|
12
12
|
moduleName: string;
|
|
@@ -30,9 +30,9 @@ export interface PluginApiBase {
|
|
|
30
30
|
log: (...msg: any[]) => void;
|
|
31
31
|
warn: (...msg: any[]) => void;
|
|
32
32
|
error: (...msg: any[]) => void;
|
|
33
|
-
getStories()
|
|
33
|
+
getStories: () => ServerStory[];
|
|
34
34
|
addStoryFile: (file: string) => void;
|
|
35
|
-
getConfig()
|
|
35
|
+
getConfig: () => HistoireConfig;
|
|
36
36
|
}
|
|
37
37
|
export interface PluginApiDev extends PluginApiBase {
|
|
38
38
|
watcher: typeof chokidar;
|
|
@@ -110,3 +110,4 @@ export interface Plugin {
|
|
|
110
110
|
*/
|
|
111
111
|
onDevEvent?: (api: PluginApiDevEvent) => Awaitable<any>;
|
|
112
112
|
}
|
|
113
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"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|
1
|
+
import type { Awaitable } from '../type-utils.js';
|
|
2
2
|
export interface PromptBase<TValue> {
|
|
3
3
|
field: string;
|
|
4
4
|
label: string;
|
|
@@ -17,3 +17,4 @@ export interface SelectPrompt extends PromptBase<string> {
|
|
|
17
17
|
options: SelectPromptOption[] | ((search: string, answers: Record<string, any>) => Awaitable<SelectPromptOption[]>);
|
|
18
18
|
}
|
|
19
19
|
export type Prompt<TValue = any> = TextPrompt | SelectPrompt;
|
|
20
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/types/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,MAAM,WAAW,UAAU,CAAC,MAAM;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,CAAA;CACnE;AAED,MAAM,WAAW,UAAW,SAAQ,UAAU,CAAC,MAAM,CAAC;IACpD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1E,MAAM,WAAW,YAAa,SAAQ,UAAU,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,SAAS,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAA;CACpH;AAGD,MAAM,MAA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AAE,WAAW,CAAA;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@histoire/shared",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0-alpha.1",
|
|
4
5
|
"description": "Shared utilities for Histoire",
|
|
5
|
-
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Guillaume Chau"
|
|
8
8
|
},
|
|
9
|
+
"license": "MIT",
|
|
9
10
|
"repository": {
|
|
10
11
|
"url": "https://github.com/Akryum/histoire.git",
|
|
11
12
|
"type": "git",
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
"publishConfig": {
|
|
15
16
|
"access": "public"
|
|
16
17
|
},
|
|
17
|
-
"
|
|
18
|
+
"sideEffects": false,
|
|
18
19
|
"exports": {
|
|
19
20
|
".": "./dist/index.js",
|
|
20
21
|
"./*": "./*",
|
|
@@ -23,24 +24,23 @@
|
|
|
23
24
|
"main": "./dist/index.js",
|
|
24
25
|
"module": "./dist/index.js",
|
|
25
26
|
"types": "./dist/index.d.ts",
|
|
26
|
-
"sideEffects": false,
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@types/fs-extra": "^9.0.13",
|
|
29
|
-
"@types/markdown-it": "^12.2.3",
|
|
30
|
-
"chokidar": "^3.5.3",
|
|
31
|
-
"pathe": "^1.1.1",
|
|
32
|
-
"picocolors": "^1.0.0",
|
|
33
|
-
"@histoire/vendors": "^0.17.16"
|
|
34
|
-
},
|
|
35
27
|
"peerDependencies": {
|
|
36
|
-
"vite": "^
|
|
28
|
+
"vite": "^6.0.1"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@types/fs-extra": "^11.0.4",
|
|
32
|
+
"@types/markdown-it": "^14.1.2",
|
|
33
|
+
"chokidar": "^4.0.1",
|
|
34
|
+
"pathe": "^1.1.2",
|
|
35
|
+
"picocolors": "^1.1.1",
|
|
36
|
+
"@histoire/vendors": "^1.0.0-alpha.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"typescript": "
|
|
40
|
-
"vite": "^
|
|
39
|
+
"typescript": "5.6.3",
|
|
40
|
+
"vite": "^6.0.5"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "rimraf dist && tsc
|
|
44
|
-
"watch": "tsc -
|
|
43
|
+
"build": "rimraf dist && tsc",
|
|
44
|
+
"watch": "tsc -w --sourceMap"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/codegen/const.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
export const voidElements = [
|
|
2
|
-
'area',
|
|
2
|
+
'area',
|
|
3
|
+
'base',
|
|
4
|
+
'br',
|
|
5
|
+
'col',
|
|
6
|
+
'embed',
|
|
7
|
+
'hr',
|
|
8
|
+
'img',
|
|
9
|
+
'input',
|
|
10
|
+
'keygen',
|
|
11
|
+
'link',
|
|
12
|
+
'meta',
|
|
13
|
+
'param',
|
|
14
|
+
'source',
|
|
15
|
+
'track',
|
|
16
|
+
'wbr',
|
|
3
17
|
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const KEY_ESCAPE_REG = /[\s
|
|
1
|
+
const KEY_ESCAPE_REG = /[\s\-.:|#@$£*%]/
|
|
2
2
|
const MAX_SINGLE_LINE_ARRAY_LENGTH = 3
|
|
3
3
|
|
|
4
4
|
interface Line {
|
|
@@ -6,7 +6,7 @@ interface Line {
|
|
|
6
6
|
line: string
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function serializeJs
|
|
9
|
+
export function serializeJs(value: any): string {
|
|
10
10
|
const seen = new Set()
|
|
11
11
|
|
|
12
12
|
if (value === undefined) {
|
|
@@ -36,20 +36,21 @@ export function serializeJs (value: any): string {
|
|
|
36
36
|
return value.toString()
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function printLines
|
|
39
|
+
function printLines(lines: Line[]) {
|
|
40
40
|
return lines.map(line => ' '.repeat(line.spaces) + line.line).join('\n')
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function objectToSourceLines
|
|
43
|
+
function objectToSourceLines(object, seen: Set<unknown>, indentCount = 0) {
|
|
44
44
|
if (seen.has(object)) {
|
|
45
45
|
object = {}
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
47
48
|
seen.add(object)
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
return createLines(indentCount, lines => {
|
|
51
|
+
return createLines(indentCount, (lines) => {
|
|
51
52
|
lines.push('{')
|
|
52
|
-
lines.push(...createLines(1, lines => {
|
|
53
|
+
lines.push(...createLines(1, (lines) => {
|
|
53
54
|
for (const key in object) {
|
|
54
55
|
const value = object[key]
|
|
55
56
|
|
|
@@ -65,37 +66,40 @@ function objectToSourceLines (object, seen: Set<unknown>, indentCount = 0) {
|
|
|
65
66
|
})
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function arrayToSourceLines
|
|
69
|
+
function arrayToSourceLines(array: any[], seen: Set<unknown>, indentCount = 0): Array<Line> {
|
|
69
70
|
if (seen.has(array)) {
|
|
70
71
|
array = []
|
|
71
|
-
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
72
74
|
seen.add(array)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
return createLines(indentCount, lines => {
|
|
76
|
-
const contentLines = createLines(1, lines => {
|
|
77
|
+
return createLines(indentCount, (lines) => {
|
|
78
|
+
const contentLines = createLines(1, (lines) => {
|
|
77
79
|
for (const value of array) {
|
|
78
80
|
addLinesFromValue(lines, value, '', ',', seen)
|
|
79
81
|
}
|
|
80
82
|
})
|
|
81
83
|
if (contentLines.length === 0) {
|
|
82
84
|
lines.push('[]')
|
|
83
|
-
}
|
|
85
|
+
}
|
|
86
|
+
else if (contentLines.length <= MAX_SINGLE_LINE_ARRAY_LENGTH && !contentLines.some(line => line.spaces > 1)) {
|
|
84
87
|
const [first] = contentLines
|
|
85
88
|
first.line = contentLines.map(({ line }) => line.substring(0, line.length - 1)).join(', ')
|
|
86
89
|
first.line = `[${first.line}]`
|
|
87
90
|
first.spaces--
|
|
88
91
|
lines.push(first)
|
|
89
|
-
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
90
94
|
lines.push('[', ...contentLines, ']')
|
|
91
95
|
}
|
|
92
96
|
})
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
function createLines
|
|
99
|
+
function createLines(indentCount: number, handler: (lines: any[]) => unknown): Array<Line> {
|
|
96
100
|
const lines: any[] = []
|
|
97
101
|
handler(lines)
|
|
98
|
-
return lines.map(line => {
|
|
102
|
+
return lines.map((line) => {
|
|
99
103
|
if (line.spaces != null) {
|
|
100
104
|
line.spaces += indentCount
|
|
101
105
|
return line
|
|
@@ -104,29 +108,35 @@ function createLines (indentCount: number, handler: (lines: any[]) => unknown):
|
|
|
104
108
|
})
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
function addLinesFromValue
|
|
111
|
+
function addLinesFromValue(lines: Line[], value, before, after, seen) {
|
|
108
112
|
let result
|
|
109
113
|
if (Array.isArray(value)) {
|
|
110
114
|
lines.push(...wrap(arrayToSourceLines(value, seen), before, after))
|
|
111
115
|
return
|
|
112
|
-
}
|
|
116
|
+
}
|
|
117
|
+
else if (value && typeof value === 'object') {
|
|
113
118
|
lines.push(...wrap(objectToSourceLines(value, seen), before, after))
|
|
114
119
|
return
|
|
115
|
-
}
|
|
120
|
+
}
|
|
121
|
+
else if (typeof value === 'string') {
|
|
116
122
|
result = value.includes('\'') ? `\`${value}\`` : `'${value}'`
|
|
117
|
-
}
|
|
123
|
+
}
|
|
124
|
+
else if (typeof value === 'undefined') {
|
|
118
125
|
result = 'undefined'
|
|
119
|
-
}
|
|
126
|
+
}
|
|
127
|
+
else if (value === null) {
|
|
120
128
|
result = 'null'
|
|
121
|
-
}
|
|
129
|
+
}
|
|
130
|
+
else if (typeof value === 'boolean') {
|
|
122
131
|
result = value ? 'true' : 'false'
|
|
123
|
-
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
124
134
|
result = value
|
|
125
135
|
}
|
|
126
136
|
lines.push(before + result + after)
|
|
127
137
|
}
|
|
128
138
|
|
|
129
|
-
function wrap
|
|
139
|
+
function wrap(lines: Line[], before: string, after: string) {
|
|
130
140
|
lines[0].line = before + lines[0].line
|
|
131
141
|
lines[lines.length - 1].line += after
|
|
132
142
|
return lines
|
package/src/codegen/util.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export function indent (lines: string[], count = 1) {
|
|
1
|
+
export function indent(lines: string[], count = 1) {
|
|
4
2
|
return lines.map(line => `${' '.repeat(count)}${line}`)
|
|
5
3
|
}
|
|
6
4
|
|
|
7
|
-
export function unindent
|
|
5
|
+
export function unindent(code: string) {
|
|
8
6
|
const lines = code.split('\n')
|
|
9
7
|
let indentLevel = -1
|
|
10
8
|
let indentText: string
|
|
@@ -30,15 +28,15 @@ interface AutoBuildingOject {
|
|
|
30
28
|
proxy: any
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
export function createAutoBuildingObject
|
|
31
|
+
export function createAutoBuildingObject(format?: (key: string) => string, specialKeysHandler?: (target: any, p: string | symbol) => (() => unknown) | null, key = '', depth = 0): AutoBuildingOject {
|
|
34
32
|
const cache: Record<string | symbol, AutoBuildingOject> = {}
|
|
35
33
|
if (depth > 32) return { key, cache, target: {}, proxy: () => key }
|
|
36
34
|
const target: any = () => {
|
|
37
|
-
const k = key
|
|
35
|
+
const k = `${key}()`
|
|
38
36
|
return format ? format(k) : k
|
|
39
37
|
}
|
|
40
38
|
const proxy = new Proxy(target, {
|
|
41
|
-
get
|
|
39
|
+
get(_, p) {
|
|
42
40
|
if (p === '__autoBuildingObject') {
|
|
43
41
|
return true
|
|
44
42
|
}
|
|
@@ -52,7 +50,7 @@ export function createAutoBuildingObject (format?: (key: string) => string, spec
|
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
if (p === 'toString') {
|
|
55
|
-
const k = key
|
|
53
|
+
const k = `${key}.toString()`
|
|
56
54
|
return () => format ? format(k) : k
|
|
57
55
|
}
|
|
58
56
|
if (p === Symbol.toPrimitive) {
|
|
@@ -65,7 +63,7 @@ export function createAutoBuildingObject (format?: (key: string) => string, spec
|
|
|
65
63
|
}
|
|
66
64
|
return cache[p].proxy
|
|
67
65
|
},
|
|
68
|
-
apply
|
|
66
|
+
apply(_, thisArg, args) {
|
|
69
67
|
const k = `${key}(${args.join(', ')})`
|
|
70
68
|
return format ? format(k) : k
|
|
71
69
|
},
|
package/src/index.ts
CHANGED
package/src/state.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
export function clone
|
|
1
|
+
export function clone(data) {
|
|
2
2
|
try {
|
|
3
3
|
return structuredClone(data)
|
|
4
|
-
}
|
|
4
|
+
}
|
|
5
|
+
catch (e) {
|
|
5
6
|
console.warn(e, `Fallback to JSON cloning`)
|
|
6
7
|
try {
|
|
7
8
|
return JSON.parse(JSON.stringify(data))
|
|
8
|
-
}
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
9
11
|
console.error(e)
|
|
10
12
|
}
|
|
11
13
|
return data
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export function omit
|
|
17
|
+
export function omit(data, keys: string[]) {
|
|
16
18
|
const copy = {}
|
|
17
19
|
for (const key in data) {
|
|
18
20
|
if (!keys.includes(key)) {
|
|
@@ -22,15 +24,17 @@ export function omit (data, keys: string[]) {
|
|
|
22
24
|
return copy
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
export function applyState
|
|
27
|
+
export function applyState(target: any, state: any, override = false) {
|
|
26
28
|
for (const key in state) {
|
|
27
29
|
// iframe sync needs to update properties without overriding them
|
|
28
30
|
if (!override && target[key] && !key.startsWith('_h') && typeof target[key] === 'object' && !Array.isArray(target[key])) {
|
|
29
31
|
Object.assign(target[key], state[key])
|
|
30
|
-
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
31
34
|
try {
|
|
32
35
|
target[key] = state[key]
|
|
33
|
-
}
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
34
38
|
// noop
|
|
35
39
|
}
|
|
36
40
|
}
|
package/src/types/command.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface ClientCommandContext {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface PluginCommand<
|
|
34
|
-
TParams = Record<string, any
|
|
34
|
+
TParams = Record<string, any>,
|
|
35
35
|
> extends Command {
|
|
36
36
|
serverAction?: (params: TParams) => unknown // @TODO ctx
|
|
37
37
|
clientSetupFile?: string | { file: string, importName: string }
|
package/src/types/config.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type MarkdownIt from 'markdown-it'
|
|
1
2
|
import type {
|
|
2
3
|
UserConfig as ViteConfig,
|
|
3
4
|
ConfigEnv as ViteConfigEnv,
|
|
4
5
|
} from 'vite'
|
|
5
|
-
import type MarkdownIt from 'markdown-it'
|
|
6
|
-
import type { ServerTreeFile, StoryProps } from './story.js'
|
|
7
6
|
import type { Plugin } from './plugin.js'
|
|
7
|
+
import type { ServerTreeFile, StoryProps } from './story.js'
|
|
8
8
|
|
|
9
9
|
export interface SupportMatchPattern {
|
|
10
10
|
id: string
|
|
@@ -19,7 +19,7 @@ export type GrayColorKeys = ColorKeys | '750' | '850' | '950'
|
|
|
19
19
|
export interface ResponsivePreset {
|
|
20
20
|
label: string
|
|
21
21
|
width: number
|
|
22
|
-
height
|
|
22
|
+
height?: number
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface BackgroundPreset {
|
|
@@ -108,7 +108,7 @@ export interface HistoireConfig {
|
|
|
108
108
|
colors?: {
|
|
109
109
|
[key in CustomizableColors]?: key extends 'gray' ? {
|
|
110
110
|
[key in GrayColorKeys]?: string
|
|
111
|
-
} :{
|
|
111
|
+
} : {
|
|
112
112
|
[key in ColorKeys]?: string
|
|
113
113
|
}
|
|
114
114
|
}
|
package/src/types/plugin.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type chokidar from 'chokidar'
|
|
2
2
|
import type fs from 'fs-extra'
|
|
3
|
+
import type path from 'pathe'
|
|
3
4
|
import type pc from 'picocolors'
|
|
4
|
-
import type chokidar from 'chokidar'
|
|
5
5
|
import type { InlineConfig as ViteInlineConfig } from 'vite'
|
|
6
|
+
import type { Awaitable } from '../type-utils.js'
|
|
6
7
|
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ServerVariant,
|
|
10
|
-
} from './story.js'
|
|
8
|
+
PluginCommand,
|
|
9
|
+
} from './command.js'
|
|
11
10
|
import type {
|
|
12
|
-
HistoireConfig,
|
|
13
11
|
ConfigMode,
|
|
12
|
+
HistoireConfig,
|
|
14
13
|
} from './config.js'
|
|
15
14
|
import type {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
ServerStory,
|
|
16
|
+
ServerStoryFile,
|
|
17
|
+
ServerVariant,
|
|
18
|
+
} from './story.js'
|
|
19
19
|
|
|
20
20
|
export interface SupportPlugin {
|
|
21
21
|
id: string
|
|
@@ -47,10 +47,10 @@ export interface PluginApiBase {
|
|
|
47
47
|
warn: (...msg) => void
|
|
48
48
|
error: (...msg) => void
|
|
49
49
|
|
|
50
|
-
getStories ()
|
|
50
|
+
getStories: () => ServerStory[]
|
|
51
51
|
addStoryFile: (file: string) => void
|
|
52
52
|
|
|
53
|
-
getConfig ()
|
|
53
|
+
getConfig: () => HistoireConfig
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export interface PluginApiDev extends PluginApiBase {
|
package/src/types/prompt.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Awaitable } from '../type-utils.js'
|
|
1
|
+
import type { Awaitable } from '../type-utils.js'
|
|
2
2
|
|
|
3
3
|
export interface PromptBase<TValue> {
|
|
4
4
|
field: string
|
|
@@ -18,5 +18,6 @@ export interface SelectPrompt extends PromptBase<string> {
|
|
|
18
18
|
options: SelectPromptOption[] | ((search: string, answers: Record<string, any>) => Awaitable<SelectPromptOption[]>)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
21
22
|
export type Prompt<TValue = any> = TextPrompt
|
|
22
|
-
| SelectPrompt
|
|
23
|
+
| SelectPrompt
|
package/tsconfig.json
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ESNext",
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"baseUrl": ".",
|
|
9
|
-
"allowSyntheticDefaultImports": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"removeComments": false,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
4
|
+
// Volar
|
|
5
|
+
"jsx": "preserve",
|
|
14
6
|
"lib": [
|
|
15
7
|
"ESNext",
|
|
16
8
|
"DOM"
|
|
17
9
|
],
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"noImplicitThis": true,
|
|
23
|
-
"alwaysStrict": true,
|
|
24
|
-
"strictBindCallApply": true,
|
|
25
|
-
"strictFunctionTypes": true,
|
|
26
|
-
// Volar
|
|
27
|
-
"jsx": "preserve",
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"rootDir": "src",
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "node",
|
|
28
14
|
// Alias
|
|
29
15
|
"paths": {
|
|
30
16
|
"floating-vue": ["node_modules/@histoire/vendors/floating-vue"],
|
|
@@ -34,7 +20,24 @@
|
|
|
34
20
|
"vue-router": ["node_modules/@histoire/vendors/vue-router"],
|
|
35
21
|
"@vueuse/core": ["node_modules/@histoire/vendors/vue-use"],
|
|
36
22
|
"vue": ["node_modules/@histoire/vendors/vue"]
|
|
37
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"resolveJsonModule": true,
|
|
25
|
+
"strictBindCallApply": true,
|
|
26
|
+
"strictFunctionTypes": true,
|
|
27
|
+
"alwaysStrict": true,
|
|
28
|
+
// Strict
|
|
29
|
+
"noImplicitAny": false,
|
|
30
|
+
"noImplicitThis": true,
|
|
31
|
+
// Output
|
|
32
|
+
"declaration": true,
|
|
33
|
+
"declarationMap": true,
|
|
34
|
+
"outDir": "dist",
|
|
35
|
+
"removeComments": false,
|
|
36
|
+
"sourceMap": false,
|
|
37
|
+
"allowSyntheticDefaultImports": true,
|
|
38
|
+
"esModuleInterop": true,
|
|
39
|
+
"skipLibCheck": true,
|
|
40
|
+
"preserveWatchOutput": true
|
|
38
41
|
},
|
|
39
42
|
"include": [
|
|
40
43
|
"src"
|