vue-jsx-vapor 2.3.6 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/api.cjs +2 -2
  2. package/dist/api.d.cts +3 -3
  3. package/dist/api.d.ts +3 -3
  4. package/dist/astro.cjs +4 -5
  5. package/dist/astro.d.cts +6 -8
  6. package/dist/astro.d.ts +6 -8
  7. package/dist/astro.js +2 -2
  8. package/dist/{chunk-BCwAaXi7.cjs → chunk-CUT6urMc.cjs} +0 -1
  9. package/dist/{core-B29W1zp3.cjs → core-BEqRwfoK.cjs} +1 -2
  10. package/dist/esbuild.cjs +4 -5
  11. package/dist/esbuild.d.cts +3 -3
  12. package/dist/esbuild.d.ts +3 -3
  13. package/dist/esbuild.js +2 -2
  14. package/dist/index.cjs +46 -5
  15. package/dist/index.d.cts +34 -2
  16. package/dist/index.d.ts +34 -2
  17. package/dist/index.js +43 -3
  18. package/dist/jsx-runtime.cjs +5 -6
  19. package/dist/jsx-runtime.d.cts +1171 -1178
  20. package/dist/jsx-runtime.d.ts +1171 -1178
  21. package/dist/nuxt.cjs +7 -8
  22. package/dist/nuxt.d.cts +4 -5
  23. package/dist/nuxt.d.ts +4 -5
  24. package/dist/nuxt.js +4 -4
  25. package/dist/options-BRfDD5qB.d.cts +18 -0
  26. package/dist/options-CeDGvYqS.d.ts +18 -0
  27. package/dist/options.d.cts +1 -2
  28. package/dist/options.d.ts +1 -2
  29. package/dist/{raw-CPEhZ9Wr.cjs → raw-BY1njZIx.cjs} +3 -4
  30. package/dist/{raw-D5n6wETp.js → raw-DecHkpC5.js} +1 -1
  31. package/dist/raw.cjs +3 -3
  32. package/dist/raw.d.cts +1 -1
  33. package/dist/raw.d.ts +1 -1
  34. package/dist/raw.js +1 -1
  35. package/dist/rolldown.cjs +5 -6
  36. package/dist/rolldown.d.cts +3 -3
  37. package/dist/rolldown.d.ts +3 -3
  38. package/dist/rolldown.js +2 -2
  39. package/dist/rollup.cjs +4 -5
  40. package/dist/rollup.d.cts +3 -3
  41. package/dist/rollup.d.ts +3 -3
  42. package/dist/rollup.js +2 -2
  43. package/dist/rspack.cjs +4 -5
  44. package/dist/rspack.d.cts +1 -1
  45. package/dist/rspack.d.ts +1 -1
  46. package/dist/rspack.js +2 -2
  47. package/dist/{unplugin-O-j6KrDW.js → unplugin-DeYNxSzL.js} +1 -1
  48. package/dist/{unplugin-BE5nHMyo.cjs → unplugin-JV7CydWf.cjs} +2 -3
  49. package/dist/unplugin.cjs +6 -6
  50. package/dist/unplugin.d.cts +4 -3
  51. package/dist/unplugin.d.ts +4 -3
  52. package/dist/unplugin.js +2 -2
  53. package/dist/vite-C2WptbyG.js +7 -0
  54. package/dist/{vite-CnMq6-74.cjs → vite-CVR2C-Wy.cjs} +1 -2
  55. package/dist/vite.cjs +5 -5
  56. package/dist/vite.d.cts +3 -3
  57. package/dist/vite.d.ts +3 -3
  58. package/dist/vite.js +3 -3
  59. package/dist/volar.cjs +3 -4
  60. package/dist/volar.d.cts +1 -1
  61. package/dist/volar.d.ts +1 -1
  62. package/dist/volar.js +1 -1
  63. package/dist/{webpack-DjBty3ZC.cjs → webpack-DWlp7dxs.cjs} +1 -2
  64. package/dist/{webpack-BnYgbUqF.js → webpack-mKQ7x4tg.js} +1 -1
  65. package/dist/webpack.cjs +5 -5
  66. package/dist/webpack.d.cts +3 -3
  67. package/dist/webpack.d.ts +3 -3
  68. package/dist/webpack.js +3 -3
  69. package/package.json +35 -91
  70. package/dist/options.d-BAyccQwr.d.ts +0 -20
  71. package/dist/options.d-CA70vgwp.d.cts +0 -20
  72. package/dist/vite-B8-AEirI.js +0 -7
