@vue-jsx-vapor/runtime 2.6.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/LICENSE +21 -0
- package/dist/block-C2Eqyw1w.d.cts +10 -0
- package/dist/block-Ce05UNsp.cjs +27 -0
- package/dist/block-CyA0ggJw.js +15 -0
- package/dist/block-pPxpKsmV.d.ts +10 -0
- package/dist/block.cjs +4 -0
- package/dist/block.d.cts +2 -0
- package/dist/block.d.ts +2 -0
- package/dist/block.js +3 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/component-BHAqMOe7.cjs +44 -0
- package/dist/component-BkffHjyR.d.cts +9 -0
- package/dist/component-CG7Pcj6B.d.ts +9 -0
- package/dist/component-DAbq6g1p.js +32 -0
- package/dist/component.cjs +6 -0
- package/dist/component.d.cts +2 -0
- package/dist/component.d.ts +2 -0
- package/dist/component.js +5 -0
- package/dist/h-76H4kJgw.js +28 -0
- package/dist/h-DutSRaoO.d.ts +36 -0
- package/dist/h-mLWlHa8R.d.cts +36 -0
- package/dist/h-yXUW23HD.cjs +33 -0
- package/dist/h.cjs +6 -0
- package/dist/h.d.cts +3 -0
- package/dist/h.d.ts +3 -0
- package/dist/h.js +6 -0
- package/dist/helpers-BvOzWbq1.d.ts +37 -0
- package/dist/helpers-C0DfvsA-.js +44 -0
- package/dist/helpers-DeLHxsS2.d.cts +37 -0
- package/dist/helpers-z4TWV9SY.cjs +61 -0
- package/dist/helpers.cjs +5 -0
- package/dist/helpers.d.cts +2 -0
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.js +3 -0
- package/dist/index.cjs +25 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/jsx-CRoDhX85.d.ts +1326 -0
- package/dist/jsx-CTAfwhvm.cjs +0 -0
- package/dist/jsx-D6bpAbiF.js +0 -0
- package/dist/jsx-EFPAy-wt.d.cts +1326 -0
- package/dist/jsx.cjs +1 -0
- package/dist/jsx.d.cts +2 -0
- package/dist/jsx.d.ts +2 -0
- package/dist/jsx.js +1 -0
- package/dist/node-BLet7XpW.cjs +87 -0
- package/dist/node-Bd0fT44y.js +75 -0
- package/dist/node-DLEa8Cxk.d.ts +7 -0
- package/dist/node-w0ksMVPx.d.cts +7 -0
- package/dist/node.cjs +4 -0
- package/dist/node.d.cts +2 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +3 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 zhiyuanzmj <https://github.com/zhiyuanzmj>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const vue = require_chunk.__toESM(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
|
+
Object.defineProperty(exports, 'isBlock', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return isBlock;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, 'normalizeNode', {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return normalizeNode;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
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.cjs
ADDED
package/dist/block.d.cts
ADDED
package/dist/block.d.ts
ADDED
package/dist/block.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_block = require('./block-Ce05UNsp.cjs');
|
|
3
|
+
const require_helpers = require('./helpers-z4TWV9SY.cjs');
|
|
4
|
+
const vue = require_chunk.__toESM(require("vue"));
|
|
5
|
+
|
|
6
|
+
//#region src/component.ts
|
|
7
|
+
const createComponent = (type, ...args) => {
|
|
8
|
+
return createProxyComponent(vue.createComponent, type, ...args);
|
|
9
|
+
};
|
|
10
|
+
const createComponentWithFallback = (type, ...args) => createProxyComponent(vue.createComponentWithFallback, type, ...args);
|
|
11
|
+
const createProxyComponent = (createComponent$1, type, props, ...args) => {
|
|
12
|
+
if (type === vue.Fragment) {
|
|
13
|
+
type = (_, { slots }) => slots.default();
|
|
14
|
+
props = null;
|
|
15
|
+
}
|
|
16
|
+
const i = require_helpers.getCurrentInstance();
|
|
17
|
+
if (typeof type === "function") type = new Proxy(type, {
|
|
18
|
+
apply(target, ctx, args$1) {
|
|
19
|
+
return require_block.normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
20
|
+
},
|
|
21
|
+
get(target, p, receiver) {
|
|
22
|
+
if ((i && i.appContext).vapor && p === "__vapor") return true;
|
|
23
|
+
return Reflect.get(target, p, receiver);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args$1) {
|
|
27
|
+
return require_block.normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
28
|
+
} });
|
|
29
|
+
return createComponent$1(type, props, ...args);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
Object.defineProperty(exports, 'createComponent', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return createComponent;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, 'createComponentWithFallback', {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return createComponentWithFallback;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
|
+
import { Fragment, VaporComponent, createComponent, createComponentWithFallback } 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$1: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponent>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
7
|
+
declare const createComponentWithFallback$1: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createComponent$1 as createComponent, createComponentWithFallback$1 as createComponentWithFallback };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
|
+
import { Fragment, VaporComponent, createComponent, createComponentWithFallback } 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$1: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponent>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
7
|
+
declare const createComponentWithFallback$1: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback>>) => vue0.VaporComponentInstance | HTMLElement;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createComponent$1 as createComponent, createComponentWithFallback$1 as createComponentWithFallback };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { normalizeNode } from "./block-CyA0ggJw.js";
|
|
2
|
+
import { getCurrentInstance } from "./helpers-C0DfvsA-.js";
|
|
3
|
+
import { Fragment, createComponent, createComponentWithFallback } from "vue";
|
|
4
|
+
|
|
5
|
+
//#region src/component.ts
|
|
6
|
+
const createComponent$1 = (type, ...args) => {
|
|
7
|
+
return createProxyComponent(createComponent, type, ...args);
|
|
8
|
+
};
|
|
9
|
+
const createComponentWithFallback$1 = (type, ...args) => createProxyComponent(createComponentWithFallback, type, ...args);
|
|
10
|
+
const createProxyComponent = (createComponent$2, type, props, ...args) => {
|
|
11
|
+
if (type === Fragment) {
|
|
12
|
+
type = (_, { slots }) => slots.default();
|
|
13
|
+
props = null;
|
|
14
|
+
}
|
|
15
|
+
const i = getCurrentInstance();
|
|
16
|
+
if (typeof type === "function") type = new Proxy(type, {
|
|
17
|
+
apply(target, ctx, args$1) {
|
|
18
|
+
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
19
|
+
},
|
|
20
|
+
get(target, p, receiver) {
|
|
21
|
+
if ((i && i.appContext).vapor && p === "__vapor") return true;
|
|
22
|
+
return Reflect.get(target, p, receiver);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args$1) {
|
|
26
|
+
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
27
|
+
} });
|
|
28
|
+
return createComponent$2(type, props, ...args);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { createComponent$1 as createComponent, createComponentWithFallback$1 as createComponentWithFallback };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
require('./block-Ce05UNsp.cjs');
|
|
2
|
+
require('./helpers-z4TWV9SY.cjs');
|
|
3
|
+
const require_component = require('./component-BHAqMOe7.cjs');
|
|
4
|
+
|
|
5
|
+
exports.createComponent = require_component.createComponent;
|
|
6
|
+
exports.createComponentWithFallback = require_component.createComponentWithFallback;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isBlock } from "./block-CyA0ggJw.js";
|
|
2
|
+
import { createComponentWithFallback } from "./component-DAbq6g1p.js";
|
|
3
|
+
|
|
4
|
+
//#region src/h.ts
|
|
5
|
+
function h(type, propsOrChildren, children) {
|
|
6
|
+
const l = arguments.length;
|
|
7
|
+
if (l === 2) if (typeof propsOrChildren === "object" && !Array.isArray(propsOrChildren) || typeof propsOrChildren === "function") {
|
|
8
|
+
if (isBlock(propsOrChildren)) return createComponentWithFallback(type, null, { default: () => propsOrChildren });
|
|
9
|
+
return createComponentWithFallback(type, resolveProps(propsOrChildren));
|
|
10
|
+
} else return createComponentWithFallback(type, null, { default: () => propsOrChildren });
|
|
11
|
+
else {
|
|
12
|
+
if (l > 3) children = Array.prototype.slice.call(arguments, 2);
|
|
13
|
+
return createComponentWithFallback(type, resolveProps(propsOrChildren), children ? typeof children === "object" && !Array.isArray(children) ? children : { default: () => children } : void 0);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function resolveProps(props) {
|
|
17
|
+
if (props) {
|
|
18
|
+
if (typeof props === "function") return { $: [props] };
|
|
19
|
+
const resolvedProps = {};
|
|
20
|
+
for (const key in props) if (typeof props[key] === "function" || key === "$") resolvedProps[key] = props[key];
|
|
21
|
+
else resolvedProps[key] = () => props[key];
|
|
22
|
+
return resolvedProps;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { h };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NodeArrayChildren, NodeChild } from "./block-pPxpKsmV.js";
|
|
2
|
+
import { Block, Component, ComponentOptions, ConcreteComponent, DefineComponent, EmitsOptions, Fragment, FunctionalComponent, RawSlots, Suspense, SuspenseProps, Teleport, TeleportProps, VNodeRef } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/h.d.ts
|
|
5
|
+
interface Constructor<P = any> {
|
|
6
|
+
__isFragment?: never;
|
|
7
|
+
__isTeleport?: never;
|
|
8
|
+
__isSuspense?: never;
|
|
9
|
+
new (...args: any[]): {
|
|
10
|
+
$props: P;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
|
|
14
|
+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
15
|
+
type RawProps = Record<string, any>;
|
|
16
|
+
type ResolveProps<T> = T extends null | undefined ? T : () => T | T;
|
|
17
|
+
declare function h<K extends keyof HTMLElementTagNameMap>(type: K, children?: NodeChild): Block;
|
|
18
|
+
declare function h<K extends keyof HTMLElementTagNameMap>(type: K, props?: ResolveProps<RawProps & HTMLElementEventHandler> | null, children?: NodeChild | RawSlots): Block;
|
|
19
|
+
declare function h(type: string, children?: NodeChild): Block;
|
|
20
|
+
declare function h(type: string, props?: ResolveProps<RawProps> | null, children?: NodeChild | RawSlots): Block;
|
|
21
|
+
declare function h(type: typeof Text | typeof Comment, children?: string | number | boolean): Block;
|
|
22
|
+
declare function h(type: typeof Text | typeof Comment, props?: null, children?: string | number | boolean): Block;
|
|
23
|
+
declare function h(type: typeof Fragment, children?: NodeArrayChildren): Block;
|
|
24
|
+
declare function h(type: typeof Fragment, props?: ResolveProps<{
|
|
25
|
+
key?: PropertyKey;
|
|
26
|
+
ref?: VNodeRef;
|
|
27
|
+
}> | null, children?: NodeArrayChildren): Block;
|
|
28
|
+
declare function h(type: typeof Teleport, props: RawProps & TeleportProps, children: NodeChild | RawSlots): Block;
|
|
29
|
+
declare function h(type: typeof Suspense, children?: NodeChild): Block;
|
|
30
|
+
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps & SuspenseProps> | null, children?: NodeChild | RawSlots): Block;
|
|
31
|
+
declare function h(type: FunctionalComponent, children?: NodeChild): Block;
|
|
32
|
+
declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = any>(type: FunctionalComponent<P, E, S>, props?: ResolveProps<(RawProps & P) | ({} extends P ? null : never)>, children?: NodeChild | IfAny<S, RawSlots, S>): Block;
|
|
33
|
+
declare function h(type: string | ConcreteComponent | Component | ComponentOptions | Constructor | DefineComponent, children?: NodeChild): Block;
|
|
34
|
+
declare function h<P>(type: string | ConcreteComponent<P> | Component<P> | ComponentOptions<P> | Constructor<P> | DefineComponent<P>, props?: ResolveProps<(RawProps & P) | ({} extends P ? null : never)>, children?: NodeChild | RawSlots): Block;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { h };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NodeArrayChildren, NodeChild } from "./block-C2Eqyw1w.cjs";
|
|
2
|
+
import { Block, Component, ComponentOptions, ConcreteComponent, DefineComponent, EmitsOptions, Fragment, FunctionalComponent, RawSlots, Suspense, SuspenseProps, Teleport, TeleportProps, VNodeRef } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/h.d.ts
|
|
5
|
+
interface Constructor<P = any> {
|
|
6
|
+
__isFragment?: never;
|
|
7
|
+
__isTeleport?: never;
|
|
8
|
+
__isSuspense?: never;
|
|
9
|
+
new (...args: any[]): {
|
|
10
|
+
$props: P;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
|
|
14
|
+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
15
|
+
type RawProps = Record<string, any>;
|
|
16
|
+
type ResolveProps<T> = T extends null | undefined ? T : () => T | T;
|
|
17
|
+
declare function h<K extends keyof HTMLElementTagNameMap>(type: K, children?: NodeChild): Block;
|
|
18
|
+
declare function h<K extends keyof HTMLElementTagNameMap>(type: K, props?: ResolveProps<RawProps & HTMLElementEventHandler> | null, children?: NodeChild | RawSlots): Block;
|
|
19
|
+
declare function h(type: string, children?: NodeChild): Block;
|
|
20
|
+
declare function h(type: string, props?: ResolveProps<RawProps> | null, children?: NodeChild | RawSlots): Block;
|
|
21
|
+
declare function h(type: typeof Text | typeof Comment, children?: string | number | boolean): Block;
|
|
22
|
+
declare function h(type: typeof Text | typeof Comment, props?: null, children?: string | number | boolean): Block;
|
|
23
|
+
declare function h(type: typeof Fragment, children?: NodeArrayChildren): Block;
|
|
24
|
+
declare function h(type: typeof Fragment, props?: ResolveProps<{
|
|
25
|
+
key?: PropertyKey;
|
|
26
|
+
ref?: VNodeRef;
|
|
27
|
+
}> | null, children?: NodeArrayChildren): Block;
|
|
28
|
+
declare function h(type: typeof Teleport, props: RawProps & TeleportProps, children: NodeChild | RawSlots): Block;
|
|
29
|
+
declare function h(type: typeof Suspense, children?: NodeChild): Block;
|
|
30
|
+
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps & SuspenseProps> | null, children?: NodeChild | RawSlots): Block;
|
|
31
|
+
declare function h(type: FunctionalComponent, children?: NodeChild): Block;
|
|
32
|
+
declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = any>(type: FunctionalComponent<P, E, S>, props?: ResolveProps<(RawProps & P) | ({} extends P ? null : never)>, children?: NodeChild | IfAny<S, RawSlots, S>): Block;
|
|
33
|
+
declare function h(type: string | ConcreteComponent | Component | ComponentOptions | Constructor | DefineComponent, children?: NodeChild): Block;
|
|
34
|
+
declare function h<P>(type: string | ConcreteComponent<P> | Component<P> | ComponentOptions<P> | Constructor<P> | DefineComponent<P>, props?: ResolveProps<(RawProps & P) | ({} extends P ? null : never)>, children?: NodeChild | RawSlots): Block;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { h };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const require_block = require('./block-Ce05UNsp.cjs');
|
|
2
|
+
const require_component = require('./component-BHAqMOe7.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/h.ts
|
|
5
|
+
function h(type, propsOrChildren, children) {
|
|
6
|
+
const l = arguments.length;
|
|
7
|
+
if (l === 2) if (typeof propsOrChildren === "object" && !Array.isArray(propsOrChildren) || typeof propsOrChildren === "function") {
|
|
8
|
+
if (require_block.isBlock(propsOrChildren)) return require_component.createComponentWithFallback(type, null, { default: () => propsOrChildren });
|
|
9
|
+
return require_component.createComponentWithFallback(type, resolveProps(propsOrChildren));
|
|
10
|
+
} else return require_component.createComponentWithFallback(type, null, { default: () => propsOrChildren });
|
|
11
|
+
else {
|
|
12
|
+
if (l > 3) children = Array.prototype.slice.call(arguments, 2);
|
|
13
|
+
return require_component.createComponentWithFallback(type, resolveProps(propsOrChildren), children ? typeof children === "object" && !Array.isArray(children) ? children : { default: () => children } : void 0);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function resolveProps(props) {
|
|
17
|
+
if (props) {
|
|
18
|
+
if (typeof props === "function") return { $: [props] };
|
|
19
|
+
const resolvedProps = {};
|
|
20
|
+
for (const key in props) if (typeof props[key] === "function" || key === "$") resolvedProps[key] = props[key];
|
|
21
|
+
else resolvedProps[key] = () => props[key];
|
|
22
|
+
return resolvedProps;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
Object.defineProperty(exports, 'h', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return h;
|
|
32
|
+
}
|
|
33
|
+
});
|
package/dist/h.cjs
ADDED
package/dist/h.d.cts
ADDED
package/dist/h.d.ts
ADDED
package/dist/h.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Vue from "vue";
|
|
2
|
+
import { GenericComponentInstance } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers.d.ts
|
|
5
|
+
declare function getCurrentInstance(): GenericComponentInstance | null;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the props of the current component instance.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { useProps } from 'vue-jsx-vapor'
|
|
12
|
+
*
|
|
13
|
+
* defineComponent(({ foo = '' })=>{
|
|
14
|
+
* const props = useProps() // { foo: '' }
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function useProps(): {
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Returns the merged props and attrs of the current component.\
|
|
23
|
+
* Equivalent to `useProps()` + `useAttrs()`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { useFullProps } from 'vue-jsx-vapor'
|
|
28
|
+
*
|
|
29
|
+
* defineComponent((props) => {
|
|
30
|
+
* const fullProps = useFullProps() // = useAttrs() + useProps()
|
|
31
|
+
* })
|
|
32
|
+
*/
|
|
33
|
+
declare function useFullProps(): Vue.ShallowUnwrapRef<{
|
|
34
|
+
[x: string]: Vue.Ref<unknown, unknown>;
|
|
35
|
+
}>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { getCurrentInstance, useFullProps, useProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Vue from "vue";
|
|
2
|
+
import { proxyRefs, toRefs, useAttrs } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers.ts
|
|
5
|
+
function getCurrentInstance() {
|
|
6
|
+
return Vue.currentInstance || Vue.getCurrentInstance();
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns the props of the current component instance.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { useProps } from 'vue-jsx-vapor'
|
|
14
|
+
*
|
|
15
|
+
* defineComponent(({ foo = '' })=>{
|
|
16
|
+
* const props = useProps() // { foo: '' }
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function useProps() {
|
|
21
|
+
const i = getCurrentInstance();
|
|
22
|
+
return i.props;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the merged props and attrs of the current component.\
|
|
26
|
+
* Equivalent to `useProps()` + `useAttrs()`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { useFullProps } from 'vue-jsx-vapor'
|
|
31
|
+
*
|
|
32
|
+
* defineComponent((props) => {
|
|
33
|
+
* const fullProps = useFullProps() // = useAttrs() + useProps()
|
|
34
|
+
* })
|
|
35
|
+
*/
|
|
36
|
+
function useFullProps() {
|
|
37
|
+
return proxyRefs({
|
|
38
|
+
...toRefs(useProps()),
|
|
39
|
+
...toRefs(useAttrs())
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { getCurrentInstance, useFullProps, useProps };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Vue from "vue";
|
|
2
|
+
import { GenericComponentInstance } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers.d.ts
|
|
5
|
+
declare function getCurrentInstance(): GenericComponentInstance | null;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the props of the current component instance.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { useProps } from 'vue-jsx-vapor'
|
|
12
|
+
*
|
|
13
|
+
* defineComponent(({ foo = '' })=>{
|
|
14
|
+
* const props = useProps() // { foo: '' }
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function useProps(): {
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Returns the merged props and attrs of the current component.\
|
|
23
|
+
* Equivalent to `useProps()` + `useAttrs()`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { useFullProps } from 'vue-jsx-vapor'
|
|
28
|
+
*
|
|
29
|
+
* defineComponent((props) => {
|
|
30
|
+
* const fullProps = useFullProps() // = useAttrs() + useProps()
|
|
31
|
+
* })
|
|
32
|
+
*/
|
|
33
|
+
declare function useFullProps(): Vue.ShallowUnwrapRef<{
|
|
34
|
+
[x: string]: Vue.Ref<unknown, unknown>;
|
|
35
|
+
}>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { getCurrentInstance, useFullProps, useProps };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const vue = require_chunk.__toESM(require("vue"));
|
|
3
|
+
|
|
4
|
+
//#region src/helpers.ts
|
|
5
|
+
function getCurrentInstance() {
|
|
6
|
+
return vue.currentInstance || vue.getCurrentInstance();
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns the props of the current component instance.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { useProps } from 'vue-jsx-vapor'
|
|
14
|
+
*
|
|
15
|
+
* defineComponent(({ foo = '' })=>{
|
|
16
|
+
* const props = useProps() // { foo: '' }
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function useProps() {
|
|
21
|
+
const i = getCurrentInstance();
|
|
22
|
+
return i.props;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the merged props and attrs of the current component.\
|
|
26
|
+
* Equivalent to `useProps()` + `useAttrs()`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { useFullProps } from 'vue-jsx-vapor'
|
|
31
|
+
*
|
|
32
|
+
* defineComponent((props) => {
|
|
33
|
+
* const fullProps = useFullProps() // = useAttrs() + useProps()
|
|
34
|
+
* })
|
|
35
|
+
*/
|
|
36
|
+
function useFullProps() {
|
|
37
|
+
return (0, vue.proxyRefs)({
|
|
38
|
+
...(0, vue.toRefs)(useProps()),
|
|
39
|
+
...(0, vue.toRefs)((0, vue.useAttrs)())
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
Object.defineProperty(exports, 'getCurrentInstance', {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return getCurrentInstance;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, 'useFullProps', {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return useFullProps;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, 'useProps', {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return useProps;
|
|
60
|
+
}
|
|
61
|
+
});
|
package/dist/helpers.cjs
ADDED
package/dist/helpers.js
ADDED