vue-jsx-vapor 2.0.0 → 2.1.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 (45) hide show
  1. package/dist/api.cjs +2 -8
  2. package/dist/api.d.cts +1 -4
  3. package/dist/api.d.ts +1 -4
  4. package/dist/api.js +1 -7
  5. package/dist/astro.cjs +4 -4
  6. package/dist/astro.js +3 -3
  7. package/dist/{chunk-YGTVDW3A.js → chunk-2FXC3LQS.js} +1 -1
  8. package/dist/{chunk-JGG42DZI.js → chunk-6KXDH742.js} +2 -14
  9. package/dist/{chunk-I563YEVV.cjs → chunk-BACJ4NJZ.cjs} +2 -2
  10. package/dist/{chunk-44HSQ6SC.js → chunk-BULCI54A.js} +1 -1
  11. package/dist/{chunk-M735SGJG.cjs → chunk-FH74ALLC.cjs} +2 -2
  12. package/dist/{chunk-IZRO67YR.cjs → chunk-GFRKGJDJ.cjs} +2 -14
  13. package/dist/{chunk-MGTJQG6U.cjs → chunk-H62XZOLW.cjs} +2 -2
  14. package/dist/{chunk-BPYHZ47Y.js → chunk-MKQCYQ5T.js} +1 -1
  15. package/dist/chunk-RGJB4EQM.js +26 -0
  16. package/dist/chunk-VTXOK4UC.cjs +26 -0
  17. package/dist/esbuild.cjs +4 -4
  18. package/dist/esbuild.js +3 -3
  19. package/dist/index.cjs +90 -1
  20. package/dist/index.d.cts +6 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.js +89 -0
  23. package/dist/jsx-runtime.cjs +16 -0
  24. package/dist/jsx-runtime.d.cts +1361 -0
  25. package/dist/jsx-runtime.d.ts +1361 -0
  26. package/dist/jsx-runtime.js +16 -0
  27. package/dist/nuxt.cjs +7 -7
  28. package/dist/nuxt.js +5 -5
  29. package/dist/raw.cjs +3 -3
  30. package/dist/raw.js +2 -2
  31. package/dist/rolldown.cjs +4 -4
  32. package/dist/rolldown.js +3 -3
  33. package/dist/rollup.cjs +4 -4
  34. package/dist/rollup.js +3 -3
  35. package/dist/rspack.cjs +4 -4
  36. package/dist/rspack.js +3 -3
  37. package/dist/unplugin.cjs +4 -4
  38. package/dist/unplugin.js +3 -3
  39. package/dist/vite.cjs +5 -5
  40. package/dist/vite.js +4 -4
  41. package/dist/webpack.cjs +5 -5
  42. package/dist/webpack.js +4 -4
  43. package/package.json +26 -7
  44. package/dist/chunk-2XDZG77D.js +0 -41
  45. package/dist/chunk-CROZ7JES.cjs +0 -41
package/dist/api.cjs CHANGED
@@ -1,12 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _chunkVTXOK4UCcjs = require('./chunk-VTXOK4UC.cjs');
3
4
 
4
5
 
5
-
6
- var _chunkCROZ7JEScjs = require('./chunk-CROZ7JES.cjs');
7
-
8
-
9
-
10
-
11
-
12
- exports.helperCode = _chunkCROZ7JEScjs.helperCode; exports.helperId = _chunkCROZ7JEScjs.helperId; exports.helperPrefix = _chunkCROZ7JEScjs.helperPrefix; exports.transformVueJsxVapor = _chunkCROZ7JEScjs.transformVueJsxVapor;
6
+ exports.transformVueJsxVapor = _chunkVTXOK4UCcjs.transformVueJsxVapor;
package/dist/api.d.cts CHANGED
@@ -3,9 +3,6 @@ import '@vue-jsx-vapor/compiler';
3
3
  import '@vue-jsx-vapor/macros';
4
4
  import 'unplugin-utils';
5
5
 
6
- declare const helperCode: string;
7
- declare const helperId: "vue-jsx-vapor/helper.js";
8
- declare const helperPrefix: "vue-jsx-vapor/helper";
9
6
  declare function transformVueJsxVapor(code: string, id: string, options?: Options): {
10
7
  code: string;
11
8
  map: {
@@ -19,4 +16,4 @@ declare function transformVueJsxVapor(code: string, id: string, options?: Option
19
16
  } | null | undefined;
20
17
  } | undefined;
21
18
 
22
- export { Options, helperCode, helperId, helperPrefix, transformVueJsxVapor };
19
+ export { Options, transformVueJsxVapor };
package/dist/api.d.ts CHANGED
@@ -3,9 +3,6 @@ import '@vue-jsx-vapor/compiler';
3
3
  import '@vue-jsx-vapor/macros';
4
4
  import 'unplugin-utils';
5
5
 
6
- declare const helperCode: string;
7
- declare const helperId: "vue-jsx-vapor/helper.js";
8
- declare const helperPrefix: "vue-jsx-vapor/helper";
9
6
  declare function transformVueJsxVapor(code: string, id: string, options?: Options): {
10
7
  code: string;
11
8
  map: {
@@ -19,4 +16,4 @@ declare function transformVueJsxVapor(code: string, id: string, options?: Option
19
16
  } | null | undefined;
20
17
  } | undefined;
21
18
 
22
- export { Options, helperCode, helperId, helperPrefix, transformVueJsxVapor };
19
+ export { Options, transformVueJsxVapor };
package/dist/api.js CHANGED
@@ -1,12 +1,6 @@
1
1
  import {
2
- helperCode,
3
- helperId,
4
- helperPrefix,
5
2
  transformVueJsxVapor
6
- } from "./chunk-2XDZG77D.js";
3
+ } from "./chunk-RGJB4EQM.js";
7
4
  export {
8
- helperCode,
9
- helperId,
10
- helperPrefix,
11
5
  transformVueJsxVapor
12
6
  };
package/dist/astro.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMGTJQG6Ucjs = require('./chunk-MGTJQG6U.cjs');
3
+ var _chunkH62XZOLWcjs = require('./chunk-H62XZOLW.cjs');
4
4
  require('./chunk-GODVM7NB.cjs');
5
- require('./chunk-IZRO67YR.cjs');
6
- require('./chunk-CROZ7JES.cjs');
5
+ require('./chunk-GFRKGJDJ.cjs');
6
+ require('./chunk-VTXOK4UC.cjs');
7
7
 
8
8
  // src/astro.ts
9
9
  var astro_default = (options) => ({
@@ -11,7 +11,7 @@ var astro_default = (options) => ({
11
11
  hooks: {
12
12
  "astro:config:setup": (astro) => {
13
13
  astro.config.vite.plugins ||= [];
14
- astro.config.vite.plugins.push(_chunkMGTJQG6Ucjs.unplugin_default.vite(options));
14
+ astro.config.vite.plugins.push(_chunkH62XZOLWcjs.unplugin_default.vite(options));
15
15
  }
16
16
  }
17
17
  });
package/dist/astro.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-BPYHZ47Y.js";
3
+ } from "./chunk-MKQCYQ5T.js";
4
4
  import "./chunk-JNAGPWSX.js";
5
- import "./chunk-JGG42DZI.js";
6
- import "./chunk-2XDZG77D.js";
5
+ import "./chunk-6KXDH742.js";
6
+ import "./chunk-RGJB4EQM.js";
7
7
 
8
8
  // src/astro.ts
9
9
  var astro_default = (options) => ({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-BPYHZ47Y.js";
3
+ } from "./chunk-MKQCYQ5T.js";
4
4
 
5
5
  // src/vite.ts
6
6
  var vite_default = unplugin_default.vite;
@@ -1,13 +1,10 @@
1
1
  import {
2
- helperCode,
3
- helperId,
4
- helperPrefix,
5
2
  transformVueJsxVapor
6
- } from "./chunk-2XDZG77D.js";
3
+ } from "./chunk-RGJB4EQM.js";
7
4
 
8
5
  // src/raw.ts
9
6
  import Macros from "@vue-jsx-vapor/macros/raw";
10
- import { createFilter, normalizePath } from "unplugin-utils";
7
+ import { createFilter } from "unplugin-utils";
11
8
  var plugin = (options = {}) => {
12
9
  const transformInclude = createFilter(
13
10
  options?.include || /\.[cm]?[jt]sx?$/,
@@ -32,15 +29,6 @@ var plugin = (options = {}) => {
32
29
  };
33
30
  }
34
31
  },
35
- resolveId(id) {
36
- if (normalizePath(id).startsWith(helperPrefix)) return id;
37
- },
38
- loadInclude(id) {
39
- return normalizePath(id).startsWith(helperPrefix);
40
- },
41
- load(id) {
42
- if (normalizePath(id) === helperId) return helperCode;
43
- },
44
32
  transformInclude,
45
33
  transform(code, id) {
46
34
  return transformVueJsxVapor(code, id, options);
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMGTJQG6Ucjs = require('./chunk-MGTJQG6U.cjs');
3
+ var _chunkH62XZOLWcjs = require('./chunk-H62XZOLW.cjs');
4
4
 
5
5
  // src/vite.ts
6
- var vite_default = _chunkMGTJQG6Ucjs.unplugin_default.vite;
6
+ var vite_default = _chunkH62XZOLWcjs.unplugin_default.vite;
7
7
 
8
8
 
9
9
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-BPYHZ47Y.js";
3
+ } from "./chunk-MKQCYQ5T.js";
4
4
 
5
5
  // src/webpack.ts
6
6
  var webpack_default = unplugin_default.webpack;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMGTJQG6Ucjs = require('./chunk-MGTJQG6U.cjs');
3
+ var _chunkH62XZOLWcjs = require('./chunk-H62XZOLW.cjs');
4
4
 
5
5
  // src/webpack.ts
6
- var webpack_default = _chunkMGTJQG6Ucjs.unplugin_default.webpack;
6
+ var webpack_default = _chunkH62XZOLWcjs.unplugin_default.webpack;
7
7
 
8
8
 
9
9
 
@@ -1,9 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
-
4
-
5
-
6
- var _chunkCROZ7JEScjs = require('./chunk-CROZ7JES.cjs');
3
+ var _chunkVTXOK4UCcjs = require('./chunk-VTXOK4UC.cjs');
7
4
 
8
5
  // src/raw.ts
9
6
  var _raw = require('@vue-jsx-vapor/macros/raw'); var _raw2 = _interopRequireDefault(_raw);
@@ -32,18 +29,9 @@ var plugin = (options = {}) => {
32
29
  };
33
30
  }
34
31
  },
