@pyreon/storybook 0.6.0 → 0.7.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/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/preset.d.ts +16 -14
- package/lib/types/preset.d.ts.map +1 -1
- package/lib/types/preview.d.ts +36 -100
- package/lib/types/preview.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/types/preset2.d.ts +0 -19
- package/lib/types/preset2.d.ts.map +0 -1
- package/lib/types/preview2.d.ts +0 -45
- package/lib/types/preview2.d.ts.map +0 -1
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { mount } from "@pyreon/runtime-dom";
|
|
2
1
|
import { ComponentFn, ComponentFn as ComponentFn$1, Fragment, Props, Props as Props$1, VNode, VNodeChild, VNodeChild as VNodeChild$1, h } from "@pyreon/core";
|
|
3
2
|
import { computed, effect, signal } from "@pyreon/reactivity";
|
|
3
|
+
import { mount } from "@pyreon/runtime-dom";
|
|
4
4
|
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
/**
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.d.ts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../../src/types.ts","../../../src/render-impl.tsx"],"mappings":";;;;;;;;;UAQiB,cAAA;EACf,SAAA,EAAW,aAAA;EACX,WAAA,EAAa,YAAA;EACb,aAAA,EAAe,WAAA;AAAA;;KAML,UAAA,MAAgB,CAAA,SAAU,aAAA,YAAuB,CAAA,GAAI,OAAA;AAAA,UAIhD,YAAA,SAAqB,OAAA;EACpC,IAAA,EAAM,KAAA;EACN,QAAA,EAAU,MAAA;EACV,OAAA,EAAS,MAAA;EACT,EAAA;EACA,IAAA;EACA,IAAA;EACA,QAAA;AAAA;AAAA,KAGU,OAAA,SAAg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A,WAAkB,OAAA;EAAA,MAC7C,OAAA;AAAA;;KAIH,QAAA,UAAkB,KAAA,SAAc,IAAA,YAAgB,UAAA,CAAW,CAAA,IAAK,OAAA;;;;;;;AA7FrE;;;;;;;;iBCYgB,cAAA,CAAA;EAEZ,OAAA;EACA,QAAA;EACA;AAAA;EAEA,OAAA,QAAe,YAAA;EACf,YAAA;IACE,SAAA,GAAY,aAAA;IACZ,IAAA,EAAM,MAAA;IAAA,CACL,GAAA;EAAA;EAEH,QAAA;EACA,SAAA,GAAY,KAAA;IAAS,KAAA;IAAe,WAAA;EAAA;EACpC,YAAA;AAAA,GAEF,aAAA,EAAe,WAAA;;;;iBA0BD,aAAA,CACd,SAAA,EAAW,aAAA,OACX,IAAA,EAAM,MAAA,oBACL,YAAA"}
|
package/lib/types/preset.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//#region src/preset.ts
|
|
1
|
+
//#region src/preset.d.ts
|
|
4
2
|
/**
|
|
5
|
-
* Storybook preset for @pyreon/storybook.
|
|
6
|
-
*
|
|
7
|
-
* This file is loaded by Storybook's server when the user sets
|
|
8
|
-
* `framework: "@pyreon/storybook"` in their `.storybook/main.ts`.
|
|
9
|
-
*
|
|
10
|
-
* It tells Storybook:
|
|
11
|
-
* - Which renderer to use (via the preview entry)
|
|
12
|
-
* - What framework name to report
|
|
13
|
-
*/
|
|
14
|
-
|
|
3
|
+
* Storybook preset for @pyreon/storybook.
|
|
4
|
+
*
|
|
5
|
+
* This file is loaded by Storybook's server when the user sets
|
|
6
|
+
* `framework: "@pyreon/storybook"` in their `.storybook/main.ts`.
|
|
7
|
+
*
|
|
8
|
+
* It tells Storybook:
|
|
9
|
+
* - Which renderer to use (via the preview entry)
|
|
10
|
+
* - What framework name to report
|
|
11
|
+
*/
|
|
12
|
+
declare const addons: string[];
|
|
13
|
+
declare const previewAnnotations: string[];
|
|
14
|
+
declare const core: {
|
|
15
|
+
renderer: string;
|
|
16
|
+
};
|
|
15
17
|
//#endregion
|
|
16
18
|
export { addons, core, previewAnnotations };
|
|
17
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=preset2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"preset2.d.ts","names":[],"sources":["../../../src/preset.ts"],"mappings":";;AAiBA;;;;;AAEA;;;;cAFa,MAAA;AAAA,cAEA,kBAAA;AAAA,cAEA,IAAA;EAEZ,QAAA;AAAA"}
|
package/lib/types/preview.d.ts
CHANGED
|
@@ -1,109 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentFn, VNodeChild } from "@pyreon/core";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region src/render-impl.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
children: normalizeChildren(children),
|
|
18
|
-
key: props?.key ?? null
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function normalizeChildren(children) {
|
|
22
|
-
for (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);
|
|
23
|
-
return children;
|
|
24
|
-
}
|
|
25
|
-
function flattenChildren(children) {
|
|
26
|
-
const result = [];
|
|
27
|
-
for (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));else result.push(child);
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* JSX automatic runtime.
|
|
32
|
-
*
|
|
33
|
-
* When tsconfig has `"jsxImportSource": "@pyreon/core"`, the TS/bundler compiler
|
|
34
|
-
* rewrites JSX to imports from this file automatically:
|
|
35
|
-
* <div class="x" /> → jsx("div", { class: "x" })
|
|
36
|
-
*/
|
|
37
|
-
function jsx(type, props, key) {
|
|
38
|
-
const {
|
|
39
|
-
children,
|
|
40
|
-
...rest
|
|
41
|
-
} = props;
|
|
42
|
-
const propsWithKey = key != null ? {
|
|
43
|
-
...rest,
|
|
44
|
-
key
|
|
45
|
-
} : rest;
|
|
46
|
-
if (typeof type === "function") return h(type, children !== void 0 ? {
|
|
47
|
-
...propsWithKey,
|
|
48
|
-
children
|
|
49
|
-
} : propsWithKey);
|
|
50
|
-
return h(type, propsWithKey, ...(children === void 0 ? [] : Array.isArray(children) ? children : [children]));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/render-impl.tsx
|
|
55
|
-
/**
|
|
56
|
-
* State tracked per canvas element so we can clean up between renders.
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Render a Pyreon story into a Storybook canvas element.
|
|
61
|
-
*
|
|
62
|
-
* This is the core integration point — Storybook calls this function
|
|
63
|
-
* every time a story needs to be displayed or re-rendered (e.g. when
|
|
64
|
-
* the user changes args via the Controls panel).
|
|
65
|
-
*
|
|
66
|
-
* It handles:
|
|
67
|
-
* 1. Cleaning up the previous mount (disposing effects, removing DOM)
|
|
68
|
-
* 2. Building the VNode from the story function or component + args
|
|
69
|
-
* 3. Mounting the new VNode into the canvas
|
|
70
|
-
*/
|
|
71
|
-
function renderToCanvas({
|
|
5
|
+
* Render a Pyreon story into a Storybook canvas element.
|
|
6
|
+
*
|
|
7
|
+
* This is the core integration point — Storybook calls this function
|
|
8
|
+
* every time a story needs to be displayed or re-rendered (e.g. when
|
|
9
|
+
* the user changes args via the Controls panel).
|
|
10
|
+
*
|
|
11
|
+
* It handles:
|
|
12
|
+
* 1. Cleaning up the previous mount (disposing effects, removing DOM)
|
|
13
|
+
* 2. Building the VNode from the story function or component + args
|
|
14
|
+
* 3. Mounting the new VNode into the canvas
|
|
15
|
+
*/
|
|
16
|
+
declare function renderToCanvas({
|
|
72
17
|
storyFn,
|
|
73
18
|
showMain,
|
|
74
19
|
showError
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
20
|
+
}: {
|
|
21
|
+
storyFn: () => VNodeChild;
|
|
22
|
+
storyContext: {
|
|
23
|
+
component?: ComponentFn<any>;
|
|
24
|
+
args: Record<string, unknown>;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
};
|
|
27
|
+
showMain: () => void;
|
|
28
|
+
showError: (error: {
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}) => void;
|
|
32
|
+
forceRemount: boolean;
|
|
33
|
+
}, canvasElement: HTMLElement): void;
|
|
93
34
|
//#endregion
|
|
94
|
-
//#region src/preview-impl.
|
|
35
|
+
//#region src/preview-impl.d.ts
|
|
95
36
|
/**
|
|
96
|
-
* Default render function — if the story CSF has a `component` but no
|
|
97
|
-
* explicit `render`, this is used to create the VNode.
|
|
98
|
-
*/
|
|
99
|
-
function render(args, context
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return /* @__PURE__ */jsx(Component, {
|
|
103
|
-
...args
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
37
|
+
* Default render function — if the story CSF has a `component` but no
|
|
38
|
+
* explicit `render`, this is used to create the VNode.
|
|
39
|
+
*/
|
|
40
|
+
declare function render<TArgs extends Record<string, unknown>>(args: TArgs, context: {
|
|
41
|
+
component?: ComponentFn<any>;
|
|
42
|
+
}): VNodeChild;
|
|
107
43
|
//#endregion
|
|
108
44
|
export { render, renderToCanvas };
|
|
109
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=preview2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"preview2.d.ts","names":[],"sources":["../../../src/render-impl.tsx","../../../src/preview-impl.tsx"],"mappings":";;;;;AAoBA;;;;;;;;;;iBAAgB,cAAA,CAAA;EAEZ,OAAA;EACA,QAAA;EACA;AAAA;EAEA,OAAA,QAAe,UAAA;EACf,YAAA;IACE,SAAA,GAAY,WAAA;IACZ,IAAA,EAAM,MAAA;IAAA,CACL,GAAA;EAAA;EAEH,QAAA;EACA,SAAA,GAAY,KAAA;IAAS,KAAA;IAAe,WAAA;EAAA;EACpC,YAAA;AAAA,GAEF,aAAA,EAAe,WAAA;;;;;;;iBCpBD,MAAA,eAAqB,MAAA,kBAAA,CACnC,IAAA,EAAM,KAAA,EACN,OAAA;EAAW,SAAA,GAAY,WAAA;AAAA,IACtB,UAAA"}
|
package/package.json
CHANGED
package/lib/types/preset2.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/preset.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Storybook preset for @pyreon/storybook.
|
|
4
|
-
*
|
|
5
|
-
* This file is loaded by Storybook's server when the user sets
|
|
6
|
-
* `framework: "@pyreon/storybook"` in their `.storybook/main.ts`.
|
|
7
|
-
*
|
|
8
|
-
* It tells Storybook:
|
|
9
|
-
* - Which renderer to use (via the preview entry)
|
|
10
|
-
* - What framework name to report
|
|
11
|
-
*/
|
|
12
|
-
declare const addons: string[];
|
|
13
|
-
declare const previewAnnotations: string[];
|
|
14
|
-
declare const core: {
|
|
15
|
-
renderer: string;
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { addons, core, previewAnnotations };
|
|
19
|
-
//# sourceMappingURL=preset2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preset2.d.ts","names":[],"sources":["../../src/preset.ts"],"mappings":";;AAiBA;;;;;AAEA;;;;cAFa,MAAA;AAAA,cAEA,kBAAA;AAAA,cAEA,IAAA;EAEZ,QAAA;AAAA"}
|
package/lib/types/preview2.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ComponentFn, VNodeChild } from "@pyreon/core";
|
|
2
|
-
|
|
3
|
-
//#region src/render-impl.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Render a Pyreon story into a Storybook canvas element.
|
|
6
|
-
*
|
|
7
|
-
* This is the core integration point — Storybook calls this function
|
|
8
|
-
* every time a story needs to be displayed or re-rendered (e.g. when
|
|
9
|
-
* the user changes args via the Controls panel).
|
|
10
|
-
*
|
|
11
|
-
* It handles:
|
|
12
|
-
* 1. Cleaning up the previous mount (disposing effects, removing DOM)
|
|
13
|
-
* 2. Building the VNode from the story function or component + args
|
|
14
|
-
* 3. Mounting the new VNode into the canvas
|
|
15
|
-
*/
|
|
16
|
-
declare function renderToCanvas({
|
|
17
|
-
storyFn,
|
|
18
|
-
showMain,
|
|
19
|
-
showError
|
|
20
|
-
}: {
|
|
21
|
-
storyFn: () => VNodeChild;
|
|
22
|
-
storyContext: {
|
|
23
|
-
component?: ComponentFn<any>;
|
|
24
|
-
args: Record<string, unknown>;
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
};
|
|
27
|
-
showMain: () => void;
|
|
28
|
-
showError: (error: {
|
|
29
|
-
title: string;
|
|
30
|
-
description: string;
|
|
31
|
-
}) => void;
|
|
32
|
-
forceRemount: boolean;
|
|
33
|
-
}, canvasElement: HTMLElement): void;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/preview-impl.d.ts
|
|
36
|
-
/**
|
|
37
|
-
* Default render function — if the story CSF has a `component` but no
|
|
38
|
-
* explicit `render`, this is used to create the VNode.
|
|
39
|
-
*/
|
|
40
|
-
declare function render<TArgs extends Record<string, unknown>>(args: TArgs, context: {
|
|
41
|
-
component?: ComponentFn<any>;
|
|
42
|
-
}): VNodeChild;
|
|
43
|
-
//#endregion
|
|
44
|
-
export { render, renderToCanvas };
|
|
45
|
-
//# sourceMappingURL=preview2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preview2.d.ts","names":[],"sources":["../../src/render-impl.tsx","../../src/preview-impl.tsx"],"mappings":";;;;;AAoBA;;;;;;;;;;iBAAgB,cAAA,CAAA;EAEZ,OAAA;EACA,QAAA;EACA;AAAA;EAEA,OAAA,QAAe,UAAA;EACf,YAAA;IACE,SAAA,GAAY,WAAA;IACZ,IAAA,EAAM,MAAA;IAAA,CACL,GAAA;EAAA;EAEH,QAAA;EACA,SAAA,GAAY,KAAA;IAAS,KAAA;IAAe,WAAA;EAAA;EACpC,YAAA;AAAA,GAEF,aAAA,EAAe,WAAA;;;;;;;iBCpBD,MAAA,eAAqB,MAAA,kBAAA,CACnC,IAAA,EAAM,KAAA,EACN,OAAA;EAAW,SAAA,GAAY,WAAA;AAAA,IACtB,UAAA"}
|