@vue-jsx-vapor/runtime 3.1.12 → 3.1.14

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/index.cjs CHANGED
@@ -9,6 +9,7 @@ exports.createComponent = require_vapor.createComponent;
9
9
  exports.createComponentWithFallback = require_vapor.createComponentWithFallback;
10
10
  exports.createNodes = require_vapor.createNodes;
11
11
  exports.createVNodeCache = require_vdom.createVNodeCache;
12
+ exports.defineVaporSSRComponent = require_vapor.defineVaporSSRComponent;
12
13
  exports.getCurrentInstance = require_props.getCurrentInstance;
13
14
  exports.h = require_h.h;
14
15
  exports.isBlock = require_vapor.isBlock;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes } from "./vapor.cjs";
1
+ import { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.cjs";
2
2
  import { h } from "./h.cjs";
3
3
  import { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler } from "./jsx.cjs";
4
4
  import { getCurrentInstance, useFullProps, useProps } from "./props.cjs";
5
5
  import { createVNodeCache, normalizeVNode } from "./vdom.cjs";
6
6
  import { shallowRef as useRef } from "vue";
7
- export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, NodeArrayChildren, NodeChild, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createComponentWithFallback, createNodes, createVNodeCache, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
7
+ export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, NodeArrayChildren, NodeChild, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createComponentWithFallback, createNodes, createVNodeCache, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes } from "./vapor.js";
1
+ import { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, defineVaporSSRComponent, isBlock, normalizeNode, setNodes } from "./vapor.js";
2
2
  import { h } from "./h.js";
3
3
  import { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler } from "./jsx.js";
4
4
  import { getCurrentInstance, useFullProps, useProps } from "./props.js";
5
5
  import { createVNodeCache, normalizeVNode } from "./vdom.js";
6
6
  import { shallowRef as useRef } from "vue";
7
- export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, NodeArrayChildren, NodeChild, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createComponentWithFallback, createNodes, createVNodeCache, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
7
+ export { AbstractView, AnchorHTMLAttributes, AnimationEvent, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseEventHandler, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEvent, ChangeEventHandler, ClipboardEvent, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEvent, CompositionEventHandler, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEvent, DragEventHandler, EmbedHTMLAttributes, EventHandler, EventHandlers, Events, FieldsetHTMLAttributes, FocusEvent, FocusEventHandler, FormEvent, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InputTypeHTMLAttribute, InsHTMLAttributes, IntrinsicElementAttributes, KeyboardEvent, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, ModifierKey, MouseEvent, MouseEventHandler, NativeElements, NodeArrayChildren, NodeChild, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OptionHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, ProgressHTMLAttributes, QuoteHTMLAttributes, ReservedProps, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, StyleValue, SyntheticEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TimeHTMLAttributes, TrackHTMLAttributes, TransitionEvent, TransitionEventHandler, UIEvent, UIEventHandler, VideoHTMLAttributes, WebViewHTMLAttributes, WheelEvent, WheelEventHandler, createComponent, createComponentWithFallback, createNodes, createVNodeCache, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes } from "./vapor.js";
1
+ import { createComponent, createComponentWithFallback, createNodes, 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";
5
5
  import { createVNodeCache, normalizeVNode } from "./vdom.js";
6
6
  import { shallowRef as useRef } from "vue";
7
7
 
8
- export { createComponent, createComponentWithFallback, createNodes, createVNodeCache, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
8
+ export { createComponent, createComponentWithFallback, createNodes, createVNodeCache, defineVaporSSRComponent, getCurrentInstance, h, isBlock, normalizeNode, normalizeVNode, setNodes, useFullProps, useProps, useRef };
package/dist/jsx.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as vue0 from "vue";
1
+ import * as vue2 from "vue";
2
2
  import * as CSS from "csstype";
3
3
 
4
4
  //#region src/jsx.d.ts
@@ -1191,7 +1191,7 @@ interface Events<T = Element> {
1191
1191
  onTransitionstart: TransitionEventHandler<T>;
1192
1192
  }
1193
1193
  type EventHandlers<E> = { [K in keyof E]?: E[K] extends ((...args: any) => any) ? E[K] : (payload: E[K]) => void };
1194
- type _ReservedProps = vue0.ReservedProps;
1194
+ type _ReservedProps = vue2.ReservedProps;
1195
1195
  interface ReservedProps extends _ReservedProps {}
1196
1196
  type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps };
1197
1197
  interface BaseSyntheticEvent<E = object, C = unknown, T = unknown> {
package/dist/raw.cjs CHANGED
@@ -2,9 +2,13 @@
2
2
  //#region src/props.ts?raw
3
3
  var props_default = "import { proxyRefs, toRefs, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\nexport function useProps() {\n const i = getCurrentInstance();\n return i.props;\n}\nexport function useFullProps() {\n return proxyRefs({\n ...toRefs(useProps()),\n ...toRefs(useAttrs())\n });\n}\n";
4
4
 
5
+ //#endregion
6
+ //#region src/ssr.ts?raw
7
+ var ssr_default = "import { useSSRContext } from \"vue\";\nexport function ssrRegisterHelper(comp, filename) {\n if (typeof comp === \"function\") {\n comp.__setup = () => {\n const ssrContext = useSSRContext();\n (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);\n };\n } else {\n const setup = comp.setup;\n comp.setup = (props, ctx) => {\n const ssrContext = useSSRContext();\n (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);\n if (setup) {\n return setup(props, ctx);\n }\n };\n }\n}\n";
8
+
5
9
  //#endregion
6
10
  //#region src/vapor.ts?raw
7
- var vapor_default = "import {\n createComponent as _createComponent,\n createComponentWithFallback as _createComponentWithFallback,\n createTextNode,\n currentInstance,\n EffectScope,\n Fragment,\n getCurrentInstance,\n insert,\n isFragment,\n isVaporComponent,\n remove,\n renderEffect,\n VaporFragment\n} from \"vue\";\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(_createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n _createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(_createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if ((i && i.appContext).vapor && p === \"__vapor\") {\n return true;\n }\n return Reflect.get(target, p, receiver);\n }\n });\n } else if (type.__vapor && type.setup) {\n type.setup = new Proxy(type.setup, {\n apply(target, ctx, args2) {\n return normalizeNode(Reflect.apply(target, ctx, args2));\n }\n });\n }\n type.__proxyed = true;\n }\n return createComponent2(type, props, ...args);\n};\nexport function normalizeNode(node) {\n if (node == null || typeof node === \"boolean\") {\n return document.createComment(\"\");\n } else if (Array.isArray(node) && node.length) {\n return node.map(normalizeNode);\n } else if (isBlock(node)) {\n return node;\n } else {\n return createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || isFragment(node)) {\n anchor && (anchor.textContent = \"\");\n return node;\n } else if (isVaporComponent(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(\n node.map((i) => normalizeBlock(i)),\n anchor\n );\n } else {\n const result = node == null || typeof node === \"boolean\" ? \"\" : String(node);\n if (anchor) {\n anchor.textContent = result;\n return anchor;\n } else {\n return document.createTextNode(result);\n }\n }\n}\nfunction resolveValue(current, value, _anchor) {\n const node = normalizeBlock(value, _anchor);\n if (current) {\n if (isFragment(current)) {\n const { anchor } = current;\n if (anchor && anchor.parentNode) {\n remove(current.nodes, anchor.parentNode);\n insert(node, anchor.parentNode, anchor);\n !_anchor && anchor.parentNode.removeChild(anchor);\n }\n } else if (current instanceof Node) {\n if (isFragment(node) && current.parentNode) {\n insert(node, current.parentNode, current);\n current.parentNode.removeChild(current);\n } else if (node instanceof Node) {\n if (current.nodeType === 3 && node.nodeType === 3) {\n current.textContent = node.textContent;\n return current;\n } else if (current.parentNode) {\n current.parentNode.replaceChild(node, current);\n }\n }\n }\n }\n return node;\n}\nfunction resolveValues(values = [], _anchor) {\n const nodes = [];\n const frag = createFragment(nodes, _anchor);\n const scopes = [];\n for (const [index, value] of values.entries()) {\n const anchor = index === values.length - 1 ? _anchor : void 0;\n if (typeof value === \"function\") {\n renderEffect(() => {\n if (scopes[index]) scopes[index].stop();\n scopes[index] = new EffectScope();\n nodes[index] = scopes[index].run(\n () => resolveValue(nodes[index], value(), anchor)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor);\n }\n }\n return frag;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
11
+ var vapor_default = "import {\n createComponent as _createComponent,\n createComponentWithFallback as _createComponentWithFallback,\n createTextNode,\n currentInstance,\n EffectScope,\n Fragment,\n getCurrentInstance,\n insert,\n isFragment,\n isVaporComponent,\n remove,\n renderEffect,\n VaporFragment\n} from \"vue\";\nexport function defineVaporSSRComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return /* @__PURE__ */ (() => Object.assign({ name: comp.name }, extraOptions, {\n setup(props, ctx) {\n const result = comp(props, ctx);\n return () => result;\n },\n __vapor: true\n }))();\n }\n const setup = comp.setup;\n if (setup) {\n comp.setup = (props, ctx) => {\n const result = setup(props, ctx);\n return () => result;\n };\n }\n comp.__vapor = true;\n return comp;\n}\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(_createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n _createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(_createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if (i && i.appContext.vapor && p === \"__vapor\") {\n return true;\n }\n return Reflect.get(target, p, receiver);\n }\n });\n } else if (type.__vapor && type.setup) {\n type.setup = new Proxy(type.setup, {\n apply(target, ctx, args2) {\n return normalizeNode(Reflect.apply(target, ctx, args2));\n }\n });\n }\n type.__proxyed = true;\n }\n return createComponent2(type, props, ...args);\n};\nexport function normalizeNode(node) {\n if (node == null || typeof node === \"boolean\") {\n return document.createComment(\"\");\n } else if (Array.isArray(node) && node.length) {\n return node.map(normalizeNode);\n } else if (isBlock(node)) {\n return node;\n } else {\n return createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || isFragment(node)) {\n anchor && (anchor.textContent = \"\");\n return node;\n } else if (isVaporComponent(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(\n node.map((i) => normalizeBlock(i)),\n anchor\n );\n } else {\n const result = node == null || typeof node === \"boolean\" ? \"\" : String(node);\n if (anchor) {\n anchor.textContent = result;\n return anchor;\n } else {\n return document.createTextNode(result);\n }\n }\n}\nfunction resolveValue(current, value, _anchor) {\n const node = normalizeBlock(value, _anchor);\n if (current) {\n if (isFragment(current)) {\n const { anchor } = current;\n if (anchor && anchor.parentNode) {\n remove(current.nodes, anchor.parentNode);\n insert(node, anchor.parentNode, anchor);\n !_anchor && anchor.parentNode.removeChild(anchor);\n }\n } else if (current instanceof Node) {\n if (isFragment(node) && current.parentNode) {\n insert(node, current.parentNode, current);\n current.parentNode.removeChild(current);\n } else if (node instanceof Node) {\n if (current.nodeType === 3 && node.nodeType === 3) {\n current.textContent = node.textContent;\n return current;\n } else if (current.parentNode) {\n current.parentNode.replaceChild(node, current);\n }\n }\n }\n }\n return node;\n}\nfunction resolveValues(values = [], _anchor) {\n const nodes = [];\n const frag = createFragment(nodes, _anchor);\n const scopes = [];\n for (const [index, value] of values.entries()) {\n const anchor = index === values.length - 1 ? _anchor : void 0;\n if (typeof value === \"function\") {\n renderEffect(() => {\n if (scopes[index]) scopes[index].stop();\n scopes[index] = new EffectScope();\n nodes[index] = scopes[index].run(\n () => resolveValue(nodes[index], value(), anchor)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor);\n }\n }\n return frag;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
8
12
 
9
13
  //#endregion
10
14
  //#region src/vdom.ts?raw
@@ -15,13 +19,17 @@ var vdom_default = "import {\n cloneVNode,\n createBlock,\n createVNode,\n F
15
19
  const propsHelperCode = props_default;
16
20
  const vdomHelperCode = vdom_default;
17
21
  const vaporHelperCode = vapor_default;
22
+ const ssrHelperCode = ssr_default;
18
23
  const propsHelperId = "/vue-jsx-vapor/props";
19
24
  const vdomHelperId = "/vue-jsx-vapor/vdom";
20
25
  const vaporHelperId = "/vue-jsx-vapor/vapor";
26
+ const ssrHelperId = "/vue-jsx-vapor/ssr";
21
27
 
22
28
  //#endregion
23
29
  exports.propsHelperCode = propsHelperCode;
24
30
  exports.propsHelperId = propsHelperId;
31
+ exports.ssrHelperCode = ssrHelperCode;
32
+ exports.ssrHelperId = ssrHelperId;
25
33
  exports.vaporHelperCode = vaporHelperCode;
26
34
  exports.vaporHelperId = vaporHelperId;
27
35
  exports.vdomHelperCode = vdomHelperCode;
package/dist/raw.d.cts CHANGED
@@ -2,8 +2,10 @@
2
2
  declare const propsHelperCode: string;
3
3
  declare const vdomHelperCode: string;
4
4
  declare const vaporHelperCode: string;
5
+ declare const ssrHelperCode: string;
5
6
  declare const propsHelperId = "/vue-jsx-vapor/props";
6
7
  declare const vdomHelperId = "/vue-jsx-vapor/vdom";
7
8
  declare const vaporHelperId = "/vue-jsx-vapor/vapor";
9
+ declare const ssrHelperId = "/vue-jsx-vapor/ssr";
8
10
  //#endregion
9
- export { propsHelperCode, propsHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
11
+ export { propsHelperCode, propsHelperId, ssrHelperCode, ssrHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
package/dist/raw.d.ts CHANGED
@@ -2,8 +2,10 @@
2
2
  declare const propsHelperCode: string;
3
3
  declare const vdomHelperCode: string;
4
4
  declare const vaporHelperCode: string;
5
+ declare const ssrHelperCode: string;
5
6
  declare const propsHelperId = "/vue-jsx-vapor/props";
6
7
  declare const vdomHelperId = "/vue-jsx-vapor/vdom";
7
8
  declare const vaporHelperId = "/vue-jsx-vapor/vapor";
9
+ declare const ssrHelperId = "/vue-jsx-vapor/ssr";
8
10
  //#endregion
9
- export { propsHelperCode, propsHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
11
+ export { propsHelperCode, propsHelperId, ssrHelperCode, ssrHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
package/dist/raw.js CHANGED
@@ -1,9 +1,13 @@
1
1
  //#region src/props.ts?raw
2
2
  var props_default = "import { proxyRefs, toRefs, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\nexport function useProps() {\n const i = getCurrentInstance();\n return i.props;\n}\nexport function useFullProps() {\n return proxyRefs({\n ...toRefs(useProps()),\n ...toRefs(useAttrs())\n });\n}\n";
3
3
 
4
+ //#endregion
5
+ //#region src/ssr.ts?raw
6
+ var ssr_default = "import { useSSRContext } from \"vue\";\nexport function ssrRegisterHelper(comp, filename) {\n if (typeof comp === \"function\") {\n comp.__setup = () => {\n const ssrContext = useSSRContext();\n (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);\n };\n } else {\n const setup = comp.setup;\n comp.setup = (props, ctx) => {\n const ssrContext = useSSRContext();\n (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);\n if (setup) {\n return setup(props, ctx);\n }\n };\n }\n}\n";
7
+
4
8
  //#endregion
5
9
  //#region src/vapor.ts?raw
6
- var vapor_default = "import {\n createComponent as _createComponent,\n createComponentWithFallback as _createComponentWithFallback,\n createTextNode,\n currentInstance,\n EffectScope,\n Fragment,\n getCurrentInstance,\n insert,\n isFragment,\n isVaporComponent,\n remove,\n renderEffect,\n VaporFragment\n} from \"vue\";\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(_createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n _createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(_createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if ((i && i.appContext).vapor && p === \"__vapor\") {\n return true;\n }\n return Reflect.get(target, p, receiver);\n }\n });\n } else if (type.__vapor && type.setup) {\n type.setup = new Proxy(type.setup, {\n apply(target, ctx, args2) {\n return normalizeNode(Reflect.apply(target, ctx, args2));\n }\n });\n }\n type.__proxyed = true;\n }\n return createComponent2(type, props, ...args);\n};\nexport function normalizeNode(node) {\n if (node == null || typeof node === \"boolean\") {\n return document.createComment(\"\");\n } else if (Array.isArray(node) && node.length) {\n return node.map(normalizeNode);\n } else if (isBlock(node)) {\n return node;\n } else {\n return createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || isFragment(node)) {\n anchor && (anchor.textContent = \"\");\n return node;\n } else if (isVaporComponent(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(\n node.map((i) => normalizeBlock(i)),\n anchor\n );\n } else {\n const result = node == null || typeof node === \"boolean\" ? \"\" : String(node);\n if (anchor) {\n anchor.textContent = result;\n return anchor;\n } else {\n return document.createTextNode(result);\n }\n }\n}\nfunction resolveValue(current, value, _anchor) {\n const node = normalizeBlock(value, _anchor);\n if (current) {\n if (isFragment(current)) {\n const { anchor } = current;\n if (anchor && anchor.parentNode) {\n remove(current.nodes, anchor.parentNode);\n insert(node, anchor.parentNode, anchor);\n !_anchor && anchor.parentNode.removeChild(anchor);\n }\n } else if (current instanceof Node) {\n if (isFragment(node) && current.parentNode) {\n insert(node, current.parentNode, current);\n current.parentNode.removeChild(current);\n } else if (node instanceof Node) {\n if (current.nodeType === 3 && node.nodeType === 3) {\n current.textContent = node.textContent;\n return current;\n } else if (current.parentNode) {\n current.parentNode.replaceChild(node, current);\n }\n }\n }\n }\n return node;\n}\nfunction resolveValues(values = [], _anchor) {\n const nodes = [];\n const frag = createFragment(nodes, _anchor);\n const scopes = [];\n for (const [index, value] of values.entries()) {\n const anchor = index === values.length - 1 ? _anchor : void 0;\n if (typeof value === \"function\") {\n renderEffect(() => {\n if (scopes[index]) scopes[index].stop();\n scopes[index] = new EffectScope();\n nodes[index] = scopes[index].run(\n () => resolveValue(nodes[index], value(), anchor)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor);\n }\n }\n return frag;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
10
+ var vapor_default = "import {\n createComponent as _createComponent,\n createComponentWithFallback as _createComponentWithFallback,\n createTextNode,\n currentInstance,\n EffectScope,\n Fragment,\n getCurrentInstance,\n insert,\n isFragment,\n isVaporComponent,\n remove,\n renderEffect,\n VaporFragment\n} from \"vue\";\nexport function defineVaporSSRComponent(comp, extraOptions) {\n if (typeof comp === \"function\") {\n return /* @__PURE__ */ (() => Object.assign({ name: comp.name }, extraOptions, {\n setup(props, ctx) {\n const result = comp(props, ctx);\n return () => result;\n },\n __vapor: true\n }))();\n }\n const setup = comp.setup;\n if (setup) {\n comp.setup = (props, ctx) => {\n const result = setup(props, ctx);\n return () => result;\n };\n }\n comp.__vapor = true;\n return comp;\n}\nexport const createComponent = (type, ...args) => {\n return createProxyComponent(_createComponent, type, ...args);\n};\nexport const createComponentWithFallback = (type, ...args) => {\n const slots = args[1];\n if (typeof type === \"string\" && slots && slots.default && typeof slots.default === \"function\") {\n const defaultSlot = slots.default;\n slots.default = () => {\n return createProxyComponent(\n _createComponentWithFallback,\n defaultSlot,\n null,\n null\n );\n };\n }\n return createProxyComponent(_createComponentWithFallback, type, ...args);\n};\nconst createProxyComponent = (createComponent2, type, props, ...args) => {\n if (type === Fragment) {\n type = (_, { slots }) => slots.default ? slots.default() : [];\n props = null;\n }\n const i = currentInstance || getCurrentInstance();\n if (!type.__proxyed) {\n if (typeof type === \"function\") {\n type = new Proxy(type, {\n apply(target, ctx, args2) {\n if (typeof target.__setup === \"function\") {\n target.__setup.apply(ctx, args2);\n }\n return normalizeNode(Reflect.apply(target, ctx, args2));\n },\n get(target, p, receiver) {\n if (i && i.appContext.vapor && p === \"__vapor\") {\n return true;\n }\n return Reflect.get(target, p, receiver);\n }\n });\n } else if (type.__vapor && type.setup) {\n type.setup = new Proxy(type.setup, {\n apply(target, ctx, args2) {\n return normalizeNode(Reflect.apply(target, ctx, args2));\n }\n });\n }\n type.__proxyed = true;\n }\n return createComponent2(type, props, ...args);\n};\nexport function normalizeNode(node) {\n if (node == null || typeof node === \"boolean\") {\n return document.createComment(\"\");\n } else if (Array.isArray(node) && node.length) {\n return node.map(normalizeNode);\n } else if (isBlock(node)) {\n return node;\n } else {\n return createTextNode(String(node));\n }\n}\nexport function isBlock(val) {\n return val instanceof Node || Array.isArray(val) || isVaporComponent(val) || isFragment(val);\n}\nfunction createFragment(nodes, anchor = document.createTextNode(\"\")) {\n const frag = new VaporFragment(nodes);\n frag.anchor = anchor;\n return frag;\n}\nfunction normalizeBlock(node, anchor) {\n if (node instanceof Node || isFragment(node)) {\n anchor && (anchor.textContent = \"\");\n return node;\n } else if (isVaporComponent(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(node, anchor);\n } else if (Array.isArray(node)) {\n anchor && (anchor.textContent = \"\");\n return createFragment(\n node.map((i) => normalizeBlock(i)),\n anchor\n );\n } else {\n const result = node == null || typeof node === \"boolean\" ? \"\" : String(node);\n if (anchor) {\n anchor.textContent = result;\n return anchor;\n } else {\n return document.createTextNode(result);\n }\n }\n}\nfunction resolveValue(current, value, _anchor) {\n const node = normalizeBlock(value, _anchor);\n if (current) {\n if (isFragment(current)) {\n const { anchor } = current;\n if (anchor && anchor.parentNode) {\n remove(current.nodes, anchor.parentNode);\n insert(node, anchor.parentNode, anchor);\n !_anchor && anchor.parentNode.removeChild(anchor);\n }\n } else if (current instanceof Node) {\n if (isFragment(node) && current.parentNode) {\n insert(node, current.parentNode, current);\n current.parentNode.removeChild(current);\n } else if (node instanceof Node) {\n if (current.nodeType === 3 && node.nodeType === 3) {\n current.textContent = node.textContent;\n return current;\n } else if (current.parentNode) {\n current.parentNode.replaceChild(node, current);\n }\n }\n }\n }\n return node;\n}\nfunction resolveValues(values = [], _anchor) {\n const nodes = [];\n const frag = createFragment(nodes, _anchor);\n const scopes = [];\n for (const [index, value] of values.entries()) {\n const anchor = index === values.length - 1 ? _anchor : void 0;\n if (typeof value === \"function\") {\n renderEffect(() => {\n if (scopes[index]) scopes[index].stop();\n scopes[index] = new EffectScope();\n nodes[index] = scopes[index].run(\n () => resolveValue(nodes[index], value(), anchor)\n );\n });\n } else {\n nodes[index] = resolveValue(nodes[index], value, anchor);\n }\n }\n return frag;\n}\nexport function setNodes(anchor, ...values) {\n const resolvedValues = resolveValues(values, anchor);\n anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);\n}\nexport function createNodes(...values) {\n return resolveValues(values);\n}\n";
7
11
 
8
12
  //#endregion
9
13
  //#region src/vdom.ts?raw
@@ -14,9 +18,11 @@ var vdom_default = "import {\n cloneVNode,\n createBlock,\n createVNode,\n F
14
18
  const propsHelperCode = props_default;
15
19
  const vdomHelperCode = vdom_default;
16
20
  const vaporHelperCode = vapor_default;
21
+ const ssrHelperCode = ssr_default;
17
22
  const propsHelperId = "/vue-jsx-vapor/props";
18
23
  const vdomHelperId = "/vue-jsx-vapor/vdom";
19
24
  const vaporHelperId = "/vue-jsx-vapor/vapor";
25
+ const ssrHelperId = "/vue-jsx-vapor/ssr";
20
26
 
21
27
  //#endregion
22
- export { propsHelperCode, propsHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
28
+ export { propsHelperCode, propsHelperId, ssrHelperCode, ssrHelperId, vaporHelperCode, vaporHelperId, vdomHelperCode, vdomHelperId };
package/dist/ssr.cjs ADDED
@@ -0,0 +1,21 @@
1
+ const require_props = require('./props-DyKlXDej.cjs');
2
+ let vue = require("vue");
3
+
4
+ //#region src/ssr.ts
5
+ function ssrRegisterHelper(comp, filename) {
6
+ if (typeof comp === "function") comp.__setup = () => {
7
+ const ssrContext = (0, vue.useSSRContext)();
8
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);
9
+ };
10
+ else {
11
+ const setup = comp.setup;
12
+ comp.setup = (props, ctx) => {
13
+ const ssrContext = (0, vue.useSSRContext)();
14
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);
15
+ if (setup) return setup(props, ctx);
16
+ };
17
+ }
18
+ }
19
+
20
+ //#endregion
21
+ exports.ssrRegisterHelper = ssrRegisterHelper;
package/dist/ssr.d.cts ADDED
@@ -0,0 +1,6 @@
1
+ import { ComponentOptions } from "vue";
2
+
3
+ //#region src/ssr.d.ts
4
+ declare function ssrRegisterHelper(comp: ComponentOptions, filename: string): void;
5
+ //#endregion
6
+ export { ssrRegisterHelper };
package/dist/ssr.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { ComponentOptions } from "vue";
2
+
3
+ //#region src/ssr.d.ts
4
+ declare function ssrRegisterHelper(comp: ComponentOptions, filename: string): void;
5
+ //#endregion
6
+ export { ssrRegisterHelper };
package/dist/ssr.js ADDED
@@ -0,0 +1,20 @@
1
+ import { useSSRContext } from "vue";
2
+
3
+ //#region src/ssr.ts
4
+ function ssrRegisterHelper(comp, filename) {
5
+ if (typeof comp === "function") comp.__setup = () => {
6
+ const ssrContext = useSSRContext();
7
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);
8
+ };
9
+ else {
10
+ const setup = comp.setup;
11
+ comp.setup = (props, ctx) => {
12
+ const ssrContext = useSSRContext();
13
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);
14
+ if (setup) return setup(props, ctx);
15
+ };
16
+ }
17
+ }
18
+
19
+ //#endregion
20
+ export { ssrRegisterHelper };
package/dist/vapor.cjs CHANGED
@@ -2,6 +2,16 @@ const require_props = require('./props-DyKlXDej.cjs');
2
2
  let vue = require("vue");
3
3
 
4
4
  //#region src/vapor.ts
5
+ function defineVaporSSRComponent(comp, extraOptions) {
6
+ if (typeof comp === "function") return;
7
+ const setup = comp.setup;
8
+ if (setup) comp.setup = (props, ctx) => {
9
+ const result = setup(props, ctx);
10
+ return () => result;
11
+ };
12
+ comp.__vapor = true;
13
+ return comp;
14
+ }
5
15
  const createComponent = (type, ...args) => {
6
16
  return createProxyComponent(vue.createComponent, type, ...args);
7
17
  };
@@ -28,7 +38,7 @@ const createProxyComponent = (createComponent$1, type, props, ...args) => {
28
38
  return normalizeNode(Reflect.apply(target, ctx, args$1));
29
39
  },
30
40
  get(target, p, receiver) {
31
- if ((i && i.appContext).vapor && p === "__vapor") return true;
41
+ if (i && i.appContext.vapor && p === "__vapor") return true;
32
42
  return Reflect.get(target, p, receiver);
33
43
  }
34
44
  });
@@ -122,6 +132,7 @@ function createNodes(...values) {
122
132
  exports.createComponent = createComponent;
123
133
  exports.createComponentWithFallback = createComponentWithFallback;
124
134
  exports.createNodes = createNodes;
135
+ exports.defineVaporSSRComponent = defineVaporSSRComponent;
125
136
  exports.isBlock = isBlock;
126
137
  exports.normalizeNode = normalizeNode;
127
138
  exports.setNodes = setNodes;
package/dist/vapor.d.cts CHANGED
@@ -1,10 +1,11 @@
1
- import * as vue1 from "vue";
1
+ import * as vue0 from "vue";
2
2
  import { Block, Fragment, VaporComponent, VaporFragment, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1 } from "vue";
3
3
 
4
4
  //#region src/vapor.d.ts
5
+ declare function defineVaporSSRComponent(comp: VaporComponent, extraOptions: VaporComponent): VaporComponent;
5
6
  type Tail<T extends any[]> = T extends [any, ...infer R] ? R : never;
6
- declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponent$1>>) => vue1.VaporComponentInstance | HTMLElement;
7
- declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback$1>>) => vue1.VaporComponentInstance | HTMLElement;
7
+ declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponent$1>>) => vue0.VaporComponentInstance | HTMLElement;
8
+ declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback$1>>) => vue0.VaporComponentInstance | HTMLElement;
8
9
  type NodeChildAtom = Block | string | number | boolean | null | undefined | void;
9
10
  type NodeArrayChildren = Array<NodeArrayChildren | NodeChildAtom>;
10
11
  type NodeChild = NodeChildAtom | NodeArrayChildren;
@@ -13,4 +14,4 @@ declare function isBlock(val: NonNullable<unknown>): val is Block;
13
14
  declare function setNodes(anchor: Node, ...values: any[]): void;
14
15
  declare function createNodes(...values: any[]): VaporFragment;
15
16
  //#endregion
16
- export { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes };
17
+ export { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
package/dist/vapor.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as vue1 from "vue";
2
2
  import { Block, Fragment, VaporComponent, VaporFragment, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1 } from "vue";
3
3
 
4
4
  //#region src/vapor.d.ts
5
+ declare function defineVaporSSRComponent(comp: VaporComponent, extraOptions: VaporComponent): VaporComponent;
5
6
  type Tail<T extends any[]> = T extends [any, ...infer R] ? R : never;
6
7
  declare const createComponent: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponent$1>>) => vue1.VaporComponentInstance | HTMLElement;
7
8
  declare const createComponentWithFallback: (type: VaporComponent | typeof Fragment, ...args: Tail<Parameters<typeof createComponentWithFallback$1>>) => vue1.VaporComponentInstance | HTMLElement;
@@ -13,4 +14,4 @@ declare function isBlock(val: NonNullable<unknown>): val is Block;
13
14
  declare function setNodes(anchor: Node, ...values: any[]): void;
14
15
  declare function createNodes(...values: any[]): VaporFragment;
15
16
  //#endregion
16
- export { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes };
17
+ export { NodeArrayChildren, NodeChild, createComponent, createComponentWithFallback, createNodes, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
package/dist/vapor.js CHANGED
@@ -1,6 +1,16 @@
1
1
  import { EffectScope, Fragment, VaporFragment, createComponent as createComponent$1, createComponentWithFallback as createComponentWithFallback$1, createTextNode, currentInstance, getCurrentInstance, insert, isFragment, isVaporComponent, remove, renderEffect } from "vue";
2
2
 
3
3
  //#region src/vapor.ts
4
+ function defineVaporSSRComponent(comp, extraOptions) {
5
+ if (typeof comp === "function") return;
6
+ const setup = comp.setup;
7
+ if (setup) comp.setup = (props, ctx) => {
8
+ const result = setup(props, ctx);
9
+ return () => result;
10
+ };
11
+ comp.__vapor = true;
12
+ return comp;
13
+ }
4
14
  const createComponent = (type, ...args) => {
5
15
  return createProxyComponent(createComponent$1, type, ...args);
6
16
  };
@@ -27,7 +37,7 @@ const createProxyComponent = (createComponent$2, type, props, ...args) => {
27
37
  return normalizeNode(Reflect.apply(target, ctx, args$1));
28
38
  },
29
39
  get(target, p, receiver) {
30
- if ((i && i.appContext).vapor && p === "__vapor") return true;
40
+ if (i && i.appContext.vapor && p === "__vapor") return true;
31
41
  return Reflect.get(target, p, receiver);
32
42
  }
33
43
  });
@@ -118,4 +128,4 @@ function createNodes(...values) {
118
128
  }
119
129
 
120
130
  //#endregion
121
- export { createComponent, createComponentWithFallback, createNodes, isBlock, normalizeNode, setNodes };
131
+ export { createComponent, createComponentWithFallback, createNodes, defineVaporSSRComponent, isBlock, normalizeNode, setNodes };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/runtime",
3
3
  "type": "module",
4
- "version": "3.1.12",
4
+ "version": "3.1.14",
5
5
  "description": "Vue JSX Vapor Runtime",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",