@ibiz-template/vue3-components 0.7.27 → 0.7.28-alpha.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 (121) hide show
  1. package/dist/{index-0TO7mjm5.js → index-HNRMy1_g.js} +1 -1
  2. package/dist/index-QB7iGpIB.js +4 -0
  3. package/dist/{index-g6o3vQXo.js → index-xa8K5AHD.js} +1 -1
  4. package/dist/index.min.css +1 -1
  5. package/dist/index.system.min.js +1 -1
  6. package/dist/wang-editor-YqnK5uQU.js +1 -0
  7. package/dist/{xlsx-util-qdXxbg2A.js → xlsx-util-nADTbeWP.js} +1 -1
  8. package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.d.ts +0 -1
  9. package/es/control/dashboard/dashboard-design/dashboard-design.mjs +3 -3
  10. package/es/control/drtab/drtab-control.util.mjs +1 -1
  11. package/es/control/grid/grid/grid-control.util.d.ts +0 -2
  12. package/es/control/grid/grid/grid-control.util.mjs +9 -72
  13. package/es/control/grid/grid/grid.css +1 -1
  14. package/es/control/grid/grid/grid.d.ts +0 -2
  15. package/es/control/grid/grid/grid.mjs +1 -7
  16. package/es/control/grid/grid/index.d.ts +0 -2
  17. package/es/control/report-panel/report-panel.mjs +5 -0
  18. package/es/control/toolbar/toolbar.css +1 -1
  19. package/es/control/toolbar/toolbar.mjs +144 -8
  20. package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.d.ts +1 -1
  21. package/es/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.mjs +2 -9
  22. package/es/editor/html/html-editor.controller.d.ts +88 -0
  23. package/es/editor/html/html-editor.controller.mjs +169 -6
  24. package/es/editor/html/wang-editor/component/emoji/emoji.css +1 -0
  25. package/es/editor/html/wang-editor/component/emoji/emoji.d.ts +17 -0
  26. package/es/editor/html/wang-editor/component/emoji/emoji.mjs +42 -0
  27. package/es/editor/html/wang-editor/component/index.d.ts +1 -0
  28. package/es/editor/html/wang-editor/component/index.mjs +3 -0
  29. package/es/editor/html/wang-editor/element/emoji.d.ts +7 -0
  30. package/es/editor/html/wang-editor/element/emoji.mjs +22 -0
  31. package/es/editor/html/wang-editor/element/index.d.ts +1 -0
  32. package/es/editor/html/wang-editor/element/index.mjs +3 -0
  33. package/es/editor/html/wang-editor/index.d.ts +4 -0
  34. package/es/editor/html/wang-editor/index.mjs +11 -0
  35. package/es/editor/html/wang-editor/module/ai-module.d.ts +67 -0
  36. package/es/editor/html/wang-editor/module/ai-module.mjs +76 -0
  37. package/es/editor/html/wang-editor/module/emoji-module.d.ts +7 -0
  38. package/es/editor/html/wang-editor/module/emoji-module.mjs +125 -0
  39. package/es/editor/html/wang-editor/module/index.d.ts +2 -0
  40. package/es/editor/html/wang-editor/module/index.mjs +4 -0
  41. package/es/editor/html/wang-editor/plugin/index.d.ts +1 -0
  42. package/es/editor/html/wang-editor/plugin/index.mjs +3 -0
  43. package/es/editor/html/wang-editor/plugin/plugin.d.ts +7 -0
  44. package/es/editor/html/wang-editor/plugin/plugin.mjs +23 -0
  45. package/es/editor/html/wang-editor/wang-editor.css +1 -1
  46. package/es/editor/html/wang-editor/wang-editor.mjs +7 -7
  47. package/es/editor/span/span/span.mjs +2 -2
  48. package/es/editor/text-box/input/input.mjs +2 -2
  49. package/es/locale/en/index.d.ts +1 -0
  50. package/es/locale/en/index.mjs +2 -1
  51. package/es/locale/zh-CN/index.d.ts +1 -0
  52. package/es/locale/zh-CN/index.mjs +2 -1
  53. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/h.mjs +89 -0
  54. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/helpers/attachto.mjs +47 -0
  55. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/hooks.mjs +1 -0
  56. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/htmldomapi.mjs +115 -0
  57. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/index.mjs +18 -0
  58. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/init.mjs +376 -0
  59. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/is.mjs +9 -0
  60. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/jsx.mjs +64 -0
  61. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/attributes.mjs +59 -0
  62. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/class.mjs +28 -0
  63. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/dataset.mjs +42 -0
  64. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/eventlisteners.mjs +85 -0
  65. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/props.mjs +24 -0
  66. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/style.mjs +115 -0
  67. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/thunk.mjs +52 -0
  68. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/tovnode.mjs +62 -0
  69. package/es/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/vnode.mjs +6 -0
  70. package/lib/control/dashboard/dashboard-design/dashboard-design.cjs +3 -3
  71. package/lib/control/drtab/drtab-control.util.cjs +1 -1
  72. package/lib/control/grid/grid/grid-control.util.cjs +9 -72
  73. package/lib/control/grid/grid/grid.cjs +1 -7
  74. package/lib/control/grid/grid/grid.css +1 -1
  75. package/lib/control/report-panel/report-panel.cjs +5 -0
  76. package/lib/control/toolbar/toolbar.cjs +144 -8
  77. package/lib/control/toolbar/toolbar.css +1 -1
  78. package/lib/editor/dropdown-list/ibiz-emoji-picker/ibiz-emoji-picker.cjs +1 -8
  79. package/lib/editor/html/html-editor.controller.cjs +169 -6
  80. package/lib/editor/html/wang-editor/component/emoji/emoji.cjs +44 -0
  81. package/lib/editor/html/wang-editor/component/emoji/emoji.css +1 -0
  82. package/lib/editor/html/wang-editor/component/index.cjs +7 -0
  83. package/lib/editor/html/wang-editor/element/emoji.cjs +24 -0
  84. package/lib/editor/html/wang-editor/element/index.cjs +7 -0
  85. package/lib/editor/html/wang-editor/index.cjs +19 -0
  86. package/lib/editor/html/wang-editor/module/ai-module.cjs +78 -0
  87. package/lib/editor/html/wang-editor/module/emoji-module.cjs +127 -0
  88. package/lib/editor/html/wang-editor/module/index.cjs +9 -0
  89. package/lib/editor/html/wang-editor/plugin/index.cjs +7 -0
  90. package/lib/editor/html/wang-editor/plugin/plugin.cjs +25 -0
  91. package/lib/editor/html/wang-editor/wang-editor.cjs +7 -7
  92. package/lib/editor/html/wang-editor/wang-editor.css +1 -1
  93. package/lib/editor/span/span/span.cjs +1 -1
  94. package/lib/editor/text-box/input/input.cjs +1 -1
  95. package/lib/locale/en/index.cjs +2 -1
  96. package/lib/locale/zh-CN/index.cjs +2 -1
  97. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/h.cjs +93 -0
  98. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/helpers/attachto.cjs +49 -0
  99. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/hooks.cjs +2 -0
  100. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/htmldomapi.cjs +117 -0
  101. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/index.cjs +42 -0
  102. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/init.cjs +378 -0
  103. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/is.cjs +12 -0
  104. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/jsx.cjs +67 -0
  105. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/attributes.cjs +61 -0
  106. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/class.cjs +30 -0
  107. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/dataset.cjs +44 -0
  108. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/eventlisteners.cjs +87 -0
  109. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/props.cjs +26 -0
  110. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/modules/style.cjs +117 -0
  111. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/thunk.cjs +54 -0
  112. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/tovnode.cjs +64 -0
  113. package/lib/node_modules/.pnpm/snabbdom@3.5.1/node_modules/snabbdom/build/vnode.cjs +8 -0
  114. package/package.json +6 -5
  115. package/dist/index-Dq21zXhV.js +0 -4
  116. package/dist/wang-editor-XpJH4SXt.js +0 -1
  117. package/es/editor/html/wang-editor/ai/ai-modules.d.ts +0 -10
  118. package/es/editor/html/wang-editor/ai/ai-modules.mjs +0 -32
  119. package/lib/editor/html/wang-editor/ai/ai-modules.cjs +0 -34
  120. /package/es/node_modules/.pnpm/{@ibiz-template_core@0.7.27_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.28-alpha.0_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.mjs +0 -0
  121. /package/lib/node_modules/.pnpm/{@ibiz-template_core@0.7.27_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.28-alpha.0_axios@1.6.8_lodash-es@4.17.21_qs@6.11.2_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.cjs +0 -0
@@ -0,0 +1,378 @@
1
+ 'use strict';
2
+
3
+ var vnode = require('./vnode.cjs');
4
+ var is = require('./is.cjs');
5
+ var htmldomapi = require('./htmldomapi.cjs');
6
+
7
+ function isUndef(s) {
8
+ return s === undefined;
9
+ }
10
+ function isDef(s) {
11
+ return s !== undefined;
12
+ }
13
+ const emptyNode = vnode.vnode("", {}, [], undefined, undefined);
14
+ function sameVnode(vnode1, vnode2) {
15
+ var _a, _b;
16
+ const isSameKey = vnode1.key === vnode2.key;
17
+ const isSameIs = ((_a = vnode1.data) === null || _a === void 0 ? void 0 : _a.is) === ((_b = vnode2.data) === null || _b === void 0 ? void 0 : _b.is);
18
+ const isSameSel = vnode1.sel === vnode2.sel;
19
+ const isSameTextOrFragment = !vnode1.sel && vnode1.sel === vnode2.sel
20
+ ? typeof vnode1.text === typeof vnode2.text
21
+ : true;
22
+ return isSameSel && isSameKey && isSameIs && isSameTextOrFragment;
23
+ }
24
+ /**
25
+ * @todo Remove this function when the document fragment is considered stable.
26
+ */
27
+ function documentFragmentIsNotSupported() {
28
+ throw new Error("The document fragment is not supported on this platform.");
29
+ }
30
+ function isElement(api, vnode) {
31
+ return api.isElement(vnode);
32
+ }
33
+ function isDocumentFragment(api, vnode) {
34
+ return api.isDocumentFragment(vnode);
35
+ }
36
+ function createKeyToOldIdx(children, beginIdx, endIdx) {
37
+ var _a;
38
+ const map = {};
39
+ for (let i = beginIdx; i <= endIdx; ++i) {
40
+ const key = (_a = children[i]) === null || _a === void 0 ? void 0 : _a.key;
41
+ if (key !== undefined) {
42
+ map[key] = i;
43
+ }
44
+ }
45
+ return map;
46
+ }
47
+ const hooks = [
48
+ "create",
49
+ "update",
50
+ "remove",
51
+ "destroy",
52
+ "pre",
53
+ "post",
54
+ ];
55
+ function init(modules, domApi, options) {
56
+ const cbs = {
57
+ create: [],
58
+ update: [],
59
+ remove: [],
60
+ destroy: [],
61
+ pre: [],
62
+ post: [],
63
+ };
64
+ const api = domApi !== undefined ? domApi : htmldomapi.htmlDomApi;
65
+ for (const hook of hooks) {
66
+ for (const module of modules) {
67
+ const currentHook = module[hook];
68
+ if (currentHook !== undefined) {
69
+ cbs[hook].push(currentHook);
70
+ }
71
+ }
72
+ }
73
+ function emptyNodeAt(elm) {
74
+ const id = elm.id ? "#" + elm.id : "";
75
+ // elm.className doesn't return a string when elm is an SVG element inside a shadowRoot.
76
+ // https://stackoverflow.com/questions/29454340/detecting-classname-of-svganimatedstring
77
+ const classes = elm.getAttribute("class");
78
+ const c = classes ? "." + classes.split(" ").join(".") : "";
79
+ return vnode.vnode(api.tagName(elm).toLowerCase() + id + c, {}, [], undefined, elm);
80
+ }
81
+ function emptyDocumentFragmentAt(frag) {
82
+ return vnode.vnode(undefined, {}, [], undefined, frag);
83
+ }
84
+ function createRmCb(childElm, listeners) {
85
+ return function rmCb() {
86
+ if (--listeners === 0) {
87
+ const parent = api.parentNode(childElm);
88
+ api.removeChild(parent, childElm);
89
+ }
90
+ };
91
+ }
92
+ function createElm(vnode, insertedVnodeQueue) {
93
+ var _a, _b, _c, _d;
94
+ let i;
95
+ let data = vnode.data;
96
+ if (data !== undefined) {
97
+ const init = (_a = data.hook) === null || _a === void 0 ? void 0 : _a.init;
98
+ if (isDef(init)) {
99
+ init(vnode);
100
+ data = vnode.data;
101
+ }
102
+ }
103
+ const children = vnode.children;
104
+ const sel = vnode.sel;
105
+ if (sel === "!") {
106
+ if (isUndef(vnode.text)) {
107
+ vnode.text = "";
108
+ }
109
+ vnode.elm = api.createComment(vnode.text);
110
+ }
111
+ else if (sel !== undefined) {
112
+ // Parse selector
113
+ const hashIdx = sel.indexOf("#");
114
+ const dotIdx = sel.indexOf(".", hashIdx);
115
+ const hash = hashIdx > 0 ? hashIdx : sel.length;
116
+ const dot = dotIdx > 0 ? dotIdx : sel.length;
117
+ const tag = hashIdx !== -1 || dotIdx !== -1
118
+ ? sel.slice(0, Math.min(hash, dot))
119
+ : sel;
120
+ const elm = (vnode.elm =
121
+ isDef(data) && isDef((i = data.ns))
122
+ ? api.createElementNS(i, tag, data)
123
+ : api.createElement(tag, data));
124
+ if (hash < dot)
125
+ elm.setAttribute("id", sel.slice(hash + 1, dot));
126
+ if (dotIdx > 0)
127
+ elm.setAttribute("class", sel.slice(dot + 1).replace(/\./g, " "));
128
+ for (i = 0; i < cbs.create.length; ++i)
129
+ cbs.create[i](emptyNode, vnode);
130
+ if (is.array(children)) {
131
+ for (i = 0; i < children.length; ++i) {
132
+ const ch = children[i];
133
+ if (ch != null) {
134
+ api.appendChild(elm, createElm(ch, insertedVnodeQueue));
135
+ }
136
+ }
137
+ }
138
+ else if (is.primitive(vnode.text)) {
139
+ api.appendChild(elm, api.createTextNode(vnode.text));
140
+ }
141
+ const hook = vnode.data.hook;
142
+ if (isDef(hook)) {
143
+ (_b = hook.create) === null || _b === void 0 ? void 0 : _b.call(hook, emptyNode, vnode);
144
+ if (hook.insert) {
145
+ insertedVnodeQueue.push(vnode);
146
+ }
147
+ }
148
+ }
149
+ else if (((_c = options === null || options === void 0 ? void 0 : options.experimental) === null || _c === void 0 ? void 0 : _c.fragments) && vnode.children) {
150
+ vnode.elm = ((_d = api.createDocumentFragment) !== null && _d !== void 0 ? _d : documentFragmentIsNotSupported)();
151
+ for (i = 0; i < cbs.create.length; ++i)
152
+ cbs.create[i](emptyNode, vnode);
153
+ for (i = 0; i < vnode.children.length; ++i) {
154
+ const ch = vnode.children[i];
155
+ if (ch != null) {
156
+ api.appendChild(vnode.elm, createElm(ch, insertedVnodeQueue));
157
+ }
158
+ }
159
+ }
160
+ else {
161
+ vnode.elm = api.createTextNode(vnode.text);
162
+ }
163
+ return vnode.elm;
164
+ }
165
+ function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
166
+ for (; startIdx <= endIdx; ++startIdx) {
167
+ const ch = vnodes[startIdx];
168
+ if (ch != null) {
169
+ api.insertBefore(parentElm, createElm(ch, insertedVnodeQueue), before);
170
+ }
171
+ }
172
+ }
173
+ function invokeDestroyHook(vnode) {
174
+ var _a, _b;
175
+ const data = vnode.data;
176
+ if (data !== undefined) {
177
+ (_b = (_a = data === null || data === void 0 ? void 0 : data.hook) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a, vnode);
178
+ for (let i = 0; i < cbs.destroy.length; ++i)
179
+ cbs.destroy[i](vnode);
180
+ if (vnode.children !== undefined) {
181
+ for (let j = 0; j < vnode.children.length; ++j) {
182
+ const child = vnode.children[j];
183
+ if (child != null && typeof child !== "string") {
184
+ invokeDestroyHook(child);
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+ function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
191
+ var _a, _b;
192
+ for (; startIdx <= endIdx; ++startIdx) {
193
+ let listeners;
194
+ let rm;
195
+ const ch = vnodes[startIdx];
196
+ if (ch != null) {
197
+ if (isDef(ch.sel)) {
198
+ invokeDestroyHook(ch);
199
+ listeners = cbs.remove.length + 1;
200
+ rm = createRmCb(ch.elm, listeners);
201
+ for (let i = 0; i < cbs.remove.length; ++i)
202
+ cbs.remove[i](ch, rm);
203
+ const removeHook = (_b = (_a = ch === null || ch === void 0 ? void 0 : ch.data) === null || _a === void 0 ? void 0 : _a.hook) === null || _b === void 0 ? void 0 : _b.remove;
204
+ if (isDef(removeHook)) {
205
+ removeHook(ch, rm);
206
+ }
207
+ else {
208
+ rm();
209
+ }
210
+ }
211
+ else if (ch.children) {
212
+ // Fragment node
213
+ invokeDestroyHook(ch);
214
+ removeVnodes(parentElm, ch.children, 0, ch.children.length - 1);
215
+ }
216
+ else {
217
+ // Text node
218
+ api.removeChild(parentElm, ch.elm);
219
+ }
220
+ }
221
+ }
222
+ }
223
+ function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) {
224
+ let oldStartIdx = 0;
225
+ let newStartIdx = 0;
226
+ let oldEndIdx = oldCh.length - 1;
227
+ let oldStartVnode = oldCh[0];
228
+ let oldEndVnode = oldCh[oldEndIdx];
229
+ let newEndIdx = newCh.length - 1;
230
+ let newStartVnode = newCh[0];
231
+ let newEndVnode = newCh[newEndIdx];
232
+ let oldKeyToIdx;
233
+ let idxInOld;
234
+ let elmToMove;
235
+ let before;
236
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
237
+ if (oldStartVnode == null) {
238
+ oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
239
+ }
240
+ else if (oldEndVnode == null) {
241
+ oldEndVnode = oldCh[--oldEndIdx];
242
+ }
243
+ else if (newStartVnode == null) {
244
+ newStartVnode = newCh[++newStartIdx];
245
+ }
246
+ else if (newEndVnode == null) {
247
+ newEndVnode = newCh[--newEndIdx];
248
+ }
249
+ else if (sameVnode(oldStartVnode, newStartVnode)) {
250
+ patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
251
+ oldStartVnode = oldCh[++oldStartIdx];
252
+ newStartVnode = newCh[++newStartIdx];
253
+ }
254
+ else if (sameVnode(oldEndVnode, newEndVnode)) {
255
+ patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
256
+ oldEndVnode = oldCh[--oldEndIdx];
257
+ newEndVnode = newCh[--newEndIdx];
258
+ }
259
+ else if (sameVnode(oldStartVnode, newEndVnode)) {
260
+ // Vnode moved right
261
+ patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
262
+ api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));
263
+ oldStartVnode = oldCh[++oldStartIdx];
264
+ newEndVnode = newCh[--newEndIdx];
265
+ }
266
+ else if (sameVnode(oldEndVnode, newStartVnode)) {
267
+ // Vnode moved left
268
+ patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
269
+ api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
270
+ oldEndVnode = oldCh[--oldEndIdx];
271
+ newStartVnode = newCh[++newStartIdx];
272
+ }
273
+ else {
274
+ if (oldKeyToIdx === undefined) {
275
+ oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
276
+ }
277
+ idxInOld = oldKeyToIdx[newStartVnode.key];
278
+ if (isUndef(idxInOld)) {
279
+ // New element
280
+ api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
281
+ }
282
+ else {
283
+ elmToMove = oldCh[idxInOld];
284
+ if (elmToMove.sel !== newStartVnode.sel) {
285
+ api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
286
+ }
287
+ else {
288
+ patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
289
+ oldCh[idxInOld] = undefined;
290
+ api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
291
+ }
292
+ }
293
+ newStartVnode = newCh[++newStartIdx];
294
+ }
295
+ }
296
+ if (newStartIdx <= newEndIdx) {
297
+ before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
298
+ addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
299
+ }
300
+ if (oldStartIdx <= oldEndIdx) {
301
+ removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
302
+ }
303
+ }
304
+ function patchVnode(oldVnode, vnode, insertedVnodeQueue) {
305
+ var _a, _b, _c, _d, _e, _f, _g, _h;
306
+ const hook = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.hook;
307
+ (_b = hook === null || hook === void 0 ? void 0 : hook.prepatch) === null || _b === void 0 ? void 0 : _b.call(hook, oldVnode, vnode);
308
+ const elm = (vnode.elm = oldVnode.elm);
309
+ if (oldVnode === vnode)
310
+ return;
311
+ if (vnode.data !== undefined ||
312
+ (isDef(vnode.text) && vnode.text !== oldVnode.text)) {
313
+ (_c = vnode.data) !== null && _c !== void 0 ? _c : (vnode.data = {});
314
+ (_d = oldVnode.data) !== null && _d !== void 0 ? _d : (oldVnode.data = {});
315
+ for (let i = 0; i < cbs.update.length; ++i)
316
+ cbs.update[i](oldVnode, vnode);
317
+ (_g = (_f = (_e = vnode.data) === null || _e === void 0 ? void 0 : _e.hook) === null || _f === void 0 ? void 0 : _f.update) === null || _g === void 0 ? void 0 : _g.call(_f, oldVnode, vnode);
318
+ }
319
+ const oldCh = oldVnode.children;
320
+ const ch = vnode.children;
321
+ if (isUndef(vnode.text)) {
322
+ if (isDef(oldCh) && isDef(ch)) {
323
+ if (oldCh !== ch)
324
+ updateChildren(elm, oldCh, ch, insertedVnodeQueue);
325
+ }
326
+ else if (isDef(ch)) {
327
+ if (isDef(oldVnode.text))
328
+ api.setTextContent(elm, "");
329
+ addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
330
+ }
331
+ else if (isDef(oldCh)) {
332
+ removeVnodes(elm, oldCh, 0, oldCh.length - 1);
333
+ }
334
+ else if (isDef(oldVnode.text)) {
335
+ api.setTextContent(elm, "");
336
+ }
337
+ }
338
+ else if (oldVnode.text !== vnode.text) {
339
+ if (isDef(oldCh)) {
340
+ removeVnodes(elm, oldCh, 0, oldCh.length - 1);
341
+ }
342
+ api.setTextContent(elm, vnode.text);
343
+ }
344
+ (_h = hook === null || hook === void 0 ? void 0 : hook.postpatch) === null || _h === void 0 ? void 0 : _h.call(hook, oldVnode, vnode);
345
+ }
346
+ return function patch(oldVnode, vnode) {
347
+ let i, elm, parent;
348
+ const insertedVnodeQueue = [];
349
+ for (i = 0; i < cbs.pre.length; ++i)
350
+ cbs.pre[i]();
351
+ if (isElement(api, oldVnode)) {
352
+ oldVnode = emptyNodeAt(oldVnode);
353
+ }
354
+ else if (isDocumentFragment(api, oldVnode)) {
355
+ oldVnode = emptyDocumentFragmentAt(oldVnode);
356
+ }
357
+ if (sameVnode(oldVnode, vnode)) {
358
+ patchVnode(oldVnode, vnode, insertedVnodeQueue);
359
+ }
360
+ else {
361
+ elm = oldVnode.elm;
362
+ parent = api.parentNode(elm);
363
+ createElm(vnode, insertedVnodeQueue);
364
+ if (parent !== null) {
365
+ api.insertBefore(parent, vnode.elm, api.nextSibling(elm));
366
+ removeVnodes(parent, [oldVnode], 0, 0);
367
+ }
368
+ }
369
+ for (i = 0; i < insertedVnodeQueue.length; ++i) {
370
+ insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]);
371
+ }
372
+ for (i = 0; i < cbs.post.length; ++i)
373
+ cbs.post[i]();
374
+ return vnode;
375
+ };
376
+ }
377
+
378
+ exports.init = init;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ const array = Array.isArray;
4
+ function primitive(s) {
5
+ return (typeof s === "string" ||
6
+ typeof s === "number" ||
7
+ s instanceof String ||
8
+ s instanceof Number);
9
+ }
10
+
11
+ exports.array = array;
12
+ exports.primitive = primitive;
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ var vnode = require('./vnode.cjs');
4
+ var h = require('./h.cjs');
5
+
6
+ /* eslint-disable @typescript-eslint/no-namespace, import/export */
7
+ function Fragment(data, ...children) {
8
+ const flatChildren = flattenAndFilter(children, []);
9
+ if (flatChildren.length === 1 &&
10
+ !flatChildren[0].sel &&
11
+ flatChildren[0].text) {
12
+ // only child is a simple text node, pass as text for a simpler vtree
13
+ return vnode.vnode(undefined, undefined, undefined, flatChildren[0].text, undefined);
14
+ }
15
+ else {
16
+ return vnode.vnode(undefined, data !== null && data !== void 0 ? data : {}, flatChildren, undefined, undefined);
17
+ }
18
+ }
19
+ function flattenAndFilter(children, flattened) {
20
+ for (const child of children) {
21
+ // filter out falsey children, except 0 since zero can be a valid value e.g inside a chart
22
+ if (child !== undefined &&
23
+ child !== null &&
24
+ child !== false &&
25
+ child !== "") {
26
+ if (Array.isArray(child)) {
27
+ flattenAndFilter(child, flattened);
28
+ }
29
+ else if (typeof child === "string" ||
30
+ typeof child === "number" ||
31
+ typeof child === "boolean") {
32
+ flattened.push(vnode.vnode(undefined, undefined, undefined, String(child), undefined));
33
+ }
34
+ else {
35
+ flattened.push(child);
36
+ }
37
+ }
38
+ }
39
+ return flattened;
40
+ }
41
+ /**
42
+ * jsx/tsx compatible factory function
43
+ * see: https://www.typescriptlang.org/docs/handbook/jsx.html#factory-functions
44
+ */
45
+ function jsx(tag, data, ...children) {
46
+ const flatChildren = flattenAndFilter(children, []);
47
+ if (typeof tag === "function") {
48
+ // tag is a function component
49
+ return tag(data, flatChildren);
50
+ }
51
+ else {
52
+ if (flatChildren.length === 1 &&
53
+ !flatChildren[0].sel &&
54
+ flatChildren[0].text) {
55
+ // only child is a simple text node, pass as text for a simpler vtree
56
+ return h.h(tag, data, flatChildren[0].text);
57
+ }
58
+ else {
59
+ return h.h(tag, data, flatChildren);
60
+ }
61
+ }
62
+ }
63
+ (function (jsx) {
64
+ })(jsx || (jsx = {}));
65
+
66
+ exports.Fragment = Fragment;
67
+ exports.jsx = jsx;
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ const xlinkNS = "http://www.w3.org/1999/xlink";
4
+ const xmlNS = "http://www.w3.org/XML/1998/namespace";
5
+ const colonChar = 58;
6
+ const xChar = 120;
7
+ function updateAttrs(oldVnode, vnode) {
8
+ let key;
9
+ const elm = vnode.elm;
10
+ let oldAttrs = oldVnode.data.attrs;
11
+ let attrs = vnode.data.attrs;
12
+ if (!oldAttrs && !attrs)
13
+ return;
14
+ if (oldAttrs === attrs)
15
+ return;
16
+ oldAttrs = oldAttrs || {};
17
+ attrs = attrs || {};
18
+ // update modified attributes, add new attributes
19
+ for (key in attrs) {
20
+ const cur = attrs[key];
21
+ const old = oldAttrs[key];
22
+ if (old !== cur) {
23
+ if (cur === true) {
24
+ elm.setAttribute(key, "");
25
+ }
26
+ else if (cur === false) {
27
+ elm.removeAttribute(key);
28
+ }
29
+ else {
30
+ if (key.charCodeAt(0) !== xChar) {
31
+ elm.setAttribute(key, cur);
32
+ }
33
+ else if (key.charCodeAt(3) === colonChar) {
34
+ // Assume xml namespace
35
+ elm.setAttributeNS(xmlNS, key, cur);
36
+ }
37
+ else if (key.charCodeAt(5) === colonChar) {
38
+ // Assume xlink namespace
39
+ elm.setAttributeNS(xlinkNS, key, cur);
40
+ }
41
+ else {
42
+ elm.setAttribute(key, cur);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ // remove removed attributes
48
+ // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)
49
+ // the other option is to remove all attributes with value == undefined
50
+ for (key in oldAttrs) {
51
+ if (!(key in attrs)) {
52
+ elm.removeAttribute(key);
53
+ }
54
+ }
55
+ }
56
+ const attributesModule = {
57
+ create: updateAttrs,
58
+ update: updateAttrs,
59
+ };
60
+
61
+ exports.attributesModule = attributesModule;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ function updateClass(oldVnode, vnode) {
4
+ let cur;
5
+ let name;
6
+ const elm = vnode.elm;
7
+ let oldClass = oldVnode.data.class;
8
+ let klass = vnode.data.class;
9
+ if (!oldClass && !klass)
10
+ return;
11
+ if (oldClass === klass)
12
+ return;
13
+ oldClass = oldClass || {};
14
+ klass = klass || {};
15
+ for (name in oldClass) {
16
+ if (oldClass[name] && !Object.prototype.hasOwnProperty.call(klass, name)) {
17
+ // was `true` and now not provided
18
+ elm.classList.remove(name);
19
+ }
20
+ }
21
+ for (name in klass) {
22
+ cur = klass[name];
23
+ if (cur !== oldClass[name]) {
24
+ elm.classList[cur ? "add" : "remove"](name);
25
+ }
26
+ }
27
+ }
28
+ const classModule = { create: updateClass, update: updateClass };
29
+
30
+ exports.classModule = classModule;
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ const CAPS_REGEX = /[A-Z]/g;
4
+ function updateDataset(oldVnode, vnode) {
5
+ const elm = vnode.elm;
6
+ let oldDataset = oldVnode.data.dataset;
7
+ let dataset = vnode.data.dataset;
8
+ let key;
9
+ if (!oldDataset && !dataset)
10
+ return;
11
+ if (oldDataset === dataset)
12
+ return;
13
+ oldDataset = oldDataset || {};
14
+ dataset = dataset || {};
15
+ const d = elm.dataset;
16
+ for (key in oldDataset) {
17
+ if (!dataset[key]) {
18
+ if (d) {
19
+ if (key in d) {
20
+ delete d[key];
21
+ }
22
+ }
23
+ else {
24
+ elm.removeAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase());
25
+ }
26
+ }
27
+ }
28
+ for (key in dataset) {
29
+ if (oldDataset[key] !== dataset[key]) {
30
+ if (d) {
31
+ d[key] = dataset[key];
32
+ }
33
+ else {
34
+ elm.setAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase(), dataset[key]);
35
+ }
36
+ }
37
+ }
38
+ }
39
+ const datasetModule = {
40
+ create: updateDataset,
41
+ update: updateDataset,
42
+ };
43
+
44
+ exports.datasetModule = datasetModule;
@@ -0,0 +1,87 @@
1
+ 'use strict';
2
+
3
+ function invokeHandler(handler, vnode, event) {
4
+ if (typeof handler === "function") {
5
+ // call function handler
6
+ handler.call(vnode, event, vnode);
7
+ }
8
+ else if (typeof handler === "object") {
9
+ // call multiple handlers
10
+ for (let i = 0; i < handler.length; i++) {
11
+ invokeHandler(handler[i], vnode, event);
12
+ }
13
+ }
14
+ }
15
+ function handleEvent(event, vnode) {
16
+ const name = event.type;
17
+ const on = vnode.data.on;
18
+ // call event handler(s) if exists
19
+ if (on && on[name]) {
20
+ invokeHandler(on[name], vnode, event);
21
+ }
22
+ }
23
+ function createListener() {
24
+ return function handler(event) {
25
+ handleEvent(event, handler.vnode);
26
+ };
27
+ }
28
+ function updateEventListeners(oldVnode, vnode) {
29
+ const oldOn = oldVnode.data.on;
30
+ const oldListener = oldVnode.listener;
31
+ const oldElm = oldVnode.elm;
32
+ const on = vnode && vnode.data.on;
33
+ const elm = (vnode && vnode.elm);
34
+ let name;
35
+ // optimization for reused immutable handlers
36
+ if (oldOn === on) {
37
+ return;
38
+ }
39
+ // remove existing listeners which no longer used
40
+ if (oldOn && oldListener) {
41
+ // if element changed or deleted we remove all existing listeners unconditionally
42
+ if (!on) {
43
+ for (name in oldOn) {
44
+ // remove listener if element was changed or existing listeners removed
45
+ oldElm.removeEventListener(name, oldListener, false);
46
+ }
47
+ }
48
+ else {
49
+ for (name in oldOn) {
50
+ // remove listener if existing listener removed
51
+ if (!on[name]) {
52
+ oldElm.removeEventListener(name, oldListener, false);
53
+ }
54
+ }
55
+ }
56
+ }
57
+ // add new listeners which has not already attached
58
+ if (on) {
59
+ // reuse existing listener or create new
60
+ const listener = (vnode.listener =
61
+ oldVnode.listener || createListener());
62
+ // update vnode for listener
63
+ listener.vnode = vnode;
64
+ // if element changed or added we add all needed listeners unconditionally
65
+ if (!oldOn) {
66
+ for (name in on) {
67
+ // add listener if element was changed or new listeners added
68
+ elm.addEventListener(name, listener, false);
69
+ }
70
+ }
71
+ else {
72
+ for (name in on) {
73
+ // add listener if new listener added
74
+ if (!oldOn[name]) {
75
+ elm.addEventListener(name, listener, false);
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ const eventListenersModule = {
82
+ create: updateEventListeners,
83
+ update: updateEventListeners,
84
+ destroy: updateEventListeners,
85
+ };
86
+
87
+ exports.eventListenersModule = eventListenersModule;