@vue-jsx-vapor/runtime 3.1.7 → 3.1.10
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/h.cjs +5 -7
- package/dist/h.d.cts +8 -8
- package/dist/h.d.ts +8 -8
- package/dist/h.js +1 -3
- package/dist/index.cjs +14 -18
- package/dist/index.d.cts +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.js +4 -7
- package/dist/jsx.d.cts +2 -2
- package/dist/jsx.d.ts +2 -2
- package/dist/{helpers-CjCn59Dr.cjs → props-DyKlXDej.cjs} +1 -1
- package/dist/props.cjs +5 -0
- package/dist/{helpers.d.ts → props.d.cts} +5 -6
- package/dist/{helpers.d.cts → props.d.ts} +5 -6
- package/dist/{helpers-CTg3GxNb.js → props.js} +4 -4
- package/dist/raw.cjs +28 -0
- package/dist/raw.d.cts +9 -0
- package/dist/raw.d.ts +9 -0
- package/dist/raw.js +22 -0
- package/dist/{node.cjs → vapor.cjs} +55 -5
- package/dist/vapor.d.cts +16 -0
- package/dist/vapor.d.ts +16 -0
- package/dist/vapor.js +121 -0
- package/dist/vdom.cjs +30 -0
- package/dist/{vnode.d.cts → vdom.d.cts} +1 -1
- package/dist/{vnode.d.ts → vdom.d.ts} +1 -1
- package/dist/vdom.js +28 -0
- package/package.json +7 -1
- package/dist/block.cjs +0 -17
- package/dist/block.d.cts +0 -10
- package/dist/block.d.ts +0 -10
- package/dist/block.js +0 -15
- package/dist/component.cjs +0 -46
- package/dist/component.d.cts +0 -9
- package/dist/component.d.ts +0 -9
- package/dist/component.js +0 -45
- package/dist/helpers.cjs +0 -5
- package/dist/helpers.js +0 -3
- package/dist/node.d.cts +0 -7
- package/dist/node.d.ts +0 -7
- package/dist/node.js +0 -75
- package/dist/vnode.cjs +0 -30
- package/dist/vnode.js +0 -28
- package/dist/vue.cjs +0 -14
- package/dist/vue.d.cts +0 -134
- package/dist/vue.d.ts +0 -134
- package/dist/vue.js +0 -13
package/dist/vapor.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { EffectScope, Fragment, VaporFragment, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1, createTextNode, currentInstance, getCurrentInstance, insert, isFragment, isVaporComponent, remove, renderEffect } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/vapor.ts
|
|
4
|
+
const createComponent = (type, ...args) => {
|
|
5
|
+
return createProxyComponent(createComponent$1, type, ...args);
|
|
6
|
+
};
|
|
7
|
+
const createComponentWithFallback = (type, ...args) => {
|
|
8
|
+
const slots = args[1];
|
|
9
|
+
if (typeof type === "string" && slots && slots.default && typeof slots.default === "function") {
|
|
10
|
+
const defaultSlot = slots.default;
|
|
11
|
+
slots.default = () => {
|
|
12
|
+
return createProxyComponent(createComponentWithFallback$1, defaultSlot, null, null);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return createProxyComponent(createComponentWithFallback$1, type, ...args);
|
|
16
|
+
};
|
|
17
|
+
const createProxyComponent = (createComponent$2, type, props, ...args) => {
|
|
18
|
+
if (type === Fragment) {
|
|
19
|
+
type = (_, { slots }) => slots.default ? slots.default() : [];
|
|
20
|
+
props = null;
|
|
21
|
+
}
|
|
22
|
+
const i = currentInstance || getCurrentInstance();
|
|
23
|
+
if (!type.__proxyed) {
|
|
24
|
+
if (typeof type === "function") type = new Proxy(type, {
|
|
25
|
+
apply(target, ctx, args$1) {
|
|
26
|
+
if (typeof target.__setup === "function") target.__setup.apply(ctx, args$1);
|
|
27
|
+
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
28
|
+
},
|
|
29
|
+
get(target, p, receiver) {
|
|
30
|
+
if ((i && i.appContext).vapor && p === "__vapor") return true;
|
|
31
|
+
return Reflect.get(target, p, receiver);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args$1) {
|
|
35
|
+
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
36
|
+
} });
|
|
37
|
+
type.__proxyed = true;
|
|
38
|
+
}
|
|
39
|
+
return createComponent$2(type, props, ...args);
|
|
40
|
+
};
|
|
41
|
+
function normalizeNode(node) {
|
|
42
|
+
if (node == null || typeof node === "boolean") return document.createComment("");
|
|
43
|
+
else if (Array.isArray(node) && node.length) return node.map(normalizeNode);
|
|
44
|
+
else if (isBlock(node)) return node;
|
|
45
|
+
else return createTextNode(String(node));
|
|
46
|
+
}
|
|
47
|
+
function isBlock(val) {
|
|
48
|
+
return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);
|
|
49
|
+
}
|
|
50
|
+
function createFragment(nodes, anchor = document.createTextNode("")) {
|
|
51
|
+
const frag = new VaporFragment(nodes);
|
|
52
|
+
frag.anchor = anchor;
|
|
53
|
+
return frag;
|
|
54
|
+
}
|
|
55
|
+
function normalizeBlock(node, anchor) {
|
|
56
|
+
if (node instanceof Node || isFragment(node)) {
|
|
57
|
+
anchor && (anchor.textContent = "");
|
|
58
|
+
return node;
|
|
59
|
+
} else if (isVaporComponent(node)) {
|
|
60
|
+
anchor && (anchor.textContent = "");
|
|
61
|
+
return createFragment(node, anchor);
|
|
62
|
+
} else if (Array.isArray(node)) {
|
|
63
|
+
anchor && (anchor.textContent = "");
|
|
64
|
+
return createFragment(node.map((i) => normalizeBlock(i)), anchor);
|
|
65
|
+
} else {
|
|
66
|
+
const result = node == null || typeof node === "boolean" ? "" : String(node);
|
|
67
|
+
if (anchor) {
|
|
68
|
+
anchor.textContent = result;
|
|
69
|
+
return anchor;
|
|
70
|
+
} else return document.createTextNode(result);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function resolveValue(current, value, _anchor) {
|
|
74
|
+
const node = normalizeBlock(value, _anchor);
|
|
75
|
+
if (current) {
|
|
76
|
+
if (isFragment(current)) {
|
|
77
|
+
const { anchor } = current;
|
|
78
|
+
if (anchor && anchor.parentNode) {
|
|
79
|
+
remove(current.nodes, anchor.parentNode);
|
|
80
|
+
insert(node, anchor.parentNode, anchor);
|
|
81
|
+
!_anchor && anchor.parentNode.removeChild(anchor);
|
|
82
|
+
}
|
|
83
|
+
} else if (current instanceof Node) {
|
|
84
|
+
if (isFragment(node) && current.parentNode) {
|
|
85
|
+
insert(node, current.parentNode, current);
|
|
86
|
+
current.parentNode.removeChild(current);
|
|
87
|
+
} else if (node instanceof Node) {
|
|
88
|
+
if (current.nodeType === 3 && node.nodeType === 3) {
|
|
89
|
+
current.textContent = node.textContent;
|
|
90
|
+
return current;
|
|
91
|
+
} else if (current.parentNode) current.parentNode.replaceChild(node, current);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return node;
|
|
96
|
+
}
|
|
97
|
+
function resolveValues(values = [], _anchor) {
|
|
98
|
+
const nodes = [];
|
|
99
|
+
const frag = createFragment(nodes, _anchor);
|
|
100
|
+
const scopes = [];
|
|
101
|
+
for (const [index, value] of values.entries()) {
|
|
102
|
+
const anchor = index === values.length - 1 ? _anchor : void 0;
|
|
103
|
+
if (typeof value === "function") renderEffect(() => {
|
|
104
|
+
if (scopes[index]) scopes[index].stop();
|
|
105
|
+
scopes[index] = new EffectScope();
|
|
106
|
+
nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor));
|
|
107
|
+
});
|
|
108
|
+
else nodes[index] = resolveValue(nodes[index], value, anchor);
|
|
109
|
+
}
|
|
110
|
+
return frag;
|
|
111
|
+
}
|
|
112
|
+
function setNodes(anchor, ...values) {
|
|
113
|
+
const resolvedValues = resolveValues(values, anchor);
|
|
114
|
+
anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);
|
|
115
|
+
}
|
|
116
|
+
function createNodes(...values) {
|
|
117
|
+
return resolveValues(values);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
export { createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes };
|
package/dist/vdom.cjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_props = require('./props-DyKlXDej.cjs');
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
|
|
4
|
+
//#region src/vdom.ts
|
|
5
|
+
const cacheMap = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
function createVNodeCache(index) {
|
|
7
|
+
const i = (0, vue.getCurrentInstance)();
|
|
8
|
+
if (i) {
|
|
9
|
+
!cacheMap.has(i) && cacheMap.set(i, []);
|
|
10
|
+
const caches = cacheMap.get(i);
|
|
11
|
+
return caches[index] || (caches[index] = []);
|
|
12
|
+
} else return [];
|
|
13
|
+
}
|
|
14
|
+
function normalizeVNode(value = " ", flag = 1) {
|
|
15
|
+
let create = vue.createVNode;
|
|
16
|
+
const isFunction = typeof value === "function";
|
|
17
|
+
if (isFunction) {
|
|
18
|
+
(0, vue.openBlock)();
|
|
19
|
+
create = vue.createBlock;
|
|
20
|
+
value = value();
|
|
21
|
+
}
|
|
22
|
+
return (0, vue.isVNode)(value) ? isFunction ? (0, vue.createBlock)(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? create(vue.Fragment, null, value.map((n) => normalizeVNode(n))) : create(vue.Text, null, value == null || typeof value === "boolean" ? "" : String(value), flag);
|
|
23
|
+
}
|
|
24
|
+
function cloneIfMounted(child) {
|
|
25
|
+
return child.el === null && child.patchFlag !== -1 || child.memo ? child : (0, vue.cloneVNode)(child);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.createVNodeCache = createVNodeCache;
|
|
30
|
+
exports.normalizeVNode = normalizeVNode;
|
package/dist/vdom.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Fragment, Text, cloneVNode, createBlock, createVNode, getCurrentInstance, isVNode, openBlock } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/vdom.ts
|
|
4
|
+
const cacheMap = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function createVNodeCache(index) {
|
|
6
|
+
const i = getCurrentInstance();
|
|
7
|
+
if (i) {
|
|
8
|
+
!cacheMap.has(i) && cacheMap.set(i, []);
|
|
9
|
+
const caches = cacheMap.get(i);
|
|
10
|
+
return caches[index] || (caches[index] = []);
|
|
11
|
+
} else return [];
|
|
12
|
+
}
|
|
13
|
+
function normalizeVNode(value = " ", flag = 1) {
|
|
14
|
+
let create = createVNode;
|
|
15
|
+
const isFunction = typeof value === "function";
|
|
16
|
+
if (isFunction) {
|
|
17
|
+
openBlock();
|
|
18
|
+
create = createBlock;
|
|
19
|
+
value = value();
|
|
20
|
+
}
|
|
21
|
+
return isVNode(value) ? isFunction ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? create(Fragment, null, value.map((n) => normalizeVNode(n))) : create(Text, null, value == null || typeof value === "boolean" ? "" : String(value), flag);
|
|
22
|
+
}
|
|
23
|
+
function cloneIfMounted(child) {
|
|
24
|
+
return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { createVNodeCache, normalizeVNode };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-jsx-vapor/runtime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.10",
|
|
5
5
|
"description": "Vue JSX Vapor Runtime",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",
|
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
"require": "./dist/index.cjs",
|
|
26
26
|
"import": "./dist/index.js"
|
|
27
27
|
},
|
|
28
|
+
"./raw": {
|
|
29
|
+
"types": "./dist/raw.d.ts",
|
|
30
|
+
"jsx-vapor-dev": "./src/raw.ts",
|
|
31
|
+
"require": "./dist/raw.cjs",
|
|
32
|
+
"import": "./dist/raw.js"
|
|
33
|
+
},
|
|
28
34
|
"./*": "./*"
|
|
29
35
|
},
|
|
30
36
|
"main": "dist/index.cjs",
|
package/dist/block.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const require_helpers = require('./helpers-CjCn59Dr.cjs');
|
|
2
|
-
let vue = require("vue");
|
|
3
|
-
|
|
4
|
-
//#region src/block.ts
|
|
5
|
-
function normalizeNode(node) {
|
|
6
|
-
if (node == null || typeof node === "boolean") return document.createComment("");
|
|
7
|
-
else if (Array.isArray(node) && node.length) return node.map(normalizeNode);
|
|
8
|
-
else if (isBlock(node)) return node;
|
|
9
|
-
else return (0, vue.createTextNode)(String(node));
|
|
10
|
-
}
|
|
11
|
-
function isBlock(val) {
|
|
12
|
-
return val instanceof Node || Array.isArray(val) || (0, vue.isVaporComponent)(val) || (0, vue.isFragment)(val);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
exports.isBlock = isBlock;
|
|
17
|
-
exports.normalizeNode = normalizeNode;
|
package/dist/block.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Block } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/block.d.ts
|
|
4
|
-
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
5
|
-
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
6
|
-
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
|
7
|
-
declare function normalizeNode(node: NodeChild): Block;
|
|
8
|
-
declare function isBlock(val: NonNullable<unknown>): val is Block;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { NodeArrayChildren, NodeChild, isBlock, normalizeNode };
|
package/dist/block.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Block } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/block.d.ts
|
|
4
|
-
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
5
|
-
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
6
|
-
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
|
7
|
-
declare function normalizeNode(node: NodeChild): Block;
|
|
8
|
-
declare function isBlock(val: NonNullable<unknown>): val is Block;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { NodeArrayChildren, NodeChild, isBlock, normalizeNode };
|
package/dist/block.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createTextNode, isFragment, isVaporComponent } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/block.ts
|
|
4
|
-
function normalizeNode(node) {
|
|
5
|
-
if (node == null || typeof node === "boolean") return document.createComment("");
|
|
6
|
-
else if (Array.isArray(node) && node.length) return node.map(normalizeNode);
|
|
7
|
-
else if (isBlock(node)) return node;
|
|
8
|
-
else return createTextNode(String(node));
|
|
9
|
-
}
|
|
10
|
-
function isBlock(val) {
|
|
11
|
-
return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { isBlock, normalizeNode };
|
package/dist/component.cjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const require_helpers = require('./helpers-CjCn59Dr.cjs');
|
|
2
|
-
const require_block = require('./block.cjs');
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
|
|
5
|
-
//#region src/component.ts
|
|
6
|
-
const createComponent = (type, ...args) => {
|
|
7
|
-
return createProxyComponent(vue.createComponent, type, ...args);
|
|
8
|
-
};
|
|
9
|
-
const createComponentWithFallback = (type, ...args) => {
|
|
10
|
-
const slots = args[1];
|
|
11
|
-
if (typeof type === "string" && slots && slots.default && typeof slots.default === "function") {
|
|
12
|
-
const defaultSlot = slots.default;
|
|
13
|
-
slots.default = () => {
|
|
14
|
-
return createProxyComponent(vue.createComponentWithFallback, defaultSlot, null, null);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return createProxyComponent(vue.createComponentWithFallback, type, ...args);
|
|
18
|
-
};
|
|
19
|
-
const createProxyComponent = (createComponent$1, type, props, ...args) => {
|
|
20
|
-
if (type === vue.Fragment) {
|
|
21
|
-
type = (_, { slots }) => slots.default ? slots.default() : [];
|
|
22
|
-
props = null;
|
|
23
|
-
}
|
|
24
|
-
const i = require_helpers.getCurrentInstance();
|
|
25
|
-
if (!type.__proxyed) {
|
|
26
|
-
if (typeof type === "function") type = new Proxy(type, {
|
|
27
|
-
apply(target, ctx, args$1) {
|
|
28
|
-
if (typeof target.__setup === "function") target.__setup.apply(ctx, args$1);
|
|
29
|
-
return require_block.normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
30
|
-
},
|
|
31
|
-
get(target, p, receiver) {
|
|
32
|
-
if ((i && i.appContext).vapor && p === "__vapor") return true;
|
|
33
|
-
return Reflect.get(target, p, receiver);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args$1) {
|
|
37
|
-
return require_block.normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
38
|
-
} });
|
|
39
|
-
type.__proxyed = true;
|
|
40
|
-
}
|
|
41
|
-
return createComponent$1(type, props, ...args);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.createComponent = createComponent;
|
|
46
|
-
exports.createComponentWithFallback = createComponentWithFallback;
|
package/dist/component.d.cts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as vue0 from "vue";
|
|
2
|
-
import { Fragment, VaporComponent, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1 } from "vue";
|
|
3
|
-
|
|
4
|
-
//#region src/component.d.ts
|
|
5
|
-
type Tail<T extends any[]> = T extends [any, ...infer R] ? R : never;
|
|
6
|
-
declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponent$1>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
7
|
-
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback$1>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { createComponent, createComponentWithFallback };
|
package/dist/component.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as vue0 from "vue";
|
|
2
|
-
import { Fragment, VaporComponent, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1 } from "vue";
|
|
3
|
-
|
|
4
|
-
//#region src/component.d.ts
|
|
5
|
-
type Tail<T extends any[]> = T extends [any, ...infer R] ? R : never;
|
|
6
|
-
declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponent$1>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
7
|
-
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback$1>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { createComponent, createComponentWithFallback };
|
package/dist/component.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { normalizeNode } from "./block.js";
|
|
2
|
-
import { t as getCurrentInstance$1 } from "./helpers-CTg3GxNb.js";
|
|
3
|
-
import { Fragment, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1 } from "vue";
|
|
4
|
-
|
|
5
|
-
//#region src/component.ts
|
|
6
|
-
const createComponent = (type, ...args) => {
|
|
7
|
-
return createProxyComponent(createComponent$1, type, ...args);
|
|
8
|
-
};
|
|
9
|
-
const createComponentWithFallback = (type, ...args) => {
|
|
10
|
-
const slots = args[1];
|
|
11
|
-
if (typeof type === "string" && slots && slots.default && typeof slots.default === "function") {
|
|
12
|
-
const defaultSlot = slots.default;
|
|
13
|
-
slots.default = () => {
|
|
14
|
-
return createProxyComponent(createComponentWithFallback$1, defaultSlot, null, null);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return createProxyComponent(createComponentWithFallback$1, type, ...args);
|
|
18
|
-
};
|
|
19
|
-
const createProxyComponent = (createComponent$2, type, props, ...args) => {
|
|
20
|
-
if (type === Fragment) {
|
|
21
|
-
type = (_, { slots }) => slots.default ? slots.default() : [];
|
|
22
|
-
props = null;
|
|
23
|
-
}
|
|
24
|
-
const i = getCurrentInstance$1();
|
|
25
|
-
if (!type.__proxyed) {
|
|
26
|
-
if (typeof type === "function") type = new Proxy(type, {
|
|
27
|
-
apply(target, ctx, args$1) {
|
|
28
|
-
if (typeof target.__setup === "function") target.__setup.apply(ctx, args$1);
|
|
29
|
-
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
30
|
-
},
|
|
31
|
-
get(target, p, receiver) {
|
|
32
|
-
if ((i && i.appContext).vapor && p === "__vapor") return true;
|
|
33
|
-
return Reflect.get(target, p, receiver);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args$1) {
|
|
37
|
-
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
38
|
-
} });
|
|
39
|
-
type.__proxyed = true;
|
|
40
|
-
}
|
|
41
|
-
return createComponent$2(type, props, ...args);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { createComponent, createComponentWithFallback };
|
package/dist/helpers.cjs
DELETED
package/dist/helpers.js
DELETED
package/dist/node.d.cts
DELETED
package/dist/node.d.ts
DELETED
package/dist/node.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { EffectScope, VaporFragment, insert, isFragment, isVaporComponent, remove, renderEffect } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/node.ts
|
|
4
|
-
function createFragment(nodes, anchor = document.createTextNode("")) {
|
|
5
|
-
const frag = new VaporFragment(nodes);
|
|
6
|
-
frag.anchor = anchor;
|
|
7
|
-
return frag;
|
|
8
|
-
}
|
|
9
|
-
function normalizeNode(node, anchor) {
|
|
10
|
-
if (node instanceof Node || isFragment(node)) {
|
|
11
|
-
anchor && (anchor.textContent = "");
|
|
12
|
-
return node;
|
|
13
|
-
} else if (isVaporComponent(node)) {
|
|
14
|
-
anchor && (anchor.textContent = "");
|
|
15
|
-
return createFragment(node, anchor);
|
|
16
|
-
} else if (Array.isArray(node)) {
|
|
17
|
-
anchor && (anchor.textContent = "");
|
|
18
|
-
return createFragment(node.map((i) => normalizeNode(i)), anchor);
|
|
19
|
-
} else {
|
|
20
|
-
const result = node == null || typeof node === "boolean" ? "" : String(node);
|
|
21
|
-
if (anchor) {
|
|
22
|
-
anchor.textContent = result;
|
|
23
|
-
return anchor;
|
|
24
|
-
} else return document.createTextNode(result);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function resolveValue(current, value, _anchor) {
|
|
28
|
-
const node = normalizeNode(value, _anchor);
|
|
29
|
-
if (current) {
|
|
30
|
-
if (isFragment(current)) {
|
|
31
|
-
const { anchor } = current;
|
|
32
|
-
if (anchor && anchor.parentNode) {
|
|
33
|
-
remove(current.nodes, anchor.parentNode);
|
|
34
|
-
insert(node, anchor.parentNode, anchor);
|
|
35
|
-
!_anchor && anchor.parentNode.removeChild(anchor);
|
|
36
|
-
}
|
|
37
|
-
} else if (current instanceof Node) {
|
|
38
|
-
if (isFragment(node) && current.parentNode) {
|
|
39
|
-
insert(node, current.parentNode, current);
|
|
40
|
-
current.parentNode.removeChild(current);
|
|
41
|
-
} else if (node instanceof Node) {
|
|
42
|
-
if (current.nodeType === 3 && node.nodeType === 3) {
|
|
43
|
-
current.textContent = node.textContent;
|
|
44
|
-
return current;
|
|
45
|
-
} else if (current.parentNode) current.parentNode.replaceChild(node, current);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return node;
|
|
50
|
-
}
|
|
51
|
-
function resolveValues(values = [], _anchor) {
|
|
52
|
-
const nodes = [];
|
|
53
|
-
const frag = createFragment(nodes, _anchor);
|
|
54
|
-
const scopes = [];
|
|
55
|
-
for (const [index, value] of values.entries()) {
|
|
56
|
-
const anchor = index === values.length - 1 ? _anchor : void 0;
|
|
57
|
-
if (typeof value === "function") renderEffect(() => {
|
|
58
|
-
if (scopes[index]) scopes[index].stop();
|
|
59
|
-
scopes[index] = new EffectScope();
|
|
60
|
-
nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor));
|
|
61
|
-
});
|
|
62
|
-
else nodes[index] = resolveValue(nodes[index], value, anchor);
|
|
63
|
-
}
|
|
64
|
-
return frag;
|
|
65
|
-
}
|
|
66
|
-
function setNodes(anchor, ...values) {
|
|
67
|
-
const resolvedValues = resolveValues(values, anchor);
|
|
68
|
-
anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);
|
|
69
|
-
}
|
|
70
|
-
function createNodes(...values) {
|
|
71
|
-
return resolveValues(values);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
|
-
export { createNodes, setNodes };
|
package/dist/vnode.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const require_helpers = require('./helpers-CjCn59Dr.cjs');
|
|
2
|
-
let vue = require("vue");
|
|
3
|
-
|
|
4
|
-
//#region src/vnode.ts
|
|
5
|
-
const cacheMap = /* @__PURE__ */ new WeakMap();
|
|
6
|
-
function createVNodeCache(index) {
|
|
7
|
-
const i = (0, vue.getCurrentInstance)();
|
|
8
|
-
if (i) {
|
|
9
|
-
!cacheMap.has(i) && cacheMap.set(i, []);
|
|
10
|
-
const caches = cacheMap.get(i);
|
|
11
|
-
return caches[index] || (caches[index] = []);
|
|
12
|
-
} else return [];
|
|
13
|
-
}
|
|
14
|
-
function normalizeVNode(value = " ", flag = 1) {
|
|
15
|
-
if (value == null || typeof value === "boolean") return (0, vue.createVNode)(vue.Comment);
|
|
16
|
-
else if (typeof value !== "function") return (0, vue.createVNode)(vue.Text, null, String(value), flag);
|
|
17
|
-
(0, vue.openBlock)();
|
|
18
|
-
const node = value();
|
|
19
|
-
if (node == null || typeof node === "boolean") return (0, vue.createBlock)(vue.Comment);
|
|
20
|
-
else if (Array.isArray(node)) return (0, vue.createBlock)(vue.Fragment, null, node.slice());
|
|
21
|
-
else if ((0, vue.isVNode)(node)) return (0, vue.createBlock)(cloneIfMounted(node));
|
|
22
|
-
else return (0, vue.createBlock)(vue.Text, null, String(node), flag);
|
|
23
|
-
}
|
|
24
|
-
function cloneIfMounted(child) {
|
|
25
|
-
return child.el === null && child.patchFlag !== -1 || child.memo ? child : (0, vue.cloneVNode)(child);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
exports.createVNodeCache = createVNodeCache;
|
|
30
|
-
exports.normalizeVNode = normalizeVNode;
|
package/dist/vnode.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Comment, Fragment, Text, cloneVNode, createBlock, createVNode, getCurrentInstance, isVNode, openBlock } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/vnode.ts
|
|
4
|
-
const cacheMap = /* @__PURE__ */ new WeakMap();
|
|
5
|
-
function createVNodeCache(index) {
|
|
6
|
-
const i = getCurrentInstance();
|
|
7
|
-
if (i) {
|
|
8
|
-
!cacheMap.has(i) && cacheMap.set(i, []);
|
|
9
|
-
const caches = cacheMap.get(i);
|
|
10
|
-
return caches[index] || (caches[index] = []);
|
|
11
|
-
} else return [];
|
|
12
|
-
}
|
|
13
|
-
function normalizeVNode(value = " ", flag = 1) {
|
|
14
|
-
if (value == null || typeof value === "boolean") return createVNode(Comment);
|
|
15
|
-
else if (typeof value !== "function") return createVNode(Text, null, String(value), flag);
|
|
16
|
-
openBlock();
|
|
17
|
-
const node = value();
|
|
18
|
-
if (node == null || typeof node === "boolean") return createBlock(Comment);
|
|
19
|
-
else if (Array.isArray(node)) return createBlock(Fragment, null, node.slice());
|
|
20
|
-
else if (isVNode(node)) return createBlock(cloneIfMounted(node));
|
|
21
|
-
else return createBlock(Text, null, String(node), flag);
|
|
22
|
-
}
|
|
23
|
-
function cloneIfMounted(child) {
|
|
24
|
-
return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
export { createVNodeCache, normalizeVNode };
|
package/dist/vue.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/vue.ts
|
|
3
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
4
|
-
function defineVaporComponent(comp, extraOptions) {
|
|
5
|
-
if (typeof comp === "function") return /* @__PURE__ */ (() => Object.assign({ name: comp.name }, extraOptions, {
|
|
6
|
-
setup: comp,
|
|
7
|
-
__vapor: true
|
|
8
|
-
}))();
|
|
9
|
-
comp.__vapor = true;
|
|
10
|
-
return comp;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
exports.defineVaporComponent = defineVaporComponent;
|