package/dist/api.cjs CHANGED
@@ -1,3 +1,3 @@
1
- const require_core = require('./core-B29W1zp3.cjs');
1
+ const require_core = require('./core-BEqRwfoK.cjs');
2
2
 
3
- exports.transformVueJsxVapor = require_core.transformVueJsxVapor
3
+ exports.transformVueJsxVapor = require_core.transformVueJsxVapor;
package/dist/api.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { Options } from "./options.d-CA70vgwp.cjs";
2
- import { BabelFileResult } from "@babel/core";
1
+ import { Options } from "./options-BRfDD5qB.cjs";
2
+ import * as _babel_core19 from "@babel/core";
3
3
 
4
4
  //#region src/core/index.d.ts
5
- declare function transformVueJsxVapor(code: string, id: string, options?: Options, needSourceMap?: boolean): BabelFileResult | null;
5
+ declare function transformVueJsxVapor(code: string, id: string, options?: Options, needSourceMap?: boolean): _babel_core19.BabelFileResult | null;
6
6
 
7
7
  //#endregion
8
8
  export { Options, transformVueJsxVapor };
package/dist/api.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Options } from "./options.d-BAyccQwr.js";
2
- import { BabelFileResult } from "@babel/core";
1
+ import { Options } from "./options-CeDGvYqS.js";
2
+ import * as _babel_core21 from "@babel/core";
3
3
 
4
4
  //#region src/core/index.d.ts
5
- declare function transformVueJsxVapor(code: string, id: string, options?: Options, needSourceMap?: boolean): BabelFileResult | null;
5
+ declare function transformVueJsxVapor(code: string, id: string, options?: Options, needSourceMap?: boolean): _babel_core21.BabelFileResult | null;
6
6
 
7
7
  //#endregion
8
8
  export { Options, transformVueJsxVapor };
package/dist/astro.cjs CHANGED
@@ -1,9 +1,8 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, '__esModule', { value: true });
3
- require('./core-B29W1zp3.cjs');
4
- require('./raw-CPEhZ9Wr.cjs');
2
+ require('./core-BEqRwfoK.cjs');
3
+ require('./raw-BY1njZIx.cjs');
5
4
  require('./options-CulFO0WS.cjs');
6
- const require_unplugin = require('./unplugin-BE5nHMyo.cjs');
5
+ const require_unplugin = require('./unplugin-JV7CydWf.cjs');
7
6
 
8
7
  //#region src/astro.ts
9
8
  var astro_default = (options) => ({
@@ -15,4 +14,4 @@ var astro_default = (options) => ({
15
14
  });
16
15
 
17
16
  //#endregion
18
- exports.default = astro_default
17
+ exports.default = astro_default;
package/dist/astro.d.cts CHANGED
@@ -1,12 +1,10 @@
1
- import { Options } from "./options.d-CA70vgwp.cjs";
1
+ import { Options } from "./options-BRfDD5qB.cjs";
2
2
 
3
3
  //#region src/astro.d.ts
4
4
  declare const _default: (options: Options) => {
5
- name: string;
6
- hooks: {
7
- 'astro:config:setup': (astro: any) => void;
8
- };
9
- };
10
-
11
- //#endregion
5
+ name: string;
6
+ hooks: {
7
+ 'astro:config:setup': (astro: any) => void;
8
+ };
9
+ }; //#endregion
12
10
  export { _default as default };
package/dist/astro.d.ts CHANGED
@@ -1,12 +1,10 @@
1
- import { Options } from "./options.d-BAyccQwr.js";
1
+ import { Options } from "./options-CeDGvYqS.js";
2
2
 
3
3
  //#region src/astro.d.ts
4
4
  declare const _default: (options: Options) => {
5
- name: string;
6
- hooks: {
7
- 'astro:config:setup': (astro: any) => void;
8
- };
9
- };
10
-
11
- //#endregion
5
+ name: string;
6
+ hooks: {
7
+ 'astro:config:setup': (astro: any) => void;
8
+ };
9
+ }; //#endregion
12
10
  export { _default as default };
package/dist/astro.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./core-BDE4GLH8.js";
2
- import "./raw-D5n6wETp.js";
2
+ import "./raw-DecHkpC5.js";
3
3
  import "./options-HYvLzmlg.js";
4
- import { unplugin_default } from "./unplugin-O-j6KrDW.js";
4
+ import { unplugin_default } from "./unplugin-DeYNxSzL.js";
5
5
 
6
6
  //#region src/astro.ts
7
7
  var astro_default = (options) => ({
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  //#region rolldown:runtime
3
2
  var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
@@ -1,5 +1,4 @@
1
- "use strict";
2
- const require_chunk = require('./chunk-BCwAaXi7.cjs');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
3
2
  const __babel_core = require_chunk.__toESM(require("@babel/core"));
4
3
  const __babel_plugin_transform_typescript = require_chunk.__toESM(require("@babel/plugin-transform-typescript"));
5
4
  const __vue_jsx_vapor_babel = require_chunk.__toESM(require("@vue-jsx-vapor/babel"));
package/dist/esbuild.cjs CHANGED
@@ -1,12 +1,11 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, '__esModule', { value: true });
3
- require('./core-B29W1zp3.cjs');
4
- require('./raw-CPEhZ9Wr.cjs');
2
+ require('./core-BEqRwfoK.cjs');
3
+ require('./raw-BY1njZIx.cjs');
5
4
  require('./options-CulFO0WS.cjs');
6
- const require_unplugin = require('./unplugin-BE5nHMyo.cjs');
5
+ const require_unplugin = require('./unplugin-JV7CydWf.cjs');
7
6
 
8
7
  //#region src/esbuild.ts
9
8
  var esbuild_default = require_unplugin.unplugin_default.esbuild;
10
9
 
11
10
  //#endregion
12
- exports.default = esbuild_default
11
+ exports.default = esbuild_default;
@@ -1,8 +1,8 @@
1
- import { Options } from "./options.d-CA70vgwp.cjs";
2
- import { Plugin } from "esbuild";
1
+ import { Options } from "./options-BRfDD5qB.cjs";
2
+ import * as esbuild8 from "esbuild";
3
3
 
4
4
  //#region src/esbuild.d.ts
5
- declare const _default: (options?: Options | undefined) => Plugin;
5
+ declare const _default: (options?: Options | undefined) => esbuild8.Plugin;
6
6
 
7
7
  //#endregion
8
8
  export { _default as default };
package/dist/esbuild.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Options } from "./options.d-BAyccQwr.js";
2
- import { Plugin } from "esbuild";
1
+ import { Options } from "./options-CeDGvYqS.js";
2
+ import * as esbuild1 from "esbuild";
3
3
 
4
4
  //#region src/esbuild.d.ts
5
- declare const _default: (options?: Options | undefined) => Plugin;
5
+ declare const _default: (options?: Options | undefined) => esbuild1.Plugin;
6
6
 
7
7
  //#endregion
8
8
  export { _default as default };
package/dist/esbuild.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./core-BDE4GLH8.js";
2
- import "./raw-D5n6wETp.js";
2
+ import "./raw-DecHkpC5.js";
3
3
  import "./options-HYvLzmlg.js";
4
- import { unplugin_default } from "./unplugin-O-j6KrDW.js";
4
+ import { unplugin_default } from "./unplugin-DeYNxSzL.js";
5
5
 
6
6
  //#region src/esbuild.ts
7
7
  var esbuild_default = unplugin_default.esbuild;
package/dist/index.cjs CHANGED
@@ -1,8 +1,44 @@
1
- "use strict";
2
- const require_chunk = require('./chunk-BCwAaXi7.cjs');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
3
2
  const vue = require_chunk.__toESM(require("vue"));
4
3
 
5
4
  //#region src/core/runtime.ts
5
+ function getCurrentInstance() {
6
+ return vue.currentInstance || vue.getCurrentInstance();
7
+ }
8
+ /**
9
+ * Returns the props of the current component instance.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { useProps } from 'vue-jsx-vapor'
14
+ *
15
+ * defineComponent(({ foo = '' })=>{
16
+ * const props = useProps() // { foo: '' }
17
+ * })
18
+ * ```
19
+ */
20
+ function useProps() {
21
+ const i = getCurrentInstance();
22
+ return i.props;
23
+ }
24
+ /**
25
+ * Returns the merged props and attrs of the current component.\
26
+ * Equivalent to `useProps()` + `useAttrs()`.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * import { useFullProps } from 'vue-jsx-vapor'
31
+ *
32
+ * defineComponent((props) => {
33
+ * const fullProps = useFullProps() // = useAttrs() + useProps()
34
+ * })
35
+ */
36
+ function useFullProps() {
37
+ return (0, vue.proxyRefs)({
38
+ ...(0, vue.toRefs)(useProps()),
39
+ ...(0, vue.toRefs)((0, vue.useAttrs)())
40
+ });
41
+ }
6
42
  function createFragment(nodes, anchor = document.createTextNode("")) {
7
43
  const frag = new vue.VaporFragment(nodes);
8
44
  frag.anchor = anchor;
@@ -56,9 +92,11 @@ function resolveValues(values = [], _anchor) {
56
92
  for (const [index, value] of values.entries()) {
57
93
  const anchor = index === values.length - 1 ? _anchor : void 0;
58
94
  if (typeof value === "function") (0, vue.renderEffect)(() => {
95
+ (0, vue.pauseTracking)();
59
96
  if (scopes[index]) scopes[index].stop();
60
- scopes[index] = (0, vue.effectScope)();
97
+ scopes[index] = new vue.EffectScope();
61
98
  nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor));
99
+ (0, vue.resetTracking)();
62
100
  });
63
101
  else nodes[index] = resolveValue(nodes[index], value, anchor);
64
102
  }
@@ -73,8 +111,11 @@ function createNodes(...values) {
73
111
  }
74
112
 
75
113
  //#endregion
