@vue/runtime-dom 3.6.0-beta.9 → 3.6.0-rc.10
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 +147 -98
- package/dist/runtime-dom.cjs.prod.js +136 -90
- package/dist/runtime-dom.d.ts +147 -151
- package/dist/runtime-dom.esm-browser.js +1221 -738
- package/dist/runtime-dom.esm-browser.prod.js +4 -3
- package/dist/runtime-dom.esm-bundler.js +194 -143
- package/dist/runtime-dom.global.js +1221 -738
- 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-
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.10
|
|
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,15 +442,20 @@ 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;
|
|
454
|
-
|
|
455
|
+
const value = next[key];
|
|
456
|
+
if (value != null) {
|
|
457
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
458
|
+
} else setStyle(style, key, "");
|
|
455
459
|
}
|
|
456
460
|
} else if (isCssString) {
|
|
457
461
|
if (prev !== next) {
|
|
@@ -460,7 +464,11 @@ function patchStyle(el, prev, next) {
|
|
|
460
464
|
style.cssText = next;
|
|
461
465
|
hasControlledDisplay = displayRE.test(next);
|
|
462
466
|
}
|
|
463
|
-
} 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
|
+
}
|
|
464
472
|
if (vShowOriginalDisplay in el) {
|
|
465
473
|
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
466
474
|
if (el[vShowHidden]) style.display = "none";
|
|
@@ -475,8 +483,10 @@ function setStyle(style, name, rawVal) {
|
|
|
475
483
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
476
484
|
if (semicolonRE.test(val)) warn(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
|
|
477
485
|
}
|
|
478
|
-
if (name.startsWith("--"))
|
|
479
|
-
|
|
486
|
+
if (name.startsWith("--")) {
|
|
487
|
+
if (importantRE.test(val)) style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
488
|
+
else style.setProperty(name, val);
|
|
489
|
+
} else {
|
|
480
490
|
const prefixed = autoPrefix(style, name);
|
|
481
491
|
if (importantRE.test(val)) style.setProperty(hyphenate(prefixed), val.replace(importantRE, ""), "important");
|
|
482
492
|
else style[prefixed] = val;
|
|
@@ -501,13 +511,22 @@ function autoPrefix(style, rawName) {
|
|
|
501
511
|
}
|
|
502
512
|
return rawName;
|
|
503
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Browsers update textarea width/height directly during native resize.
|
|
516
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
517
|
+
* still follow normal vnode style patching.
|
|
518
|
+
*/
|
|
519
|
+
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
520
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
|
|
521
|
+
}
|
|
504
522
|
//#endregion
|
|
505
523
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
506
524
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
507
525
|
function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
|
|
508
|
-
if (isSVG && key.startsWith("xlink:"))
|
|
509
|
-
|
|
510
|
-
|
|
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);
|
|
511
530
|
else el.setAttribute(key, isBoolean ? "" : isSymbol(value) ? String(value) : value);
|
|
512
531
|
}
|
|
513
532
|
//#endregion
|
|
@@ -559,7 +578,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
559
578
|
const existingInvoker = invokers[rawName];
|
|
560
579
|
if (nextValue && existingInvoker) existingInvoker.value = !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue;
|
|
561
580
|
else {
|
|
562
|
-
const [name, options] =
|
|
581
|
+
const [name, options] = parseEventName(rawName);
|
|
563
582
|
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(!!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue, instance), options);
|
|
564
583
|
else if (existingInvoker) {
|
|
565
584
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -567,27 +586,40 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
567
586
|
}
|
|
568
587
|
}
|
|
569
588
|
}
|
|
570
|
-
const optionsModifierRE = /(
|
|
571
|
-
|
|
589
|
+
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
590
|
+
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
591
|
+
function parseEventName(name) {
|
|
572
592
|
let options;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
options[m[0].toLowerCase()] = true;
|
|
579
|
-
}
|
|
593
|
+
let m;
|
|
594
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
595
|
+
if (!options) options = {};
|
|
596
|
+
name = name.slice(0, name.length - m[1].length);
|
|
597
|
+
options[m[1].toLowerCase()] = true;
|
|
580
598
|
}
|
|
581
599
|
return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
|
|
582
600
|
}
|
|
583
601
|
let cachedNow = 0;
|
|
584
|
-
const p =
|
|
602
|
+
const p = /*@__PURE__*/ Promise.resolve();
|
|
585
603
|
const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
|
586
604
|
function createInvoker(initialValue, instance) {
|
|
587
605
|
const invoker = (e) => {
|
|
588
606
|
if (!e._vts) e._vts = Date.now();
|
|
589
607
|
else if (e._vts <= invoker.attached) return;
|
|
590
|
-
|
|
608
|
+
const value = invoker.value;
|
|
609
|
+
if (isArray(value)) {
|
|
610
|
+
const originalStop = e.stopImmediatePropagation;
|
|
611
|
+
e.stopImmediatePropagation = () => {
|
|
612
|
+
originalStop.call(e);
|
|
613
|
+
e._stopped = true;
|
|
614
|
+
};
|
|
615
|
+
const handlers = value.slice();
|
|
616
|
+
const args = [e];
|
|
617
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
618
|
+
if (e._stopped) break;
|
|
619
|
+
const handler = handlers[i];
|
|
620
|
+
if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
|
|
621
|
+
}
|
|
622
|
+
} else callWithAsyncErrorHandling(value, instance, 5, [e]);
|
|
591
623
|
};
|
|
592
624
|
invoker.value = initialValue;
|
|
593
625
|
invoker.attached = getNow();
|
|
@@ -598,16 +630,6 @@ function sanitizeEventValue(value, propName) {
|
|
|
598
630
|
warn(`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`);
|
|
599
631
|
return NOOP;
|
|
600
632
|
}
|
|
601
|
-
function patchStopImmediatePropagation(e, value) {
|
|
602
|
-
if (isArray(value)) {
|
|
603
|
-
const originalStop = e.stopImmediatePropagation;
|
|
604
|
-
e.stopImmediatePropagation = () => {
|
|
605
|
-
originalStop.call(e);
|
|
606
|
-
e._stopped = true;
|
|
607
|
-
};
|
|
608
|
-
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
609
|
-
} else return value;
|
|
610
|
-
}
|
|
611
633
|
//#endregion
|
|
612
634
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
613
635
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -645,7 +667,7 @@ function shouldSetAsPropForVueCE(el, key) {
|
|
|
645
667
|
//#endregion
|
|
646
668
|
//#region packages/runtime-dom/src/apiCustomElement.ts
|
|
647
669
|
const REMOVAL = {};
|
|
648
|
-
|
|
670
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
649
671
|
function defineCustomElement(options, extraOptions, _createApp) {
|
|
650
672
|
let Comp = defineComponent(options, extraOptions);
|
|
651
673
|
if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
|
|
@@ -694,12 +716,14 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
694
716
|
this._parent = parent;
|
|
695
717
|
break;
|
|
696
718
|
}
|
|
697
|
-
if (!this._instance)
|
|
698
|
-
|
|
699
|
-
this._pendingResolve =
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
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
|
+
}
|
|
703
727
|
}
|
|
704
728
|
disconnectedCallback() {
|
|
705
729
|
this._connected = false;
|
|
@@ -733,7 +757,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
733
757
|
* resolve inner component definition (handle possible async component)
|
|
734
758
|
*/
|
|
735
759
|
_resolveDef() {
|
|
736
|
-
if (this._pendingResolve) return;
|
|
760
|
+
if (this._pendingResolve) return this._pendingResolve;
|
|
737
761
|
for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
|
|
738
762
|
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
739
763
|
this._ob.observe(this, { attributes: true });
|
|
@@ -763,6 +787,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
763
787
|
this._def = def;
|
|
764
788
|
resolve(def);
|
|
765
789
|
});
|
|
790
|
+
return this._pendingResolve;
|
|
766
791
|
} else resolve(this._def);
|
|
767
792
|
}
|
|
768
793
|
_mountComponent(def) {
|
|
@@ -801,14 +826,17 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
801
826
|
const { props } = def;
|
|
802
827
|
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
803
828
|
for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
|
|
804
|
-
for (const key of declaredPropKeys.map(camelize$1))
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
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
|
+
}
|
|
812
840
|
}
|
|
813
841
|
_setAttr(key) {
|
|
814
842
|
if (key.startsWith("data-v-")) return;
|
|
@@ -869,14 +897,16 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
869
897
|
if (!parentComp) this._styleAnchors.set(this._def, s);
|
|
870
898
|
if (owner) this._styleAnchors.set(owner, s);
|
|
871
899
|
}
|
|
872
|
-
if (!!(process.env.NODE_ENV !== "production"))
|
|
873
|
-
if (owner
|
|
874
|
-
if (
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
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
|
+
}
|
|
880
910
|
}
|
|
881
911
|
}
|
|
882
912
|
_getStyleAnchor(comp) {
|
|
@@ -911,13 +941,11 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
911
941
|
_renderSlots() {
|
|
912
942
|
const outlets = this._getSlots();
|
|
913
943
|
const scopeId = this._instance.type.__scopeId;
|
|
914
|
-
const slotReplacements = /* @__PURE__ */ new Map();
|
|
915
944
|
for (let i = 0; i < outlets.length; i++) {
|
|
916
945
|
const o = outlets[i];
|
|
917
946
|
const slotName = o.getAttribute("name") || "default";
|
|
918
947
|
const content = this._slots[slotName];
|
|
919
948
|
const parent = o.parentNode;
|
|
920
|
-
const replacementNodes = [];
|
|
921
949
|
if (content) for (const n of content) {
|
|
922
950
|
if (scopeId && n.nodeType === 1) {
|
|
923
951
|
const id = scopeId + "-s";
|
|
@@ -927,17 +955,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
927
955
|
while (child = walker.nextNode()) child.setAttribute(id, "");
|
|
928
956
|
}
|
|
929
957
|
parent.insertBefore(n, o);
|
|
930
|
-
replacementNodes.push(n);
|
|
931
|
-
}
|
|
932
|
-
else while (o.firstChild) {
|
|
933
|
-
const child = o.firstChild;
|
|
934
|
-
parent.insertBefore(child, o);
|
|
935
|
-
replacementNodes.push(child);
|
|
936
958
|
}
|
|
959
|
+
else while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
937
960
|
parent.removeChild(o);
|
|
938
|
-
slotReplacements.set(o, replacementNodes);
|
|
939
961
|
}
|
|
940
|
-
this._updateSlotNodes(slotReplacements);
|
|
941
962
|
}
|
|
942
963
|
/**
|
|
943
964
|
* @internal
|
|
@@ -976,7 +997,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
976
997
|
* @internal
|
|
977
998
|
*/
|
|
978
999
|
_hasShadowRoot() {
|
|
979
|
-
return this.
|
|
1000
|
+
return this._root !== this;
|
|
980
1001
|
}
|
|
981
1002
|
/**
|
|
982
1003
|
* @internal
|
|
@@ -1023,10 +1044,6 @@ var VueElement = class extends VueElementBase {
|
|
|
1023
1044
|
if (this._instance && this._instance.ce) this._instance.ce = void 0;
|
|
1024
1045
|
this._app = this._instance = null;
|
|
1025
1046
|
}
|
|
1026
|
-
/**
|
|
1027
|
-
* Only called when shadowRoot is false
|
|
1028
|
-
*/
|
|
1029
|
-
_updateSlotNodes(replacements) {}
|
|
1030
1047
|
_createVNode() {
|
|
1031
1048
|
const baseProps = {};
|
|
1032
1049
|
if (!this.shadowRoot) baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
@@ -1042,8 +1059,10 @@ function useHost(caller) {
|
|
|
1042
1059
|
const { hasInstance, value } = useInstanceOption("ce", true);
|
|
1043
1060
|
const el = value;
|
|
1044
1061
|
if (el) return el;
|
|
1045
|
-
else if (!!(process.env.NODE_ENV !== "production"))
|
|
1046
|
-
|
|
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
|
+
}
|
|
1047
1066
|
return null;
|
|
1048
1067
|
}
|
|
1049
1068
|
/**
|
|
@@ -1092,7 +1111,7 @@ const decorate = (t) => {
|
|
|
1092
1111
|
};
|
|
1093
1112
|
const TransitionGroup = /* @__PURE__ */ decorate({
|
|
1094
1113
|
name: "TransitionGroup",
|
|
1095
|
-
props:
|
|
1114
|
+
props: /*@__PURE__*/ extend({}, TransitionPropsValidators, {
|
|
1096
1115
|
tag: String,
|
|
1097
1116
|
moveClass: String
|
|
1098
1117
|
}),
|
|
@@ -1125,7 +1144,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
1125
1144
|
prevChildren = [];
|
|
1126
1145
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
1127
1146
|
const child = children[i];
|
|
1128
|
-
if (child.el && child.el instanceof Element) {
|
|
1147
|
+
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
1129
1148
|
prevChildren.push(child);
|
|
1130
1149
|
setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
1131
1150
|
positionMap.set(child, getPosition(child.el));
|
|
@@ -1223,13 +1242,22 @@ function onCompositionEnd(e) {
|
|
|
1223
1242
|
}
|
|
1224
1243
|
}
|
|
1225
1244
|
const assignKey = Symbol("_assign");
|
|
1245
|
+
const initialValueKey = Symbol("_initialValue");
|
|
1226
1246
|
const vModelText = {
|
|
1227
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
|
+
}
|
|
1228
1252
|
el[assignKey] = getModelAssigner(vnode);
|
|
1229
1253
|
vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
|
|
1230
1254
|
},
|
|
1231
|
-
mounted(el, { value }) {
|
|
1232
|
-
|
|
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;
|
|
1233
1261
|
},
|
|
1234
1262
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1235
1263
|
el[assignKey] = getModelAssigner(vnode);
|
|
@@ -1349,7 +1377,8 @@ const vModelSelect = {
|
|
|
1349
1377
|
mounted(el, { value }) {
|
|
1350
1378
|
vModelSetSelected(el, value);
|
|
1351
1379
|
},
|
|
1352
|
-
beforeUpdate(el,
|
|
1380
|
+
beforeUpdate(el, { value }, vnode) {
|
|
1381
|
+
el._modelValue = value;
|
|
1353
1382
|
el[assignKey] = getModelAssigner(vnode);
|
|
1354
1383
|
},
|
|
1355
1384
|
updated(el, { value }) {
|
|
@@ -1360,21 +1389,42 @@ const vModelSelect = {
|
|
|
1360
1389
|
* @internal
|
|
1361
1390
|
*/
|
|
1362
1391
|
const vModelSelectInit = (el, value, number, set) => {
|
|
1363
|
-
|
|
1392
|
+
el._modelValue = value;
|
|
1364
1393
|
addEventListener(el, "change", () => {
|
|
1365
1394
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
|
|
1366
|
-
|
|
1367
|
-
el.
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
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
|
+
}
|
|
1371
1405
|
});
|
|
1372
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
|
+
}
|
|
1373
1417
|
/**
|
|
1374
1418
|
* @internal
|
|
1375
1419
|
*/
|
|
1376
1420
|
const vModelSetSelected = (el, value) => {
|
|
1377
|
-
|
|
1421
|
+
el._modelValue = value;
|
|
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) {
|
|
1378
1428
|
const isMultiple = el.multiple;
|
|
1379
1429
|
const isArrayValue = isArray(value);
|
|
1380
1430
|
if (isMultiple && !isArrayValue && !isSet(value)) {
|
|
@@ -1384,18 +1434,19 @@ const vModelSetSelected = (el, value) => {
|
|
|
1384
1434
|
for (let i = 0, l = el.options.length; i < l; i++) {
|
|
1385
1435
|
const option = el.options[i];
|
|
1386
1436
|
const optionValue = getValue(option);
|
|
1387
|
-
if (isMultiple)
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
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)) {
|
|
1393
1444
|
if (el.selectedIndex !== i) el.selectedIndex = i;
|
|
1394
1445
|
return;
|
|
1395
1446
|
}
|
|
1396
1447
|
}
|
|
1397
1448
|
if (!isMultiple && el.selectedIndex !== -1) el.selectedIndex = -1;
|
|
1398
|
-
}
|
|
1449
|
+
}
|
|
1399
1450
|
/**
|
|
1400
1451
|
* @internal retrieve raw value set via :value bindings
|
|
1401
1452
|
*/
|
|
@@ -1515,7 +1566,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
1515
1566
|
};
|
|
1516
1567
|
//#endregion
|
|
1517
1568
|
//#region packages/runtime-dom/src/index.ts
|
|
1518
|
-
const rendererOptions =
|
|
1569
|
+
const rendererOptions = /*@__PURE__*/ extend({ patchProp }, nodeOps);
|
|
1519
1570
|
let renderer;
|
|
1520
1571
|
let enabledHydration = false;
|
|
1521
1572
|
function ensureRenderer() {
|
|
@@ -1626,4 +1677,4 @@ const initDirectivesForSSR = () => {
|
|
|
1626
1677
|
}
|
|
1627
1678
|
};
|
|
1628
1679
|
//#endregion
|
|
1629
|
-
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 };
|