@vue/shared 3.4.0-alpha.2 → 3.4.0-alpha.4

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.
@@ -12,8 +12,8 @@ const EMPTY_ARR = Object.freeze([]) ;
12
12
  const NOOP = () => {
13
13
  };
14
14
  const NO = () => false;
15
- const onRE = /^on[^a-z]/;
16
- const isOn = (key) => onRE.test(key);
15
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
16
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
17
17
  const isModelListener = (key) => key.startsWith("onUpdate:");
18
18
  const extend = Object.assign;
19
19
  const remove = (arr, el) => {
@@ -102,6 +102,36 @@ function genPropsAccessExp(name) {
102
102
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
103
103
  }
104
104
 
105
+ const PatchFlags = {
106
+ "TEXT": 1,
107
+ "1": "TEXT",
108
+ "CLASS": 2,
109
+ "2": "CLASS",
110
+ "STYLE": 4,
111
+ "4": "STYLE",
112
+ "PROPS": 8,
113
+ "8": "PROPS",
114
+ "FULL_PROPS": 16,
115
+ "16": "FULL_PROPS",
116
+ "NEED_HYDRATION": 32,
117
+ "32": "NEED_HYDRATION",
118
+ "STABLE_FRAGMENT": 64,
119
+ "64": "STABLE_FRAGMENT",
120
+ "KEYED_FRAGMENT": 128,
121
+ "128": "KEYED_FRAGMENT",
122
+ "UNKEYED_FRAGMENT": 256,
123
+ "256": "UNKEYED_FRAGMENT",
124
+ "NEED_PATCH": 512,
125
+ "512": "NEED_PATCH",
126
+ "DYNAMIC_SLOTS": 1024,
127
+ "1024": "DYNAMIC_SLOTS",
128
+ "DEV_ROOT_FRAGMENT": 2048,
129
+ "2048": "DEV_ROOT_FRAGMENT",
130
+ "HOISTED": -1,
131
+ "-1": "HOISTED",
132
+ "BAIL": -2,
133
+ "-2": "BAIL"
134
+ };
105
135
  const PatchFlagNames = {
106
136
  [1]: `TEXT`,
107
137
  [2]: `CLASS`,
@@ -119,13 +149,46 @@ const PatchFlagNames = {
119
149
  [-2]: `BAIL`
120
150
  };
121
151
 
152
+ const ShapeFlags = {
153
+ "ELEMENT": 1,
154
+ "1": "ELEMENT",
155
+ "FUNCTIONAL_COMPONENT": 2,
156
+ "2": "FUNCTIONAL_COMPONENT",
157
+ "STATEFUL_COMPONENT": 4,
158
+ "4": "STATEFUL_COMPONENT",
159
+ "TEXT_CHILDREN": 8,
160
+ "8": "TEXT_CHILDREN",
161
+ "ARRAY_CHILDREN": 16,
162
+ "16": "ARRAY_CHILDREN",
163
+ "SLOTS_CHILDREN": 32,
164
+ "32": "SLOTS_CHILDREN",
165
+ "TELEPORT": 64,
166
+ "64": "TELEPORT",
167
+ "SUSPENSE": 128,
168
+ "128": "SUSPENSE",
169
+ "COMPONENT_SHOULD_KEEP_ALIVE": 256,
170
+ "256": "COMPONENT_SHOULD_KEEP_ALIVE",
171
+ "COMPONENT_KEPT_ALIVE": 512,
172
+ "512": "COMPONENT_KEPT_ALIVE",
173
+ "COMPONENT": 6,
174
+ "6": "COMPONENT"
175
+ };
176
+
177
+ const SlotFlags = {
178
+ "STABLE": 1,
179
+ "1": "STABLE",
180
+ "DYNAMIC": 2,
181
+ "2": "DYNAMIC",
182
+ "FORWARDED": 3,
183
+ "3": "FORWARDED"
184
+ };
122
185
  const slotFlagsText = {
123
186
  [1]: "STABLE",
124
187
  [2]: "DYNAMIC",
125
188
  [3]: "FORWARDED"
126
189
  };
127
190
 
128
- const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
191
+ const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
129
192
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
130
193
  const isGloballyWhitelisted = isGloballyAllowed;
131
194
 
@@ -410,6 +473,9 @@ exports.EMPTY_OBJ = EMPTY_OBJ;
410
473
  exports.NO = NO;
411
474
  exports.NOOP = NOOP;
412
475
  exports.PatchFlagNames = PatchFlagNames;
476
+ exports.PatchFlags = PatchFlags;
477
+ exports.ShapeFlags = ShapeFlags;
478
+ exports.SlotFlags = SlotFlags;
413
479
  exports.camelize = camelize;
414
480
  exports.capitalize = capitalize;
415
481
  exports.def = def;
@@ -12,8 +12,8 @@ const EMPTY_ARR = [];
12
12
  const NOOP = () => {
13
13
  };
14
14
  const NO = () => false;
15
- const onRE = /^on[^a-z]/;
16
- const isOn = (key) => onRE.test(key);
15
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
16
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
17
17
  const isModelListener = (key) => key.startsWith("onUpdate:");
18
18
  const extend = Object.assign;
19
19
  const remove = (arr, el) => {
@@ -102,6 +102,36 @@ function genPropsAccessExp(name) {
102
102
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
103
103
  }
104
104
 
105
+ const PatchFlags = {
106
+ "TEXT": 1,
107
+ "1": "TEXT",
108
+ "CLASS": 2,
109
+ "2": "CLASS",
110
+ "STYLE": 4,
111
+ "4": "STYLE",
112
+ "PROPS": 8,
113
+ "8": "PROPS",
114
+ "FULL_PROPS": 16,
115
+ "16": "FULL_PROPS",
116
+ "NEED_HYDRATION": 32,
117
+ "32": "NEED_HYDRATION",
118
+ "STABLE_FRAGMENT": 64,
119
+ "64": "STABLE_FRAGMENT",
120
+ "KEYED_FRAGMENT": 128,
121
+ "128": "KEYED_FRAGMENT",
122
+ "UNKEYED_FRAGMENT": 256,
123
+ "256": "UNKEYED_FRAGMENT",
124
+ "NEED_PATCH": 512,
125
+ "512": "NEED_PATCH",
126
+ "DYNAMIC_SLOTS": 1024,
127
+ "1024": "DYNAMIC_SLOTS",
128
+ "DEV_ROOT_FRAGMENT": 2048,
129
+ "2048": "DEV_ROOT_FRAGMENT",
130
+ "HOISTED": -1,
131
+ "-1": "HOISTED",
132
+ "BAIL": -2,
133
+ "-2": "BAIL"
134
+ };
105
135
  const PatchFlagNames = {
106
136
  [1]: `TEXT`,
107
137
  [2]: `CLASS`,
@@ -119,13 +149,46 @@ const PatchFlagNames = {
119
149
  [-2]: `BAIL`
120
150
  };
121
151
 
152
+ const ShapeFlags = {
153
+ "ELEMENT": 1,
154
+ "1": "ELEMENT",
155
+ "FUNCTIONAL_COMPONENT": 2,
156
+ "2": "FUNCTIONAL_COMPONENT",
157
+ "STATEFUL_COMPONENT": 4,
158
+ "4": "STATEFUL_COMPONENT",
159
+ "TEXT_CHILDREN": 8,
160
+ "8": "TEXT_CHILDREN",
161
+ "ARRAY_CHILDREN": 16,
162
+ "16": "ARRAY_CHILDREN",
163
+ "SLOTS_CHILDREN": 32,
164
+ "32": "SLOTS_CHILDREN",
165
+ "TELEPORT": 64,
166
+ "64": "TELEPORT",
167
+ "SUSPENSE": 128,
168
+ "128": "SUSPENSE",
169
+ "COMPONENT_SHOULD_KEEP_ALIVE": 256,
170
+ "256": "COMPONENT_SHOULD_KEEP_ALIVE",
171
+ "COMPONENT_KEPT_ALIVE": 512,
172
+ "512": "COMPONENT_KEPT_ALIVE",
173
+ "COMPONENT": 6,
174
+ "6": "COMPONENT"
175
+ };
176
+
177
+ const SlotFlags = {
178
+ "STABLE": 1,
179
+ "1": "STABLE",
180
+ "DYNAMIC": 2,
181
+ "2": "DYNAMIC",
182
+ "FORWARDED": 3,
183
+ "3": "FORWARDED"
184
+ };
122
185
  const slotFlagsText = {
123
186
  [1]: "STABLE",
124
187
  [2]: "DYNAMIC",
125
188
  [3]: "FORWARDED"
126
189
  };
127
190
 
128
- const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
191
+ const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
129
192
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
130
193
  const isGloballyWhitelisted = isGloballyAllowed;
131
194
 
@@ -410,6 +473,9 @@ exports.EMPTY_OBJ = EMPTY_OBJ;
410
473
  exports.NO = NO;
411
474
  exports.NOOP = NOOP;
412
475
  exports.PatchFlagNames = PatchFlagNames;
476
+ exports.PatchFlags = PatchFlags;
477
+ exports.ShapeFlags = ShapeFlags;
478
+ exports.SlotFlags = SlotFlags;
413
479
  exports.camelize = camelize;
414
480
  exports.capitalize = capitalize;
415
481
  exports.def = def;
package/dist/shared.d.ts CHANGED
@@ -93,7 +93,7 @@ export declare function genPropsAccessExp(name: string): string;
93
93
  * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
94
94
  * flags are handled during diff.
95
95
  */
96
- export declare const enum PatchFlags {
96
+ export declare enum PatchFlags {
97
97
  /**
98
98
  * Indicates an element with dynamic textContent (children fast path)
99
99
  */
@@ -191,7 +191,7 @@ export declare const enum PatchFlags {
191
191
  */
192
192
  export declare const PatchFlagNames: Record<PatchFlags, string>;
193
193
 
194
- export declare const enum ShapeFlags {
194
+ export declare enum ShapeFlags {
195
195
  ELEMENT = 1,
196
196
  FUNCTIONAL_COMPONENT = 2,
197
197
  STATEFUL_COMPONENT = 4,
@@ -205,7 +205,7 @@ export declare const enum ShapeFlags {
205
205
  COMPONENT = 6
206
206
  }
207
207
 
208
- export declare const enum SlotFlags {
208
+ export declare enum SlotFlags {
209
209
  /**
210
210
  * Stable slots that only reference slot props or context state. The slot
211
211
  * can fully capture its own dependencies so when passed down the parent won't
@@ -8,8 +8,8 @@ const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([])
8
8
  const NOOP = () => {
9
9
  };
10
10
  const NO = () => false;
11
- const onRE = /^on[^a-z]/;
12
- const isOn = (key) => onRE.test(key);
11
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
12
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
13
13
  const isModelListener = (key) => key.startsWith("onUpdate:");
14
14
  const extend = Object.assign;
15
15
  const remove = (arr, el) => {
@@ -98,6 +98,36 @@ function genPropsAccessExp(name) {
98
98
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
99
99
  }
100
100
 
101
+ const PatchFlags = {
102
+ "TEXT": 1,
103
+ "1": "TEXT",
104
+ "CLASS": 2,
105
+ "2": "CLASS",
106
+ "STYLE": 4,
107
+ "4": "STYLE",
108
+ "PROPS": 8,
109
+ "8": "PROPS",
110
+ "FULL_PROPS": 16,
111
+ "16": "FULL_PROPS",
112
+ "NEED_HYDRATION": 32,
113
+ "32": "NEED_HYDRATION",
114
+ "STABLE_FRAGMENT": 64,
115
+ "64": "STABLE_FRAGMENT",
116
+ "KEYED_FRAGMENT": 128,
117
+ "128": "KEYED_FRAGMENT",
118
+ "UNKEYED_FRAGMENT": 256,
119
+ "256": "UNKEYED_FRAGMENT",
120
+ "NEED_PATCH": 512,
121
+ "512": "NEED_PATCH",
122
+ "DYNAMIC_SLOTS": 1024,
123
+ "1024": "DYNAMIC_SLOTS",
124
+ "DEV_ROOT_FRAGMENT": 2048,
125
+ "2048": "DEV_ROOT_FRAGMENT",
126
+ "HOISTED": -1,
127
+ "-1": "HOISTED",
128
+ "BAIL": -2,
129
+ "-2": "BAIL"
130
+ };
101
131
  const PatchFlagNames = {
102
132
  [1]: `TEXT`,
103
133
  [2]: `CLASS`,
@@ -115,13 +145,46 @@ const PatchFlagNames = {
115
145
  [-2]: `BAIL`
116
146
  };
117
147
 
148
+ const ShapeFlags = {
149
+ "ELEMENT": 1,
150
+ "1": "ELEMENT",
151
+ "FUNCTIONAL_COMPONENT": 2,
152
+ "2": "FUNCTIONAL_COMPONENT",
153
+ "STATEFUL_COMPONENT": 4,
154
+ "4": "STATEFUL_COMPONENT",
155
+ "TEXT_CHILDREN": 8,
156
+ "8": "TEXT_CHILDREN",
157
+ "ARRAY_CHILDREN": 16,
158
+ "16": "ARRAY_CHILDREN",
159
+ "SLOTS_CHILDREN": 32,
160
+ "32": "SLOTS_CHILDREN",
161
+ "TELEPORT": 64,
162
+ "64": "TELEPORT",
163
+ "SUSPENSE": 128,
164
+ "128": "SUSPENSE",
165
+ "COMPONENT_SHOULD_KEEP_ALIVE": 256,
166
+ "256": "COMPONENT_SHOULD_KEEP_ALIVE",
167
+ "COMPONENT_KEPT_ALIVE": 512,
168
+ "512": "COMPONENT_KEPT_ALIVE",
169
+ "COMPONENT": 6,
170
+ "6": "COMPONENT"
171
+ };
172
+
173
+ const SlotFlags = {
174
+ "STABLE": 1,
175
+ "1": "STABLE",
176
+ "DYNAMIC": 2,
177
+ "2": "DYNAMIC",
178
+ "FORWARDED": 3,
179
+ "3": "FORWARDED"
180
+ };
118
181
  const slotFlagsText = {
119
182
  [1]: "STABLE",
120
183
  [2]: "DYNAMIC",
121
184
  [3]: "FORWARDED"
122
185
  };
123
186
 
124
- const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
187
+ const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
125
188
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
126
189
  const isGloballyWhitelisted = isGloballyAllowed;
127
190
 
@@ -401,4 +464,4 @@ const replacer = (_key, val) => {
401
464
  return val;
402
465
  };
403
466
 
404
- 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, isGloballyAllowed, 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 };
467
+ export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, 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.4.0-alpha.2",
3
+ "version": "3.4.0-alpha.4",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",