@vue-jsx-vapor/runtime 3.2.16 → 3.2.18

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.d.cts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { NodeChild } from "./vapor.cjs";
2
- import { Block, Component, EmitsOptions, Fragment, FunctionalVaporComponent, NodeRef, Suspense, SuspenseProps, TeleportProps, VaporComponent, VaporTeleport } from "vue";
2
+ import { Block, Component, EmitsOptions, Fragment, FunctionalVaporComponent, Ref, Suspense, SuspenseProps, TeleportProps, VaporComponent, VaporComponentInstance, VaporTeleport } from "vue";
3
3
 
4
4
  //#region src/h.d.ts
5
5
  type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
6
+ type NodeRef = string | Ref | ((ref: Element | VaporComponentInstance, refs: Record<string, any>) => void);
6
7
  type ReservedProps = {
7
8
  key?: () => PropertyKey;
8
9
  ref?: NodeRef;
package/dist/h.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { NodeChild } from "./vapor.js";
2
- import { Block, Component, EmitsOptions, Fragment, FunctionalVaporComponent, NodeRef, Suspense, SuspenseProps, TeleportProps, VaporComponent, VaporTeleport } from "vue";
2
+ import { Block, Component, EmitsOptions, Fragment, FunctionalVaporComponent, Ref, Suspense, SuspenseProps, TeleportProps, VaporComponent, VaporComponentInstance, VaporTeleport } from "vue";
3
3
 
4
4
  //#region src/h.d.ts
5
5
  type HTMLElementEventHandler = { [K in keyof HTMLElementEventMap as `on${Capitalize<K>}`]?: (ev: HTMLElementEventMap[K]) => any };
6
+ type NodeRef = string | Ref | ((ref: Element | VaporComponentInstance, refs: Record<string, any>) => void);
6
7
  type ReservedProps = {
7
8
  key?: () => PropertyKey;
8
9
  ref?: NodeRef;
package/dist/index.cjs CHANGED
@@ -21,7 +21,9 @@ exports.h = require_h.h;
21
21
  exports.isBlock = require_vapor.isBlock;
22
22
  exports.normalizeNode = require_vapor.normalizeNode;
23
23
  exports.normalizeSlot = require_vdom.normalizeSlot;
24
+ exports.normalizeSlots = require_vdom.normalizeSlots;
24
25
  exports.normalizeVNode = require_vdom.normalizeVNode;
26
+ exports.normalizeVaporSlots = require_vapor.normalizeVaporSlots;
25
27
  exports.setNodes = require_vapor.setNodes;
26
28
  exports.ssrRegisterHelper = require_ssr.ssrRegisterHelper;
27
29
  exports.useFullProps = require_props.useFullProps;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { SlotsToProps } from "./types.cjs";
2
- import { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.cjs";
2
+ import { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, normalizeVaporSlots, setNodes } from "./vapor.cjs";
3
3
  import { h } from "./h.cjs";
4
4
  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";
5
5
  import { getCurrentInstance, useFullProps, useProps } from "./props.cjs";
6
6
  import { ssrRegisterHelper } from "./ssr.cjs";
7
- import { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeVNode } from "./vdom.cjs";
7
+ import { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeSlots, normalizeVNode } from "./vdom.cjs";
8
8
  import { shallowRef as useRef } from "vue";
9
- export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DefineComponent, DefineSetupFnComponent, DefineVaporComponent, DefineVaporSetupFnComponent, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, For, 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, type SlotsToProps, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VaporFor, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createNodes, createProxyComponent, createVNodeCache, defineComponent, defineVaporComponent, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeSlot, normalizeVNode, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
9
+ export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DefineComponent, DefineSetupFnComponent, DefineVaporComponent, DefineVaporSetupFnComponent, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, For, 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, type SlotsToProps, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VaporFor, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createNodes, createProxyComponent, createVNodeCache, defineComponent, defineVaporComponent, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeSlot, normalizeSlots, normalizeVNode, normalizeVaporSlots, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { SlotsToProps } from "./types.js";
2
- import { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.js";
2
+ import { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, normalizeVaporSlots, setNodes } from "./vapor.js";
3
3
  import { h } from "./h.js";
4
4
  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";
5
5
  import { getCurrentInstance, useFullProps, useProps } from "./props.js";
6
6
  import { ssrRegisterHelper } from "./ssr.js";
7
- import { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeVNode } from "./vdom.js";
7
+ import { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeSlots, normalizeVNode } from "./vdom.js";
8
8
  import { shallowRef as useRef } from "vue";
9
- export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DefineComponent, DefineSetupFnComponent, DefineVaporComponent, DefineVaporSetupFnComponent, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, For, 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, type SlotsToProps, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VaporFor, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createNodes, createProxyComponent, createVNodeCache, defineComponent, defineVaporComponent, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeSlot, normalizeVNode, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
9
+ export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DefineComponent, DefineSetupFnComponent, DefineVaporComponent, DefineVaporSetupFnComponent, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, For, 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, type SlotsToProps, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VaporFor, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createNodes, createProxyComponent, createVNodeCache, defineComponent, defineVaporComponent, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeSlot, normalizeSlots, normalizeVNode, normalizeVaporSlots, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.js";
1
+ import { VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, normalizeVaporSlots, setNodes } from "./vapor.js";
2
2
  import { h } from "./h.js";
3
3
  import { getCurrentInstance, useFullProps, useProps } from "./props.js";
4
4
  import { ssrRegisterHelper } from "./ssr.js";
5
- import { For, createVNodeCache, defineComponent, normalizeSlot, normalizeVNode } from "./vdom.js";
5
+ import { For, createVNodeCache, defineComponent, normalizeSlot, normalizeSlots, normalizeVNode } from "./vdom.js";
6
6
  import { shallowRef as useRef } from "vue";
7
7
 
8
- export { For, VaporFor, createComponent, createNodes, createProxyComponent, createVNodeCache, defineComponent, defineVaporComponent, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeSlot, normalizeVNode, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
8
+ export { For, VaporFor, createComponent, createNodes, createProxyComponent, createVNodeCache, defineComponent, defineVaporComponent, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeSlot, normalizeSlots, normalizeVNode, normalizeVaporSlots, setNodes, ssrRegisterHelper, useFullProps, useProps, useRef };
package/dist/raw.cjs CHANGED
@@ -9,11 +9,11 @@ var ssr_default = "import { useSSRContext } from \"vue\";\nexport function ssrRe
9
9
 
10
10
  //#endregion
11
11
  //#region src/vapor.ts?raw
12
- 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// @__NO_SIDE_EFFECTS__\nexport function defineVaporComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup: comp,\n __vapor: true\n });\n }\n comp.__vapor = true;\n return comp;\n}\nexport const VaporFor = /* @__PURE__ */ defineVaporComponent(\n (props, {\n slots\n }) => {\n return Vue.createFor(\n () => props.in,\n (item, key, index) => {\n return slots.default ? slots.default(\n // @ts-ignore\n props.getKey === void 0 ? item.value : item,\n key,\n index\n ) : [];\n },\n props.getKey === void 0 ? (item) => item : props.getKey\n );\n },\n { props: [\"in\", \"getKey\"] }\n);\n";
12
+ 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 === \"function\" ? 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}\nexport function normalizeVaporSlots(slots) {\n if (typeof slots === \"function\") {\n return { name: \"default\", fn: slots };\n } else if (Object.prototype.toString.call(slots) === \"[object Object]\" && !isBlock(slots)) {\n return Object.entries(slots).map(([name, fn]) => ({ name, fn }));\n } else {\n return {\n name: \"default\",\n fn: () => createNodes(slots)\n };\n }\n}\n// @__NO_SIDE_EFFECTS__\nexport function defineVaporComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup: comp,\n __vapor: true\n });\n }\n comp.__vapor = true;\n return comp;\n}\nexport const VaporFor = /* @__PURE__ */ defineVaporComponent(\n (props, {\n slots\n }) => {\n return Vue.createFor(\n () => props.in,\n (item, key, index) => {\n return slots.default ? slots.default(\n // @ts-ignore\n props.getKey === void 0 ? item.value : item,\n key,\n index\n ) : [];\n },\n props.getKey === void 0 ? (item) => item : props.getKey\n );\n },\n { props: [\"in\", \"getKey\"] }\n);\n";
13
13
 
14
14
  //#endregion
15
15
  //#region src/vdom.ts?raw
16
- var vdom_default = "import {\n defineComponent as __defineComponent,\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createElementVNode,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n renderList,\n Text,\n withCtx\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(key) {\n const i = getCurrentInstance();\n if (i) {\n if (!cacheMap.has(i)) cacheMap.set(i, {});\n const caches = cacheMap.get(i);\n return caches[key] || (caches[key] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value, flag = 1) {\n let create = createVNode;\n let isBlock = false;\n if (typeof value === \"function\") {\n isBlock = true;\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isBlock ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? isBlock ? createElementBlock(\n Fragment,\n null,\n value.map((n) => normalizeVNode(() => n)),\n -2\n ) : createElementVNode(Fragment, null, value.slice()) : value == null || typeof value === \"boolean\" ? create(Comment) : create(Text, null, String(value), flag);\n}\nfunction cloneIfMounted(child) {\n return child.el === null && child.patchFlag !== -1 || // @ts-ignore\n child.memo ? child : cloneVNode(child);\n}\nconst normalizeSlotValue = (value) => Array.isArray(value) ? value.map((n) => normalizeVNode(n)) : [normalizeVNode(value)];\nexport const normalizeSlot = (rawSlot) => {\n if (rawSlot._n) {\n return rawSlot;\n }\n return withCtx((...args) => {\n return normalizeSlotValue(rawSlot(...args));\n });\n};\nexport const defineComponent = __defineComponent;\nexport const For = defineComponent(\n (props, {\n slots\n }) => {\n const defaultSlot = slots.default;\n return () => (openBlock(true), createElementBlock(\n Fragment,\n null,\n renderList(props.in, (item, key, index) => {\n const result = defaultSlot(item, key, index);\n return Array.isArray(result) ? result.length === 1 ? result[0] : normalizeVNode(result) : result;\n }),\n 128\n ));\n },\n { props: [\"in\"] }\n);\n";
16
+ var vdom_default = "import {\n defineComponent as __defineComponent,\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createElementVNode,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n renderList,\n Text,\n withCtx\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(key) {\n const i = getCurrentInstance();\n if (i) {\n if (!cacheMap.has(i)) cacheMap.set(i, {});\n const caches = cacheMap.get(i);\n return caches[key] || (caches[key] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value, flag = 1) {\n let create = createVNode;\n let isBlock = false;\n if (typeof value === \"function\") {\n isBlock = true;\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isBlock ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? isBlock ? createElementBlock(\n Fragment,\n null,\n value.map((n) => normalizeVNode(() => n)),\n -2\n ) : createElementVNode(Fragment, null, value.slice()) : value == null || typeof value === \"boolean\" ? create(Comment) : create(Text, null, String(value), flag);\n}\nfunction cloneIfMounted(child) {\n return child.el === null && child.patchFlag !== -1 || // @ts-ignore\n child.memo ? child : cloneVNode(child);\n}\nconst normalizeSlotValue = (value) => Array.isArray(value) ? value.map((n) => normalizeVNode(n)) : [normalizeVNode(value)];\nexport const normalizeSlot = (rawSlot) => {\n if (rawSlot._n) {\n return rawSlot;\n }\n return withCtx((...args) => {\n return normalizeSlotValue(rawSlot(...args));\n });\n};\nexport const normalizeSlots = (slots) => {\n return typeof slots === \"function\" || Object.prototype.toString.call(slots) === \"[object Object]\" && !isVNode(slots) ? slots : {\n default: withCtx(() => [normalizeVNode(() => slots)])\n };\n};\nexport const defineComponent = __defineComponent;\nexport const For = defineComponent(\n (props, {\n slots\n }) => {\n const defaultSlot = slots.default;\n return () => (openBlock(true), createElementBlock(\n Fragment,\n null,\n renderList(props.in, (item, key, index) => {\n const result = defaultSlot(item, key, index);\n return Array.isArray(result) ? result.length === 1 ? result[0] : normalizeVNode(result) : result;\n }),\n 128\n ));\n },\n { props: [\"in\"] }\n);\n";
17
17
 
18
18
  //#endregion
19
19
  //#region src/raw.ts
package/dist/raw.js CHANGED
@@ -7,11 +7,11 @@ 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 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// @__NO_SIDE_EFFECTS__\nexport function defineVaporComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup: comp,\n __vapor: true\n });\n }\n comp.__vapor = true;\n return comp;\n}\nexport const VaporFor = /* @__PURE__ */ defineVaporComponent(\n (props, {\n slots\n }) => {\n return Vue.createFor(\n () => props.in,\n (item, key, index) => {\n return slots.default ? slots.default(\n // @ts-ignore\n props.getKey === void 0 ? item.value : item,\n key,\n index\n ) : [];\n },\n props.getKey === void 0 ? (item) => item : props.getKey\n );\n },\n { props: [\"in\", \"getKey\"] }\n);\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 === \"function\" ? 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}\nexport function normalizeVaporSlots(slots) {\n if (typeof slots === \"function\") {\n return { name: \"default\", fn: slots };\n } else if (Object.prototype.toString.call(slots) === \"[object Object]\" && !isBlock(slots)) {\n return Object.entries(slots).map(([name, fn]) => ({ name, fn }));\n } else {\n return {\n name: \"default\",\n fn: () => createNodes(slots)\n };\n }\n}\n// @__NO_SIDE_EFFECTS__\nexport function defineVaporComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return Object.assign({ name: comp.name }, extraOptions, {\n setup: comp,\n __vapor: true\n });\n }\n comp.__vapor = true;\n return comp;\n}\nexport const VaporFor = /* @__PURE__ */ defineVaporComponent(\n (props, {\n slots\n }) => {\n return Vue.createFor(\n () => props.in,\n (item, key, index) => {\n return slots.default ? slots.default(\n // @ts-ignore\n props.getKey === void 0 ? item.value : item,\n key,\n index\n ) : [];\n },\n props.getKey === void 0 ? (item) => item : props.getKey\n );\n },\n { props: [\"in\", \"getKey\"] }\n);\n";
11
11
 
12
12
  //#endregion
13
13
  //#region src/vdom.ts?raw
14
- var vdom_default = "import {\n defineComponent as __defineComponent,\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createElementVNode,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n renderList,\n Text,\n withCtx\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(key) {\n const i = getCurrentInstance();\n if (i) {\n if (!cacheMap.has(i)) cacheMap.set(i, {});\n const caches = cacheMap.get(i);\n return caches[key] || (caches[key] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value, flag = 1) {\n let create = createVNode;\n let isBlock = false;\n if (typeof value === \"function\") {\n isBlock = true;\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isBlock ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? isBlock ? createElementBlock(\n Fragment,\n null,\n value.map((n) => normalizeVNode(() => n)),\n -2\n ) : createElementVNode(Fragment, null, value.slice()) : value == null || typeof value === \"boolean\" ? create(Comment) : create(Text, null, String(value), flag);\n}\nfunction cloneIfMounted(child) {\n return child.el === null && child.patchFlag !== -1 || // @ts-ignore\n child.memo ? child : cloneVNode(child);\n}\nconst normalizeSlotValue = (value) => Array.isArray(value) ? value.map((n) => normalizeVNode(n)) : [normalizeVNode(value)];\nexport const normalizeSlot = (rawSlot) => {\n if (rawSlot._n) {\n return rawSlot;\n }\n return withCtx((...args) => {\n return normalizeSlotValue(rawSlot(...args));\n });\n};\nexport const defineComponent = __defineComponent;\nexport const For = defineComponent(\n (props, {\n slots\n }) => {\n const defaultSlot = slots.default;\n return () => (openBlock(true), createElementBlock(\n Fragment,\n null,\n renderList(props.in, (item, key, index) => {\n const result = defaultSlot(item, key, index);\n return Array.isArray(result) ? result.length === 1 ? result[0] : normalizeVNode(result) : result;\n }),\n 128\n ));\n },\n { props: [\"in\"] }\n);\n";
14
+ var vdom_default = "import {\n defineComponent as __defineComponent,\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createElementVNode,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n renderList,\n Text,\n withCtx\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(key) {\n const i = getCurrentInstance();\n if (i) {\n if (!cacheMap.has(i)) cacheMap.set(i, {});\n const caches = cacheMap.get(i);\n return caches[key] || (caches[key] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value, flag = 1) {\n let create = createVNode;\n let isBlock = false;\n if (typeof value === \"function\") {\n isBlock = true;\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isBlock ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? isBlock ? createElementBlock(\n Fragment,\n null,\n value.map((n) => normalizeVNode(() => n)),\n -2\n ) : createElementVNode(Fragment, null, value.slice()) : value == null || typeof value === \"boolean\" ? create(Comment) : create(Text, null, String(value), flag);\n}\nfunction cloneIfMounted(child) {\n return child.el === null && child.patchFlag !== -1 || // @ts-ignore\n child.memo ? child : cloneVNode(child);\n}\nconst normalizeSlotValue = (value) => Array.isArray(value) ? value.map((n) => normalizeVNode(n)) : [normalizeVNode(value)];\nexport const normalizeSlot = (rawSlot) => {\n if (rawSlot._n) {\n return rawSlot;\n }\n return withCtx((...args) => {\n return normalizeSlotValue(rawSlot(...args));\n });\n};\nexport const normalizeSlots = (slots) => {\n return typeof slots === \"function\" || Object.prototype.toString.call(slots) === \"[object Object]\" && !isVNode(slots) ? slots : {\n default: withCtx(() => [normalizeVNode(() => slots)])\n };\n};\nexport const defineComponent = __defineComponent;\nexport const For = defineComponent(\n (props, {\n slots\n }) => {\n const defaultSlot = slots.default;\n return () => (openBlock(true), createElementBlock(\n Fragment,\n null,\n renderList(props.in, (item, key, index) => {\n const result = defaultSlot(item, key, index);\n return Array.isArray(result) ? result.length === 1 ? result[0] : normalizeVNode(result) : result;\n }),\n 128\n ));\n },\n { props: [\"in\"] }\n);\n";
15
15
 
16
16
  //#endregion
17
17
  //#region src/raw.ts
package/dist/vapor.cjs CHANGED
@@ -24,7 +24,7 @@ function defineVaporSSRComponent(comp, extraOptions) {
24
24
  const createComponent = (type, ...args) => {
25
25
  if (type === vue.Fragment) {
26
26
  const slots = args[1];
27
- return slots && typeof slots.default === "function" ? slots.default() : [];
27
+ return slots ? typeof slots === "function" ? slots() : typeof slots.default === "function" ? slots.default() : [] : [];
28
28
  }
29
29
  return vue.createComponentWithFallback(createProxyComponent(vue.resolveDynamicComponent(type)), ...args);
30
30
  };
@@ -125,6 +125,20 @@ function setNodes(anchor, ...values) {
125
125
  function createNodes(...values) {
126
126
  return resolveValues(values);
127
127
  }
128
+ function normalizeVaporSlots(slots) {
129
+ if (typeof slots === "function") return {
130
+ name: "default",
131
+ fn: slots
132
+ };
133
+ else if (Object.prototype.toString.call(slots) === "[object Object]" && !isBlock(slots)) return Object.entries(slots).map(([name, fn]) => ({
134
+ name,
135
+ fn
136
+ }));
137
+ else return {
138
+ name: "default",
139
+ fn: () => createNodes(slots)
140
+ };
141
+ }
128
142
  /* @__NO_SIDE_EFFECTS__ */
129
143
  function defineVaporComponent(comp, extraOptions) {
130
144
  if (typeof comp === "function") return Object.assign({ name: comp.name }, extraOptions, {
@@ -149,4 +163,5 @@ exports.defineVaporComponent = defineVaporComponent;
149
163
  exports.defineVaporSSRComponent = defineVaporSSRComponent;
150
164
  exports.isBlock = isBlock;
151
165
  exports.normalizeNode = normalizeNode;
166
+ exports.normalizeVaporSlots = normalizeVaporSlots;
152
167
  exports.setNodes = setNodes;
package/dist/vapor.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IsKeyValues, Prettify, SlotsToProps, ToResolvedProps } from "./types.cjs";
2
2
  import * as Vue from "vue";
3
- import { Block, ComponentObjectPropsOptions, ComponentTypeEmits, EmitFn, EmitsOptions, ExtractDefaultPropTypes, ExtractPropTypes, Fragment, ShallowRef, StaticSlots, TypeEmitsToOptions, VNode, VaporComponent, VaporComponentInstance, VaporComponentInstanceConstructor, VaporComponentOptions, VaporPublicProps, VaporRenderResult } from "vue";
3
+ import { Block, ComponentObjectPropsOptions, ComponentTypeEmits, EffectScope, EmitFn, EmitsOptions, ExtractDefaultPropTypes, ExtractPropTypes, Fragment, ShallowRef, TypeEmitsToOptions, VNode, VaporComponent, VaporComponentInstance, VaporComponentOptions, VaporPublicProps, VaporRenderResult, VaporSlot } from "vue";
4
4
 
5
5
  //#region src/vapor.d.ts
6
6
  declare function defineVaporSSRComponent(comp: VaporComponent, extraOptions: VaporComponent): VaporComponent;
@@ -14,6 +14,20 @@ declare function normalizeNode(node: NodeChild): Block;
14
14
  declare function isBlock(val: NonNullable<unknown>): val is Block;
15
15
  declare function setNodes(anchor: Node, ...values: any[]): void;
16
16
  declare function createNodes(...values: any[]): Block[];
17
+ declare function normalizeVaporSlots(slots: any): {
18
+ name: string;
19
+ fn: unknown;
20
+ }[] | {
21
+ name: string;
22
+ fn: any;
23
+ };
24
+ type StaticSlots = Record<string, VaporSlot>;
25
+ type VaporComponentInstanceConstructor<T extends VaporComponentInstance> = {
26
+ __isFragment?: never;
27
+ __isTeleport?: never;
28
+ __isSuspense?: never;
29
+ new (...args: any[]): T;
30
+ };
17
31
  type DefineVaporComponent<RuntimePropsOptions = {}, RuntimePropsKeys extends string = string, InferredProps = (string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : { [key in RuntimePropsKeys]?: any }), Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, TypeRefs extends Record<string, unknown> = {}, MakeDefaultsOptional extends boolean = true, PublicProps = VaporPublicProps, ResolvedProps = ToResolvedProps<InferredProps, Emits>, Defaults = ExtractDefaultPropTypes<RuntimePropsOptions>> = VaporComponentInstanceConstructor<VaporComponentInstance<(MakeDefaultsOptional extends true ? keyof Defaults extends never ? Prettify<ResolvedProps> & PublicProps : Partial<Defaults> & Omit<Prettify<ResolvedProps> & PublicProps, keyof Defaults> : Prettify<ResolvedProps> & PublicProps) & SlotsToProps<Slots, NodeChild>, Emits, Slots, Exposed, TypeBlock, TypeRefs>> & VaporComponentOptions<RuntimePropsOptions | RuntimePropsKeys[], Emits, RuntimeEmitsKeys, Slots, Exposed>;
18
32
  type DefineVaporSetupFnComponent<Props extends Record<string, any> = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, ResolvedProps extends Record<string, any> = ToResolvedProps<Props & VaporPublicProps, Emits>> = new () => VaporComponentInstance<ResolvedProps & SlotsToProps<Slots, NodeChild>, Emits, Slots, Exposed, TypeBlock>;
19
33
  declare function defineVaporComponent<Props extends Record<string, any>, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block>(setup: (this: void, props: Props, ctx: {
@@ -57,6 +71,24 @@ declare const VaporFor: new <T extends any[] | Record<any, any> | number | strin
57
71
  } | ((...args: string extends keyof Item ? [item: ResolveItem<T[keyof T], GetKey>, key: ShallowRef<keyof T>, index: ShallowRef<number>] : [item: ResolveItem<Item, GetKey>, index: ShallowRef<number>]) => any) | NoInfer<NodeChild<undefined>> | undefined;
58
72
  }, {}, {
59
73
  default: (...args: string extends keyof Item ? [item: ResolveItem<T[keyof T], GetKey>, key: ShallowRef<keyof T>, index: ShallowRef<number>] : [item: ResolveItem<Item, GetKey>, index: ShallowRef<number>]) => any;
60
- }, Record<string, any>, Vue.ForFragment, Record<string, any>>;
74
+ }, Record<string, any>, {
75
+ resetListeners?: (() => void)[];
76
+ onReset(fn: () => void): void;
77
+ $key?: any;
78
+ $transition?: Vue.VaporTransitionHooks | undefined;
79
+ nodes: Block[];
80
+ vnode?: VNode | null;
81
+ anchor?: Node;
82
+ validityPending?: boolean;
83
+ isBlockValid?: () => boolean;
84
+ insert?: (parent: ParentNode, anchor: Node | null, transitionHooks?: Vue.TransitionHooks) => void;
85
+ remove?: (parent?: ParentNode, transitionHooks?: Vue.TransitionHooks) => void;
86
+ hydrate?(...args: any[]): void;
87
+ setRef?: (instance: VaporComponentInstance, ref: string | Vue.Ref<any, any> | ((ref: Element | VaporComponentInstance, refs: Record<string, any>) => void), refFor: boolean, refKey: string | undefined) => void;
88
+ onBeforeInsert?: ((nodes: Block) => void)[];
89
+ onBeforeRemove?: ((scope: EffectScope) => boolean)[];
90
+ onBeforeUpdate?: (() => void)[];
91
+ onUpdated?: ((nodes?: Block) => void)[];
92
+ }, Record<string, any>>;
61
93
  //#endregion
62
- export { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
94
+ export { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, normalizeVaporSlots, setNodes };
package/dist/vapor.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IsKeyValues, Prettify, SlotsToProps, ToResolvedProps } from "./types.js";
2
2
  import * as Vue from "vue";
3
- import { Block, ComponentObjectPropsOptions, ComponentTypeEmits, EmitFn, EmitsOptions, ExtractDefaultPropTypes, ExtractPropTypes, Fragment, ShallowRef, StaticSlots, TypeEmitsToOptions, VNode, VaporComponent, VaporComponentInstance, VaporComponentInstanceConstructor, VaporComponentOptions, VaporPublicProps, VaporRenderResult } from "vue";
3
+ import { Block, ComponentObjectPropsOptions, ComponentTypeEmits, EffectScope, EmitFn, EmitsOptions, ExtractDefaultPropTypes, ExtractPropTypes, Fragment, ShallowRef, TypeEmitsToOptions, VNode, VaporComponent, VaporComponentInstance, VaporComponentOptions, VaporPublicProps, VaporRenderResult, VaporSlot } from "vue";
4
4
 
5
5
  //#region src/vapor.d.ts
6
6
  declare function defineVaporSSRComponent(comp: VaporComponent, extraOptions: VaporComponent): VaporComponent;
@@ -14,6 +14,20 @@ declare function normalizeNode(node: NodeChild): Block;
14
14
  declare function isBlock(val: NonNullable<unknown>): val is Block;
15
15
  declare function setNodes(anchor: Node, ...values: any[]): void;
16
16
  declare function createNodes(...values: any[]): Block[];
17
+ declare function normalizeVaporSlots(slots: any): {
18
+ name: string;
19
+ fn: unknown;
20
+ }[] | {
21
+ name: string;
22
+ fn: any;
23
+ };
24
+ type StaticSlots = Record<string, VaporSlot>;
25
+ type VaporComponentInstanceConstructor<T extends VaporComponentInstance> = {
26
+ __isFragment?: never;
27
+ __isTeleport?: never;
28
+ __isSuspense?: never;
29
+ new (...args: any[]): T;
30
+ };
17
31
  type DefineVaporComponent<RuntimePropsOptions = {}, RuntimePropsKeys extends string = string, InferredProps = (string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : { [key in RuntimePropsKeys]?: any }), Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, TypeRefs extends Record<string, unknown> = {}, MakeDefaultsOptional extends boolean = true, PublicProps = VaporPublicProps, ResolvedProps = ToResolvedProps<InferredProps, Emits>, Defaults = ExtractDefaultPropTypes<RuntimePropsOptions>> = VaporComponentInstanceConstructor<VaporComponentInstance<(MakeDefaultsOptional extends true ? keyof Defaults extends never ? Prettify<ResolvedProps> & PublicProps : Partial<Defaults> & Omit<Prettify<ResolvedProps> & PublicProps, keyof Defaults> : Prettify<ResolvedProps> & PublicProps) & SlotsToProps<Slots, NodeChild>, Emits, Slots, Exposed, TypeBlock, TypeRefs>> & VaporComponentOptions<RuntimePropsOptions | RuntimePropsKeys[], Emits, RuntimeEmitsKeys, Slots, Exposed>;
18
32
  type DefineVaporSetupFnComponent<Props extends Record<string, any> = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, ResolvedProps extends Record<string, any> = ToResolvedProps<Props & VaporPublicProps, Emits>> = new () => VaporComponentInstance<ResolvedProps & SlotsToProps<Slots, NodeChild>, Emits, Slots, Exposed, TypeBlock>;
19
33
  declare function defineVaporComponent<Props extends Record<string, any>, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block>(setup: (this: void, props: Props, ctx: {
@@ -57,6 +71,24 @@ declare const VaporFor: new <T extends any[] | Record<any, any> | number | strin
57
71
  } | ((...args: string extends keyof Item ? [item: ResolveItem<T[keyof T], GetKey>, key: ShallowRef<keyof T>, index: ShallowRef<number>] : [item: ResolveItem<Item, GetKey>, index: ShallowRef<number>]) => any) | NoInfer<NodeChild<undefined>> | undefined;
58
72
  }, {}, {
59
73
  default: (...args: string extends keyof Item ? [item: ResolveItem<T[keyof T], GetKey>, key: ShallowRef<keyof T>, index: ShallowRef<number>] : [item: ResolveItem<Item, GetKey>, index: ShallowRef<number>]) => any;
60
- }, Record<string, any>, Vue.ForFragment, Record<string, any>>;
74
+ }, Record<string, any>, {
75
+ resetListeners?: (() => void)[];
76
+ onReset(fn: () => void): void;
77
+ $key?: any;
78
+ $transition?: Vue.VaporTransitionHooks | undefined;
79
+ nodes: Block[];
80
+ vnode?: VNode | null;
81
+ anchor?: Node;
82
+ validityPending?: boolean;
83
+ isBlockValid?: () => boolean;
84
+ insert?: (parent: ParentNode, anchor: Node | null, transitionHooks?: Vue.TransitionHooks) => void;
85
+ remove?: (parent?: ParentNode, transitionHooks?: Vue.TransitionHooks) => void;
86
+ hydrate?(...args: any[]): void;
87
+ setRef?: (instance: VaporComponentInstance, ref: string | Vue.Ref<any, any> | ((ref: Element | VaporComponentInstance, refs: Record<string, any>) => void), refFor: boolean, refKey: string | undefined) => void;
88
+ onBeforeInsert?: ((nodes: Block) => void)[];
89
+ onBeforeRemove?: ((scope: EffectScope) => boolean)[];
90
+ onBeforeUpdate?: (() => void)[];
91
+ onUpdated?: ((nodes?: Block) => void)[];
92
+ }, Record<string, any>>;
61
93
  //#endregion
62
- export { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
94
+ export { DefineVaporComponent, DefineVaporSetupFnComponent, NodeArrayChildren, NodeChild, VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, normalizeVaporSlots, setNodes };
package/dist/vapor.js CHANGED
@@ -22,7 +22,7 @@ function defineVaporSSRComponent(comp, extraOptions) {
22
22
  const createComponent = (type, ...args) => {
23
23
  if (type === Fragment) {
24
24
  const slots = args[1];
25
- return slots && typeof slots.default === "function" ? slots.default() : [];
25
+ return slots ? typeof slots === "function" ? slots() : typeof slots.default === "function" ? slots.default() : [] : [];
26
26
  }
27
27
  return Vue.createComponentWithFallback(createProxyComponent(Vue.resolveDynamicComponent(type)), ...args);
28
28
  };
@@ -123,6 +123,20 @@ function setNodes(anchor, ...values) {
123
123
  function createNodes(...values) {
124
124
  return resolveValues(values);
125
125
  }
126
+ function normalizeVaporSlots(slots) {
127
+ if (typeof slots === "function") return {
128
+ name: "default",
129
+ fn: slots
130
+ };
131
+ else if (Object.prototype.toString.call(slots) === "[object Object]" && !isBlock(slots)) return Object.entries(slots).map(([name, fn]) => ({
132
+ name,
133
+ fn
134
+ }));
135
+ else return {
136
+ name: "default",
137
+ fn: () => createNodes(slots)
138
+ };
139
+ }
126
140
  /* @__NO_SIDE_EFFECTS__ */
127
141
  function defineVaporComponent(comp, extraOptions) {
128
142
  if (typeof comp === "function") return Object.assign({ name: comp.name }, extraOptions, {
@@ -139,4 +153,4 @@ const VaporFor = /* @__PURE__ */ defineVaporComponent((props, { slots }) => {
139
153
  }, { props: ["in", "getKey"] });
140
154
 
141
155
  //#endregion
142
- export { VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
156
+ export { VaporFor, createComponent, createNodes, createProxyComponent, defineVaporComponent, defineVaporSSRComponent, isBlock, normalizeNode, normalizeVaporSlots, setNodes };
package/dist/vdom.cjs CHANGED
@@ -33,6 +33,9 @@ const normalizeSlot = (rawSlot) => {
33
33
  return normalizeSlotValue(rawSlot(...args));
34
34
  });
35
35
  };
36
+ const normalizeSlots = (slots) => {
37
+ return typeof slots === "function" || Object.prototype.toString.call(slots) === "[object Object]" && !(0, vue.isVNode)(slots) ? slots : { default: (0, vue.withCtx)(() => [normalizeVNode(() => slots)]) };
38
+ };
36
39
  const defineComponent = vue.defineComponent;
37
40
  const For = defineComponent((props, { slots }) => {
38
41
  const defaultSlot = slots.default;
@@ -47,4 +50,5 @@ exports.For = For;
47
50
  exports.createVNodeCache = createVNodeCache;
48
51
  exports.defineComponent = defineComponent;
49
52
  exports.normalizeSlot = normalizeSlot;
53
+ exports.normalizeSlots = normalizeSlots;
50
54
  exports.normalizeVNode = normalizeVNode;
package/dist/vdom.d.cts CHANGED
@@ -6,6 +6,7 @@ import { Component, ComponentInjectOptions, ComponentObjectPropsOptions, Compone
6
6
  declare function createVNodeCache(key: string): any;
7
7
  declare function normalizeVNode(value: VNodeChild | (() => VNodeChild), flag?: number): VNode;
8
8
  declare const normalizeSlot: (rawSlot: Function) => Slot;
9
+ declare const normalizeSlots: (slots: any) => Record<string, any> | Function;
9
10
  type RenderFunction = () => VNodeChild | {};
10
11
  type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
11
12
  __isFragment?: never;
@@ -73,4 +74,4 @@ declare const For: new <T extends any[] | Record<any, any> | number | string | S
73
74
  default: (...args: string extends keyof Item ? [item: T[keyof T], key: keyof T, index: number] : [item: Item, index: number]) => any;
74
75
  }>, {}, {}, never>;
75
76
  //#endregion
76
- export { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeVNode };
77
+ export { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeSlots, normalizeVNode };
package/dist/vdom.d.ts CHANGED
@@ -6,6 +6,7 @@ import { Component, ComponentInjectOptions, ComponentObjectPropsOptions, Compone
6
6
  declare function createVNodeCache(key: string): any;
7
7
  declare function normalizeVNode(value: VNodeChild | (() => VNodeChild), flag?: number): VNode;
8
8
  declare const normalizeSlot: (rawSlot: Function) => Slot;
9
+ declare const normalizeSlots: (slots: any) => Record<string, any> | Function;
9
10
  type RenderFunction = () => VNodeChild | {};
10
11
  type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
11
12
  __isFragment?: never;
@@ -73,4 +74,4 @@ declare const For: new <T extends any[] | Record<any, any> | number | string | S
73
74
  default: (...args: string extends keyof Item ? [item: T[keyof T], key: keyof T, index: number] : [item: Item, index: number]) => any;
74
75
  }>, {}, {}, never>;
75
76
  //#endregion
76
- export { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeVNode };
77
+ export { DefineComponent, DefineSetupFnComponent, For, createVNodeCache, defineComponent, normalizeSlot, normalizeSlots, normalizeVNode };
package/dist/vdom.js CHANGED
@@ -31,6 +31,9 @@ const normalizeSlot = (rawSlot) => {
31
31
  return normalizeSlotValue(rawSlot(...args));
32
32
  });
33
33
  };
34
+ const normalizeSlots = (slots) => {
35
+ return typeof slots === "function" || Object.prototype.toString.call(slots) === "[object Object]" && !isVNode(slots) ? slots : { default: withCtx(() => [normalizeVNode(() => slots)]) };
36
+ };
34
37
  const defineComponent = defineComponent$1;
35
38
  const For = defineComponent((props, { slots }) => {
36
39
  const defaultSlot = slots.default;
@@ -41,4 +44,4 @@ const For = defineComponent((props, { slots }) => {
41
44
  }, { props: ["in"] });
42
45
 
43
46
  //#endregion
44
- export { For, createVNodeCache, defineComponent, normalizeSlot, normalizeVNode };
47
+ export { For, createVNodeCache, defineComponent, normalizeSlot, normalizeSlots, normalizeVNode };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/runtime",
3
3
  "type": "module",
4
- "version": "3.2.16",
4
+ "version": "3.2.18",
5
5
  "description": "Vue JSX Vapor Runtime",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",
@@ -41,7 +41,7 @@
41
41
  ],
42
42
  "peerDependencies": {
43
43
  "csstype": "^3.2.3",
44
- "vue": "3.6.0-beta.12"
44
+ "vue": "3.6.0-beta.16"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsdown",