@dcloudio/uni-cli-shared 3.0.0-alpha-4070720250804001 → 3.0.0-alpha-4070620250731002

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 (163) hide show
  1. package/dist/easycom.d.ts +0 -1
  2. package/dist/easycom.js +13 -17
  3. package/dist/hbx/alias.js +10 -43
  4. package/dist/hbx/index.js +0 -10
  5. package/dist/hbx/log.js +1 -23
  6. package/dist/index.d.ts +1 -2
  7. package/dist/index.js +1 -3
  8. package/dist/json/index.d.ts +1 -1
  9. package/dist/json/index.js +1 -2
  10. package/dist/json/manifest.d.ts +0 -1
  11. package/dist/json/manifest.js +1 -11
  12. package/dist/json/mp/jsonFile.js +2 -4
  13. package/dist/json/mp/pages.js +0 -1
  14. package/dist/json/mp/types.d.ts +1 -4
  15. package/dist/json/uni-x/manifest.d.ts +0 -1
  16. package/dist/json/uni-x/manifest.js +1 -5
  17. package/dist/messages/zh_CN.js +0 -1
  18. package/dist/uni_modules.cloud.d.ts +4 -10
  19. package/dist/uni_modules.cloud.js +19 -58
  20. package/dist/uni_modules.d.ts +0 -2
  21. package/dist/uni_modules.js +2 -81
  22. package/dist/uts.js +0 -16
  23. package/dist/vite/autoImport.js +0 -2
  24. package/dist/vite/cloud.js +5 -51
  25. package/dist/vite/plugins/index.d.ts +0 -1
  26. package/dist/vite/plugins/index.js +1 -3
  27. package/dist/vite/plugins/inject.js +1 -3
  28. package/dist/vite/plugins/uts/uni_modules.d.ts +0 -1
  29. package/dist/vite/plugins/uts/uni_modules.js +14 -63
  30. package/dist/vite/plugins/uts/uvue.js +3 -17
  31. package/dist/vite/plugins/vitejs/plugins/css.js +5 -40
  32. package/dist/vue/transforms/transformUTSComponent.js +3 -8
  33. package/package.json +38 -38
  34. package/dist/vite/plugins/stats.d.ts +0 -2
  35. package/dist/vite/plugins/stats.js +0 -42
  36. package/dist/workers.d.ts +0 -14
  37. package/dist/workers.js +0 -187
  38. package/lib/vapor/@vitejs/plugin-vue/LICENSE +0 -21
  39. package/lib/vapor/@vitejs/plugin-vue/README.md +0 -278
  40. package/lib/vapor/@vitejs/plugin-vue/dist/index.cjs +0 -3105
  41. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.cts +0 -113
  42. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.mts +0 -111
  43. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.ts +0 -113
  44. package/lib/vapor/@vitejs/plugin-vue/dist/index.mjs +0 -3090
  45. package/lib/vapor/@vitejs/plugin-vue/package.json +0 -50
  46. package/lib/vapor/@vue/compiler-core/LICENSE +0 -21
  47. package/lib/vapor/@vue/compiler-core/README.md +0 -1
  48. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.js +0 -6902
  49. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.prod.js +0 -6779
  50. package/lib/vapor/@vue/compiler-core/dist/compiler-core.esm-bundler.js +0 -5870
  51. package/lib/vapor/@vue/compiler-core/index.js +0 -7
  52. package/lib/vapor/@vue/compiler-core/package.json +0 -58
  53. package/lib/vapor/@vue/compiler-dom/LICENSE +0 -21
  54. package/lib/vapor/@vue/compiler-dom/README.md +0 -1
  55. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.js +0 -936
  56. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +0 -856
  57. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +0 -6682
  58. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +0 -14
  59. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +0 -693
  60. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.js +0 -6855
  61. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.prod.js +0 -14
  62. package/lib/vapor/@vue/compiler-dom/index.js +0 -7
  63. package/lib/vapor/@vue/compiler-dom/package.json +0 -57
  64. package/lib/vapor/@vue/compiler-sfc/LICENSE +0 -21
  65. package/lib/vapor/@vue/compiler-sfc/README.md +0 -80
  66. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -21682
  67. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +0 -66272
  68. package/lib/vapor/@vue/compiler-sfc/package.json +0 -68
  69. package/lib/vapor/@vue/compiler-ssr/LICENSE +0 -21
  70. package/lib/vapor/@vue/compiler-ssr/README.md +0 -1
  71. package/lib/vapor/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +0 -1402
  72. package/lib/vapor/@vue/compiler-ssr/package.json +0 -34
  73. package/lib/vapor/@vue/compiler-vapor/LICENSE +0 -21
  74. package/lib/vapor/@vue/compiler-vapor/README.md +0 -1
  75. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +0 -4540
  76. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +0 -37020
  77. package/lib/vapor/@vue/compiler-vapor/package.json +0 -49
  78. package/lib/vapor/@vue/reactivity/LICENSE +0 -21
  79. package/lib/vapor/@vue/reactivity/README.md +0 -19
  80. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.js +0 -2033
  81. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.prod.js +0 -1841
  82. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.js +0 -2023
  83. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.prod.js +0 -5
  84. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-bundler.js +0 -1992
  85. package/lib/vapor/@vue/reactivity/dist/reactivity.global.js +0 -2082
  86. package/lib/vapor/@vue/reactivity/dist/reactivity.global.prod.js +0 -5
  87. package/lib/vapor/@vue/reactivity/index.js +0 -7
  88. package/lib/vapor/@vue/reactivity/package.json +0 -55
  89. package/lib/vapor/@vue/runtime-core/LICENSE +0 -21
  90. package/lib/vapor/@vue/runtime-core/README.md +0 -28
  91. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.js +0 -8972
  92. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.prod.js +0 -7088
  93. package/lib/vapor/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8913
  94. package/lib/vapor/@vue/runtime-core/index.js +0 -7
  95. package/lib/vapor/@vue/runtime-core/package.json +0 -54
  96. package/lib/vapor/@vue/runtime-dom/LICENSE +0 -21
  97. package/lib/vapor/@vue/runtime-dom/README.md +0 -13
  98. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.js +0 -1797
  99. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +0 -1646
  100. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +0 -12929
  101. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +0 -6
  102. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1838
  103. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.js +0 -13086
  104. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.prod.js +0 -6
  105. package/lib/vapor/@vue/runtime-dom/index.js +0 -7
  106. package/lib/vapor/@vue/runtime-dom/package.json +0 -60
  107. package/lib/vapor/@vue/runtime-vapor/LICENSE +0 -21
  108. package/lib/vapor/@vue/runtime-vapor/README.md +0 -8
  109. package/lib/vapor/@vue/runtime-vapor/dist/runtime-vapor.esm-bundler.js +0 -3242
  110. package/lib/vapor/@vue/runtime-vapor/package.json +0 -47
  111. package/lib/vapor/@vue/server-renderer/LICENSE +0 -21
  112. package/lib/vapor/@vue/server-renderer/README.md +0 -178
  113. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.js +0 -1144
  114. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.prod.js +0 -871
  115. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.js +0 -8756
  116. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.prod.js +0 -5
  117. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-bundler.js +0 -1366
  118. package/lib/vapor/@vue/server-renderer/index.js +0 -7
  119. package/lib/vapor/@vue/server-renderer/package.json +0 -55
  120. package/lib/vapor/@vue/shared/LICENSE +0 -21
  121. package/lib/vapor/@vue/shared/README.md +0 -3
  122. package/lib/vapor/@vue/shared/dist/shared.cjs.js +0 -698
  123. package/lib/vapor/@vue/shared/dist/shared.cjs.prod.js +0 -690
  124. package/lib/vapor/@vue/shared/dist/shared.esm-bundler.js +0 -616
  125. package/lib/vapor/@vue/shared/index.js +0 -7
  126. package/lib/vapor/@vue/shared/package.json +0 -47
  127. package/lib/vapor/@vue/vue/LICENSE +0 -21
  128. package/lib/vapor/@vue/vue/README.md +0 -62
  129. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.js +0 -1
  130. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.mjs +0 -1
  131. package/lib/vapor/@vue/vue/compiler-sfc/index.d.mts +0 -1
  132. package/lib/vapor/@vue/vue/compiler-sfc/index.d.ts +0 -1
  133. package/lib/vapor/@vue/vue/compiler-sfc/index.js +0 -3
  134. package/lib/vapor/@vue/vue/compiler-sfc/index.mjs +0 -3
  135. package/lib/vapor/@vue/vue/compiler-sfc/package.json +0 -4
  136. package/lib/vapor/@vue/vue/compiler-sfc/register-ts.js +0 -3
  137. package/lib/vapor/@vue/vue/dist/vue.cjs.js +0 -80
  138. package/lib/vapor/@vue/vue/dist/vue.cjs.prod.js +0 -66
  139. package/lib/vapor/@vue/vue/dist/vue.esm-browser.js +0 -18840
  140. package/lib/vapor/@vue/vue/dist/vue.esm-browser.prod.js +0 -12
  141. package/lib/vapor/@vue/vue/dist/vue.esm-bundler.js +0 -72
  142. package/lib/vapor/@vue/vue/dist/vue.global.js +0 -18820
  143. package/lib/vapor/@vue/vue/dist/vue.global.prod.js +0 -12
  144. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.js +0 -15648
  145. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.prod.js +0 -9
  146. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.js +0 -12953
  147. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.prod.js +0 -6
  148. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-bundler.js +0 -29
  149. package/lib/vapor/@vue/vue/dist/vue.runtime.global.js +0 -13111
  150. package/lib/vapor/@vue/vue/dist/vue.runtime.global.prod.js +0 -6
  151. package/lib/vapor/@vue/vue/index.js +0 -7
  152. package/lib/vapor/@vue/vue/index.mjs +0 -1
  153. package/lib/vapor/@vue/vue/jsx-runtime/index.d.ts +0 -25
  154. package/lib/vapor/@vue/vue/jsx-runtime/index.js +0 -15
  155. package/lib/vapor/@vue/vue/jsx-runtime/index.mjs +0 -12
  156. package/lib/vapor/@vue/vue/jsx-runtime/package.json +0 -5
  157. package/lib/vapor/@vue/vue/jsx.d.ts +0 -22
  158. package/lib/vapor/@vue/vue/package.json +0 -114
  159. package/lib/vapor/@vue/vue/server-renderer/index.d.mts +0 -1
  160. package/lib/vapor/@vue/vue/server-renderer/index.d.ts +0 -1
  161. package/lib/vapor/@vue/vue/server-renderer/index.js +0 -1
  162. package/lib/vapor/@vue/vue/server-renderer/index.mjs +0 -1
  163. package/lib/vapor/@vue/vue/server-renderer/package.json +0 -4
