@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,36 +1,46 @@
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
- 'use strict';
7
-
8
- Object.defineProperty(exports, '__esModule', { value: true });
9
-
10
- // @__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
+ Object.defineProperties(exports, {
7
+ __esModule: { value: true },
8
+ [Symbol.toStringTag]: { value: "Module" }
9
+ });
10
+ //#region packages/shared/src/makeMap.ts
11
+ /**
12
+ * Make a map and return a function for checking if a key
13
+ * is in that map.
14
+ * IMPORTANT: all calls of this function must be prefixed with
15
+ * \/\*#\_\_PURE\_\_\*\/
16
+ * So that they can be tree-shaken if necessary.
17
+ */
18
+ /* @__NO_SIDE_EFFECTS__ */
11
19
  function makeMap(str) {
12
- const map = /* @__PURE__ */ Object.create(null);
13
- for (const key of str.split(",")) map[key] = 1;
14
- return (val) => val in map;
20
+ const map = Object.create(null);
21
+ for (const key of str.split(",")) map[key] = 1;
22
+ return (val) => val in map;
15
23
  }
16
-
17
- const EMPTY_OBJ = Object.freeze({}) ;
18
- const EMPTY_ARR = Object.freeze([]) ;
19
- const NOOP = () => {
20
- };
24
+ //#endregion
25
+ //#region packages/shared/src/general.ts
26
+ const EMPTY_OBJ = Object.freeze({});
27
+ const EMPTY_ARR = Object.freeze([]);
28
+ const NOOP = () => {};
29
+ /**
30
+ * Always return true.
31
+ */
21
32
  const YES = () => true;
33
+ /**
34
+ * Always return false.
35
+ */
22
36
  const NO = () => false;
