@vue-jsx-vapor/runtime 3.1.1 → 3.1.3

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/jsx.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as vue1 from "vue";
1
+ import * as vue0 from "vue";
2
2
  import * as CSS from "csstype";
3
3
 
4
4
  //#region src/jsx.d.ts
@@ -1191,7 +1191,7 @@ interface Events<T = Element> {
1191
1191
  onTransitionstart: TransitionEventHandler<T>;
1192
1192
  }
1193
1193
  type EventHandlers<E> = { [K in keyof E]?: E[K] extends ((...args: any) => any) ? E[K] : (payload: E[K]) => void };
1194
- type _ReservedProps = vue1.ReservedProps;
1194
+ type _ReservedProps = vue0.ReservedProps;
1195
1195
  interface ReservedProps extends _ReservedProps {}
1196
1196
  type NativeElements = { [K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps };
1197
1197
  interface BaseSyntheticEvent<E = object, C = unknown, T = unknown> {
package/dist/vnode.cjs CHANGED
@@ -3,19 +3,23 @@ let vue = require("vue");
3
3
 
4
4
  //#region src/vnode.ts
5
5
  const cacheMap = /* @__PURE__ */ new WeakMap();
6
- function createVNodeCache() {
6
+ function createVNodeCache(index) {
7
7
  const i = (0, vue.getCurrentInstance)();
8
8
  if (i) {
9
9
  !cacheMap.has(i) && cacheMap.set(i, []);
10
10
  const caches = cacheMap.get(i);
11
- return caches[caches.length] = [];
11
+ return caches[index] || (caches[index] = []);
12
12
  } else return [];
13
13
  }
14
- function normalizeVNode(child = " ", flag = 0) {
15
- if (child == null || typeof child === "boolean") return (0, vue.createVNode)(vue.Comment);
16
- else if (Array.isArray(child)) return (0, vue.createVNode)(vue.Fragment, null, child.map((node) => normalizeVNode(node)));
17
- else if ((0, vue.isVNode)(child)) return (0, vue.openBlock)(), (0, vue.createBlock)(cloneIfMounted(child));
18
- else return (0, vue.createVNode)(vue.Text, null, String(child), flag);
14
+ function normalizeVNode(value = " ", flag = 0) {
15
+ if (value == null || typeof value === "boolean") return (0, vue.createVNode)(vue.Comment);
16
+ else if (typeof value !== "function") return (0, vue.createVNode)(vue.Text, null, String(value), flag);
17
+ (0, vue.openBlock)();
18
+ const child = value();
19
+ if (value == null || typeof value === "boolean") return (0, vue.createBlock)(vue.Comment);
20
+ else if (Array.isArray(child)) return (0, vue.createBlock)(vue.Fragment, null, child.slice());
21
+ else if ((0, vue.isVNode)(child)) return (0, vue.createBlock)(cloneIfMounted(child));
22
+ else return (0, vue.createBlock)(vue.Text, null, String(child), flag);
19
23
  }
20
24
  function cloneIfMounted(child) {
21
25
  return child.el === null && child.patchFlag !== -1 || child.memo ? child : (0, vue.cloneVNode)(child);
package/dist/vnode.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { VNode } from "vue";
2
2
 
3
3
  //#region src/vnode.d.ts
4
- declare function createVNodeCache(): never[];
5
- declare function normalizeVNode(child?: string, flag?: number): VNode;
4
+ declare function createVNodeCache(index: number): any;
5
+ declare function normalizeVNode(value?: any, flag?: number): VNode;
6
6
  //#endregion
7
7
  export { createVNodeCache, normalizeVNode };
package/dist/vnode.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { VNode } from "vue";
2
2
 
3
3
  //#region src/vnode.d.ts
4
- declare function createVNodeCache(): never[];
5
- declare function normalizeVNode(child?: string, flag?: number): VNode;
4
+ declare function createVNodeCache(index: number): any;
5
+ declare function normalizeVNode(value?: any, flag?: number): VNode;
6
6
  //#endregion
7
7
  export { createVNodeCache, normalizeVNode };
package/dist/vnode.js CHANGED
@@ -2,19 +2,23 @@ import { Comment, Fragment, Text, cloneVNode, createBlock, createVNode, getCurre
2
2
 
3
3
  //#region src/vnode.ts
4
4
  const cacheMap = /* @__PURE__ */ new WeakMap();
5
- function createVNodeCache() {
5
+ function createVNodeCache(index) {
6
6
  const i = getCurrentInstance();
7
7
  if (i) {
8
8
  !cacheMap.has(i) && cacheMap.set(i, []);
9
9
  const caches = cacheMap.get(i);
10
- return caches[caches.length] = [];
10
+ return caches[index] || (caches[index] = []);
11
11
  } else return [];
12
12
  }
13
- function normalizeVNode(child = " ", flag = 0) {
14
- if (child == null || typeof child === "boolean") return createVNode(Comment);
15
- else if (Array.isArray(child)) return createVNode(Fragment, null, child.map((node) => normalizeVNode(node)));
16
- else if (isVNode(child)) return openBlock(), createBlock(cloneIfMounted(child));
17
- else return createVNode(Text, null, String(child), flag);
13
+ function normalizeVNode(value = " ", flag = 0) {
14
+ if (value == null || typeof value === "boolean") return createVNode(Comment);
15
+ else if (typeof value !== "function") return createVNode(Text, null, String(value), flag);
16
+ openBlock();
17
+ const child = value();
18
+ if (value == null || typeof value === "boolean") return createBlock(Comment);
19
+ else if (Array.isArray(child)) return createBlock(Fragment, null, child.slice());
20
+ else if (isVNode(child)) return createBlock(cloneIfMounted(child));
21
+ else return createBlock(Text, null, String(child), flag);
18
22
  }
19
23
  function cloneIfMounted(child) {
20
24
  return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
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.1",
4
+ "version": "3.1.3",
5
5
  "description": "Vue JSX Vapor Runtime",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",