@@ -1,3242 +0,0 @@
1
- /**
2
- * @vue/runtime-vapor v3.6.0-alpha.2
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/
6
- import { warn as warn$2, currentInstance as currentInstance$1, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, createVNode as createVNode$1, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, baseEmit, baseNormalizePropsOptions, pushWarningContext as pushWarningContext$1, validateProps, popWarningContext as popWarningContext$1, resolvePropValue, isRef as isRef$1, registerHMR, PublicInstanceProxyHandlers, callWithErrorHandling as callWithErrorHandling$1, endMeasure, unregisterHMR, publicPropertiesMap, nextUid, EffectScope as EffectScope$1, expose, createAppAPI, initFeatureFlags, setDevtoolsHook as setDevtoolsHook$1, flushOnAppMount, resolveDynamicComponent, vShowOriginalDisplay, vShowHidden as vShowHidden$1, vModelTextInit, vModelCheckboxInit, vModelSelectInit, onMounted, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected } from '@vue/runtime-dom';
7
- import { isArray, hasOwn, invokeArrayFns, isString, isFunction, EMPTY_OBJ, isOn, isObject, extend, NOOP, parseStringStyle, camelize, canSetValueDirectly, toDisplayString, EMPTY_ARR, NO, YES, getGlobalThis, remove as remove$1, looseEqual } from '@vue/shared';
8
- import { setActiveSub, EffectScope, ReactiveEffect, isRef, toRaw, isProxy, onEffectCleanup, proxyRefs, onScopeDispose as onScopeDispose$1, markRaw, watch, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, traverse } from '@vue/reactivity';
9
- import { normalizeClass, normalizeStyle as normalizeStyle$1 } from '@dcloudio/uni-shared';
10
- import { expand } from '@dcloudio/uni-nvue-styler/dist/uni-nvue-styler.es';
11
-
12
- let insertionParent;
13
- let insertionAnchor;
14
- function setInsertionState(parent, anchor) {
15
- insertionParent = parent;
16
- insertionAnchor = anchor;
17
- }
18
- function resetInsertionState() {
19
- insertionParent = insertionAnchor = void 0;
20
- }
21
-
22
- /*! #__NO_SIDE_EFFECTS__ */
23
- // @__NO_SIDE_EFFECTS__
24
- function createTextNode(doc, value = "") {
25
- return doc.createTextNode(value);
26
- }
27
- /*! #__NO_SIDE_EFFECTS__ */
28
- // @__NO_SIDE_EFFECTS__
29
- function child(node) {
30
- return node.firstChild;
31
- }
32
- /*! #__NO_SIDE_EFFECTS__ */
33
- // @__NO_SIDE_EFFECTS__
34
- function nthChild(node, i) {
35
- return node.childNodes[i];
36
- }
37
- /*! #__NO_SIDE_EFFECTS__ */
38
- // @__NO_SIDE_EFFECTS__
39
- function next(node) {
40
- return node.nextSibling;
41
- }
42
-
43
- let isHydrating = false;
44
- let currentHydrationNode = null;
45
- let isOptimized$1 = false;
46
- function withHydration(container, fn) {
47
- adoptTemplate = adoptTemplateImpl;
48
- locateHydrationNode = locateHydrationNodeImpl;
49
- if (!isOptimized$1) {
50
- Comment.prototype.$fs = void 0;
51
- isOptimized$1 = true;
52
- }
53
- isHydrating = true;
54
- setInsertionState(container, 0);
55
- const res = fn();
56
- resetInsertionState();
57
- currentHydrationNode = null;
58
- isHydrating = false;
59
- return res;
60
- }
61
- let adoptTemplate;
62
- let locateHydrationNode;
63
- const isComment = (node, data) => node.nodeType === 8 && node.data === data;
64
- function adoptTemplateImpl(node, template) {
65
- if (!(template[0] === "<" && template[1] === "!")) {
66
- while (node.nodeType === 8) node = next(node);
67
- }
68
- if (!!(process.env.NODE_ENV !== "production")) {
69
- const type = node.nodeType;
70
- if (type === 8 && !template.startsWith("<!") || type === 1 && !template.startsWith(`<` + node.tagName.toLowerCase()) || type === 3 && template.trim() && !template.startsWith(node.data)) {
71
- warn$2(`adopted: `, node);
72
- warn$2(`template: ${template}`);
73
- warn$2("hydration mismatch!");
74
- }
75
- }
76
- currentHydrationNode = next(node);
77
- return node;
78
- }
79
- function locateHydrationNodeImpl() {
80
- let node;
81
- if (insertionAnchor === 0) {
82
- node = child(insertionParent);
83
- } else {
84
- node = insertionAnchor ? insertionAnchor.previousSibling : insertionParent ? insertionParent.lastChild : currentHydrationNode;
85
- if (node && isComment(node, "]")) {
86
- if (node.$fs) {
87
- node = node.$fs;
88
- } else {
89
- let cur = node;
90
- let curFragEnd = node;
91
- let fragDepth = 0;
92
- node = null;
93
- while (cur) {
94
- cur = cur.previousSibling;
95
- if (cur) {
96
- if (isComment(cur, "[")) {
97
- curFragEnd.$fs = cur;
98
- if (!fragDepth) {
99
- node = cur;
100
- break;
101
- } else {
102
- fragDepth--;
103
- }
104
- } else if (isComment(cur, "]")) {
105
- curFragEnd = cur;
106
- fragDepth++;
107
- }
108
- }
109
- }
110
- }
111
- }
112
- }
113
- if (!!(process.env.NODE_ENV !== "production") && !node) {
114
- warn$2("Hydration mismatch in ", insertionParent);
115
- }
116
- resetInsertionState();
117
- currentHydrationNode = node;
118
- }
119
-
120
- const NODE_EXT_STYLES = "styles";
121
- const NODE_EXT_PARENT_STYLES = "parentStyles";
122
- const NODE_EXT_CLASS_STYLE = "classStyle";
123
- const NODE_EXT_STYLE = "style";
124
- function setNodeExtraData(el, name, value) {
125
- el.ext.set(name, value);
126
- }
127
- function getNodeExtraData(el, name) {
128
- return el.ext.get(name);
129
- }
130
- function getExtraStyles(el) {
131
- return getNodeExtraData(el, NODE_EXT_STYLES);
132
- }
133
- function setExtraStyles(el, styles) {
134
- setNodeExtraData(el, NODE_EXT_STYLES, styles);
135
- }
136
- function getExtraParentStyles(el) {
137
- return getNodeExtraData(el, NODE_EXT_PARENT_STYLES);
138
- }
139
- function setExtraParentStyles(el, styles) {
140
- setNodeExtraData(el, NODE_EXT_PARENT_STYLES, styles);
141
- }
142
- function getExtraClassStyle(el) {
143
- return getNodeExtraData(el, NODE_EXT_CLASS_STYLE);
144
- }
145
- function setExtraClassStyle(el, classStyle) {
146
- setNodeExtraData(el, NODE_EXT_CLASS_STYLE, classStyle);
147
- }
148
- function getExtraStyle(el) {
149
- return getNodeExtraData(el, NODE_EXT_STYLE);
150
- }
151
- function setExtraStyle(el, style) {
152
- setNodeExtraData(el, NODE_EXT_STYLE, style);
153
- }
154
- function isCommentNode(node) {
155
- return node.nodeName == "#comment";
156
- }
157
-
158
- function each(obj) {
159
- return Object.keys(obj);
160
- }
161
- function useCssStyles(componentStyles) {
162
- const normalized = {};
163
- if (!isArray(componentStyles)) {
164
- return normalized;
165
- }
166
- componentStyles.forEach((componentStyle) => {
167
- each(componentStyle).forEach((className) => {
168
- const parentStyles = componentStyle[className];
169
- const normalizedStyles = normalized[className] || (normalized[className] = {});
170
- each(parentStyles).forEach((parentSelector) => {
171
- const parentStyle = parentStyles[parentSelector];
172
- const normalizedStyle = normalizedStyles[parentSelector] || (normalizedStyles[parentSelector] = {});
173
- each(parentStyle).forEach((name) => {
174
- if (name[0] === "!") {
175
- normalizedStyle[name] = parentStyle[name];
176
- delete normalizedStyle[name.slice(1)];
177
- } else {
178
- if (!hasOwn(normalizedStyle, "!" + name)) {
179
- normalizedStyle[name] = parentStyle[name];
180
- }
181
- }
182
- });
183
- });
184
- });
185
- });
186
- return normalized;
187
- }
188
- function hasClass(calssName, el) {
189
- const classList = el && el.classList;
190
- return classList && classList.includes(calssName);
191
- }
192
- const TYPE_RE = /[+~> ]$/;
193
- const PROPERTY_PARENT_NODE = "parentNode";
194
- const PROPERTY_PREVIOUS_SIBLING = "previousSibling";
195
- function isMatchParentSelector(parentSelector, el) {
196
- const classArray = parentSelector.split(".");
197
- for (let i = classArray.length - 1; i > 0; i--) {
198
- const item = classArray[i];
199
- const type = item[item.length - 1];
200
- const className = item.replace(TYPE_RE, "");
201
- if (type === "~" || type === " ") {
202
- const property = type === "~" ? PROPERTY_PREVIOUS_SIBLING : PROPERTY_PARENT_NODE;
203
- while (el) {
204
- el = el[property];
205
- if (hasClass(className, el)) {
206
- break;
207
- }
208
- }
209
- if (!el) {
210
- return false;
211
- }
212
- } else {
213
- if (type === ">") {
214
- el = el && el[PROPERTY_PARENT_NODE];
215
- } else if (type === "+") {
216
- el = el && el[PROPERTY_PREVIOUS_SIBLING];
217
- }
218
- if (!hasClass(className, el)) {
219
- return false;
220
- }
221
- }
222
- }
223
- return true;
224
- }
225
- const WEIGHT_IMPORTANT = 1e3;
226
- function parseClassName({ styles, weights }, parentStyles, el) {
227
- each(parentStyles).forEach((parentSelector) => {
228
- if (parentSelector && el) {
229
- if (!isMatchParentSelector(parentSelector, el)) {
230
- return;
231
- }
232
- }
233
- const classWeight = parentSelector.split(".").length;
234
- const style = parentStyles[parentSelector];
235
- each(style).forEach((name) => {
236
- const value = style[name];
237
- const isImportant = name[0] === "!";
238
- if (isImportant) {
239
- name = name.slice(1);
240
- }
241
- const oldWeight = weights[name] || 0;
242
- const weight = classWeight + (isImportant ? WEIGHT_IMPORTANT : 0);
243
- if (weight >= oldWeight) {
244
- weights[name] = weight;
245
- styles.set(name, value);
246
- }
247
- });
248
- });
249
- }
250
- class ParseStyleContext {
251
- constructor() {
252
- this.styles = /* @__PURE__ */ new Map();
253
- this.weights = {};
254
- }
255
- }
256
- function parseClassListWithStyleSheet(classList, stylesheet, parentStylesheets, el = null) {
257
- const context = new ParseStyleContext();
258
- classList.forEach((className) => {
259
- const parentStyles = stylesheet && stylesheet[className];
260
- if (parentStyles) {
261
- parseClassName(context, parentStyles, el);
262
- }
263
- });
264
- if (parentStylesheets != null) {
265
- classList.forEach((className) => {
266
- const parentStylesheet = (parentStylesheets || []).find(
267
- (style) => style[className] !== null
268
- );
269
- const parentStyles = parentStylesheet && parentStylesheet[className];
270
- if (parentStyles != null) {
271
- parseClassName(context, parentStyles, el);
272
- }
273
- });
274
- }
275
- return context;
276
- }
277
- function parseClassStyles(el) {
278
- const styles = getExtraStyles(el);
279
- const parentStyles = getExtraParentStyles(el);
280
- if (styles == null && parentStyles == null || el.classList.length == 0) {
281
- return new ParseStyleContext();
282
- }
283
- return parseClassListWithStyleSheet(el.classList, styles, parentStyles, el);
284
- }
285
- function parseStyleSheet({
286
- type,
287
- appContext,
288
- root
289
- }) {
290
- const component = type;
291
- const pageInstance = root;
292
- if (!pageInstance.componentStylesCache) {
293
- pageInstance.componentStylesCache = /* @__PURE__ */ new Map();
294
- }
295
- let cache = pageInstance.componentStylesCache.get(component);
296
- if (!cache) {
297
- const __globalStyles = appContext.provides.__globalStyles;
298
- if (appContext && isArray(__globalStyles)) {
299
- appContext.provides.__globalStyles = useCssStyles(__globalStyles);
300
- }
301
- const styles = [];
302
- if (appContext && __globalStyles) {
303
- const globalStyles = isArray(__globalStyles) ? __globalStyles : [__globalStyles];
304
- styles.push(...globalStyles);
305
- }
306
- const page = root && root.type;
307
- if (page && component !== page && isArray(page.styles)) {
308
- styles.push(...page.styles);
309
- }
310
- if (isArray(component.styles)) {
311
- styles.push(...component.styles);
312
- }
313
- cache = useCssStyles(styles);
314
- pageInstance.componentStylesCache.set(component, cache);
315
- }
316
- return cache;
317
- }
318
- function extendMap(a, b) {
319
- b.forEach((value, key) => {
320
- a.set(key, value);
321
- });
322
- return a;
323
- }
324
- function toStyle(el, classStyle, classStyleWeights) {
325
- const res = extendMap(/* @__PURE__ */ new Map(), classStyle);
326
- const style = getExtraStyle(el);
327
- if (style != null) {
328
- style.forEach((value, key) => {
329
- const weight = classStyleWeights[key];
330
- if (weight == null || weight < WEIGHT_IMPORTANT) {
331
- res.set(key, value);
332
- }
333
- });
334
- }
335
- return res;
336
- }
337
-
338
- const vShowHidden = Symbol("_vsh");
339
-
340
- function patchClass(el, pre, next, instance = null) {
341
- if (!instance) {
342
- return;
343
- }
344
- const classList = next ? next.split(" ") : [];
345
- el.classList = classList;
346
- setExtraStyles(el, parseStyleSheet(instance));
347
- if (instance.parent != null && instance !== instance.root) {
348
- const isRootEl = (
349
- // @ts-expect-error
350
- instance.block === el || instance.subTree && el === instance.subTree.el
351
- );
352
- if (isRootEl) {
353
- setExtraParentStyles(
354
- el,
355
- instance.parent.type.styles
356
- );
357
- }
358
- }
359
- updateClassStyles(el);
360
- }
361
- function updateClassStyles(el) {
362
- if (el.parentNode == null || isCommentNode(el)) {
363
- return;
364
- }
365
- if (getExtraClassStyle(el) == null) {
366
- setExtraClassStyle(el, /* @__PURE__ */ new Map());
367
- }
368
- const oldClassStyle = getExtraClassStyle(el);
369
- oldClassStyle.forEach((_value, key) => {
370
- oldClassStyle.set(key, "");
371
- });
372
- const parseClassStylesResult = parseClassStyles(el);
373
- parseClassStylesResult.styles.forEach((value, key) => {
374
- oldClassStyle.set(key, value);
375
- });
376
- const styles = toStyle(el, oldClassStyle, parseClassStylesResult.weights);
377
- if (styles.size == 0) {
378
- return;
379
- }
380
- if (el[vShowHidden]) {
381
- styles.set("display", "none");
382
- }
383
- el.updateStyle(styles);
384
- }
385
- function updateChildrenClassStyle(el) {
386
- if (el !== null) {
387
- el.childNodes.forEach((child) => {
388
- updateClassStyles(child);
389
- updateChildrenClassStyle(child);
390
- });
391
- }
392
- }
393
-
394
- class VaporFragment {
395
- constructor(nodes) {
396
- this.nodes = nodes;
397
- }
398
- }
399
- class DynamicFragment extends VaporFragment {
400
- // fixed by uts
401
- constructor(doc, anchorLabel) {
402
- super([]);
403
- this.anchor = doc.createComment(anchorLabel || "");
404
- }
405
- update(render, key = render) {
406
- if (key === this.current) {
407
- return;
408
- }
409
- this.current = key;
410
- const prevSub = setActiveSub();
411
- const parent = this.anchor.parentNode;
412
- if (this.scope) {
413
- this.scope.stop();
414
- parent && remove(this.nodes, parent);
415
- }
416
- if (render) {
417
- this.scope = new EffectScope();
418
- const start = Date.now();
419
- this.nodes = this.scope.run(render) || [];
420
- console.log("[VAPOR] dom create", Date.now() - start);
421
- const start2 = Date.now();
422
- if (parent) insert(this.nodes, parent, this.anchor);
423
- console.log("[VAPOR] dom insert", Date.now() - start2);
424
- console.log("[VAPOR] dom all", Date.now() - start);
425
- } else {
426
- this.scope = void 0;
427
- this.nodes = [];
428
- }
429
- if (this.fallback && !isValidBlock(this.nodes)) {
430
- parent && remove(this.nodes, parent);
431
- this.nodes = (this.scope || (this.scope = new EffectScope())).run(this.fallback) || [];
432
- parent && insert(this.nodes, parent, this.anchor);
433
- }
434
- setActiveSub(prevSub);
435
- }
436
- }
437
- function isFragment(val) {
438
- return val instanceof VaporFragment;
439
- }
440
- function isBlock(val) {
441
- return val instanceof Node || isArray(val) || isVaporComponent(val) || isFragment(val);
442
- }
443
- function isValidBlock(block) {
444
- if (block instanceof Node) {
445
- return !(block instanceof Comment);
446
- } else if (isVaporComponent(block)) {
447
- return isValidBlock(block.block);
448
- } else if (isArray(block)) {
449
- return block.length > 0 && block.every(isValidBlock);
450
- } else {
451
- return isValidBlock(block.nodes);
452
- }
453
- }
454
- function insert(block, parent, anchor = null) {
455
- anchor = anchor === 0 ? parent.firstChild : anchor;
456
- if (block instanceof Node) {
457
- if (!isHydrating) {
458
- parent.insertBefore(block, anchor);
459
- if (parent.isConnected) {
460
- updateClassStyles(block);
461
- updateChildrenClassStyle(block);
462
- }
463
- }
464
- } else if (isVaporComponent(block)) {
465
- if (block.isMounted) {
466
- insert(block.block, parent, anchor);
467
- } else {
468
- mountComponent(block, parent, anchor);
469
- }
470
- } else if (isArray(block)) {
471
- for (const b of block) {
472
- insert(b, parent, anchor);
473
- }
474
- } else {
475
- if (block.insert) {
476
- block.insert(parent, anchor);
477
- } else {
478
- insert(block.nodes, parent, anchor);
479
- }
480
- if (block.anchor) insert(block.anchor, parent, anchor);
481
- }
482
- }
483
- function prepend(parent, ...blocks) {
484
- let i = blocks.length;
485
- while (i--) insert(blocks[i], parent, 0);
486
- }
487
- function remove(block, parent) {
488
- if (block instanceof Node) {
489
- parent && parent.removeChild(block);
490
- } else if (isVaporComponent(block)) {
491
- unmountComponent(block, parent);
492
- } else if (isArray(block)) {
493
- for (let i = 0; i < block.length; i++) {
494
- remove(block[i], parent);
495
- }
496
- } else {
497
- if (block.remove) {
498
- block.remove(parent);
499
- } else {
500
- remove(block.nodes, parent);
501
- }
502
- if (block.anchor) remove(block.anchor, parent);
503
- if (block.scope) {
504
- block.scope.stop();
505
- }
506
- }
507
- }
508
- function normalizeBlock(block) {
509
- if (!!!(process.env.NODE_ENV !== "production") && true) {
510
- throw new Error(
511
- "normalizeBlock should not be used in production code paths"
512
- );
513
- }
514
- const nodes = [];
515
- if (block instanceof Node) {
516
- nodes.push(block);
517
- } else if (isArray(block)) {
518
- block.forEach((child) => nodes.push(...normalizeBlock(child)));
519
- } else if (isVaporComponent(block)) {
520
- nodes.push(...normalizeBlock(block.block));
521
- } else {
522
- nodes.push(...normalizeBlock(block.nodes));
523
- block.anchor && nodes.push(block.anchor);
524
- }
525
- return nodes;
526
- }
527
-
528
- class RenderEffect extends ReactiveEffect {
529
- constructor(render) {
530
- super();
531
- this.render = render;
532
- const instance = currentInstance$1;
533
- if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
534
- warn$2("renderEffect called without active EffectScope or Vapor instance.");
535
- }
536
- const job = () => {
537
- if (this.dirty) {
538
- this.run();
539
- }
540
- };
541
- this.updateJob = () => {
542
- instance.isUpdating = false;
543
- instance.u && invokeArrayFns(instance.u);
544
- };
545
- if (instance) {
546
- if (!!(process.env.NODE_ENV !== "production")) {
547
- this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
548
- this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
549
- }
550
- job.i = instance;
551
- }
552
- this.job = job;
553
- this.i = instance;
554
- }
555
- fn() {
556
- const instance = this.i;
557
- const scope = this.subs ? this.subs.sub : void 0;
558
- const hasUpdateHooks = instance && (instance.bu || instance.u);
559
- if (!!(process.env.NODE_ENV !== "production") && instance) {
560
- startMeasure(instance, `renderEffect`);
561
- }
562
- const prev = setCurrentInstance(instance, scope);
563
- if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
564
- instance.isUpdating = true;
565
- instance.bu && invokeArrayFns(instance.bu);
566
- this.render();
567
- queuePostFlushCb(this.updateJob);
568
- } else {
569
- this.render();
570
- }
571
- setCurrentInstance(...prev);
572
- if (!!(process.env.NODE_ENV !== "production") && instance) {
573
- startMeasure(instance, `renderEffect`);
574
- }
575
- }
576
- notify() {
577
- const flags = this.flags;
578
- if (!(flags & 256)) {
579
- queueJob(this.job, this.i ? this.i.uid : void 0);
580
- }
581
- }
582
- }
583
- function renderEffect(fn, noLifecycle = false) {
584
- const effect = new RenderEffect(fn);
585
- if (noLifecycle) {
586
- effect.fn = fn;
587
- }
588
- effect.run();
589
- }
590
-
591
- const stack = [];
592
- function pushWarningContext(ctx) {
593
- stack.push(ctx);
594
- }
595
- function popWarningContext() {
596
- stack.pop();
597
- }
598
- let isWarning = false;
599
- function warn$1(msg, ...args) {
600
- if (isWarning) return;
601
- isWarning = true;
602
- const prevSub = setActiveSub();
603
- const entry = stack.length ? stack[stack.length - 1] : null;
604
- const instance = isVNode(entry) ? entry.component : entry;
605
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
606
- const trace = getComponentTrace();
607
- if (appWarnHandler) {
608
- callWithErrorHandling(
609
- appWarnHandler,
610
- instance,
611
- 11,
612
- [
613
- // eslint-disable-next-line no-restricted-syntax
614
- msg + args.map((a) => {
615
- var _a, _b;
616
- return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
617
- }).join(""),
618
- instance && instance.proxy || instance,
619
- trace.map(
620
- ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
621
- ).join("\n"),
622
- trace
623
- ]
624
- );
625
- } else {
626
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
627
- if (trace.length && // avoid spamming console during tests
628
- true) {
629
- warnArgs.push(`
630
- `, ...formatTrace(trace));
631
- }
632
- console.warn(...warnArgs);
633
- }
634
- setActiveSub(prevSub);
635
- isWarning = false;
636
- }
637
- function getComponentTrace() {
638
- let currentCtx = stack[stack.length - 1];
639
- if (!currentCtx) {
640
- return [];
641
- }
642
- const normalizedStack = [];
643
- while (currentCtx) {
644
- const last = normalizedStack[0];
645
- if (last && last.ctx === currentCtx) {
646
- last.recurseCount++;
647
- } else {
648
- normalizedStack.push({
649
- ctx: currentCtx,
650
- recurseCount: 0
651
- });
652
- }
653
- if (isVNode(currentCtx)) {
654
- const parent = currentCtx.component && currentCtx.component.parent;
655
- currentCtx = parent && parent.vnode || parent;
656
- } else {
657
- currentCtx = currentCtx.parent;
658
- }
659
- }
660
- return normalizedStack;
661
- }
662
- function formatTrace(trace) {
663
- const logs = [];
664
- trace.forEach((entry, i) => {
665
- logs.push(...i === 0 ? [] : [`
666
- `], ...formatTraceEntry(entry));
667
- });
668
- return logs;
669
- }
670
- function formatTraceEntry({ ctx, recurseCount }) {
671
- const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
672
- const instance = isVNode(ctx) ? ctx.component : ctx;
673
- const isRoot = instance ? instance.parent == null : false;
674
- const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
675
- const close = `>` + postfix;
676
- return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
677
- }
678
- function formatProps(props) {
679
- const res = [];
680
- const keys = Object.keys(props);
681
- keys.slice(0, 3).forEach((key) => {
682
- res.push(...formatProp(key, props[key]));
683
- });
684
- if (keys.length > 3) {
685
- res.push(` ...`);
686
- }
687
- return res;
688
- }
689
- function formatProp(key, value, raw) {
690
- if (isString(value)) {
691
- value = JSON.stringify(value);
692
- return raw ? value : [`${key}=${value}`];
693
- } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
694
- return raw ? value : [`${key}=${value}`];
695
- } else if (isRef(value)) {
696
- value = formatProp(key, toRaw(value.value), true);
697
- return raw ? value : [`${key}=Ref<`, value, `>`];
698
- } else if (isFunction(value)) {
699
- return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
700
- } else {
701
- value = toRaw(value);
702
- return raw ? value : [`${key}=`, value];
703
- }
704
- }
705
-
706
- const ErrorTypeStrings = {
707
- ["sp"]: "serverPrefetch hook",
708
- ["bc"]: "beforeCreate hook",
709
- ["c"]: "created hook",
710
- ["bm"]: "beforeMount hook",
711
- ["m"]: "mounted hook",
712
- ["bu"]: "beforeUpdate hook",
713
- ["u"]: "updated",
714
- ["bum"]: "beforeUnmount hook",
715
- ["um"]: "unmounted hook",
716
- ["a"]: "activated hook",
717
- ["da"]: "deactivated hook",
718
- ["ec"]: "errorCaptured hook",
719
- ["rtc"]: "renderTracked hook",
720
- ["rtg"]: "renderTriggered hook",
721
- [0]: "setup function",
722
- [1]: "render function",
723
- [2]: "watcher getter",
724
- [3]: "watcher callback",
725
- [4]: "watcher cleanup function",
726
- [5]: "native event handler",
727
- [6]: "component event handler",
728
- [7]: "vnode hook",
729
- [8]: "directive hook",
730
- [9]: "transition hook",
731
- [10]: "app errorHandler",
732
- [11]: "app warnHandler",
733
- [12]: "ref function",
734
- [13]: "async component loader",
735
- [14]: "scheduler flush",
736
- [15]: "component update",
737
- [16]: "app unmount cleanup function"
738
- };
739
- function callWithErrorHandling(fn, instance, type, args) {
740
- try {
741
- return args ? fn(...args) : fn();
742
- } catch (err) {
743
- handleError(err, instance, type);
744
- }
745
- }
746
- function handleError(err, instance, type, throwInDev = true) {
747
- const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
748
- if (instance) {
749
- let cur = instance.parent;
750
- const exposedInstance = instance.proxy || instance;
751
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] || type : `https://vuejs.org/error-reference/#runtime-${type}`;
752
- while (cur) {
753
- const errorCapturedHooks = cur.ec;
754
- if (errorCapturedHooks) {
755
- for (let i = 0; i < errorCapturedHooks.length; i++) {
756
- if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
757
- return;
758
- }
759
- }
760
- }
761
- cur = cur.parent;
762
- }
763
- if (errorHandler) {
764
- const prevSub = setActiveSub();
765
- callWithErrorHandling(errorHandler, null, 10, [
766
- err,
767
- exposedInstance,
768
- errorInfo
769
- ]);
770
- setActiveSub(prevSub);
771
- return;
772
- }
773
- }
774
- logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
775
- }
776
- function logError(err, type, instance, throwInDev = true, throwInProd = false) {
777
- if (!!(process.env.NODE_ENV !== "production")) {
778
- const info = ErrorTypeStrings[type] || type;
779
- if (instance) {
780
- pushWarningContext(instance);
781
- }
782
- warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
783
- if (instance) {
784
- popWarningContext();
785
- }
786
- if (err instanceof Error) {
787
- console.error(
788
- `---BEGIN:EXCEPTION---${err.message}
789
- ${err.stack || ""}---END:EXCEPTION---`
790
- );
791
- } else {
792
- console.error(err);
793
- }
794
- } else if (throwInProd) {
795
- throw err;
796
- } else {
797
- console.error(err);
798
- }
799
- }
800
-
801
- let devtools;
802
- let buffer = [];
803
- function setDevtoolsHook(hook, target) {
804
- var _a, _b;
805
- devtools = hook;
806
- if (devtools) {
807
- devtools.enabled = true;
808
- buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
809
- buffer = [];
810
- } else if (
811
- // handle late devtools injection - only do this if we are in an actual
812
- // browser environment to avoid the timer handle stalling test runner exit
813
- // (#4815)
814
- typeof window !== "undefined" && // some envs mock window but not fully
815
- window.HTMLElement && // also exclude jsdom
816
- // eslint-disable-next-line no-restricted-syntax
817
- !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
818
- ) {
819
- const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
820
- replay.push((newHook) => {
821
- setDevtoolsHook(newHook, target);
822
- });
823
- setTimeout(() => {
824
- if (!devtools) {
825
- target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
826
- buffer = [];
827
- }
828
- }, 3e3);
829
- } else {
830
- buffer = [];
831
- }
832
- }
833
-
834
- let currentRenderingInstance = null;
835
- let currentScopeId = null;
836
-
837
- const isTeleport = (type) => type.__isTeleport;
838
-
839
- function setTransitionHooks(vnode, hooks) {
840
- if (vnode.shapeFlag & 6 && vnode.component) {
841
- vnode.transition = hooks;
842
- setTransitionHooks(vnode.component.subTree, hooks);
843
- } else if (vnode.shapeFlag & 128) {
844
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
845
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
846
- } else {
847
- vnode.transition = hooks;
848
- }
849
- }
850
-
851
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
852
-
853
- const internalObjectProto = {};
854
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
855
-
856
- const isSuspense = (type) => type.__isSuspense;
857
-
858
- const Fragment = Symbol.for("v-fgt");
859
- const Text = Symbol.for("v-txt");
860
- const Comment$1 = Symbol.for("v-cmt");
861
- function isVNode(value) {
862
- return value ? value.__v_isVNode === true : false;
863
- }
864
- const createVNodeWithArgsTransform = (...args) => {
865
- return _createVNode(
866
- ...args
867
- );
868
- };
869
- const normalizeKey = ({ key }) => key != null ? key : null;
870
- const normalizeRef = ({
871
- ref,
872
- ref_key,
873
- ref_for
874
- }) => {
875
- if (typeof ref === "number") {
876
- ref = "" + ref;
877
- }
878
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
879
- };
880
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
881
- const vnode = {
882
- __v_isVNode: true,
883
- __v_skip: true,
884
- type,
885
- props,
886
- key: props && normalizeKey(props),
887
- ref: props && normalizeRef(props),
888
- scopeId: currentScopeId,
889
- slotScopeIds: null,
890
- children,
891
- component: null,
892
- suspense: null,
893
- ssContent: null,
894
- ssFallback: null,
895
- dirs: null,
896
- transition: null,
897
- el: null,
898
- anchor: null,
899
- target: null,
900
- targetStart: null,
901
- targetAnchor: null,
902
- staticCount: 0,
903
- shapeFlag,
904
- patchFlag,
905
- dynamicProps,
906
- dynamicChildren: null,
907
- appContext: null,
908
- ctx: currentRenderingInstance,
909
- // fixed by xxxxxx
910
- hostInstance: currentRenderingInstance
911
- };
912
- if (needFullChildrenNormalization) {
913
- normalizeChildren(vnode, children);
914
- if (shapeFlag & 128) {
915
- type.normalize(vnode);
916
- }
917
- } else if (children) {
918
- vnode.shapeFlag |= isString(children) ? 8 : 16;
919
- }
920
- if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
921
- warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
922
- }
923
- if (type == "button") {
924
- if (vnode.props == null) vnode.props = {};
925
- if (!vnode.props["hoverClass"] && !vnode.props["hover-class"]) {
926
- vnode.props["hoverClass"] = "button-hover";
927
- }
928
- }
929
- return vnode;
930
- }
931
- const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
932
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
933
- if (!type || type === NULL_DYNAMIC_COMPONENT) {
934
- if (!!(process.env.NODE_ENV !== "production") && !type) {
935
- warn$1(`Invalid vnode type when creating vnode: ${type}.`);
936
- }
937
- type = Comment$1;
938
- }
939
- if (isVNode(type)) {
940
- const cloned = cloneVNode(
941
- type,
942
- props,
943
- true
944
- /* mergeRef: true */
945
- );
946
- if (children) {
947
- normalizeChildren(cloned, children);
948
- }
949
- cloned.patchFlag = -2;
950
- return cloned;
951
- }
952
- if (isClassComponent(type)) {
953
- type = type.__vccOpts;
954
- }
955
- if (props) {
956
- props = guardReactiveProps(props);
957
- let { class: klass, style } = props;
958
- if (klass && !isString(klass)) {
959
- props.class = normalizeClass(klass);
960
- }
961
- if (isObject(style)) {
962
- if (isProxy(style) && !isArray(style)) {
963
- style = extend({}, style);
964
- }
965
- props.style = normalizeStyle$1(style);
966
- }
967
- }
968
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
969
- if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
970
- type = toRaw(type);
971
- warn$1(
972
- `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
973
- `
974
- Component that was made reactive: `,
975
- type
976
- );
977
- }
978
- return createBaseVNode(
979
- type,
980
- props,
981
- children,
982
- patchFlag,
983
- dynamicProps,
984
- shapeFlag,
985
- isBlockNode,
986
- true
987
- );
988
- }
989
- function guardReactiveProps(props) {
990
- if (!props) return null;
991
- return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
992
- }
993
- function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
994
- const { props, ref, patchFlag, children, transition } = vnode;
995
- const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
996
- const cloned = {
997
- __v_isVNode: true,
998
- __v_skip: true,
999
- type: vnode.type,
1000
- props: mergedProps,
1001
- key: mergedProps && normalizeKey(mergedProps),
1002
- ref: extraProps && extraProps.ref ? (
1003
- // #2078 in the case of <component :is="vnode" ref="extra"/>
1004
- // if the vnode itself already has a ref, cloneVNode will need to merge
1005
- // the refs so the single vnode can be set on multiple refs
1006
- mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
1007
- ) : ref,
1008
- scopeId: vnode.scopeId,
1009
- slotScopeIds: vnode.slotScopeIds,
1010
- children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
1011
- target: vnode.target,
1012
- targetStart: vnode.targetStart,
1013
- targetAnchor: vnode.targetAnchor,
1014
- staticCount: vnode.staticCount,
1015
- shapeFlag: vnode.shapeFlag,
1016
- // if the vnode is cloned with extra props, we can no longer assume its
1017
- // existing patch flag to be reliable and need to add the FULL_PROPS flag.
1018
- // note: preserve flag for fragments since they use the flag for children
1019
- // fast paths only.
1020
- patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
1021
- dynamicProps: vnode.dynamicProps,
1022
- dynamicChildren: vnode.dynamicChildren,
1023
- appContext: vnode.appContext,
1024
- // fixed by xxxxxx
1025
- hostInstance: vnode.hostInstance,
1026
- dirs: vnode.dirs,
1027
- transition,
1028
- // These should technically only be non-null on mounted VNodes. However,
1029
- // they *should* be copied for kept-alive vnodes. So we just always copy
1030
- // them since them being non-null during a mount doesn't affect the logic as
1031
- // they will simply be overwritten.
1032
- component: vnode.component,
1033
- suspense: vnode.suspense,
1034
- ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
1035
- ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
1036
- el: vnode.el,
1037
- anchor: vnode.anchor,
1038
- ctx: vnode.ctx,
1039
- ce: vnode.ce
1040
- };
1041
- if (transition && cloneTransition) {
1042
- setTransitionHooks(
1043
- cloned,
1044
- transition.clone(cloned)
1045
- );
1046
- }
1047
- return cloned;
1048
- }
1049
- function deepCloneVNode(vnode) {
1050
- const cloned = cloneVNode(vnode);
1051
- if (isArray(vnode.children)) {
1052
- cloned.children = vnode.children.map(deepCloneVNode);
1053
- }
1054
- return cloned;
1055
- }
1056
- function createTextVNode(text = " ", flag = 0) {
1057
- return createVNode(Text, null, text, flag);
1058
- }
1059
- function normalizeChildren(vnode, children) {
1060
- let type = 0;
1061
- const { shapeFlag } = vnode;
1062
- if (children == null) {
1063
- children = null;
1064
- } else if (isArray(children)) {
1065
- type = 16;
1066
- } else if (typeof children === "object") {
1067
- if (shapeFlag & (1 | 64)) {
1068
- const slot = children.default;
1069
- if (slot) {
1070
- slot._c && (slot._d = false);
1071
- normalizeChildren(vnode, slot());
1072
- slot._c && (slot._d = true);
1073
- }
1074
- return;
1075
- } else {
1076
- type = 32;
1077
- const slotFlag = children._;
1078
- if (!slotFlag && !isInternalObject(children)) {
1079
- children._ctx = currentRenderingInstance;
1080
- }
1081
- }
1082
- } else if (isFunction(children)) {
1083
- children = { default: children, _ctx: currentRenderingInstance };
1084
- type = 32;
1085
- } else {
1086
- children = String(children);
1087
- if (shapeFlag & 64) {
1088
- type = 16;
1089
- children = [createTextVNode(children)];
1090
- } else {
1091
- type = 8;
1092
- }
1093
- }
1094
- vnode.children = children;
1095
- vnode.shapeFlag |= type;
1096
- }
1097
- function mergeProps(...args) {
1098
- const ret = {};
1099
- for (let i = 0; i < args.length; i++) {
1100
- const toMerge = args[i];
1101
- for (const key in toMerge) {
1102
- if (key === "class") {
1103
- if (ret.class !== toMerge.class) {
1104
- ret.class = normalizeClass([ret.class, toMerge.class]);
1105
- }
1106
- } else if (key === "style") {
1107
- ret.style = normalizeStyle$1([ret.style, toMerge.style]);
1108
- } else if (isOn(key)) {
1109
- const existing = ret[key];
1110
- const incoming = toMerge[key];
1111
- if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
1112
- ret[key] = existing ? [].concat(existing, incoming) : incoming;
1113
- }
1114
- } else if (key !== "") {
1115
- ret[key] = toMerge[key];
1116
- }
1117
- }
1118
- }
1119
- return ret;
1120
- }
1121
-
1122
- let currentInstance = null;
1123
- const getCurrentGenericInstance = () => currentRenderingInstance;
1124
-
1125
- !!(process.env.NODE_ENV !== "production") ? {
1126
- } : {
1127
- };
1128
- const classifyRE = /(?:^|[-_])(\w)/g;
1129
- const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
1130
- function getComponentName(Component, includeInferred = true) {
1131
- return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
1132
- }
1133
- function formatComponentName(instance, Component, isRoot = false) {
1134
- let name = getComponentName(Component);
1135
- if (!name && Component.__file) {
1136
- const match = Component.__file.match(/([^/\\]+)\.\w+$/);
1137
- if (match) {
1138
- name = match[1];
1139
- }
1140
- }
1141
- if (!name && instance && instance.parent) {
1142
- const inferFromRegistry = (registry) => {
1143
- for (const key in registry) {
1144
- if (registry[key] === Component) {
1145
- return key;
1146
- }
1147
- }
1148
- };
1149
- name = inferFromRegistry(
1150
- instance.components || instance.parent.type.components
1151
- ) || inferFromRegistry(instance.appContext.components);
1152
- }
1153
- return name ? classify(name) : isRoot ? `App` : `Anonymous`;
1154
- }
1155
- function isClassComponent(value) {
1156
- return isFunction(value) && "__vccOpts" in value;
1157
- }
1158
-
1159
- const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
1160
- !!(process.env.NODE_ENV !== "production") || true ? devtools : void 0;
1161
- !!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook : NOOP;
1162
-
1163
- function addEventListener(el, event, handler, options) {
1164
- el.addEventListener(event, handler);
1165
- return () => el.removeEventListener(event, handler);
1166
- }
1167
- function on(el, event, handler, options = {}) {
1168
- addEventListener(el, event, handler);
1169
- if (options.effect) {
1170
- onEffectCleanup(() => {
1171
- el.removeEventListener(event, handler);
1172
- });
1173
- }
1174
- }
1175
- function delegate(el, event, handler) {
1176
- const key = `$evt${event}`;
1177
- const existing = el[key];
1178
- if (existing) {
1179
- if (isArray(existing)) {
1180
- existing.push(handler);
1181
- } else {
1182
- el[key] = [existing, handler];
1183
- }
1184
- } else {
1185
- el[key] = handler;
1186
- }
1187
- }
1188
- const delegatedEvents = /* @__PURE__ */ Object.create(null);
1189
- const delegateEvents = (doc, ...names) => {
1190
- for (const name of names) {
1191
- if (!delegatedEvents[name]) {
1192
- delegatedEvents[name] = true;
1193
- doc.addEventListener(name, delegatedEventHandler);
1194
- }
1195
- }
1196
- };
1197
- const delegatedEventHandler = (e) => {
1198
- let node = e.target;
1199
- if (e.target !== node) {
1200
- Object.defineProperty(e, "target", {
1201
- configurable: true,
1202
- value: node
1203
- });
1204
- }
1205
- Object.defineProperty(e, "currentTarget", {
1206
- configurable: true,
1207
- get() {
1208
- return node || document;
1209
- }
1210
- });
1211
- while (node !== null) {
1212
- const handlers = node[`$evt${e.type}`];
1213
- if (handlers) {
1214
- if (isArray(handlers)) {
1215
- for (const handler of handlers) {
1216
- if (!node.disabled) {
1217
- handler(e);
1218
- }
1219
- }
1220
- } else {
1221
- handlers(e);
1222
- }
1223
- }
1224
- node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
1225
- }
1226
- };
1227
- function setDynamicEvents(el, events) {
1228
- for (const name in events) {
1229
- on(el, name, events[name], { effect: true });
1230
- }
1231
- }
1232
-
1233
- const processDeclaration = expand({ type: "uvue" }).Declaration;
1234
- function createDeclaration(prop, value) {
1235
- const newValue = value + "";
1236
- if (newValue.includes("!important")) {
1237
- return {
1238
- prop,
1239
- value: newValue.replace(/\s*!important/, ""),
1240
- important: true
1241
- };
1242
- }
1243
- return {
1244
- prop,
1245
- value: newValue,
1246
- important: false
1247
- };
1248
- }
1249
- function normalizeStyle(name, value) {
1250
- const decl = Object.assign(
1251
- {},
1252
- {
1253
- replaceWith(newProps) {
1254
- props = newProps;
1255
- }
1256
- },
1257
- createDeclaration(name, value)
1258
- );
1259
- let props = [decl];
1260
- processDeclaration(decl);
1261
- return props;
1262
- }
1263
- function setStyle$1(expandRes) {
1264
- const resArr = expandRes.map((item) => {
1265
- return [item.prop, item.value];
1266
- });
1267
- const resMap = new Map(resArr);
1268
- return resMap;
1269
- }
1270
- function parseStyleDecl(prop, value) {
1271
- const val = normalizeStyle(prop, value);
1272
- const res = setStyle$1(val);
1273
- return res;
1274
- }
1275
-
1276
- function isSame(a, b) {
1277
- return isString(a) && isString(b) || typeof a === "number" && typeof b === "number" ? a == b : a === b;
1278
- }
1279
- function patchStyle(el, prev, next) {
1280
- if (!next) {
1281
- return;
1282
- }
1283
- if (isString(next)) {
1284
- next = parseStringStyle(next);
1285
- }
1286
- const batchedStyles = /* @__PURE__ */ new Map();
1287
- const isPrevObj = prev && !isString(prev);
1288
- if (isPrevObj) {
1289
- const classStyle = getExtraClassStyle(el);
1290
- const style = getExtraStyle(el);
1291
- for (const key in prev) {
1292
- if (next[key] == null) {
1293
- const _key = key.startsWith("--") ? key : camelize(key);
1294
- const value = classStyle != null && classStyle.has(_key) ? classStyle.get(_key) : "";
1295
- parseStyleDecl(_key, value).forEach((value2, key2) => {
1296
- batchedStyles.set(key2, value2);
1297
- style && style.delete(key2);
1298
- });
1299
- }
1300
- }
1301
- for (const key in next) {
1302
- const value = next[key];
1303
- const prevValue = prev[key];
1304
- if (!isSame(prevValue, value)) {
1305
- const _key = key.startsWith("--") ? key : camelize(key);
1306
- parseStyleDecl(_key, value).forEach((value2, key2) => {
1307
- batchedStyles.set(key2, value2);
1308
- style && style.set(key2, value2);
1309
- });
1310
- }
1311
- }
1312
- } else {
1313
- for (const key in next) {
1314
- const value = next[key];
1315
- const _key = key.startsWith("--") ? key : camelize(key);
1316
- setBatchedStyles(batchedStyles, _key, value);
1317
- }
1318
- setExtraStyle(el, batchedStyles);
1319
- }
1320
- if (batchedStyles.size == 0) {
1321
- return;
1322
- }
1323
- if (el[vShowHidden]) {
1324
- batchedStyles.set("display", "none");
1325
- }
1326
- el.updateStyle(batchedStyles);
1327
- }
1328
- function setBatchedStyles(batchedStyles, key, value) {
1329
- parseStyleDecl(key, value).forEach((value2, key2) => {
1330
- batchedStyles.set(key2, value2);
1331
- });
1332
- }
1333
-
1334
- function shouldSetAsProp(el, key, value, isSVG) {
1335
- return false;
1336
- }
1337
-
1338
- const hasFallthroughKey = (key) => currentInstance.hasFallthrough && key in currentInstance.attrs;
1339
- function setProp(el, key, value) {
1340
- if (key in el) {
1341
- setDOMProp(el, key, value);
1342
- } else {
1343
- setAttr(el, key, value);
1344
- }
1345
- }
1346
- function setAttr(el, key, value) {
1347
- if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
1348
- return;
1349
- }
1350
- if (key === "true-value") {
1351
- el._trueValue = value;
1352
- } else if (key === "false-value") {
1353
- el._falseValue = value;
1354
- }
1355
- if (value !== el[`$${key}`]) {
1356
- el[`$${key}`] = value;
1357
- if (value != null) {
1358
- el.setAttribute(key, value);
1359
- } else {
1360
- el.removeAttribute(key);
1361
- }
1362
- }
1363
- }
1364
- function setDOMProp(el, key, value) {
1365
- if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
1366
- return;
1367
- }
1368
- const prev = el[key];
1369
- if (value === prev) {
1370
- return;
1371
- }
1372
- let needRemove = false;
1373
- if (value === "" || value == null) {
1374
- const type = typeof prev;
1375
- if (value == null && type === "string") {
1376
- value = "";
1377
- needRemove = true;
1378
- } else if (type === "number") {
1379
- value = 0;
1380
- needRemove = true;
1381
- }
1382
- }
1383
- try {
1384
- el[key] = value;
1385
- } catch (e) {
1386
- if (!!(process.env.NODE_ENV !== "production") && !needRemove) {
1387
- warn(
1388
- `Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: value ${value} is invalid.`,
1389
- e
1390
- );
1391
- }
1392
- }
1393
- needRemove && el.removeAttribute(key);
1394
- }
1395
- function setClass(el, value) {
1396
- patchClass(el, null, normalizeClass(value), getCurrentGenericInstance());
1397
- }
1398
- function setStyle(el, value) {
1399
- if (el.$root) {
1400
- setStyleIncremental(el, value);
1401
- } else {
1402
- const prev = el.$sty;
1403
- value = el.$sty = normalizeStyle$1(value);
1404
- patchStyle(el, prev, value);
1405
- }
1406
- }
1407
- function setStyleIncremental(el, value) {
1408
- const cacheKey = `$styi${isApplyingFallthroughProps ? "$" : ""}`;
1409
- const prev = el[cacheKey];
1410
- value = el[cacheKey] = isString(value) ? parseStringStyle(value) : normalizeStyle$1(value);
1411
- patchStyle(el, prev, value);
1412
- return value;
1413
- }
1414
- function setValue(el, value) {
1415
- if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
1416
- return;
1417
- }
1418
- el._value = value;
1419
- const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
1420
- const newValue = value == null ? "" : value;
1421
- if (oldValue !== newValue) {
1422
- el.value = newValue;
1423
- }
1424
- if (value == null) {
1425
- el.removeAttribute("value");
1426
- }
1427
- }
1428
- function setText(el, value) {
1429
- if (el.$txt !== value) {
1430
- el.setAttribute("value", el.$txt = value);
1431
- }
1432
- }
1433
- function setElementText(el, value) {
1434
- if (el.$txt !== (value = toDisplayString(value))) {
1435
- el.setAttribute("value", el.$txt = value);
1436
- }
1437
- }
1438
- function setHtml(el, value) {
1439
- value = value == null ? "" : value;
1440
- if (el.$html !== value) ;
1441
- }
1442
- function setDynamicProps(el, args) {
1443
- const props = args.length > 1 ? mergeProps(...args) : args[0];
1444
- const cacheKey = `$dprops${isApplyingFallthroughProps ? "$" : ""}`;
1445
- const prevKeys = el[cacheKey];
1446
- if (prevKeys) {
1447
- for (const key of prevKeys) {
1448
- if (!(key in props)) {
1449
- setDynamicProp(el, key, null);
1450
- }
1451
- }
1452
- }
1453
- for (const key of el[cacheKey] = Object.keys(props)) {
1454
- setDynamicProp(el, key, props[key]);
1455
- }
1456
- }
1457
- function setDynamicProp(el, key, value) {
1458
- if (key === "class") {
1459
- setClass(el, value);
1460
- } else if (key === "style") {
1461
- setStyle(el, value);
1462
- } else if (isOn(key)) {
1463
- on(el, key[2].toLowerCase() + key.slice(3), value, { effect: true });
1464
- } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp()) {
1465
- if (key === "innerHTML") {
1466
- setHtml(el, value);
1467
- } else if (key === "textContent") {
1468
- setElementText(el, value);
1469
- } else if (key === "value" && canSetValueDirectly(el.tagName)) {
1470
- setValue(el, value);
1471
- } else {
1472
- setDOMProp(el, key, value);
1473
- }
1474
- } else {
1475
- setAttr(el, key, value);
1476
- }
1477
- return value;
1478
- }
1479
- let isOptimized = false;
1480
- function optimizePropertyLookup() {
1481
- if (isOptimized) return;
1482
- isOptimized = true;
1483
- const proto = UniElement.prototype;
1484
- proto.$evtclick = void 0;
1485
- proto.$root = false;
1486
- proto.$html = proto.$txt = proto.$cls = proto.$sty = "";
1487
- }
1488
-
1489
- const interopKey = Symbol(`interop`);
1490
- const vaporInteropImpl = {
1491
- mount(vnode, container, anchor, parentComponent) {
1492
- const selfAnchor = vnode.el = vnode.anchor = // fixed by uts 统一使用注释节点作为锚点,优化性能(因为注释节点不会进native层)
1493
- container.page.document.createComment("");
1494
- container.insertBefore(selfAnchor, anchor);
1495
- const prev = currentInstance$1;
1496
- simpleSetCurrentInstance(parentComponent);
1497
- const propsRef = shallowRef(vnode.props);
1498
- const slotsRef = shallowRef(vnode.children);
1499
- const dynamicPropSource = [
1500
- () => propsRef.value
1501
- ];
1502
- dynamicPropSource[interopKey] = true;
1503
- const instance = vnode.component = createComponent(
1504
- vnode.type,
1505
- {
1506
- $: dynamicPropSource
1507
- },
1508
- {
1509
- _: slotsRef
1510
- // pass the slots ref
1511
- }
1512
- );
1513
- instance.rawPropsRef = propsRef;
1514
- instance.rawSlotsRef = slotsRef;
1515
- mountComponent(instance, container, selfAnchor);
1516
- simpleSetCurrentInstance(prev);
1517
- return instance;
1518
- },
1519
- update(n1, n2, shouldUpdate) {
1520
- n2.component = n1.component;
1521
- n2.el = n2.anchor = n1.anchor;
1522
- if (shouldUpdate) {
1523
- const instance = n2.component;
1524
- instance.rawPropsRef.value = n2.props;
1525
- instance.rawSlotsRef.value = n2.children;
1526
- }
1527
- },
1528
- unmount(vnode, doRemove) {
1529
- const container = doRemove ? vnode.anchor.parentNode : void 0;
1530
- if (vnode.component) {
1531
- unmountComponent(vnode.component, container);
1532
- } else if (vnode.vb) {
1533
- remove(vnode.vb, container);
1534
- }
1535
- remove(vnode.anchor, container);
1536
- },
1537
- /**
1538
- * vapor slot in vdom
1539
- */
1540
- slot(n1, n2, container, anchor) {
1541
- if (!n1) {
1542
- const selfAnchor = n2.el = n2.anchor = // fixed by uts 统一使用注释节点作为锚点,优化性能(因为注释节点不会进native层)
1543
- container.page.document.createComment("");
1544
- insert(selfAnchor, container, anchor);
1545
- const { slot, fallback } = n2.vs;
1546
- const propsRef = n2.vs.ref = shallowRef(n2.props);
1547
- const slotBlock = slot(new Proxy(propsRef, vaporSlotPropsProxyHandler));
1548
- insert(n2.vb = slotBlock, container, selfAnchor);
1549
- } else {
1550
- n2.el = n2.anchor = n1.anchor;
1551
- n2.vb = n1.vb;
1552
- (n2.vs.ref = n1.vs.ref).value = n2.props;
1553
- }
1554
- },
1555
- move(vnode, container, anchor) {
1556
- insert(vnode.vb || vnode.component, container, anchor);
1557
- insert(vnode.anchor, container, anchor);
1558
- }
1559
- };
1560
- const vaporSlotPropsProxyHandler = {
1561
- get(target, key) {
1562
- return target.value[key];
1563
- },
1564
- has(target, key) {
1565
- return target.value[key];
1566
- },
1567
- ownKeys(target) {
1568
- return Object.keys(target.value);
1569
- }
1570
- };
1571
- const vaporSlotsProxyHandler = {
1572
- get(target, key) {
1573
- const slot = target[key];
1574
- if (isFunction(slot)) {
1575
- slot.__vapor = true;
1576
- }
1577
- return slot;
1578
- }
1579
- };
1580
- function createVDOMComponent(internals, component, rawProps, rawSlots) {
1581
- const frag = new VaporFragment([]);
1582
- const vnode = createVNode$1(
1583
- component,
1584
- // fixed by uts 临时方案,等待修复:https://github.com/vuejs/core/pull/13382
1585
- rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers))
1586
- );
1587
- const wrapper = new VaporComponentInstance(
1588
- { props: component.props },
1589
- rawProps,
1590
- rawSlots
1591
- );
1592
- vnode.vi = (instance) => {
1593
- instance.props = shallowReactive(wrapper.props);
1594
- const attrs = instance.attrs = createInternalObject();
1595
- for (const key in wrapper.attrs) {
1596
- if (!isEmitListener(instance.emitsOptions, key)) {
1597
- attrs[key] = wrapper.attrs[key];
1598
- }
1599
- }
1600
- instance.slots = wrapper.slots === EMPTY_OBJ ? EMPTY_OBJ : new Proxy(wrapper.slots, vaporSlotsProxyHandler);
1601
- };
1602
- let isMounted = false;
1603
- const parentInstance = currentInstance$1;
1604
- const unmount = (parentNode) => {
1605
- internals.umt(vnode.component, null, !!parentNode);
1606
- };
1607
- frag.insert = (parentNode, anchor) => {
1608
- if (!isMounted) {
1609
- internals.mt(
1610
- vnode,
1611
- parentNode,
1612
- anchor,
1613
- parentInstance,
1614
- null,
1615
- void 0,
1616
- false
1617
- );
1618
- onScopeDispose(unmount, true);
1619
- isMounted = true;
1620
- } else {
1621
- internals.m(
1622
- vnode,
1623
- parentNode,
1624
- anchor,
1625
- 2,
1626
- parentInstance
1627
- );
1628
- }
1629
- };
1630
- frag.remove = unmount;
1631
- return frag;
1632
- }
1633
- function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
1634
- const frag = new VaporFragment([]);
1635
- let isMounted = false;
1636
- let fallbackNodes;
1637
- let oldVNode = null;
1638
- frag.insert = (parentNode, anchor) => {
1639
- if (!isMounted) {
1640
- renderEffect(() => {
1641
- const vnode = renderSlot(
1642
- slotsRef.value,
1643
- isFunction(name) ? name() : name,
1644
- props
1645
- );
1646
- if (vnode.children.length) {
1647
- if (fallbackNodes) {
1648
- remove(fallbackNodes, parentNode);
1649
- fallbackNodes = void 0;
1650
- }
1651
- internals.p(
1652
- oldVNode,
1653
- vnode,
1654
- parentNode,
1655
- anchor,
1656
- parentComponent
1657
- );
1658
- oldVNode = vnode;
1659
- } else {
1660
- if (fallback && !fallbackNodes) {
1661
- if (oldVNode) {
1662
- internals.um(oldVNode, parentComponent, null, true);
1663
- }
1664
- insert(fallbackNodes = fallback(props), parentNode, anchor);
1665
- }
1666
- oldVNode = null;
1667
- }
1668
- });
1669
- isMounted = true;
1670
- } else {
1671
- internals.m(
1672
- oldVNode,
1673
- parentNode,
1674
- anchor,
1675
- 2,
1676
- parentComponent
1677
- );
1678
- }
1679
- frag.remove = (parentNode2) => {
1680
- if (fallbackNodes) {
1681
- remove(fallbackNodes, parentNode2);
1682
- } else if (oldVNode) {
1683
- internals.um(oldVNode, parentComponent, null);
1684
- }
1685
- };
1686
- };
1687
- return frag;
1688
- }
1689
- const vaporInteropPlugin = (app) => {
1690
- const internals = ensureRenderer().internals;
1691
- app._context.vapor = extend(vaporInteropImpl, {
1692
- vdomMount: createVDOMComponent.bind(null, internals),
1693
- vdomUnmount: internals.umt,
1694
- vdomSlot: renderVDOMSlot.bind(null, internals)
1695
- });
1696
- const mount = app.mount;
1697
- app.mount = (...args) => {
1698
- optimizePropertyLookup();
1699
- return mount(...args);
1700
- };
1701
- };
1702
-
1703
- function normalizeEmitsOptions(comp) {
1704
- const cached = comp.__emitsOptions;
1705
- if (cached) return cached;
1706
- const raw = comp.emits;
1707
- if (!raw) return null;
1708
- let normalized;
1709
- if (isArray(raw)) {
1710
- normalized = {};
1711
- for (const key of raw) normalized[key] = null;
1712
- } else {
1713
- normalized = raw;
1714
- }
1715
- return comp.__emitsOptions = normalized;
1716
- }
1717
- function emit(instance, event, ...rawArgs) {
1718
- baseEmit(
1719
- instance,
1720
- instance.rawProps || EMPTY_OBJ,
1721
- propGetter,
1722
- event,
1723
- ...rawArgs
1724
- );
1725
- }
1726
- function propGetter(rawProps, key) {
1727
- const dynamicSources = rawProps.$;
1728
- if (dynamicSources) {
1729
- let i = dynamicSources.length;
1730
- while (i--) {
1731
- const source = resolveSource(dynamicSources[i]);
1732
- if (hasOwn(source, key))
1733
- return dynamicSources[interopKey] ? source[key] : resolveSource(source[key]);
1734
- }
1735
- }
1736
- return rawProps[key] && resolveSource(rawProps[key]);
1737
- }
1738
-
1739
- function resolveSource(source) {
1740
- return isFunction(source) ? source() : source;
1741
- }
1742
- function getPropsProxyHandlers(comp) {
1743
- if (comp.__propsHandlers) {
1744
- return comp.__propsHandlers;
1745
- }
1746
- const propsOptions = normalizePropsOptions(comp)[0];
1747
- const emitsOptions = normalizeEmitsOptions(comp);
1748
- const isProp = propsOptions ? (key) => isString(key) && hasOwn(propsOptions, camelize(key)) : NO;
1749
- const isAttr = propsOptions ? (key) => key !== "$" && !isProp(key) && !isEmitListener(emitsOptions, key) : YES;
1750
- const getProp = (instance, key) => {
1751
- if (key === "__v_isReactive") return true;
1752
- if (!isProp(key)) return;
1753
- const rawProps = instance.rawProps;
1754
- const dynamicSources = rawProps.$;
1755
- if (dynamicSources) {
1756
- let i = dynamicSources.length;
1757
- let source, isDynamic, rawKey;
1758
- while (i--) {
1759
- source = dynamicSources[i];
1760
- isDynamic = isFunction(source);
1761
- source = isDynamic ? source() : source;
1762
- for (rawKey in source) {
1763
- if (camelize(rawKey) === key) {
1764
- return resolvePropValue(
1765
- propsOptions,
1766
- key,
1767
- isDynamic ? source[rawKey] : source[rawKey](),
1768
- instance,
1769
- resolveDefault
1770
- );
1771
- }
1772
- }
1773
- }
1774
- }
1775
- for (const rawKey in rawProps) {
1776
- if (camelize(rawKey) === key) {
1777
- return resolvePropValue(
1778
- propsOptions,
1779
- key,
1780
- rawProps[rawKey](),
1781
- instance,
1782
- resolveDefault
1783
- );
1784
- }
1785
- }
1786
- return resolvePropValue(
1787
- propsOptions,
1788
- key,
1789
- void 0,
1790
- instance,
1791
- resolveDefault,
1792
- true
1793
- );
1794
- };
1795
- const propsHandlers = propsOptions ? {
1796
- get: (target, key) => getProp(target, key),
1797
- has: (_, key) => isProp(key),
1798
- ownKeys: () => Object.keys(propsOptions),
1799
- getOwnPropertyDescriptor(target, key) {
1800
- if (isProp(key)) {
1801
- return {
1802
- configurable: true,
1803
- enumerable: true,
1804
- get: () => getProp(target, key)
1805
- };
1806
- }
1807
- }
1808
- } : null;
1809
- if (!!(process.env.NODE_ENV !== "production") && propsOptions) {
1810
- Object.assign(propsHandlers, {
1811
- set: propsSetDevTrap,
1812
- deleteProperty: propsDeleteDevTrap
1813
- });
1814
- }
1815
- const getAttr = (target, key) => {
1816
- if (!isProp(key) && !isEmitListener(emitsOptions, key)) {
1817
- return getAttrFromRawProps(target, key);
1818
- }
1819
- };
1820
- const hasAttr = (target, key) => {
1821
- if (isAttr(key)) {
1822
- return hasAttrFromRawProps(target, key);
1823
- } else {
1824
- return false;
1825
- }
1826
- };
1827
- const attrsHandlers = {
1828
- get: (target, key) => getAttr(target.rawProps, key),
1829
- has: (target, key) => hasAttr(target.rawProps, key),
1830
- ownKeys: (target) => getKeysFromRawProps(target.rawProps).filter(isAttr),
1831
- getOwnPropertyDescriptor(target, key) {
1832
- if (hasAttr(target.rawProps, key)) {
1833
- return {
1834
- configurable: true,
1835
- enumerable: true,
1836
- get: () => getAttr(target.rawProps, key)
1837
- };
1838
- }
1839
- }
1840
- };
1841
- if (!!(process.env.NODE_ENV !== "production")) {
1842
- Object.assign(attrsHandlers, {
1843
- set: propsSetDevTrap,
1844
- deleteProperty: propsDeleteDevTrap
1845
- });
1846
- }
1847
- return comp.__propsHandlers = [propsHandlers, attrsHandlers];
1848
- }
1849
- function getAttrFromRawProps(rawProps, key) {
1850
- if (key === "$") return;
1851
- const merged = key === "class" || key === "style" ? [] : void 0;
1852
- const dynamicSources = rawProps.$;
1853
- if (dynamicSources) {
1854
- let i = dynamicSources.length;
1855
- let source, isDynamic;
1856
- while (i--) {
1857
- source = dynamicSources[i];
1858
- isDynamic = isFunction(source);
1859
- source = isDynamic ? source() : source;
1860
- if (source && hasOwn(source, key)) {
1861
- const value = isDynamic ? source[key] : source[key]();
1862
- if (merged) {
1863
- merged.push(value);
1864
- } else {
1865
- return value;
1866
- }
1867
- }
1868
- }
1869
- }
1870
- if (hasOwn(rawProps, key)) {
1871
- if (merged) {
1872
- merged.push(rawProps[key]());
1873
- } else {
1874
- return rawProps[key]();
1875
- }
1876
- }
1877
- if (merged && merged.length) {
1878
- return merged;
1879
- }
1880
- }
1881
- function hasAttrFromRawProps(rawProps, key) {
1882
- if (key === "$") return false;
1883
- const dynamicSources = rawProps.$;
1884
- if (dynamicSources) {
1885
- let i = dynamicSources.length;
1886
- while (i--) {
1887
- const source = resolveSource(dynamicSources[i]);
1888
- if (source && hasOwn(source, key)) {
1889
- return true;
1890
- }
1891
- }
1892
- }
1893
- return hasOwn(rawProps, key);
1894
- }
1895
- function getKeysFromRawProps(rawProps) {
1896
- const keys = [];
1897
- for (const key in rawProps) {
1898
- if (key !== "$") keys.push(key);
1899
- }
1900
- const dynamicSources = rawProps.$;
1901
- if (dynamicSources) {
1902
- let i = dynamicSources.length;
1903
- let source;
1904
- while (i--) {
1905
- source = resolveSource(dynamicSources[i]);
1906
- for (const key in source) {
1907
- keys.push(key);
1908
- }
1909
- }
1910
- }
1911
- return Array.from(new Set(keys));
1912
- }
1913
- function normalizePropsOptions(comp) {
1914
- const cached = comp.__propsOptions;
1915
- if (cached) return cached;
1916
- const raw = comp.props;
1917
- if (!raw) return EMPTY_ARR;
1918
- const normalized = {};
1919
- const needCastKeys = [];
1920
- baseNormalizePropsOptions(raw, normalized, needCastKeys);
1921
- return comp.__propsOptions = [normalized, needCastKeys];
1922
- }
1923
- function resolveDefault(factory, instance) {
1924
- const prev = setCurrentInstance(instance);
1925
- const res = factory.call(null, instance.props);
1926
- setCurrentInstance(...prev);
1927
- return res;
1928
- }
1929
- function hasFallthroughAttrs(comp, rawProps) {
1930
- if (rawProps) {
1931
- if (rawProps.$ || !comp.props) {
1932
- return true;
1933
- } else {
1934
- const propsOptions = normalizePropsOptions(comp)[0];
1935
- for (const key in rawProps) {
1936
- if (!hasOwn(propsOptions, camelize(key))) {
1937
- return true;
1938
- }
1939
- }
1940
- }
1941
- }
1942
- return false;
1943
- }
1944
- function setupPropsValidation(instance) {
1945
- const rawProps = instance.rawProps;
1946
- if (!rawProps) return;
1947
- renderEffect(
1948
- () => {
1949
- pushWarningContext$1(instance);
1950
- validateProps(
1951
- resolveDynamicProps(rawProps),
1952
- instance.props,
1953
- normalizePropsOptions(instance.type)[0]
1954
- );
1955
- popWarningContext$1();
1956
- },
1957
- true
1958
- /* noLifecycle */
1959
- );
1960
- }
1961
- function resolveDynamicProps(props) {
1962
- const mergedRawProps = {};
1963
- for (const key in props) {
1964
- if (key !== "$") {
1965
- mergedRawProps[key] = props[key]();
1966
- }
1967
- }
1968
- if (props.$) {
1969
- for (const source of props.$) {
1970
- const isDynamic = isFunction(source);
1971
- const resolved = isDynamic ? source() : source;
1972
- for (const key in resolved) {
1973
- const value = isDynamic ? resolved[key] : resolved[key]();
1974
- if (key === "class" || key === "style") {
1975
- const existing = mergedRawProps[key];
1976
- if (isArray(existing)) {
1977
- existing.push(value);
1978
- } else {
1979
- mergedRawProps[key] = [existing, value];
1980
- }
1981
- } else {
1982
- mergedRawProps[key] = value;
1983
- }
1984
- }
1985
- }
1986
- }
1987
- return mergedRawProps;
1988
- }
1989
- function propsSetDevTrap(_, key) {
1990
- warn$2(
1991
- `Attempt to mutate prop ${JSON.stringify(key)} failed. Props are readonly.`
1992
- );
1993
- return true;
1994
- }
1995
- function propsDeleteDevTrap(_, key) {
1996
- warn$2(
1997
- `Attempt to delete prop ${JSON.stringify(key)} failed. Props are readonly.`
1998
- );
1999
- return true;
2000
- }
2001
- const rawPropsProxyHandlers = {
2002
- get: getAttrFromRawProps,
2003
- has: hasAttrFromRawProps,
2004
- ownKeys: getKeysFromRawProps,
2005
- getOwnPropertyDescriptor(target, key) {
2006
- if (hasAttrFromRawProps(target, key)) {
2007
- return {
2008
- configurable: true,
2009
- enumerable: true,
2010
- get: () => getAttrFromRawProps(target, key)
2011
- };
2012
- }
2013
- }
2014
- };
2015
-
2016
- const dynamicSlotsProxyHandlers = {
2017
- get: getSlot,
2018
- has: (target, key) => !!getSlot(target, key),
2019
- getOwnPropertyDescriptor(target, key) {
2020
- const slot = getSlot(target, key);
2021
- if (slot) {
2022
- return {
2023
- configurable: true,
2024
- enumerable: true,
2025
- value: slot
2026
- };
2027
- }
2028
- },
2029
- ownKeys(target) {
2030
- let keys = Object.keys(target);
2031
- const dynamicSources = target.$;
2032
- if (dynamicSources) {
2033
- keys = keys.filter((k) => k !== "$");
2034
- for (const source of dynamicSources) {
2035
- if (isFunction(source)) {
2036
- const slot = source();
2037
- if (isArray(slot)) {
2038
- for (const s of slot) keys.push(String(s.name));
2039
- } else {
2040
- keys.push(String(slot.name));
2041
- }
2042
- } else {
2043
- keys.push(...Object.keys(source));
2044
- }
2045
- }
2046
- }
2047
- return keys;
2048
- },
2049
- set: NO,
2050
- deleteProperty: NO
2051
- };
2052
- function getSlot(target, key) {
2053
- if (key === "$") return;
2054
- const dynamicSources = target.$;
2055
- if (dynamicSources) {
2056
- let i = dynamicSources.length;
2057
- let source;
2058
- while (i--) {
2059
- source = dynamicSources[i];
2060
- if (isFunction(source)) {
2061
- const slot = source();
2062
- if (slot) {
2063
- if (isArray(slot)) {
2064
- for (const s of slot) {
2065
- if (String(s.name) === key) return s.fn;
2066
- }
2067
- } else if (String(slot.name) === key) {
2068
- return slot.fn;
2069
- }
2070
- }
2071
- } else if (hasOwn(source, key)) {
2072
- return source[key];
2073
- }
2074
- }
2075
- }
2076
- if (hasOwn(target, key)) {
2077
- return target[key];
2078
- }
2079
- }
2080
- function createSlot(doc, name, rawProps, fallback) {
2081
- const _insertionParent = insertionParent;
2082
- const _insertionAnchor = insertionAnchor;
2083
- if (isHydrating) {
2084
- locateHydrationNode();
2085
- } else {
2086
- resetInsertionState();
2087
- }
2088
- const instance = currentInstance$1;
2089
- const rawSlots = instance.rawSlots;
2090
- const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
2091
- let fragment;
2092
- if (isRef$1(rawSlots._)) {
2093
- fragment = instance.appContext.vapor.vdomSlot(
2094
- rawSlots._,
2095
- name,
2096
- slotProps,
2097
- instance,
2098
- fallback
2099
- );
2100
- } else {
2101
- fragment = !!(process.env.NODE_ENV !== "production") ? (
2102
- // fixed by uts
2103
- new DynamicFragment(doc, "slot")
2104
- ) : (
2105
- // fixed by uts
2106
- new DynamicFragment(doc)
2107
- );
2108
- const isDynamicName = isFunction(name);
2109
- const renderSlot = () => {
2110
- const slot = getSlot(rawSlots, isFunction(name) ? name() : name);
2111
- if (slot) {
2112
- fragment.update(
2113
- slot._bound || (slot._bound = () => {
2114
- const slotContent = slot(slotProps);
2115
- if (slotContent instanceof DynamicFragment) {
2116
- slotContent.fallback = fallback;
2117
- }
2118
- return slotContent;
2119
- })
2120
- );
2121
- } else {
2122
- fragment.update(fallback);
2123
- }
2124
- };
2125
- if (isDynamicName || rawSlots.$) {
2126
- renderEffect(renderSlot);
2127
- } else {
2128
- renderSlot();
2129
- }
2130
- }
2131
- if (!isHydrating && _insertionParent) {
2132
- insert(fragment, _insertionParent, _insertionAnchor);
2133
- }
2134
- return fragment;
2135
- }
2136
-
2137
- function hmrRerender(instance) {
2138
- const normalized = normalizeBlock(instance.block);
2139
- const parent = normalized[0].parentNode;
2140
- const anchor = normalized[normalized.length - 1].nextSibling;
2141
- remove(instance.block, parent);
2142
- const prev = setCurrentInstance(instance);
2143
- pushWarningContext$1(instance);
2144
- devRender(instance);
2145
- popWarningContext$1();
2146
- setCurrentInstance(...prev);
2147
- insert(instance.block, parent, anchor);
2148
- }
2149
- function hmrReload(instance, newComp) {
2150
- const normalized = normalizeBlock(instance.block);
2151
- const parent = normalized[0].parentNode;
2152
- const anchor = normalized[normalized.length - 1].nextSibling;
2153
- unmountComponent(instance, parent);
2154
- const prev = setCurrentInstance(instance.parent);
2155
- const newInstance = createComponent(
2156
- newComp,
2157
- instance.rawProps,
2158
- instance.rawSlots,
2159
- instance.isSingleRoot
2160
- );
2161
- setCurrentInstance(...prev);
2162
- mountComponent(newInstance, parent, anchor);
2163
- }
2164
-
2165
- function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext = currentInstance$1 && currentInstance$1.appContext || emptyContext) {
2166
- const _insertionParent = insertionParent;
2167
- const _insertionAnchor = insertionAnchor;
2168
- if (isHydrating) {
2169
- locateHydrationNode();
2170
- } else {
2171
- resetInsertionState();
2172
- }
2173
- if (appContext.vapor && !component.__vapor) {
2174
- const frag = appContext.vapor.vdomMount(
2175
- component,
2176
- rawProps,
2177
- rawSlots
2178
- );
2179
- if (!isHydrating && _insertionParent) {
2180
- insert(frag, _insertionParent, _insertionAnchor);
2181
- }
2182
- return frag;
2183
- }
2184
- if (isSingleRoot && component.inheritAttrs !== false && isVaporComponent(currentInstance$1) && currentInstance$1.hasFallthrough) {
2185
- const attrs = currentInstance$1.attrs;
2186
- if (rawProps) {
2187
- (rawProps.$ || (rawProps.$ = [])).push(
2188
- () => attrs
2189
- );
2190
- } else {
2191
- rawProps = { $: [() => attrs] };
2192
- }
2193
- }
2194
- const instance = new VaporComponentInstance(
2195
- component,
2196
- rawProps,
2197
- rawSlots,
2198
- appContext
2199
- );
2200
- if (!!(process.env.NODE_ENV !== "production") && component.__hmrId) {
2201
- registerHMR(instance);
2202
- instance.isSingleRoot = isSingleRoot;
2203
- instance.hmrRerender = hmrRerender.bind(null, instance);
2204
- instance.hmrReload = hmrReload.bind(null, instance);
2205
- }
2206
- if (!!(process.env.NODE_ENV !== "production")) {
2207
- pushWarningContext$1(instance);
2208
- startMeasure(instance, `init`);
2209
- instance.propsOptions = normalizePropsOptions(component);
2210
- instance.emitsOptions = normalizeEmitsOptions(component);
2211
- }
2212
- const prevInstance = setCurrentInstance(instance);
2213
- const prevSub = setActiveSub();
2214
- if (!!(process.env.NODE_ENV !== "production")) {
2215
- setupPropsValidation(instance);
2216
- }
2217
- instance.ctx = { _: instance };
2218
- instance.data = EMPTY_OBJ;
2219
- instance.setupState = EMPTY_OBJ;
2220
- instance.setupContext = null;
2221
- instance.accessCache = /* @__PURE__ */ Object.create(null);
2222
- instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
2223
- const setupFn = isFunction(component) ? component : component.setup;
2224
- const { beforeSetupPage, initNativePage, initFontFace } = appContext.config.uniX || {};
2225
- if (instance.renderer === "page") {
2226
- beforeSetupPage && beforeSetupPage(instance.props, instance);
2227
- }
2228
- initNativePage && initNativePage(instance.proxy);
2229
- const setupResult = setupFn ? callWithErrorHandling$1(setupFn, instance, 0, [
2230
- instance.props,
2231
- instance
2232
- ]) || EMPTY_OBJ : EMPTY_OBJ;
2233
- const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions;
2234
- if (customApplyOptions) {
2235
- customApplyOptions(component, instance, instance.proxy);
2236
- }
2237
- initFontFace && initFontFace(instance.proxy);
2238
- if (!!(process.env.NODE_ENV !== "production") && !isBlock(setupResult)) {
2239
- if (isFunction(component)) {
2240
- warn$2(`Functional vapor component must return a block directly.`);
2241
- instance.block = [];
2242
- } else if (!component.render) {
2243
- warn$2(
2244
- `Vapor component setup() returned non-block value, and has no render function.`
2245
- );
2246
- instance.block = [];
2247
- } else {
2248
- instance.devtoolsRawSetupState = setupResult;
2249
- instance.setupState = proxyRefs(setupResult);
2250
- devRender(instance);
2251
- }
2252
- } else {
2253
- if (!setupFn && component.render) {
2254
- instance.block = callWithErrorHandling$1(
2255
- component.render,
2256
- instance,
2257
- 1
2258
- );
2259
- } else {
2260
- instance.block = setupResult;
2261
- }
2262
- }
2263
- if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
2264
- const el = getRootElement(instance);
2265
- if (el) {
2266
- renderEffect(() => {
2267
- isApplyingFallthroughProps = true;
2268
- setDynamicProps(el, [instance.attrs]);
2269
- isApplyingFallthroughProps = false;
2270
- });
2271
- }
2272
- }
2273
- setActiveSub(prevSub);
2274
- setCurrentInstance(...prevInstance);
2275
- if (!!(process.env.NODE_ENV !== "production")) {
2276
- popWarningContext$1();
2277
- endMeasure(instance, "init");
2278
- }
2279
- onScopeDispose$1(() => unmountComponent(instance), true);
2280
- if (!isHydrating && _insertionParent) {
2281
- mountComponent(instance, _insertionParent, _insertionAnchor);
2282
- }
2283
- return instance;
2284
- }
2285
- let isApplyingFallthroughProps = false;
2286
- function devRender(instance) {
2287
- instance.block = (instance.type.render ? callWithErrorHandling$1(
2288
- instance.type.render,
2289
- instance,
2290
- 1,
2291
- [
2292
- instance.setupState,
2293
- instance.props,
2294
- instance.emit,
2295
- instance.attrs,
2296
- instance.slots
2297
- ]
2298
- ) : callWithErrorHandling$1(
2299
- isFunction(instance.type) ? instance.type : instance.type.setup,
2300
- instance,
2301
- 0,
2302
- [
2303
- instance.props,
2304
- {
2305
- slots: instance.slots,
2306
- attrs: instance.attrs,
2307
- emit: instance.emit,
2308
- expose: instance.expose
2309
- }
2310
- ]
2311
- )) || [];
2312
- }
2313
- const emptyContext = {
2314
- app: null,
2315
- config: {},
2316
- provides: /* @__PURE__ */ Object.create(null)
2317
- };
2318
- class VaporComponentInstance {
2319
- constructor(comp, rawProps, rawSlots, appContext) {
2320
- if (comp.__file) {
2321
- console.log("vue3 \u84B8\u6C7D\u6A21\u5F0F\uFF1A", `at ${comp.__file}:1`);
2322
- }
2323
- this.vapor = true;
2324
- this.uid = nextUid();
2325
- this.type = comp;
2326
- this.parent = currentInstance$1;
2327
- this.root = currentInstance$1 ? currentInstance$1.root : this;
2328
- if (currentInstance$1) {
2329
- this.appContext = currentInstance$1.appContext;
2330
- this.provides = currentInstance$1.provides;
2331
- this.ids = currentInstance$1.ids;
2332
- } else {
2333
- this.appContext = appContext || emptyContext;
2334
- this.provides = Object.create(this.appContext.provides);
2335
- this.ids = ["", 0, 0];
2336
- }
2337
- this.block = null;
2338
- this.scope = new EffectScope$1(true);
2339
- this.emit = emit.bind(null, this);
2340
- this.expose = expose.bind(null, this);
2341
- this.refs = EMPTY_OBJ;
2342
- this.emitted = this.exposed = this.exposeProxy = this.propsDefaults = this.suspense = null;
2343
- this.isMounted = this.isUnmounted = this.isUpdating = this.isDeactivated = false;
2344
- this.rawProps = rawProps || EMPTY_OBJ;
2345
- this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
2346
- if (rawProps || comp.props) {
2347
- const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp);
2348
- this.attrs = new Proxy(this, attrsHandlers);
2349
- this.props = comp.props ? new Proxy(this, propsHandlers) : isFunction(comp) ? this.attrs : EMPTY_OBJ;
2350
- } else {
2351
- this.props = this.attrs = EMPTY_OBJ;
2352
- }
2353
- this.rawSlots = rawSlots || EMPTY_OBJ;
2354
- this.slots = rawSlots ? rawSlots.$ ? new Proxy(rawSlots, dynamicSlotsProxyHandlers) : rawSlots : EMPTY_OBJ;
2355
- this.renderer = // @ts-expect-error
2356
- comp.mpType === "app" ? "app" : rawProps && rawProps.__pagePath ? "page" : "component";
2357
- }
2358
- /**
2359
- * Expose `getKeysFromRawProps` on the instance so it can be used in code
2360
- * paths where it's needed, e.g. `useModel`
2361
- */
2362
- rawKeys() {
2363
- return getKeysFromRawProps(this.rawProps);
2364
- }
2365
- // fixed by xxxxxx
2366
- $waitNativeRender(fn) {
2367
- const proxy = this.proxy;
2368
- const document = proxy && proxy.$nativePage && proxy.$nativePage.document;
2369
- if (document) {
2370
- document.waitNativeRender(fn);
2371
- } else {
2372
- fn();
2373
- }
2374
- }
2375
- }
2376
- function isVaporComponent(value) {
2377
- return value instanceof VaporComponentInstance;
2378
- }
2379
- function createComponentWithFallback(doc, comp, rawProps, rawSlots, isSingleRoot) {
2380
- if (!isString(comp)) {
2381
- return createComponent(comp, rawProps, rawSlots, isSingleRoot);
2382
- }
2383
- const _insertionParent = insertionParent;
2384
- const _insertionAnchor = insertionAnchor;
2385
- if (isHydrating) {
2386
- locateHydrationNode();
2387
- } else {
2388
- resetInsertionState();
2389
- }
2390
- const el = doc.createElement(comp);
2391
- el.$root = isSingleRoot;
2392
- if (rawProps) {
2393
- renderEffect(() => {
2394
- setDynamicProps(el, [resolveDynamicProps(rawProps)]);
2395
- });
2396
- }
2397
- if (rawSlots) {
2398
- if (rawSlots.$) ; else {
2399
- insert(getSlot(rawSlots, "default")(), el);
2400
- }
2401
- }
2402
- if (!isHydrating && _insertionParent) {
2403
- insert(el, _insertionParent, _insertionAnchor);
2404
- }
2405
- return el;
2406
- }
2407
- function mountComponent(instance, parent, anchor) {
2408
- if (!!(process.env.NODE_ENV !== "production")) {
2409
- startMeasure(instance, `mount`);
2410
- }
2411
- if (instance.bm) invokeArrayFns(instance.bm);
2412
- insert(instance.block, parent, anchor);
2413
- if (instance.m) queuePostFlushCb(() => invokeArrayFns(instance.m));
2414
- instance.isMounted = true;
2415
- if (!!(process.env.NODE_ENV !== "production")) {
2416
- endMeasure(instance, `mount`);
2417
- }
2418
- }
2419
- function unmountComponent(instance, parentNode) {
2420
- if (instance.isMounted && !instance.isUnmounted) {
2421
- if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
2422
- unregisterHMR(instance);
2423
- }
2424
- if (instance.bum) {
2425
- invokeArrayFns(instance.bum);
2426
- }
2427
- instance.scope.stop();
2428
- if (instance.um) {
2429
- queuePostFlushCb(() => invokeArrayFns(instance.um));
2430
- }
2431
- instance.isUnmounted = true;
2432
- }
2433
- if (parentNode) {
2434
- remove(instance.block, parentNode);
2435
- }
2436
- }
2437
- function getExposed(instance) {
2438
- if (instance.exposed) {
2439
- return instance.exposeProxy || // fixed by uts 支持 $callMethod
2440
- (instance.exposeProxy = new Proxy(markRaw(instance.exposed), {
2441
- get(target, key) {
2442
- if (key in target) {
2443
- return target[key];
2444
- } else if (key in publicPropertiesMap) {
2445
- return publicPropertiesMap[key](
2446
- instance
2447
- );
2448
- }
2449
- },
2450
- has(target, key) {
2451
- return key in target || key in publicPropertiesMap;
2452
- }
2453
- }));
2454
- }
2455
- }
2456
- function getRootElement({
2457
- block
2458
- }) {
2459
- if (block instanceof Element) {
2460
- return block;
2461
- }
2462
- if (block instanceof DynamicFragment) {
2463
- const { nodes } = block;
2464
- if (nodes instanceof Element && nodes.$root) {
2465
- return nodes;
2466
- }
2467
- }
2468
- }
2469
-
2470
- let _createApp;
2471
- const mountApp = (app, container) => {
2472
- optimizePropertyLookup();
2473
- if (container.nodeType === 1) {
2474
- if (!!(process.env.NODE_ENV !== "production") && container.childNodes.length) {
2475
- warn$2("mount target container is not empty and will be cleared.");
2476
- }
2477
- container.textContent = "";
2478
- }
2479
- const instance = createComponent(
2480
- app._component,
2481
- app._props,
2482
- null,
2483
- false,
2484
- app._context
2485
- );
2486
- mountComponent(instance, container);
2487
- flushOnAppMount();
2488
- return instance;
2489
- };
2490
- let _hydrateApp;
2491
- const hydrateApp = (app, container) => {
2492
- optimizePropertyLookup();
2493
- let instance;
2494
- withHydration(container, () => {
2495
- instance = createComponent(
2496
- app._component,
2497
- app._props,
2498
- null,
2499
- false,
2500
- app._context
2501
- );
2502
- mountComponent(instance, container);
2503
- flushOnAppMount();
2504
- });
2505
- return instance;
2506
- };
2507
- const unmountApp = (app) => {
2508
- unmountComponent(app._instance, app._container);
2509
- };
2510
- function prepareApp() {
2511
- {
2512
- initFeatureFlags();
2513
- }
2514
- const target = getGlobalThis();
2515
- target.__VUE__ = true;
2516
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
2517
- setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
2518
- }
2519
- }
2520
- function postPrepareApp(app) {
2521
- app.vapor = true;
2522
- }
2523
- const createVaporApp = (comp, props) => {
2524
- prepareApp();
2525
- if (!_createApp) _createApp = createAppAPI(mountApp, unmountApp, getExposed);
2526
- const app = _createApp(comp, props);
2527
- postPrepareApp(app);
2528
- return app;
2529
- };
2530
- const createVaporSSRApp = (comp, props) => {
2531
- prepareApp();
2532
- if (!_hydrateApp)
2533
- _hydrateApp = createAppAPI(hydrateApp, unmountApp, getExposed);
2534
- const app = _hydrateApp(comp, props);
2535
- postPrepareApp(app);
2536
- return app;
2537
- };
2538
-
2539
- /*! #__NO_SIDE_EFFECTS__ */
2540
- // @__NO_SIDE_EFFECTS__
2541
- function defineVaporComponent(comp, extraOptions) {
2542
- if (isFunction(comp)) {
2543
- return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
2544
- setup: comp,
2545
- __vapor: true
2546
- }))();
2547
- }
2548
- comp.__vapor = true;
2549
- return comp;
2550
- }
2551
-
2552
- let t;
2553
- /*! #__NO_SIDE_EFFECTS__ */
2554
- // @__NO_SIDE_EFFECTS__
2555
- function template(html, root) {
2556
- let node;
2557
- return () => {
2558
- if (isHydrating) {
2559
- if (!!(process.env.NODE_ENV !== "production") && !currentHydrationNode) {
2560
- throw new Error("No current hydration node");
2561
- }
2562
- return adoptTemplate(currentHydrationNode, html);
2563
- }
2564
- if (html[0] !== "<") {
2565
- return createTextNode(html);
2566
- }
2567
- if (!node) {
2568
- t = t || document.createElement("template");
2569
- t.innerHTML = html;
2570
- node = child(t.content);
2571
- }
2572
- const ret = node.cloneNode(true);
2573
- if (root) ret.$root = true;
2574
- return ret;
2575
- };
2576
- }
2577
-
2578
- function createIf(doc, condition, b1, b2, once) {
2579
- const _insertionParent = insertionParent;
2580
- const _insertionAnchor = insertionAnchor;
2581
- if (isHydrating) {
2582
- locateHydrationNode();
2583
- } else {
2584
- resetInsertionState();
2585
- }
2586
- let frag;
2587
- if (once) {
2588
- frag = condition() ? b1() : b2 ? b2() : [];
2589
- } else {
2590
- frag = !!(process.env.NODE_ENV !== "production") ? (
2591
- // fixed by uts
2592
- new DynamicFragment(doc, "if")
2593
- ) : (
2594
- // fixed by uts
2595
- new DynamicFragment(doc)
2596
- );
2597
- renderEffect(() => frag.update(condition() ? b1 : b2));
2598
- }
2599
- if (!isHydrating && _insertionParent) {
2600
- insert(frag, _insertionParent, _insertionAnchor);
2601
- }
2602
- return frag;
2603
- }
2604
-
2605
- class ForBlock extends VaporFragment {
2606
- constructor(nodes, scope, item, key, index, renderKey) {
2607
- super(nodes);
2608
- this.scope = scope;
2609
- this.itemRef = item;
2610
- this.keyRef = key;
2611
- this.indexRef = index;
2612
- this.key = renderKey;
2613
- }
2614
- }
2615
- const createFor = (doc, src, renderItem, getKey, flags = 0, setup) => {
2616
- const _insertionParent = insertionParent;
2617
- const _insertionAnchor = insertionAnchor;
2618
- if (isHydrating) {
2619
- locateHydrationNode();
2620
- } else {
2621
- resetInsertionState();
2622
- }
2623
- let isMounted = false;
2624
- let oldBlocks = [];
2625
- let newBlocks;
2626
- let parent;
2627
- let currentKey;
2628
- const parentAnchor = doc.createComment("for");
2629
- const frag = new VaporFragment(oldBlocks);
2630
- const instance = currentInstance$1;
2631
- const canUseFastRemove = !!(flags & 1);
2632
- const isComponent = !!(flags & 2);
2633
- const selectors = [];
2634
- if (!!(process.env.NODE_ENV !== "production") && !instance) {
2635
- warn$2("createFor() can only be used inside setup()");
2636
- }
2637
- const renderList = () => {
2638
- const source = normalizeSource(src());
2639
- const newLength = source.values.length;
2640
- const oldLength = oldBlocks.length;
2641
- newBlocks = new Array(newLength);
2642
- const prevSub = setActiveSub();
2643
- if (!isMounted) {
2644
- isMounted = true;
2645
- for (let i = 0; i < newLength; i++) {
2646
- mount(source, i);
2647
- }
2648
- } else {
2649
- parent = parent || parentAnchor.parentNode;
2650
- if (!oldLength) {
2651
- for (let i = 0; i < newLength; i++) {
2652
- mount(source, i);
2653
- }
2654
- } else if (!newLength) {
2655
- for (const selector of selectors) {
2656
- selector.cleanup();
2657
- }
2658
- const doRemove = !canUseFastRemove;
2659
- for (let i = 0; i < oldLength; i++) {
2660
- unmount(oldBlocks[i], doRemove, false);
2661
- }
2662
- if (canUseFastRemove) {
2663
- parent.textContent = "";
2664
- parent.appendChild(parentAnchor);
2665
- }
2666
- } else if (!getKey) {
2667
- const commonLength = Math.min(newLength, oldLength);
2668
- for (let i = 0; i < commonLength; i++) {
2669
- update(newBlocks[i] = oldBlocks[i], getItem(source, i)[0]);
2670
- }
2671
- for (let i = oldLength; i < newLength; i++) {
2672
- mount(source, i);
2673
- }
2674
- for (let i = newLength; i < oldLength; i++) {
2675
- unmount(oldBlocks[i]);
2676
- }
2677
- } else {
2678
- const sharedBlockCount = Math.min(oldLength, newLength);
2679
- const previousKeyIndexPairs = new Array(oldLength);
2680
- const queuedBlocks = new Array(newLength);
2681
- let anchorFallback = parentAnchor;
2682
- let endOffset = 0;
2683
- let startOffset = 0;
2684
- let queuedBlocksInsertIndex = 0;
2685
- let previousKeyIndexInsertIndex = 0;
2686
- while (endOffset < sharedBlockCount) {
2687
- const currentIndex = newLength - endOffset - 1;
2688
- const currentItem = getItem(source, currentIndex);
2689
- const currentKey2 = getKey(...currentItem);
2690
- const existingBlock = oldBlocks[oldLength - endOffset - 1];
2691
- if (existingBlock.key === currentKey2) {
2692
- update(existingBlock, ...currentItem);
2693
- newBlocks[currentIndex] = existingBlock;
2694
- endOffset++;
2695
- continue;
2696
- }
2697
- if (endOffset !== 0) {
2698
- anchorFallback = normalizeAnchor(newBlocks[currentIndex + 1].nodes);
2699
- }
2700
- break;
2701
- }
2702
- while (startOffset < sharedBlockCount - endOffset) {
2703
- const currentItem = getItem(source, startOffset);
2704
- const currentKey2 = getKey(...currentItem);
2705
- const previousBlock = oldBlocks[startOffset];
2706
- const previousKey = previousBlock.key;
2707
- if (previousKey === currentKey2) {
2708
- update(newBlocks[startOffset] = previousBlock, currentItem[0]);
2709
- } else {
2710
- queuedBlocks[queuedBlocksInsertIndex++] = [
2711
- startOffset,
2712
- currentItem,
2713
- currentKey2
2714
- ];
2715
- previousKeyIndexPairs[previousKeyIndexInsertIndex++] = [
2716
- previousKey,
2717
- startOffset
2718
- ];
2719
- }
2720
- startOffset++;
2721
- }
2722
- for (let i = startOffset; i < oldLength - endOffset; i++) {
2723
- previousKeyIndexPairs[previousKeyIndexInsertIndex++] = [
2724
- oldBlocks[i].key,
2725
- i
2726
- ];
2727
- }
2728
- const preparationBlockCount = Math.min(
2729
- newLength - endOffset,
2730
- sharedBlockCount
2731
- );
2732
- for (let i = startOffset; i < preparationBlockCount; i++) {
2733
- const blockItem = getItem(source, i);
2734
- const blockKey = getKey(...blockItem);
2735
- queuedBlocks[queuedBlocksInsertIndex++] = [i, blockItem, blockKey];
2736
- }
2737
- if (!queuedBlocksInsertIndex && !previousKeyIndexInsertIndex) {
2738
- for (let i = preparationBlockCount; i < newLength - endOffset; i++) {
2739
- const blockItem = getItem(source, i);
2740
- const blockKey = getKey(...blockItem);
2741
- mount(source, i, anchorFallback, blockItem, blockKey);
2742
- }
2743
- } else {
2744
- queuedBlocks.length = queuedBlocksInsertIndex;
2745
- previousKeyIndexPairs.length = previousKeyIndexInsertIndex;
2746
- const previousKeyIndexMap = new Map(previousKeyIndexPairs);
2747
- const blocksToMount = [];
2748
- const relocateOrMountBlock = (blockIndex, blockItem, blockKey, anchorOffset) => {
2749
- const previousIndex = previousKeyIndexMap.get(blockKey);
2750
- if (previousIndex !== void 0) {
2751
- const reusedBlock = newBlocks[blockIndex] = oldBlocks[previousIndex];
2752
- update(reusedBlock, ...blockItem);
2753
- insert(
2754
- reusedBlock,
2755
- parent,
2756
- anchorOffset === -1 ? anchorFallback : normalizeAnchor(newBlocks[anchorOffset].nodes)
2757
- );
2758
- previousKeyIndexMap.delete(blockKey);
2759
- } else {
2760
- blocksToMount.push([
2761
- blockIndex,
2762
- blockItem,
2763
- blockKey,
2764
- anchorOffset
2765
- ]);
2766
- }
2767
- };
2768
- for (let i = queuedBlocks.length - 1; i >= 0; i--) {
2769
- const [blockIndex, blockItem, blockKey] = queuedBlocks[i];
2770
- relocateOrMountBlock(
2771
- blockIndex,
2772
- blockItem,
2773
- blockKey,
2774
- blockIndex < preparationBlockCount - 1 ? blockIndex + 1 : -1
2775
- );
2776
- }
2777
- for (let i = preparationBlockCount; i < newLength - endOffset; i++) {
2778
- const blockItem = getItem(source, i);
2779
- const blockKey = getKey(...blockItem);
2780
- relocateOrMountBlock(i, blockItem, blockKey, -1);
2781
- }
2782
- const useFastRemove = blocksToMount.length === newLength;
2783
- for (const leftoverIndex of previousKeyIndexMap.values()) {
2784
- unmount(
2785
- oldBlocks[leftoverIndex],
2786
- !(useFastRemove && canUseFastRemove),
2787
- !useFastRemove
2788
- );
2789
- }
2790
- if (useFastRemove) {
2791
- for (const selector of selectors) {
2792
- selector.cleanup();
2793
- }
2794
- if (canUseFastRemove) {
2795
- parent.textContent = "";
2796
- parent.appendChild(parentAnchor);
2797
- }
2798
- }
2799
- for (const [
2800
- blockIndex,
2801
- blockItem,
2802
- blockKey,
2803
- anchorOffset
2804
- ] of blocksToMount) {
2805
- mount(
2806
- source,
2807
- blockIndex,
2808
- anchorOffset === -1 ? anchorFallback : normalizeAnchor(newBlocks[anchorOffset].nodes),
2809
- blockItem,
2810
- blockKey
2811
- );
2812
- }
2813
- }
2814
- }
2815
- }
2816
- frag.nodes = [oldBlocks = newBlocks];
2817
- if (parentAnchor) {
2818
- frag.nodes.push(parentAnchor);
2819
- }
2820
- setActiveSub(prevSub);
2821
- };
2822
- const needKey = renderItem.length > 1;
2823
- const needIndex = renderItem.length > 2;
2824
- const mount = (source, idx, anchor = parentAnchor, [item, key, index] = getItem(source, idx), key2 = getKey && getKey(item, key, index)) => {
2825
- const itemRef = shallowRef$1(item);
2826
- const keyRef = needKey ? shallowRef$1(key) : void 0;
2827
- const indexRef = needIndex ? shallowRef$1(index) : void 0;
2828
- currentKey = key2;
2829
- let nodes;
2830
- let scope;
2831
- if (isComponent) {
2832
- nodes = renderItem(itemRef, keyRef, indexRef);
2833
- } else {
2834
- scope = new EffectScope();
2835
- nodes = scope.run(
2836
- () => renderItem(itemRef, keyRef, indexRef)
2837
- );
2838
- }
2839
- const block = newBlocks[idx] = new ForBlock(
2840
- nodes,
2841
- scope,
2842
- itemRef,
2843
- keyRef,
2844
- indexRef,
2845
- key2
2846
- );
2847
- if (parent) insert(block.nodes, parent, anchor);
2848
- return block;
2849
- };
2850
- const update = ({ itemRef, keyRef, indexRef }, newItem, newKey, newIndex) => {
2851
- if (newItem !== itemRef.value) {
2852
- itemRef.value = newItem;
2853
- }
2854
- if (keyRef && newKey !== void 0 && newKey !== keyRef.value) {
2855
- keyRef.value = newKey;
2856
- }
2857
- if (indexRef && newIndex !== void 0 && newIndex !== indexRef.value) {
2858
- indexRef.value = newIndex;
2859
- }
2860
- };
2861
- const unmount = (block, doRemove = true, doDeregister = true) => {
2862
- if (!isComponent) {
2863
- block.scope.stop();
2864
- }
2865
- if (doRemove) {
2866
- remove(block.nodes, parent);
2867
- }
2868
- if (doDeregister) {
2869
- for (const selector of selectors) {
2870
- selector.deregister(block.key);
2871
- }
2872
- }
2873
- };
2874
- if (setup) {
2875
- setup({ createSelector });
2876
- }
2877
- if (flags & 4) {
2878
- renderList();
2879
- } else {
2880
- renderEffect(renderList);
2881
- }
2882
- if (!isHydrating && _insertionParent) {
2883
- insert(frag, _insertionParent, _insertionAnchor);
2884
- }
2885
- return frag;
2886
- function createSelector(source) {
2887
- let operMap = /* @__PURE__ */ new Map();
2888
- let activeKey = source();
2889
- let activeOpers;
2890
- watch(source, (newValue) => {
2891
- if (activeOpers !== void 0) {
2892
- for (const oper of activeOpers) {
2893
- oper();
2894
- }
2895
- }
2896
- activeOpers = operMap.get(newValue);
2897
- if (activeOpers !== void 0) {
2898
- for (const oper of activeOpers) {
2899
- oper();
2900
- }
2901
- }
2902
- });
2903
- selectors.push({ deregister, cleanup });
2904
- return register;
2905
- function cleanup() {
2906
- operMap = /* @__PURE__ */ new Map();
2907
- activeOpers = void 0;
2908
- }
2909
- function register(oper) {
2910
- oper();
2911
- let opers = operMap.get(currentKey);
2912
- if (opers !== void 0) {
2913
- opers.push(oper);
2914
- } else {
2915
- opers = [oper];
2916
- operMap.set(currentKey, opers);
2917
- if (currentKey === activeKey) {
2918
- activeOpers = opers;
2919
- }
2920
- }
2921
- }
2922
- function deregister(key) {
2923
- operMap.delete(key);
2924
- if (key === activeKey) {
2925
- activeOpers = void 0;
2926
- }
2927
- }
2928
- }
2929
- };
2930
- function createForSlots(rawSource, getSlot) {
2931
- const source = normalizeSource(rawSource);
2932
- const sourceLength = source.values.length;
2933
- const slots = new Array(sourceLength);
2934
- for (let i = 0; i < sourceLength; i++) {
2935
- slots[i] = getSlot(...getItem(source, i));
2936
- }
2937
- return slots;
2938
- }
2939
- function normalizeSource(source) {
2940
- let values = source;
2941
- let needsWrap = false;
2942
- let isReadonlySource = false;
2943
- let keys;
2944
- if (isArray(source)) {
2945
- if (isReactive(source)) {
2946
- needsWrap = !isShallow(source);
2947
- values = shallowReadArray(source);
2948
- isReadonlySource = isReadonly(source);
2949
- }
2950
- } else if (isString(source)) {
2951
- values = source.split("");
2952
- } else if (typeof source === "number") {
2953
- if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
2954
- warn$2(`The v-for range expect an integer value but got ${source}.`);
2955
- }
2956
- values = new Array(source);
2957
- for (let i = 0; i < source; i++) values[i] = i + 1;
2958
- } else if (isObject(source)) {
2959
- if (source[Symbol.iterator]) {
2960
- values = Array.from(source);
2961
- } else {
2962
- keys = Object.keys(source);
2963
- values = new Array(keys.length);
2964
- for (let i = 0, l = keys.length; i < l; i++) {
2965
- values[i] = source[keys[i]];
2966
- }
2967
- }
2968
- }
2969
- return {
2970
- values,
2971
- needsWrap,
2972
- isReadonlySource,
2973
- keys
2974
- };
2975
- }
2976
- function getItem({ keys, values, needsWrap, isReadonlySource }, idx) {
2977
- const value = needsWrap ? isReadonlySource ? toReadonly(toReactive(values[idx])) : toReactive(values[idx]) : values[idx];
2978
- if (keys) {
2979
- return [value, keys[idx], idx];
2980
- } else {
2981
- return [value, idx, void 0];
2982
- }
2983
- }
2984
- function normalizeAnchor(node) {
2985
- if (node instanceof Node) {
2986
- return node;
2987
- } else if (isArray(node)) {
2988
- return normalizeAnchor(node[0]);
2989
- } else if (isVaporComponent(node)) {
2990
- return normalizeAnchor(node.block);
2991
- } else {
2992
- return normalizeAnchor(node.nodes);
2993
- }
2994
- }
2995
- function getRestElement(val, keys) {
2996
- const res = {};
2997
- for (const key in val) {
2998
- if (!keys.includes(key)) res[key] = val[key];
2999
- }
3000
- return res;
3001
- }
3002
- function getDefaultValue(val, defaultVal) {
3003
- return val === void 0 ? defaultVal : val;
3004
- }
3005
-
3006
- function createTemplateRefSetter() {
3007
- const instance = currentInstance$1;
3008
- return (...args) => setRef(instance, ...args);
3009
- }
3010
- function setRef(instance, el, ref, oldRef, refFor = false) {
3011
- if (!instance || instance.isUnmounted) return;
3012
- const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
3013
- const refValue = getRefValue(el);
3014
- const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
3015
- if (oldRef != null && oldRef !== ref) {
3016
- if (isString(oldRef)) {
3017
- refs[oldRef] = null;
3018
- if (!!(process.env.NODE_ENV !== "production") && hasOwn(setupState, oldRef)) {
3019
- setupState[oldRef] = null;
3020
- }
3021
- } else if (isRef(oldRef)) {
3022
- oldRef.value = null;
3023
- }
3024
- }
3025
- if (isFunction(ref)) {
3026
- const invokeRefSetter = (value) => {
3027
- callWithErrorHandling$1(ref, currentInstance$1, 12, [
3028
- value,
3029
- refs
3030
- ]);
3031
- };
3032
- invokeRefSetter(refValue);
3033
- onScopeDispose$1(() => invokeRefSetter());
3034
- } else {
3035
- const _isString = isString(ref);
3036
- const _isRef = isRef(ref);
3037
- let existing;
3038
- if (_isString || _isRef) {
3039
- const doSet = () => {
3040
- if (refFor) {
3041
- existing = _isString ? !!(process.env.NODE_ENV !== "production") && hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
3042
- if (!isArray(existing)) {
3043
- existing = [refValue];
3044
- if (_isString) {
3045
- refs[ref] = existing;
3046
- if (!!(process.env.NODE_ENV !== "production") && hasOwn(setupState, ref)) {
3047
- setupState[ref] = refs[ref];
3048
- existing = setupState[ref];
3049
- }
3050
- } else {
3051
- ref.value = existing;
3052
- }
3053
- } else if (!existing.includes(refValue)) {
3054
- existing.push(refValue);
3055
- }
3056
- } else if (_isString) {
3057
- refs[ref] = refValue;
3058
- if (!!(process.env.NODE_ENV !== "production") && hasOwn(setupState, ref)) {
3059
- setupState[ref] = refValue;
3060
- }
3061
- } else if (_isRef) {
3062
- ref.value = refValue;
3063
- } else if (!!(process.env.NODE_ENV !== "production")) {
3064
- warn$2("Invalid template ref type:", ref, `(${typeof ref})`);
3065
- }
3066
- };
3067
- queuePostFlushCb(doSet, -1);
3068
- onScopeDispose$1(() => {
3069
- queuePostFlushCb(() => {
3070
- if (isArray(existing)) {
3071
- remove$1(existing, refValue);
3072
- } else if (_isString) {
3073
- refs[ref] = null;
3074
- if (!!(process.env.NODE_ENV !== "production") && hasOwn(setupState, ref)) {
3075
- setupState[ref] = null;
3076
- }
3077
- } else if (_isRef) {
3078
- ref.value = null;
3079
- }
3080
- });
3081
- });
3082
- } else if (!!(process.env.NODE_ENV !== "production")) {
3083
- warn$2("Invalid template ref type:", ref, `(${typeof ref})`);
3084
- }
3085
- }
3086
- return ref;
3087
- }
3088
- const getRefValue = (el) => {
3089
- if (isVaporComponent(el)) {
3090
- return getExposed(el) || el;
3091
- } else if (el instanceof DynamicFragment) {
3092
- return getRefValue(el.nodes);
3093
- }
3094
- return el;
3095
- };
3096
-
3097
- function createDynamicComponent(doc, getter, rawProps, rawSlots, isSingleRoot) {
3098
- const _insertionParent = insertionParent;
3099
- const _insertionAnchor = insertionAnchor;
3100
- if (isHydrating) {
3101
- locateHydrationNode();
3102
- } else {
3103
- resetInsertionState();
3104
- }
3105
- const frag = !!(process.env.NODE_ENV !== "production") ? (
3106
- // fixed by uts
3107
- new DynamicFragment(doc, "dynamic-component")
3108
- ) : (
3109
- // fixed by uts
3110
- new DynamicFragment(doc)
3111
- );
3112
- renderEffect(() => {
3113
- const value = getter();
3114
- frag.update(
3115
- () => createComponentWithFallback(
3116
- // fixed by uts
3117
- doc,
3118
- resolveDynamicComponent(value),
3119
- rawProps,
3120
- rawSlots,
3121
- isSingleRoot
3122
- ),
3123
- value
3124
- );
3125
- });
3126
- if (!isHydrating && _insertionParent) {
3127
- insert(frag, _insertionParent, _insertionAnchor);
3128
- }
3129
- return frag;
3130
- }
3131
-
3132
- function applyVShow(target, source) {
3133
- if (isVaporComponent(target)) {
3134
- return applyVShow(target.block, source);
3135
- }
3136
- if (isArray(target) && target.length === 1) {
3137
- return applyVShow(target[0], source);
3138
- }
3139
- if (target instanceof DynamicFragment) {
3140
- const update = target.update;
3141
- target.update = (render, key) => {
3142
- update.call(target, render, key);
3143
- setDisplay(target, source());
3144
- };
3145
- }
3146
- renderEffect(() => setDisplay(target, source()));
3147
- }
3148
- function setDisplay(target, value) {
3149
- if (isVaporComponent(target)) {
3150
- return setDisplay(target, value);
3151
- }
3152
- if (isArray(target) && target.length === 1) {
3153
- return setDisplay(target[0], value);
3154
- }
3155
- if (target instanceof DynamicFragment) {
3156
- return setDisplay(target.nodes, value);
3157
- }
3158
- if (target instanceof Element) {
3159
- const el = target;
3160
- if (!(vShowOriginalDisplay in el)) {
3161
- el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
3162
- }
3163
- el.style.display = value ? el[vShowOriginalDisplay] : "none";
3164
- el[vShowHidden$1] = !value;
3165
- } else if (!!(process.env.NODE_ENV !== "production")) {
3166
- warn$2(
3167
- `v-show used on component with non-single-element root node and will be ignored.`
3168
- );
3169
- }
3170
- }
3171
-
3172
- function ensureMounted(cb) {
3173
- if (currentInstance$1.isMounted) {
3174
- cb();
3175
- } else {
3176
- onMounted(cb);
3177
- }
3178
- }
3179
- const applyTextModel = (el, get, set, { trim, number, lazy } = {}) => {
3180
- vModelTextInit(el, trim, number, lazy, set);
3181
- ensureMounted(() => {
3182
- let value;
3183
- renderEffect(() => {
3184
- vModelTextUpdate(el, value, value = get(), trim, number, lazy);
3185
- });
3186
- });
3187
- };
3188
- const applyCheckboxModel = (el, get, set) => {
3189
- vModelCheckboxInit(el, set);
3190
- ensureMounted(() => {
3191
- let value;
3192
- renderEffect(() => {
3193
- vModelCheckboxUpdate(
3194
- el,
3195
- value,
3196
- // #4096 array checkboxes need to be deep traversed
3197
- traverse(value = get())
3198
- );
3199
- });
3200
- });
3201
- };
3202
- const applyRadioModel = (el, get, set) => {
3203
- addEventListener(el, "change", () => set(vModelGetValue(el)));
3204
- ensureMounted(() => {
3205
- let value;
3206
- renderEffect(() => {
3207
- if (value !== (value = get())) {
3208
- el.checked = looseEqual(value, vModelGetValue(el));
3209
- }
3210
- });
3211
- });
3212
- };
3213
- const applySelectModel = (el, get, set, modifiers) => {
3214
- vModelSelectInit(el, get(), modifiers && modifiers.number, set);
3215
- ensureMounted(() => {
3216
- renderEffect(() => vModelSetSelected(el, traverse(get())));
3217
- });
3218
- };
3219
- const applyDynamicModel = (el, get, set, modifiers) => {
3220
- let apply = applyTextModel;
3221
- if (el.tagName === "SELECT") {
3222
- apply = applySelectModel;
3223
- } else if (el.tagName === "TEXTAREA") {
3224
- apply = applyTextModel;
3225
- } else if (el.type === "checkbox") {
3226
- apply = applyCheckboxModel;
3227
- } else if (el.type === "radio") {
3228
- apply = applyRadioModel;
3229
- }
3230
- apply(el, get, set, modifiers);
3231
- };
3232
-
3233
- function withVaporDirectives(node, dirs) {
3234
- for (const [dir, value, argument, modifiers] of dirs) {
3235
- if (dir) {
3236
- const ret = dir(node, value, argument, modifiers);
3237
- if (ret) onScopeDispose(ret);
3238
- }
3239
- }
3240
- }
3241
-
3242
- export { VaporFragment, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporComponent, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, unmountComponent, vaporInteropPlugin, withVaporDirectives };