@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/h.cjs
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
require('./
|
|
2
|
-
const require_block = require('./block.cjs');
|
|
3
|
-
const require_component = require('./component.cjs');
|
|
1
|
+
const require_vapor = require('./vapor.cjs');
|
|
4
2
|
|
|
5
3
|
//#region src/h.ts
|
|
6
4
|
function h(type, propsOrChildren, children) {
|
|
7
5
|
const l = arguments.length;
|
|
8
6
|
if (l === 2) if (typeof propsOrChildren === "object" && !Array.isArray(propsOrChildren) || typeof propsOrChildren === "function") {
|
|
9
|
-
if (
|
|
10
|
-
return
|
|
11
|
-
} else return
|
|
7
|
+
if (require_vapor.isBlock(propsOrChildren)) return require_vapor.createComponentWithFallback(type, null, { default: () => propsOrChildren });
|
|
8
|
+
return require_vapor.createComponentWithFallback(type, resolveProps(propsOrChildren));
|
|
9
|
+
} else return require_vapor.createComponentWithFallback(type, null, { default: () => propsOrChildren });
|
|
12
10
|
else {
|
|
13
11
|
if (l > 3) children = Array.prototype.slice.call(arguments, 2);
|
|
14
|
-
return
|
|
12
|
+
return require_vapor.createComponentWithFallback(type, resolveProps(propsOrChildren), children ? typeof children === "object" && !Array.isArray(children) ? children : { default: () => children } : void 0);
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
function resolveProps(props) {
|
package/dist/h.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeArrayChildren, NodeChild } from "./
|
|
1
|
+
import { NodeArrayChildren, NodeChild } from "./vapor.cjs";
|
|
2
2
|
import { Block, Component, ComponentOptions, ConcreteComponent, DefineComponent, EmitsOptions, Fragment, FunctionalComponent, RawSlots, Suspense, SuspenseProps, Teleport, TeleportProps, VNodeRef } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/h.d.ts
|
|
@@ -12,12 +12,12 @@ interface Constructor<P = any> {
|
|
|
12
12
|
}
|
|
13
13
|
type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
|
|
14
14
|
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
15
|
-
type RawProps
|
|
15
|
+
type RawProps = Record<string, any>;
|
|
16
16
|
type ResolveProps<T> = T extends null | undefined ? T : (() => T) | T;
|
|
17
17
|
declare function h<K$1 extends keyof HTMLElementTagNameMap>(type: K$1, children?: NodeChild): Block;
|
|
18
|
-
declare function h<K$1 extends keyof HTMLElementTagNameMap>(type: K$1, props?: ResolveProps<RawProps
|
|
18
|
+
declare function h<K$1 extends keyof HTMLElementTagNameMap>(type: K$1, props?: ResolveProps<RawProps & HTMLElementEventHandler> | null, children?: NodeChild | RawSlots): Block;
|
|
19
19
|
declare function h(type: string, children?: NodeChild): Block;
|
|
20
|
-
declare function h(type: string, props?: ResolveProps<RawProps
|
|
20
|
+
declare function h(type: string, props?: ResolveProps<RawProps> | null, children?: NodeChild | RawSlots): Block;
|
|
21
21
|
declare function h(type: typeof Text | typeof Comment, children?: string | number | boolean): Block;
|
|
22
22
|
declare function h(type: typeof Text | typeof Comment, props?: null, children?: string | number | boolean): Block;
|
|
23
23
|
declare function h(type: typeof Fragment, children?: NodeArrayChildren): Block;
|
|
@@ -25,12 +25,12 @@ declare function h(type: typeof Fragment, props?: ResolveProps<{
|
|
|
25
25
|
key?: PropertyKey;
|
|
26
26
|
ref?: VNodeRef;
|
|
27
27
|
}> | null, children?: NodeArrayChildren): Block;
|
|
28
|
-
declare function h(type: typeof Teleport, props: RawProps
|
|
28
|
+
declare function h(type: typeof Teleport, props: RawProps & TeleportProps, children: NodeChild | RawSlots): Block;
|
|
29
29
|
declare function h(type: typeof Suspense, children?: NodeChild): Block;
|
|
30
|
-
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps
|
|
30
|
+
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps & SuspenseProps> | null, children?: NodeChild | RawSlots): Block;
|
|
31
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
|
|
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
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
|
|
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
35
|
//#endregion
|
|
36
36
|
export { h };
|
package/dist/h.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeArrayChildren, NodeChild } from "./
|
|
1
|
+
import { NodeArrayChildren, NodeChild } from "./vapor.js";
|
|
2
2
|
import { Block, Component, ComponentOptions, ConcreteComponent, DefineComponent, EmitsOptions, Fragment, FunctionalComponent, RawSlots, Suspense, SuspenseProps, Teleport, TeleportProps, VNodeRef } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/h.d.ts
|
|
@@ -12,12 +12,12 @@ interface Constructor<P = any> {
|
|
|
12
12
|
}
|
|
13
13
|
type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
|
|
14
14
|
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
15
|
-
type RawProps
|
|
15
|
+
type RawProps = Record<string, any>;
|
|
16
16
|
type ResolveProps<T> = T extends null | undefined ? T : (() => T) | T;
|
|
17
17
|
declare function h<K$1 extends keyof HTMLElementTagNameMap>(type: K$1, children?: NodeChild): Block;
|
|
18
|
-
declare function h<K$1 extends keyof HTMLElementTagNameMap>(type: K$1, props?: ResolveProps<RawProps
|
|
18
|
+
declare function h<K$1 extends keyof HTMLElementTagNameMap>(type: K$1, props?: ResolveProps<RawProps & HTMLElementEventHandler> | null, children?: NodeChild | RawSlots): Block;
|
|
19
19
|
declare function h(type: string, children?: NodeChild): Block;
|
|
20
|
-
declare function h(type: string, props?: ResolveProps<RawProps
|
|
20
|
+
declare function h(type: string, props?: ResolveProps<RawProps> | null, children?: NodeChild | RawSlots): Block;
|
|
21
21
|
declare function h(type: typeof Text | typeof Comment, children?: string | number | boolean): Block;
|
|
22
22
|
declare function h(type: typeof Text | typeof Comment, props?: null, children?: string | number | boolean): Block;
|
|
23
23
|
declare function h(type: typeof Fragment, children?: NodeArrayChildren): Block;
|
|
@@ -25,12 +25,12 @@ declare function h(type: typeof Fragment, props?: ResolveProps<{
|
|
|
25
25
|
key?: PropertyKey;
|
|
26
26
|
ref?: VNodeRef;
|
|
27
27
|
}> | null, children?: NodeArrayChildren): Block;
|
|
28
|
-
declare function h(type: typeof Teleport, props: RawProps
|
|
28
|
+
declare function h(type: typeof Teleport, props: RawProps & TeleportProps, children: NodeChild | RawSlots): Block;
|
|
29
29
|
declare function h(type: typeof Suspense, children?: NodeChild): Block;
|
|
30
|
-
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps
|
|
30
|
+
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps & SuspenseProps> | null, children?: NodeChild | RawSlots): Block;
|
|
31
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
|
|
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
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
|
|
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
35
|
//#endregion
|
|
36
36
|
export { h };
|
package/dist/h.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { isBlock } from "./
|
|
2
|
-
import "./helpers-CTg3GxNb.js";
|
|
3
|
-
import { createComponentWithFallback } from "./component.js";
|
|
1
|
+
import { createComponentWithFallback, isBlock } from "./vapor.js";
|
|
4
2
|
|
|
5
3
|
//#region src/h.ts
|
|
6
4
|
function h(type, propsOrChildren, children) {
|
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_component = require('./component.cjs');
|
|
1
|
+
const require_props = require('./props-DyKlXDej.cjs');
|
|
2
|
+
const require_vapor = require('./vapor.cjs');
|
|
4
3
|
const require_h = require('./h.cjs');
|
|
5
4
|
require('./jsx.cjs');
|
|
6
|
-
const
|
|
7
|
-
const require_vnode = require('./vnode.cjs');
|
|
8
|
-
const require_vue = require('./vue.cjs');
|
|
5
|
+
const require_vdom = require('./vdom.cjs');
|
|
9
6
|
let vue = require("vue");
|
|
10
7
|
|
|
11
|
-
exports.createComponent =
|
|
12
|
-
exports.createComponentWithFallback =
|
|
13
|
-
exports.createNodes =
|
|
14
|
-
exports.createVNodeCache =
|
|
15
|
-
exports.
|
|
16
|
-
exports.getCurrentInstance = require_helpers.getCurrentInstance;
|
|
8
|
+
exports.createComponent = require_vapor.createComponent;
|
|
9
|
+
exports.createComponentWithFallback = require_vapor.createComponentWithFallback;
|
|
10
|
+
exports.createNodes = require_vapor.createNodes;
|
|
11
|
+
exports.createVNodeCache = require_vdom.createVNodeCache;
|
|
12
|
+
exports.getCurrentInstance = require_props.getCurrentInstance;
|
|
17
13
|
exports.h = require_h.h;
|
|
18
|
-
exports.isBlock =
|
|
19
|
-
exports.normalizeNode =
|
|
20
|
-
exports.normalizeVNode =
|
|
21
|
-
exports.setNodes =
|
|
22
|
-
exports.useFullProps =
|
|
23
|
-
exports.useProps =
|
|
14
|
+
exports.isBlock = require_vapor.isBlock;
|
|
15
|
+
exports.normalizeNode = require_vapor.normalizeNode;
|
|
16
|
+
exports.normalizeVNode = require_vdom.normalizeVNode;
|
|
17
|
+
exports.setNodes = require_vapor.setNodes;
|
|
18
|
+
exports.useFullProps = require_props.useFullProps;
|
|
19
|
+
exports.useProps = require_props.useProps;
|
|
24
20
|
Object.defineProperty(exports, 'useRef', {
|
|
25
21
|
enumerable: true,
|
|
26
22
|
get: function () {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { NodeArrayChildren, NodeChild, isBlock, normalizeNode } from "./
|
|
2
|
-
import { createComponent, createComponentWithFallback } from "./component.cjs";
|
|
1
|
+
import { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes } from "./vapor.cjs";
|
|
3
2
|
import { h } from "./h.cjs";
|
|
4
|
-
import { getCurrentInstance, useFullProps, useProps } from "./helpers.cjs";
|
|
5
3
|
import { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler } from "./jsx.cjs";
|
|
6
|
-
import {
|
|
7
|
-
import { createVNodeCache, normalizeVNode } from "./
|
|
8
|
-
import { DefineVaporComponent, DefineVaporSetupFnComponent, FunctionalVaporComponent, ObjectVaporComponent, RenderReturn, TypeEmitsToOptions, VaporComponent, VaporComponentInstance, VaporComponentInstanceConstructor, VaporPublicProps, defineVaporComponent } from "./vue.cjs";
|
|
4
|
+
import { getCurrentInstance, useFullProps, useProps } from "./props.cjs";
|
|
5
|
+
import { createVNodeCache, normalizeVNode } from "./vdom.cjs";
|
|
9
6
|
import { shallowRef as useRef } from "vue";
|
|
10
|
-
export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes,
|
|
7
|
+
export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, NodeArrayChildren, NodeChild, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createComponentWithFallback, createNodes, createVNodeCache, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { NodeArrayChildren, NodeChild, isBlock, normalizeNode } from "./
|
|
2
|
-
import { createComponent, createComponentWithFallback } from "./component.js";
|
|
1
|
+
import { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes } from "./vapor.js";
|
|
3
2
|
import { h } from "./h.js";
|
|
4
|
-
import { getCurrentInstance, useFullProps, useProps } from "./helpers.js";
|
|
5
3
|
import { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler } from "./jsx.js";
|
|
6
|
-
import {
|
|
7
|
-
import { createVNodeCache, normalizeVNode } from "./
|
|
8
|
-
import { DefineVaporComponent, DefineVaporSetupFnComponent, FunctionalVaporComponent, ObjectVaporComponent, RenderReturn, TypeEmitsToOptions, VaporComponent, VaporComponentInstance, VaporComponentInstanceConstructor, VaporPublicProps, defineVaporComponent } from "./vue.js";
|
|
4
|
+
import { getCurrentInstance, useFullProps, useProps } from "./props.js";
|
|
5
|
+
import { createVNodeCache, normalizeVNode } from "./vdom.js";
|
|
9
6
|
import { shallowRef as useRef } from "vue";
|
|
10
|
-
export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes,
|
|
7
|
+
export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, NodeArrayChildren, NodeChild, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createComponentWithFallback, createNodes, createVNodeCache, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { isBlock, normalizeNode } from "./
|
|
2
|
-
import { n as useFullProps, r as useProps, t as getCurrentInstance } from "./helpers-CTg3GxNb.js";
|
|
3
|
-
import { createComponent, createComponentWithFallback } from "./component.js";
|
|
1
|
+
import { createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes } from "./vapor.js";
|
|
4
2
|
import { h } from "./h.js";
|
|
5
3
|
import "./jsx.js";
|
|
6
|
-
import {
|
|
7
|
-
import { createVNodeCache, normalizeVNode } from "./
|
|
8
|
-
import { defineVaporComponent } from "./vue.js";
|
|
4
|
+
import { getCurrentInstance, useFullProps, useProps } from "./props.js";
|
|
5
|
+
import { createVNodeCache, normalizeVNode } from "./vdom.js";
|
|
9
6
|
import { shallowRef as useRef } from "vue";
|
|
10
7
|
|
|
11
|
-
export { createComponent, createComponentWithFallback, createNodes, createVNodeCache,
|
|
8
|
+
export { createComponent, createComponentWithFallback, createNodes, createVNodeCache, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
|
package/dist/jsx.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
import * as CSS from "csstype";
|
|
3
3
|
|
|
4
4
|
//#region src/jsx.d.ts
|
|
@@ -1191,7 +1191,7 @@ interface Events<T = Element> {
|
|
|
1191
1191
|
onTransitionstart: TransitionEventHandler<T>;
|
|
1192
1192
|
}
|
|
1193
1193
|
type EventHandlers<E> = { [K in keyof E]?: E[K] extends ((...args: any) => any) ? E[K] : (payload: E[K]) => void };
|
|
1194
|
-
type _ReservedProps =
|
|
1194
|
+
type _ReservedProps = vue0.ReservedProps;
|
|
1195
1195
|
interface ReservedProps extends _ReservedProps {}
|
|
1196
1196
|
type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps };
|
|
1197
1197
|
interface BaseSyntheticEvent<E = object, C = unknown, T = unknown> {
|
package/dist/jsx.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
import * as CSS from "csstype";
|
|
3
3
|
|
|
4
4
|
//#region src/jsx.d.ts
|
|
@@ -1191,7 +1191,7 @@ interface Events<T = Element> {
|
|
|
1191
1191
|
onTransitionstart: TransitionEventHandler<T>;
|
|
1192
1192
|
}
|
|
1193
1193
|
type EventHandlers<E> = { [K in keyof E]?: E[K] extends ((...args: any) => any) ? E[K] : (payload: E[K]) => void };
|
|
1194
|
-
type _ReservedProps =
|
|
1194
|
+
type _ReservedProps = vue0.ReservedProps;
|
|
1195
1195
|
interface ReservedProps extends _ReservedProps {}
|
|
1196
1196
|
type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps };
|
|
1197
1197
|
interface BaseSyntheticEvent<E = object, C = unknown, T = unknown> {
|
|
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
let vue = require("vue");
|
|
29
29
|
vue = __toESM(vue);
|
|
30
30
|
|
|
31
|
-
//#region src/
|
|
31
|
+
//#region src/props.ts
|
|
32
32
|
function getCurrentInstance() {
|
|
33
33
|
return vue.currentInstance || vue.getCurrentInstance();
|
|
34
34
|
}
|
package/dist/props.cjs
ADDED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { GenericComponentInstance } from "vue";
|
|
1
|
+
import * as vue0 from "vue";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
5
|
-
declare function getCurrentInstance(): GenericComponentInstance | null;
|
|
3
|
+
//#region src/props.d.ts
|
|
4
|
+
declare function getCurrentInstance(): vue0.GenericComponentInstance | null;
|
|
6
5
|
/**
|
|
7
6
|
* Returns the props of the current component instance.
|
|
8
7
|
*
|
|
@@ -30,8 +29,8 @@ declare function useProps(): {
|
|
|
30
29
|
* const fullProps = useFullProps() // = useAttrs() + useProps()
|
|
31
30
|
* })
|
|
32
31
|
*/
|
|
33
|
-
declare function useFullProps():
|
|
34
|
-
[x: string]:
|
|
32
|
+
declare function useFullProps(): vue0.ShallowUnwrapRef<{
|
|
33
|
+
[x: string]: vue0.Ref<unknown, unknown>;
|
|
35
34
|
}>;
|
|
36
35
|
//#endregion
|
|
37
36
|
export { getCurrentInstance, useFullProps, useProps };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { GenericComponentInstance } from "vue";
|
|
1
|
+
import * as vue0 from "vue";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
5
|
-
declare function getCurrentInstance(): GenericComponentInstance | null;
|
|
3
|
+
//#region src/props.d.ts
|
|
4
|
+
declare function getCurrentInstance(): vue0.GenericComponentInstance | null;
|
|
6
5
|
/**
|
|
7
6
|
* Returns the props of the current component instance.
|
|
8
7
|
*
|
|
@@ -30,8 +29,8 @@ declare function useProps(): {
|
|
|
30
29
|
* const fullProps = useFullProps() // = useAttrs() + useProps()
|
|
31
30
|
* })
|
|
32
31
|
*/
|
|
33
|
-
declare function useFullProps():
|
|
34
|
-
[x: string]:
|
|
32
|
+
declare function useFullProps(): vue0.ShallowUnwrapRef<{
|
|
33
|
+
[x: string]: vue0.Ref<unknown, unknown>;
|
|
35
34
|
}>;
|
|
36
35
|
//#endregion
|
|
37
36
|
export { getCurrentInstance, useFullProps, useProps };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Vue from "vue";
|
|
2
2
|
import { proxyRefs, toRefs, useAttrs } from "vue";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
5
|
-
function getCurrentInstance
|
|
4
|
+
//#region src/props.ts
|
|
5
|
+
function getCurrentInstance() {
|
|
6
6
|
return Vue.currentInstance || Vue.getCurrentInstance();
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
@@ -18,7 +18,7 @@ function getCurrentInstance$1() {
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
function useProps() {
|
|
21
|
-
return getCurrentInstance
|
|
21
|
+
return getCurrentInstance().props;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Returns the merged props and attrs of the current component.\
|
|
@@ -40,4 +40,4 @@ function useFullProps() {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
//#endregion
|
|
43
|
-
export { useFullProps
|
|
43
|
+
export { getCurrentInstance, useFullProps, useProps };
|
package/dist/raw.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/props.ts?raw
|
|
3
|
+
var props_default = "import { proxyRefs, toRefs, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\nexport function useProps() {\n const i = getCurrentInstance();\n return i.props;\n}\nexport function useFullProps() {\n return proxyRefs({\n ...toRefs(useProps()),\n ...toRefs(useAttrs())\n });\n}\n";
|
|
4
|
+
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/vapor.ts?raw
|
|
7
|
+
var vapor_default = "import {\n createComponent as _createComponent,\n createComponentWithFallback as _createComponentWithFallback,\n createTextNode,\n currentInstance,\n EffectScope,\n Fragment,\n getCurrentInstance,\n insert,\n isFragment,\n isVaporComponent,\n remove,\n renderEffect,\n VaporFragment\n} from \"vue\";\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(_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 _createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(_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 = 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 createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || isFragment(node)) {\n anchor && (anchor.textContent = \"\");\n return node;\n } else if (isVaporComponent(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n anchor && (anchor.textContent = \"\");\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 const node = normalizeBlock(value, _anchor);\n if (current) {\n if (isFragment(current)) {\n const { anchor } = current;\n if (anchor && anchor.parentNode) {\n remove(current.nodes, anchor.parentNode);\n insert(node, anchor.parentNode, anchor);\n !_anchor && anchor.parentNode.removeChild(anchor);\n }\n } else if (current instanceof Node) {\n if (isFragment(node) && current.parentNode) {\n insert(node, current.parentNode, current);\n current.parentNode.removeChild(current);\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 frag = createFragment(nodes, _anchor);\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 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 frag;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/vdom.ts?raw
|
|
11
|
+
var vdom_default = "import {\n cloneVNode,\n createBlock,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n Text\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(index) {\n const i = getCurrentInstance();\n if (i) {\n !cacheMap.has(i) && cacheMap.set(i, []);\n const caches = cacheMap.get(i);\n return caches[index] || (caches[index] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value = \" \", flag = 1) {\n let create = createVNode;\n const isFunction = typeof value === \"function\";\n if (isFunction) {\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isFunction ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? create(\n Fragment,\n null,\n value.map((n) => normalizeVNode(n))\n ) : create(\n Text,\n null,\n value == null || typeof value === \"boolean\" ? \"\" : String(value),\n flag\n );\n}\nfunction cloneIfMounted(child) {\n return child.el === null && child.patchFlag !== -1 || // @ts-ignore\n child.memo ? child : cloneVNode(child);\n}\n";
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/raw.ts
|
|
15
|
+
const propsHelperCode = props_default;
|
|
16
|
+
const vdomHelperCode = vdom_default;
|
|
17
|
+
const vaporHelperCode = vapor_default;
|
|
18
|
+
const propsHelperId = "/vue-jsx-vapor/props";
|
|
19
|
+
const vdomHelperId = "/vue-jsx-vapor/vdom";
|
|
20
|
+
const vaporHelperId = "/vue-jsx-vapor/vapor";
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.propsHelperCode = propsHelperCode;
|
|
24
|
+
exports.propsHelperId = propsHelperId;
|
|
25
|
+
exports.vaporHelperCode = vaporHelperCode;
|
|
26
|
+
exports.vaporHelperId = vaporHelperId;
|
|
27
|
+
exports.vdomHelperCode = vdomHelperCode;
|
|
28
|
+
exports.vdomHelperId = vdomHelperId;
|
package/dist/raw.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/raw.d.ts
|
|
2
|
+
declare const propsHelperCode: string;
|
|
3
|
+
declare const vdomHelperCode: string;
|
|
4
|
+
declare const vaporHelperCode: string;
|
|
5
|
+
declare const propsHelperId = "/vue-jsx-vapor/props";
|
|
6
|
+
declare const vdomHelperId = "/vue-jsx-vapor/vdom";
|
|
7
|
+
declare const vaporHelperId = "/vue-jsx-vapor/vapor";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { propsHelperCode, propsHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
|
package/dist/raw.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/raw.d.ts
|
|
2
|
+
declare const propsHelperCode: string;
|
|
3
|
+
declare const vdomHelperCode: string;
|
|
4
|
+
declare const vaporHelperCode: string;
|
|
5
|
+
declare const propsHelperId = "/vue-jsx-vapor/props";
|
|
6
|
+
declare const vdomHelperId = "/vue-jsx-vapor/vdom";
|
|
7
|
+
declare const vaporHelperId = "/vue-jsx-vapor/vapor";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { propsHelperCode, propsHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
|
package/dist/raw.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/props.ts?raw
|
|
2
|
+
var props_default = "import { proxyRefs, toRefs, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\nexport function useProps() {\n const i = getCurrentInstance();\n return i.props;\n}\nexport function useFullProps() {\n return proxyRefs({\n ...toRefs(useProps()),\n ...toRefs(useAttrs())\n });\n}\n";
|
|
3
|
+
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/vapor.ts?raw
|
|
6
|
+
var vapor_default = "import {\n createComponent as _createComponent,\n createComponentWithFallback as _createComponentWithFallback,\n createTextNode,\n currentInstance,\n EffectScope,\n Fragment,\n getCurrentInstance,\n insert,\n isFragment,\n isVaporComponent,\n remove,\n renderEffect,\n VaporFragment\n} from \"vue\";\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(_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 _createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(_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 = 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 createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || isFragment(node)) {\n anchor && (anchor.textContent = \"\");\n return node;\n } else if (isVaporComponent(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n anchor && (anchor.textContent = \"\");\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 const node = normalizeBlock(value, _anchor);\n if (current) {\n if (isFragment(current)) {\n const { anchor } = current;\n if (anchor && anchor.parentNode) {\n remove(current.nodes, anchor.parentNode);\n insert(node, anchor.parentNode, anchor);\n !_anchor && anchor.parentNode.removeChild(anchor);\n }\n } else if (current instanceof Node) {\n if (isFragment(node) && current.parentNode) {\n insert(node, current.parentNode, current);\n current.parentNode.removeChild(current);\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 frag = createFragment(nodes, _anchor);\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 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 frag;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/vdom.ts?raw
|
|
10
|
+
var vdom_default = "import {\n cloneVNode,\n createBlock,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n Text\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(index) {\n const i = getCurrentInstance();\n if (i) {\n !cacheMap.has(i) && cacheMap.set(i, []);\n const caches = cacheMap.get(i);\n return caches[index] || (caches[index] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value = \" \", flag = 1) {\n let create = createVNode;\n const isFunction = typeof value === \"function\";\n if (isFunction) {\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isFunction ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? create(\n Fragment,\n null,\n value.map((n) => normalizeVNode(n))\n ) : create(\n Text,\n null,\n value == null || typeof value === \"boolean\" ? \"\" : String(value),\n flag\n );\n}\nfunction cloneIfMounted(child) {\n return child.el === null && child.patchFlag !== -1 || // @ts-ignore\n child.memo ? child : cloneVNode(child);\n}\n";
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/raw.ts
|
|
14
|
+
const propsHelperCode = props_default;
|
|
15
|
+
const vdomHelperCode = vdom_default;
|
|
16
|
+
const vaporHelperCode = vapor_default;
|
|
17
|
+
const propsHelperId = "/vue-jsx-vapor/props";
|
|
18
|
+
const vdomHelperId = "/vue-jsx-vapor/vdom";
|
|
19
|
+
const vaporHelperId = "/vue-jsx-vapor/vapor";
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { propsHelperCode, propsHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
|
|
@@ -1,13 +1,59 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_props = require('./props-DyKlXDej.cjs');
|
|
2
2
|
let vue = require("vue");
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/vapor.ts
|
|
5
|
+
const createComponent = (type, ...args) => {
|
|
6
|
+
return createProxyComponent(vue.createComponent, type, ...args);
|
|
7
|
+
};
|
|
8
|
+
const createComponentWithFallback = (type, ...args) => {
|
|
9
|
+
const slots = args[1];
|
|
10
|
+
if (typeof type === "string" && slots && slots.default && typeof slots.default === "function") {
|
|
11
|
+
const defaultSlot = slots.default;
|
|
12
|
+
slots.default = () => {
|
|
13
|
+
return createProxyComponent(vue.createComponentWithFallback, defaultSlot, null, null);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return createProxyComponent(vue.createComponentWithFallback, type, ...args);
|
|
17
|
+
};
|
|
18
|
+
const createProxyComponent = (createComponent$1, type, props, ...args) => {
|
|
19
|
+
if (type === vue.Fragment) {
|
|
20
|
+
type = (_, { slots }) => slots.default ? slots.default() : [];
|
|
21
|
+
props = null;
|
|
22
|
+
}
|
|
23
|
+
const i = vue.currentInstance || (0, vue.getCurrentInstance)();
|
|
24
|
+
if (!type.__proxyed) {
|
|
25
|
+
if (typeof type === "function") type = new Proxy(type, {
|
|
26
|
+
apply(target, ctx, args$1) {
|
|
27
|
+
if (typeof target.__setup === "function") target.__setup.apply(ctx, args$1);
|
|
28
|
+
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
29
|
+
},
|
|
30
|
+
get(target, p, receiver) {
|
|
31
|
+
if ((i && i.appContext).vapor && p === "__vapor") return true;
|
|
32
|
+
return Reflect.get(target, p, receiver);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
else if (type.__vapor && type.setup) type.setup = new Proxy(type.setup, { apply(target, ctx, args$1) {
|
|
36
|
+
return normalizeNode(Reflect.apply(target, ctx, args$1));
|
|
37
|
+
} });
|
|
38
|
+
type.__proxyed = true;
|
|
39
|
+
}
|
|
40
|
+
return createComponent$1(type, props, ...args);
|
|
41
|
+
};
|
|
42
|
+
function normalizeNode(node) {
|
|
43
|
+
if (node == null || typeof node === "boolean") return document.createComment("");
|
|
44
|
+
else if (Array.isArray(node) && node.length) return node.map(normalizeNode);
|
|
45
|
+
else if (isBlock(node)) return node;
|
|
46
|
+
else return (0, vue.createTextNode)(String(node));
|
|
47
|
+
}
|
|
48
|
+
function isBlock(val) {
|
|
49
|
+
return val instanceof Node || Array.isArray(val) || (0, vue.isVaporComponent)(val) || (0, vue.isFragment)(val);
|
|
50
|
+
}
|
|
5
51
|
function createFragment(nodes, anchor = document.createTextNode("")) {
|
|
6
52
|
const frag = new vue.VaporFragment(nodes);
|
|
7
53
|
frag.anchor = anchor;
|
|
8
54
|
return frag;
|
|
9
55
|
}
|
|
10
|
-
function
|
|
56
|
+
function normalizeBlock(node, anchor) {
|
|
11
57
|
if (node instanceof Node || (0, vue.isFragment)(node)) {
|
|
12
58
|
anchor && (anchor.textContent = "");
|
|
13
59
|
return node;
|
|
@@ -16,7 +62,7 @@ function normalizeNode(node, anchor) {
|
|
|
16
62
|
return createFragment(node, anchor);
|
|
17
63
|
} else if (Array.isArray(node)) {
|
|
18
64
|
anchor && (anchor.textContent = "");
|
|
19
|
-
return createFragment(node.map((i) =>
|
|
65
|
+
return createFragment(node.map((i) => normalizeBlock(i)), anchor);
|
|
20
66
|
} else {
|
|
21
67
|
const result = node == null || typeof node === "boolean" ? "" : String(node);
|
|
22
68
|
if (anchor) {
|
|
@@ -26,7 +72,7 @@ function normalizeNode(node, anchor) {
|
|
|
26
72
|
}
|
|
27
73
|
}
|
|
28
74
|
function resolveValue(current, value, _anchor) {
|
|
29
|
-
const node =
|
|
75
|
+
const node = normalizeBlock(value, _anchor);
|
|
30
76
|
if (current) {
|
|
31
77
|
if ((0, vue.isFragment)(current)) {
|
|
32
78
|
const { anchor } = current;
|
|
@@ -73,5 +119,9 @@ function createNodes(...values) {
|
|
|
73
119
|
}
|
|
74
120
|
|
|
75
121
|
//#endregion
|
|
122
|
+
exports.createComponent = createComponent;
|
|
123
|
+
exports.createComponentWithFallback = createComponentWithFallback;
|
|
76
124
|
exports.createNodes = createNodes;
|
|
125
|
+
exports.isBlock = isBlock;
|
|
126
|
+
exports.normalizeNode = normalizeNode;
|
|
77
127
|
exports.setNodes = setNodes;
|
package/dist/vapor.d.cts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as vue1 from "vue";
|
|
2
|
+
import { Block, Fragment, VaporComponent, VaporFragment, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1 } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/vapor.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>>) => vue1.VaporComponentInstance | HTMLElement;
|
|
7
|
+
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback$1>>) => vue1.VaporComponentInstance | HTMLElement;
|
|
8
|
+
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
9
|
+
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
10
|
+
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
|
11
|
+
declare function normalizeNode(node: NodeChild): Block;
|
|
12
|
+
declare function isBlock(val: NonNullable<unknown>): val is Block;
|
|
13
|
+
declare function setNodes(anchor: Node, ...values: any[]): void;
|
|
14
|
+
declare function createNodes(...values: any[]): VaporFragment;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes };
|
package/dist/vapor.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as vue1 from "vue";
|
|
2
|
+
import { Block, Fragment, VaporComponent, VaporFragment, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1 } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/vapor.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>>) => vue1.VaporComponentInstance | HTMLElement;
|
|
7
|
+
declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback$1>>) => vue1.VaporComponentInstance | HTMLElement;
|
|
8
|
+
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
9
|
+
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
10
|
+
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
|
11
|
+
declare function normalizeNode(node: NodeChild): Block;
|
|
12
|
+
declare function isBlock(val: NonNullable<unknown>): val is Block;
|
|
13
|
+
declare function setNodes(anchor: Node, ...values: any[]): void;
|
|
14
|
+
declare function createNodes(...values: any[]): VaporFragment;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes };
|