35
- resolveId(id) {
36
- if (_unpluginutils.normalizePath.call(void 0, id).startsWith(_chunkCROZ7JEScjs.helperPrefix)) return id;
37
- },
38
- loadInclude(id) {
39
- return _unpluginutils.normalizePath.call(void 0, id).startsWith(_chunkCROZ7JEScjs.helperPrefix);
40
- },
41
- load(id) {
42
- if (_unpluginutils.normalizePath.call(void 0, id) === _chunkCROZ7JEScjs.helperId) return _chunkCROZ7JEScjs.helperCode;
43
- },
44
32
  transformInclude,
45
33
  transform(code, id) {
46
- return _chunkCROZ7JEScjs.transformVueJsxVapor.call(void 0, code, id, options);
34
+ return _chunkVTXOK4UCcjs.transformVueJsxVapor.call(void 0, code, id, options);
47
35
  }
48
36
  },
49
37
  ...options.macros === false ? [] : options.macros ? [_raw2.default.call(void 0, options.macros === true ? void 0 : options.macros)] : []
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkIZRO67YRcjs = require('./chunk-IZRO67YR.cjs');
3
+ var _chunkGFRKGJDJcjs = require('./chunk-GFRKGJDJ.cjs');
4
4
 
5
5
  // src/unplugin.ts
6
6
  var _unplugin = require('unplugin');
7
7
  var _vite = require('vite');
