@vue/compat 3.3.0-alpha.4 → 3.3.0-alpha.6

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.
@@ -7,6 +7,96 @@ function makeMap(str, expectsLowerCase) {
7
7
  return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
8
8
  }
9
9
 
10
+ const EMPTY_OBJ = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
11
+ const EMPTY_ARR = process.env.NODE_ENV !== "production" ? Object.freeze([]) : [];
12
+ const NOOP = () => {
13
+ };
14
+ const NO = () => false;
15
+ const onRE = /^on[^a-z]/;
16
+ const isOn = (key) => onRE.test(key);
17
+ const isModelListener = (key) => key.startsWith("onUpdate:");
18
+ const extend = Object.assign;
19
+ const remove = (arr, el) => {
20
+ const i = arr.indexOf(el);
21
+ if (i > -1) {
22
+ arr.splice(i, 1);
23
+ }
24
+ };
25
+ const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
26
+ const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
27
+ const isArray = Array.isArray;
28
+ const isMap = (val) => toTypeString(val) === "[object Map]";
29
+ const isSet = (val) => toTypeString(val) === "[object Set]";
30
+ const isDate = (val) => toTypeString(val) === "[object Date]";
31
+ const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
32
+ const isFunction = (val) => typeof val === "function";
33
+ const isString = (val) => typeof val === "string";
34
+ const isSymbol = (val) => typeof val === "symbol";
35
+ const isObject = (val) => val !== null && typeof val === "object";
36
+ const isPromise = (val) => {
37
+ return isObject(val) && isFunction(val.then) && isFunction(val.catch);
38
+ };
39
+ const objectToString = Object.prototype.toString;
40
+ const toTypeString = (value) => objectToString.call(value);
41
+ const toRawType = (value) => {
42
+ return toTypeString(value).slice(8, -1);
43
+ };
44
+ const isPlainObject = (val) => toTypeString(val) === "[object Object]";
45
+ const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
46
+ const isReservedProp = /* @__PURE__ */ makeMap(
47
+ // the leading comma is intentional so empty string "" is also included
48
+ ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
49
+ );
50
+ const isBuiltInDirective = /* @__PURE__ */ makeMap(
51
+ "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
52
+ );
53
+ const cacheStringFunction = (fn) => {
54
+ const cache = /* @__PURE__ */ Object.create(null);
55
+ return (str) => {
56
+ const hit = cache[str];
57
+ return hit || (cache[str] = fn(str));
58
+ };
59
+ };
60
+ const camelizeRE = /-(\w)/g;
61
+ const camelize = cacheStringFunction((str) => {
62
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
63
+ });
64
+ const hyphenateRE = /\B([A-Z])/g;
65
+ const hyphenate = cacheStringFunction(
66
+ (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
67
+ );
68
+ const capitalize = cacheStringFunction(
69
+ (str) => str.charAt(0).toUpperCase() + str.slice(1)
70
+ );
71
+ const toHandlerKey = cacheStringFunction(
72
+ (str) => str ? `on${capitalize(str)}` : ``
73
+ );
74
+ const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
75
+ const invokeArrayFns = (fns, arg) => {
76
+ for (let i = 0; i < fns.length; i++) {
77
+ fns[i](arg);
78
+ }
79
+ };
80
+ const def = (obj, key, value) => {
81
+ Object.defineProperty(obj, key, {
82
+ configurable: true,
83
+ enumerable: false,
84
+ value
85
+ });
86
+ };
87
+ const looseToNumber = (val) => {
88
+ const n = parseFloat(val);
89
+ return isNaN(n) ? val : n;
90
+ };
91
+ const toNumber = (val) => {
92
+ const n = isString(val) ? Number(val) : NaN;
93
+ return isNaN(n) ? val : n;
94
+ };
95
+ let _globalThis;
96
+ const getGlobalThis = () => {
97
+ return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
98
+ };
99
+
10
100
  const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
11
101
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
12
102
 
@@ -161,96 +251,6 @@ const replacer = (_key, val) => {
161
251
  return val;
162
252
  };
163
253
 
164
- const EMPTY_OBJ = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
165
- const EMPTY_ARR = process.env.NODE_ENV !== "production" ? Object.freeze([]) : [];
166
- const NOOP = () => {
167
- };
168
- const NO = () => false;
169
- const onRE = /^on[^a-z]/;
170
- const isOn = (key) => onRE.test(key);
171
- const isModelListener = (key) => key.startsWith("onUpdate:");
172
- const extend = Object.assign;
173
- const remove = (arr, el) => {
174
- const i = arr.indexOf(el);
175
- if (i > -1) {
176
- arr.splice(i, 1);
177
- }
178
- };
179
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
180
- const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
181
- const isArray = Array.isArray;
182
- const isMap = (val) => toTypeString(val) === "[object Map]";
183
- const isSet = (val) => toTypeString(val) === "[object Set]";
184
- const isDate = (val) => toTypeString(val) === "[object Date]";
185
- const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
186
- const isFunction = (val) => typeof val === "function";
187
- const isString = (val) => typeof val === "string";
188
- const isSymbol = (val) => typeof val === "symbol";
189
- const isObject = (val) => val !== null && typeof val === "object";
190
- const isPromise = (val) => {
191
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
192
- };
193
- const objectToString = Object.prototype.toString;
194
- const toTypeString = (value) => objectToString.call(value);
195
- const toRawType = (value) => {
196
- return toTypeString(value).slice(8, -1);
197
- };
198
- const isPlainObject = (val) => toTypeString(val) === "[object Object]";
199
- const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
200
- const isReservedProp = /* @__PURE__ */ makeMap(
201
- // the leading comma is intentional so empty string "" is also included
202
- ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
203
- );
204
- const isBuiltInDirective = /* @__PURE__ */ makeMap(
205
- "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
206
- );
207
- const cacheStringFunction = (fn) => {
208
- const cache = /* @__PURE__ */ Object.create(null);
209
- return (str) => {
210
- const hit = cache[str];
211
- return hit || (cache[str] = fn(str));
212
- };
213
- };
214
- const camelizeRE = /-(\w)/g;
215
- const camelize = cacheStringFunction((str) => {
216
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
217
- });
218
- const hyphenateRE = /\B([A-Z])/g;
219
- const hyphenate = cacheStringFunction(
220
- (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
221
- );
222
- const capitalize = cacheStringFunction(
223
- (str) => str.charAt(0).toUpperCase() + str.slice(1)
224
- );
225
- const toHandlerKey = cacheStringFunction(
226
- (str) => str ? `on${capitalize(str)}` : ``
227
- );
228
- const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
229
- const invokeArrayFns = (fns, arg) => {
230
- for (let i = 0; i < fns.length; i++) {
231
- fns[i](arg);
232
- }
233
- };
234
- const def = (obj, key, value) => {
235
- Object.defineProperty(obj, key, {
236
- configurable: true,
237
- enumerable: false,
238
- value
239
- });
240
- };
241
- const looseToNumber = (val) => {
242
- const n = parseFloat(val);
243
- return isNaN(n) ? val : n;
244
- };
245
- const toNumber = (val) => {
246
- const n = isString(val) ? Number(val) : NaN;
247
- return isNaN(n) ? val : n;
248
- };
249
- let _globalThis;
250
- const getGlobalThis = () => {
251
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
252
- };
253
-
254
254
  function warn$1(msg, ...args) {
255
255
  console.warn(`[Vue warn] ${msg}`, ...args);
256
256
  }
@@ -4075,8 +4075,8 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4075
4075
  return ret;
4076
4076
  }
4077
4077
 
4078
- function defineComponent(options) {
4079
- return isFunction(options) ? { setup: options, name: options.name } : options;
4078
+ function defineComponent(options, extraOptions) {
4079
+ return isFunction(options) ? extend({}, extraOptions, { setup: options, name: options.name }) : options;
4080
4080
  }
4081
4081
 
4082
4082
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
@@ -4658,7 +4658,7 @@ const FILTERS = "filters";
4658
4658
  function resolveComponent(name, maybeSelfReference) {
4659
4659
  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4660
4660
  }
4661
- const NULL_DYNAMIC_COMPONENT = Symbol();
4661
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4662
4662
  function resolveDynamicComponent(component) {
4663
4663
  if (isString(component)) {
4664
4664
  return resolveAsset(COMPONENTS, component, false) || component;
@@ -6237,7 +6237,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6237
6237
  const hasDefault = hasOwn(opt, "default");
6238
6238
  if (hasDefault && value === void 0) {
6239
6239
  const defaultValue = opt.default;
6240
- if (opt.type !== Function && isFunction(defaultValue)) {
6240
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6241
6241
  const { propsDefaults } = instance;
6242
6242
  if (key in propsDefaults) {
6243
6243
  value = propsDefaults[key];
@@ -6376,7 +6376,7 @@ function validateProps(rawProps, props, instance) {
6376
6376
  }
6377
6377
  }
6378
6378
  function validateProp(name, value, prop, isAbsent) {
6379
- const { type, required, validator } = prop;
6379
+ const { type, required, validator, skipCheck } = prop;
6380
6380
  if (required && isAbsent) {
6381
6381
  warn('Missing required prop: "' + name + '"');
6382
6382
  return;
@@ -6384,7 +6384,7 @@ function validateProp(name, value, prop, isAbsent) {
6384
6384
  if (value == null && !prop.required) {
6385
6385
  return;
6386
6386
  }
6387
- if (type != null && type !== true) {
6387
+ if (type != null && type !== true && !skipCheck) {
6388
6388
  let isValid = false;
6389
6389
  const types = isArray(type) ? type : [type];
6390
6390
  const expectedTypes = [];
@@ -6626,7 +6626,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6626
6626
  return vm;
6627
6627
  }
6628
6628
  }
6629
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.4"}`;
6629
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6630
6630
  Vue.config = singletonApp.config;
6631
6631
  Vue.use = (p, ...options) => {
6632
6632
  if (p && isFunction(p.install)) {
@@ -9545,10 +9545,10 @@ function convertLegacyComponent(comp, instance) {
9545
9545
  return comp;
9546
9546
  }
9547
9547
 
9548
- const Fragment = Symbol(process.env.NODE_ENV !== "production" ? "Fragment" : void 0);
9549
- const Text = Symbol(process.env.NODE_ENV !== "production" ? "Text" : void 0);
9550
- const Comment = Symbol(process.env.NODE_ENV !== "production" ? "Comment" : void 0);
9551
- const Static = Symbol(process.env.NODE_ENV !== "production" ? "Static" : void 0);
9548
+ const Fragment = Symbol.for("v-fgt");
9549
+ const Text = Symbol.for("v-txt");
9550
+ const Comment = Symbol.for("v-cmt");
9551
+ const Static = Symbol.for("v-stc");
9552
9552
  const blockStack = [];
9553
9553
  let currentBlock = null;
9554
9554
  function openBlock(disableTracking = false) {
@@ -10012,13 +10012,29 @@ function createComponentInstance(vnode, parent, suspense) {
10012
10012
  }
10013
10013
  let currentInstance = null;
10014
10014
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10015
+ let internalSetCurrentInstance;
10016
+ let globalCurrentInstanceSetters;
10017
+ let settersKey = "__VUE_INSTANCE_SETTERS__";
10018
+ {
10019
+ if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
10020
+ globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
10021
+ }
10022
+ globalCurrentInstanceSetters.push((i) => currentInstance = i);
10023
+ internalSetCurrentInstance = (instance) => {
10024
+ if (globalCurrentInstanceSetters.length > 1) {
10025
+ globalCurrentInstanceSetters.forEach((s) => s(instance));
10026
+ } else {
10027
+ globalCurrentInstanceSetters[0](instance);
10028
+ }
10029
+ };
10030
+ }
10015
10031
  const setCurrentInstance = (instance) => {
10016
- currentInstance = instance;
10032
+ internalSetCurrentInstance(instance);
10017
10033
  instance.scope.on();
10018
10034
  };
10019
10035
  const unsetCurrentInstance = () => {
10020
10036
  currentInstance && currentInstance.scope.off();
10021
- currentInstance = null;
10037
+ internalSetCurrentInstance(null);
10022
10038
  };
10023
10039
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10024
10040
  function validateComponentName(name, config) {
@@ -10355,6 +10371,11 @@ function defineExpose(exposed) {
10355
10371
  warnRuntimeUsage(`defineExpose`);
10356
10372
  }
10357
10373
  }
10374
+ function defineOptions(options) {
10375
+ if (process.env.NODE_ENV !== "production") {
10376
+ warnRuntimeUsage(`defineOptions`);
10377
+ }
10378
+ }
10358
10379
  function withDefaults(props, defaults) {
10359
10380
  if (process.env.NODE_ENV !== "production") {
10360
10381
  warnRuntimeUsage(`withDefaults`);
@@ -10380,18 +10401,23 @@ function mergeDefaults(raw, defaults) {
10380
10401
  {}
10381
10402
  ) : raw;
10382
10403
  for (const key in defaults) {
10383
- const opt = props[key];
10404
+ if (key.startsWith("__skip"))
10405
+ continue;
10406
+ let opt = props[key];
10384
10407
  if (opt) {
10385
10408
  if (isArray(opt) || isFunction(opt)) {
10386
- props[key] = { type: opt, default: defaults[key] };
10409
+ opt = props[key] = { type: opt, default: defaults[key] };
10387
10410
  } else {
10388
10411
  opt.default = defaults[key];
10389
10412
  }
10390
10413
  } else if (opt === null) {
10391
- props[key] = { default: defaults[key] };
10414
+ opt = props[key] = { default: defaults[key] };
10392
10415
  } else if (process.env.NODE_ENV !== "production") {
10393
10416
  warn(`props default key "${key}" has no corresponding declaration.`);
10394
10417
  }
10418
+ if (opt && defaults[`__skip_${key}`]) {
10419
+ opt.skipFactory = true;
10420
+ }
10395
10421
  }
10396
10422
  return props;
10397
10423
  }
@@ -10446,7 +10472,7 @@ function h(type, propsOrChildren, children) {
10446
10472
  }
10447
10473
  }
10448
10474
 
10449
- const ssrContextKey = Symbol(process.env.NODE_ENV !== "production" ? `ssrContext` : ``);
10475
+ const ssrContextKey = Symbol.for("v-scx");
10450
10476
  const useSSRContext = () => {
10451
10477
  {
10452
10478
  const ctx = inject(ssrContextKey);
@@ -10660,7 +10686,7 @@ function isMemoSame(cached, memo) {
10660
10686
  return true;
10661
10687
  }
10662
10688
 
10663
- const version = "3.3.0-alpha.4";
10689
+ const version = "3.3.0-alpha.6";
10664
10690
  const _ssrUtils = {
10665
10691
  createComponentInstance,
10666
10692
  setupComponent,
@@ -12372,6 +12398,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12372
12398
  defineCustomElement: defineCustomElement,
12373
12399
  defineEmits: defineEmits,
12374
12400
  defineExpose: defineExpose,
12401
+ defineOptions: defineOptions,
12375
12402
  defineProps: defineProps,
12376
12403
  defineSSRCustomElement: defineSSRCustomElement,
12377
12404
  get devtools () { return devtools; },
@@ -12518,4 +12545,4 @@ var Vue$1 = Vue;
12518
12545
 
12519
12546
  const { configureCompat } = Vue$1;
12520
12547
 
12521
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
12548
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };