@vue/runtime-core 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.
@@ -2191,8 +2191,8 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2191
2191
  return ret;
2192
2192
  }
2193
2193
 
2194
- function defineComponent(options) {
2195
- return shared.isFunction(options) ? { setup: options, name: options.name } : options;
2194
+ function defineComponent(options, extraOptions) {
2195
+ return shared.isFunction(options) ? shared.extend({}, extraOptions, { setup: options, name: options.name }) : options;
2196
2196
  }
2197
2197
 
2198
2198
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
@@ -2694,7 +2694,7 @@ const DIRECTIVES = "directives";
2694
2694
  function resolveComponent(name, maybeSelfReference) {
2695
2695
  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2696
2696
  }
2697
- const NULL_DYNAMIC_COMPONENT = Symbol();
2697
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2698
2698
  function resolveDynamicComponent(component) {
2699
2699
  if (shared.isString(component)) {
2700
2700
  return resolveAsset(COMPONENTS, component, false) || component;
@@ -3695,7 +3695,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3695
3695
  const hasDefault = shared.hasOwn(opt, "default");
3696
3696
  if (hasDefault && value === void 0) {
3697
3697
  const defaultValue = opt.default;
3698
- if (opt.type !== Function && shared.isFunction(defaultValue)) {
3698
+ if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
3699
3699
  const { propsDefaults } = instance;
3700
3700
  if (key in propsDefaults) {
3701
3701
  value = propsDefaults[key];
@@ -3831,7 +3831,7 @@ function validateProps(rawProps, props, instance) {
3831
3831
  }
3832
3832
  }
3833
3833
  function validateProp(name, value, prop, isAbsent) {
3834
- const { type, required, validator } = prop;
3834
+ const { type, required, validator, skipCheck } = prop;
3835
3835
  if (required && isAbsent) {
3836
3836
  warn('Missing required prop: "' + name + '"');
3837
3837
  return;
@@ -3839,7 +3839,7 @@ function validateProp(name, value, prop, isAbsent) {
3839
3839
  if (value == null && !prop.required) {
3840
3840
  return;
3841
3841
  }
3842
- if (type != null && type !== true) {
3842
+ if (type != null && type !== true && !skipCheck) {
3843
3843
  let isValid = false;
3844
3844
  const types = shared.isArray(type) ? type : [type];
3845
3845
  const expectedTypes = [];
@@ -6452,10 +6452,10 @@ function updateCssVars(vnode) {
6452
6452
  }
6453
6453
  }
6454
6454
 
6455
- const Fragment = Symbol("Fragment" );
6456
- const Text = Symbol("Text" );
6457
- const Comment = Symbol("Comment" );
6458
- const Static = Symbol("Static" );
6455
+ const Fragment = Symbol.for("v-fgt");
6456
+ const Text = Symbol.for("v-txt");
6457
+ const Comment = Symbol.for("v-cmt");
6458
+ const Static = Symbol.for("v-stc");
6459
6459
  const blockStack = [];
6460
6460
  let currentBlock = null;
6461
6461
  function openBlock(disableTracking = false) {
@@ -6907,13 +6907,29 @@ function createComponentInstance(vnode, parent, suspense) {
6907
6907
  }
6908
6908
  let currentInstance = null;
6909
6909
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
6910
+ let internalSetCurrentInstance;
6911
+ let globalCurrentInstanceSetters;
6912
+ let settersKey = "__VUE_INSTANCE_SETTERS__";
6913
+ {
6914
+ if (!(globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey])) {
6915
+ globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey] = [];
6916
+ }
6917
+ globalCurrentInstanceSetters.push((i) => currentInstance = i);
6918
+ internalSetCurrentInstance = (instance) => {
6919
+ if (globalCurrentInstanceSetters.length > 1) {
6920
+ globalCurrentInstanceSetters.forEach((s) => s(instance));
6921
+ } else {
6922
+ globalCurrentInstanceSetters[0](instance);
6923
+ }
6924
+ };
6925
+ }
6910
6926
  const setCurrentInstance = (instance) => {
6911
- currentInstance = instance;
6927
+ internalSetCurrentInstance(instance);
6912
6928
  instance.scope.on();
6913
6929
  };
6914
6930
  const unsetCurrentInstance = () => {
6915
6931
  currentInstance && currentInstance.scope.off();
6916
- currentInstance = null;
6932
+ internalSetCurrentInstance(null);
6917
6933
  };
6918
6934
  const isBuiltInTag = /* @__PURE__ */ shared.makeMap("slot,component");
6919
6935
  function validateComponentName(name, config) {
@@ -7224,6 +7240,11 @@ function defineExpose(exposed) {
7224
7240
  warnRuntimeUsage(`defineExpose`);
7225
7241
  }
7226
7242
  }
7243
+ function defineOptions(options) {
7244
+ {
7245
+ warnRuntimeUsage(`defineOptions`);
7246
+ }
7247
+ }
7227
7248
  function withDefaults(props, defaults) {
7228
7249
  {
7229
7250
  warnRuntimeUsage(`withDefaults`);
@@ -7249,18 +7270,23 @@ function mergeDefaults(raw, defaults) {
7249
7270
  {}
7250
7271
  ) : raw;
7251
7272
  for (const key in defaults) {
7252
- const opt = props[key];
7273
+ if (key.startsWith("__skip"))
7274
+ continue;
7275
+ let opt = props[key];
7253
7276
  if (opt) {
7254
7277
  if (shared.isArray(opt) || shared.isFunction(opt)) {
7255
- props[key] = { type: opt, default: defaults[key] };
7278
+ opt = props[key] = { type: opt, default: defaults[key] };
7256
7279
  } else {
7257
7280
  opt.default = defaults[key];
7258
7281
  }
7259
7282
  } else if (opt === null) {
7260
- props[key] = { default: defaults[key] };
7283
+ opt = props[key] = { default: defaults[key] };
7261
7284
  } else {
7262
7285
  warn(`props default key "${key}" has no corresponding declaration.`);
7263
7286
  }
7287
+ if (opt && defaults[`__skip_${key}`]) {
7288
+ opt.skipFactory = true;
7289
+ }
7264
7290
  }
7265
7291
  return props;
7266
7292
  }
@@ -7315,7 +7341,7 @@ function h(type, propsOrChildren, children) {
7315
7341
  }
7316
7342
  }
7317
7343
 
7318
- const ssrContextKey = Symbol(`ssrContext` );
7344
+ const ssrContextKey = Symbol.for("v-scx");
7319
7345
  const useSSRContext = () => {
7320
7346
  {
7321
7347
  const ctx = inject(ssrContextKey);
@@ -7533,7 +7559,7 @@ function isMemoSame(cached, memo) {
7533
7559
  return true;
7534
7560
  }
7535
7561
 
7536
- const version = "3.3.0-alpha.4";
7562
+ const version = "3.3.0-alpha.6";
7537
7563
  const _ssrUtils = {
7538
7564
  createComponentInstance,
7539
7565
  setupComponent,
@@ -7609,6 +7635,7 @@ exports.defineAsyncComponent = defineAsyncComponent;
7609
7635
  exports.defineComponent = defineComponent;
7610
7636
  exports.defineEmits = defineEmits;
7611
7637
  exports.defineExpose = defineExpose;
7638
+ exports.defineOptions = defineOptions;
7612
7639
  exports.defineProps = defineProps;
7613
7640
  exports.getCurrentInstance = getCurrentInstance;
7614
7641
  exports.getTransitionRawChildren = getTransitionRawChildren;
@@ -1631,8 +1631,8 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1631
1631
  return ret;
1632
1632
  }
1633
1633
 
1634
- function defineComponent(options) {
1635
- return shared.isFunction(options) ? { setup: options, name: options.name } : options;
1634
+ function defineComponent(options, extraOptions) {
1635
+ return shared.isFunction(options) ? shared.extend({}, extraOptions, { setup: options, name: options.name }) : options;
1636
1636
  }
1637
1637
 
1638
1638
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
@@ -2103,7 +2103,7 @@ const DIRECTIVES = "directives";
2103
2103
  function resolveComponent(name, maybeSelfReference) {
2104
2104
  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2105
2105
  }
2106
- const NULL_DYNAMIC_COMPONENT = Symbol();
2106
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2107
2107
  function resolveDynamicComponent(component) {
2108
2108
  if (shared.isString(component)) {
2109
2109
  return resolveAsset(COMPONENTS, component, false) || component;
@@ -2883,7 +2883,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
2883
2883
  const hasDefault = shared.hasOwn(opt, "default");
2884
2884
  if (hasDefault && value === void 0) {
2885
2885
  const defaultValue = opt.default;
2886
- if (opt.type !== Function && shared.isFunction(defaultValue)) {
2886
+ if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
2887
2887
  const { propsDefaults } = instance;
2888
2888
  if (key in propsDefaults) {
2889
2889
  value = propsDefaults[key];
@@ -5194,10 +5194,10 @@ function updateCssVars(vnode) {
5194
5194
  }
5195
5195
  }
5196
5196
 
5197
- const Fragment = Symbol(void 0);
5198
- const Text = Symbol(void 0);
5199
- const Comment = Symbol(void 0);
5200
- const Static = Symbol(void 0);
5197
+ const Fragment = Symbol.for("v-fgt");
5198
+ const Text = Symbol.for("v-txt");
5199
+ const Comment = Symbol.for("v-cmt");
5200
+ const Static = Symbol.for("v-stc");
5201
5201
  const blockStack = [];
5202
5202
  let currentBlock = null;
5203
5203
  function openBlock(disableTracking = false) {
@@ -5615,13 +5615,29 @@ function createComponentInstance(vnode, parent, suspense) {
5615
5615
  }
5616
5616
  let currentInstance = null;
5617
5617
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
5618
+ let internalSetCurrentInstance;
5619
+ let globalCurrentInstanceSetters;
5620
+ let settersKey = "__VUE_INSTANCE_SETTERS__";
5621
+ {
5622
+ if (!(globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey])) {
5623
+ globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey] = [];
5624
+ }
5625
+ globalCurrentInstanceSetters.push((i) => currentInstance = i);
5626
+ internalSetCurrentInstance = (instance) => {
5627
+ if (globalCurrentInstanceSetters.length > 1) {
5628
+ globalCurrentInstanceSetters.forEach((s) => s(instance));
5629
+ } else {
5630
+ globalCurrentInstanceSetters[0](instance);
5631
+ }
5632
+ };
5633
+ }
5618
5634
  const setCurrentInstance = (instance) => {
5619
- currentInstance = instance;
5635
+ internalSetCurrentInstance(instance);
5620
5636
  instance.scope.on();
5621
5637
  };
5622
5638
  const unsetCurrentInstance = () => {
5623
5639
  currentInstance && currentInstance.scope.off();
5624
- currentInstance = null;
5640
+ internalSetCurrentInstance(null);
5625
5641
  };
5626
5642
  function isStatefulComponent(instance) {
5627
5643
  return instance.vnode.shapeFlag & 4;
@@ -5791,6 +5807,8 @@ function defineEmits() {
5791
5807
  }
5792
5808
  function defineExpose(exposed) {
5793
5809
  }
5810
+ function defineOptions(options) {
5811
+ }
5794
5812
  function withDefaults(props, defaults) {
5795
5813
  return null;
5796
5814
  }
@@ -5810,16 +5828,21 @@ function mergeDefaults(raw, defaults) {
5810
5828
  {}
5811
5829
  ) : raw;
5812
5830
  for (const key in defaults) {
5813
- const opt = props[key];
5831
+ if (key.startsWith("__skip"))
5832
+ continue;
5833
+ let opt = props[key];
5814
5834
  if (opt) {
5815
5835
  if (shared.isArray(opt) || shared.isFunction(opt)) {
5816
- props[key] = { type: opt, default: defaults[key] };
5836
+ opt = props[key] = { type: opt, default: defaults[key] };
5817
5837
  } else {
5818
5838
  opt.default = defaults[key];
5819
5839
  }
5820
5840
  } else if (opt === null) {
5821
- props[key] = { default: defaults[key] };
5841
+ opt = props[key] = { default: defaults[key] };
5822
5842
  } else ;
5843
+ if (opt && defaults[`__skip_${key}`]) {
5844
+ opt.skipFactory = true;
5845
+ }
5823
5846
  }
5824
5847
  return props;
5825
5848
  }
@@ -5869,7 +5892,7 @@ function h(type, propsOrChildren, children) {
5869
5892
  }
5870
5893
  }
5871
5894
 
5872
- const ssrContextKey = Symbol(``);
5895
+ const ssrContextKey = Symbol.for("v-scx");
5873
5896
  const useSSRContext = () => {
5874
5897
  {
5875
5898
  const ctx = inject(ssrContextKey);
@@ -5908,7 +5931,7 @@ function isMemoSame(cached, memo) {
5908
5931
  return true;
5909
5932
  }
5910
5933
 
5911
- const version = "3.3.0-alpha.4";
5934
+ const version = "3.3.0-alpha.6";
5912
5935
  const _ssrUtils = {
5913
5936
  createComponentInstance,
5914
5937
  setupComponent,
@@ -5984,6 +6007,7 @@ exports.defineAsyncComponent = defineAsyncComponent;
5984
6007
  exports.defineComponent = defineComponent;
5985
6008
  exports.defineEmits = defineEmits;
5986
6009
  exports.defineExpose = defineExpose;
6010
+ exports.defineOptions = defineOptions;
5987
6011
  exports.defineProps = defineProps;
5988
6012
  exports.getCurrentInstance = getCurrentInstance;
5989
6013
  exports.getTransitionRawChildren = getTransitionRawChildren;