23
- const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
24
- (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
25
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
26
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
37
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
38
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
27
39
  const isModelListener = (key) => key.startsWith("onUpdate:");
28
40
  const extend = Object.assign;
29
41
  const remove = (arr, el) => {
30
- const i = arr.indexOf(el);
31
- if (i > -1) {
32
- arr.splice(i, 1);
33
- }
42
+ const i = arr.indexOf(el);
43
+ if (i > -1) arr.splice(i, 1);
34
44
  };
35
45
  const hasOwnProperty = Object.prototype.hasOwnProperty;
36
46
  const hasOwn = (val, key) => hasOwnProperty.call(val, key);
@@ -44,593 +54,627 @@ const isString = (val) => typeof val === "string";
44
54
  const isSymbol = (val) => typeof val === "symbol";
45
55
  const isObject = (val) => val !== null && typeof val === "object";
46
56
  const isPromise = (val) => {
47
- return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
57
+ return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
48
58
  };
49
59
  const objectToString = Object.prototype.toString;
50
60
  const toTypeString = (value) => objectToString.call(value);
51
61
  const toRawType = (value) => {
52
- return toTypeString(value).slice(8, -1);
62
+ return toTypeString(value).slice(8, -1);
53
63
  };
54
64
  const isPlainObject = (val) => toTypeString(val) === "[object Object]";
55
65
  const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
56
- const isReservedProp = /* @__PURE__ */ makeMap(
57
- // the leading comma is intentional so empty string "" is also included
58
- ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
59
- );
66
+ const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
60
67
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
61
- const isBuiltInDirective = /* @__PURE__ */ makeMap(
62
- "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
63
- );
68
+ const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
64
69
  const cacheStringFunction = (fn) => {
65
- const cache = /* @__PURE__ */ Object.create(null);
66
- return ((str) => {
67
- const hit = cache[str];
68
- return hit || (cache[str] = fn(str));
69
- });
70
+ const cache = Object.create(null);
71
+ return ((str) => {
72
+ return cache[str] || (cache[str] = fn(str));
73
+ });
70
74
  };
71
75
  const camelizeRE = /-(\w)/g;
72
76
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
73
- const camelize = cacheStringFunction(
74
- (str) => str.replace(camelizeRE, camelizeReplacer)
75
- );
77
+ /**
78
+ * @private
79
+ */
80
+ const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
76
81
  const hyphenateRE = /\B([A-Z])/g;
77
- const hyphenate = cacheStringFunction(
78
- (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
79
- );
82
+ /**
83
+ * @private
84
+ */
85
+ const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
86
+ /**
87
+ * @private
88
+ */
80
89
  const capitalize = cacheStringFunction((str) => {
81
- return str.charAt(0).toUpperCase() + str.slice(1);
90
+ return str.charAt(0).toUpperCase() + str.slice(1);
91
+ });
92
+ /**
93
+ * @private
94
+ */
95
+ const toHandlerKey = cacheStringFunction((str) => {
96
+ return str ? `on${capitalize(str)}` : ``;
82
97
  });
83
- const toHandlerKey = cacheStringFunction(
84
- (str) => {
85
- const s = str ? `on${capitalize(str)}` : ``;
86
- return s;
87
- }
88
- );
98
+ /**
99
+ * #13070 When v-model and v-model:model directives are used together,
100
+ * they will generate the same modelModifiers prop,
101
+ * so a `$` suffix is added to avoid conflicts.
102
+ * @private
103
+ */
89
104
  const getModifierPropName = (name) => {
90
- return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
105
+ return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
91
106
  };
92
107
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
93
108
  const invokeArrayFns = (fns, ...arg) => {
94
- for (let i = 0; i < fns.length; i++) {
95
- fns[i](...arg);
96
- }
109
+ for (let i = 0; i < fns.length; i++) fns[i](...arg);
97
110
  };
98
111
  const def = (obj, key, value, writable = false) => {
99
- Object.defineProperty(obj, key, {
100
- configurable: true,
101
- enumerable: false,
102
- writable,
103
- value
104
- });
112
+ Object.defineProperty(obj, key, {
113
+ configurable: true,
114
+ enumerable: false,
115
+ writable,
116
+ value
117
+ });
105
118
  };
119
+ /**
120
+ * "123-foo" will be parsed to 123
121
+ * This is used for the .number modifier in v-model
122
+ */
106
123
  const looseToNumber = (val) => {
107
- const n = parseFloat(val);
108
- return isNaN(n) ? val : n;
124
+ const n = parseFloat(val);
125
+ return isNaN(n) ? val : n;
109
126
  };
127
+ /**
128
+ * Only concerns number-like strings
129
+ * "123-foo" will be returned as-is
130
+ */
110
131
  const toNumber = (val) => {
111
- const n = isString(val) ? Number(val) : NaN;
112
- return isNaN(n) ? val : n;
132
+ const n = isString(val) ? Number(val) : NaN;
133
+ return isNaN(n) ? val : n;
113
134
  };
114
135
  let _globalThis;
115
136
  const getGlobalThis = () => {
116
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
137
+ return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
117
138
  };
118
139
  const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
119
140
  function genPropsAccessExp(name) {
120
- return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
141
+ return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
121
142
  }
122
143
  function genCacheKey(source, options) {
123
- return source + JSON.stringify(
124
- options,
125
- (_, val) => typeof val === "function" ? val.toString() : val
126
- );
144
+ return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
127
145
  }
128
146
  function canSetValueDirectly(tagName) {
129
- return tagName !== "PROGRESS" && // custom elements may use _value internally
130
- !tagName.includes("-");
147
+ return tagName !== "PROGRESS" && !tagName.includes("-");
131
148
  }
132
-
149
+ //#endregion
150
+ //#region packages/shared/src/patchFlags.ts
151
+ /**
152
+ * Patch flags are optimization hints generated by the compiler.
153
+ * when a block with dynamicChildren is encountered during diff, the algorithm
154
+ * enters "optimized mode". In this mode, we know that the vdom is produced by
155
+ * a render function generated by the compiler, so the algorithm only needs to
156
+ * handle updates explicitly marked by these patch flags.
157
+ *
158
+ * Patch flags can be combined using the | bitwise operator and can be checked
159
+ * using the & operator, e.g.
160
+ *
161
+ * ```js
162
+ * const flag = TEXT | CLASS
163
+ * if (flag & TEXT) { ... }
164
+ * ```
165
+ *
166
+ * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
167
+ * flags are handled during diff.
168
+ */
133
169
  const PatchFlags = {
134
- "TEXT": 1,
135
- "1": "TEXT",
136
- "CLASS": 2,
137
- "2": "CLASS",
138
- "STYLE": 4,
139
- "4": "STYLE",
140
- "PROPS": 8,
141
- "8": "PROPS",
142
- "FULL_PROPS": 16,
143
- "16": "FULL_PROPS",
144
- "NEED_HYDRATION": 32,
145
- "32": "NEED_HYDRATION",
146
- "STABLE_FRAGMENT": 64,
147
- "64": "STABLE_FRAGMENT",
148
- "KEYED_FRAGMENT": 128,
149
- "128": "KEYED_FRAGMENT",
150
- "UNKEYED_FRAGMENT": 256,
151
- "256": "UNKEYED_FRAGMENT",
152
- "NEED_PATCH": 512,
153
- "512": "NEED_PATCH",
154
- "DYNAMIC_SLOTS": 1024,
155
- "1024": "DYNAMIC_SLOTS",
156
- "DEV_ROOT_FRAGMENT": 2048,
157
- "2048": "DEV_ROOT_FRAGMENT",
158
- "CACHED": -1,
159
- "-1": "CACHED",
160
- "BAIL": -2,
161
- "-2": "BAIL"
170
+ "TEXT": 1,
171
+ "1": "TEXT",
172
+ "CLASS": 2,
173
+ "2": "CLASS",
174
+ "STYLE": 4,
175
+ "4": "STYLE",
176
+ "PROPS": 8,
177
+ "8": "PROPS",
178
+ "FULL_PROPS": 16,
179
+ "16": "FULL_PROPS",
180
+ "NEED_HYDRATION": 32,
181
+ "32": "NEED_HYDRATION",
182
+ "STABLE_FRAGMENT": 64,
183
+ "64": "STABLE_FRAGMENT",
184
+ "KEYED_FRAGMENT": 128,
185
+ "128": "KEYED_FRAGMENT",
186
+ "UNKEYED_FRAGMENT": 256,
187
+ "256": "UNKEYED_FRAGMENT",
188
+ "NEED_PATCH": 512,
189
+ "512": "NEED_PATCH",
190
+ "DYNAMIC_SLOTS": 1024,
191
+ "1024": "DYNAMIC_SLOTS",
192
+ "DEV_ROOT_FRAGMENT": 2048,
193
+ "2048": "DEV_ROOT_FRAGMENT",
194
+ "CACHED": -1,
195
+ "-1": "CACHED",
196
+ "BAIL": -2,
197
+ "-2": "BAIL"
162
198
  };
199
+ /**
200
+ * dev only flag -> name mapping
201
+ */
163
202
  const PatchFlagNames = {
164
- [1]: `TEXT`,
165
- [2]: `CLASS`,
166
- [4]: `STYLE`,
167
- [8]: `PROPS`,
168
- [16]: `FULL_PROPS`,
169
- [32]: `NEED_HYDRATION`,
170
- [64]: `STABLE_FRAGMENT`,
171
- [128]: `KEYED_FRAGMENT`,
172
- [256]: `UNKEYED_FRAGMENT`,
173
- [512]: `NEED_PATCH`,
174
- [1024]: `DYNAMIC_SLOTS`,
175
- [2048]: `DEV_ROOT_FRAGMENT`,
176
- [-1]: `CACHED`,
177
- [-2]: `BAIL`
203
+ [1]: `TEXT`,
204
+ [2]: `CLASS`,
205
+ [4]: `STYLE`,
206
+ [8]: `PROPS`,
207
+ [16]: `FULL_PROPS`,
208
+ [32]: `NEED_HYDRATION`,
209
+ [64]: `STABLE_FRAGMENT`,
210
+ [128]: `KEYED_FRAGMENT`,
211
+ [256]: `UNKEYED_FRAGMENT`,
212
+ [512]: `NEED_PATCH`,
213
+ [1024]: `DYNAMIC_SLOTS`,
214
+ [2048]: `DEV_ROOT_FRAGMENT`,
215
+ [-1]: `CACHED`,
216
+ [-2]: `BAIL`
178
217
  };
179
-
218
+ //#endregion
219
+ //#region packages/shared/src/shapeFlags.ts
180
220
  const ShapeFlags = {
181
- "ELEMENT": 1,
182
- "1": "ELEMENT",
183
- "FUNCTIONAL_COMPONENT": 2,
184
- "2": "FUNCTIONAL_COMPONENT",
185
- "STATEFUL_COMPONENT": 4,
186
- "4": "STATEFUL_COMPONENT",
187
- "TEXT_CHILDREN": 8,
188
- "8": "TEXT_CHILDREN",
189
- "ARRAY_CHILDREN": 16,
190
- "16": "ARRAY_CHILDREN",
191
- "SLOTS_CHILDREN": 32,
192
- "32": "SLOTS_CHILDREN",
193
- "TELEPORT": 64,
194
- "64": "TELEPORT",
195
- "SUSPENSE": 128,
196
- "128": "SUSPENSE",
197
- "COMPONENT_SHOULD_KEEP_ALIVE": 256,
198
- "256": "COMPONENT_SHOULD_KEEP_ALIVE",
199
- "COMPONENT_KEPT_ALIVE": 512,
200
- "512": "COMPONENT_KEPT_ALIVE",
201
- "COMPONENT": 6,
202
- "6": "COMPONENT"
221
+ "ELEMENT": 1,
222
+ "1": "ELEMENT",
223
+ "FUNCTIONAL_COMPONENT": 2,
224
+ "2": "FUNCTIONAL_COMPONENT",
225
+ "STATEFUL_COMPONENT": 4,
226
+ "4": "STATEFUL_COMPONENT",
227
+ "TEXT_CHILDREN": 8,
228
+ "8": "TEXT_CHILDREN",
229
+ "ARRAY_CHILDREN": 16,
230
+ "16": "ARRAY_CHILDREN",
231
+ "SLOTS_CHILDREN": 32,
232
+ "32": "SLOTS_CHILDREN",
233
+ "TELEPORT": 64,
234
+ "64": "TELEPORT",
235
+ "SUSPENSE": 128,
236
+ "128": "SUSPENSE",
237
+ "COMPONENT_SHOULD_KEEP_ALIVE": 256,
238
+ "256": "COMPONENT_SHOULD_KEEP_ALIVE",
239
+ "COMPONENT_KEPT_ALIVE": 512,
240
+ "512": "COMPONENT_KEPT_ALIVE",
241
+ "COMPONENT": 6,
242
+ "6": "COMPONENT"
203
243
  };
204
-
244
+ //#endregion
245
+ //#region packages/shared/src/slotFlags.ts
205
246
  const SlotFlags = {
206
- "STABLE": 1,
207
- "1": "STABLE",
208
- "DYNAMIC": 2,
209
- "2": "DYNAMIC",
210
- "FORWARDED": 3,
211
- "3": "FORWARDED"
247
+ "STABLE": 1,
248
+ "1": "STABLE",
249
+ "DYNAMIC": 2,
250
+ "2": "DYNAMIC",
251
+ "FORWARDED": 3,
252
+ "3": "FORWARDED"
212
253
  };
254
+ /**
255
+ * Dev only
256
+ */
213
257
  const slotFlagsText = {
214
- [1]: "STABLE",
215
- [2]: "DYNAMIC",
216
- [3]: "FORWARDED"
258
+ [1]: "STABLE",
259
+ [2]: "DYNAMIC",
260
+ [3]: "FORWARDED"
217
261
  };
218
-
219
- 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";
220
- const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
262
+ 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");
263
+ /** @deprecated use `isGloballyAllowed` instead */
221
264
  const isGloballyWhitelisted = isGloballyAllowed;
222
-
265
+ //#endregion
266
+ //#region packages/shared/src/codeframe.ts
223
267
  const range = 2;
224
268
  function generateCodeFrame(source, start = 0, end = source.length) {
225
- start = Math.max(0, Math.min(start, source.length));
226
- end = Math.max(0, Math.min(end, source.length));
227
- if (start > end) return "";
228
- let lines = source.split(/(\r?\n)/);
229
- const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
230
- lines = lines.filter((_, idx) => idx % 2 === 0);
231
- let count = 0;
232
- const res = [];
233
- for (let i = 0; i < lines.length; i++) {
234
- count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
235
- if (count >= start) {
236
- for (let j = i - range; j <= i + range || end > count; j++) {
237
- if (j < 0 || j >= lines.length) continue;
238
- const line = j + 1;
239
- res.push(
240
- `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
241
- );
242
- const lineLength = lines[j].length;
243
- const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
244
- if (j === i) {
245
- const pad = start - (count - (lineLength + newLineSeqLength));
246
- const length = Math.max(
247
- 1,
248
- end > count ? lineLength - pad : end - start
249
- );
250
- res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
251
- } else if (j > i) {
252
- if (end > count) {
253
- const length = Math.max(Math.min(end - count, lineLength), 1);
254
- res.push(` | ` + "^".repeat(length));
255
- }
256
- count += lineLength + newLineSeqLength;
257
- }
258
- }
259
- break;
260
- }
261
- }
262
- return res.join("\n");
269
+ start = Math.max(0, Math.min(start, source.length));
270
+ end = Math.max(0, Math.min(end, source.length));
271
+ if (start > end) return "";
272
+ let lines = source.split(/(\r?\n)/);
273
+ const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
274
+ lines = lines.filter((_, idx) => idx % 2 === 0);
275
+ let count = 0;
276
+ const res = [];
277
+ for (let i = 0; i < lines.length; i++) {
278
+ count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
279
+ if (count >= start) {
280
+ for (let j = i - range; j <= i + range || end > count; j++) {
281
+ if (j < 0 || j >= lines.length) continue;
282
+ const line = j + 1;
283
+ res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
284
+ const lineLength = lines[j].length;
285
+ const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
286
+ if (j === i) {
287
+ const pad = start - (count - (lineLength + newLineSeqLength));
288
+ const length = Math.max(1, end > count ? lineLength - pad : end - start);
289
+ res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
290
+ } else if (j > i) {
291
+ if (end > count) {
292
+ const length = Math.max(Math.min(end - count, lineLength), 1);
293
+ res.push(` | ` + "^".repeat(length));
294
+ }
295
+ count += lineLength + newLineSeqLength;
296
+ }
297
+ }
298
+ break;
299
+ }
300
+ }
301
+ return res.join("\n");
263
302
  }
264
-
303
+ //#endregion
304
+ //#region packages/shared/src/normalizeProp.ts
265
305
  function normalizeStyle(value) {
266
- if (isArray(value)) {
267
- const res = {};
268
- for (let i = 0; i < value.length; i++) {
269
- const item = value[i];
270
- const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
271
- if (normalized) {
272
- for (const key in normalized) {
273
- res[key] = normalized[key];
274
- }
275
- }
276
- }
277
- return res;
278
- } else if (isString(value) || isObject(value)) {
279
- return value;
280
- }
306
+ if (isArray(value)) {
307
+ const res = {};
308
+ for (let i = 0; i < value.length; i++) {
309
+ const item = value[i];
310
+ const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
311
+ if (normalized) for (const key in normalized) res[key] = normalized[key];
312
+ }
313
+ return res;
314
+ } else if (isString(value) || isObject(value)) return value;
281
315
  }
282
316
  const listDelimiterRE = /;(?![^(]*\))/g;
283
317
  const propertyDelimiterRE = /:([^]+)/;
284
318
  const styleCommentRE = /\/\*[^]*?\*\//g;
285
319
  function parseStringStyle(cssText) {
286
- const ret = {};
287
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
288
- if (item) {
289
- const tmp = item.split(propertyDelimiterRE);
290
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
291
- }
292
- });
293
- return ret;
320
+ const ret = {};
321
+ cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
322
+ if (item) {
323
+ const tmp = item.split(propertyDelimiterRE);
324
+ tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
325
+ }
326
+ });
327
+ return ret;
294
328
  }
295
329
  function stringifyStyle(styles) {
296
- if (!styles) return "";
297
- if (isString(styles)) return styles;
298
- let ret = "";
299
- for (const key in styles) {
300
- const value = styles[key];
301
- if (isString(value) || typeof value === "number") {
302
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
303
- ret += `${normalizedKey}:${value};`;
304
- }
305
- }
306
- return ret;
330
+ if (!styles) return "";
331
+ if (isString(styles)) return styles;
332
+ let ret = "";
333
+ for (const key in styles) {
334
+ const value = styles[key];
335
+ if (isString(value) || typeof value === "number") {
336
+ const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
337
+ ret += `${normalizedKey}:${value};`;
338
+ }
339
+ }
340
+ return ret;
307
341
  }
308
342
  function normalizeClass(value) {
309
- let res = "";
310
- if (isString(value)) {
311
- res = value;
312
- } else if (isArray(value)) {
313
- for (let i = 0; i < value.length; i++) {
314
- const normalized = normalizeClass(value[i]);
315
- if (normalized) {
316
- res += normalized + " ";
317
- }
318
- }
319
- } else if (isObject(value)) {
320
- for (const name in value) {
321
- if (value[name]) {
322
- res += name + " ";
323
- }
324
- }
325
- }
326
- return res.trim();
343
+ let res = "";
344
+ if (isString(value)) res = value;
345
+ else if (isArray(value)) for (let i = 0; i < value.length; i++) {
346
+ const normalized = normalizeClass(value[i]);
347
+ if (normalized) res += normalized + " ";
348
+ }
349
+ else if (isObject(value)) {
350
+ for (const name in value) if (value[name]) res += name + " ";
351
+ }
352
+ return res.trim();
327
353
  }
328
354
  function normalizeProps(props) {
329
- if (!props) return null;
330
- let { class: klass, style } = props;
331
- if (klass && !isString(klass)) {
332
- props.class = normalizeClass(klass);
333
- }
334
- if (style) {
335
- props.style = normalizeStyle(style);
336
- }
337
- return props;
355
+ if (!props) return null;
356
+ let { class: klass, style } = props;
357
+ if (klass && !isString(klass)) props.class = normalizeClass(klass);
358
+ if (style) props.style = normalizeStyle(style);
359
+ return props;
338
360
  }
339
-
361
+ //#endregion
362
+ //#region packages/shared/src/domTagConfig.ts
340
363
  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";
341
364
  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";
342
365
  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";
343
366
  const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
367
+ const FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
368
+ const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset";
369
+ 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";
370
+ 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";
371
+ /**
372
+ * Compiler only.
373
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
374
+ */
344
375
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
376
+ /**
377
+ * Compiler only.
378
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
379
+ */
345
380
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
381
+ /**
382
+ * Compiler only.
383
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
384
+ */
346
385
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
386
+ /**
387
+ * Compiler only.
388
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
389
+ */
347
390
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
348
-
391
+ /**
392
+ * Compiler only.
393
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
394
+ */
395
+ const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS);
396
+ /**
397
+ * Compiler only.
398
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
399
+ */
400
+ const isAlwaysCloseTag = /* @__PURE__ */ makeMap(ALWAYS_CLOSE_TAGS);
401
+ /**
402
+ * Compiler only.
403
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
404
+ */
405
+ const isInlineTag = /* @__PURE__ */ makeMap(INLINE_TAGS);
406
+ /**
407
+ * Compiler only.
408
+ * Do NOT use in runtime code paths unless behind `__DEV__` flag.
409
+ */
410
+ const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
411
+ //#endregion
412
+ //#region packages/shared/src/domAttrConfig.ts
413
+ /**
414
+ * On the client we only need to offer special cases for boolean attributes that
415
+ * have different names from their corresponding dom properties:
416
+ * - itemscope -> N/A
417
+ * - allowfullscreen -> allowFullscreen
418
+ * - formnovalidate -> formNoValidate
419
+ * - ismap -> isMap
420
+ * - nomodule -> noModule
421
+ * - novalidate -> noValidate
422
+ * - readonly -> readOnly
423
+ */
349
424
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
350
425
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
351
- const isBooleanAttr = /* @__PURE__ */ makeMap(
352
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
353
- );
426
+ /**
427
+ * The full list is needed during SSR to produce the correct initial markup.
428
+ */
429
+ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
430
+ /**
431
+ * Boolean attributes should be included if the value is truthy or ''.
432
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
433
+ */
354
434
  function includeBooleanAttr(value) {
355
- return !!value || value === "";
435
+ return !!value || value === "";
356
436
  }
357
437
  const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
358
438
  const attrValidationCache = {};
359
439
  function isSSRSafeAttrName(name) {
360
- if (attrValidationCache.hasOwnProperty(name)) {
361
- return attrValidationCache[name];
362
- }
363
- const isUnsafe = unsafeAttrCharRE.test(name);
364
- if (isUnsafe) {
365
- console.error(`unsafe attribute name: ${name}`);
366
- }
367
- return attrValidationCache[name] = !isUnsafe;
440
+ if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name];
441
+ const isUnsafe = unsafeAttrCharRE.test(name);
442
+ if (isUnsafe) console.error(`unsafe attribute name: ${name}`);
443
+ return attrValidationCache[name] = !isUnsafe;
368
444
  }
369
445
  const propsToAttrMap = {
370
- acceptCharset: "accept-charset",
371
- className: "class",
372
- htmlFor: "for",
373
- httpEquiv: "http-equiv"
446
+ acceptCharset: "accept-charset",
447
+ className: "class",
448
+ htmlFor: "for",
449
+ httpEquiv: "http-equiv"
374
450
  };
375
- const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
376
- `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`
377
- );
378
- const isKnownSvgAttr = /* @__PURE__ */ makeMap(
379
- `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`
380
- );
381
- const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
382
- `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`
383
- );
451
+ /**
452
+ * Known attributes, this is used for stringification of runtime static nodes
453
+ * so that we don't stringify bindings that cannot be set from HTML.
454
+ * Don't also forget to allow `data-*` and `aria-*`!
455
+ * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
456
+ */
457
+ 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");
458
+ /**
459
+ * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
460
+ */
461
+ 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");
462
+ /**
463
+ * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
464
+ */
465
+ 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");
466
+ /**
467
+ * Shared between server-renderer and runtime-core hydration logic
468
+ */
384
469
  function isRenderableAttrValue(value) {
385
- if (value == null) {
386
- return false;
387
- }
388
- const type = typeof value;
389
- return type === "string" || type === "number" || type === "boolean";
470
+ if (value == null) return false;
471
+ const type = typeof value;
472
+ return type === "string" || type === "number" || type === "boolean";
390
473
  }
391
474
  function shouldSetAsAttr(tagName, key) {
392
- if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
393
- return true;
394
- }
395
- if (key === "form") {
396
- return true;
397
- }
398
- if (key === "list" && tagName === "INPUT") {
399
- return true;
400
- }
401
- if (key === "type" && tagName === "TEXTAREA") {
402
- return true;
403
- }
404
- if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
405
- return true;
406
- }
407
- if (key === "sandbox" && tagName === "IFRAME") {
408
- return true;
409
- }
410
- return false;
475
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true;
476
+ if (key === "form") return true;
477
+ if (key === "list" && tagName === "INPUT") return true;
478
+ if (key === "type" && tagName === "TEXTAREA") return true;
479
+ if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true;
480
+ if (key === "sandbox" && tagName === "IFRAME") return true;
481
+ return false;
411
482
  }
412
-
483
+ //#endregion
484
+ //#region packages/shared/src/domNamespace.ts
413
485
  const Namespaces = {
414
- "HTML": 0,
415
- "0": "HTML",
416
- "SVG": 1,
417
- "1": "SVG",
418
- "MATH_ML": 2,
419
- "2": "MATH_ML"
486
+ "HTML": 0,
487
+ "0": "HTML",
488
+ "SVG": 1,
489
+ "1": "SVG",
490
+ "MATH_ML": 2,
491
+ "2": "MATH_ML"
420
492
  };
421
-
493
+ //#endregion
494
+ //#region packages/shared/src/escapeHtml.ts
422
495
  const escapeRE = /["'&<>]/;
423
496
  function escapeHtml(string) {
424
- const str = "" + string;
425
- const match = escapeRE.exec(str);
426
- if (!match) {
427
- return str;
428
- }
429
- let html = "";
430
- let escaped;
431
- let index;
432
- let lastIndex = 0;
433
- for (index = match.index; index < str.length; index++) {
434
- switch (str.charCodeAt(index)) {
435
- case 34:
436
- escaped = "&quot;";
437
- break;
438
- case 38:
439
- escaped = "&amp;";
440
- break;
441
- case 39:
442
- escaped = "&#39;";
443
- break;
444
- case 60:
445
- escaped = "&lt;";
446
- break;
447
- case 62:
448
- escaped = "&gt;";
449
- break;
450
- default:
451
- continue;
452
- }
453
- if (lastIndex !== index) {
454
- html += str.slice(lastIndex, index);
455
- }
456
- lastIndex = index + 1;
457
- html += escaped;
458
- }
459
- return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
497
+ const str = "" + string;
498
+ const match = escapeRE.exec(str);
499
+ if (!match) return str;
500
+ let html = "";
501
+ let escaped;
502
+ let index;
503
+ let lastIndex = 0;
504
+ for (index = match.index; index < str.length; index++) {
505
+ switch (str.charCodeAt(index)) {
506
+ case 34:
507
+ escaped = "&quot;";
508
+ break;
509
+ case 38:
510
+ escaped = "&amp;";
511
+ break;
512
+ case 39:
513
+ escaped = "&#39;";
514
+ break;
515
+ case 60:
516
+ escaped = "&lt;";
517
+ break;
518
+ case 62:
519
+ escaped = "&gt;";
520
+ break;
521
+ default: continue;
522
+ }
523
+ if (lastIndex !== index) html += str.slice(lastIndex, index);
524
+ lastIndex = index + 1;
525
+ html += escaped;
526
+ }
527
+ return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
460
528
  }
461
529
  const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
462
530
  function escapeHtmlComment(src) {
463
- return src.replace(commentStripRE, "");
531
+ return src.replace(commentStripRE, "");
464
532
  }
465
533
  const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
466
534
  function getEscapedCssVarName(key, doubleEscape) {
467
- return key.replace(
468
- cssVarNameEscapeSymbolsRE,
469
- (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
470
- );
535
+ return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`);
471
536
  }
472
-
537
+ //#endregion
538
+ //#region packages/shared/src/looseEqual.ts
473
539
  function looseCompareArrays(a, b) {
474
- if (a.length !== b.length) return false;
475
- let equal = true;
476
- for (let i = 0; equal && i < a.length; i++) {
477
- equal = looseEqual(a[i], b[i]);
478
- }
479
- return equal;
540
+ if (a.length !== b.length) return false;
541
+ let equal = true;
542
+ for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]);
543
+ return equal;
480
544
  }
481
545
  function looseEqual(a, b) {
482
- if (a === b) return true;
483
- let aValidType = isDate(a);
484
- let bValidType = isDate(b);
485
- if (aValidType || bValidType) {
486
- return aValidType && bValidType ? a.getTime() === b.getTime() : false;
487
- }
488
- aValidType = isSymbol(a);
489
- bValidType = isSymbol(b);
490
- if (aValidType || bValidType) {
491
- return a === b;
492
- }
493
- aValidType = isArray(a);
494
- bValidType = isArray(b);
495
- if (aValidType || bValidType) {
496
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
497
- }
498
- aValidType = isObject(a);
499
- bValidType = isObject(b);
500
- if (aValidType || bValidType) {
501
- if (!aValidType || !bValidType) {
502
- return false;
503
- }
504
- const aKeysCount = Object.keys(a).length;
505
- const bKeysCount = Object.keys(b).length;
506
- if (aKeysCount !== bKeysCount) {
507
- return false;
508
- }
509
- for (const key in a) {
510
- const aHasKey = a.hasOwnProperty(key);
511
- const bHasKey = b.hasOwnProperty(key);
512
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
513
- return false;
514
- }
515
- }
516
- }
517
- return String(a) === String(b);
546
+ if (a === b) return true;
547
+ let aValidType = isDate(a);
548
+ let bValidType = isDate(b);
549
+ if (aValidType || bValidType) return aValidType && bValidType ? a.getTime() === b.getTime() : false;
550
+ aValidType = isSymbol(a);
551
+ bValidType = isSymbol(b);
552
+ if (aValidType || bValidType) return a === b;
553
+ aValidType = isArray(a);
554
+ bValidType = isArray(b);
555
+ if (aValidType || bValidType) return aValidType && bValidType ? looseCompareArrays(a, b) : false;
556
+ aValidType = isObject(a);
557
+ bValidType = isObject(b);
558
+ if (aValidType || bValidType) {
559
+ if (!aValidType || !bValidType) return false;
560
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
561
+ for (const key in a) {
562
+ const aHasKey = a.hasOwnProperty(key);
563
+ const bHasKey = b.hasOwnProperty(key);
564
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false;
565
+ }
566
+ }
567
+ return String(a) === String(b);
518
568
  }
519
569
  function looseIndexOf(arr, val) {
520
- return arr.findIndex((item) => looseEqual(item, val));
570
+ return arr.findIndex((item) => looseEqual(item, val));
521
571
  }
522
-
572
+ //#endregion
573
+ //#region packages/shared/src/toDisplayString.ts
523
574
  const isRef = (val) => {
524
- return !!(val && val["__v_isRef"] === true);
575
+ return !!(val && val["__v_isRef"] === true);
525
576
  };
577
+ /**
578
+ * For converting {{ interpolation }} values to displayed strings.
579
+ * @private
580
+ */
526
581
  const toDisplayString = (val) => {
527
- switch (typeof val) {
528
- case "string":
529
- return val;
530
- case "object":
531
- if (val) {
532
- if (isRef(val)) {
533
- return toDisplayString(val.value);
534
- } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
535
- return JSON.stringify(val, replacer, 2);
536
- }
537
- }
538
- default:
539
- return val == null ? "" : String(val);
540
- }
582
+ switch (typeof val) {
583
+ case "string": return val;
584
+ case "object": if (val) {
585
+ if (isRef(val)) return toDisplayString(val.value);
586
+ else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2);
587
+ }
588
+ default: return val == null ? "" : String(val);
589
+ }
541
590
  };
