@vue-jsx-vapor/runtime 3.1.22 → 3.2.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/dist/h.cjs +24 -15
- package/dist/h.d.cts +16 -30
- package/dist/h.d.ts +16 -30
- package/dist/h.js +23 -16
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/jsx.d.cts +2 -4
- package/dist/jsx.d.ts +2 -4
- package/dist/raw.cjs +1 -1
- package/dist/raw.js +1 -1
- package/dist/vapor.cjs +29 -35
- package/dist/vapor.d.cts +5 -5
- package/dist/vapor.d.ts +5 -5
- package/dist/vapor.js +29 -35
- package/package.json +1 -1
package/dist/h.cjs
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
1
2
|
const require_vapor = require('./vapor.cjs');
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
vue = require_chunk.__toESM(vue);
|
|
2
5
|
|
|
3
6
|
//#region src/h.ts
|
|
4
7
|
/* @__NO_SIDE_EFFECTS__ */
|
|
5
|
-
function h(type,
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
}
|
|
8
|
+
function h(type, props, children) {
|
|
9
|
+
const { props: resolvedProps, key, ref } = resolveProps(props);
|
|
10
|
+
const render = () => {
|
|
11
|
+
const comp = require_vapor.createComponent(type, resolvedProps, children ? typeof children === "object" && !Array.isArray(children) ? new Proxy(children, { get: (target, key, receiver) => require_vapor.createProxyComponent(Reflect.get(target, key, receiver), require_vapor.normalizeNode) }) : { default: typeof children === "function" ? require_vapor.createProxyComponent(children, require_vapor.normalizeNode) : () => require_vapor.normalizeNode(children) } : void 0);
|
|
12
|
+
if (ref) {
|
|
13
|
+
const setRef = vue.createTemplateRefSetter();
|
|
14
|
+
vue.renderEffect(() => setRef(comp, ref));
|
|
15
|
+
}
|
|
16
|
+
return comp;
|
|
17
|
+
};
|
|
18
|
+
return key ? vue.createKeyedFragment(key, render) : render();
|
|
15
19
|
}
|
|
20
|
+
const EVENT_REGEX = /^on[A-Z]/;
|
|
16
21
|
function resolveProps(props) {
|
|
22
|
+
const resolvedProps = { props: {} };
|
|
17
23
|
if (props) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
for (const p in props) {
|
|
25
|
+
const isFuncton = typeof props[p] === "function";
|
|
26
|
+
if (p === "key") resolvedProps.key = isFuncton ? props[p] : () => props[p];
|
|
27
|
+
else if (p === "ref") resolvedProps.ref = props[p];
|
|
28
|
+
else if (EVENT_REGEX.test(p)) resolvedProps.props[p] = () => props[p];
|
|
29
|
+
else resolvedProps.props[p] = props[p];
|
|
30
|
+
}
|
|
22
31
|
return resolvedProps;
|
|
23
32
|
}
|
|
24
|
-
return
|
|
33
|
+
return resolvedProps;
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
//#endregion
|
package/dist/h.d.cts
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Block, Component,
|
|
1
|
+
import { NodeChild } from "./vapor.cjs";
|
|
2
|
+
import { Block, Component, EmitsOptions, Fragment, FunctionalVaporComponent, NodeRef, Suspense, SuspenseProps, TeleportProps, VaporComponent, VaporTeleport } from "vue";
|
|
3
3
|
|
|
4
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
5
|
type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare function h(type:
|
|
23
|
-
declare function h(type: typeof Fragment, props?:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}> | null, children?:
|
|
27
|
-
declare function h(type:
|
|
28
|
-
declare function h(type: typeof Suspense, children?: NodeChild): Block;
|
|
29
|
-
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps & SuspenseProps> | null, children?: NodeChild): Block;
|
|
30
|
-
declare function h(type: FunctionalComponent, children?: NodeChild): Block;
|
|
31
|
-
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): Block;
|
|
32
|
-
declare function h(type: string | ConcreteComponent | Component | ComponentOptions | Constructor | DefineComponent, children?: NodeChild): Block;
|
|
33
|
-
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): Block;
|
|
6
|
+
type ReservedProps = {
|
|
7
|
+
key?: () => PropertyKey;
|
|
8
|
+
ref?: NodeRef;
|
|
9
|
+
};
|
|
10
|
+
type RawProps = Record<string, any> & ReservedProps;
|
|
11
|
+
type RawSlot = (...args: any[]) => NodeChild;
|
|
12
|
+
type RawChildren = NodeChild | RawSlot;
|
|
13
|
+
type RawSlots = Record<string, RawSlot>;
|
|
14
|
+
declare function h<K extends string>(type: K, props?: (RawProps & (K extends keyof HTMLElementTagNameMap ? HTMLElementEventHandler : {})) | null, children?: K extends keyof HTMLElementTagNameMap ? RawChildren : RawChildren | RawSlots): Block;
|
|
15
|
+
declare function h(type: typeof Fragment, props?: ReservedProps | null, children?: RawChildren): Block;
|
|
16
|
+
declare function h(type: typeof VaporTeleport, props: RawProps & TeleportProps, children: RawChildren | RawSlots): Block;
|
|
17
|
+
declare function h(type: typeof Suspense, props?: (RawProps & SuspenseProps) | null, children?: RawChildren | RawSlots): Block;
|
|
18
|
+
declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = RawSlots>(type: FunctionalVaporComponent<P, E, S>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | S): Block;
|
|
19
|
+
declare function h(type: Component | VaporComponent, props?: RawProps, children?: RawChildren | RawSlots): Block;
|
|
34
20
|
//#endregion
|
|
35
21
|
export { h };
|
package/dist/h.d.ts
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Block, Component,
|
|
1
|
+
import { NodeChild } from "./vapor.js";
|
|
2
|
+
import { Block, Component, EmitsOptions, Fragment, FunctionalVaporComponent, NodeRef, Suspense, SuspenseProps, TeleportProps, VaporComponent, VaporTeleport } from "vue";
|
|
3
3
|
|
|
4
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
5
|
type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare function h(type:
|
|
23
|
-
declare function h(type: typeof Fragment, props?:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}> | null, children?:
|
|
27
|
-
declare function h(type:
|
|
28
|
-
declare function h(type: typeof Suspense, children?: NodeChild): Block;
|
|
29
|
-
declare function h(type: typeof Suspense, props?: ResolveProps<RawProps & SuspenseProps> | null, children?: NodeChild): Block;
|
|
30
|
-
declare function h(type: FunctionalComponent, children?: NodeChild): Block;
|
|
31
|
-
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): Block;
|
|
32
|
-
declare function h(type: string | ConcreteComponent | Component | ComponentOptions | Constructor | DefineComponent, children?: NodeChild): Block;
|
|
33
|
-
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): Block;
|
|
6
|
+
type ReservedProps = {
|
|
7
|
+
key?: () => PropertyKey;
|
|
8
|
+
ref?: NodeRef;
|
|
9
|
+
};
|
|
10
|
+
type RawProps = Record<string, any> & ReservedProps;
|
|
11
|
+
type RawSlot = (...args: any[]) => NodeChild;
|
|
12
|
+
type RawChildren = NodeChild | RawSlot;
|
|
13
|
+
type RawSlots = Record<string, RawSlot>;
|
|
14
|
+
declare function h<K extends string>(type: K, props?: (RawProps & (K extends keyof HTMLElementTagNameMap ? HTMLElementEventHandler : {})) | null, children?: K extends keyof HTMLElementTagNameMap ? RawChildren : RawChildren | RawSlots): Block;
|
|
15
|
+
declare function h(type: typeof Fragment, props?: ReservedProps | null, children?: RawChildren): Block;
|
|
16
|
+
declare function h(type: typeof VaporTeleport, props: RawProps & TeleportProps, children: RawChildren | RawSlots): Block;
|
|
17
|
+
declare function h(type: typeof Suspense, props?: (RawProps & SuspenseProps) | null, children?: RawChildren | RawSlots): Block;
|
|
18
|
+
declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = RawSlots>(type: FunctionalVaporComponent<P, E, S>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | S): Block;
|
|
19
|
+
declare function h(type: Component | VaporComponent, props?: RawProps, children?: RawChildren | RawSlots): Block;
|
|
34
20
|
//#endregion
|
|
35
21
|
export { h };
|
package/dist/h.js
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createComponent, createProxyComponent, normalizeNode } from "./vapor.js";
|
|
2
|
+
import * as Vue from "vue";
|
|
2
3
|
|
|
3
4
|
//#region src/h.ts
|
|
4
5
|
/* @__NO_SIDE_EFFECTS__ */
|
|
5
|
-
function h(type,
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
}
|
|
6
|
+
function h(type, props, children) {
|
|
7
|
+
const { props: resolvedProps, key, ref } = resolveProps(props);
|
|
8
|
+
const render = () => {
|
|
9
|
+
const comp = createComponent(type, resolvedProps, children ? typeof children === "object" && !Array.isArray(children) ? new Proxy(children, { get: (target, key, receiver) => createProxyComponent(Reflect.get(target, key, receiver), normalizeNode) }) : { default: typeof children === "function" ? createProxyComponent(children, normalizeNode) : () => normalizeNode(children) } : void 0);
|
|
10
|
+
if (ref) {
|
|
11
|
+
const setRef = Vue.createTemplateRefSetter();
|
|
12
|
+
Vue.renderEffect(() => setRef(comp, ref));
|
|
13
|
+
}
|
|
14
|
+
return comp;
|
|
15
|
+
};
|
|
16
|
+
return key ? Vue.createKeyedFragment(key, render) : render();
|
|
15
17
|
}
|
|
18
|
+
const EVENT_REGEX = /^on[A-Z]/;
|
|
16
19
|
function resolveProps(props) {
|
|
20
|
+
const resolvedProps = { props: {} };
|
|
17
21
|
if (props) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
for (const p in props) {
|
|
23
|
+
const isFuncton = typeof props[p] === "function";
|
|
24
|
+
if (p === "key") resolvedProps.key = isFuncton ? props[p] : () => props[p];
|
|
25
|
+
else if (p === "ref") resolvedProps.ref = props[p];
|
|
26
|
+
else if (EVENT_REGEX.test(p)) resolvedProps.props[p] = () => props[p];
|
|
27
|
+
else resolvedProps.props[p] = props[p];
|
|
28
|
+
}
|
|
22
29
|
return resolvedProps;
|
|
23
30
|
}
|
|
24
|
-
return
|
|
31
|
+
return resolvedProps;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
//#endregion
|
package/dist/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@ const require_vdom = require('./vdom.cjs');
|
|
|
8
8
|
let vue = require("vue");
|
|
9
9
|
|
|
10
10
|
exports.createComponent = require_vapor.createComponent;
|
|
11
|
-
exports.createComponentWithFallback = require_vapor.createComponentWithFallback;
|
|
12
11
|
exports.createNodes = require_vapor.createNodes;
|
|
12
|
+
exports.createProxyComponent = require_vapor.createProxyComponent;
|
|
13
13
|
exports.createVNodeCache = require_vdom.createVNodeCache;
|
|
14
14
|
exports.defineVaporSSRComponent = require_vapor.defineVaporSSRComponent;
|
|
15
15
|
exports.getCurrentInstance = require_props.getCurrentInstance;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NodeArrayChildren, NodeChild, createComponent,
|
|
1
|
+
import { NodeArrayChildren, NodeChild, createComponent, createNodes, createProxyComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.cjs";
|
|
2
2
|
import { h } from "./h.cjs";
|
|
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,
|
|
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, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler } from "./jsx.cjs";
|
|
4
4
|
import { getCurrentInstance, useFullProps, useProps } from "./props.cjs";
|
|
5
5
|
import { ssrRegisterHelper } from "./ssr.cjs";
|
|
6
6
|
import { createVNodeCache, normalizeVNode } from "./vdom.cjs";
|
|
7
7
|
import { shallowRef as useRef } from "vue";
|
|
8
|
-
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,
|
|
8
|
+
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, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createNodes, createProxyComponent, createVNodeCache, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NodeArrayChildren, NodeChild, createComponent,
|
|
1
|
+
import { NodeArrayChildren, NodeChild, createComponent, createNodes, createProxyComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.js";
|
|
2
2
|
import { h } from "./h.js";
|
|
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,
|
|
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, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler } from "./jsx.js";
|
|
4
4
|
import { getCurrentInstance, useFullProps, useProps } from "./props.js";
|
|
5
5
|
import { ssrRegisterHelper } from "./ssr.js";
|
|
6
6
|
import { createVNodeCache, normalizeVNode } from "./vdom.js";
|
|
7
7
|
import { shallowRef as useRef } from "vue";
|
|
8
|
-
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,
|
|
8
|
+
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, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createNodes, createProxyComponent, createVNodeCache, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent,
|
|
1
|
+
import { createComponent, createNodes, createProxyComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.js";
|
|
2
2
|
import { h } from "./h.js";
|
|
3
3
|
import "./jsx.js";
|
|
4
4
|
import { getCurrentInstance, useFullProps, useProps } from "./props.js";
|
|
@@ -6,4 +6,4 @@ import { ssrRegisterHelper } from "./ssr.js";
|
|
|
6
6
|
import { createVNodeCache, normalizeVNode } from "./vdom.js";
|
|
7
7
|
import { shallowRef as useRef } from "vue";
|
|
8
8
|
|
|
9
|
-
export { createComponent,
|
|
9
|
+
export { createComponent, createNodes, createProxyComponent, createVNodeCache, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
|
package/dist/jsx.d.cts
CHANGED
|
@@ -1191,9 +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
|
|
1195
|
-
interface ReservedProps extends _ReservedProps {}
|
|
1196
|
-
type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps };
|
|
1194
|
+
type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & vue0.ReservedProps };
|
|
1197
1195
|
interface BaseSyntheticEvent<E = object, C = unknown, T = unknown> {
|
|
1198
1196
|
nativeEvent: E;
|
|
1199
1197
|
currentTarget: C;
|
|
@@ -1323,4 +1321,4 @@ interface TransitionEvent<T = Element> extends SyntheticEvent<T, globalThis.Tran
|
|
|
1323
1321
|
}
|
|
1324
1322
|
type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
|
|
1325
1323
|
//#endregion
|
|
1326
|
-
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, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes,
|
|
1324
|
+
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, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler };
|
package/dist/jsx.d.ts
CHANGED
|
@@ -1191,9 +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
|
|
1195
|
-
interface ReservedProps extends _ReservedProps {}
|
|
1196
|
-
type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps };
|
|
1194
|
+
type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & vue0.ReservedProps };
|
|
1197
1195
|
interface BaseSyntheticEvent<E = object, C = unknown, T = unknown> {
|
|
1198
1196
|
nativeEvent: E;
|
|
1199
1197
|
currentTarget: C;
|
|
@@ -1323,4 +1321,4 @@ interface TransitionEvent<T = Element> extends SyntheticEvent<T, globalThis.Tran
|
|
|
1323
1321
|
}
|
|
1324
1322
|
type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
|
|
1325
1323
|
//#endregion
|
|
1326
|
-
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, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes,
|
|
1324
|
+
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, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler };
|
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
|
|
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 if (type === Fragment) {\n const slots = args[1];\n return slots && typeof slots.default === \"function\" ? slots.default() : [];\n }\n return Vue.createComponentWithFallback(\n createProxyComponent(Vue.resolveDynamicComponent(type)),\n ...args\n );\n};\nconst proxyCache = /* @__PURE__ */ new WeakMap();\nexport function createProxyComponent(type, normalizeNode2) {\n if (typeof type === \"function\") {\n const existing = proxyCache.get(type);\n if (existing) return existing;\n const i = Vue.currentInstance || getCurrentInstance();\n const proxy = new Proxy(type, {\n apply(target, ctx, args) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args);\n }\n const node = Reflect.apply(target, ctx, args);\n return normalizeNode2 ? normalizeNode2(node) : node;\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 proxyCache.set(type, proxy);\n return proxy;\n }\n return type;\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 if (typeof node === \"function\") {\n return resolveValues([node], void 0, true)[0];\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, processFunction = false) {\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, void 0, processFunction)),\n anchor\n );\n } else if (processFunction && typeof node === \"function\") {\n return resolveValues([node], anchor, true)[0];\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, processFunction = false) {\n anchor = anchor || (current instanceof Node && current.nodeType === 3 ? current : void 0);\n const node = normalizeBlock(value, anchor, processFunction);\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 if (!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, processFunction = false) {\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, processFunction)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor, processFunction);\n }\n }\n return nodes;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n if (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
|
|
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 if (type === Fragment) {\n const slots = args[1];\n return slots && typeof slots.default === \"function\" ? slots.default() : [];\n }\n return Vue.createComponentWithFallback(\n createProxyComponent(Vue.resolveDynamicComponent(type)),\n ...args\n );\n};\nconst proxyCache = /* @__PURE__ */ new WeakMap();\nexport function createProxyComponent(type, normalizeNode2) {\n if (typeof type === \"function\") {\n const existing = proxyCache.get(type);\n if (existing) return existing;\n const i = Vue.currentInstance || getCurrentInstance();\n const proxy = new Proxy(type, {\n apply(target, ctx, args) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args);\n }\n const node = Reflect.apply(target, ctx, args);\n return normalizeNode2 ? normalizeNode2(node) : node;\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 proxyCache.set(type, proxy);\n return proxy;\n }\n return type;\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 if (typeof node === \"function\") {\n return resolveValues([node], void 0, true)[0];\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, processFunction = false) {\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, void 0, processFunction)),\n anchor\n );\n } else if (processFunction && typeof node === \"function\") {\n return resolveValues([node], anchor, true)[0];\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, processFunction = false) {\n anchor = anchor || (current instanceof Node && current.nodeType === 3 ? current : void 0);\n const node = normalizeBlock(value, anchor, processFunction);\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 if (!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, processFunction = false) {\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, processFunction)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor, processFunction);\n }\n }\n return nodes;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n if (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
|
@@ -21,46 +21,39 @@ function defineVaporSSRComponent(comp, extraOptions) {
|
|
|
21
21
|
return comp;
|
|
22
22
|
}
|
|
23
23
|
const createComponent = (type, ...args) => {
|
|
24
|
-
return createProxyComponent(vue.createComponent, type, ...args);
|
|
25
|
-
};
|
|
26
|
-
const createComponentWithFallback = (type, ...args) => {
|
|
27
|
-
const slots = args[1];
|
|
28
|
-
if (typeof type === "string" && slots && slots.default && typeof slots.default === "function") {
|
|
29
|
-
const defaultSlot = slots.default;
|
|
30
|
-
slots.default = () => {
|
|
31
|
-
return createProxyComponent(vue.createComponentWithFallback, defaultSlot, null, null);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return createProxyComponent(vue.createComponentWithFallback, type, ...args);
|
|
35
|
-
};
|
|
36
|
-
const createProxyComponent = (createComponent, type, props, ...args) => {
|
|
37
24
|
if (type === vue.Fragment) {
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
const slots = args[1];
|
|
26
|
+
return slots && typeof slots.default === "function" ? slots.default() : [];
|
|
40
27
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
return vue.createComponentWithFallback(createProxyComponent(vue.resolveDynamicComponent(type)), ...args);
|
|
29
|
+
};
|
|
30
|
+
const proxyCache = /* @__PURE__ */ new WeakMap();
|
|
31
|
+
function createProxyComponent(type, normalizeNode) {
|
|
32
|
+
if (typeof type === "function") {
|
|
33
|
+
const existing = proxyCache.get(type);
|
|
34
|
+
if (existing) return existing;
|
|
35
|
+
const i = vue.currentInstance || (0, vue.getCurrentInstance)();
|
|
36
|
+
const proxy = new Proxy(type, {
|
|
44
37
|
apply(target, ctx, args) {
|
|
45
38
|
if (typeof target.__setup === "function") target.__setup.apply(ctx, args);
|
|
46
|
-
|
|
39
|
+
const node = Reflect.apply(target, ctx, args);
|
|
40
|
+
return normalizeNode ? normalizeNode(node) : node;
|
|
47
41
|
},
|
|
48
42
|
get(target, p, receiver) {
|
|
49
43
|
if (i && i.appContext.vapor && p === "__vapor") return true;
|
|
50
44
|
return Reflect.get(target, p, receiver);
|
|
51
45
|
}
|
|
52
46
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} });
|
|
56
|
-
type.__proxyed = true;
|
|
47
|
+
proxyCache.set(type, proxy);
|
|
48
|
+
return proxy;
|
|
57
49
|
}
|
|
58
|
-
return
|
|
59
|
-
}
|
|
50
|
+
return type;
|
|
51
|
+
}
|
|
60
52
|
function normalizeNode(node) {
|
|
61
53
|
if (node == null || typeof node === "boolean") return document.createComment("");
|
|
62
54
|
else if (Array.isArray(node) && node.length) return node.map(normalizeNode);
|
|
63
55
|
else if (isBlock(node)) return node;
|
|
56
|
+
else if (typeof node === "function") return resolveValues([node], void 0, true)[0];
|
|
64
57
|
else return document.createTextNode(String(node));
|
|
65
58
|
}
|
|
66
59
|
function isBlock(val) {
|
|
@@ -71,10 +64,11 @@ function createFragment(nodes, anchor = document.createTextNode("")) {
|
|
|
71
64
|
frag.anchor = anchor;
|
|
72
65
|
return frag;
|
|
73
66
|
}
|
|
74
|
-
function normalizeBlock(node, anchor) {
|
|
67
|
+
function normalizeBlock(node, anchor, processFunction = false) {
|
|
75
68
|
if (node instanceof Node || vue.isFragment(node)) return node;
|
|
76
69
|
else if (vue.isVaporComponent(node)) return createFragment(node, anchor);
|
|
77
|
-
else if (Array.isArray(node)) return createFragment(node.map((i) => normalizeBlock(i)), anchor);
|
|
70
|
+
else if (Array.isArray(node)) return createFragment(node.map((i) => normalizeBlock(i, void 0, processFunction)), anchor);
|
|
71
|
+
else if (processFunction && typeof node === "function") return resolveValues([node], anchor, true)[0];
|
|
78
72
|
else {
|
|
79
73
|
const result = node == null || typeof node === "boolean" ? "" : String(node);
|
|
80
74
|
if (anchor) {
|
|
@@ -83,15 +77,15 @@ function normalizeBlock(node, anchor) {
|
|
|
83
77
|
} else return document.createTextNode(result);
|
|
84
78
|
}
|
|
85
79
|
}
|
|
86
|
-
function resolveValue(current, value, anchor) {
|
|
80
|
+
function resolveValue(current, value, anchor, processFunction = false) {
|
|
87
81
|
anchor = anchor || (current instanceof Node && current.nodeType === 3 ? current : void 0);
|
|
88
|
-
const node = normalizeBlock(value, anchor);
|
|
82
|
+
const node = normalizeBlock(value, anchor, processFunction);
|
|
89
83
|
if (current) {
|
|
90
84
|
if (vue.isFragment(current)) {
|
|
91
85
|
if (current.anchor && current.anchor.parentNode) {
|
|
92
86
|
vue.remove(current.nodes, current.anchor.parentNode);
|
|
93
87
|
vue.insert(node, current.anchor.parentNode, current.anchor);
|
|
94
|
-
!anchor
|
|
88
|
+
if (!anchor) current.anchor.parentNode.removeChild(current.anchor);
|
|
95
89
|
if (current.scope) current.scope.stop();
|
|
96
90
|
}
|
|
97
91
|
} else if (current instanceof Node) {
|
|
@@ -109,7 +103,7 @@ function resolveValue(current, value, anchor) {
|
|
|
109
103
|
}
|
|
110
104
|
return node;
|
|
111
105
|
}
|
|
112
|
-
function resolveValues(values = [], _anchor) {
|
|
106
|
+
function resolveValues(values = [], _anchor, processFunction = false) {
|
|
113
107
|
const nodes = [];
|
|
114
108
|
const scopes = [];
|
|
115
109
|
for (const [index, value] of values.entries()) {
|
|
@@ -117,15 +111,15 @@ function resolveValues(values = [], _anchor) {
|
|
|
117
111
|
if (typeof value === "function") vue.renderEffect(() => {
|
|
118
112
|
if (scopes[index]) scopes[index].stop();
|
|
119
113
|
scopes[index] = new vue.EffectScope();
|
|
120
|
-
nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor));
|
|
114
|
+
nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor, processFunction));
|
|
121
115
|
});
|
|
122
|
-
else nodes[index] = resolveValue(nodes[index], value, anchor);
|
|
116
|
+
else nodes[index] = resolveValue(nodes[index], value, anchor, processFunction);
|
|
123
117
|
}
|
|
124
118
|
return nodes;
|
|
125
119
|
}
|
|
126
120
|
function setNodes(anchor, ...values) {
|
|
127
121
|
const resolvedValues = resolveValues(values, anchor);
|
|
128
|
-
anchor.parentNode
|
|
122
|
+
if (anchor.parentNode) vue.insert(resolvedValues, anchor.parentNode, anchor);
|
|
129
123
|
}
|
|
130
124
|
function createNodes(...values) {
|
|
131
125
|
return resolveValues(values);
|
|
@@ -133,8 +127,8 @@ function createNodes(...values) {
|
|
|
133
127
|
|
|
134
128
|
//#endregion
|
|
135
129
|
exports.createComponent = createComponent;
|
|
136
|
-
exports.createComponentWithFallback = createComponentWithFallback;
|
|
137
130
|
exports.createNodes = createNodes;
|
|
131
|
+
exports.createProxyComponent = createProxyComponent;
|
|
138
132
|
exports.defineVaporSSRComponent = defineVaporSSRComponent;
|
|
139
133
|
exports.isBlock = isBlock;
|
|
140
134
|
exports.normalizeNode = normalizeNode;
|
package/dist/vapor.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as Vue from "vue";
|
|
2
|
-
import { Block, Fragment, VaporComponent } from "vue";
|
|
2
|
+
import { Block, Fragment, VNode, VaporComponent } from "vue";
|
|
3
3
|
|
|
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>>) =>
|
|
8
|
-
declare
|
|
9
|
-
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
7
|
+
declare const createComponent: (type: VaporComponent | typeof Fragment | string, ...args: Tail<Parameters<typeof Vue.createComponent>>) => Block;
|
|
8
|
+
declare function createProxyComponent(type: VaporComponent, normalizeNode?: (node: any) => Block): any;
|
|
9
|
+
type NodeChildAtom = VNode | Block | string | number | boolean | null | undefined | void | (() => NodeChild);
|
|
10
10
|
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
11
11
|
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
|
12
12
|
declare function normalizeNode(node: NodeChild): Block;
|
|
@@ -14,4 +14,4 @@ declare function isBlock(val: NonNullable<unknown>): val is Block;
|
|
|
14
14
|
declare function setNodes(anchor: Node, ...values: any[]): void;
|
|
15
15
|
declare function createNodes(...values: any[]): Block[];
|
|
16
16
|
//#endregion
|
|
17
|
-
export { NodeArrayChildren, NodeChild, createComponent,
|
|
17
|
+
export { NodeArrayChildren, NodeChild, createComponent, createNodes, createProxyComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
|
package/dist/vapor.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as Vue from "vue";
|
|
2
|
-
import { Block, Fragment, VaporComponent } from "vue";
|
|
2
|
+
import { Block, Fragment, VNode, VaporComponent } from "vue";
|
|
3
3
|
|
|
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>>) =>
|
|
8
|
-
declare
|
|
9
|
-
type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
|
|
7
|
+
declare const createComponent: (type: VaporComponent | typeof Fragment | string, ...args: Tail<Parameters<typeof Vue.createComponent>>) => Block;
|
|
8
|
+
declare function createProxyComponent(type: VaporComponent, normalizeNode?: (node: any) => Block): any;
|
|
9
|
+
type NodeChildAtom = VNode | Block | string | number | boolean | null | undefined | void | (() => NodeChild);
|
|
10
10
|
type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
|
|
11
11
|
type NodeChild = NodeChildAtom | NodeArrayChildren;
|
|
12
12
|
declare function normalizeNode(node: NodeChild): Block;
|
|
@@ -14,4 +14,4 @@ declare function isBlock(val: NonNullable<unknown>): val is Block;
|
|
|
14
14
|
declare function setNodes(anchor: Node, ...values: any[]): void;
|
|
15
15
|
declare function createNodes(...values: any[]): Block[];
|
|
16
16
|
//#endregion
|
|
17
|
-
export { NodeArrayChildren, NodeChild, createComponent,
|
|
17
|
+
export { NodeArrayChildren, NodeChild, createComponent, createNodes, createProxyComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
|
package/dist/vapor.js
CHANGED
|
@@ -20,46 +20,39 @@ function defineVaporSSRComponent(comp, extraOptions) {
|
|
|
20
20
|
return comp;
|
|
21
21
|
}
|
|
22
22
|
const createComponent = (type, ...args) => {
|
|
23
|
-
return createProxyComponent(Vue.createComponent, type, ...args);
|
|
24
|
-
};
|
|
25
|
-
const createComponentWithFallback = (type, ...args) => {
|
|
26
|
-
const slots = args[1];
|
|
27
|
-
if (typeof type === "string" && slots && slots.default && typeof slots.default === "function") {
|
|
28
|
-
const defaultSlot = slots.default;
|
|
29
|
-
slots.default = () => {
|
|
30
|
-
return createProxyComponent(Vue.createComponentWithFallback, defaultSlot, null, null);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return createProxyComponent(Vue.createComponentWithFallback, type, ...args);
|
|
34
|
-
};
|
|
35
|
-
const createProxyComponent = (createComponent, type, props, ...args) => {
|
|
36
23
|
if (type === Fragment) {
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
const slots = args[1];
|
|
25
|
+
return slots && typeof slots.default === "function" ? slots.default() : [];
|
|
39
26
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
return Vue.createComponentWithFallback(createProxyComponent(Vue.resolveDynamicComponent(type)), ...args);
|
|
28
|
+
};
|
|
29
|
+
const proxyCache = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
function createProxyComponent(type, normalizeNode) {
|
|
31
|
+
if (typeof type === "function") {
|
|
32
|
+
const existing = proxyCache.get(type);
|
|
33
|
+
if (existing) return existing;
|
|
34
|
+
const i = Vue.currentInstance || getCurrentInstance();
|
|
35
|
+
const proxy = new Proxy(type, {
|
|
43
36
|
apply(target, ctx, args) {
|
|
44
37
|
if (typeof target.__setup === "function") target.__setup.apply(ctx, args);
|
|
45
|
-
|
|
38
|
+
const node = Reflect.apply(target, ctx, args);
|
|
39
|
+
return normalizeNode ? normalizeNode(node) : node;
|
|
46
40
|
},
|
|
47
41
|
get(target, p, receiver) {
|
|
48
42
|
if (i && i.appContext.vapor && p === "__vapor") return true;
|
|
49
43
|
return Reflect.get(target, p, receiver);
|
|
50
44
|
}
|
|
51
45
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} });
|
|
55
|
-
type.__proxyed = true;
|
|
46
|
+
proxyCache.set(type, proxy);
|
|
47
|
+
return proxy;
|
|
56
48
|
}
|
|
57
|
-
return
|
|
58
|
-
}
|
|
49
|
+
return type;
|
|
50
|
+
}
|
|
59
51
|
function normalizeNode(node) {
|
|
60
52
|
if (node == null || typeof node === "boolean") return document.createComment("");
|
|
61
53
|
else if (Array.isArray(node) && node.length) return node.map(normalizeNode);
|
|
62
54
|
else if (isBlock(node)) return node;
|
|
55
|
+
else if (typeof node === "function") return resolveValues([node], void 0, true)[0];
|
|
63
56
|
else return document.createTextNode(String(node));
|
|
64
57
|
}
|
|
65
58
|
function isBlock(val) {
|
|
@@ -70,10 +63,11 @@ function createFragment(nodes, anchor = document.createTextNode("")) {
|
|
|
70
63
|
frag.anchor = anchor;
|
|
71
64
|
return frag;
|
|
72
65
|
}
|
|
73
|
-
function normalizeBlock(node, anchor) {
|
|
66
|
+
function normalizeBlock(node, anchor, processFunction = false) {
|
|
74
67
|
if (node instanceof Node || Vue.isFragment(node)) return node;
|
|
75
68
|
else if (Vue.isVaporComponent(node)) return createFragment(node, anchor);
|
|
76
|
-
else if (Array.isArray(node)) return createFragment(node.map((i) => normalizeBlock(i)), anchor);
|
|
69
|
+
else if (Array.isArray(node)) return createFragment(node.map((i) => normalizeBlock(i, void 0, processFunction)), anchor);
|
|
70
|
+
else if (processFunction && typeof node === "function") return resolveValues([node], anchor, true)[0];
|
|
77
71
|
else {
|
|
78
72
|
const result = node == null || typeof node === "boolean" ? "" : String(node);
|
|
79
73
|
if (anchor) {
|
|
@@ -82,15 +76,15 @@ function normalizeBlock(node, anchor) {
|
|
|
82
76
|
} else return document.createTextNode(result);
|
|
83
77
|
}
|
|
84
78
|
}
|
|
85
|
-
function resolveValue(current, value, anchor) {
|
|
79
|
+
function resolveValue(current, value, anchor, processFunction = false) {
|
|
86
80
|
anchor = anchor || (current instanceof Node && current.nodeType === 3 ? current : void 0);
|
|
87
|
-
const node = normalizeBlock(value, anchor);
|
|
81
|
+
const node = normalizeBlock(value, anchor, processFunction);
|
|
88
82
|
if (current) {
|
|
89
83
|
if (Vue.isFragment(current)) {
|
|
90
84
|
if (current.anchor && current.anchor.parentNode) {
|
|
91
85
|
Vue.remove(current.nodes, current.anchor.parentNode);
|
|
92
86
|
Vue.insert(node, current.anchor.parentNode, current.anchor);
|
|
93
|
-
!anchor
|
|
87
|
+
if (!anchor) current.anchor.parentNode.removeChild(current.anchor);
|
|
94
88
|
if (current.scope) current.scope.stop();
|
|
95
89
|
}
|
|
96
90
|
} else if (current instanceof Node) {
|
|
@@ -108,7 +102,7 @@ function resolveValue(current, value, anchor) {
|
|
|
108
102
|
}
|
|
109
103
|
return node;
|
|
110
104
|
}
|
|
111
|
-
function resolveValues(values = [], _anchor) {
|
|
105
|
+
function resolveValues(values = [], _anchor, processFunction = false) {
|
|
112
106
|
const nodes = [];
|
|
113
107
|
const scopes = [];
|
|
114
108
|
for (const [index, value] of values.entries()) {
|
|
@@ -116,19 +110,19 @@ function resolveValues(values = [], _anchor) {
|
|
|
116
110
|
if (typeof value === "function") Vue.renderEffect(() => {
|
|
117
111
|
if (scopes[index]) scopes[index].stop();
|
|
118
112
|
scopes[index] = new EffectScope();
|
|
119
|
-
nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor));
|
|
113
|
+
nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor, processFunction));
|
|
120
114
|
});
|
|
121
|
-
else nodes[index] = resolveValue(nodes[index], value, anchor);
|
|
115
|
+
else nodes[index] = resolveValue(nodes[index], value, anchor, processFunction);
|
|
122
116
|
}
|
|
123
117
|
return nodes;
|
|
124
118
|
}
|
|
125
119
|
function setNodes(anchor, ...values) {
|
|
126
120
|
const resolvedValues = resolveValues(values, anchor);
|
|
127
|
-
anchor.parentNode
|
|
121
|
+
if (anchor.parentNode) Vue.insert(resolvedValues, anchor.parentNode, anchor);
|
|
128
122
|
}
|
|
129
123
|
function createNodes(...values) {
|
|
130
124
|
return resolveValues(values);
|
|
131
125
|
}
|
|
132
126
|
|
|
133
127
|
//#endregion
|
|
134
|
-
export { createComponent,
|
|
128
|
+
export { createComponent, createNodes, createProxyComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
|