@vue/shared 3.5.17 → 3.6.0-alpha.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.
- package/dist/shared.cjs.js +109 -5
- package/dist/shared.cjs.prod.js +101 -5
- package/dist/shared.d.ts +18 -2
- package/dist/shared.esm-bundler.js +103 -6
- package/package.json +1 -1
package/dist/shared.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.
|
|
2
|
+
* @vue/shared v3.6.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -19,9 +19,12 @@ const EMPTY_OBJ = Object.freeze({}) ;
|
|
|
19
19
|
const EMPTY_ARR = Object.freeze([]) ;
|
|
20
20
|
const NOOP = () => {
|
|
21
21
|
};
|
|
22
|
+
const YES = () => true;
|
|
22
23
|
const NO = () => false;
|
|
23
24
|
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
24
25
|
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
26
|
+
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
27
|
+
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
25
28
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
26
29
|
const extend = Object.assign;
|
|
27
30
|
const remove = (arr, el) => {
|
|
@@ -55,6 +58,7 @@ const isReservedProp = /* @__PURE__ */ makeMap(
|
|
|
55
58
|
// the leading comma is intentional so empty string "" is also included
|
|
56
59
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
57
60
|
);
|
|
61
|
+
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
58
62
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
59
63
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
60
64
|
);
|
|
@@ -66,10 +70,9 @@ const cacheStringFunction = (fn) => {
|
|
|
66
70
|
};
|
|
67
71
|
};
|
|
68
72
|
const camelizeRE = /-(\w)/g;
|
|
73
|
+
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
69
74
|
const camelize = cacheStringFunction(
|
|
70
|
-
(str) =>
|
|
71
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
72
|
-
}
|
|
75
|
+
(str) => str.replace(camelizeRE, camelizeReplacer)
|
|
73
76
|
);
|
|
74
77
|
const hyphenateRE = /\B([A-Z])/g;
|
|
75
78
|
const hyphenate = cacheStringFunction(
|
|
@@ -120,6 +123,10 @@ function genCacheKey(source, options) {
|
|
|
120
123
|
(_, val) => typeof val === "function" ? val.toString() : val
|
|
121
124
|
);
|
|
122
125
|
}
|
|
126
|
+
function canSetValueDirectly(tagName) {
|
|
127
|
+
return tagName !== "PROGRESS" && // custom elements may use _value internally
|
|
128
|
+
!tagName.includes("-");
|
|
129
|
+
}
|
|
123
130
|
|
|
124
131
|
const PatchFlags = {
|
|
125
132
|
"TEXT": 1,
|
|
@@ -379,6 +386,24 @@ function isRenderableAttrValue(value) {
|
|
|
379
386
|
const type = typeof value;
|
|
380
387
|
return type === "string" || type === "number" || type === "boolean";
|
|
381
388
|
}
|
|
389
|
+
function shouldSetAsAttr(tagName, key) {
|
|
390
|
+
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
if (key === "form") {
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
if (key === "list" && tagName === "INPUT") {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
if (key === "type" && tagName === "TEXTAREA") {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
382
407
|
|
|
383
408
|
const escapeRE = /["'&<>]/;
|
|
384
409
|
function escapeHtml(string) {
|
|
@@ -485,7 +510,20 @@ const isRef = (val) => {
|
|
|
485
510
|
return !!(val && val["__v_isRef"] === true);
|
|
486
511
|
};
|
|
487
512
|
const toDisplayString = (val) => {
|
|
488
|
-
|
|
513
|
+
switch (typeof val) {
|
|
514
|
+
case "string":
|
|
515
|
+
return val;
|
|
516
|
+
case "object":
|
|
517
|
+
if (val) {
|
|
518
|
+
if (isRef(val)) {
|
|
519
|
+
return toDisplayString(val.value);
|
|
520
|
+
} else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
|
|
521
|
+
return JSON.stringify(val, replacer, 2);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
default:
|
|
525
|
+
return val == null ? "" : String(val);
|
|
526
|
+
}
|
|
489
527
|
};
|
|
490
528
|
const replacer = (_key, val) => {
|
|
491
529
|
if (isRef(val)) {
|
|
@@ -520,6 +558,65 @@ const stringifySymbol = (v, i = "") => {
|
|
|
520
558
|
);
|
|
521
559
|
};
|
|
522
560
|
|
|
561
|
+
function getSequence(arr) {
|
|
562
|
+
const p = arr.slice();
|
|
563
|
+
const result = [0];
|
|
564
|
+
let i, j, u, v, c;
|
|
565
|
+
const len = arr.length;
|
|
566
|
+
for (i = 0; i < len; i++) {
|
|
567
|
+
const arrI = arr[i];
|
|
568
|
+
if (arrI !== 0) {
|
|
569
|
+
j = result[result.length - 1];
|
|
570
|
+
if (arr[j] < arrI) {
|
|
571
|
+
p[i] = j;
|
|
572
|
+
result.push(i);
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
u = 0;
|
|
576
|
+
v = result.length - 1;
|
|
577
|
+
while (u < v) {
|
|
578
|
+
c = u + v >> 1;
|
|
579
|
+
if (arr[result[c]] < arrI) {
|
|
580
|
+
u = c + 1;
|
|
581
|
+
} else {
|
|
582
|
+
v = c;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if (arrI < arr[result[u]]) {
|
|
586
|
+
if (u > 0) {
|
|
587
|
+
p[i] = result[u - 1];
|
|
588
|
+
}
|
|
589
|
+
result[u] = i;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
u = result.length;
|
|
594
|
+
v = result[u - 1];
|
|
595
|
+
while (u-- > 0) {
|
|
596
|
+
result[u] = v;
|
|
597
|
+
v = p[v];
|
|
598
|
+
}
|
|
599
|
+
return result;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function normalizeCssVarValue(value) {
|
|
603
|
+
if (value == null) {
|
|
604
|
+
return "initial";
|
|
605
|
+
}
|
|
606
|
+
if (typeof value === "string") {
|
|
607
|
+
return value === "" ? " " : value;
|
|
608
|
+
}
|
|
609
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
610
|
+
{
|
|
611
|
+
console.warn(
|
|
612
|
+
"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
|
|
613
|
+
value
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return String(value);
|
|
618
|
+
}
|
|
619
|
+
|
|
523
620
|
exports.EMPTY_ARR = EMPTY_ARR;
|
|
524
621
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
|
525
622
|
exports.NO = NO;
|
|
@@ -528,7 +625,9 @@ exports.PatchFlagNames = PatchFlagNames;
|
|
|
528
625
|
exports.PatchFlags = PatchFlags;
|
|
529
626
|
exports.ShapeFlags = ShapeFlags;
|
|
530
627
|
exports.SlotFlags = SlotFlags;
|
|
628
|
+
exports.YES = YES;
|
|
531
629
|
exports.camelize = camelize;
|
|
630
|
+
exports.canSetValueDirectly = canSetValueDirectly;
|
|
532
631
|
exports.capitalize = capitalize;
|
|
533
632
|
exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
|
|
534
633
|
exports.def = def;
|
|
@@ -540,6 +639,7 @@ exports.genPropsAccessExp = genPropsAccessExp;
|
|
|
540
639
|
exports.generateCodeFrame = generateCodeFrame;
|
|
541
640
|
exports.getEscapedCssVarName = getEscapedCssVarName;
|
|
542
641
|
exports.getGlobalThis = getGlobalThis;
|
|
642
|
+
exports.getSequence = getSequence;
|
|
543
643
|
exports.hasChanged = hasChanged;
|
|
544
644
|
exports.hasOwn = hasOwn;
|
|
545
645
|
exports.hyphenate = hyphenate;
|
|
@@ -548,6 +648,7 @@ exports.invokeArrayFns = invokeArrayFns;
|
|
|
548
648
|
exports.isArray = isArray;
|
|
549
649
|
exports.isBooleanAttr = isBooleanAttr;
|
|
550
650
|
exports.isBuiltInDirective = isBuiltInDirective;
|
|
651
|
+
exports.isBuiltInTag = isBuiltInTag;
|
|
551
652
|
exports.isDate = isDate;
|
|
552
653
|
exports.isFunction = isFunction;
|
|
553
654
|
exports.isGloballyAllowed = isGloballyAllowed;
|
|
@@ -560,6 +661,7 @@ exports.isKnownSvgAttr = isKnownSvgAttr;
|
|
|
560
661
|
exports.isMap = isMap;
|
|
561
662
|
exports.isMathMLTag = isMathMLTag;
|
|
562
663
|
exports.isModelListener = isModelListener;
|
|
664
|
+
exports.isNativeOn = isNativeOn;
|
|
563
665
|
exports.isObject = isObject;
|
|
564
666
|
exports.isOn = isOn;
|
|
565
667
|
exports.isPlainObject = isPlainObject;
|
|
@@ -579,12 +681,14 @@ exports.looseIndexOf = looseIndexOf;
|
|
|
579
681
|
exports.looseToNumber = looseToNumber;
|
|
580
682
|
exports.makeMap = makeMap;
|
|
581
683
|
exports.normalizeClass = normalizeClass;
|
|
684
|
+
exports.normalizeCssVarValue = normalizeCssVarValue;
|
|
582
685
|
exports.normalizeProps = normalizeProps;
|
|
583
686
|
exports.normalizeStyle = normalizeStyle;
|
|
584
687
|
exports.objectToString = objectToString;
|
|
585
688
|
exports.parseStringStyle = parseStringStyle;
|
|
586
689
|
exports.propsToAttrMap = propsToAttrMap;
|
|
587
690
|
exports.remove = remove;
|
|
691
|
+
exports.shouldSetAsAttr = shouldSetAsAttr;
|
|
588
692
|
exports.slotFlagsText = slotFlagsText;
|
|
589
693
|
exports.stringifyStyle = stringifyStyle;
|
|
590
694
|
exports.toDisplayString = toDisplayString;
|
package/dist/shared.cjs.prod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.
|
|
2
|
+
* @vue/shared v3.6.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -19,9 +19,12 @@ const EMPTY_OBJ = {};
|
|
|
19
19
|
const EMPTY_ARR = [];
|
|
20
20
|
const NOOP = () => {
|
|
21
21
|
};
|
|
22
|
+
const YES = () => true;
|
|
22
23
|
const NO = () => false;
|
|
23
24
|
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
24
25
|
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
26
|
+
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
27
|
+
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
25
28
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
26
29
|
const extend = Object.assign;
|
|
27
30
|
const remove = (arr, el) => {
|
|
@@ -55,6 +58,7 @@ const isReservedProp = /* @__PURE__ */ makeMap(
|
|
|
55
58
|
// the leading comma is intentional so empty string "" is also included
|
|
56
59
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
57
60
|
);
|
|
61
|
+
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
58
62
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
59
63
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
60
64
|
);
|
|
@@ -66,10 +70,9 @@ const cacheStringFunction = (fn) => {
|
|
|
66
70
|
};
|
|
67
71
|
};
|
|
68
72
|
const camelizeRE = /-(\w)/g;
|
|
73
|
+
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
69
74
|
const camelize = cacheStringFunction(
|
|
70
|
-
(str) =>
|
|
71
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
72
|
-
}
|
|
75
|
+
(str) => str.replace(camelizeRE, camelizeReplacer)
|
|
73
76
|
);
|
|
74
77
|
const hyphenateRE = /\B([A-Z])/g;
|
|
75
78
|
const hyphenate = cacheStringFunction(
|
|
@@ -120,6 +123,10 @@ function genCacheKey(source, options) {
|
|
|
120
123
|
(_, val) => typeof val === "function" ? val.toString() : val
|
|
121
124
|
);
|
|
122
125
|
}
|
|
126
|
+
function canSetValueDirectly(tagName) {
|
|
127
|
+
return tagName !== "PROGRESS" && // custom elements may use _value internally
|
|
128
|
+
!tagName.includes("-");
|
|
129
|
+
}
|
|
123
130
|
|
|
124
131
|
const PatchFlags = {
|
|
125
132
|
"TEXT": 1,
|
|
@@ -379,6 +386,24 @@ function isRenderableAttrValue(value) {
|
|
|
379
386
|
const type = typeof value;
|
|
380
387
|
return type === "string" || type === "number" || type === "boolean";
|
|
381
388
|
}
|
|
389
|
+
function shouldSetAsAttr(tagName, key) {
|
|
390
|
+
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
if (key === "form") {
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
if (key === "list" && tagName === "INPUT") {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
if (key === "type" && tagName === "TEXTAREA") {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
382
407
|
|
|
383
408
|
const escapeRE = /["'&<>]/;
|
|
384
409
|
function escapeHtml(string) {
|
|
@@ -485,7 +510,20 @@ const isRef = (val) => {
|
|
|
485
510
|
return !!(val && val["__v_isRef"] === true);
|
|
486
511
|
};
|
|
487
512
|
const toDisplayString = (val) => {
|
|
488
|
-
|
|
513
|
+
switch (typeof val) {
|
|
514
|
+
case "string":
|
|
515
|
+
return val;
|
|
516
|
+
case "object":
|
|
517
|
+
if (val) {
|
|
518
|
+
if (isRef(val)) {
|
|
519
|
+
return toDisplayString(val.value);
|
|
520
|
+
} else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
|
|
521
|
+
return JSON.stringify(val, replacer, 2);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
default:
|
|
525
|
+
return val == null ? "" : String(val);
|
|
526
|
+
}
|
|
489
527
|
};
|
|
490
528
|
const replacer = (_key, val) => {
|
|
491
529
|
if (isRef(val)) {
|
|
@@ -520,6 +558,57 @@ const stringifySymbol = (v, i = "") => {
|
|
|
520
558
|
);
|
|
521
559
|
};
|
|
522
560
|
|
|
561
|
+
function getSequence(arr) {
|
|
562
|
+
const p = arr.slice();
|
|
563
|
+
const result = [0];
|
|
564
|
+
let i, j, u, v, c;
|
|
565
|
+
const len = arr.length;
|
|
566
|
+
for (i = 0; i < len; i++) {
|
|
567
|
+
const arrI = arr[i];
|
|
568
|
+
if (arrI !== 0) {
|
|
569
|
+
j = result[result.length - 1];
|
|
570
|
+
if (arr[j] < arrI) {
|
|
571
|
+
p[i] = j;
|
|
572
|
+
result.push(i);
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
u = 0;
|
|
576
|
+
v = result.length - 1;
|
|
577
|
+
while (u < v) {
|
|
578
|
+
c = u + v >> 1;
|
|
579
|
+
if (arr[result[c]] < arrI) {
|
|
580
|
+
u = c + 1;
|
|
581
|
+
} else {
|
|
582
|
+
v = c;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if (arrI < arr[result[u]]) {
|
|
586
|
+
if (u > 0) {
|
|
587
|
+
p[i] = result[u - 1];
|
|
588
|
+
}
|
|
589
|
+
result[u] = i;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
u = result.length;
|
|
594
|
+
v = result[u - 1];
|
|
595
|
+
while (u-- > 0) {
|
|
596
|
+
result[u] = v;
|
|
597
|
+
v = p[v];
|
|
598
|
+
}
|
|
599
|
+
return result;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function normalizeCssVarValue(value) {
|
|
603
|
+
if (value == null) {
|
|
604
|
+
return "initial";
|
|
605
|
+
}
|
|
606
|
+
if (typeof value === "string") {
|
|
607
|
+
return value === "" ? " " : value;
|
|
608
|
+
}
|
|
609
|
+
return String(value);
|
|
610
|
+
}
|
|
611
|
+
|
|
523
612
|
exports.EMPTY_ARR = EMPTY_ARR;
|
|
524
613
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
|
525
614
|
exports.NO = NO;
|
|
@@ -528,7 +617,9 @@ exports.PatchFlagNames = PatchFlagNames;
|
|
|
528
617
|
exports.PatchFlags = PatchFlags;
|
|
529
618
|
exports.ShapeFlags = ShapeFlags;
|
|
530
619
|
exports.SlotFlags = SlotFlags;
|
|
620
|
+
exports.YES = YES;
|
|
531
621
|
exports.camelize = camelize;
|
|
622
|
+
exports.canSetValueDirectly = canSetValueDirectly;
|
|
532
623
|
exports.capitalize = capitalize;
|
|
533
624
|
exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
|
|
534
625
|
exports.def = def;
|
|
@@ -540,6 +631,7 @@ exports.genPropsAccessExp = genPropsAccessExp;
|
|
|
540
631
|
exports.generateCodeFrame = generateCodeFrame;
|
|
541
632
|
exports.getEscapedCssVarName = getEscapedCssVarName;
|
|
542
633
|
exports.getGlobalThis = getGlobalThis;
|
|
634
|
+
exports.getSequence = getSequence;
|
|
543
635
|
exports.hasChanged = hasChanged;
|
|
544
636
|
exports.hasOwn = hasOwn;
|
|
545
637
|
exports.hyphenate = hyphenate;
|
|
@@ -548,6 +640,7 @@ exports.invokeArrayFns = invokeArrayFns;
|
|
|
548
640
|
exports.isArray = isArray;
|
|
549
641
|
exports.isBooleanAttr = isBooleanAttr;
|
|
550
642
|
exports.isBuiltInDirective = isBuiltInDirective;
|
|
643
|
+
exports.isBuiltInTag = isBuiltInTag;
|
|
551
644
|
exports.isDate = isDate;
|
|
552
645
|
exports.isFunction = isFunction;
|
|
553
646
|
exports.isGloballyAllowed = isGloballyAllowed;
|
|
@@ -560,6 +653,7 @@ exports.isKnownSvgAttr = isKnownSvgAttr;
|
|
|
560
653
|
exports.isMap = isMap;
|
|
561
654
|
exports.isMathMLTag = isMathMLTag;
|
|
562
655
|
exports.isModelListener = isModelListener;
|
|
656
|
+
exports.isNativeOn = isNativeOn;
|
|
563
657
|
exports.isObject = isObject;
|
|
564
658
|
exports.isOn = isOn;
|
|
565
659
|
exports.isPlainObject = isPlainObject;
|
|
@@ -579,12 +673,14 @@ exports.looseIndexOf = looseIndexOf;
|
|
|
579
673
|
exports.looseToNumber = looseToNumber;
|
|
580
674
|
exports.makeMap = makeMap;
|
|
581
675
|
exports.normalizeClass = normalizeClass;
|
|
676
|
+
exports.normalizeCssVarValue = normalizeCssVarValue;
|
|
582
677
|
exports.normalizeProps = normalizeProps;
|
|
583
678
|
exports.normalizeStyle = normalizeStyle;
|
|
584
679
|
exports.objectToString = objectToString;
|
|
585
680
|
exports.parseStringStyle = parseStringStyle;
|
|
586
681
|
exports.propsToAttrMap = propsToAttrMap;
|
|
587
682
|
exports.remove = remove;
|
|
683
|
+
exports.shouldSetAsAttr = shouldSetAsAttr;
|
|
588
684
|
exports.slotFlagsText = slotFlagsText;
|
|
589
685
|
exports.stringifyStyle = stringifyStyle;
|
|
590
686
|
exports.toDisplayString = toDisplayString;
|
package/dist/shared.d.ts
CHANGED
|
@@ -13,12 +13,17 @@ export declare const EMPTY_OBJ: {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const EMPTY_ARR: readonly never[];
|
|
15
15
|
export declare const NOOP: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Always return true.
|
|
18
|
+
*/
|
|
19
|
+
export declare const YES: () => boolean;
|
|
16
20
|
/**
|
|
17
21
|
* Always return false.
|
|
18
22
|
*/
|
|
19
23
|
export declare const NO: () => boolean;
|
|
20
24
|
export declare const isOn: (key: string) => boolean;
|
|
21
|
-
export declare const
|
|
25
|
+
export declare const isNativeOn: (key: string) => boolean;
|
|
26
|
+
export declare const isModelListener: (key: string) => boolean;
|
|
22
27
|
export declare const extend: typeof Object.assign;
|
|
23
28
|
export declare const remove: <T>(arr: T[], el: T) => void;
|
|
24
29
|
export declare const hasOwn: (val: object, key: string | symbol) => key is keyof typeof val;
|
|
@@ -38,6 +43,7 @@ export declare const toRawType: (value: unknown) => string;
|
|
|
38
43
|
export declare const isPlainObject: (val: unknown) => val is object;
|
|
39
44
|
export declare const isIntegerKey: (key: unknown) => boolean;
|
|
40
45
|
export declare const isReservedProp: (key: string) => boolean;
|
|
46
|
+
export declare const isBuiltInTag: (key: string) => boolean;
|
|
41
47
|
export declare const isBuiltInDirective: (key: string) => boolean;
|
|
42
48
|
/**
|
|
43
49
|
* @private
|
|
@@ -71,6 +77,7 @@ export declare const toNumber: (val: any) => any;
|
|
|
71
77
|
export declare const getGlobalThis: () => any;
|
|
72
78
|
export declare function genPropsAccessExp(name: string): string;
|
|
73
79
|
export declare function genCacheKey(source: string, options: any): string;
|
|
80
|
+
export declare function canSetValueDirectly(tagName: string): boolean;
|
|
74
81
|
|
|
75
82
|
/**
|
|
76
83
|
* Patch flags are optimization hints generated by the compiler.
|
|
@@ -234,7 +241,7 @@ export declare const isGloballyWhitelisted: (key: string) => boolean;
|
|
|
234
241
|
|
|
235
242
|
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
|
236
243
|
|
|
237
|
-
export type NormalizedStyle = Record<string,
|
|
244
|
+
export type NormalizedStyle = Record<string, unknown>;
|
|
238
245
|
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
|
239
246
|
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
|
240
247
|
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
|
|
@@ -293,6 +300,7 @@ export declare const isKnownMathMLAttr: (key: string) => boolean;
|
|
|
293
300
|
* Shared between server-renderer and runtime-core hydration logic
|
|
294
301
|
*/
|
|
295
302
|
export declare function isRenderableAttrValue(value: unknown): boolean;
|
|
303
|
+
export declare function shouldSetAsAttr(tagName: string, key: string): boolean;
|
|
296
304
|
|
|
297
305
|
export declare function escapeHtml(string: unknown): string;
|
|
298
306
|
export declare function escapeHtmlComment(src: string): string;
|
|
@@ -326,4 +334,12 @@ type OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>;
|
|
|
326
334
|
type OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends (...args: infer TArgs) => infer TReturn ? TPartialOverload extends TOverload ? never : OverloadUnionRecursive<TPartialOverload & TOverload, TPartialOverload & ((...args: TArgs) => TReturn) & OverloadProps<TOverload>> | ((...args: TArgs) => TReturn) : never;
|
|
327
335
|
type OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<OverloadUnionRecursive<(() => never) & TOverload>, TOverload extends () => never ? never : () => never>;
|
|
328
336
|
|
|
337
|
+
export declare function getSequence(arr: number[]): number[];
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Normalize CSS var value created by `v-bind` in `<style>` block
|
|
341
|
+
* See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
|
|
342
|
+
*/
|
|
343
|
+
export declare function normalizeCssVarValue(value: unknown): string;
|
|
344
|
+
|
|
329
345
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.
|
|
2
|
+
* @vue/shared v3.6.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -15,9 +15,12 @@ const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({})
|
|
|
15
15
|
const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
16
16
|
const NOOP = () => {
|
|
17
17
|
};
|
|
18
|
+
const YES = () => true;
|
|
18
19
|
const NO = () => false;
|
|
19
20
|
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
20
21
|
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
22
|
+
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
23
|
+
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
21
24
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
22
25
|
const extend = Object.assign;
|
|
23
26
|
const remove = (arr, el) => {
|
|
@@ -51,6 +54,7 @@ const isReservedProp = /* @__PURE__ */ makeMap(
|
|
|
51
54
|
// the leading comma is intentional so empty string "" is also included
|
|
52
55
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
53
56
|
);
|
|
57
|
+
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
54
58
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
55
59
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
56
60
|
);
|
|
@@ -62,10 +66,9 @@ const cacheStringFunction = (fn) => {
|
|
|
62
66
|
};
|
|
63
67
|
};
|
|
64
68
|
const camelizeRE = /-(\w)/g;
|
|
69
|
+
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
65
70
|
const camelize = cacheStringFunction(
|
|
66
|
-
(str) =>
|
|
67
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
68
|
-
}
|
|
71
|
+
(str) => str.replace(camelizeRE, camelizeReplacer)
|
|
69
72
|
);
|
|
70
73
|
const hyphenateRE = /\B([A-Z])/g;
|
|
71
74
|
const hyphenate = cacheStringFunction(
|
|
@@ -116,6 +119,10 @@ function genCacheKey(source, options) {
|
|
|
116
119
|
(_, val) => typeof val === "function" ? val.toString() : val
|
|
117
120
|
);
|
|
118
121
|
}
|
|
122
|
+
function canSetValueDirectly(tagName) {
|
|
123
|
+
return tagName !== "PROGRESS" && // custom elements may use _value internally
|
|
124
|
+
!tagName.includes("-");
|
|
125
|
+
}
|
|
119
126
|
|
|
120
127
|
const PatchFlags = {
|
|
121
128
|
"TEXT": 1,
|
|
@@ -375,6 +382,24 @@ function isRenderableAttrValue(value) {
|
|
|
375
382
|
const type = typeof value;
|
|
376
383
|
return type === "string" || type === "number" || type === "boolean";
|
|
377
384
|
}
|
|
385
|
+
function shouldSetAsAttr(tagName, key) {
|
|
386
|
+
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
if (key === "form") {
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
if (key === "list" && tagName === "INPUT") {
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
if (key === "type" && tagName === "TEXTAREA") {
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
378
403
|
|
|
379
404
|
const escapeRE = /["'&<>]/;
|
|
380
405
|
function escapeHtml(string) {
|
|
@@ -481,7 +506,20 @@ const isRef = (val) => {
|
|
|
481
506
|
return !!(val && val["__v_isRef"] === true);
|
|
482
507
|
};
|
|
483
508
|
const toDisplayString = (val) => {
|
|
484
|
-
|
|
509
|
+
switch (typeof val) {
|
|
510
|
+
case "string":
|
|
511
|
+
return val;
|
|
512
|
+
case "object":
|
|
513
|
+
if (val) {
|
|
514
|
+
if (isRef(val)) {
|
|
515
|
+
return toDisplayString(val.value);
|
|
516
|
+
} else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
|
|
517
|
+
return JSON.stringify(val, replacer, 2);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
default:
|
|
521
|
+
return val == null ? "" : String(val);
|
|
522
|
+
}
|
|
485
523
|
};
|
|
486
524
|
const replacer = (_key, val) => {
|
|
487
525
|
if (isRef(val)) {
|
|
@@ -516,4 +554,63 @@ const stringifySymbol = (v, i = "") => {
|
|
|
516
554
|
);
|
|
517
555
|
};
|
|
518
556
|
|
|
519
|
-
|
|
557
|
+
function getSequence(arr) {
|
|
558
|
+
const p = arr.slice();
|
|
559
|
+
const result = [0];
|
|
560
|
+
let i, j, u, v, c;
|
|
561
|
+
const len = arr.length;
|
|
562
|
+
for (i = 0; i < len; i++) {
|
|
563
|
+
const arrI = arr[i];
|
|
564
|
+
if (arrI !== 0) {
|
|
565
|
+
j = result[result.length - 1];
|
|
566
|
+
if (arr[j] < arrI) {
|
|
567
|
+
p[i] = j;
|
|
568
|
+
result.push(i);
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
u = 0;
|
|
572
|
+
v = result.length - 1;
|
|
573
|
+
while (u < v) {
|
|
574
|
+
c = u + v >> 1;
|
|
575
|
+
if (arr[result[c]] < arrI) {
|
|
576
|
+
u = c + 1;
|
|
577
|
+
} else {
|
|
578
|
+
v = c;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (arrI < arr[result[u]]) {
|
|
582
|
+
if (u > 0) {
|
|
583
|
+
p[i] = result[u - 1];
|
|
584
|
+
}
|
|
585
|
+
result[u] = i;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
u = result.length;
|
|
590
|
+
v = result[u - 1];
|
|
591
|
+
while (u-- > 0) {
|
|
592
|
+
result[u] = v;
|
|
593
|
+
v = p[v];
|
|
594
|
+
}
|
|
595
|
+
return result;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function normalizeCssVarValue(value) {
|
|
599
|
+
if (value == null) {
|
|
600
|
+
return "initial";
|
|
601
|
+
}
|
|
602
|
+
if (typeof value === "string") {
|
|
603
|
+
return value === "" ? " " : value;
|
|
604
|
+
}
|
|
605
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
606
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
607
|
+
console.warn(
|
|
608
|
+
"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
|
|
609
|
+
value
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return String(value);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, 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 };
|