542
591
  const replacer = (_key, val) => {
543
- if (isRef(val)) {
544
- return replacer(_key, val.value);
545
- } else if (isMap(val)) {
546
- return {
547
- [`Map(${val.size})`]: [...val.entries()].reduce(
548
- (entries, [key, val2], i) => {
549
- entries[stringifySymbol(key, i) + " =>"] = val2;
550
- return entries;
551
- },
552
- {}
553
- )
554
- };
555
- } else if (isSet(val)) {
556
- return {
557
- [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
558
- };
559
- } else if (isSymbol(val)) {
560
- return stringifySymbol(val);
561
- } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
562
- return String(val);
563
- }
564
- return val;
592
+ if (isRef(val)) return replacer(_key, val.value);
593
+ else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => {
594
+ entries[stringifySymbol(key, i) + " =>"] = val;
595
+ return entries;
596
+ }, {}) };
597
+ else if (isSet(val)) return { [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) };
598
+ else if (isSymbol(val)) return stringifySymbol(val);
599
+ else if (isObject(val) && !isArray(val) && !isPlainObject(val)) return String(val);
600
+ return val;
565
601
  };
566
602
  const stringifySymbol = (v, i = "") => {
567
- var _a;
568
- return (
569
- // Symbol.description in es2019+ so we need to cast here to pass
570
- // the lib: es2016 check
571
- isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
572
- );
603
+ var _description;
604
+ return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v;
573
605
  };
