@vue/shared 3.6.0-beta.1 → 3.6.0-beta.11

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.
@@ -1,32 +1,42 @@
1
1
  /**
2
- * @vue/shared v3.6.0-beta.1
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/
6
- // @__NO_SIDE_EFFECTS__
2
+ * @vue/shared v3.6.0-beta.11
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
6
+ //#region packages/shared/src/makeMap.ts
7
+ /**
8
+ * Make a map and return a function for checking if a key
9
+ * is in that map.
10
+ * IMPORTANT: all calls of this function must be prefixed with
11
+ * \/\*#\_\_PURE\_\_\*\/
12
+ * So that they can be tree-shaken if necessary.
13
+ */
14
+ /* @__NO_SIDE_EFFECTS__ */
7
15
  function makeMap(str) {
8
- const map = /* @__PURE__ */ Object.create(null);
9
- for (const key of str.split(",")) map[key] = 1;
10
- return (val) => val in map;
16
+ const map = Object.create(null);
17
+ for (const key of str.split(",")) map[key] = 1;
18
+ return (val) => val in map;
11
19
  }
12
-
20
+ //#endregion
21
+ //#region packages/shared/src/general.ts
13
22
  const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
14
23
  const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
15
- const NOOP = () => {
16
- };
24
+ const NOOP = () => {};
25
+ /**
26
+ * Always return true.
27
+ */
17
28
  const YES = () => true;
29
+ /**
30
+ * Always return false.
31
+ */
18
32
  const NO = () => false;
