@vue/runtime-dom 3.6.0-rc.1 → 3.6.0-rc.11
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.
- package/dist/runtime-dom.cjs.js +106 -76
- package/dist/runtime-dom.cjs.prod.js +95 -68
- package/dist/runtime-dom.d.ts +147 -157
- package/dist/runtime-dom.esm-browser.js +942 -653
- package/dist/runtime-dom.esm-browser.prod.js +4 -3
- package/dist/runtime-dom.esm-bundler.js +153 -121
- package/dist/runtime-dom.global.js +942 -653
- package/dist/runtime-dom.global.prod.js +4 -3
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.6.0-rc.
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.11
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -10,7 +10,7 @@ export * from "@vue/runtime-core";
|
|
|
10
10
|
let policy = void 0;
|
|
11
11
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
12
12
|
if (tt) try {
|
|
13
|
-
policy =
|
|
13
|
+
policy = /*@__PURE__*/ tt.createPolicy("vue", { createHTML: (val) => val });
|
|
14
14
|
} catch (e) {
|
|
15
15
|
process.env.NODE_ENV !== "production" && warn(`Error creating trusted types policy: ${e}`);
|
|
16
16
|
}
|
|
@@ -18,7 +18,7 @@ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) =>
|
|
|
18
18
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
19
19
|
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
|
20
20
|
const doc = typeof document !== "undefined" ? document : null;
|
|
21
|
-
const templateContainer = doc &&
|
|
21
|
+
const templateContainer = doc && /*@__PURE__*/ doc.createElement("template");
|
|
22
22
|
const nodeOps = {
|
|
23
23
|
insert: (child, parent, anchor) => {
|
|
24
24
|
parent.insertBefore(child, anchor || null);
|
|
@@ -92,7 +92,7 @@ const DOMTransitionPropsValidators = {
|
|
|
92
92
|
leaveActiveClass: String,
|
|
93
93
|
leaveToClass: String
|
|
94
94
|
};
|
|
95
|
-
const TransitionPropsValidators =
|
|
95
|
+
const TransitionPropsValidators = /*@__PURE__*/ extend({}, BaseTransitionPropsValidators, DOMTransitionPropsValidators);
|
|
96
96
|
/**
|
|
97
97
|
* Wrap logic that attaches extra properties to Transition in a function
|
|
98
98
|
* so that it can be annotated as pure
|
|
@@ -106,7 +106,7 @@ const decorate$1 = (t) => {
|
|
|
106
106
|
* DOM Transition is a higher-order-component based on the platform-agnostic
|
|
107
107
|
* base Transition component, with DOM-specific logic.
|
|
108
108
|
*/
|
|
109
|
-
const Transition =
|
|
109
|
+
const Transition = /*@__PURE__*/ decorate$1((props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots));
|
|
110
110
|
/**
|
|
111
111
|
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
|
112
112
|
* with custom HOCs.
|
|
@@ -328,14 +328,15 @@ const vShow = {
|
|
|
328
328
|
},
|
|
329
329
|
updated(el, { value, oldValue }, { transition }) {
|
|
330
330
|
if (!value === !oldValue) return;
|
|
331
|
-
if (transition)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
331
|
+
if (transition) {
|
|
332
|
+
if (value) {
|
|
333
|
+
transition.beforeEnter(el);
|
|
334
|
+
setDisplay(el, true);
|
|
335
|
+
transition.enter(el);
|
|
336
|
+
} else transition.leave(el, () => {
|
|
337
|
+
setDisplay(el, false);
|
|
338
|
+
});
|
|
339
|
+
} else setDisplay(el, value);
|
|
339
340
|
},
|
|
340
341
|
beforeUnmount(el, { value }) {
|
|
341
342
|
setDisplay(el, value);
|
|
@@ -359,50 +360,20 @@ const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR
|
|
|
359
360
|
*/
|
|
360
361
|
function useCssVars(getter) {
|
|
361
362
|
const instance = getCurrentInstance();
|
|
362
|
-
const getVars = () => getter(instance.proxy);
|
|
363
|
-
const setVars = (vars) => {
|
|
364
|
-
if (instance.ce) setVarsOnNode(instance.ce, vars);
|
|
365
|
-
else setVarsOnVNode(instance.subTree, vars);
|
|
366
|
-
};
|
|
367
|
-
baseUseCssVars(instance, () => instance.subTree.el.parentNode, getVars, setVars);
|
|
368
|
-
}
|
|
369
|
-
function setVarsOnVNode(vnode, vars) {
|
|
370
|
-
if (vnode.shapeFlag & 128) {
|
|
371
|
-
const suspense = vnode.suspense;
|
|
372
|
-
vnode = suspense.activeBranch;
|
|
373
|
-
if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
|
|
374
|
-
setVarsOnVNode(suspense.activeBranch, vars);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
while (vnode.component) vnode = vnode.component.subTree;
|
|
378
|
-
if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
|
|
379
|
-
else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
|
380
|
-
else if (vnode.type === Static) {
|
|
381
|
-
let { el, anchor } = vnode;
|
|
382
|
-
while (el) {
|
|
383
|
-
setVarsOnNode(el, vars);
|
|
384
|
-
if (el === anchor) break;
|
|
385
|
-
el = el.nextSibling;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* @internal
|
|
391
|
-
* shared between vdom and vapor
|
|
392
|
-
*/
|
|
393
|
-
function baseUseCssVars(instance, getParentNode, getVars, setVars) {
|
|
394
363
|
/* v8 ignore start */
|
|
395
364
|
if (!instance) {
|
|
396
365
|
process.env.NODE_ENV !== "production" && warn(`useCssVars is called without current active component instance.`);
|
|
397
366
|
return;
|
|
398
367
|
}
|
|
399
368
|
/* v8 ignore stop */
|
|
369
|
+
const getVars = () => getter(instance.proxy);
|
|
400
370
|
if (!!(process.env.NODE_ENV !== "production")) instance.getCssVars = getVars;
|
|
401
371
|
const updateTeleports = instance.ut = (vars = getVars()) => {
|
|
402
372
|
Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach((node) => setVarsOnNode(node, vars));
|
|
403
373
|
};
|
|
404
374
|
const applyCssVars = (vars = getVars()) => {
|
|
405
|
-
|
|
375
|
+
if (instance.ce) setVarsOnNode(instance.ce, vars);
|
|
376
|
+
else setVarsOnVNode(instance.subTree, vars);
|
|
406
377
|
updateTeleports(vars);
|
|
407
378
|
};
|
|
408
379
|
onBeforeUpdate(() => {
|
|
@@ -415,10 +386,38 @@ function baseUseCssVars(instance, getParentNode, getVars, setVars) {
|
|
|
415
386
|
applyCssVars(vars);
|
|
416
387
|
}, NOOP, { flush: "post" });
|
|
417
388
|
const ob = new MutationObserver(() => applyCssVars());
|
|
418
|
-
ob.observe(
|
|
389
|
+
ob.observe(instance.subTree.el.parentNode, { childList: true });
|
|
419
390
|
onUnmounted(() => ob.disconnect());
|
|
420
391
|
});
|
|
421
392
|
}
|
|
393
|
+
function setVarsOnVNode(vnode, vars) {
|
|
394
|
+
if (vnode.shapeFlag & 128) {
|
|
395
|
+
const suspense = vnode.suspense;
|
|
396
|
+
vnode = suspense.activeBranch;
|
|
397
|
+
if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
|
|
398
|
+
setVarsOnVNode(suspense.activeBranch, vars);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
while (vnode.component) {
|
|
402
|
+
const component = vnode.component;
|
|
403
|
+
if (component.vapor) {
|
|
404
|
+
component.appContext.vapor.applyCssVars(vnode, vars);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
vnode = vnode.component.subTree;
|
|
408
|
+
}
|
|
409
|
+
if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
|
|
410
|
+
else if (vnode.vb) vnode.ctx.appContext.vapor.applyCssVars(vnode, vars);
|
|
411
|
+
else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
|
412
|
+
else if (vnode.type === Static) {
|
|
413
|
+
let { el, anchor } = vnode;
|
|
414
|
+
while (el) {
|
|
415
|
+
setVarsOnNode(el, vars);
|
|
416
|
+
if (el === anchor) break;
|
|
417
|
+
el = el.nextSibling;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
422
421
|
/**
|
|
423
422
|
* @internal
|
|
424
423
|
* shared between vdom and vapor
|
|
@@ -443,11 +442,13 @@ function patchStyle(el, prev, next) {
|
|
|
443
442
|
const isCssString = isString(next);
|
|
444
443
|
let hasControlledDisplay = false;
|
|
445
444
|
if (next && !isCssString) {
|
|
446
|
-
if (prev)
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
445
|
+
if (prev) {
|
|
446
|
+
if (!isString(prev)) {
|
|
447
|
+
for (const key in prev) if (next[key] == null) setStyle(style, key, "");
|
|
448
|
+
} else for (const prevStyle of prev.split(";")) {
|
|
449
|
+
const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
|
|
450
|
+
if (next[key] == null) setStyle(style, key, "");
|
|
451
|
+
}
|
|
451
452
|
}
|
|
452
453
|
for (const key in next) {
|
|
453
454
|
if (key === "display") hasControlledDisplay = true;
|
|
@@ -463,7 +464,11 @@ function patchStyle(el, prev, next) {
|
|
|
463
464
|
style.cssText = next;
|
|
464
465
|
hasControlledDisplay = displayRE.test(next);
|
|
465
466
|
}
|
|
466
|
-
} else if (prev)
|
|
467
|
+
} else if (prev) {
|
|
468
|
+
const cssVarText = style[CSS_VAR_TEXT];
|
|
469
|
+
if (cssVarText) style.cssText = cssVarText;
|
|
470
|
+
else el.removeAttribute("style");
|
|
471
|
+
}
|
|
467
472
|
if (vShowOriginalDisplay in el) {
|
|
468
473
|
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
469
474
|
if (el[vShowHidden]) style.display = "none";
|
|
@@ -478,8 +483,10 @@ function setStyle(style, name, rawVal) {
|
|
|
478
483
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
479
484
|
if (semicolonRE.test(val)) warn(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
|
|
480
485
|
}
|
|
481
|
-
if (name.startsWith("--"))
|
|
482
|
-
|
|
486
|
+
if (name.startsWith("--")) {
|
|
487
|
+
if (importantRE.test(val)) style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
488
|
+
else style.setProperty(name, val);
|
|
489
|
+
} else {
|
|
483
490
|
const prefixed = autoPrefix(style, name);
|
|
484
491
|
if (importantRE.test(val)) style.setProperty(hyphenate(prefixed), val.replace(importantRE, ""), "important");
|
|
485
492
|
else style[prefixed] = val;
|
|
@@ -516,9 +523,10 @@ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
|
516
523
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
517
524
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
518
525
|
function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
|
|
519
|
-
if (isSVG && key.startsWith("xlink:"))
|
|
520
|
-
|
|
521
|
-
|
|
526
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
527
|
+
if (value == null) el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
528
|
+
else el.setAttributeNS(xlinkNS, key, value);
|
|
529
|
+
} else if (value == null || isBoolean && !includeBooleanAttr(value)) el.removeAttribute(key);
|
|
522
530
|
else el.setAttribute(key, isBoolean ? "" : isSymbol(value) ? String(value) : value);
|
|
523
531
|
}
|
|
524
532
|
//#endregion
|
|
@@ -591,7 +599,7 @@ function parseEventName(name) {
|
|
|
591
599
|
return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
|
|
592
600
|
}
|
|
593
601
|
let cachedNow = 0;
|
|
594
|
-
const p =
|
|
602
|
+
const p = /*@__PURE__*/ Promise.resolve();
|
|
595
603
|
const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
|
596
604
|
function createInvoker(initialValue, instance) {
|
|
597
605
|
const invoker = (e) => {
|
|
@@ -659,7 +667,7 @@ function shouldSetAsPropForVueCE(el, key) {
|
|
|
659
667
|
//#endregion
|
|
660
668
|
//#region packages/runtime-dom/src/apiCustomElement.ts
|
|
661
669
|
const REMOVAL = {};
|
|
662
|
-
|
|
670
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
663
671
|
function defineCustomElement(options, extraOptions, _createApp) {
|
|
664
672
|
let Comp = defineComponent(options, extraOptions);
|
|
665
673
|
if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
|
|
@@ -708,12 +716,14 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
708
716
|
this._parent = parent;
|
|
709
717
|
break;
|
|
710
718
|
}
|
|
711
|
-
if (!this._instance)
|
|
712
|
-
|
|
713
|
-
this._pendingResolve =
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
719
|
+
if (!this._instance) {
|
|
720
|
+
if (this._resolved) this._mountComponent(this._def);
|
|
721
|
+
else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
|
|
722
|
+
this._pendingResolve = void 0;
|
|
723
|
+
if (this.isConnected) return this._resolveDef();
|
|
724
|
+
});
|
|
725
|
+
else this._resolveDef();
|
|
726
|
+
}
|
|
717
727
|
}
|
|
718
728
|
disconnectedCallback() {
|
|
719
729
|
this._connected = false;
|
|
@@ -747,7 +757,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
747
757
|
* resolve inner component definition (handle possible async component)
|
|
748
758
|
*/
|
|
749
759
|
_resolveDef() {
|
|
750
|
-
if (this._pendingResolve) return;
|
|
760
|
+
if (this._pendingResolve) return this._pendingResolve;
|
|
751
761
|
for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
|
|
752
762
|
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
753
763
|
this._ob.observe(this, { attributes: true });
|
|
@@ -777,6 +787,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
777
787
|
this._def = def;
|
|
778
788
|
resolve(def);
|
|
779
789
|
});
|
|
790
|
+
return this._pendingResolve;
|
|
780
791
|
} else resolve(this._def);
|
|
781
792
|
}
|
|
782
793
|
_mountComponent(def) {
|
|
@@ -815,14 +826,17 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
815
826
|
const { props } = def;
|
|
816
827
|
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
817
828
|
for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
|
|
818
|
-
for (const key of declaredPropKeys.map(camelize$1))
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
829
|
+
for (const key of declaredPropKeys.map(camelize$1)) {
|
|
830
|
+
if (!!(process.env.NODE_ENV !== "production") && key in Object.getPrototypeOf(this)) warn(`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`);
|
|
831
|
+
Object.defineProperty(this, key, {
|
|
832
|
+
get() {
|
|
833
|
+
return this._getProp(key);
|
|
834
|
+
},
|
|
835
|
+
set(val) {
|
|
836
|
+
this._setProp(key, val, true, !this._patching);
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
}
|
|
826
840
|
}
|
|
827
841
|
_setAttr(key) {
|
|
828
842
|
if (key.startsWith("data-v-")) return;
|
|
@@ -883,14 +897,16 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
883
897
|
if (!parentComp) this._styleAnchors.set(this._def, s);
|
|
884
898
|
if (owner) this._styleAnchors.set(owner, s);
|
|
885
899
|
}
|
|
886
|
-
if (!!(process.env.NODE_ENV !== "production"))
|
|
887
|
-
if (owner
|
|
888
|
-
if (
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
900
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
901
|
+
if (owner) {
|
|
902
|
+
if (owner.__hmrId) {
|
|
903
|
+
if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
|
|
904
|
+
let entry = this._childStyles.get(owner.__hmrId);
|
|
905
|
+
if (!entry) this._childStyles.set(owner.__hmrId, entry = []);
|
|
906
|
+
entry.push(s);
|
|
907
|
+
}
|
|
908
|
+
} else (this._styles || (this._styles = [])).push(s);
|
|
909
|
+
}
|
|
894
910
|
}
|
|
895
911
|
}
|
|
896
912
|
_getStyleAnchor(comp) {
|
|
@@ -925,13 +941,11 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
925
941
|
_renderSlots() {
|
|
926
942
|
const outlets = this._getSlots();
|
|
927
943
|
const scopeId = this._instance.type.__scopeId;
|
|
928
|
-
const slotReplacements = /* @__PURE__ */ new Map();
|
|
929
944
|
for (let i = 0; i < outlets.length; i++) {
|
|
930
945
|
const o = outlets[i];
|
|
931
946
|
const slotName = o.getAttribute("name") || "default";
|
|
932
947
|
const content = this._slots[slotName];
|
|
933
948
|
const parent = o.parentNode;
|
|
934
|
-
const replacementNodes = [];
|
|
935
949
|
if (content) for (const n of content) {
|
|
936
950
|
if (scopeId && n.nodeType === 1) {
|
|
937
951
|
const id = scopeId + "-s";
|
|
@@ -941,20 +955,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
941
955
|
while (child = walker.nextNode()) child.setAttribute(id, "");
|
|
942
956
|
}
|
|
943
957
|
parent.insertBefore(n, o);
|
|
944
|
-
replacementNodes.push(n);
|
|
945
|
-
}
|
|
946
|
-
else while (o.firstChild) {
|
|
947
|
-
const child = o.firstChild;
|
|
948
|
-
parent.insertBefore(child, o);
|
|
949
|
-
replacementNodes.push(child);
|
|
950
958
|
}
|
|
959
|
+
else while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
951
960
|
parent.removeChild(o);
|
|
952
|
-
slotReplacements.set(o, {
|
|
953
|
-
nodes: replacementNodes,
|
|
954
|
-
usedFallback: !content
|
|
955
|
-
});
|
|
956
961
|
}
|
|
957
|
-
this._updateSlotNodes(slotReplacements);
|
|
958
962
|
}
|
|
959
963
|
/**
|
|
960
964
|
* @internal
|
|
@@ -993,7 +997,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
993
997
|
* @internal
|
|
994
998
|
*/
|
|
995
999
|
_hasShadowRoot() {
|
|
996
|
-
return this.
|
|
1000
|
+
return this._root !== this;
|
|
997
1001
|
}
|
|
998
1002
|
/**
|
|
999
1003
|
* @internal
|
|
@@ -1040,10 +1044,6 @@ var VueElement = class extends VueElementBase {
|
|
|
1040
1044
|
if (this._instance && this._instance.ce) this._instance.ce = void 0;
|
|
1041
1045
|
this._app = this._instance = null;
|
|
1042
1046
|
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Only called when shadowRoot is false
|
|
1045
|
-
*/
|
|
1046
|
-
_updateSlotNodes(replacements) {}
|
|
1047
1047
|
_createVNode() {
|
|
1048
1048
|
const baseProps = {};
|
|
1049
1049
|
if (!this.shadowRoot) baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
@@ -1059,8 +1059,10 @@ function useHost(caller) {
|
|
|
1059
1059
|
const { hasInstance, value } = useInstanceOption("ce", true);
|
|
1060
1060
|
const el = value;
|
|
1061
1061
|
if (el) return el;
|
|
1062
|
-
else if (!!(process.env.NODE_ENV !== "production"))
|
|
1063
|
-
|
|
1062
|
+
else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1063
|
+
if (!hasInstance) warn(`${caller || "useHost"} called without an active component instance.`);
|
|
1064
|
+
else warn(`${caller || "useHost"} can only be used in components defined via defineCustomElement.`);
|
|
1065
|
+
}
|
|
1064
1066
|
return null;
|
|
1065
1067
|
}
|
|
1066
1068
|
/**
|
|
@@ -1109,7 +1111,7 @@ const decorate = (t) => {
|
|
|
1109
1111
|
};
|
|
1110
1112
|
const TransitionGroup = /* @__PURE__ */ decorate({
|
|
1111
1113
|
name: "TransitionGroup",
|
|
1112
|
-
props:
|
|
1114
|
+
props: /*@__PURE__*/ extend({}, TransitionPropsValidators, {
|
|
1113
1115
|
tag: String,
|
|
1114
1116
|
moveClass: String
|
|
1115
1117
|
}),
|
|
@@ -1240,13 +1242,22 @@ function onCompositionEnd(e) {
|
|
|
1240
1242
|
}
|
|
1241
1243
|
}
|
|
1242
1244
|
const assignKey = Symbol("_assign");
|
|
1245
|
+
const initialValueKey = Symbol("_initialValue");
|
|
1243
1246
|
const vModelText = {
|
|
1244
1247
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
1248
|
+
if (el.parentNode) {
|
|
1249
|
+
if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
|
|
1250
|
+
else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
|
|
1251
|
+
}
|
|
1245
1252
|
el[assignKey] = getModelAssigner(vnode);
|
|
1246
1253
|
vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
|
|
1247
1254
|
},
|
|
1248
|
-
mounted(el, { value }) {
|
|
1249
|
-
|
|
1255
|
+
mounted(el, { value, modifiers: { trim, number } }) {
|
|
1256
|
+
const newValue = value == null ? "" : value;
|
|
1257
|
+
const initialValue = el[initialValueKey];
|
|
1258
|
+
delete el[initialValueKey];
|
|
1259
|
+
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
|
|
1260
|
+
else el.value = newValue;
|
|
1250
1261
|
},
|
|
1251
1262
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1252
1263
|
el[assignKey] = getModelAssigner(vnode);
|
|
@@ -1381,19 +1392,39 @@ const vModelSelectInit = (el, value, number, set) => {
|
|
|
1381
1392
|
el._modelValue = value;
|
|
1382
1393
|
addEventListener(el, "change", () => {
|
|
1383
1394
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
|
|
1384
|
-
|
|
1385
|
-
el.
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1395
|
+
const multiple = el.multiple;
|
|
1396
|
+
const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
|
|
1397
|
+
const pending = el._pendingValue = [multiple, multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue];
|
|
1398
|
+
try {
|
|
1399
|
+
(set || el[assignKey])(assignedValue);
|
|
1400
|
+
} finally {
|
|
1401
|
+
nextTick(() => {
|
|
1402
|
+
if (el._pendingValue === pending) el._pendingValue = void 0;
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1389
1405
|
});
|
|
1390
1406
|
};
|
|
1407
|
+
function isSameSelectValue(value, assignedValue, multiple) {
|
|
1408
|
+
if (!multiple) return looseEqual(value, assignedValue);
|
|
1409
|
+
if (isArray(value)) return looseEqual(value, assignedValue);
|
|
1410
|
+
if (isSet(value)) {
|
|
1411
|
+
if (value.size !== assignedValue.length) return false;
|
|
1412
|
+
for (const item of assignedValue) if (!value.has(item)) return false;
|
|
1413
|
+
return true;
|
|
1414
|
+
}
|
|
1415
|
+
return false;
|
|
1416
|
+
}
|
|
1391
1417
|
/**
|
|
1392
1418
|
* @internal
|
|
1393
1419
|
*/
|
|
1394
1420
|
const vModelSetSelected = (el, value) => {
|
|
1395
1421
|
el._modelValue = value;
|
|
1396
|
-
|
|
1422
|
+
const pending = el._pendingValue;
|
|
1423
|
+
el._pendingValue = void 0;
|
|
1424
|
+
if (pending && pending[0] === el.multiple && isSameSelectValue(value, pending[1], pending[0])) return;
|
|
1425
|
+
setSelected(el, value);
|
|
1426
|
+
};
|
|
1427
|
+
function setSelected(el, value) {
|
|
1397
1428
|
const isMultiple = el.multiple;
|
|
1398
1429
|
const isArrayValue = isArray(value);
|
|
1399
1430
|
if (isMultiple && !isArrayValue && !isSet(value)) {
|
|
@@ -1403,18 +1434,19 @@ const vModelSetSelected = (el, value) => {
|
|
|
1403
1434
|
for (let i = 0, l = el.options.length; i < l; i++) {
|
|
1404
1435
|
const option = el.options[i];
|
|
1405
1436
|
const optionValue = getValue(option);
|
|
1406
|
-
if (isMultiple)
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1437
|
+
if (isMultiple) {
|
|
1438
|
+
if (isArrayValue) {
|
|
1439
|
+
const optionType = typeof optionValue;
|
|
1440
|
+
if (optionType === "string" || optionType === "number") option.selected = value.some((v) => String(v) === String(optionValue));
|
|
1441
|
+
else option.selected = looseIndexOf(value, optionValue) > -1;
|
|
1442
|
+
} else option.selected = value.has(optionValue);
|
|
1443
|
+
} else if (looseEqual(getValue(option), value)) {
|
|
1412
1444
|
if (el.selectedIndex !== i) el.selectedIndex = i;
|
|
1413
1445
|
return;
|
|
1414
1446
|
}
|
|
1415
1447
|
}
|
|
1416
1448
|
if (!isMultiple && el.selectedIndex !== -1) el.selectedIndex = -1;
|
|
1417
|
-
}
|
|
1449
|
+
}
|
|
1418
1450
|
/**
|
|
1419
1451
|
* @internal retrieve raw value set via :value bindings
|
|
1420
1452
|
*/
|
|
@@ -1534,7 +1566,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
1534
1566
|
};
|
|
1535
1567
|
//#endregion
|
|
1536
1568
|
//#region packages/runtime-dom/src/index.ts
|
|
1537
|
-
const rendererOptions =
|
|
1569
|
+
const rendererOptions = /*@__PURE__*/ extend({ patchProp }, nodeOps);
|
|
1538
1570
|
let renderer;
|
|
1539
1571
|
let enabledHydration = false;
|
|
1540
1572
|
function ensureRenderer() {
|
|
@@ -1645,4 +1677,4 @@ const initDirectivesForSSR = () => {
|
|
|
1645
1677
|
}
|
|
1646
1678
|
};
|
|
1647
1679
|
//#endregion
|
|
1648
|
-
export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation,
|
|
1680
|
+
export { Transition, TransitionGroup, TransitionPropsValidators, VueElement, VueElementBase, baseApplyTranslation, callPendingCbs, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, ensureHydrationRenderer, ensureRenderer, forceReflow, handleMovedChildren, hasCSSTransform, hydrate, initDirectivesForSSR, nodeOps, normalizeContainer, parseEventName, patchClass, patchProp, patchStyle, render, resolveTransitionProps, setVarsOnNode, shouldSetAsProp, shouldSetAsPropForVueCE, svgNS, unsafeToTrustedHTML, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelCheckboxInit, vModelCheckboxUpdate, vModelDynamic, getValue as vModelGetValue, vModelRadio, vModelSelect, vModelSelectInit, vModelSetSelected, vModelText, vModelTextInit, vModelTextUpdate, vShow, vShowHidden, vShowOriginalDisplay, withKeys, withModifiers, xlinkNS };
|