8
8
  var unpluginFactory = (options = {}) => {
9
9
  return [
10
- ..._chunkIZRO67YRcjs.raw_default.call(void 0, options),
10
+ ..._chunkGFRKGJDJcjs.raw_default.call(void 0, options),
11
11
  options.interop ? { name: "interop" } : {
12
12
  name: "unplugin-esbuild",
13
13
  transformInclude: _vite.createFilter.call(void 0,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raw_default
3
- } from "./chunk-JGG42DZI.js";
3
+ } from "./chunk-6KXDH742.js";
4
4
 
5
5
  // src/unplugin.ts
6
6
  import { createUnplugin } from "unplugin";
@@ -0,0 +1,26 @@
1
+ // src/core/index.ts
2
+ import { transformSync } from "@babel/core";
3
+ import babelTypescript from "@babel/plugin-transform-typescript";
4
+ import jsx from "@vue-jsx-vapor/babel";
5
+ function transformVueJsxVapor(code, id, options) {
6
+ const result = transformSync(code, {
7
+ plugins: [
8
+ [jsx, { compile: options?.compile, interop: options?.interop }],
9
+ id.endsWith(".tsx") ? [babelTypescript, { isTSX: true, allowExtensions: true }] : null
10
+ ].filter((i) => i !== null),
11
+ filename: id,
12
+ sourceMaps: true,
13
+ sourceFileName: id,
14
+ babelrc: false,
15
+ configFile: false
16
+ });
17
+ if (result?.code)
18
+ return {
19
+ code: result.code,
20
+ map: result.map
21
+ };
22
+ }
23
+
24
+ export {
25
+ transformVueJsxVapor
26
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/index.ts
2
+ var _core = require('@babel/core');
3
+ var _plugintransformtypescript = require('@babel/plugin-transform-typescript'); var _plugintransformtypescript2 = _interopRequireDefault(_plugintransformtypescript);
4
+ var _babel = require('@vue-jsx-vapor/babel'); var _babel2 = _interopRequireDefault(_babel);
5
+ function transformVueJsxVapor(code, id, options) {
6
+ const result = _core.transformSync.call(void 0, code, {
7
+ plugins: [
8
+ [_babel2.default, { compile: _optionalChain([options, 'optionalAccess', _ => _.compile]), interop: _optionalChain([options, 'optionalAccess', _2 => _2.interop]) }],
9
+ id.endsWith(".tsx") ? [_plugintransformtypescript2.default, { isTSX: true, allowExtensions: true }] : null
10
+ ].filter((i) => i !== null),
11
+ filename: id,
12
+ sourceMaps: true,
13
+ sourceFileName: id,
14
+ babelrc: false,
15
+ configFile: false
16
+ });
17
+ if (_optionalChain([result, 'optionalAccess', _3 => _3.code]))
18
+ return {
19
+ code: result.code,
20
+ map: result.map
21
+ };
22
+ }
23
+
24
+
25
+
26
+ exports.transformVueJsxVapor = transformVueJsxVapor;
package/dist/esbuild.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMGTJQG6Ucjs = require('./chunk-MGTJQG6U.cjs');
3
+ var _chunkH62XZOLWcjs = require('./chunk-H62XZOLW.cjs');
4
4
  require('./chunk-GODVM7NB.cjs');
5
- require('./chunk-IZRO67YR.cjs');
6
- require('./chunk-CROZ7JES.cjs');
5
+ require('./chunk-GFRKGJDJ.cjs');
6
+ require('./chunk-VTXOK4UC.cjs');
7
7
 
8
8
  // src/esbuild.ts
9
- var esbuild_default = _chunkMGTJQG6Ucjs.unplugin_default.esbuild;
9
+ var esbuild_default = _chunkH62XZOLWcjs.unplugin_default.esbuild;
10
10
 
11
11
 
12
12
  exports.default = esbuild_default;
package/dist/esbuild.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-BPYHZ47Y.js";
3
+ } from "./chunk-MKQCYQ5T.js";
4
4
  import "./chunk-JNAGPWSX.js";
5
- import "./chunk-JGG42DZI.js";
6
- import "./chunk-2XDZG77D.js";
5
+ import "./chunk-6KXDH742.js";
6
+ import "./chunk-RGJB4EQM.js";
7
7
 
8
8
  // src/esbuild.ts
9
9
  var esbuild_default = unplugin_default.esbuild;
package/dist/index.cjs CHANGED
@@ -1,5 +1,94 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts
2
2
  var _vue = require('vue');
3
3
 
4
+ // src/core/runtime.ts
4
5
 
5
- exports.useRef = _vue.shallowRef;
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ function createFragment(nodes, anchor = document.createTextNode("")) {
14
+ const frag = new (0, _vue.VaporFragment)(nodes);
15
+ frag.anchor = anchor;
16
+ return frag;
17
+ }
18
+ function normalizeValue(value, anchor) {
19
+ if (value instanceof Node || _vue.isFragment.call(void 0, value)) {
20
+ anchor && (anchor.textContent = "");
21
+ return value;
22
+ } else if (Array.isArray(value)) {
23
+ anchor && (anchor.textContent = "");
24
+ return createFragment(
25
+ value.map((i) => normalizeValue(i)),
26
+ anchor
27
+ );
28
+ } else {
29
+ const result = value == null || typeof value === "boolean" ? "" : String(value);
30
+ if (anchor) {
31
+ anchor.textContent = result;
32
+ return anchor;
33
+ } else {
34
+ return document.createTextNode(result);
35
+ }
36
+ }
37
+ }
38
+ function resolveValue(current, value, anchor) {
39
+ const node = normalizeValue(value, anchor);
40
+ if (current) {
41
+ if (_vue.isFragment.call(void 0, current)) {
42
+ const { anchor: anchor2 } = current;
43
+ if (anchor2 && anchor2.parentNode) {
44
+ _vue.remove.call(void 0, current.nodes, anchor2.parentNode);
45
+ _vue.insert.call(void 0, node, anchor2.parentNode, anchor2);
46
+ anchor2.remove();
47
+ }
48
+ } else if (current instanceof Node) {
49
+ if (_vue.isFragment.call(void 0, node) && current.parentNode) {
50
+ _vue.insert.call(void 0, node, current.parentNode, current);
51
+ current.remove();
52
+ } else if (node instanceof Node) {
53
+ if (current.nodeType === 3 && node.nodeType === 3) {
54
+ current.textContent = node.textContent;
55
+ return current;
56
+ } else if (current.parentNode) {
57
+ current.parentNode.replaceChild(node, current);
58
+ }
59
+ }
60
+ }
61
+ }
62
+ return node;
63
+ }
64
+ function resolveValues(values = [], _anchor) {
65
+ const nodes = [];
66
+ const scopes = [];
67
+ for (const [index, value] of values.entries()) {
68
+ const anchor = index === values.length - 1 ? _anchor : void 0;
69
+ if (typeof value === "function") {
70
+ _vue.renderEffect.call(void 0, () => {
71
+ if (scopes[index]) scopes[index].stop();
72
+ scopes[index] = _vue.effectScope.call(void 0, );
73
+ nodes[index] = scopes[index].run(
74
+ () => resolveValue(nodes[index], value(), anchor)
75
+ );
76
+ });
77
+ } else {
78
+ nodes[index] = resolveValue(nodes[index], value, anchor);
79
+ }
80
+ }
81
+ return nodes;
82
+ }
83
+ function setNodes(anchor, ...values) {
84
+ const resolvedValues = resolveValues(values, anchor);
85
+ anchor.parentNode && _vue.insert.call(void 0, resolvedValues, anchor.parentNode, anchor);
86
+ }
87
+ function createNodes(...values) {
88
+ return resolveValues(values);
89
+ }
90
+
91
+
92
+
93
+
94
+ exports.createNodes = createNodes; exports.setNodes = setNodes; exports.useRef = _vue.shallowRef;
package/dist/index.d.cts CHANGED
@@ -1 +1,7 @@
1
+ import { Block } from 'vue';
1
2
  export { shallowRef as useRef } from 'vue';
3
+
4
+ declare function setNodes(anchor: Element, ...values: any[]): void;
5
+ declare function createNodes(...values: any[]): Block[];
6
+
7
+ export { createNodes, setNodes };
package/dist/index.d.ts CHANGED
@@ -1 +1,7 @@
1
+ import { Block } from 'vue';
1
2
  export { shallowRef as useRef } from 'vue';
3
+
4
+ declare function setNodes(anchor: Element, ...values: any[]): void;
5
+ declare function createNodes(...values: any[]): Block[];
6
+
7
+ export { createNodes, setNodes };
package/dist/index.js CHANGED
@@ -1,5 +1,94 @@
1
1
  // src/index.ts
2
2
  import { shallowRef } from "vue";
3
+
4
+ // src/core/runtime.ts
5
+ import {
6
+ effectScope,
7
+ insert,
8
+ isFragment,
9
+ remove,
10
+ renderEffect,
11
+ VaporFragment
12
+ } from "vue";
13
+ function createFragment(nodes, anchor = document.createTextNode("")) {
14
+ const frag = new VaporFragment(nodes);
15
+ frag.anchor = anchor;
16
+ return frag;
17
+ }
18
+ function normalizeValue(value, anchor) {
19
+ if (value instanceof Node || isFragment(value)) {
20
+ anchor && (anchor.textContent = "");
21
+ return value;
22
+ } else if (Array.isArray(value)) {
23
+ anchor && (anchor.textContent = "");
24
+ return createFragment(
25
+ value.map((i) => normalizeValue(i)),
26
+ anchor
27
+ );
28
+ } else {
29
+ const result = value == null || typeof value === "boolean" ? "" : String(value);
30
+ if (anchor) {
31
+ anchor.textContent = result;
32
+ return anchor;
33
+ } else {
34
+ return document.createTextNode(result);
35
+ }
36
+ }
37
+ }
38
+ function resolveValue(current, value, anchor) {
39
+ const node = normalizeValue(value, anchor);
40
+ if (current) {
41
+ if (isFragment(current)) {
42
+ const { anchor: anchor2 } = current;
43
+ if (anchor2 && anchor2.parentNode) {
44
+ remove(current.nodes, anchor2.parentNode);
45
+ insert(node, anchor2.parentNode, anchor2);
46
+ anchor2.remove();
47
+ }
48
+ } else if (current instanceof Node) {
49
+ if (isFragment(node) && current.parentNode) {
50
+ insert(node, current.parentNode, current);
51
+ current.remove();
52
+ } else if (node instanceof Node) {
53
+ if (current.nodeType === 3 && node.nodeType === 3) {
54
+ current.textContent = node.textContent;
55
+ return current;
56
+ } else if (current.parentNode) {
57
+ current.parentNode.replaceChild(node, current);
58
+ }
59
+ }
60
+ }
61
+ }
62
+ return node;
63
+ }
64
+ function resolveValues(values = [], _anchor) {
65
+ const nodes = [];
66
+ const scopes = [];
67
+ for (const [index, value] of values.entries()) {
68
+ const anchor = index === values.length - 1 ? _anchor : void 0;
69
+ if (typeof value === "function") {
70
+ renderEffect(() => {
71
+ if (scopes[index]) scopes[index].stop();
72
+ scopes[index] = effectScope();
73
+ nodes[index] = scopes[index].run(
74
+ () => resolveValue(nodes[index], value(), anchor)
75
+ );
76
+ });
77
+ } else {
78
+ nodes[index] = resolveValue(nodes[index], value, anchor);
79
+ }
80
+ }
81
+ return nodes;
82
+ }
83
+ function setNodes(anchor, ...values) {
84
+ const resolvedValues = resolveValues(values, anchor);
85
+ anchor.parentNode && insert(resolvedValues, anchor.parentNode, anchor);
86
+ }
87
+ function createNodes(...values) {
88
+ return resolveValues(values);
89
+ }
3
90
  export {
91
+ createNodes,
92
+ setNodes,
4
93
  shallowRef as useRef
5
94
  };
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/jsx-runtime.ts
2
+ var _vue = require('vue');
3
+ function jsx(type, props, key) {
4
+ const { children } = props;
5
+ delete props.children;
6
+ if (arguments.length > 2) {
7
+ props.key = key;
8
+ }
9
+ return _vue.h.call(void 0, type, props, children);
10
+ }
11
+
12
+
13
+
14
+
15
+
16
+ exports.Fragment = _vue.Fragment; exports.jsx = jsx; exports.jsxDEV = jsx; exports.jsxs = jsx;