@vue-jsx-vapor/runtime 3.1.20 → 3.1.22
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/raw.cjs +1 -1
- package/dist/raw.js +1 -1
- package/dist/vapor.cjs +4 -10
- package/dist/vapor.d.cts +2 -6
- package/dist/vapor.d.ts +2 -6
- package/dist/vapor.js +4 -10
- package/package.json +2 -2
package/dist/raw.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var ssr_default = "import { useSSRContext } from \"vue\";\nexport function ssrRe
|
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/vapor.ts?raw
|
|
11
|
-
var vapor_default = "import {\n EffectScope,\n Fragment,\n getCurrentInstance\n} from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function defineVaporSSRComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup(props, ctx) {\n const result = comp(props, ctx);\n return () => result;\n },\n __vapor: true\n });\n }\n const setup = comp.setup;\n if (setup) {\n comp.setup = (props, ctx) => {\n const result = setup(props, ctx);\n return () => result;\n };\n }\n comp.__vapor = true;\n return comp;\n}\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(Vue.createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n Vue.createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(Vue.createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = Vue.currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if (
|
|
11
|
+
var vapor_default = "import {\n EffectScope,\n Fragment,\n getCurrentInstance\n} from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function defineVaporSSRComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup(props, ctx) {\n const result = comp(props, ctx);\n return () => result;\n },\n __vapor: true\n });\n }\n const setup = comp.setup;\n if (setup) {\n comp.setup = (props, ctx) => {\n const result = setup(props, ctx);\n return () => result;\n };\n }\n comp.__vapor = true;\n return comp;\n}\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(Vue.createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n Vue.createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(Vue.createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = Vue.currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if (i && i.appContext.vapor && p === \"__vapor\") {\n return true;\n }\n return Reflect.get(target, p, receiver);\n }\n });\n } else if (type.__vapor && type.setup) {\n type.setup = new Proxy(type.setup, {\n apply(target, ctx, args2) {\n return normalizeNode(Reflect.apply(target, ctx, args2));\n }\n });\n }\n type.__proxyed = true;\n }\n return createComponent2(type, props, ...args);\n};\nexport function normalizeNode(node) {\n if (node == null || typeof node === \"boolean\") {\n return document.createComment(\"\");\n } else if (Array.isArray(node) && node.length) {\n return node.map(normalizeNode);\n } else if (isBlock(node)) {\n return node;\n } else {\n return document.createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || Vue.isVaporComponent(val) || Vue.isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new Vue.VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || Vue.isFragment(node)) {\n return node;\n } else if (Vue.isVaporComponent(node)) {\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n return createFragment(\n node.map((i) => normalizeBlock(i)),\n anchor\n );\n } else {\n const result = node == null || typeof node === \"boolean\" ? \"\" : String(node);\n if (anchor) {\n anchor.textContent = result;\n return anchor;\n } else {\n return document.createTextNode(result);\n }\n }\n}\nfunction resolveValue(current, value, anchor) {\n anchor = anchor || (current instanceof Node && current.nodeType === 3 ? current : void 0);\n const node = normalizeBlock(value, anchor);\n if (current) {\n if (Vue.isFragment(current)) {\n if (current.anchor && current.anchor.parentNode) {\n Vue.remove(current.nodes, current.anchor.parentNode);\n Vue.insert(node, current.anchor.parentNode, current.anchor);\n !anchor && current.anchor.parentNode.removeChild(current.anchor);\n if (current.scope) current.scope.stop();\n }\n } else if (current instanceof Node) {\n if (current.nodeType === 3 && (!(node instanceof Node) || node.nodeType !== 3)) {\n current.textContent = \"\";\n }\n if (Vue.isFragment(node) && current.parentNode) {\n Vue.insert(node, current.parentNode, current);\n if (!anchor || current.nodeType !== 3) {\n current.parentNode.removeChild(current);\n }\n } else if (node instanceof Node) {\n if (current.nodeType === 3 && node.nodeType === 3) {\n current.textContent = node.textContent;\n return current;\n } else if (current.parentNode) {\n current.parentNode.replaceChild(node, current);\n }\n }\n }\n }\n return node;\n}\nfunction resolveValues(values = [], _anchor) {\n const nodes = [];\n const scopes = [];\n for (const [index, value] of values.entries()) {\n const anchor = index === values.length - 1 ? _anchor : void 0;\n if (typeof value === \"function\") {\n Vue.renderEffect(() => {\n if (scopes[index]) scopes[index].stop();\n scopes[index] = new EffectScope();\n nodes[index] = scopes[index].run(\n () => resolveValue(nodes[index], value(), anchor)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor);\n }\n }\n return nodes;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && Vue.insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/vdom.ts?raw
|
package/dist/raw.js
CHANGED
|
@@ -7,7 +7,7 @@ var ssr_default = "import { useSSRContext } from \"vue\";\nexport function ssrRe
|
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/vapor.ts?raw
|
|
10
|
-
var vapor_default = "import {\n EffectScope,\n Fragment,\n getCurrentInstance\n} from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function defineVaporSSRComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup(props, ctx) {\n const result = comp(props, ctx);\n return () => result;\n },\n __vapor: true\n });\n }\n const setup = comp.setup;\n if (setup) {\n comp.setup = (props, ctx) => {\n const result = setup(props, ctx);\n return () => result;\n };\n }\n comp.__vapor = true;\n return comp;\n}\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(Vue.createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n Vue.createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(Vue.createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = Vue.currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if (
|
|
10
|
+
var vapor_default = "import {\n EffectScope,\n Fragment,\n getCurrentInstance\n} from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function defineVaporSSRComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup(props, ctx) {\n const result = comp(props, ctx);\n return () => result;\n },\n __vapor: true\n });\n }\n const setup = comp.setup;\n if (setup) {\n comp.setup = (props, ctx) => {\n const result = setup(props, ctx);\n return () => result;\n };\n }\n comp.__vapor = true;\n return comp;\n}\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(Vue.createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n Vue.createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(Vue.createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = Vue.currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if (i && i.appContext.vapor && p === \"__vapor\") {\n return true;\n }\n return Reflect.get(target, p, receiver);\n }\n });\n } else if (type.__vapor && type.setup) {\n type.setup = new Proxy(type.setup, {\n apply(target, ctx, args2) {\n return normalizeNode(Reflect.apply(target, ctx, args2));\n }\n });\n }\n type.__proxyed = true;\n }\n return createComponent2(type, props, ...args);\n};\nexport function normalizeNode(node) {\n if (node == null || typeof node === \"boolean\") {\n return document.createComment(\"\");\n } else if (Array.isArray(node) && node.length) {\n return node.map(normalizeNode);\n } else if (isBlock(node)) {\n return node;\n } else {\n return document.createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || Vue.isVaporComponent(val) || Vue.isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new Vue.VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || Vue.isFragment(node)) {\n return node;\n } else if (Vue.isVaporComponent(node)) {\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n return createFragment(\n node.map((i) => normalizeBlock(i)),\n anchor\n );\n } else {\n const result = node == null || typeof node === \"boolean\" ? \"\" : String(node);\n if (anchor) {\n anchor.textContent = result;\n return anchor;\n } else {\n return document.createTextNode(result);\n }\n }\n}\nfunction resolveValue(current, value, anchor) {\n anchor = anchor || (current instanceof Node && current.nodeType === 3 ? current : void 0);\n const node = normalizeBlock(value, anchor);\n if (current) {\n if (Vue.isFragment(current)) {\n if (current.anchor && current.anchor.parentNode) {\n Vue.remove(current.nodes, current.anchor.parentNode);\n Vue.insert(node, current.anchor.parentNode, current.anchor);\n !anchor && current.anchor.parentNode.removeChild(current.anchor);\n if (current.scope) current.scope.stop();\n }\n } else if (current instanceof Node) {\n if (current.nodeType === 3 && (!(node instanceof Node) || node.nodeType !== 3)) {\n current.textContent = \"\";\n }\n if (Vue.isFragment(node) && current.parentNode) {\n Vue.insert(node, current.parentNode, current);\n if (!anchor || current.nodeType !== 3) {\n current.parentNode.removeChild(current);\n }\n } else if (node instanceof Node) {\n if (current.nodeType === 3 && node.nodeType === 3) {\n current.textContent = node.textContent;\n return current;\n } else if (current.parentNode) {\n current.parentNode.replaceChild(node, current);\n }\n }\n }\n }\n return node;\n}\nfunction resolveValues(values = [], _anchor) {\n const nodes = [];\n const scopes = [];\n for (const [index, value] of values.entries()) {\n const anchor = index === values.length - 1 ? _anchor : void 0;\n if (typeof value === \"function\") {\n Vue.renderEffect(() => {\n if (scopes[index]) scopes[index].stop();\n scopes[index] = new EffectScope();\n nodes[index] = scopes[index].run(\n () => resolveValue(nodes[index], value(), anchor)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor);\n }\n }\n return nodes;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && Vue.insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/vdom.ts?raw
|
package/dist/vapor.cjs
CHANGED
|
@@ -46,20 +46,14 @@ const createProxyComponent = (createComponent, type, props, ...args) => {
|
|
|
46
46
|
return normalizeNode(Reflect.apply(target, ctx, args));
|
|
47
47
|
},
|
|
48
48
|
get(target, p, receiver) {
|
|
49
|
-
if (p === "__proxyed") return true;
|
|
50
49
|
if (i && i.appContext.vapor && p === "__vapor") return true;
|
|
51
50
|
return Reflect.get(target, p, receiver);
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
|
-
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, {
|
|
55
|
-
apply(target, ctx, args)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
get(target, p, receiver) {
|
|
59
|
-
if (p === "__proxyed") return true;
|
|
60
|
-
return Reflect.get(target, p, receiver);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
53
|
+
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args) {
|
|
54
|
+
return normalizeNode(Reflect.apply(target, ctx, args));
|
|
55
|
+
} });
|
|
56
|
+
type.__proxyed = true;
|
|
63
57
|
}
|
|
64
58
|
return createComponent(type, props, ...args);
|
|
65
59
|
};
|
package/dist/vapor.d.cts
CHANGED
|
@@ -4,12 +4,8 @@ import { Block, Fragment, VaporComponent } from "vue";
|
|
|
4
4
|
//#region src/vapor.d.ts
|
|
5
5
|
declare function defineVaporSSRComponent(comp: VaporComponent, extraOptions: VaporComponent): VaporComponent;
|
|
6
6
|
type Tail<T extends any[]> = T extends [any, ...infer R] ? R : never;
|
|
7
|
-
declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponent>>) => Vue.VaporComponentInstance<{}, {},
|
|
8
|
-
|
|
9
|
-
}, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
10
|
-
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponentWithFallback>>) => Vue.VaporComponentInstance<{}, {}, {
|
|
11
|
-
[x: string]: (...args: any[]) => Block;
|
|
12
|
-
}, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
7
|
+
declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponent>>) => Vue.VaporComponentInstance<{}, {}, Vue.StaticSlots, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
8
|
+
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponentWithFallback>>) => Vue.VaporComponentInstance<{}, {}, Vue.StaticSlots, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
13
9
|
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
14
10
|
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
15
11
|
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
package/dist/vapor.d.ts
CHANGED
|
@@ -4,12 +4,8 @@ import { Block, Fragment, VaporComponent } from "vue";
|
|
|
4
4
|
//#region src/vapor.d.ts
|
|
5
5
|
declare function defineVaporSSRComponent(comp: VaporComponent, extraOptions: VaporComponent): VaporComponent;
|
|
6
6
|
type Tail<T extends any[]> = T extends [any, ...infer R] ? R : never;
|
|
7
|
-
declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponent>>) => Vue.VaporComponentInstance<{}, {},
|
|
8
|
-
|
|
9
|
-
}, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
10
|
-
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponentWithFallback>>) => Vue.VaporComponentInstance<{}, {}, {
|
|
11
|
-
[x: string]: (...args: any[]) => Block;
|
|
12
|
-
}, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
7
|
+
declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponent>>) => Vue.VaporComponentInstance<{}, {}, Vue.StaticSlots, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
8
|
+
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof Vue.createComponentWithFallback>>) => Vue.VaporComponentInstance<{}, {}, Vue.StaticSlots, Record<string, any>, Block, Record<string, any>> | HTMLElement;
|
|
13
9
|
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
14
10
|
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
15
11
|
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
package/dist/vapor.js
CHANGED
|
@@ -45,20 +45,14 @@ const createProxyComponent = (createComponent, type, props, ...args) => {
|
|
|
45
45
|
return normalizeNode(Reflect.apply(target, ctx, args));
|
|
46
46
|
},
|
|
47
47
|
get(target, p, receiver) {
|
|
48
|
-
if (p === "__proxyed") return true;
|
|
49
48
|
if (i && i.appContext.vapor && p === "__vapor") return true;
|
|
50
49
|
return Reflect.get(target, p, receiver);
|
|
51
50
|
}
|
|
52
51
|
});
|
|
53
|
-
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, {
|
|
54
|
-
apply(target, ctx, args)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
get(target, p, receiver) {
|
|
58
|
-
if (p === "__proxyed") return true;
|
|
59
|
-
return Reflect.get(target, p, receiver);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
52
|
+
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args) {
|
|
53
|
+
return normalizeNode(Reflect.apply(target, ctx, args));
|
|
54
|
+
} });
|
|
55
|
+
type.__proxyed = true;
|
|
62
56
|
}
|
|
63
57
|
return createComponent(type, props, ...args);
|
|
64
58
|
};
|
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.22",
|
|
5
5
|
"description": "Vue JSX Vapor Runtime",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"csstype": "^3.2.3",
|
|
44
|
-
"vue": "3.6.0-beta.
|
|
44
|
+
"vue": "3.6.0-beta.6"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsdown",
|