@vue/shared 3.5.42 → 3.5.44

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,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.5.42
2
+ * @vue/shared v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -271,10 +271,10 @@ function normalizeStyle(value) {
271
271
  }
272
272
  const listDelimiterRE = /;(?![^(]*\))/g;
273
273
  const propertyDelimiterRE = /:([^]+)/;
274
- const styleCommentRE = /\/\*[^]*?\*\//g;
274
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
275
275
  function parseStringStyle(cssText) {
276
276
  const ret = {};
277
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
277
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
278
278
  if (item) {
279
279
  const tmp = item.split(propertyDelimiterRE);
280
280
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -336,7 +336,7 @@ const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
336
336
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
337
337
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
338
338
 
339
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
339
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
340
340
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
341
341
  const isBooleanAttr = /* @__PURE__ */ makeMap(
342
342
  specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
@@ -435,22 +435,22 @@ function getEscapedCssVarName(key, doubleEscape) {
435
435
  );
436
436
  }
437
437
 
438
- function looseCompareArrays(a, b) {
438
+ function looseCompareArrays(a, b, seen) {
439
439
  if (a.length !== b.length) return false;
440
440
  let equal = true;
441
441
  for (let i = 0; equal && i < a.length; i++) {
442
- equal = looseEqual(a[i], b[i]);
442
+ equal = looseEqual(a[i], b[i], seen);
443
443
  }
444
444
  return equal;
445
445
  }
446
- function looseCompareCollections(a, b) {
446
+ function looseCompareCollections(a, b, seen) {
447
447
  if (a.size !== b.size) return false;
448
448
  const candidates = Array.from(b);
449
449
  const matched = new Uint8Array(candidates.length);
450
450
  for (const item of a) {
451
451
  let index = -1;
452
452
  for (let i = 0; i < candidates.length; i++) {
453
- if (!matched[i] && looseEqual(item, candidates[i])) {
453
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
454
454
  index = i;
455
455
  break;
456
456
  }
@@ -460,7 +460,47 @@ function looseCompareCollections(a, b) {
460
460
  }
461
461
  return true;
462
462
  }
463
- function looseEqual(a, b) {
463
+ function looseCompareObjects(a, b, seen) {
464
+ let aValidType = isMap(a);
465
+ let bValidType = isMap(b);
466
+ if (aValidType || bValidType) {
467
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
468
+ }
469
+ aValidType = isSet(a);
470
+ bValidType = isSet(b);
471
+ if (aValidType || bValidType) {
472
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
473
+ }
474
+ const aKeysCount = Object.keys(a).length;
475
+ const bKeysCount = Object.keys(b).length;
476
+ if (aKeysCount !== bKeysCount) {
477
+ return false;
478
+ }
479
+ for (const key in a) {
480
+ const aHasKey = a.hasOwnProperty(key);
481
+ const bHasKey = b.hasOwnProperty(key);
482
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
483
+ return false;
484
+ }
485
+ }
486
+ return String(a) === String(b);
487
+ }
488
+ function looseCompareNested(a, b, seen, compare) {
489
+ if (!seen) {
490
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
491
+ }
492
+ const [seenA, seenB] = seen;
493
+ if (seenA.has(a) || seenB.has(b)) {
494
+ return seenA.get(a) === b && seenB.get(b) === a;
495
+ }
496
+ seenA.set(a, b);
497
+ seenB.set(b, a);
498
+ const equal = compare(a, b, seen);
499
+ seenA.delete(a);
500
+ seenB.delete(b);
501
+ return equal;
502
+ }
503
+ function looseEqual(a, b, seen) {
464
504
  if (a === b) return true;
465
505
  let aValidType = isDate(a);
466
506
  let bValidType = isDate(b);
@@ -475,7 +515,7 @@ function looseEqual(a, b) {
475
515
  aValidType = isArray(a);
476
516
  bValidType = isArray(b);
477
517
  if (aValidType || bValidType) {
478
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
518
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
479
519
  }
480
520
  aValidType = isObject(a);
481
521
  bValidType = isObject(b);
@@ -483,28 +523,7 @@ function looseEqual(a, b) {
483
523
  if (!aValidType || !bValidType) {
484
524
  return false;
485
525
  }
486
- aValidType = isMap(a);
487
- bValidType = isMap(b);
488
- if (aValidType || bValidType) {
489
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
490
- }
491
- aValidType = isSet(a);
492
- bValidType = isSet(b);
493
- if (aValidType || bValidType) {
494
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
495
- }
496
- const aKeysCount = Object.keys(a).length;
497
- const bKeysCount = Object.keys(b).length;
498
- if (aKeysCount !== bKeysCount) {
499
- return false;
500
- }
501
- for (const key in a) {
502
- const aHasKey = a.hasOwnProperty(key);
503
- const bHasKey = b.hasOwnProperty(key);
504
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
505
- return false;
506
- }
507
- }
526
+ return looseCompareNested(a, b, seen, looseCompareObjects);
508
527
  }
509
528
  return String(a) === String(b);
510
529
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.5.42
2
+ * @vue/shared v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -271,10 +271,10 @@ function normalizeStyle(value) {
271
271
  }
272
272
  const listDelimiterRE = /;(?![^(]*\))/g;
273
273
  const propertyDelimiterRE = /:([^]+)/;
274
- const styleCommentRE = /\/\*[^]*?\*\//g;
274
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
275
275
  function parseStringStyle(cssText) {
276
276
  const ret = {};
277
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
277
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
278
278
  if (item) {
279
279
  const tmp = item.split(propertyDelimiterRE);
280
280
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -336,7 +336,7 @@ const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
336
336
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
337
337
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
338
338
 
339
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
339
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
340
340
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
341
341
  const isBooleanAttr = /* @__PURE__ */ makeMap(
342
342
  specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
@@ -435,22 +435,22 @@ function getEscapedCssVarName(key, doubleEscape) {
435
435
  );
436
436
  }
437
437
 
438
- function looseCompareArrays(a, b) {
438
+ function looseCompareArrays(a, b, seen) {
439
439
  if (a.length !== b.length) return false;
440
440
  let equal = true;
441
441
  for (let i = 0; equal && i < a.length; i++) {
442
- equal = looseEqual(a[i], b[i]);
442
+ equal = looseEqual(a[i], b[i], seen);
443
443
  }
444
444
  return equal;
445
445
  }
446
- function looseCompareCollections(a, b) {
446
+ function looseCompareCollections(a, b, seen) {
447
447
  if (a.size !== b.size) return false;
448
448
  const candidates = Array.from(b);
449
449
  const matched = new Uint8Array(candidates.length);
450
450
  for (const item of a) {
451
451
  let index = -1;
452
452
  for (let i = 0; i < candidates.length; i++) {
453
- if (!matched[i] && looseEqual(item, candidates[i])) {
453
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
454
454
  index = i;
455
455
  break;
456
456
  }
@@ -460,7 +460,47 @@ function looseCompareCollections(a, b) {
460
460
  }
461
461
  return true;
462
462
  }
463
- function looseEqual(a, b) {
463
+ function looseCompareObjects(a, b, seen) {
464
+ let aValidType = isMap(a);
465
+ let bValidType = isMap(b);
466
+ if (aValidType || bValidType) {
467
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
468
+ }
469
+ aValidType = isSet(a);
470
+ bValidType = isSet(b);
471
+ if (aValidType || bValidType) {
472
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
473
+ }
474
+ const aKeysCount = Object.keys(a).length;
475
+ const bKeysCount = Object.keys(b).length;
476
+ if (aKeysCount !== bKeysCount) {
477
+ return false;
478
+ }
479
+ for (const key in a) {
480
+ const aHasKey = a.hasOwnProperty(key);
481
+ const bHasKey = b.hasOwnProperty(key);
482
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
483
+ return false;
484
+ }
485
+ }
486
+ return String(a) === String(b);
487
+ }
488
+ function looseCompareNested(a, b, seen, compare) {
489
+ if (!seen) {
490
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
491
+ }
492
+ const [seenA, seenB] = seen;
493
+ if (seenA.has(a) || seenB.has(b)) {
494
+ return seenA.get(a) === b && seenB.get(b) === a;
495
+ }
496
+ seenA.set(a, b);
497
+ seenB.set(b, a);
498
+ const equal = compare(a, b, seen);
499
+ seenA.delete(a);
500
+ seenB.delete(b);
501
+ return equal;
502
+ }
503
+ function looseEqual(a, b, seen) {
464
504
  if (a === b) return true;
465
505
  let aValidType = isDate(a);
466
506
  let bValidType = isDate(b);
@@ -475,7 +515,7 @@ function looseEqual(a, b) {
475
515
  aValidType = isArray(a);
476
516
  bValidType = isArray(b);
477
517
  if (aValidType || bValidType) {
478
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
518
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
479
519
  }
480
520
  aValidType = isObject(a);
481
521
  bValidType = isObject(b);
@@ -483,28 +523,7 @@ function looseEqual(a, b) {
483
523
  if (!aValidType || !bValidType) {
484
524
  return false;
485
525
  }
486
- aValidType = isMap(a);
487
- bValidType = isMap(b);
488
- if (aValidType || bValidType) {
489
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
490
- }
491
- aValidType = isSet(a);
492
- bValidType = isSet(b);
493
- if (aValidType || bValidType) {
494
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
495
- }
496
- const aKeysCount = Object.keys(a).length;
497
- const bKeysCount = Object.keys(b).length;
498
- if (aKeysCount !== bKeysCount) {
499
- return false;
500
- }
501
- for (const key in a) {
502
- const aHasKey = a.hasOwnProperty(key);
503
- const bHasKey = b.hasOwnProperty(key);
504
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
505
- return false;
506
- }
507
- }
526
+ return looseCompareNested(a, b, seen, looseCompareObjects);
508
527
  }
509
528
  return String(a) === String(b);
510
529
  }
package/dist/shared.d.ts CHANGED
@@ -298,7 +298,8 @@ export declare function escapeHtmlComment(src: string): string;
298
298
  export declare const cssVarNameEscapeSymbolsRE: RegExp;
299
299
  export declare function getEscapedCssVarName(key: string, doubleEscape: boolean): string;
300
300
 
301
- export declare function looseEqual(a: any, b: any): boolean;
301
+ type ComparisonState = [Map<any, any>, Map<any, any>];
302
+ export declare function looseEqual(a: any, b: any, seen?: ComparisonState): boolean;
302
303
  export declare function looseIndexOf(arr: any[], val: any): number;
303
304
 
304
305
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.5.42
2
+ * @vue/shared v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -267,10 +267,10 @@ function normalizeStyle(value) {
267
267
  }
268
268
  const listDelimiterRE = /;(?![^(]*\))/g;
269
269
  const propertyDelimiterRE = /:([^]+)/;
270
- const styleCommentRE = /\/\*[^]*?\*\//g;
270
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
271
271
  function parseStringStyle(cssText) {
272
272
  const ret = {};
273
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
273
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
274
274
  if (item) {
275
275
  const tmp = item.split(propertyDelimiterRE);
276
276
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -332,7 +332,7 @@ const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
332
332
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
333
333
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
334
334
 
335
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
335
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
336
336
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
337
337
  const isBooleanAttr = /* @__PURE__ */ makeMap(
338
338
  specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
@@ -431,22 +431,22 @@ function getEscapedCssVarName(key, doubleEscape) {
431
431
  );
432
432
  }
433
433
 
434
- function looseCompareArrays(a, b) {
434
+ function looseCompareArrays(a, b, seen) {
435
435
  if (a.length !== b.length) return false;
436
436
  let equal = true;
437
437
  for (let i = 0; equal && i < a.length; i++) {
438
- equal = looseEqual(a[i], b[i]);
438
+ equal = looseEqual(a[i], b[i], seen);
439
439
  }
440
440
  return equal;
441
441
  }
442
- function looseCompareCollections(a, b) {
442
+ function looseCompareCollections(a, b, seen) {
443
443
  if (a.size !== b.size) return false;
444
444
  const candidates = Array.from(b);
445
445
  const matched = new Uint8Array(candidates.length);
446
446
  for (const item of a) {
447
447
  let index = -1;
448
448
  for (let i = 0; i < candidates.length; i++) {
449
- if (!matched[i] && looseEqual(item, candidates[i])) {
449
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
450
450
  index = i;
451
451
  break;
452
452
  }
@@ -456,7 +456,47 @@ function looseCompareCollections(a, b) {
456
456
  }
457
457
  return true;
458
458
  }
459
- function looseEqual(a, b) {
459
+ function looseCompareObjects(a, b, seen) {
460
+ let aValidType = isMap(a);
461
+ let bValidType = isMap(b);
462
+ if (aValidType || bValidType) {
463
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
464
+ }
465
+ aValidType = isSet(a);
466
+ bValidType = isSet(b);
467
+ if (aValidType || bValidType) {
468
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
469
+ }
470
+ const aKeysCount = Object.keys(a).length;
471
+ const bKeysCount = Object.keys(b).length;
472
+ if (aKeysCount !== bKeysCount) {
473
+ return false;
474
+ }
475
+ for (const key in a) {
476
+ const aHasKey = a.hasOwnProperty(key);
477
+ const bHasKey = b.hasOwnProperty(key);
478
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
479
+ return false;
480
+ }
481
+ }
482
+ return String(a) === String(b);
483
+ }
484
+ function looseCompareNested(a, b, seen, compare) {
485
+ if (!seen) {
486
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
487
+ }
488
+ const [seenA, seenB] = seen;
489
+ if (seenA.has(a) || seenB.has(b)) {
490
+ return seenA.get(a) === b && seenB.get(b) === a;
491
+ }
492
+ seenA.set(a, b);
493
+ seenB.set(b, a);
494
+ const equal = compare(a, b, seen);
495
+ seenA.delete(a);
496
+ seenB.delete(b);
497
+ return equal;
498
+ }
499
+ function looseEqual(a, b, seen) {
460
500
  if (a === b) return true;
461
501
  let aValidType = isDate(a);
462
502
  let bValidType = isDate(b);
@@ -471,7 +511,7 @@ function looseEqual(a, b) {
471
511
  aValidType = isArray(a);
472
512
  bValidType = isArray(b);
473
513
  if (aValidType || bValidType) {
474
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
514
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
475
515
  }
476
516
  aValidType = isObject(a);
477
517
  bValidType = isObject(b);
@@ -479,28 +519,7 @@ function looseEqual(a, b) {
479
519
  if (!aValidType || !bValidType) {
480
520
  return false;
481
521
  }
482
- aValidType = isMap(a);
483
- bValidType = isMap(b);
484
- if (aValidType || bValidType) {
485
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
486
- }
487
- aValidType = isSet(a);
488
- bValidType = isSet(b);
489
- if (aValidType || bValidType) {
490
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
491
- }
492
- const aKeysCount = Object.keys(a).length;
493
- const bKeysCount = Object.keys(b).length;
494
- if (aKeysCount !== bKeysCount) {
495
- return false;
496
- }
497
- for (const key in a) {
498
- const aHasKey = a.hasOwnProperty(key);
499
- const bHasKey = b.hasOwnProperty(key);
500
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
501
- return false;
502
- }
503
- }
522
+ return looseCompareNested(a, b, seen, looseCompareObjects);
504
523
  }
505
524
  return String(a) === String(b);
506
525
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/shared",
3
- "version": "3.5.42",
3
+ "version": "3.5.44",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",