@vue/shared 3.2.45 → 3.2.46

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,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  /**
6
4
  * Make a map and return a function for checking if a key
7
5
  * is in that map.
@@ -188,7 +186,7 @@ function normalizeProps(props) {
188
186
  // These tag configs are shared between compiler-dom and runtime-dom, so they
189
187
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
190
188
  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,' +
189
+ 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
192
190
  'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
193
191
  'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
194
192
  'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
@@ -200,7 +198,7 @@ const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,asi
200
198
  const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
201
199
  'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
202
200
  'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
203
- 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
201
+ 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
204
202
  'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
205
203
  'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
206
204
  'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
@@ -496,6 +494,7 @@ const isArray = Array.isArray;
496
494
  const isMap = (val) => toTypeString(val) === '[object Map]';
497
495
  const isSet = (val) => toTypeString(val) === '[object Set]';
498
496
  const isDate = (val) => toTypeString(val) === '[object Date]';
497
+ const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
499
498
  const isFunction = (val) => typeof val === 'function';
500
499
  const isString = (val) => typeof val === 'string';
501
500
  const isSymbol = (val) => typeof val === 'symbol';
@@ -562,10 +561,22 @@ const def = (obj, key, value) => {
562
561
  value
563
562
  });
564
563
  };
565
- const toNumber = (val) => {
564
+ /**
565
+ * "123-foo" will be parsed to 123
566
+ * This is used for the .number modifier in v-model
567
+ */
568
+ const looseToNumber = (val) => {
566
569
  const n = parseFloat(val);
567
570
  return isNaN(n) ? val : n;
568
571
  };
572
+ /**
573
+ * Only conerces number-like strings
574
+ * "123-foo" will be returned as-is
575
+ */
576
+ const toNumber = (val) => {
577
+ const n = isString(val) ? Number(val) : NaN;
578
+ return isNaN(n) ? val : n;
579
+ };
569
580
  let _globalThis;
570
581
  const getGlobalThis = () => {
571
582
  return (_globalThis ||
@@ -622,6 +633,7 @@ exports.isObject = isObject;
622
633
  exports.isOn = isOn;
623
634
  exports.isPlainObject = isPlainObject;
624
635
  exports.isPromise = isPromise;
636
+ exports.isRegExp = isRegExp;
625
637
  exports.isReservedProp = isReservedProp;
626
638
  exports.isSSRSafeAttrName = isSSRSafeAttrName;
627
639
  exports.isSVGTag = isSVGTag;
@@ -632,6 +644,7 @@ exports.isSymbol = isSymbol;
632
644
  exports.isVoidTag = isVoidTag;
633
645
  exports.looseEqual = looseEqual;
634
646
  exports.looseIndexOf = looseIndexOf;
647
+ exports.looseToNumber = looseToNumber;
635
648
  exports.makeMap = makeMap;
636
649
  exports.normalizeClass = normalizeClass;
637
650
  exports.normalizeProps = normalizeProps;
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  /**
6
4
  * Make a map and return a function for checking if a key
7
5
  * is in that map.
@@ -188,7 +186,7 @@ function normalizeProps(props) {
188
186
  // These tag configs are shared between compiler-dom and runtime-dom, so they
189
187
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
190
188
  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,' +
189
+ 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
192
190
  'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
193
191
  'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
194
192
  'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
@@ -200,7 +198,7 @@ const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,asi
200
198
  const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
201
199
  'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
202
200
  'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
203
- 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
201
+ 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
204
202
  'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
205
203
  'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
206
204
  'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
@@ -495,6 +493,7 @@ const isArray = Array.isArray;
495
493
  const isMap = (val) => toTypeString(val) === '[object Map]';
496
494
  const isSet = (val) => toTypeString(val) === '[object Set]';
497
495
  const isDate = (val) => toTypeString(val) === '[object Date]';
496
+ const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
498
497
  const isFunction = (val) => typeof val === 'function';
499
498
  const isString = (val) => typeof val === 'string';
500
499
  const isSymbol = (val) => typeof val === 'symbol';
@@ -561,10 +560,22 @@ const def = (obj, key, value) => {
561
560
  value
562
561
  });
563
562
  };
564
- 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) => {
565
568
  const n = parseFloat(val);
566
569
  return isNaN(n) ? val : n;
567
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
+ };
568
579
  let _globalThis;
569
580
  const getGlobalThis = () => {
570
581
  return (_globalThis ||
@@ -621,6 +632,7 @@ exports.isObject = isObject;
621
632
  exports.isOn = isOn;
622
633
  exports.isPlainObject = isPlainObject;
623
634
  exports.isPromise = isPromise;
635
+ exports.isRegExp = isRegExp;
624
636
  exports.isReservedProp = isReservedProp;
625
637
  exports.isSSRSafeAttrName = isSSRSafeAttrName;
626
638
  exports.isSVGTag = isSVGTag;
@@ -631,6 +643,7 @@ exports.isSymbol = isSymbol;
631
643
  exports.isVoidTag = isVoidTag;
632
644
  exports.looseEqual = looseEqual;
633
645
  exports.looseIndexOf = looseIndexOf;
646
+ exports.looseToNumber = looseToNumber;
634
647
  exports.makeMap = makeMap;
635
648
  exports.normalizeClass = normalizeClass;
636
649
  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.46",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",