@vue/shared 3.2.45 → 3.2.47

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.
@@ -188,7 +188,7 @@ function normalizeProps(props) {
188
188
  // These tag configs are shared between compiler-dom and runtime-dom, so they
189
189
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
190
190
  const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
191
- 'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
191
+ 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
192
192
  'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
193
193
  'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
194
194
  'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
@@ -200,7 +200,7 @@ const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,asi
200
200
  const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
201
201
  'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
202
202
  'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
203
- 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
203
+ 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
204
204
  'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
205
205
  'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
206
206
  'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
@@ -496,6 +496,7 @@ const isArray = Array.isArray;
496
496
  const isMap = (val) => toTypeString(val) === '[object Map]';
497
497
  const isSet = (val) => toTypeString(val) === '[object Set]';
498
498
  const isDate = (val) => toTypeString(val) === '[object Date]';
499
+ const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
499
500
  const isFunction = (val) => typeof val === 'function';
500
501
  const isString = (val) => typeof val === 'string';
501
502
  const isSymbol = (val) => typeof val === 'symbol';
@@ -562,10 +563,22 @@ const def = (obj, key, value) => {
562
563
  value
563
564
  });
564
565
  };
565
- const toNumber = (val) => {
566
+ /**
567
+ * "123-foo" will be parsed to 123
568
+ * This is used for the .number modifier in v-model
569
+ */
570
+ const looseToNumber = (val) => {
566
571
  const n = parseFloat(val);
567
572
  return isNaN(n) ? val : n;
568
573
  };
574
+ /**
575
+ * Only conerces number-like strings
576
+ * "123-foo" will be returned as-is
577
+ */
578
+ const toNumber = (val) => {
579
+ const n = isString(val) ? Number(val) : NaN;
580
+ return isNaN(n) ? val : n;
581
+ };
569
582
  let _globalThis;
570
583
  const getGlobalThis = () => {
571
584
  return (_globalThis ||
@@ -622,6 +635,7 @@ exports.isObject = isObject;
622
635
  exports.isOn = isOn;
623
636
  exports.isPlainObject = isPlainObject;
624
637
  exports.isPromise = isPromise;
638
+ exports.isRegExp = isRegExp;
625
639
  exports.isReservedProp = isReservedProp;
626
640
  exports.isSSRSafeAttrName = isSSRSafeAttrName;
627
641
  exports.isSVGTag = isSVGTag;
@@ -632,6 +646,7 @@ exports.isSymbol = isSymbol;
632
646
  exports.isVoidTag = isVoidTag;
633
647
  exports.looseEqual = looseEqual;
634
648
  exports.looseIndexOf = looseIndexOf;
649
+ exports.looseToNumber = looseToNumber;
635
650
  exports.makeMap = makeMap;
636
651
  exports.normalizeClass = normalizeClass;
637
652
  exports.normalizeProps = normalizeProps;
@@ -188,7 +188,7 @@ function normalizeProps(props) {
188
188
  // These tag configs are shared between compiler-dom and runtime-dom, so they
189
189
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
190
190
  const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
191
- 'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
191
+ 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
192
192
  'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
193
193
  'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
194
194
  'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
@@ -200,7 +200,7 @@ const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,asi
200
200
  const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
201
201
  'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
202
202
  'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
203
- 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
203
+ 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
204
204
  'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
205
205
  'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
206
206
  'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
@@ -495,6 +495,7 @@ const isArray = Array.isArray;
495
495
  const isMap = (val) => toTypeString(val) === '[object Map]';
496
496
  const isSet = (val) => toTypeString(val) === '[object Set]';
497
497
  const isDate = (val) => toTypeString(val) === '[object Date]';
498
+ const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
498
499
  const isFunction = (val) => typeof val === 'function';
499
500
  const isString = (val) => typeof val === 'string';
500
501
  const isSymbol = (val) => typeof val === 'symbol';
@@ -561,10 +562,22 @@ const def = (obj, key, value) => {
561
562
  value
562
563
  });
563
564
  };
564
- const toNumber = (val) => {
565
+ /**
566
+ * "123-foo" will be parsed to 123
567
+ * This is used for the .number modifier in v-model
568
+ */
569
+ const looseToNumber = (val) => {
565
570
  const n = parseFloat(val);
566
571
  return isNaN(n) ? val : n;
567
572
  };
573
+ /**
574
+ * Only conerces number-like strings
575
+ * "123-foo" will be returned as-is
576
+ */
577
+ const toNumber = (val) => {
578
+ const n = isString(val) ? Number(val) : NaN;
579
+ return isNaN(n) ? val : n;
580
+ };
568
581
  let _globalThis;
569
582
  const getGlobalThis = () => {
570
583
  return (_globalThis ||
@@ -621,6 +634,7 @@ exports.isObject = isObject;
621
634
  exports.isOn = isOn;
622
635
  exports.isPlainObject = isPlainObject;
623
636
  exports.isPromise = isPromise;
637
+ exports.isRegExp = isRegExp;
624
638
  exports.isReservedProp = isReservedProp;
625
639
  exports.isSSRSafeAttrName = isSSRSafeAttrName;
626
640
  exports.isSVGTag = isSVGTag;
@@ -631,6 +645,7 @@ exports.isSymbol = isSymbol;
631
645
  exports.isVoidTag = isVoidTag;
632
646
  exports.looseEqual = looseEqual;
633
647
  exports.looseIndexOf = looseIndexOf;
648
+ exports.looseToNumber = looseToNumber;
634
649
  exports.makeMap = makeMap;
635
650
  exports.normalizeClass = normalizeClass;
636
651
  exports.normalizeProps = normalizeProps;
package/dist/shared.d.ts CHANGED
@@ -100,6 +100,8 @@ export declare const isPlainObject: (val: unknown) => val is object;
100
100
 
101
101
  export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
102
102
 
103
+ export declare const isRegExp: (val: unknown) => val is RegExp;
104
+
103
105
  export declare const isReservedProp: (key: string) => boolean;
104
106
 
105
107
  export declare const isSet: (val: unknown) => val is Set<any>;
@@ -132,6 +134,12 @@ export declare type LooseRequired<T> = {
132
134
  [P in keyof (T & Required<T>)]: T[P];
133
135
  };
134
136
 
137
+ /**
138
+ * "123-foo" will be parsed to 123
139
+ * This is used for the .number modifier in v-model
140
+ */
141
+ export declare const looseToNumber: (val: any) => any;
142
+
135
143
  /**
136
144
  * Make a map and return a function for checking if a key
137
145
  * is in that map.
@@ -340,6 +348,10 @@ export declare const toDisplayString: (val: unknown) => string;
340
348
  */
341
349
  export declare const toHandlerKey: (str: string) => string;
342
350
 
351
+ /**
352
+ * Only conerces number-like strings
353
+ * "123-foo" will be returned as-is
354
+ */
343
355
  export declare const toNumber: (val: any) => any;
344
356
 
345
357
  export declare const toRawType: (value: unknown) => string;
@@ -184,7 +184,7 @@ function normalizeProps(props) {
184
184
  // These tag configs are shared between compiler-dom and runtime-dom, so they
185
185
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
186
186
  const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
187
- 'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
187
+ 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
188
188
  'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
189
189
  'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
190
190
  'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
@@ -196,7 +196,7 @@ const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,asi
196
196
  const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
197
197
  'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
198
198
  'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
199
- 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
199
+ 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
200
200
  'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
201
201
  'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
202
202
  'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
@@ -493,6 +493,7 @@ const isArray = Array.isArray;
493
493
  const isMap = (val) => toTypeString(val) === '[object Map]';
494
494
  const isSet = (val) => toTypeString(val) === '[object Set]';
495
495
  const isDate = (val) => toTypeString(val) === '[object Date]';
496
+ const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
496
497
  const isFunction = (val) => typeof val === 'function';
497
498
  const isString = (val) => typeof val === 'string';
498
499
  const isSymbol = (val) => typeof val === 'symbol';
@@ -559,10 +560,22 @@ const def = (obj, key, value) => {
559
560
  value
560
561
  });
561
562
  };
562
- const toNumber = (val) => {
563
+ /**
564
+ * "123-foo" will be parsed to 123
565
+ * This is used for the .number modifier in v-model
566
+ */
567
+ const looseToNumber = (val) => {
563
568
  const n = parseFloat(val);
564
569
  return isNaN(n) ? val : n;
565
570
  };
571
+ /**
572
+ * Only conerces number-like strings
573
+ * "123-foo" will be returned as-is
574
+ */
575
+ const toNumber = (val) => {
576
+ const n = isString(val) ? Number(val) : NaN;
577
+ return isNaN(n) ? val : n;
578
+ };
566
579
  let _globalThis;
567
580
  const getGlobalThis = () => {
568
581
  return (_globalThis ||
@@ -584,4 +597,4 @@ function genPropsAccessExp(name) {
584
597
  : `__props[${JSON.stringify(name)}]`;
585
598
  }
586
599
 
587
- export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
600
+ export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, 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.2.45",
3
+ "version": "3.2.47",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",