19
- const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
20
- (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
21
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
22
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
33
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
34
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
23
35
  const isModelListener = (key) => key.startsWith("onUpdate:");
24
36
  const extend = Object.assign;
25
37
  const remove = (arr, el) => {
26
- const i = arr.indexOf(el);
27
- if (i > -1) {
28
- arr.splice(i, 1);
29
- }
38
+ const i = arr.indexOf(el);
39
+ if (i > -1) arr.splice(i, 1);
30
40
  };
31
41
  const hasOwnProperty = Object.prototype.hasOwnProperty;
32
42
  const hasOwn = (val, key) => hasOwnProperty.call(val, key);
@@ -40,591 +50,627 @@ const isString = (val) => typeof val === "string";
40
50
  const isSymbol = (val) => typeof val === "symbol";
41
51
  const isObject = (val) => val !== null && typeof val === "object";
42
52
  const isPromise = (val) => {
43
- return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
53
+ return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
44
54
  };
45
55
  const objectToString = Object.prototype.toString;
46
56
  const toTypeString = (value) => objectToString.call(value);
47
57
  const toRawType = (value) => {
48
- return toTypeString(value).slice(8, -1);
58
+ return toTypeString(value).slice(8, -1);
49
59
  };
50
60
  const isPlainObject = (val) => toTypeString(val) === "[object Object]";
51
61
  const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
52
- const isReservedProp = /* @__PURE__ */ makeMap(
53
- // the leading comma is intentional so empty string "" is also included
54
- ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
55
- );
62
+ const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
56
63
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
57
- const isBuiltInDirective = /* @__PURE__ */ makeMap(
58
- "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
59
- );
64
+ const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
60
65
  const cacheStringFunction = (fn) => {
61
- const cache = /* @__PURE__ */ Object.create(null);
62
- return ((str) => {
63
- const hit = cache[str];
64
- return hit || (cache[str] = fn(str));
65
- });
66
+ const cache = Object.create(null);
67
+ return ((str) => {
68
+ return cache[str] || (cache[str] = fn(str));
69
+ });
66
70
  };
67
71
  const camelizeRE = /-(\w)/g;
68
72
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
69
- const camelize = cacheStringFunction(
70
- (str) => str.replace(camelizeRE, camelizeReplacer)
71
- );
73
+ /**
74
+ * @private
75
+ */
76
+ const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
72
77
  const hyphenateRE = /\B([A-Z])/g;
73
- const hyphenate = cacheStringFunction(
74
- (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
75
- );
78
+ /**
79
+ * @private
80
+ */
81
+ const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
82
+ /**
83
+ * @private
84
+ */
76
85
  const capitalize = cacheStringFunction((str) => {
77
- return str.charAt(0).toUpperCase() + str.slice(1);
86
+ return str.charAt(0).toUpperCase() + str.slice(1);
87
+ });
88
+ /**
89
+ * @private
90
+ */
91
+ const toHandlerKey = cacheStringFunction((str) => {
92
+ return str ? `on${capitalize(str)}` : ``;
78
93
  });
79
- const toHandlerKey = cacheStringFunction(
80
- (str) => {
81
- const s = str ? `on${capitalize(str)}` : ``;
82
- return s;
83
- }
84
- );
94
+ /**
95
+ * #13070 When v-model and v-model:model directives are used together,
96
+ * they will generate the same modelModifiers prop,
97
+ * so a `$` suffix is added to avoid conflicts.
98
+ * @private
99
+ */
85
100
  const getModifierPropName = (name) => {
86
- return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
101
+ return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
87
102
  };
88
103
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
89
104
  const invokeArrayFns = (fns, ...arg) => {
90
- for (let i = 0; i < fns.length; i++) {
91
- fns[i](...arg);
92
- }
105
+ for (let i = 0; i < fns.length; i++) fns[i](...arg);
93
106
  };
94
107
  const def = (obj, key, value, writable = false) => {
95
- Object.defineProperty(obj, key, {
96
- configurable: true,
97
- enumerable: false,
98
- writable,
99
- value
100
- });
108
+ Object.defineProperty(obj, key, {
109
+ configurable: true,
110
+ enumerable: false,
111
+ writable,
112
+ value
113
+ });
101
114
  };
115
+ /**
116
+ * "123-foo" will be parsed to 123
117
+ * This is used for the .number modifier in v-model
118
+ */
102
119
  const looseToNumber = (val) => {
103
- const n = parseFloat(val);
104
- return isNaN(n) ? val : n;
120
+ const n = parseFloat(val);
121
+ return isNaN(n) ? val : n;
105
122
  };
123
+ /**
124
+ * Only concerns number-like strings
125
+ * "123-foo" will be returned as-is
126
+ */
106
127
  const toNumber = (val) => {
107
- const n = isString(val) ? Number(val) : NaN;
108
- return isNaN(n) ? val : n;
128
+ const n = isString(val) ? Number(val) : NaN;
129
+ return isNaN(n) ? val : n;
109
130
  };
110
131
  let _globalThis;
111
132
  const getGlobalThis = () => {
112
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
133
+ return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
113
134
  };
114
135
  const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
115
136
  function genPropsAccessExp(name) {
116
- return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
137
+ return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
117
138
  }
118
139
  function genCacheKey(source, options) {
119
- return source + JSON.stringify(
120
- options,
121
- (_, val) => typeof val === "function" ? val.toString() : val
122
- );
140
+ return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
123
141
  }
124
142
  function canSetValueDirectly(tagName) {
125
- return tagName !== "PROGRESS" && // custom elements may use _value internally
126
- !tagName.includes("-");
143
+ return tagName !== "PROGRESS" && !tagName.includes("-");
127
144
  }
128
-
145
+ //#endregion
146
+ //#region packages/shared/src/patchFlags.ts
147
+ /**
148
+ * Patch flags are optimization hints generated by the compiler.
149
+ * when a block with dynamicChildren is encountered during diff, the algorithm
150
+ * enters "optimized mode". In this mode, we know that the vdom is produced by
151
+ * a render function generated by the compiler, so the algorithm only needs to
152
+ * handle updates explicitly marked by these patch flags.
153
+ *
154
+ * Patch flags can be combined using the | bitwise operator and can be checked
155
+ * using the & operator, e.g.
156
+ *
157
+ * ```js
158
+ * const flag = TEXT | CLASS
159
+ * if (flag & TEXT) { ... }
160
+ * ```
161
+ *
162
+ * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
163
+ * flags are handled during diff.
164
+ */
129
165
  const PatchFlags = {
130
- "TEXT": 1,
131
- "1": "TEXT",
132
- "CLASS": 2,
133
- "2": "CLASS",
134
- "STYLE": 4,
135
- "4": "STYLE",
136
- "PROPS": 8,
137
- "8": "PROPS",
138
- "FULL_PROPS": 16,
139
- "16": "FULL_PROPS",
140
- "NEED_HYDRATION": 32,
141
- "32": "NEED_HYDRATION",
142
- "STABLE_FRAGMENT": 64,
143
- "64": "STABLE_FRAGMENT",
144
- "KEYED_FRAGMENT": 128,
145
- "128": "KEYED_FRAGMENT",
146
- "UNKEYED_FRAGMENT": 256,
147
- "256": "UNKEYED_FRAGMENT",
148
- "NEED_PATCH": 512,
149
- "512": "NEED_PATCH",
150
- "DYNAMIC_SLOTS": 1024,
151
- "1024": "DYNAMIC_SLOTS",
152
- "DEV_ROOT_FRAGMENT": 2048,
153
- "2048": "DEV_ROOT_FRAGMENT",
154
- "CACHED": -1,
155
- "-1": "CACHED",
156
- "BAIL": -2,
157
- "-2": "BAIL"
166
+ "TEXT": 1,
167
+ "1": "TEXT",
168
+ "CLASS": 2,
169
+ "2": "CLASS",
170
+ "STYLE": 4,
171
+ "4": "STYLE",
172
+ "PROPS": 8,
173
+ "8": "PROPS",
174
+ "FULL_PROPS": 16,
175
+ "16": "FULL_PROPS",
176
+ "NEED_HYDRATION": 32,
177
+ "32": "NEED_HYDRATION",
178
+ "STABLE_FRAGMENT": 64,
179
+ "64": "STABLE_FRAGMENT",
180
+ "KEYED_FRAGMENT": 128,
181
+ "128": "KEYED_FRAGMENT",
182
+ "UNKEYED_FRAGMENT": 256,
183
+ "256": "UNKEYED_FRAGMENT",
184
+ "NEED_PATCH": 512,
185
+ "512": "NEED_PATCH",
186
+ "DYNAMIC_SLOTS": 1024,
187
+ "1024": "DYNAMIC_SLOTS",
188
+ "DEV_ROOT_FRAGMENT": 2048,
189
+ "2048": "DEV_ROOT_FRAGMENT",
190
+ "CACHED": -1,
191
+ "-1": "CACHED",
192
+ "BAIL": -2,
193
+ "-2": "BAIL"
158
194
  };
195
+ /**
196
+ * dev only flag -> name mapping
197
+ */
159
198
  const PatchFlagNames = {
160
- [1]: `TEXT`,
161
- [2]: `CLASS`,
162
- [4]: `STYLE`,
163
- [8]: `PROPS`,
164
- [16]: `FULL_PROPS`,
165
- [32]: `NEED_HYDRATION`,
166
- [64]: `STABLE_FRAGMENT`,
167
- [128]: `KEYED_FRAGMENT`,
168
- [256]: `UNKEYED_FRAGMENT`,
169
- [512]: `NEED_PATCH`,
170
- [1024]: `DYNAMIC_SLOTS`,
171
- [2048]: `DEV_ROOT_FRAGMENT`,
172
- [-1]: `CACHED`,
173
- [-2]: `BAIL`
199
+ [1]: `TEXT`,
200
+ [2]: `CLASS`,
201
+ [4]: `STYLE`,
202
+ [8]: `PROPS`,
203
+ [16]: `FULL_PROPS`,
204
+ [32]: `NEED_HYDRATION`,
205
+ [64]: `STABLE_FRAGMENT`,
206
+ [128]: `KEYED_FRAGMENT`,
207
+ [256]: `UNKEYED_FRAGMENT`,
208
+ [512]: `NEED_PATCH`,
209
+ [1024]: `DYNAMIC_SLOTS`,
210
+ [2048]: `DEV_ROOT_FRAGMENT`,
211
+ [-1]: `CACHED`,
212
+ [-2]: `BAIL`
174
213
  };
175
-
214
+ //#endregion
215
+ //#region packages/shared/src/shapeFlags.ts
176
216
  const ShapeFlags = {
177
- "ELEMENT": 1,
178
- "1": "ELEMENT",
179
- "FUNCTIONAL_COMPONENT": 2,
180
- "2": "FUNCTIONAL_COMPONENT",
181
- "STATEFUL_COMPONENT": 4,
182
- "4": "STATEFUL_COMPONENT",
183
- "TEXT_CHILDREN": 8,
184
- "8": "TEXT_CHILDREN",
185
- "ARRAY_CHILDREN": 16,
186
- "16": "ARRAY_CHILDREN",
187
- "SLOTS_CHILDREN": 32,
188
- "32": "SLOTS_CHILDREN",
189
- "TELEPORT": 64,
190
- "64": "TELEPORT",
191
- "SUSPENSE": 128,
192
- "128": "SUSPENSE",
193
- "COMPONENT_SHOULD_KEEP_ALIVE": 256,
194
- "256": "COMPONENT_SHOULD_KEEP_ALIVE",
195
- "COMPONENT_KEPT_ALIVE": 512,
196
- "512": "COMPONENT_KEPT_ALIVE",
197
- "COMPONENT": 6,
198
- "6": "COMPONENT"
217
+ "ELEMENT": 1,
218
+ "1": "ELEMENT",
219
+ "FUNCTIONAL_COMPONENT": 2,
220
+ "2": "FUNCTIONAL_COMPONENT",
221
+ "STATEFUL_COMPONENT": 4,
222
+ "4": "STATEFUL_COMPONENT",
223
+ "TEXT_CHILDREN": 8,
224
+ "8": "TEXT_CHILDREN",
225
+ "ARRAY_CHILDREN": 16,
226
+ "16": "ARRAY_CHILDREN",
227
+ "SLOTS_CHILDREN": 32,
228
+ "32": "SLOTS_CHILDREN",
229
+ "TELEPORT": 64,
230
+ "64": "TELEPORT",
231
+ "SUSPENSE": 128,
232
+ "128": "SUSPENSE",
233
+ "COMPONENT_SHOULD_KEEP_ALIVE": 256,
234
+ "256": "COMPONENT_SHOULD_KEEP_ALIVE",
235
+ "COMPONENT_KEPT_ALIVE": 512,
236
+ "512": "COMPONENT_KEPT_ALIVE",
237
+ "COMPONENT": 6,
238
+ "6": "COMPONENT"
199
239
  };
200
-
240
+ //#endregion
241
+ //#region packages/shared/src/slotFlags.ts
201
242
  const SlotFlags = {
202
- "STABLE": 1,
203
- "1": "STABLE",
204
- "DYNAMIC": 2,
205
- "2": "DYNAMIC",
206
- "FORWARDED": 3,
207
- "3": "FORWARDED"
243
+ "STABLE": 1,
244
+ "1": "STABLE",
245
+ "DYNAMIC": 2,
246
+ "2": "DYNAMIC",
247
+ "FORWARDED": 3,
248
+ "3": "FORWARDED"
208
249
  };
250
+ /**
251
+ * Dev only
252
+ */
209
253
  const slotFlagsText = {
210
- [1]: "STABLE",
211
- [2]: "DYNAMIC",
212
- [3]: "FORWARDED"
254
+ [1]: "STABLE",
255
+ [2]: "DYNAMIC",
256
+ [3]: "FORWARDED"
213
257
  };
214
-
215
- const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
216
- const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
258
+ const isGloballyAllowed = /* @__PURE__ */ makeMap("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol");
259
+ /** @deprecated use `isGloballyAllowed` instead */
217
260
  const isGloballyWhitelisted = isGloballyAllowed;
218
-
261
+ //#endregion
262
+ //#region packages/shared/src/codeframe.ts
219
263
  const range = 2;
220
264
  function generateCodeFrame(source, start = 0, end = source.length) {
221
- start = Math.max(0, Math.min(start, source.length));
222
- end = Math.max(0, Math.min(end, source.length));
223
- if (start > end) return "";
224
- let lines = source.split(/(\r?\n)/);
225
- const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
226
- lines = lines.filter((_, idx) => idx % 2 === 0);
227
- let count = 0;
228
- const res = [];
229
- for (let i = 0; i < lines.length; i++) {
230
- count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
231
- if (count >= start) {
232
- for (let j = i - range; j <= i + range || end > count; j++) {
233
- if (j < 0 || j >= lines.length) continue;
234
- const line = j + 1;
235
- res.push(
236
- `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
237
- );
238
- const lineLength = lines[j].length;
239
- const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
240
- if (j === i) {
241
- const pad = start - (count - (lineLength + newLineSeqLength));
242
- const length = Math.max(
243
- 1,
244
- end > count ? lineLength - pad : end - start
245
- );
246
- res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
247
- } else if (j > i) {
248
- if (end > count) {
249
- const length = Math.max(Math.min(end - count, lineLength), 1);
250
- res.push(` | ` + "^".repeat(length));
251
- }
252
- count += lineLength + newLineSeqLength;
253
- }
254
- }
255
- break;
256
- }
257
- }
258
- return res.join("\n");
265
+ start = Math.max(0, Math.min(start, source.length));
266
+ end = Math.max(0, Math.min(end, source.length));
267
+ if (start > end) return "";
268
+ let lines = source.split(/(\r?\n)/);
269
+ const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
270
+ lines = lines.filter((_, idx) => idx % 2 === 0);
271
+ let count = 0;
272
+ const res = [];
273
+ for (let i = 0; i < lines.length; i++) {
274
+ count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
275
+ if (count >= start) {
276
+ for (let j = i - range; j <= i + range || end > count; j++) {
277
+ if (j < 0 || j >= lines.length) continue;
278
+ const line = j + 1;
279
+ res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
280
+ const lineLength = lines[j].length;
281
+ const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
282
+ if (j === i) {
283
+ const pad = start - (count - (lineLength + newLineSeqLength));
284
+ const length = Math.max(1, end > count ? lineLength - pad : end - start);
285
+ res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
286
+ } else if (j > i) {
287
+ if (end > count) {
288
+ const length = Math.max(Math.min(end - count, lineLength), 1);
289
+ res.push(` | ` + "^".repeat(length));
290
+ }
291
+ count += lineLength + newLineSeqLength;
292
+ }
293
+ }
294
+ break;
295
+ }
296
+ }
297
+ return res.join("\n");
259
298
  }
260
-
299
+ //#endregion
300
+ //#region packages/shared/src/normalizeProp.ts
261
301
  function normalizeStyle(value) {
262
- if (isArray(value)) {
263
- const res = {};
264
- for (let i = 0; i < value.length; i++) {
265
- const item = value[i];
266
- const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
267
- if (normalized) {
268
- for (const key in normalized) {
269
- res[key] = normalized[key];
270
- }
271
- }
272
- }
273
- return res;
274
- } else if (isString(value) || isObject(value)) {
275
- return value;
276
- }
302
+ if (isArray(value)) {
303
+ const res = {};
304
+ for (let i = 0; i < value.length; i++) {
305
+ const item = value[i];
306
+ const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
307
+ if (normalized) for (const key in normalized) res[key] = normalized[key];
308
+ }
309
+ return res;
310
+ } else if (isString(value) || isObject(value)) return value;
277
311
  }
278
312
  const listDelimiterRE = /;(?![^(]*\))/g;
279
313
  const propertyDelimiterRE = /:([^]+)/;
280
314
  const styleCommentRE = /\/\*[^]*?\*\//g;
281
315
  function parseStringStyle(cssText) {
282
- const ret = {};
283
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
284
- if (item) {
285
- const tmp = item.split(propertyDelimiterRE);
286
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
287
- }
288
- });
289
- return ret;
316
+ const ret = {};
317
+ cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
318
+ if (item) {
319
+ const tmp = item.split(propertyDelimiterRE);
320
+ tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
321
+ }
322
+ });
323
+ return ret;
290
324
  }
291
325
  function stringifyStyle(styles) {
292
- if (!styles) return "";
293
- if (isString(styles)) return styles;
294
- let ret = "";
295
- for (const key in styles) {
296
- const value = styles[key];
297
- if (isString(value) || typeof value === "number") {
298
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
299
- ret += `${normalizedKey}:${value};`;
300
- }
301
- }
302
- return ret;
326
+ if (!styles) return "";
327
+ if (isString(styles)) return styles;
328
+ let ret = "";
329
+ for (const key in styles) {
330
+ const value = styles[key];
331
+ if (isString(value) || typeof value === "number") {
332
+ const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
333
+ ret += `${normalizedKey}:${value};`;
334
+ }
335
+ }
336
+ return ret;
303
337
  }
304
338
  function normalizeClass(value) {
305
- let res = "";
306
- if (isString(value)) {
307
- res = value;
308
- } else if (isArray(value)) {
309
- for (let i = 0; i < value.length; i++) {
310
- const normalized = normalizeClass(value[i]);
311
- if (normalized) {
312
- res += normalized + " ";
313
- }
314
- }
315
- } else if (isObject(value)) {
316
- for (const name in value) {
317
- if (value[name]) {
318
- res += name + " ";
319
- }
320
- }
321
- }
322
- return res.trim();
339
+ let res = "";
340
+ if (isString(value)) res = value;
341
+ else if (isArray(value)) for (let i = 0; i < value.length; i++) {
342
+ const normalized = normalizeClass(value[i]);
343
+ if (normalized) res += normalized + " ";
344
+ }
345
+ else if (isObject(value)) {
346
+ for (const name in value) if (value[name]) res += name + " ";
347
+ }
348
+ return res.trim();
323
349
  }
324
350
  function normalizeProps(props) {
325
- if (!props) return null;
326
- let { class: klass, style } = props;
327
- if (klass && !isString(klass)) {
328
- props.class = normalizeClass(klass);
329
- }
330
- if (style) {
331
- props.style = normalizeStyle(style);
332
- }
333
- return props;
351
+ if (!props) return null;
352
+ let { class: klass, style } = props;
353
+ if (klass && !isString(klass)) props.class = normalizeClass(klass);
354
+ if (style) props.style = normalizeStyle(style);
355
+ return props;
334
356
  }
335
-
357
+ //#endregion
358
+ //#region packages/shared/src/domTagConfig.ts
336
359
  const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
337
360
  const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
338
361
  const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
339
362
  const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
363
+ const FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
364
+ const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset";
365
+ const INLINE_TAGS = "a,abbr,acronym,b,bdi,bdo,big,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,label,map,mark,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,small,span,strong,sub,sup,svg,textarea,time,u,tt,var,video";
366
+ const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,main,menu,nav,ol,p,pre,section,table,ul";
367
+ /**
368
+ * Compiler only.
369
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
370
+ */
340
371
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
372
+ /**
373
+ * Compiler only.
374
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
375
+ */
341
376
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
377
+ /**
378
+ * Compiler only.
379
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
380
+ */
342
381
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
382
+ /**
383
+ * Compiler only.
384
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
385
+ */
343
386
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
344
-
387
+ /**
388
+ * Compiler only.
389
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
390
+ */
391
+ const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS);
392
+ /**
393
+ * Compiler only.
394
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
395
+ */
396
+ const isAlwaysCloseTag = /* @__PURE__ */ makeMap(ALWAYS_CLOSE_TAGS);
397
+ /**
398
+ * Compiler only.
399
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
400
+ */
401
+ const isInlineTag = /* @__PURE__ */ makeMap(INLINE_TAGS);
402
+ /**
403
+ * Compiler only.
404
+ * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
405
+ */
406
+ const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
407
+ //#endregion
408
+ //#region packages/shared/src/domAttrConfig.ts
409
+ /**
410
+ * On the client we only need to offer special cases for boolean attributes that
411
+ * have different names from their corresponding dom properties:
412
+ * - itemscope -> N/A
413
+ * - allowfullscreen -> allowFullscreen
414
+ * - formnovalidate -> formNoValidate
415
+ * - ismap -> isMap
416
+ * - nomodule -> noModule
417
+ * - novalidate -> noValidate
418
+ * - readonly -> readOnly
419
+ */
345
420
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
346
421
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
347
- const isBooleanAttr = /* @__PURE__ */ makeMap(
348
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
349
- );
422
+ /**
423
+ * The full list is needed during SSR to produce the correct initial markup.
424
+ */
425
+ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
426
+ /**
427
+ * Boolean attributes should be included if the value is truthy or ''.
428
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
429
+ */
350
430
  function includeBooleanAttr(value) {
351
- return !!value || value === "";
431
+ return !!value || value === "";
352
432
  }
353
433
  const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
354
434
  const attrValidationCache = {};
355
435
  function isSSRSafeAttrName(name) {
356
- if (attrValidationCache.hasOwnProperty(name)) {
357
- return attrValidationCache[name];
358
- }
359
- const isUnsafe = unsafeAttrCharRE.test(name);
360
- if (isUnsafe) {
361
- console.error(`unsafe attribute name: ${name}`);
362
- }
363
- return attrValidationCache[name] = !isUnsafe;
436
+ if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name];
437
+ const isUnsafe = unsafeAttrCharRE.test(name);
438
+ if (isUnsafe) console.error(`unsafe attribute name: ${name}`);
439
+ return attrValidationCache[name] = !isUnsafe;
364
440
  }
365
441
  const propsToAttrMap = {
366
- acceptCharset: "accept-charset",
367
- className: "class",
368
- htmlFor: "for",
369
- httpEquiv: "http-equiv"
442
+ acceptCharset: "accept-charset",
443
+ className: "class",
444
+ htmlFor: "for",
445
+ httpEquiv: "http-equiv"
370
446
  };
371
- const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
372
- `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
373
- );
374
- const isKnownSvgAttr = /* @__PURE__ */ makeMap(
375
- `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
376
- );
377
- const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
378
- `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
379
- );
447
+ /**
448
+ * Known attributes, this is used for stringification of runtime static nodes
449
+ * so that we don't stringify bindings that cannot be set from HTML.
450
+ * Don't also forget to allow `data-*` and `aria-*`!
451
+ * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
452
+ */
453
+ const isKnownHtmlAttr = /* @__PURE__ */ makeMap("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap");
454
+ /**
455
+ * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
456
+ */
457
+ const isKnownSvgAttr = /* @__PURE__ */ makeMap("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan");
458
+ /**
459
+ * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
460
+ */
461
+ const isKnownMathMLAttr = /* @__PURE__ */ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns");
462
+ /**
463
+ * Shared between server-renderer and runtime-core hydration logic
464
+ */
380
465
  function isRenderableAttrValue(value) {
381
- if (value == null) {
382
- return false;
383
- }
384
- const type = typeof value;
385
- return type === "string" || type === "number" || type === "boolean";
466
+ if (value == null) return false;
467
+ const type = typeof value;
468
+ return type === "string" || type === "number" || type === "boolean";
386
469
  }
387
470
  function shouldSetAsAttr(tagName, key) {
388
- if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
389
- return true;
390
- }
391
- if (key === "form") {
392
- return true;
393
- }
394
- if (key === "list" && tagName === "INPUT") {
395
- return true;
396
- }
397
- if (key === "type" && tagName === "TEXTAREA") {
398
- return true;
399
- }
400
- if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
401
- return true;
402
- }
403
- if (key === "sandbox" && tagName === "IFRAME") {
404
- return true;
405
- }
406
- return false;
471
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true;
472
+ if (key === "form") return true;
473
+ if (key === "list" && tagName === "INPUT") return true;
474
+ if (key === "type" && tagName === "TEXTAREA") return true;
475
+ if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true;
476
+ if (key === "sandbox" && tagName === "IFRAME") return true;
477
+ return false;
407
478
  }
408
-
479
+ //#endregion
480
+ //#region packages/shared/src/domNamespace.ts
409
481
  const Namespaces = {
410
- "HTML": 0,
411
- "0": "HTML",
412
- "SVG": 1,
413
- "1": "SVG",
414
- "MATH_ML": 2,
415
- "2": "MATH_ML"
482
+ "HTML": 0,
483
+ "0": "HTML",
484
+ "SVG": 1,
485
+ "1": "SVG",
486
+ "MATH_ML": 2,
487
+ "2": "MATH_ML"
416
488
  };
417
-
489
+ //#endregion
490
+ //#region packages/shared/src/escapeHtml.ts
418
491
  const escapeRE = /["'&<>]/;
419
492
  function escapeHtml(string) {
420
- const str = "" + string;
421
- const match = escapeRE.exec(str);
422
- if (!match) {
423
- return str;
424
- }
425
- let html = "";
426
- let escaped;
427
- let index;
428
- let lastIndex = 0;
429
- for (index = match.index; index < str.length; index++) {
430
- switch (str.charCodeAt(index)) {
431
- case 34:
432
- escaped = "&quot;";
433
- break;
434
- case 38:
435
- escaped = "&amp;";
436
- break;
437
- case 39:
438
- escaped = "&#39;";
439
- break;
440
- case 60:
441
- escaped = "&lt;";
442
- break;
443
- case 62:
444
- escaped = "&gt;";
445
- break;
446
- default:
447
- continue;
448
- }
449
- if (lastIndex !== index) {
450
- html += str.slice(lastIndex, index);
451
- }
452
- lastIndex = index + 1;
453
- html += escaped;
454
- }
455
- return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
493
+ const str = "" + string;
494
+ const match = escapeRE.exec(str);
495
+ if (!match) return str;
496
+ let html = "";
497
+ let escaped;
498
+ let index;
499
+ let lastIndex = 0;
500
+ for (index = match.index; index < str.length; index++) {
501
+ switch (str.charCodeAt(index)) {
502
+ case 34:
503
+ escaped = "&quot;";
504
+ break;
505
+ case 38:
506
+ escaped = "&amp;";
507
+ break;
508
+ case 39:
509
+ escaped = "&#39;";
510
+ break;
511
+ case 60:
512
+ escaped = "&lt;";
513
+ break;
514
+ case 62:
515
+ escaped = "&gt;";
516
+ break;
517
+ default: continue;
518
+ }
519
+ if (lastIndex !== index) html += str.slice(lastIndex, index);
520
+ lastIndex = index + 1;
521
+ html += escaped;
522
+ }
523
+ return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
456
524
  }
457
525
  const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
458
526
  function escapeHtmlComment(src) {
459
- return src.replace(commentStripRE, "");
527
+ return src.replace(commentStripRE, "");
460
528
  }
461
529
  const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
462
530
  function getEscapedCssVarName(key, doubleEscape) {
463
- return key.replace(
464
- cssVarNameEscapeSymbolsRE,
465
- (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
466
- );
531
+ return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`);
467
532
  }
468
-
533
+ //#endregion
534
+ //#region packages/shared/src/looseEqual.ts
469
535
  function looseCompareArrays(a, b) {
470
- if (a.length !== b.length) return false;
471
- let equal = true;
472
- for (let i = 0; equal && i < a.length; i++) {
473
- equal = looseEqual(a[i], b[i]);
474
- }
475
- return equal;
536
+ if (a.length !== b.length) return false;
537
+ let equal = true;
538
+ for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]);
539
+ return equal;
476
540
  }
477
541
  function looseEqual(a, b) {
478
- if (a === b) return true;
479
- let aValidType = isDate(a);
480
- let bValidType = isDate(b);
481
- if (aValidType || bValidType) {
482
- return aValidType && bValidType ? a.getTime() === b.getTime() : false;
483
- }
484
- aValidType = isSymbol(a);
485
- bValidType = isSymbol(b);
486
- if (aValidType || bValidType) {
487
- return a === b;
488
- }
489
- aValidType = isArray(a);
490
- bValidType = isArray(b);
491
- if (aValidType || bValidType) {
492
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
493
- }
494
- aValidType = isObject(a);
495
- bValidType = isObject(b);
496
- if (aValidType || bValidType) {
497
- if (!aValidType || !bValidType) {
498
- return false;
499
- }
500
- const aKeysCount = Object.keys(a).length;
501
- const bKeysCount = Object.keys(b).length;
502
- if (aKeysCount !== bKeysCount) {
503
- return false;
504
- }
505
- for (const key in a) {
506
- const aHasKey = a.hasOwnProperty(key);
507
- const bHasKey = b.hasOwnProperty(key);
508
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
509
- return false;
510
- }
511
- }
512
- }
513
- return String(a) === String(b);
542
+ if (a === b) return true;
543
+ let aValidType = isDate(a);
544
+ let bValidType = isDate(b);
545
+ if (aValidType || bValidType) return aValidType && bValidType ? a.getTime() === b.getTime() : false;
546
+ aValidType = isSymbol(a);
547
+ bValidType = isSymbol(b);
548
+ if (aValidType || bValidType) return a === b;
549
+ aValidType = isArray(a);
550
+ bValidType = isArray(b);
551
+ if (aValidType || bValidType) return aValidType && bValidType ? looseCompareArrays(a, b) : false;
552
+ aValidType = isObject(a);
553
+ bValidType = isObject(b);
554
+ if (aValidType || bValidType) {
555
+ if (!aValidType || !bValidType) return false;
556
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
557
+ for (const key in a) {
558
+ const aHasKey = a.hasOwnProperty(key);
559
+ const bHasKey = b.hasOwnProperty(key);
560
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false;
561
+ }
562
+ }
563
+ return String(a) === String(b);
514
564
  }
515
565
  function looseIndexOf(arr, val) {
516
- return arr.findIndex((item) => looseEqual(item, val));
566
+ return arr.findIndex((item) => looseEqual(item, val));
517
567
  }
518
-
568
+ //#endregion
569
+ //#region packages/shared/src/toDisplayString.ts
519
570
  const isRef = (val) => {
520
- return !!(val && val["__v_isRef"] === true);
571
+ return !!(val && val["__v_isRef"] === true);
521
572
  };
573
+ /**
574
+ * For converting {{ interpolation }} values to displayed strings.
575
+ * @private
576
+ */
522
577
  const toDisplayString = (val) => {
523
- switch (typeof val) {
524
- case "string":
525
- return val;
526
- case "object":
527
- if (val) {
528
- if (isRef(val)) {
529
- return toDisplayString(val.value);
530
- } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
531
- return JSON.stringify(val, replacer, 2);
532
- }
533
- }
534
- default:
535
- return val == null ? "" : String(val);
536
- }
578
+ switch (typeof val) {
579
+ case "string": return val;
580
+ case "object": if (val) {
581
+ if (isRef(val)) return toDisplayString(val.value);
582
+ else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2);
583
+ }
584
+ default: return val == null ? "" : String(val);
585
+ }
537
586
  };
538
587
  const replacer = (_key, val) => {
539
- if (isRef(val)) {
540
- return replacer(_key, val.value);
541
- } else if (isMap(val)) {
542
- return {
543
- [`Map(${val.size})`]: [...val.entries()].reduce(
544
- (entries, [key, val2], i) => {
545
- entries[stringifySymbol(key, i) + " =>"] = val2;
546
- return entries;
547
- },
548
- {}
549
- )
550
- };
551
- } else if (isSet(val)) {
552
- return {
553
- [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
554
- };
555
- } else if (isSymbol(val)) {
556
- return stringifySymbol(val);
557
- } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
558
- return String(val);
559
- }
560
- return val;
588
+ if (isRef(val)) return replacer(_key, val.value);
589
+ else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => {
590
+ entries[stringifySymbol(key, i) + " =>"] = val;
591
+ return entries;
592
+ }, {}) };
593
+ else if (isSet(val)) return { [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) };
594
+ else if (isSymbol(val)) return stringifySymbol(val);
595
+ else if (isObject(val) && !isArray(val) && !isPlainObject(val)) return String(val);
596
+ return val;
561
597
  };
562
598
  const stringifySymbol = (v, i = "") => {
563
- var _a;
564
- return (
565
- // Symbol.description in es2019+ so we need to cast here to pass
566
- // the lib: es2016 check
567
- isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
568
- );
599
+ var _description;
600
+ return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v;
569
601
  };
570
-
602
+ //#endregion
603
+ //#region packages/shared/src/subSequence.ts
571
604
  function getSequence(arr) {
572
- const p = arr.slice();
573
- const result = [0];
574
- let i, j, u, v, c;
575
- const len = arr.length;
576
- for (i = 0; i < len; i++) {
577
- const arrI = arr[i];
578
- if (arrI !== 0) {
579
- j = result[result.length - 1];
580
- if (arr[j] < arrI) {
581
- p[i] = j;
582
- result.push(i);
583
- continue;
584
- }
585
- u = 0;
586
- v = result.length - 1;
587
- while (u < v) {
588
- c = u + v >> 1;
589
- if (arr[result[c]] < arrI) {
590
- u = c + 1;
591
- } else {
592
- v = c;
593
- }
594
- }
595
- if (arrI < arr[result[u]]) {
596
- if (u > 0) {
597
- p[i] = result[u - 1];
598
- }
599
- result[u] = i;
600
- }
601
- }
602
- }
603
- u = result.length;
604
- v = result[u - 1];
605
- while (u-- > 0) {
606
- result[u] = v;
607
- v = p[v];
608
- }
609
- return result;
605
+ const p = arr.slice();
606
+ const result = [0];
607
+ let i, j, u, v, c;
608
+ const len = arr.length;
609
+ for (i = 0; i < len; i++) {
610
+ const arrI = arr[i];
611
+ if (arrI !== 0) {
612
+ j = result[result.length - 1];
613
+ if (arr[j] < arrI) {
614
+ p[i] = j;
615
+ result.push(i);
616
+ continue;
617
+ }
618
+ u = 0;
619
+ v = result.length - 1;
620
+ while (u < v) {
621
+ c = u + v >> 1;
622
+ if (arr[result[c]] < arrI) u = c + 1;
623
+ else v = c;
624
+ }
625
+ if (arrI < arr[result[u]]) {
626
+ if (u > 0) p[i] = result[u - 1];
627
+ result[u] = i;
628
+ }
629
+ }
630
+ }
631
+ u = result.length;
632
+ v = result[u - 1];
633
+ while (u-- > 0) {
634
+ result[u] = v;
635
+ v = p[v];
636
+ }
637
+ return result;
610
638
  }
611
-
639
+ //#endregion
640
+ //#region packages/shared/src/cssVars.ts
641
+ /**
642
+ * Normalize CSS var value created by `v-bind` in `<style>` block
643
+ * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
644
+ */
612
645
  function normalizeCssVarValue(value) {
613
- if (value == null) {
614
- return "initial";
615
- }
616
- if (typeof value === "string") {
617
- return value === "" ? " " : value;
618
- }
619
- if (typeof value !== "number" || !Number.isFinite(value)) {
620
- if (!!(process.env.NODE_ENV !== "production")) {
621
- console.warn(
622
- "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
623
- value
624
- );
625
- }
626
- }
627
- return String(value);
646
+ if (value == null) return "initial";
647
+ if (typeof value === "string") return value === "" ? " " : value;
648
+ if (typeof value !== "number" || !Number.isFinite(value)) {
649
+ if (!!(process.env.NODE_ENV !== "production")) console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", value);
650
+ }
651
+ return String(value);
628
652
  }
629
-
630
- export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
653
+ //#endregion
654
+ //#region packages/shared/src/vaporFlags.ts
655
+ /**
656
+ * Flags to optimize vapor `createFor` runtime behavior, shared between the
657
+ * compiler and the runtime
658
+ */
659
+ const VaporVForFlags = {
660
+ "FAST_REMOVE": 1,
661
+ "1": "FAST_REMOVE",
662
+ "IS_COMPONENT": 2,
663
+ "2": "IS_COMPONENT",
664
+ "ONCE": 4,
665
+ "4": "ONCE"
666
+ };
667
+ const VaporBlockShape = {
668
+ "EMPTY": 0,
669
+ "0": "EMPTY",
670
+ "SINGLE_ROOT": 1,
671
+ "1": "SINGLE_ROOT",
672
+ "MULTI_ROOT": 2,
673
+ "2": "MULTI_ROOT"
674
+ };
675
+ //#endregion
676
+ export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, VaporBlockShape, VaporVForFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBlockTag, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isInlineTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };