@poveste/plugin-vue 0.13.1 → 0.15.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/README.md +1 -1
- package/dist/bundled/client/app/MountStory.js +3 -3
- package/dist/bundled/client/app/RenderStory.js +15 -9
- package/dist/bundled/client/app/Story.js +56 -43
- package/dist/bundled/client/app/Variant.js +32 -27
- package/dist/bundled/client/app/global-components.js +11 -10
- package/dist/bundled/client/app/host.js +2 -2
- package/dist/bundled/client/app/util.js +31 -26
- package/dist/bundled/client/client.js +4 -4
- package/dist/bundled/client/codegen.js +79 -60
- package/dist/bundled/client/server/Story.js +9 -7
- package/dist/bundled/client/server/Variant.js +1 -0
- package/dist/bundled/client/server/run.js +2 -2
- package/dist/client/app/MountStory.d.ts +3 -3
- package/dist/client/app/RenderStory.d.ts +1 -1
- package/dist/client/app/Story.d.ts +10 -7
- package/dist/client/app/Variant.d.ts +14 -13
- package/dist/client/app/render-context.d.ts +1 -1
- package/dist/client/app/util.d.ts +6 -3
- package/dist/client/codegen.d.ts +29 -0
- package/dist/client/server/Story.d.ts +17 -17
- package/dist/client/server/Variant.d.ts +10 -10
- package/dist/commands/generate-story.client.js +4 -4
- package/dist/commands/generate-story.server.js +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.node.js +2 -0
- package/dist/util/list-components.d.ts +1 -1
- package/dist/util/list-components.js +63 -6
- package/dist/util/list-components.spec.d.ts +1 -0
- package/dist/util/list-components.spec.js +46 -0
- package/package.json +12 -11
- package/src/client/__tests__/codegen-attrs.spec.ts +149 -0
- package/src/client/app/MountStory.ts +5 -1
- package/src/client/app/RenderStory.ts +6 -1
- package/src/client/app/RouterLinkStub.ts +1 -1
- package/src/client/app/Story.ts +78 -37
- package/src/client/app/Variant.ts +26 -23
- package/src/client/app/__tests__/preview-variants.spec.ts +76 -0
- package/src/client/app/auto-props.ts +2 -2
- package/src/client/app/global-components.ts +20 -14
- package/src/client/app/host.ts +9 -6
- package/src/client/app/util.ts +17 -7
- package/src/client/codegen.ts +81 -29
- package/src/client/server/Story.ts +10 -4
- package/src/client/server/Variant.ts +3 -0
- package/src/client/server/run.ts +5 -4
- package/src/commands/generate-story.client.ts +4 -4
- package/src/commands/generate-story.server.ts +2 -2
- package/src/helpers.ts +2 -2
- package/src/index.node.ts +2 -0
- package/src/util/list-components.spec.ts +54 -0
- package/src/util/list-components.ts +68 -6
package/README.md
CHANGED
|
@@ -40,5 +40,5 @@ import MyButton from './MyButton.vue'
|
|
|
40
40
|
Coming from histoire? The Vue API is unchanged: swap the dependency and your existing
|
|
41
41
|
`.story.vue` files keep working.
|
|
42
42
|
|
|
43
|
-
[Vue guide](https://poveste.dev/guide/vue/getting-started
|
|
43
|
+
[Vue guide](https://poveste.dev/guide/vue/getting-started) ·
|
|
44
44
|
[Documentation](https://poveste.dev)
|
|
@@ -22,15 +22,15 @@ var c = t({
|
|
|
22
22
|
targetVariantId: t.targetVariantId,
|
|
23
23
|
externalState: null,
|
|
24
24
|
nextVariantIndex: { value: 0 }
|
|
25
|
-
}), l;
|
|
25
|
+
}), l = null;
|
|
26
26
|
async function u() {
|
|
27
|
-
l = e({
|
|
27
|
+
n.value && (l = e({
|
|
28
28
|
name: "MountStorySubApp",
|
|
29
29
|
el: n.value,
|
|
30
30
|
getStory: () => t.story,
|
|
31
31
|
getVariant: () => null,
|
|
32
32
|
renderContext: c
|
|
33
|
-
}), await l.mount();
|
|
33
|
+
}), await l.mount());
|
|
34
34
|
}
|
|
35
35
|
function d() {
|
|
36
36
|
l?.unmount(), l = null;
|
|
@@ -21,7 +21,7 @@ var l = n({
|
|
|
21
21
|
},
|
|
22
22
|
emits: { ready: () => !0 },
|
|
23
23
|
setup(n, { emit: r }) {
|
|
24
|
-
let l = o(), u, d = !1, f = c({}), p = e(n.variant.state, f), m = c({
|
|
24
|
+
let l = o(), u = null, d = !1, f = c({}), p = e(n.variant.state, f), m = c({
|
|
25
25
|
mode: "render",
|
|
26
26
|
slotName: n.slotName,
|
|
27
27
|
currentVariant: n.variant,
|
|
@@ -35,14 +35,20 @@ var l = n({
|
|
|
35
35
|
p?.stop(), p = e(n.variant.state, f);
|
|
36
36
|
}
|
|
37
37
|
async function _() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
if (!d) {
|
|
39
|
+
if (d = !0, h(), m.currentVariant = n.variant, m.slotName = n.slotName, !l.value) {
|
|
40
|
+
d = !1;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
u = t({
|
|
44
|
+
name: "RenderStorySubApp",
|
|
45
|
+
el: l.value,
|
|
46
|
+
getStory: () => n.story,
|
|
47
|
+
getVariant: () => n.variant,
|
|
48
|
+
renderContext: m,
|
|
49
|
+
wrapInDiv: !0
|
|
50
|
+
}), await u.mount(), d = !1, r("ready");
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
return a(async () => {
|
|
48
54
|
n.variant.configReady && await _();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useRenderContext as e } from "./render-context.js";
|
|
2
|
-
import t from "./
|
|
3
|
-
import
|
|
2
|
+
import { useInstance as t } from "./util.js";
|
|
3
|
+
import n from "./Variant.js";
|
|
4
|
+
import { cloneVNode as r, computed as i, defineComponent as a, h as o, isRef as s, provide as c, reactive as l, useAttrs as u } from "vue";
|
|
4
5
|
import { omitInheritStoryProps as d } from "@poveste/shared";
|
|
5
6
|
//#region src/client/app/Story.ts
|
|
6
|
-
var f =
|
|
7
|
+
var f = a({
|
|
7
8
|
name: "Story",
|
|
8
9
|
__povesteType: "story",
|
|
9
10
|
inheritAttrs: !1,
|
|
@@ -17,10 +18,10 @@ var f = i({
|
|
|
17
18
|
default: void 0
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
|
-
setup(
|
|
21
|
-
let
|
|
21
|
+
setup(n) {
|
|
22
|
+
let a = t("Story"), o = u(), f = e(), p = i(() => o.story);
|
|
22
23
|
c("story", p);
|
|
23
|
-
let m =
|
|
24
|
+
let m = a.parent, h = l({});
|
|
24
25
|
Object.defineProperty(h, "$data", {
|
|
25
26
|
enumerable: !0,
|
|
26
27
|
configurable: !0,
|
|
@@ -49,67 +50,79 @@ var f = i({
|
|
|
49
50
|
for (let e in m.data) g(m.data, e);
|
|
50
51
|
c("implicitState", () => h);
|
|
51
52
|
function _() {
|
|
52
|
-
|
|
53
|
+
n.meta && (o.story.meta || (o.story.meta = {}), Object.assign(o.story.meta, n.meta)), Object.assign(o.story, { slots: () => a.slots });
|
|
53
54
|
}
|
|
54
55
|
return {
|
|
55
56
|
renderContext: f,
|
|
56
57
|
story: p,
|
|
57
|
-
renderMountStory:
|
|
58
|
-
renderPreviewStory:
|
|
58
|
+
renderMountStory: y,
|
|
59
|
+
renderPreviewStory: x,
|
|
59
60
|
updateStory: _
|
|
60
61
|
};
|
|
61
|
-
function v() {
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
function v(e) {
|
|
63
|
+
let t = {};
|
|
64
|
+
for (let n in a.attrs) e.props?.[n] === void 0 && (t[n] = a.attrs[n]);
|
|
65
|
+
for (let n in o.story) !d.includes(n) && e.props?.[n] === void 0 && (t[n] = Reflect.get(o.story, n));
|
|
66
|
+
return t;
|
|
67
|
+
}
|
|
68
|
+
function y() {
|
|
69
|
+
let e = 0, t = f?.targetVariantId, i = t ? o.story.variants.findIndex((e) => e.id === t) : -1, s = (t) => {
|
|
70
|
+
let a = [];
|
|
71
|
+
for (let c of t) {
|
|
72
|
+
if (c.type?.__povesteType === "variant") {
|
|
73
|
+
let t = o.story.variants[e];
|
|
74
|
+
if (e++, !t || i !== -1 && e - 1 !== i) continue;
|
|
75
|
+
let s = { variant: t };
|
|
76
|
+
c.key ?? (s.key = t.id), !c.props?.initState && !c.props?.["init-state"] && (s.initState = n.initState), Object.assign(s, v(c)), a.push(r(c, s));
|
|
73
77
|
continue;
|
|
74
78
|
}
|
|
75
|
-
Array.isArray(
|
|
79
|
+
Array.isArray(c.children) && (c.children = s(c.children)), a.push(c);
|
|
76
80
|
}
|
|
77
|
-
return
|
|
81
|
+
return a;
|
|
78
82
|
};
|
|
79
|
-
return a
|
|
83
|
+
return s(a.slots.default?.() ?? []);
|
|
80
84
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
let e
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
function b(e) {
|
|
86
|
+
let t = 0;
|
|
87
|
+
for (let n of e) n?.type?.__povesteType === "variant" ? t++ : Array.isArray(n?.children) && (t += b(n.children));
|
|
88
|
+
return t;
|
|
89
|
+
}
|
|
90
|
+
function x(e) {
|
|
91
|
+
e.nextVariantIndex.value = 0;
|
|
92
|
+
let t = { state: e.externalState }, n = [];
|
|
93
|
+
e.slotName === "controls" && n.push(...a.slots.controls?.(t) ?? []), (e.slotName === "default" || o.story.meta?.hasVariantChildComponents) && n.push(...a.slots.default?.(t) ?? []);
|
|
94
|
+
let i = e.currentVariant;
|
|
95
|
+
if (e.slotName === "default" && i && b(n) === o.story.variants.length) {
|
|
96
|
+
let t = o.story.variants.findIndex((e) => e.id === i.id);
|
|
97
|
+
if (t !== -1) {
|
|
98
|
+
let i = 0, a = !1, o = (e) => {
|
|
99
|
+
let n = [];
|
|
100
|
+
for (let s of e) {
|
|
101
|
+
if (s?.type?.__povesteType === "variant") {
|
|
102
|
+
i === t && (n.push(r(s, v(s))), a = !0), i++;
|
|
92
103
|
continue;
|
|
93
104
|
}
|
|
94
|
-
Array.isArray(
|
|
105
|
+
Array.isArray(s?.children) && s.children.length && (s.children = o(s.children)), n.push(s);
|
|
95
106
|
}
|
|
96
|
-
return
|
|
97
|
-
},
|
|
98
|
-
if (
|
|
107
|
+
return n;
|
|
108
|
+
}, s = o(n);
|
|
109
|
+
if (a) return e.nextVariantIndex.value = t, s;
|
|
99
110
|
}
|
|
100
111
|
}
|
|
101
|
-
return
|
|
112
|
+
return n;
|
|
102
113
|
}
|
|
103
114
|
},
|
|
104
115
|
render() {
|
|
105
116
|
this.updateStory();
|
|
106
117
|
let [e] = this.story.variants;
|
|
107
|
-
|
|
118
|
+
if (e?.id === "_default") return o(n, {
|
|
108
119
|
variant: e,
|
|
109
|
-
initState: this.initState,
|
|
120
|
+
...this.initState ? { initState: this.initState } : {},
|
|
110
121
|
implicit: !0,
|
|
111
122
|
...this.$attrs
|
|
112
|
-
}, this.$slots)
|
|
123
|
+
}, this.$slots);
|
|
124
|
+
let t = this.renderContext;
|
|
125
|
+
return t?.mode === "render" ? this.renderPreviewStory(t) : this.renderMountStory();
|
|
113
126
|
}
|
|
114
127
|
});
|
|
115
128
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useRenderContext as e } from "./render-context.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { computed as
|
|
2
|
+
import { syncStateBundledAndExternal as t, toRawDeep as n, useInstance as r } from "./util.js";
|
|
3
|
+
import { syncVariantAutoProps as i } from "./auto-props.js";
|
|
4
|
+
import { computed as a, defineComponent as o, inject as s, onBeforeUnmount as c, useAttrs as l } from "vue";
|
|
5
5
|
import { applyState as u, autoPropsStateKeys as d } from "@poveste/shared";
|
|
6
6
|
//#region src/client/app/Variant.ts
|
|
7
|
-
var f =
|
|
7
|
+
var f = o({
|
|
8
8
|
name: "Variant",
|
|
9
9
|
__povesteType: "variant",
|
|
10
10
|
props: {
|
|
@@ -37,41 +37,43 @@ var f = a({
|
|
|
37
37
|
default: !1
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
async setup(
|
|
41
|
-
let f = l(), p =
|
|
40
|
+
async setup(o) {
|
|
41
|
+
let f = l(), p = r("Variant"), m = s("story"), h = s("implicitState"), g = e(), _, v, y = null, b;
|
|
42
42
|
c(() => {
|
|
43
43
|
y?.stop(), b?.stop();
|
|
44
44
|
});
|
|
45
|
-
let x =
|
|
46
|
-
if (g?.mode !== "render" && typeof
|
|
47
|
-
let e = await
|
|
48
|
-
u(x.value.state,
|
|
45
|
+
let x = a(() => f.variant);
|
|
46
|
+
if (g?.mode !== "render" && typeof o.initState == "function" && x.value) {
|
|
47
|
+
let e = await o.initState();
|
|
48
|
+
u(x.value.state, n(e));
|
|
49
49
|
}
|
|
50
|
-
g?.mode !== "render" && x.value && h && (b =
|
|
50
|
+
g?.mode !== "render" && x.value && h && (b = t(x.value.state, h(), d));
|
|
51
51
|
function S(e) {
|
|
52
52
|
Object.assign(e, {
|
|
53
|
-
slots: () => p.
|
|
54
|
-
source:
|
|
55
|
-
responsiveDisabled:
|
|
56
|
-
autoPropsDisabled:
|
|
57
|
-
setupApp:
|
|
58
|
-
meta:
|
|
53
|
+
slots: () => p.slots,
|
|
54
|
+
source: o.source,
|
|
55
|
+
responsiveDisabled: o.responsiveDisabled,
|
|
56
|
+
autoPropsDisabled: o.autoPropsDisabled,
|
|
57
|
+
setupApp: o.setupApp,
|
|
58
|
+
meta: o.meta,
|
|
59
59
|
configReady: !0
|
|
60
|
-
})
|
|
60
|
+
});
|
|
61
|
+
let t = m?.value;
|
|
62
|
+
t && !o.implicit && !t.meta?.hasVariantChildComponents && (t.meta ||= {}, Object.assign(t.meta, { hasVariantChildComponents: !0 }));
|
|
61
63
|
}
|
|
62
64
|
function C() {
|
|
63
|
-
return f.variant ? f.variant : g?.mode === "render" ? (v || (v = m
|
|
65
|
+
return f.variant ? f.variant : g?.mode === "render" ? (v || (v = m?.value?.variants[g.nextVariantIndex.value], g.nextVariantIndex.value++), v) : null;
|
|
64
66
|
}
|
|
65
|
-
function w(e) {
|
|
66
|
-
if (
|
|
67
|
-
if (
|
|
68
|
-
let n = p.
|
|
69
|
-
return n && !e.autoPropsDisabled && (_ =
|
|
67
|
+
function w(e, t) {
|
|
68
|
+
if (t.slotName === "controls") return p.slots.controls?.({ state: t.externalState }) ?? null;
|
|
69
|
+
if (t.slotName !== "default") return null;
|
|
70
|
+
let n = p.slots.default?.({ state: t.externalState }) ?? null;
|
|
71
|
+
return n && !e.autoPropsDisabled && (_ = i(e, n, t.externalState, _)), n;
|
|
70
72
|
}
|
|
71
73
|
function T(e) {
|
|
72
74
|
if (!h) return;
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
+
let n = g?.mode === "render" && g.currentVariant?.id === e.id;
|
|
76
|
+
n && !y ? y = t(e.state, h(), d) : !n && y && (y.stop(), y = null);
|
|
75
77
|
}
|
|
76
78
|
return x.value && S(x.value), {
|
|
77
79
|
renderContext: g,
|
|
@@ -83,7 +85,10 @@ var f = a({
|
|
|
83
85
|
},
|
|
84
86
|
render() {
|
|
85
87
|
let e = this.resolveVariant();
|
|
86
|
-
|
|
88
|
+
if (!e) return null;
|
|
89
|
+
this.updateVariant(e), this.syncRenderVariantState(e);
|
|
90
|
+
let t = this.renderContext;
|
|
91
|
+
return t?.mode !== "render" || t.currentVariant?.id !== e.id ? null : this.renderVariantSlot(e, t);
|
|
87
92
|
}
|
|
88
93
|
});
|
|
89
94
|
//#endregion
|
|
@@ -6,13 +6,14 @@ import { components as f } from "@poveste/controls";
|
|
|
6
6
|
//#region src/client/app/global-components.ts
|
|
7
7
|
function p(n) {
|
|
8
8
|
n.component("Story", t), n.component("Variant", e);
|
|
9
|
-
for (let e
|
|
9
|
+
for (let [e, t] of Object.entries(f)) n.component(e, m(t));
|
|
10
10
|
}
|
|
11
11
|
function m(e) {
|
|
12
|
+
let t = e;
|
|
12
13
|
return a({
|
|
13
|
-
name: e.name,
|
|
14
|
+
...e.name ? { name: e.name } : {},
|
|
14
15
|
inheritAttrs: !1,
|
|
15
|
-
setup(
|
|
16
|
+
setup(e, { attrs: a }) {
|
|
16
17
|
let o = d(), f = d(), p = i({});
|
|
17
18
|
function m(e) {
|
|
18
19
|
Object.assign(p, e);
|
|
@@ -23,11 +24,11 @@ function m(e) {
|
|
|
23
24
|
let h = [], g = d([]);
|
|
24
25
|
function _() {
|
|
25
26
|
g.value.forEach((e, t) => {
|
|
26
|
-
let n = f.value
|
|
27
|
-
if (!n)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
let n = f.value?.querySelector(`[renderslotid="${t}"]`), r = o.value?.querySelector(`[slotid="${t}"]`);
|
|
28
|
+
if (!(!n || !r)) {
|
|
29
|
+
for (; r.lastChild;) r.removeChild(r.lastChild);
|
|
30
|
+
r.appendChild(n);
|
|
31
|
+
}
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
let v;
|
|
@@ -40,7 +41,7 @@ function m(e) {
|
|
|
40
41
|
g.value = h, h = [];
|
|
41
42
|
},
|
|
42
43
|
render() {
|
|
43
|
-
return r(
|
|
44
|
+
return r(t, {
|
|
44
45
|
...p,
|
|
45
46
|
key: "component"
|
|
46
47
|
}, { default: (e) => (h.push(e), r("div", { slotId: h.length - 1 })) });
|
|
@@ -57,7 +58,7 @@ function m(e) {
|
|
|
57
58
|
};
|
|
58
59
|
},
|
|
59
60
|
render() {
|
|
60
|
-
return [o("div", { ref: "el" }), o("div", { ref: "slotEl" }, this.slotCalls.map((e, t) => o("div", { renderSlotId: t }, this.$slots.default(e))))];
|
|
61
|
+
return [o("div", { ref: "el" }), o("div", { ref: "slotEl" }, this.slotCalls.map((e, t) => o("div", { renderSlotId: t }, this.$slots.default?.(e))))];
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
}
|
|
@@ -20,7 +20,7 @@ var f = o({
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
setup(e) {
|
|
23
|
-
return t(e.renderContext), () => s(e.story.file.component, { story: e.story });
|
|
23
|
+
return t(e.renderContext), () => e.story.file ? s(e.story.file.component, { story: e.story }) : null;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
function p(e) {
|
|
@@ -51,7 +51,7 @@ function p(e) {
|
|
|
51
51
|
}, n(t), t.component("RouterLink", r), await m({
|
|
52
52
|
app: t,
|
|
53
53
|
story: e.getStory(),
|
|
54
|
-
variant: e.getVariant(),
|
|
54
|
+
variant: e.getVariant() ?? void 0,
|
|
55
55
|
addWrapper: (e) => {
|
|
56
56
|
c.unshift(e);
|
|
57
57
|
}
|
|
@@ -1,71 +1,76 @@
|
|
|
1
1
|
import { isRef as e, unref as t, watch as n } from "@poveste/vendors/vue";
|
|
2
|
-
import {
|
|
3
|
-
import { applyState as
|
|
2
|
+
import { getCurrentInstance as r, isRef as i, unref as a, watch as o } from "vue";
|
|
3
|
+
import { applyState as s, createStateBaseline as c } from "@poveste/shared";
|
|
4
4
|
//#region src/client/app/util.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
let n =
|
|
5
|
+
var l = (e) => typeof e == "object" && !!e;
|
|
6
|
+
function u(e, t = /* @__PURE__ */ new WeakMap()) {
|
|
7
|
+
let n = i(e) ? a(e) : e;
|
|
8
8
|
if (typeof n == "symbol") return n.toString();
|
|
9
|
-
if (!
|
|
9
|
+
if (!l(n)) return n;
|
|
10
10
|
if (t.has(n)) return t.get(n);
|
|
11
11
|
if (Array.isArray(n)) {
|
|
12
12
|
let e = [];
|
|
13
|
-
return t.set(n, e), e.push(...n.map((e) =>
|
|
13
|
+
return t.set(n, e), e.push(...n.map((e) => u(e, t))), e;
|
|
14
14
|
}
|
|
15
15
|
{
|
|
16
16
|
let e = {};
|
|
17
|
-
return t.set(n, e),
|
|
17
|
+
return t.set(n, e), d(n, e, t), e;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function d(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
21
21
|
Object.keys(e).forEach((r) => {
|
|
22
|
-
t[r] =
|
|
22
|
+
t[r] = u(e[r], n);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function f(n, r = /* @__PURE__ */ new WeakMap()) {
|
|
26
26
|
let i = e(n) ? t(n) : n;
|
|
27
27
|
if (typeof i == "symbol") return i.toString();
|
|
28
|
-
if (!
|
|
28
|
+
if (!l(i)) return i;
|
|
29
29
|
if (r.has(i)) return r.get(i);
|
|
30
30
|
if (Array.isArray(i)) {
|
|
31
31
|
let e = [];
|
|
32
|
-
return r.set(i, e), e.push(...i.map((e) =>
|
|
32
|
+
return r.set(i, e), e.push(...i.map((e) => f(e, r))), e;
|
|
33
33
|
}
|
|
34
34
|
{
|
|
35
35
|
let e = {};
|
|
36
|
-
return r.set(i, e),
|
|
36
|
+
return r.set(i, e), p(i, e, r), e;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function p(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
40
40
|
Object.keys(e).forEach((r) => {
|
|
41
|
-
t[r] =
|
|
41
|
+
t[r] = u(e[r], n);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function m(e, t) {
|
|
45
45
|
if (!t.length) return e;
|
|
46
46
|
let n = { ...e };
|
|
47
47
|
for (let e of t) delete n[e];
|
|
48
48
|
return n;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
let i =
|
|
50
|
+
function h(e, t, r = []) {
|
|
51
|
+
let i = c(), a = n(() => e, (e) => {
|
|
52
52
|
if (e == null) return;
|
|
53
|
-
let n = i.take(
|
|
54
|
-
n &&
|
|
53
|
+
let n = i.take(m(f(e), r));
|
|
54
|
+
n && s(t, n);
|
|
55
55
|
}, {
|
|
56
56
|
deep: !0,
|
|
57
57
|
immediate: !0
|
|
58
|
-
}),
|
|
58
|
+
}), l = o(() => t, (t) => {
|
|
59
59
|
if (t == null) return;
|
|
60
|
-
let n = i.take(
|
|
61
|
-
n &&
|
|
60
|
+
let n = i.take(m(u(t), r));
|
|
61
|
+
n && s(e, n);
|
|
62
62
|
}, {
|
|
63
63
|
deep: !0,
|
|
64
64
|
immediate: !0
|
|
65
65
|
});
|
|
66
66
|
return { stop() {
|
|
67
|
-
|
|
67
|
+
a(), l();
|
|
68
68
|
} };
|
|
69
69
|
}
|
|
70
|
+
function g(e) {
|
|
71
|
+
let t = r();
|
|
72
|
+
if (!t) throw Error(`[poveste] <${e}> can only be set up inside a component`);
|
|
73
|
+
return t;
|
|
74
|
+
}
|
|
70
75
|
//#endregion
|
|
71
|
-
export {
|
|
76
|
+
export { f as _toRawDeep, h as syncStateBundledAndExternal, u as toRawDeep, g as useInstance };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { delimitAttr as e, generateSourceCode as t, getTagName as n } from "./codegen.js";
|
|
2
|
+
import r from "./app/MountStory.js";
|
|
3
|
+
import i from "./app/RenderStory.js";
|
|
4
4
|
import "./app/index.js";
|
|
5
|
-
export {
|
|
5
|
+
export { r as MountStory, i as RenderStory, e as delimitAttr, t as generateSourceCode, n as getTagName };
|