@vue/shared 3.6.0-beta.8 → 3.6.0-rc.1

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.6.0-beta.8
2
+ * @vue/shared v3.6.0-rc.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -526,9 +526,14 @@ function escapeHtml(string) {
526
526
  }
527
527
  return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
528
528
  }
529
- const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
529
+ const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
530
530
  function escapeHtmlComment(src) {
531
- return src.replace(commentStripRE, "");
531
+ let prev;
532
+ do {
533
+ prev = src;
534
+ src = src.replace(commentStripRE, "");
535
+ } while (src !== prev);
536
+ return src;
532
537
  }
533
538
  const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
534
539
  function getEscapedCssVarName(key, doubleEscape) {
@@ -664,7 +669,13 @@ const VaporVForFlags = {
664
669
  "IS_COMPONENT": 2,
665
670
  "2": "IS_COMPONENT",
666
671
  "ONCE": 4,
667
- "4": "ONCE"
672
+ "4": "ONCE",
673
+ "IS_SINGLE_NODE": 8,
674
+ "8": "IS_SINGLE_NODE",
675
+ "IS_FRAGMENT": 16,
676
+ "16": "IS_FRAGMENT",
677
+ "SLOT_ROOT": 32,
678
+ "32": "SLOT_ROOT"
668
679
  };
669
680
  const VaporBlockShape = {
670
681
  "EMPTY": 0,
@@ -674,6 +685,67 @@ const VaporBlockShape = {
674
685
  "MULTI_ROOT": 2,
675
686
  "2": "MULTI_ROOT"
676
687
  };
688
+ /**
689
+ * Bit layout for vapor `createIf` flags.
690
+ *
691
+ * - bits 0-1: true branch VaporBlockShape
692
+ * - bits 2-3: false branch VaporBlockShape
693
+ * - bit 4: v-once
694
+ * - bit 5: true branch is static and can skip branch-owned EffectScope
695
+ * - bit 6: false branch is static and can skip branch-owned EffectScope
696
+ * - bit 7: v-if sits on a slot content/fallback root chain
697
+ * - bits 8+: branch index + 1 for keyed dynamic fragments
698
+ *
699
+ * Examples:
700
+ * - v-once, true single-root, no false branch: 1 | ONCE = 17
701
+ * - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
702
+ */
703
+ const VaporIfFlags = {
704
+ "BLOCK_SHAPE": 15,
705
+ "15": "BLOCK_SHAPE",
706
+ "ONCE": 16,
707
+ "16": "ONCE",
708
+ "TRUE_NO_SCOPE": 32,
709
+ "32": "TRUE_NO_SCOPE",
710
+ "FALSE_NO_SCOPE": 64,
711
+ "64": "FALSE_NO_SCOPE",
712
+ "SLOT_ROOT": 128,
713
+ "128": "SLOT_ROOT",
714
+ "INDEX_SHIFT": 8,
715
+ "8": "INDEX_SHIFT"
716
+ };
717
+ /**
718
+ * Flags used by vapor template factories, shared between the compiler and the
719
+ * runtime.
720
+ */
721
+ const TemplateFlags = {
722
+ "ROOT": 1,
723
+ "1": "ROOT",
724
+ "STATIC": 2,
725
+ "2": "STATIC"
726
+ };
727
+ /**
728
+ * Flags used by vapor slot outlets, shared between the compiler and the
729
+ * runtime.
730
+ */
731
+ const VaporSlotFlags = {
732
+ "NO_SLOTTED": 1,
733
+ "1": "NO_SLOTTED",
734
+ "ONCE": 2,
735
+ "2": "ONCE",
736
+ "SLOT_ROOT": 4,
737
+ "4": "SLOT_ROOT",
738
+ "NON_STABLE": 8,
739
+ "8": "NON_STABLE"
740
+ };
741
+ const VaporDynamicComponentFlags = {
742
+ "SINGLE_ROOT": 1,
743
+ "1": "SINGLE_ROOT",
744
+ "ONCE": 2,
745
+ "2": "ONCE",
746
+ "SLOT_ROOT": 4,
747
+ "4": "SLOT_ROOT"
748
+ };
677
749
  //#endregion
678
750
  exports.EMPTY_ARR = EMPTY_ARR;
679
751
  exports.EMPTY_OBJ = EMPTY_OBJ;
@@ -684,7 +756,11 @@ exports.PatchFlagNames = PatchFlagNames;
684
756
  exports.PatchFlags = PatchFlags;
685
757
  exports.ShapeFlags = ShapeFlags;
686
758
  exports.SlotFlags = SlotFlags;
759
+ exports.TemplateFlags = TemplateFlags;
687
760
  exports.VaporBlockShape = VaporBlockShape;
761
+ exports.VaporDynamicComponentFlags = VaporDynamicComponentFlags;
762
+ exports.VaporIfFlags = VaporIfFlags;
763
+ exports.VaporSlotFlags = VaporSlotFlags;
688
764
  exports.VaporVForFlags = VaporVForFlags;
689
765
  exports.YES = YES;
690
766
  exports.camelize = camelize;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.6.0-beta.8
2
+ * @vue/shared v3.6.0-rc.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -526,9 +526,14 @@ function escapeHtml(string) {
526
526
  }
527
527
  return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
528
528
  }
529
- const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
529
+ const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
530
530
  function escapeHtmlComment(src) {
531
- return src.replace(commentStripRE, "");
531
+ let prev;
532
+ do {
533
+ prev = src;
534
+ src = src.replace(commentStripRE, "");
535
+ } while (src !== prev);
536
+ return src;
532
537
  }
533
538
  const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
534
539
  function getEscapedCssVarName(key, doubleEscape) {
@@ -664,7 +669,13 @@ const VaporVForFlags = {
664
669
  "IS_COMPONENT": 2,
665
670
  "2": "IS_COMPONENT",
666
671
  "ONCE": 4,
667
- "4": "ONCE"
672
+ "4": "ONCE",
673
+ "IS_SINGLE_NODE": 8,
674
+ "8": "IS_SINGLE_NODE",
675
+ "IS_FRAGMENT": 16,
676
+ "16": "IS_FRAGMENT",
677
+ "SLOT_ROOT": 32,
678
+ "32": "SLOT_ROOT"
668
679
  };
669
680
  const VaporBlockShape = {
670
681
  "EMPTY": 0,
@@ -674,6 +685,67 @@ const VaporBlockShape = {
674
685
  "MULTI_ROOT": 2,
675
686
  "2": "MULTI_ROOT"
676
687
  };
688
+ /**
689
+ * Bit layout for vapor `createIf` flags.
690
+ *
691
+ * - bits 0-1: true branch VaporBlockShape
692
+ * - bits 2-3: false branch VaporBlockShape
693
+ * - bit 4: v-once
694
+ * - bit 5: true branch is static and can skip branch-owned EffectScope
695
+ * - bit 6: false branch is static and can skip branch-owned EffectScope
696
+ * - bit 7: v-if sits on a slot content/fallback root chain
697
+ * - bits 8+: branch index + 1 for keyed dynamic fragments
698
+ *
699
+ * Examples:
700
+ * - v-once, true single-root, no false branch: 1 | ONCE = 17
701
+ * - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
702
+ */
703
+ const VaporIfFlags = {
704
+ "BLOCK_SHAPE": 15,
705
+ "15": "BLOCK_SHAPE",
706
+ "ONCE": 16,
707
+ "16": "ONCE",
708
+ "TRUE_NO_SCOPE": 32,
709
+ "32": "TRUE_NO_SCOPE",
710
+ "FALSE_NO_SCOPE": 64,
711
+ "64": "FALSE_NO_SCOPE",
712
+ "SLOT_ROOT": 128,
713
+ "128": "SLOT_ROOT",
714
+ "INDEX_SHIFT": 8,
715
+ "8": "INDEX_SHIFT"
716
+ };
717
+ /**
718
+ * Flags used by vapor template factories, shared between the compiler and the
719
+ * runtime.
720
+ */
721
+ const TemplateFlags = {
722
+ "ROOT": 1,
723
+ "1": "ROOT",
724
+ "STATIC": 2,
725
+ "2": "STATIC"
726
+ };
727
+ /**
728
+ * Flags used by vapor slot outlets, shared between the compiler and the
729
+ * runtime.
730
+ */
731
+ const VaporSlotFlags = {
732
+ "NO_SLOTTED": 1,
733
+ "1": "NO_SLOTTED",
734
+ "ONCE": 2,
735
+ "2": "ONCE",
736
+ "SLOT_ROOT": 4,
737
+ "4": "SLOT_ROOT",
738
+ "NON_STABLE": 8,
739
+ "8": "NON_STABLE"
740
+ };
741
+ const VaporDynamicComponentFlags = {
742
+ "SINGLE_ROOT": 1,
743
+ "1": "SINGLE_ROOT",
744
+ "ONCE": 2,
745
+ "2": "ONCE",
746
+ "SLOT_ROOT": 4,
747
+ "4": "SLOT_ROOT"
748
+ };
677
749
  //#endregion
678
750
  exports.EMPTY_ARR = EMPTY_ARR;
679
751
  exports.EMPTY_OBJ = EMPTY_OBJ;
@@ -684,7 +756,11 @@ exports.PatchFlagNames = PatchFlagNames;
684
756
  exports.PatchFlags = PatchFlags;
685
757
  exports.ShapeFlags = ShapeFlags;
686
758
  exports.SlotFlags = SlotFlags;
759
+ exports.TemplateFlags = TemplateFlags;
687
760
  exports.VaporBlockShape = VaporBlockShape;
761
+ exports.VaporDynamicComponentFlags = VaporDynamicComponentFlags;
762
+ exports.VaporIfFlags = VaporIfFlags;
763
+ exports.VaporSlotFlags = VaporSlotFlags;
688
764
  exports.VaporVForFlags = VaporVForFlags;
689
765
  exports.YES = YES;
690
766
  exports.camelize = camelize;
package/dist/shared.d.ts CHANGED
@@ -401,17 +401,102 @@ export declare enum VaporVForFlags {
401
401
  FAST_REMOVE = 1,
402
402
  /**
403
403
  * v-for used on component - we can skip creating child scopes for each block
404
- * because the component itself already has a scope.
404
+ * because the component itself already has a scope. This does not guarantee
405
+ * the item block is a VaporComponentInstance: component fallback paths may
406
+ * still return a DOM Node.
405
407
  */
406
408
  IS_COMPONENT = 2,
407
409
  /**
408
410
  * v-for inside v-once
409
411
  */
410
- ONCE = 4
412
+ ONCE = 4,
413
+ /**
414
+ * v-for item block is a single DOM Node.
415
+ */
416
+ IS_SINGLE_NODE = 8,
417
+ /**
418
+ * v-for item block is known to be a VaporFragment, so runtime can use
419
+ * fragment-specific insert/remove helpers.
420
+ */
421
+ IS_FRAGMENT = 16,
422
+ /**
423
+ * v-for sits on a slot content/fallback root chain and can change slot
424
+ * validity.
425
+ */
426
+ SLOT_ROOT = 32
411
427
  }
412
428
  export declare enum VaporBlockShape {
413
429
  EMPTY = 0,
414
430
  SINGLE_ROOT = 1,
415
431
  MULTI_ROOT = 2
416
432
  }
433
+ /**
434
+ * Bit layout for vapor `createIf` flags.
435
+ *
436
+ * - bits 0-1: true branch VaporBlockShape
437
+ * - bits 2-3: false branch VaporBlockShape
438
+ * - bit 4: v-once
439
+ * - bit 5: true branch is static and can skip branch-owned EffectScope
440
+ * - bit 6: false branch is static and can skip branch-owned EffectScope
441
+ * - bit 7: v-if sits on a slot content/fallback root chain
442
+ * - bits 8+: branch index + 1 for keyed dynamic fragments
443
+ *
444
+ * Examples:
445
+ * - v-once, true single-root, no false branch: 1 | ONCE = 17
446
+ * - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
447
+ */
448
+ export declare enum VaporIfFlags {
449
+ /**
450
+ * Documents the packed true/false branch shape bits. Runtime decode shifts
451
+ * to the selected branch first, then masks with 0b11 for one VaporBlockShape.
452
+ */
453
+ BLOCK_SHAPE = 15,
454
+ /**
455
+ * Marks a branch that is created once and never updated.
456
+ */
457
+ ONCE = 16,
458
+ /**
459
+ * The compiler proved that the true branch only returns static template nodes,
460
+ * so runtime can skip creating a branch-owned EffectScope.
461
+ */
462
+ TRUE_NO_SCOPE = 32,
463
+ /**
464
+ * The compiler proved that the false branch only returns static template
465
+ * nodes, so runtime can skip creating a branch-owned EffectScope.
466
+ */
467
+ FALSE_NO_SCOPE = 64,
468
+ /**
469
+ * v-if sits on a slot content/fallback root chain and can change slot
470
+ * validity.
471
+ */
472
+ SLOT_ROOT = 128,
473
+ /**
474
+ * Shift for keyed branch index. The encoded value is index + 1, so decoded
475
+ * zero means "not keyed" and source index 0 still round-trips.
476
+ */
477
+ INDEX_SHIFT = 8
478
+ }
479
+ /**
480
+ * Flags used by vapor template factories, shared between the compiler and the
481
+ * runtime.
482
+ */
483
+ export declare enum TemplateFlags {
484
+ ROOT = 1,
485
+ STATIC = 2
486
+ }
487
+ /**
488
+ * Flags used by vapor slot outlets, shared between the compiler and the
489
+ * runtime.
490
+ */
491
+ export declare enum VaporSlotFlags {
492
+ NO_SLOTTED = 1,
493
+ ONCE = 2,
494
+ SLOT_ROOT = 4,
495
+ NON_STABLE = 8
496
+ }
497
+ export declare enum VaporDynamicComponentFlags {
498
+ SINGLE_ROOT = 1,
499
+ ONCE = 2,
500
+ SLOT_ROOT = 4
501
+ }
417
502
  //#endregion
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.6.0-beta.8
2
+ * @vue/shared v3.6.0-rc.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -522,9 +522,14 @@ function escapeHtml(string) {
522
522
  }
523
523
  return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
524
524
  }
525
- const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
525
+ const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
526
526
  function escapeHtmlComment(src) {
527
- return src.replace(commentStripRE, "");
527
+ let prev;
528
+ do {
529
+ prev = src;
530
+ src = src.replace(commentStripRE, "");
531
+ } while (src !== prev);
532
+ return src;
528
533
  }
529
534
  const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
530
535
  function getEscapedCssVarName(key, doubleEscape) {
@@ -662,7 +667,13 @@ const VaporVForFlags = {
662
667
  "IS_COMPONENT": 2,
663
668
  "2": "IS_COMPONENT",
664
669
  "ONCE": 4,
665
- "4": "ONCE"
670
+ "4": "ONCE",
671
+ "IS_SINGLE_NODE": 8,
672
+ "8": "IS_SINGLE_NODE",
673
+ "IS_FRAGMENT": 16,
674
+ "16": "IS_FRAGMENT",
675
+ "SLOT_ROOT": 32,
676
+ "32": "SLOT_ROOT"
666
677
  };
667
678
  const VaporBlockShape = {
668
679
  "EMPTY": 0,
@@ -672,5 +683,66 @@ const VaporBlockShape = {
672
683
  "MULTI_ROOT": 2,
673
684
  "2": "MULTI_ROOT"
674
685
  };
686
+ /**
687
+ * Bit layout for vapor `createIf` flags.
688
+ *
689
+ * - bits 0-1: true branch VaporBlockShape
690
+ * - bits 2-3: false branch VaporBlockShape
691
+ * - bit 4: v-once
692
+ * - bit 5: true branch is static and can skip branch-owned EffectScope
693
+ * - bit 6: false branch is static and can skip branch-owned EffectScope
694
+ * - bit 7: v-if sits on a slot content/fallback root chain
695
+ * - bits 8+: branch index + 1 for keyed dynamic fragments
696
+ *
697
+ * Examples:
698
+ * - v-once, true single-root, no false branch: 1 | ONCE = 17
699
+ * - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
700
+ */
701
+ const VaporIfFlags = {
702
+ "BLOCK_SHAPE": 15,
703
+ "15": "BLOCK_SHAPE",
704
+ "ONCE": 16,
705
+ "16": "ONCE",
706
+ "TRUE_NO_SCOPE": 32,
707
+ "32": "TRUE_NO_SCOPE",
708
+ "FALSE_NO_SCOPE": 64,
709
+ "64": "FALSE_NO_SCOPE",
710
+ "SLOT_ROOT": 128,
711
+ "128": "SLOT_ROOT",
712
+ "INDEX_SHIFT": 8,
713
+ "8": "INDEX_SHIFT"
714
+ };
715
+ /**
716
+ * Flags used by vapor template factories, shared between the compiler and the
717
+ * runtime.
718
+ */
719
+ const TemplateFlags = {
720
+ "ROOT": 1,
721
+ "1": "ROOT",
722
+ "STATIC": 2,
723
+ "2": "STATIC"
724
+ };
725
+ /**
726
+ * Flags used by vapor slot outlets, shared between the compiler and the
727
+ * runtime.
728
+ */
729
+ const VaporSlotFlags = {
730
+ "NO_SLOTTED": 1,
731
+ "1": "NO_SLOTTED",
732
+ "ONCE": 2,
733
+ "2": "ONCE",
734
+ "SLOT_ROOT": 4,
735
+ "4": "SLOT_ROOT",
736
+ "NON_STABLE": 8,
737
+ "8": "NON_STABLE"
738
+ };
739
+ const VaporDynamicComponentFlags = {
740
+ "SINGLE_ROOT": 1,
741
+ "1": "SINGLE_ROOT",
742
+ "ONCE": 2,
743
+ "2": "ONCE",
744
+ "SLOT_ROOT": 4,
745
+ "4": "SLOT_ROOT"
746
+ };
675
747
  //#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 };
748
+ export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, TemplateFlags, VaporBlockShape, VaporDynamicComponentFlags, VaporIfFlags, VaporSlotFlags, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/shared",
3
- "version": "3.6.0-beta.8",
3
+ "version": "3.6.0-rc.1",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",