76
- exports.createNodes = createNodes
77
- exports.setNodes = setNodes
114
+ exports.createNodes = createNodes;
115
+ exports.getCurrentInstance = getCurrentInstance;
116
+ exports.setNodes = setNodes;
117
+ exports.useFullProps = useFullProps;
118
+ exports.useProps = useProps;
78
119
  Object.defineProperty(exports, 'useRef', {
79
120
  enumerable: true,
80
121
  get: function () {
package/dist/index.d.cts CHANGED
@@ -1,8 +1,40 @@
1
- import { shallowRef as useRef } from "vue";
1
+ import * as Vue from "vue";
2
+ import { Block, GenericComponentInstance, shallowRef as useRef } from "vue";
2
3
 
3
4
  //#region src/core/runtime.d.ts
5
+ declare function getCurrentInstance(): GenericComponentInstance | null;
6
+ /**
7
+ * Returns the props of the current component instance.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import { useProps } from 'vue-jsx-vapor'
12
+ *
13
+ * defineComponent(({ foo = '' })=>{
14
+ * const props = useProps() // { foo: '' }
15
+ * })
16
+ * ```
17
+ */
18
+ declare function useProps(): {
19
+ [x: string]: unknown;
20
+ };
21
+ /**
22
+ * Returns the merged props and attrs of the current component.\
23
+ * Equivalent to `useProps()` + `useAttrs()`.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * import { useFullProps } from 'vue-jsx-vapor'
28
+ *
29
+ * defineComponent((props) => {
30
+ * const fullProps = useFullProps() // = useAttrs() + useProps()
31
+ * })
32
+ */
33
+ declare function useFullProps(): Vue.ShallowUnwrapRef<{
34
+ [x: string]: Vue.Ref<unknown, unknown>;
35
+ }>;
4
36
  declare function setNodes(anchor: Element, ...values: any[]): void;
5
37
  declare function createNodes(...values: any[]): Block[];
6
38
 
7
39
  //#endregion
8
- export { createNodes, setNodes, useRef };
40
+ export { createNodes, getCurrentInstance, setNodes, useFullProps, useProps, useRef };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,40 @@
1
- import { shallowRef as useRef } from "vue";
1
+ import * as Vue from "vue";
2
+ import { Block, GenericComponentInstance, shallowRef as useRef } from "vue";
2
3
 
3
4
  //#region src/core/runtime.d.ts
5
+ declare function getCurrentInstance(): GenericComponentInstance | null;
6
+ /**
7
+ * Returns the props of the current component instance.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import { useProps } from 'vue-jsx-vapor'
12
+ *
13
+ * defineComponent(({ foo = '' })=>{
14
+ * const props = useProps() // { foo: '' }
15
+ * })
16
+ * ```
17
+ */
18
+ declare function useProps(): {
19
+ [x: string]: unknown;
20
+ };
21
+ /**
22
+ * Returns the merged props and attrs of the current component.\
23
+ * Equivalent to `useProps()` + `useAttrs()`.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * import { useFullProps } from 'vue-jsx-vapor'
28
+ *
29
+ * defineComponent((props) => {
30
+ * const fullProps = useFullProps() // = useAttrs() + useProps()
31
+ * })
32
+ */
33
+ declare function useFullProps(): Vue.ShallowUnwrapRef<{
34
+ [x: string]: Vue.Ref<unknown, unknown>;
35
+ }>;
4
36
  declare function setNodes(anchor: Element, ...values: any[]): void;
5
37
  declare function createNodes(...values: any[]): Block[];
6
38
 
7
39
  //#endregion
8
- export { createNodes, setNodes, useRef };
40
+ export { createNodes, getCurrentInstance, setNodes, useFullProps, useProps, useRef };
package/dist/index.js CHANGED
@@ -1,6 +1,44 @@
1
- import { VaporFragment, effectScope, insert, isFragment, isVaporComponent, remove, renderEffect, shallowRef as useRef } from "vue";
1
+ import * as Vue from "vue";
2
+ import { EffectScope, VaporFragment, insert, isFragment, isVaporComponent, pauseTracking, proxyRefs, remove, renderEffect, resetTracking, shallowRef as useRef, toRefs, useAttrs } from "vue";
2
3
 
3
4
  //#region src/core/runtime.ts
5
+ function getCurrentInstance() {
6
+ return Vue.currentInstance || Vue.getCurrentInstance();
7
+ }
8
+ /**
9
+ * Returns the props of the current component instance.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { useProps } from 'vue-jsx-vapor'
14
+ *
15
+ * defineComponent(({ foo = '' })=>{
16
+ * const props = useProps() // { foo: '' }
17
+ * })
18
+ * ```
19
+ */
20
+ function useProps() {
21
+ const i = getCurrentInstance();
22
+ return i.props;
23
+ }
24
+ /**
25
+ * Returns the merged props and attrs of the current component.\
26
+ * Equivalent to `useProps()` + `useAttrs()`.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * import { useFullProps } from 'vue-jsx-vapor'
31
+ *
32
+ * defineComponent((props) => {
33
+ * const fullProps = useFullProps() // = useAttrs() + useProps()
34
+ * })
35
+ */
36
+ function useFullProps() {
37
+ return proxyRefs({
38
+ ...toRefs(useProps()),
39
+ ...toRefs(useAttrs())
40
+ });
41
+ }
4
42
  function createFragment(nodes, anchor = document.createTextNode("")) {
5
43
  const frag = new VaporFragment(nodes);
6
44
  frag.anchor = anchor;
@@ -54,9 +92,11 @@ function resolveValues(values = [], _anchor) {
54
92
  for (const [index, value] of values.entries()) {
55
93
  const anchor = index === values.length - 1 ? _anchor : void 0;
56
94
  if (typeof value === "function") renderEffect(() => {
95
+ pauseTracking();
57
96
  if (scopes[index]) scopes[index].stop();
58
- scopes[index] = effectScope();
97
+ scopes[index] = new EffectScope();
59
98
  nodes[index] = scopes[index].run(() => resolveValue(nodes[index], value(), anchor));
99
+ resetTracking();
60
100
  });
61
101
  else nodes[index] = resolveValue(nodes[index], value, anchor);
62
102
  }
@@ -71,4 +111,4 @@ function createNodes(...values) {
71
111
  }
72
112
 
73
113
  //#endregion
74
- export { createNodes, setNodes, useRef };
114
+ export { createNodes, getCurrentInstance, setNodes, useFullProps, useProps, useRef };
@@ -1,5 +1,4 @@
1
- "use strict";
2
- const require_chunk = require('./chunk-BCwAaXi7.cjs');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
3
2
  const vue = require_chunk.__toESM(require("vue"));
4
3
 
5
4
  //#region src/jsx-runtime.ts
@@ -11,7 +10,7 @@ function jsx(type, props, key) {
11
10
  }
12
11
 
13
12
  //#endregion
14
- exports.Fragment = vue.Fragment
15
- exports.jsx = jsx
16
- exports.jsxDEV = jsx
17
- exports.jsxs = jsx
13
+ exports.Fragment = vue.Fragment;
14
+ exports.jsx = jsx;
15
+ exports.jsxDEV = jsx;
16
+ exports.jsxs = jsx;