574
-
606
+ //#endregion
607
+ //#region packages/shared/src/subSequence.ts
575
608
  function getSequence(arr) {
576
- const p = arr.slice();
577
- const result = [0];
578
- let i, j, u, v, c;
579
- const len = arr.length;
580
- for (i = 0; i < len; i++) {
581
- const arrI = arr[i];
582
- if (arrI !== 0) {
583
- j = result[result.length - 1];
584
- if (arr[j] < arrI) {
585
- p[i] = j;
586
- result.push(i);
587
- continue;
588
- }
589
- u = 0;
590
- v = result.length - 1;
591
- while (u < v) {
592
- c = u + v >> 1;
593
- if (arr[result[c]] < arrI) {
594
- u = c + 1;
595
- } else {
596
- v = c;
597
- }
598
- }
599
- if (arrI < arr[result[u]]) {
600
- if (u > 0) {
601
- p[i] = result[u - 1];
602
- }
603
- result[u] = i;
604
- }
605
- }
606
- }
607
- u = result.length;
608
- v = result[u - 1];
609
- while (u-- > 0) {
610
- result[u] = v;
611
- v = p[v];
612
- }
613
- return result;
609
+ const p = arr.slice();
610
+ const result = [0];
611
+ let i, j, u, v, c;
612
+ const len = arr.length;
613
+ for (i = 0; i < len; i++) {
614
+ const arrI = arr[i];
615
+ if (arrI !== 0) {
616
+ j = result[result.length - 1];
617
+ if (arr[j] < arrI) {
618
+ p[i] = j;
619
+ result.push(i);
620
+ continue;
621
+ }
622
+ u = 0;
623
+ v = result.length - 1;
624
+ while (u < v) {
625
+ c = u + v >> 1;
626
+ if (arr[result[c]] < arrI) u = c + 1;
627
+ else v = c;
628
+ }
629
+ if (arrI < arr[result[u]]) {
630
+ if (u > 0) p[i] = result[u - 1];
631
+ result[u] = i;
632
+ }
633
+ }
634
+ }
635
+ u = result.length;
636
+ v = result[u - 1];
637
+ while (u-- > 0) {
638
+ result[u] = v;
639
+ v = p[v];
640
+ }
641
+ return result;
614
642
  }
