@vue-jsx-vapor/runtime 3.2.2 → 3.2.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/props.cjs CHANGED
@@ -37,9 +37,37 @@ function useProps() {
37
37
  */
38
38
  /* @__NO_SIDE_EFFECTS__ */
39
39
  function useFullProps() {
40
- return (0, vue.proxyRefs)({
41
- ...(0, vue.toRefs)(/* @__PURE__ */ useProps()),
42
- ...(0, vue.toRefs)((0, vue.useAttrs)())
40
+ const attrs = (0, vue.useAttrs)();
41
+ if (!(/* @__PURE__ */ getCurrentInstance()).type.props) return attrs;
42
+ const props = /* @__PURE__ */ useProps();
43
+ const fullProps = (0, vue.computed)(() => ({
44
+ ...props,
45
+ ...attrs
46
+ }));
47
+ return new Proxy({}, {
48
+ get(_, p, receiver) {
49
+ return (0, vue.unref)(Reflect.get(fullProps.value, p, receiver));
50
+ },
51
+ set(_, p, value) {
52
+ if ((0, vue.isRef)(fullProps.value[p]) && !(0, vue.isRef)(value)) fullProps.value[p].value = value;
53
+ else fullProps.value[p] = value;
54
+ return true;
55
+ },
56
+ deleteProperty(_, p) {
57
+ return Reflect.deleteProperty(fullProps.value, p);
58
+ },
59
+ has(_, p) {
60
+ return Reflect.has(fullProps.value, p);
61
+ },
62
+ ownKeys() {
63
+ return Object.keys(fullProps.value);
64
+ },
65
+ getOwnPropertyDescriptor() {
66
+ return {
67
+ enumerable: true,
68
+ configurable: true
69
+ };
70
+ }
43
71
  });
44
72
  }
45
73
 
package/dist/props.d.cts CHANGED
@@ -29,8 +29,6 @@ declare function useProps(): {
29
29
  * const fullProps = useFullProps() // = useAttrs() + useProps()
30
30
  * })
31
31
  */
32
- declare function useFullProps(): vue0.ShallowUnwrapRef<{
33
- [x: string]: vue0.Ref<unknown, unknown>;
34
- }>;
32
+ declare function useFullProps(): {};
35
33
  //#endregion
36
34
  export { getCurrentInstance, useFullProps, useProps };
package/dist/props.d.ts CHANGED
@@ -29,8 +29,6 @@ declare function useProps(): {
29
29
  * const fullProps = useFullProps() // = useAttrs() + useProps()
30
30
  * })
31
31
  */
32
- declare function useFullProps(): vue0.ShallowUnwrapRef<{
33
- [x: string]: vue0.Ref<unknown, unknown>;
34
- }>;
32
+ declare function useFullProps(): {};
35
33
  //#endregion
36
34
  export { getCurrentInstance, useFullProps, useProps };
package/dist/props.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Vue from "vue";
2
- import { proxyRefs, toRefs, useAttrs } from "vue";
2
+ import { computed, isRef, unref, useAttrs } from "vue";
3
3
 
4
4
  //#region src/props.ts
5
5
  /* @__NO_SIDE_EFFECTS__ */
@@ -36,9 +36,37 @@ function useProps() {
36
36
  */
37
37
  /* @__NO_SIDE_EFFECTS__ */
38
38
  function useFullProps() {
39
- return proxyRefs({
40
- ...toRefs(/* @__PURE__ */ useProps()),
41
- ...toRefs(useAttrs())
39
+ const attrs = useAttrs();
40
+ if (!(/* @__PURE__ */ getCurrentInstance()).type.props) return attrs;
41
+ const props = /* @__PURE__ */ useProps();
42
+ const fullProps = computed(() => ({
43
+ ...props,
44
+ ...attrs
45
+ }));
46
+ return new Proxy({}, {
47
+ get(_, p, receiver) {
48
+ return unref(Reflect.get(fullProps.value, p, receiver));
49
+ },
50
+ set(_, p, value) {
51
+ if (isRef(fullProps.value[p]) && !isRef(value)) fullProps.value[p].value = value;
52
+ else fullProps.value[p] = value;
53
+ return true;
54
+ },
55
+ deleteProperty(_, p) {
56
+ return Reflect.deleteProperty(fullProps.value, p);
57
+ },
58
+ has(_, p) {
59
+ return Reflect.has(fullProps.value, p);
60
+ },
61
+ ownKeys() {
62
+ return Object.keys(fullProps.value);
63
+ },
64
+ getOwnPropertyDescriptor() {
65
+ return {
66
+ enumerable: true,
67
+ configurable: true
68
+ };
69
+ }
42
70
  });
43
71
  }
44
72
 
package/dist/raw.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  //#region src/props.ts?raw
3
- var props_default = "import { proxyRefs, toRefs, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\n// @__NO_SIDE_EFFECTS__\nexport function useProps() {\n const i = /* @__PURE__ */ getCurrentInstance();\n return i.props;\n}\n// @__NO_SIDE_EFFECTS__\nexport function useFullProps() {\n return proxyRefs({\n ...toRefs(/* @__PURE__ */ useProps()),\n ...toRefs(useAttrs())\n });\n}\n";
3
+ var props_default = "import { computed, isRef, unref, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\n// @__NO_SIDE_EFFECTS__\nexport function useProps() {\n const i = /* @__PURE__ */ getCurrentInstance();\n return i.props;\n}\n// @__NO_SIDE_EFFECTS__\nexport function useFullProps() {\n const attrs = useAttrs();\n const i = /* @__PURE__ */ getCurrentInstance();\n if (!i.type.props) {\n return attrs;\n }\n const props = /* @__PURE__ */ useProps();\n const fullProps = computed(() => ({ ...props, ...attrs }));\n return new Proxy(\n {},\n {\n get(_, p, receiver) {\n return unref(Reflect.get(fullProps.value, p, receiver));\n },\n set(_, p, value) {\n if (isRef(fullProps.value[p]) && !isRef(value))\n fullProps.value[p].value = value;\n else fullProps.value[p] = value;\n return true;\n },\n deleteProperty(_, p) {\n return Reflect.deleteProperty(fullProps.value, p);\n },\n has(_, p) {\n return Reflect.has(fullProps.value, p);\n },\n ownKeys() {\n return Object.keys(fullProps.value);\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true\n };\n }\n }\n );\n}\n";
4
4
 
5
5
  //#endregion
6
6
  //#region src/ssr.ts?raw
@@ -12,7 +12,7 @@ var vapor_default = "import {\n EffectScope,\n Fragment,\n getCurrentInstance
12
12
 
13
13
  //#endregion
14
14
  //#region src/vdom.ts?raw
15
- var vdom_default = "import {\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n Text\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(index) {\n const i = getCurrentInstance();\n if (i) {\n if (!cacheMap.has(i)) cacheMap.set(i, []);\n const caches = cacheMap.get(i);\n return caches[index] || (caches[index] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value = \" \", flag = 1) {\n let create = createVNode;\n const isFunction = typeof value === \"function\";\n if (isFunction) {\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isFunction ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? createElementBlock(\n Fragment,\n null,\n value.map(\n (n) => normalizeVNode(typeof n === \"function\" ? n.toString() : () => n)\n )\n ) : 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}\n";
15
+ var vdom_default = "import {\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n Text\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 const isFunction = typeof value === \"function\";\n if (isFunction) {\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isFunction ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? createElementBlock(\n Fragment,\n null,\n value.map(\n (n) => normalizeVNode(typeof n === \"function\" ? n.toString() : () => n)\n )\n ) : 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}\n";
16
16
 
17
17
  //#endregion
18
18
  //#region src/raw.ts
package/dist/raw.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region src/props.ts?raw
2
- var props_default = "import { proxyRefs, toRefs, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\n// @__NO_SIDE_EFFECTS__\nexport function useProps() {\n const i = /* @__PURE__ */ getCurrentInstance();\n return i.props;\n}\n// @__NO_SIDE_EFFECTS__\nexport function useFullProps() {\n return proxyRefs({\n ...toRefs(/* @__PURE__ */ useProps()),\n ...toRefs(useAttrs())\n });\n}\n";
2
+ var props_default = "import { computed, isRef, unref, useAttrs } from \"vue\";\nimport * as Vue from \"vue\";\n// @__NO_SIDE_EFFECTS__\nexport function getCurrentInstance() {\n return Vue.currentInstance || Vue.getCurrentInstance();\n}\n// @__NO_SIDE_EFFECTS__\nexport function useProps() {\n const i = /* @__PURE__ */ getCurrentInstance();\n return i.props;\n}\n// @__NO_SIDE_EFFECTS__\nexport function useFullProps() {\n const attrs = useAttrs();\n const i = /* @__PURE__ */ getCurrentInstance();\n if (!i.type.props) {\n return attrs;\n }\n const props = /* @__PURE__ */ useProps();\n const fullProps = computed(() => ({ ...props, ...attrs }));\n return new Proxy(\n {},\n {\n get(_, p, receiver) {\n return unref(Reflect.get(fullProps.value, p, receiver));\n },\n set(_, p, value) {\n if (isRef(fullProps.value[p]) && !isRef(value))\n fullProps.value[p].value = value;\n else fullProps.value[p] = value;\n return true;\n },\n deleteProperty(_, p) {\n return Reflect.deleteProperty(fullProps.value, p);\n },\n has(_, p) {\n return Reflect.has(fullProps.value, p);\n },\n ownKeys() {\n return Object.keys(fullProps.value);\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true\n };\n }\n }\n );\n}\n";
3
3
 
4
4
  //#endregion
5
5
  //#region src/ssr.ts?raw
@@ -11,7 +11,7 @@ var vapor_default = "import {\n EffectScope,\n Fragment,\n getCurrentInstance
11
11
 
12
12
  //#endregion
13
13
  //#region src/vdom.ts?raw
14
- var vdom_default = "import {\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n Text\n} from \"vue\";\nconst cacheMap = /* @__PURE__ */ new WeakMap();\nexport function createVNodeCache(index) {\n const i = getCurrentInstance();\n if (i) {\n if (!cacheMap.has(i)) cacheMap.set(i, []);\n const caches = cacheMap.get(i);\n return caches[index] || (caches[index] = []);\n } else {\n return [];\n }\n}\nexport function normalizeVNode(value = \" \", flag = 1) {\n let create = createVNode;\n const isFunction = typeof value === \"function\";\n if (isFunction) {\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isFunction ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? createElementBlock(\n Fragment,\n null,\n value.map(\n (n) => normalizeVNode(typeof n === \"function\" ? n.toString() : () => n)\n )\n ) : 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}\n";
14
+ var vdom_default = "import {\n cloneVNode,\n Comment,\n createBlock,\n createElementBlock,\n createVNode,\n Fragment,\n getCurrentInstance,\n isVNode,\n openBlock,\n Text\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 const isFunction = typeof value === \"function\";\n if (isFunction) {\n openBlock();\n create = createBlock;\n value = value();\n }\n return isVNode(value) ? isFunction ? createBlock(cloneIfMounted(value)) : cloneIfMounted(value) : Array.isArray(value) ? createElementBlock(\n Fragment,\n null,\n value.map(\n (n) => normalizeVNode(typeof n === \"function\" ? n.toString() : () => n)\n )\n ) : 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}\n";
15
15
 
16
16
  //#endregion
17
17
  //#region src/raw.ts
package/dist/vdom.cjs CHANGED
@@ -3,12 +3,12 @@ let vue = require("vue");
3
3
 
4
4
  //#region src/vdom.ts
5
5
  const cacheMap = /* @__PURE__ */ new WeakMap();
6
- function createVNodeCache(index) {
6
+ function createVNodeCache(key) {
7
7
  const i = (0, vue.getCurrentInstance)();
8
8
  if (i) {
9
- if (!cacheMap.has(i)) cacheMap.set(i, []);
9
+ if (!cacheMap.has(i)) cacheMap.set(i, {});
10
10
  const caches = cacheMap.get(i);
11
- return caches[index] || (caches[index] = []);
11
+ return caches[key] || (caches[key] = []);
12
12
  } else return [];
13
13
  }
14
14
  function normalizeVNode(value = " ", flag = 1) {
package/dist/vdom.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { VNode } from "vue";
2
2
 
3
3
  //#region src/vdom.d.ts
4
- declare function createVNodeCache(index: number): any;
4
+ declare function createVNodeCache(key: string): any;
5
5
  declare function normalizeVNode(value?: any, flag?: number): VNode;
6
6
  //#endregion
7
7
  export { createVNodeCache, normalizeVNode };
package/dist/vdom.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { VNode } from "vue";
2
2
 
3
3
  //#region src/vdom.d.ts
4
- declare function createVNodeCache(index: number): any;
4
+ declare function createVNodeCache(key: string): any;
5
5
  declare function normalizeVNode(value?: any, flag?: number): VNode;
6
6
  //#endregion
7
7
  export { createVNodeCache, normalizeVNode };
package/dist/vdom.js CHANGED
@@ -2,12 +2,12 @@ import { Comment, Fragment, Text, cloneVNode, createBlock, createElementBlock, c
2
2
 
3
3
  //#region src/vdom.ts
4
4
  const cacheMap = /* @__PURE__ */ new WeakMap();
5
- function createVNodeCache(index) {
5
+ function createVNodeCache(key) {
6
6
  const i = getCurrentInstance();
7
7
  if (i) {
8
- if (!cacheMap.has(i)) cacheMap.set(i, []);
8
+ if (!cacheMap.has(i)) cacheMap.set(i, {});
9
9
  const caches = cacheMap.get(i);
10
- return caches[index] || (caches[index] = []);
10
+ return caches[key] || (caches[key] = []);
11
11
  } else return [];
12
12
  }
13
13
  function normalizeVNode(value = " ", flag = 1) {
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.2",
4
+ "version": "3.2.3",
5
5
  "description": "Vue JSX Vapor Runtime",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",