615
-
643
+ //#endregion
644
+ //#region packages/shared/src/cssVars.ts
645
+ /**
646
+ * Normalize CSS var value created by `v-bind` in `<style>` block
647
+ * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
648
+ */
616
649
  function normalizeCssVarValue(value) {
617
- if (value == null) {
618
- return "initial";
619
- }
620
- if (typeof value === "string") {
621
- return value === "" ? " " : value;
622
- }
623
- if (typeof value !== "number" || !Number.isFinite(value)) {
624
- {
625
- console.warn(
626
- "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
627
- value
628
- );
629
- }
630
- }
631
- return String(value);
650
+ if (value == null) return "initial";
651
+ if (typeof value === "string") return value === "" ? " " : value;
652
+ if (typeof value !== "number" || !Number.isFinite(value)) console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", value);
653
+ return String(value);
632
654
  }
633
-
655
+ //#endregion
656
+ //#region packages/shared/src/vaporFlags.ts
657
+ /**
658
+ * Flags to optimize vapor `createFor` runtime behavior, shared between the
659
+ * compiler and the runtime
660
+ */
661
+ const VaporVForFlags = {
662
+ "FAST_REMOVE": 1,
663
+ "1": "FAST_REMOVE",
664
+ "IS_COMPONENT": 2,
665
+ "2": "IS_COMPONENT",
666
+ "ONCE": 4,
667
+ "4": "ONCE"
668
+ };
669
+ const VaporBlockShape = {
670
+ "EMPTY": 0,
671
+ "0": "EMPTY",
672
+ "SINGLE_ROOT": 1,
673
+ "1": "SINGLE_ROOT",
674
+ "MULTI_ROOT": 2,
675
+ "2": "MULTI_ROOT"
676
+ };
677
+ //#endregion
634
678
  exports.EMPTY_ARR = EMPTY_ARR;
635
679
  exports.EMPTY_OBJ = EMPTY_OBJ;
636
680
  exports.NO = NO;
@@ -640,6 +684,8 @@ exports.PatchFlagNames = PatchFlagNames;
640
684
  exports.PatchFlags = PatchFlags;
641
685
  exports.ShapeFlags = ShapeFlags;
642
686
  exports.SlotFlags = SlotFlags;
687
+ exports.VaporBlockShape = VaporBlockShape;
688
+ exports.VaporVForFlags = VaporVForFlags;
643
689
  exports.YES = YES;
644
690
  exports.camelize = camelize;
645
691
  exports.canSetValueDirectly = canSetValueDirectly;
@@ -661,15 +707,19 @@ exports.hasOwn = hasOwn;
661
707
  exports.hyphenate = hyphenate;
662
708
  exports.includeBooleanAttr = includeBooleanAttr;
663
709
  exports.invokeArrayFns = invokeArrayFns;
710
+ exports.isAlwaysCloseTag = isAlwaysCloseTag;
664
711
  exports.isArray = isArray;
712
+ exports.isBlockTag = isBlockTag;
665
713
  exports.isBooleanAttr = isBooleanAttr;
666
714
  exports.isBuiltInDirective = isBuiltInDirective;
667
715
  exports.isBuiltInTag = isBuiltInTag;
668
716
  exports.isDate = isDate;
717
+ exports.isFormattingTag = isFormattingTag;
669
718
  exports.isFunction = isFunction;
670
719
  exports.isGloballyAllowed = isGloballyAllowed;
671
720
  exports.isGloballyWhitelisted = isGloballyWhitelisted;
672
721
  exports.isHTMLTag = isHTMLTag;
722
+ exports.isInlineTag = isInlineTag;
673
723
  exports.isIntegerKey = isIntegerKey;
674
724
  exports.isKnownHtmlAttr = isKnownHtmlAttr;
675
725
  exports.isKnownMathMLAttr = isKnownMathMLAttr;