@atmgrupomaggioli/iris-button 0.0.1 → 0.1.0-dev.0
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/cjs/{index-15a93aad.js → index-f786c569.js} +289 -384
- package/dist/cjs/index-f786c569.js.map +1 -0
- package/dist/cjs/iris-button.cjs.entry.js +66 -10
- package/dist/cjs/iris-button.cjs.entry.js.map +1 -1
- package/dist/cjs/iris-button.cjs.js +3 -3
- package/dist/cjs/iris-button.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/iris-button/iris-button.css +40 -13
- package/dist/collection/components/iris-button/iris-button.js +161 -14
- package/dist/collection/components/iris-button/iris-button.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/iris-button.js +72 -14
- package/dist/components/iris-button.js.map +1 -1
- package/dist/components/{p-9678c037.js → p-913b636c.js} +248 -375
- package/dist/components/p-913b636c.js.map +1 -0
- package/dist/esm/{index-73dab88a.js → index-45a8db1c.js} +289 -385
- package/dist/esm/index-45a8db1c.js.map +1 -0
- package/dist/esm/iris-button.entry.js +66 -10
- package/dist/esm/iris-button.entry.js.map +1 -1
- package/dist/esm/iris-button.js +4 -4
- package/dist/esm/iris-button.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/iris-button/iris-button.css +1 -1
- package/dist/iris-button/iris-button.esm.js +1 -1
- package/dist/iris-button/iris-button.esm.js.map +1 -1
- package/dist/iris-button/p-705a656b.js +3 -0
- package/dist/iris-button/p-705a656b.js.map +1 -0
- package/dist/iris-button/p-cbf16ce7.entry.js +2 -0
- package/dist/iris-button/p-cbf16ce7.entry.js.map +1 -0
- package/dist/types/components/iris-button/iris-button.d.ts +32 -4
- package/dist/types/components.d.ts +49 -7
- package/package.json +6 -9
- package/dist/cjs/index-15a93aad.js.map +0 -1
- package/dist/components/p-9678c037.js.map +0 -1
- package/dist/esm/index-73dab88a.js.map +0 -1
- package/dist/iris-button/p-cc8752cf.entry.js +0 -2
- package/dist/iris-button/p-cc8752cf.entry.js.map +0 -1
- package/dist/iris-button/p-f582cc7a.js +0 -3
- package/dist/iris-button/p-f582cc7a.js.map +0 -1
@@ -21,19 +21,27 @@ function _interopNamespace(e) {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
const NAMESPACE = 'iris-button';
|
24
|
-
const BUILD = /* iris-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event:
|
24
|
+
const BUILD = /* iris-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: false, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: false, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
|
25
25
|
|
26
26
|
/*
|
27
|
-
Stencil Client Platform v4.
|
27
|
+
Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
|
28
28
|
*/
|
29
29
|
var __defProp = Object.defineProperty;
|
30
30
|
var __export = (target, all) => {
|
31
31
|
for (var name in all)
|
32
32
|
__defProp(target, name, { get: all[name], enumerable: true });
|
33
33
|
};
|
34
|
+
|
35
|
+
// src/utils/constants.ts
|
36
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
37
|
+
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
38
|
+
|
39
|
+
// src/client/client-host-ref.ts
|
34
40
|
var hostRefs = /* @__PURE__ */ new WeakMap();
|
35
41
|
var getHostRef = (ref) => hostRefs.get(ref);
|
36
|
-
var registerInstance = (lazyInstance, hostRef) =>
|
42
|
+
var registerInstance = (lazyInstance, hostRef) => {
|
43
|
+
hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
|
44
|
+
};
|
37
45
|
var registerHost = (hostElement, cmpMeta) => {
|
38
46
|
const hostRef = {
|
39
47
|
$flags$: 0,
|
@@ -46,8 +54,10 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
46
54
|
hostElement["s-p"] = [];
|
47
55
|
hostElement["s-rc"] = [];
|
48
56
|
}
|
49
|
-
|
57
|
+
const ref = hostRefs.set(hostElement, hostRef);
|
58
|
+
return ref;
|
50
59
|
};
|
60
|
+
var isMemberInElement = (elm, memberName) => memberName in elm;
|
51
61
|
var consoleError = (e, el) => (0, console.error)(e, el);
|
52
62
|
|
53
63
|
// src/client/client-load-module.ts
|
@@ -69,16 +79,22 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
69
79
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
70
80
|
/* webpackMode: "lazy" */
|
71
81
|
`./${bundleId}.entry.js${""}`
|
72
|
-
)); }).then(
|
73
|
-
{
|
74
|
-
|
82
|
+
)); }).then(
|
83
|
+
(importedModule) => {
|
84
|
+
{
|
85
|
+
cmpModules.set(bundleId, importedModule);
|
86
|
+
}
|
87
|
+
return importedModule[exportName];
|
88
|
+
},
|
89
|
+
(e) => {
|
90
|
+
consoleError(e, hostRef.$hostElement$);
|
75
91
|
}
|
76
|
-
|
77
|
-
}, consoleError);
|
92
|
+
);
|
78
93
|
};
|
79
94
|
|
80
95
|
// src/client/client-style.ts
|
81
96
|
var styles = /* @__PURE__ */ new Map();
|
97
|
+
var HYDRATED_STYLE_ID = "sty-id";
|
82
98
|
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
83
99
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
84
100
|
var win = typeof window !== "undefined" ? window : {};
|
@@ -92,7 +108,6 @@ var plt = {
|
|
92
108
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
93
109
|
ce: (eventName, opts) => new CustomEvent(eventName, opts)
|
94
110
|
};
|
95
|
-
var supportsShadow = BUILD.shadowDom;
|
96
111
|
var promiseResolve = (v) => Promise.resolve(v);
|
97
112
|
var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
|
98
113
|
try {
|
@@ -137,12 +152,6 @@ var flush = () => {
|
|
137
152
|
};
|
138
153
|
var nextTick = (cb) => promiseResolve().then(cb);
|
139
154
|
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
|
140
|
-
|
141
|
-
// src/utils/constants.ts
|
142
|
-
var EMPTY_OBJ = {};
|
143
|
-
|
144
|
-
// src/utils/helpers.ts
|
145
|
-
var isDef = (v) => v != null;
|
146
155
|
var isComplexType = (o) => {
|
147
156
|
o = typeof o;
|
148
157
|
return o === "object" || o === "function";
|
@@ -218,8 +227,6 @@ var uniqueTime = (key, measureText) => {
|
|
218
227
|
};
|
219
228
|
var h = (nodeName, vnodeData, ...children) => {
|
220
229
|
let child = null;
|
221
|
-
let key = null;
|
222
|
-
let slotName = null;
|
223
230
|
let simple = false;
|
224
231
|
let lastSimple = false;
|
225
232
|
const vNodeChildren = [];
|
@@ -243,12 +250,6 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
243
250
|
};
|
244
251
|
walk(children);
|
245
252
|
if (vnodeData) {
|
246
|
-
if (vnodeData.key) {
|
247
|
-
key = vnodeData.key;
|
248
|
-
}
|
249
|
-
if (vnodeData.name) {
|
250
|
-
slotName = vnodeData.name;
|
251
|
-
}
|
252
253
|
{
|
253
254
|
const classData = vnodeData.className || vnodeData.class;
|
254
255
|
if (classData) {
|
@@ -261,12 +262,6 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
261
262
|
if (vNodeChildren.length > 0) {
|
262
263
|
vnode.$children$ = vNodeChildren;
|
263
264
|
}
|
264
|
-
{
|
265
|
-
vnode.$key$ = key;
|
266
|
-
}
|
267
|
-
{
|
268
|
-
vnode.$name$ = slotName;
|
269
|
-
}
|
270
265
|
return vnode;
|
271
266
|
};
|
272
267
|
var newVNode = (tag, text) => {
|
@@ -280,12 +275,6 @@ var newVNode = (tag, text) => {
|
|
280
275
|
{
|
281
276
|
vnode.$attrs$ = null;
|
282
277
|
}
|
283
|
-
{
|
284
|
-
vnode.$key$ = null;
|
285
|
-
}
|
286
|
-
{
|
287
|
-
vnode.$name$ = null;
|
288
|
-
}
|
289
278
|
return vnode;
|
290
279
|
};
|
291
280
|
var Host = {};
|
@@ -302,6 +291,22 @@ var parsePropertyValue = (propValue, propType) => {
|
|
302
291
|
}
|
303
292
|
return propValue;
|
304
293
|
};
|
294
|
+
var getElement = (ref) => getHostRef(ref).$hostElement$ ;
|
295
|
+
|
296
|
+
// src/runtime/event-emitter.ts
|
297
|
+
var createEvent = (ref, name, flags) => {
|
298
|
+
const elm = getElement(ref);
|
299
|
+
return {
|
300
|
+
emit: (detail) => {
|
301
|
+
return emitEvent(elm, name, {
|
302
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
303
|
+
composed: !!(flags & 2 /* Composed */),
|
304
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
305
|
+
detail
|
306
|
+
});
|
307
|
+
}
|
308
|
+
};
|
309
|
+
};
|
305
310
|
var emitEvent = (elm, name, opts) => {
|
306
311
|
const ev = plt.ce(name, opts);
|
307
312
|
elm.dispatchEvent(ev);
|
@@ -337,7 +342,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
337
342
|
}
|
338
343
|
if (!appliedStyles.has(scopeId2)) {
|
339
344
|
{
|
340
|
-
styleElm = doc.createElement("style");
|
345
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
|
341
346
|
styleElm.innerHTML = style;
|
342
347
|
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
343
348
|
if (nonce != null) {
|
@@ -347,7 +352,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
347
352
|
if (styleContainerNode.nodeName === "HEAD") {
|
348
353
|
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
349
354
|
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
350
|
-
styleContainerNode.insertBefore(
|
355
|
+
styleContainerNode.insertBefore(
|
356
|
+
styleElm,
|
357
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
358
|
+
);
|
351
359
|
} else if ("host" in styleContainerNode) {
|
352
360
|
if (supportsConstructableStylesheets) {
|
353
361
|
const stylesheet = new CSSStyleSheet();
|
@@ -385,42 +393,123 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
385
393
|
var attachStyles = (hostRef) => {
|
386
394
|
const cmpMeta = hostRef.$cmpMeta$;
|
387
395
|
const elm = hostRef.$hostElement$;
|
396
|
+
const flags = cmpMeta.$flags$;
|
388
397
|
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
389
|
-
addStyle(
|
390
|
-
elm.getRootNode(),
|
398
|
+
const scopeId2 = addStyle(
|
399
|
+
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
391
400
|
cmpMeta);
|
401
|
+
if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
402
|
+
elm["s-sc"] = scopeId2;
|
403
|
+
elm.classList.add(scopeId2 + "-h");
|
404
|
+
}
|
392
405
|
endAttachStyles();
|
393
406
|
};
|
394
407
|
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
395
|
-
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
408
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
396
409
|
if (oldValue !== newValue) {
|
397
|
-
memberName
|
410
|
+
let isProp = isMemberInElement(elm, memberName);
|
411
|
+
let ln = memberName.toLowerCase();
|
398
412
|
if (memberName === "class") {
|
399
413
|
const classList = elm.classList;
|
400
414
|
const oldClasses = parseClassList(oldValue);
|
401
|
-
|
402
|
-
|
403
|
-
|
415
|
+
let newClasses = parseClassList(newValue);
|
416
|
+
{
|
417
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
418
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
419
|
+
}
|
420
|
+
} else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
|
421
|
+
if (memberName[2] === "-") {
|
422
|
+
memberName = memberName.slice(3);
|
423
|
+
} else if (isMemberInElement(win, ln)) {
|
424
|
+
memberName = ln.slice(2);
|
425
|
+
} else {
|
426
|
+
memberName = ln[2] + memberName.slice(3);
|
427
|
+
}
|
428
|
+
if (oldValue || newValue) {
|
429
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
430
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
431
|
+
if (oldValue) {
|
432
|
+
plt.rel(elm, memberName, oldValue, capture);
|
433
|
+
}
|
434
|
+
if (newValue) {
|
435
|
+
plt.ael(elm, memberName, newValue, capture);
|
436
|
+
}
|
437
|
+
}
|
438
|
+
} else {
|
439
|
+
const isComplex = isComplexType(newValue);
|
440
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
441
|
+
try {
|
442
|
+
if (!elm.tagName.includes("-")) {
|
443
|
+
const n = newValue == null ? "" : newValue;
|
444
|
+
if (memberName === "list") {
|
445
|
+
isProp = false;
|
446
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
447
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
448
|
+
elm[memberName] = n;
|
449
|
+
} else {
|
450
|
+
elm.setAttribute(memberName, n);
|
451
|
+
}
|
452
|
+
}
|
453
|
+
} else if (elm[memberName] !== newValue) {
|
454
|
+
elm[memberName] = newValue;
|
455
|
+
}
|
456
|
+
} catch (e) {
|
457
|
+
}
|
458
|
+
}
|
459
|
+
if (newValue == null || newValue === false) {
|
460
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
461
|
+
{
|
462
|
+
elm.removeAttribute(memberName);
|
463
|
+
}
|
464
|
+
}
|
465
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
466
|
+
newValue = newValue === true ? "" : newValue;
|
467
|
+
{
|
468
|
+
elm.setAttribute(memberName, newValue);
|
469
|
+
}
|
470
|
+
}
|
404
471
|
}
|
405
472
|
}
|
406
473
|
};
|
407
474
|
var parseClassListRegex = /\s/;
|
408
|
-
var parseClassList = (value) =>
|
475
|
+
var parseClassList = (value) => {
|
476
|
+
if (typeof value === "object" && value && "baseVal" in value) {
|
477
|
+
value = value.baseVal;
|
478
|
+
}
|
479
|
+
if (!value || typeof value !== "string") {
|
480
|
+
return [];
|
481
|
+
}
|
482
|
+
return value.split(parseClassListRegex);
|
483
|
+
};
|
484
|
+
var CAPTURE_EVENT_SUFFIX = "Capture";
|
485
|
+
var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
|
409
486
|
|
410
487
|
// src/runtime/vdom/update-element.ts
|
411
|
-
var updateElement = (oldVnode, newVnode, isSvgMode2) => {
|
488
|
+
var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
412
489
|
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
413
|
-
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ ||
|
414
|
-
const newVnodeAttrs = newVnode.$attrs$ ||
|
490
|
+
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
|
491
|
+
const newVnodeAttrs = newVnode.$attrs$ || {};
|
415
492
|
{
|
416
493
|
for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
|
417
494
|
if (!(memberName in newVnodeAttrs)) {
|
418
|
-
setAccessor(
|
495
|
+
setAccessor(
|
496
|
+
elm,
|
497
|
+
memberName,
|
498
|
+
oldVnodeAttrs[memberName],
|
499
|
+
void 0,
|
500
|
+
isSvgMode2,
|
501
|
+
newVnode.$flags$);
|
419
502
|
}
|
420
503
|
}
|
421
504
|
}
|
422
505
|
for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
|
423
|
-
setAccessor(
|
506
|
+
setAccessor(
|
507
|
+
elm,
|
508
|
+
memberName,
|
509
|
+
oldVnodeAttrs[memberName],
|
510
|
+
newVnodeAttrs[memberName],
|
511
|
+
isSvgMode2,
|
512
|
+
newVnode.$flags$);
|
424
513
|
}
|
425
514
|
};
|
426
515
|
function sortedAttrNames(attrNames) {
|
@@ -432,51 +521,29 @@ function sortedAttrNames(attrNames) {
|
|
432
521
|
attrNames
|
433
522
|
);
|
434
523
|
}
|
435
|
-
|
436
|
-
// src/runtime/vdom/vdom-render.ts
|
437
|
-
var scopeId;
|
438
|
-
var contentRef;
|
439
524
|
var hostTagName;
|
440
525
|
var useNativeShadowDom = false;
|
441
|
-
var
|
442
|
-
var
|
443
|
-
var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
444
|
-
var _a;
|
526
|
+
var isSvgMode = false;
|
527
|
+
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
445
528
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
446
529
|
let i2 = 0;
|
447
530
|
let elm;
|
448
531
|
let childNode;
|
449
|
-
let oldVNode;
|
450
|
-
if (!useNativeShadowDom) {
|
451
|
-
checkSlotRelocate = true;
|
452
|
-
if (newVNode2.$tag$ === "slot") {
|
453
|
-
newVNode2.$flags$ |= newVNode2.$children$ ? (
|
454
|
-
// slot element has fallback content
|
455
|
-
// still create an element that "mocks" the slot element
|
456
|
-
2 /* isSlotFallback */
|
457
|
-
) : (
|
458
|
-
// slot element does not have fallback content
|
459
|
-
// create an html comment we'll use to always reference
|
460
|
-
// where actual slot content should sit next to
|
461
|
-
1 /* isSlotReference */
|
462
|
-
);
|
463
|
-
}
|
464
|
-
}
|
465
532
|
if (newVNode2.$text$ !== null) {
|
466
533
|
elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
|
467
|
-
} else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
|
468
|
-
elm = newVNode2.$elm$ = doc.createTextNode("");
|
469
534
|
} else {
|
470
|
-
|
535
|
+
if (!isSvgMode) {
|
536
|
+
isSvgMode = newVNode2.$tag$ === "svg";
|
537
|
+
}
|
538
|
+
elm = newVNode2.$elm$ = doc.createElementNS(
|
539
|
+
isSvgMode ? SVG_NS : HTML_NS,
|
471
540
|
!useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
472
|
-
);
|
473
|
-
{
|
474
|
-
|
541
|
+
) ;
|
542
|
+
if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
543
|
+
isSvgMode = false;
|
475
544
|
}
|
476
|
-
|
477
|
-
|
478
|
-
if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
479
|
-
elm.classList.add(elm["s-si"] = scopeId);
|
545
|
+
{
|
546
|
+
updateElement(null, newVNode2, isSvgMode);
|
480
547
|
}
|
481
548
|
if (newVNode2.$children$) {
|
482
549
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
@@ -486,59 +553,29 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
486
553
|
}
|
487
554
|
}
|
488
555
|
}
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
elm["s-cr"] = contentRef;
|
495
|
-
elm["s-sn"] = newVNode2.$name$ || "";
|
496
|
-
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
497
|
-
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
498
|
-
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
499
|
-
{
|
500
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
501
|
-
}
|
556
|
+
{
|
557
|
+
if (newVNode2.$tag$ === "svg") {
|
558
|
+
isSvgMode = false;
|
559
|
+
} else if (elm.tagName === "foreignObject") {
|
560
|
+
isSvgMode = true;
|
502
561
|
}
|
503
562
|
}
|
504
563
|
}
|
564
|
+
elm["s-hn"] = hostTagName;
|
505
565
|
return elm;
|
506
566
|
};
|
507
|
-
var putBackInOriginalLocation = (parentElm, recursive) => {
|
508
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
509
|
-
const oldSlotChildNodes = Array.from(parentElm.childNodes);
|
510
|
-
if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
|
511
|
-
let node = parentElm;
|
512
|
-
while (node = node.nextSibling) {
|
513
|
-
if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
|
514
|
-
oldSlotChildNodes.push(node);
|
515
|
-
}
|
516
|
-
}
|
517
|
-
}
|
518
|
-
for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
|
519
|
-
const childNode = oldSlotChildNodes[i2];
|
520
|
-
if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
|
521
|
-
insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
|
522
|
-
childNode["s-ol"].remove();
|
523
|
-
childNode["s-ol"] = void 0;
|
524
|
-
childNode["s-sh"] = void 0;
|
525
|
-
checkSlotRelocate = true;
|
526
|
-
}
|
527
|
-
if (recursive) {
|
528
|
-
putBackInOriginalLocation(childNode, recursive);
|
529
|
-
}
|
530
|
-
}
|
531
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
532
|
-
};
|
533
567
|
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
534
|
-
let containerElm = parentElm
|
568
|
+
let containerElm = parentElm;
|
535
569
|
let childNode;
|
570
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
571
|
+
containerElm = containerElm.shadowRoot;
|
572
|
+
}
|
536
573
|
for (; startIdx <= endIdx; ++startIdx) {
|
537
574
|
if (vnodes[startIdx]) {
|
538
575
|
childNode = createElm(null, parentVNode, startIdx);
|
539
576
|
if (childNode) {
|
540
577
|
vnodes[startIdx].$elm$ = childNode;
|
541
|
-
insertBefore(containerElm, childNode,
|
578
|
+
insertBefore(containerElm, childNode, before);
|
542
579
|
}
|
543
580
|
}
|
544
581
|
}
|
@@ -549,14 +586,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
549
586
|
if (vnode) {
|
550
587
|
const elm = vnode.$elm$;
|
551
588
|
if (elm) {
|
552
|
-
{
|
553
|
-
checkSlotFallbackVisibility = true;
|
554
|
-
if (elm["s-ol"]) {
|
555
|
-
elm["s-ol"].remove();
|
556
|
-
} else {
|
557
|
-
putBackInOriginalLocation(elm, true);
|
558
|
-
}
|
559
|
-
}
|
560
589
|
elm.remove();
|
561
590
|
}
|
562
591
|
}
|
@@ -565,8 +594,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
565
594
|
var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
|
566
595
|
let oldStartIdx = 0;
|
567
596
|
let newStartIdx = 0;
|
568
|
-
let idxInOld = 0;
|
569
|
-
let i2 = 0;
|
570
597
|
let oldEndIdx = oldCh.length - 1;
|
571
598
|
let oldStartVnode = oldCh[0];
|
572
599
|
let oldEndVnode = oldCh[oldEndIdx];
|
@@ -574,7 +601,6 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
574
601
|
let newStartVnode = newCh[0];
|
575
602
|
let newEndVnode = newCh[newEndIdx];
|
576
603
|
let node;
|
577
|
-
let elmToMove;
|
578
604
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
579
605
|
if (oldStartVnode == null) {
|
580
606
|
oldStartVnode = oldCh[++oldStartIdx];
|
@@ -593,48 +619,23 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
593
619
|
oldEndVnode = oldCh[--oldEndIdx];
|
594
620
|
newEndVnode = newCh[--newEndIdx];
|
595
621
|
} else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
596
|
-
if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
597
|
-
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
598
|
-
}
|
599
622
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
600
623
|
insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
601
624
|
oldStartVnode = oldCh[++oldStartIdx];
|
602
625
|
newEndVnode = newCh[--newEndIdx];
|
603
626
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
604
|
-
if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
605
|
-
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
606
|
-
}
|
607
627
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
608
628
|
insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
|
609
629
|
oldEndVnode = oldCh[--oldEndIdx];
|
610
630
|
newStartVnode = newCh[++newStartIdx];
|
611
631
|
} else {
|
612
|
-
idxInOld = -1;
|
613
632
|
{
|
614
|
-
for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
|
615
|
-
if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
|
616
|
-
idxInOld = i2;
|
617
|
-
break;
|
618
|
-
}
|
619
|
-
}
|
620
|
-
}
|
621
|
-
if (idxInOld >= 0) {
|
622
|
-
elmToMove = oldCh[idxInOld];
|
623
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
624
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
|
625
|
-
} else {
|
626
|
-
patch(elmToMove, newStartVnode, isInitialRender);
|
627
|
-
oldCh[idxInOld] = void 0;
|
628
|
-
node = elmToMove.$elm$;
|
629
|
-
}
|
630
|
-
newStartVnode = newCh[++newStartIdx];
|
631
|
-
} else {
|
632
633
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
|
633
634
|
newStartVnode = newCh[++newStartIdx];
|
634
635
|
}
|
635
636
|
if (node) {
|
636
637
|
{
|
637
|
-
insertBefore(
|
638
|
+
insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
|
638
639
|
}
|
639
640
|
}
|
640
641
|
}
|
@@ -654,40 +655,26 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
654
655
|
};
|
655
656
|
var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
656
657
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
657
|
-
if (leftVNode.$
|
658
|
-
|
659
|
-
// The component gets hydrated and no VDOM has been initialized.
|
660
|
-
// Here the comparison can't happen as $name$ property is not set for `leftNode`.
|
661
|
-
"$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
|
662
|
-
// hydration comments to be removed
|
663
|
-
leftVNode.$elm$.nodeType !== 8
|
664
|
-
) {
|
665
|
-
return false;
|
666
|
-
}
|
667
|
-
return leftVNode.$name$ === rightVNode.$name$;
|
668
|
-
}
|
669
|
-
if (!isInitialRender) {
|
670
|
-
return leftVNode.$key$ === rightVNode.$key$;
|
658
|
+
if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
|
659
|
+
leftVNode.$key$ = rightVNode.$key$;
|
671
660
|
}
|
672
661
|
return true;
|
673
662
|
}
|
674
663
|
return false;
|
675
664
|
};
|
676
|
-
var referenceNode = (node) => {
|
677
|
-
return node && node["s-ol"] || node;
|
678
|
-
};
|
679
|
-
var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
|
680
665
|
var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
681
666
|
const elm = newVNode2.$elm$ = oldVNode.$elm$;
|
682
667
|
const oldChildren = oldVNode.$children$;
|
683
668
|
const newChildren = newVNode2.$children$;
|
684
669
|
const tag = newVNode2.$tag$;
|
685
670
|
const text = newVNode2.$text$;
|
686
|
-
let defaultHolder;
|
687
671
|
if (text === null) {
|
688
672
|
{
|
689
|
-
|
690
|
-
|
673
|
+
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
674
|
+
}
|
675
|
+
{
|
676
|
+
{
|
677
|
+
updateElement(oldVNode, newVNode2, isSvgMode);
|
691
678
|
}
|
692
679
|
}
|
693
680
|
if (oldChildren !== null && newChildren !== null) {
|
@@ -703,110 +690,21 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
703
690
|
) {
|
704
691
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
705
692
|
}
|
706
|
-
|
707
|
-
|
693
|
+
if (isSvgMode && tag === "svg") {
|
694
|
+
isSvgMode = false;
|
695
|
+
}
|
708
696
|
} else if (oldVNode.$text$ !== text) {
|
709
697
|
elm.data = text;
|
710
698
|
}
|
711
699
|
};
|
712
|
-
var updateFallbackSlotVisibility = (elm) => {
|
713
|
-
const childNodes = elm.childNodes;
|
714
|
-
for (const childNode of childNodes) {
|
715
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
716
|
-
if (childNode["s-sr"]) {
|
717
|
-
const slotName = childNode["s-sn"];
|
718
|
-
childNode.hidden = false;
|
719
|
-
for (const siblingNode of childNodes) {
|
720
|
-
if (siblingNode !== childNode) {
|
721
|
-
if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
|
722
|
-
if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
|
723
|
-
childNode.hidden = true;
|
724
|
-
break;
|
725
|
-
}
|
726
|
-
} else {
|
727
|
-
if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
|
728
|
-
childNode.hidden = true;
|
729
|
-
break;
|
730
|
-
}
|
731
|
-
}
|
732
|
-
}
|
733
|
-
}
|
734
|
-
}
|
735
|
-
updateFallbackSlotVisibility(childNode);
|
736
|
-
}
|
737
|
-
}
|
738
|
-
};
|
739
|
-
var relocateNodes = [];
|
740
|
-
var markSlotContentForRelocation = (elm) => {
|
741
|
-
let node;
|
742
|
-
let hostContentNodes;
|
743
|
-
let j;
|
744
|
-
for (const childNode of elm.childNodes) {
|
745
|
-
if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
|
746
|
-
hostContentNodes = node.parentNode.childNodes;
|
747
|
-
const slotName = childNode["s-sn"];
|
748
|
-
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
749
|
-
node = hostContentNodes[j];
|
750
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes )) {
|
751
|
-
if (isNodeLocatedInSlot(node, slotName)) {
|
752
|
-
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
753
|
-
checkSlotFallbackVisibility = true;
|
754
|
-
node["s-sn"] = node["s-sn"] || slotName;
|
755
|
-
if (relocateNodeData) {
|
756
|
-
relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
|
757
|
-
relocateNodeData.$slotRefNode$ = childNode;
|
758
|
-
} else {
|
759
|
-
node["s-sh"] = childNode["s-hn"];
|
760
|
-
relocateNodes.push({
|
761
|
-
$slotRefNode$: childNode,
|
762
|
-
$nodeToRelocate$: node
|
763
|
-
});
|
764
|
-
}
|
765
|
-
if (node["s-sr"]) {
|
766
|
-
relocateNodes.map((relocateNode) => {
|
767
|
-
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
|
768
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
769
|
-
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
770
|
-
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
771
|
-
}
|
772
|
-
}
|
773
|
-
});
|
774
|
-
}
|
775
|
-
} else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
776
|
-
relocateNodes.push({
|
777
|
-
$nodeToRelocate$: node
|
778
|
-
});
|
779
|
-
}
|
780
|
-
}
|
781
|
-
}
|
782
|
-
}
|
783
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
784
|
-
markSlotContentForRelocation(childNode);
|
785
|
-
}
|
786
|
-
}
|
787
|
-
};
|
788
|
-
var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
789
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
790
|
-
if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
|
791
|
-
return true;
|
792
|
-
}
|
793
|
-
if (nodeToRelocate.getAttribute("slot") === slotName) {
|
794
|
-
return true;
|
795
|
-
}
|
796
|
-
return false;
|
797
|
-
}
|
798
|
-
if (nodeToRelocate["s-sn"] === slotName) {
|
799
|
-
return true;
|
800
|
-
}
|
801
|
-
return slotName === "";
|
802
|
-
};
|
803
700
|
var insertBefore = (parent, newNode, reference) => {
|
804
|
-
|
805
|
-
|
701
|
+
{
|
702
|
+
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
703
|
+
}
|
806
704
|
};
|
807
705
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
808
|
-
var _a, _b, _c, _d;
|
809
706
|
const hostElm = hostRef.$hostElement$;
|
707
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
810
708
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
811
709
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
812
710
|
hostTagName = hostElm.tagName;
|
@@ -820,83 +718,22 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
820
718
|
rootVnode.$tag$ = null;
|
821
719
|
rootVnode.$flags$ |= 4 /* isHost */;
|
822
720
|
hostRef.$vnode$ = rootVnode;
|
823
|
-
rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
|
824
|
-
useNativeShadowDom =
|
825
|
-
{
|
826
|
-
contentRef = hostElm["s-cr"];
|
827
|
-
checkSlotFallbackVisibility = false;
|
828
|
-
}
|
721
|
+
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
722
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
829
723
|
patch(oldVNode, rootVnode, isInitialLoad);
|
830
|
-
{
|
831
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
832
|
-
if (checkSlotRelocate) {
|
833
|
-
markSlotContentForRelocation(rootVnode.$elm$);
|
834
|
-
for (const relocateData of relocateNodes) {
|
835
|
-
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
836
|
-
if (!nodeToRelocate["s-ol"]) {
|
837
|
-
const orgLocationNode = doc.createTextNode("");
|
838
|
-
orgLocationNode["s-nr"] = nodeToRelocate;
|
839
|
-
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
840
|
-
}
|
841
|
-
}
|
842
|
-
for (const relocateData of relocateNodes) {
|
843
|
-
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
844
|
-
const slotRefNode = relocateData.$slotRefNode$;
|
845
|
-
if (slotRefNode) {
|
846
|
-
const parentNodeRef = slotRefNode.parentNode;
|
847
|
-
let insertBeforeNode = slotRefNode.nextSibling;
|
848
|
-
{
|
849
|
-
let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
|
850
|
-
while (orgLocationNode) {
|
851
|
-
let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
|
852
|
-
if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
|
853
|
-
refNode = refNode.nextSibling;
|
854
|
-
while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
|
855
|
-
refNode = refNode == null ? void 0 : refNode.nextSibling;
|
856
|
-
}
|
857
|
-
if (!refNode || !refNode["s-nr"]) {
|
858
|
-
insertBeforeNode = refNode;
|
859
|
-
break;
|
860
|
-
}
|
861
|
-
}
|
862
|
-
orgLocationNode = orgLocationNode.previousSibling;
|
863
|
-
}
|
864
|
-
}
|
865
|
-
if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
|
866
|
-
if (nodeToRelocate !== insertBeforeNode) {
|
867
|
-
if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
|
868
|
-
nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
|
869
|
-
}
|
870
|
-
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
871
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
872
|
-
nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
|
873
|
-
}
|
874
|
-
}
|
875
|
-
}
|
876
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
|
877
|
-
} else {
|
878
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
879
|
-
if (isInitialLoad) {
|
880
|
-
nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
|
881
|
-
}
|
882
|
-
nodeToRelocate.hidden = true;
|
883
|
-
}
|
884
|
-
}
|
885
|
-
}
|
886
|
-
}
|
887
|
-
if (checkSlotFallbackVisibility) {
|
888
|
-
updateFallbackSlotVisibility(rootVnode.$elm$);
|
889
|
-
}
|
890
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
891
|
-
relocateNodes.length = 0;
|
892
|
-
}
|
893
|
-
contentRef = void 0;
|
894
724
|
};
|
895
725
|
|
896
726
|
// src/runtime/update-component.ts
|
897
727
|
var attachToAncestor = (hostRef, ancestorComponent) => {
|
898
728
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
899
|
-
ancestorComponent["s-p"].push(
|
729
|
+
const index = ancestorComponent["s-p"].push(
|
730
|
+
new Promise(
|
731
|
+
(r) => hostRef.$onRenderResolve$ = () => {
|
732
|
+
ancestorComponent["s-p"].splice(index - 1, 1);
|
733
|
+
r();
|
734
|
+
}
|
735
|
+
)
|
736
|
+
);
|
900
737
|
}
|
901
738
|
};
|
902
739
|
var scheduleUpdate = (hostRef, isInitialLoad) => {
|
@@ -1055,15 +892,68 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1055
892
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
1056
893
|
members.map(([memberName, [memberFlags]]) => {
|
1057
894
|
if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
895
|
+
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
|
896
|
+
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
897
|
+
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
898
|
+
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
899
|
+
Object.defineProperty(prototype, memberName, {
|
900
|
+
get() {
|
901
|
+
{
|
902
|
+
if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
|
903
|
+
return getValue(this, memberName);
|
904
|
+
}
|
905
|
+
const ref = getHostRef(this);
|
906
|
+
const instance = ref ? ref.$lazyInstance$ : prototype;
|
907
|
+
if (!instance) return;
|
908
|
+
return instance[memberName];
|
909
|
+
}
|
910
|
+
},
|
911
|
+
configurable: true,
|
912
|
+
enumerable: true
|
913
|
+
});
|
914
|
+
}
|
1058
915
|
Object.defineProperty(prototype, memberName, {
|
1059
|
-
get() {
|
1060
|
-
return getValue(this, memberName);
|
1061
|
-
},
|
1062
916
|
set(newValue) {
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
917
|
+
const ref = getHostRef(this);
|
918
|
+
if (origSetter) {
|
919
|
+
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
920
|
+
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
921
|
+
newValue = ref.$instanceValues$.get(memberName);
|
922
|
+
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
923
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
924
|
+
}
|
925
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
926
|
+
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
927
|
+
setValue(this, memberName, newValue, cmpMeta);
|
928
|
+
return;
|
929
|
+
}
|
930
|
+
{
|
931
|
+
if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
|
932
|
+
setValue(this, memberName, newValue, cmpMeta);
|
933
|
+
if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
|
934
|
+
ref.$onReadyPromise$.then(() => {
|
935
|
+
if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
|
936
|
+
ref.$lazyInstance$[memberName] = newValue;
|
937
|
+
}
|
938
|
+
});
|
939
|
+
}
|
940
|
+
return;
|
941
|
+
}
|
942
|
+
const setterSetVal = () => {
|
943
|
+
const currentValue = ref.$lazyInstance$[memberName];
|
944
|
+
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
945
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
946
|
+
}
|
947
|
+
ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
|
948
|
+
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
949
|
+
};
|
950
|
+
if (ref.$lazyInstance$) {
|
951
|
+
setterSetVal();
|
952
|
+
} else {
|
953
|
+
ref.$onReadyPromise$.then(() => setterSetVal());
|
954
|
+
}
|
955
|
+
}
|
956
|
+
}
|
1067
957
|
});
|
1068
958
|
}
|
1069
959
|
});
|
@@ -1073,7 +963,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1073
963
|
plt.jmp(() => {
|
1074
964
|
var _a2;
|
1075
965
|
const propName = attrNameToPropName.get(attrName);
|
1076
|
-
if (this.hasOwnProperty(propName)) {
|
966
|
+
if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
|
1077
967
|
newValue = this[propName];
|
1078
968
|
delete this[propName];
|
1079
969
|
} else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
@@ -1093,7 +983,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1093
983
|
}
|
1094
984
|
return;
|
1095
985
|
}
|
1096
|
-
|
986
|
+
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
987
|
+
newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
|
988
|
+
if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
|
989
|
+
this[propName] = newValue;
|
990
|
+
}
|
1097
991
|
});
|
1098
992
|
};
|
1099
993
|
Cstr.observedAttributes = Array.from(
|
@@ -1116,9 +1010,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1116
1010
|
let Cstr;
|
1117
1011
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
1118
1012
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
1119
|
-
|
1120
|
-
|
1121
|
-
const CstrImport = loadModule(cmpMeta);
|
1013
|
+
{
|
1014
|
+
const CstrImport = loadModule(cmpMeta, hostRef);
|
1122
1015
|
if (CstrImport && "then" in CstrImport) {
|
1123
1016
|
const endLoad = uniqueTime();
|
1124
1017
|
Cstr = await CstrImport;
|
@@ -1140,16 +1033,12 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1140
1033
|
try {
|
1141
1034
|
new Cstr(hostRef);
|
1142
1035
|
} catch (e) {
|
1143
|
-
consoleError(e);
|
1036
|
+
consoleError(e, elm);
|
1144
1037
|
}
|
1145
1038
|
{
|
1146
1039
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
1147
1040
|
}
|
1148
1041
|
endNewInstance();
|
1149
|
-
} else {
|
1150
|
-
Cstr = elm.constructor;
|
1151
|
-
const cmpTag = elm.localName;
|
1152
|
-
customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
|
1153
1042
|
}
|
1154
1043
|
if (Cstr && Cstr.style) {
|
1155
1044
|
let style;
|
@@ -1172,7 +1061,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1172
1061
|
schedule();
|
1173
1062
|
}
|
1174
1063
|
};
|
1175
|
-
var fireConnectedCallback = (instance) => {
|
1064
|
+
var fireConnectedCallback = (instance, elm) => {
|
1176
1065
|
};
|
1177
1066
|
|
1178
1067
|
// src/runtime/connected-callback.ts
|
@@ -1183,12 +1072,6 @@ var connectedCallback = (elm) => {
|
|
1183
1072
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
1184
1073
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
1185
1074
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
1186
|
-
{
|
1187
|
-
if (// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
1188
|
-
cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
|
1189
|
-
setContentReference(elm);
|
1190
|
-
}
|
1191
|
-
}
|
1192
1075
|
{
|
1193
1076
|
let ancestorComponent = elm;
|
1194
1077
|
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
@@ -1218,14 +1101,7 @@ var connectedCallback = (elm) => {
|
|
1218
1101
|
endConnected();
|
1219
1102
|
}
|
1220
1103
|
};
|
1221
|
-
var
|
1222
|
-
const contentRefElm = elm["s-cr"] = doc.createComment(
|
1223
|
-
""
|
1224
|
-
);
|
1225
|
-
contentRefElm["s-cn"] = true;
|
1226
|
-
insertBefore(elm, contentRefElm, elm.firstChild);
|
1227
|
-
};
|
1228
|
-
var disconnectInstance = (instance) => {
|
1104
|
+
var disconnectInstance = (instance, elm) => {
|
1229
1105
|
};
|
1230
1106
|
var disconnectedCallback = async (elm) => {
|
1231
1107
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
@@ -1234,6 +1110,12 @@ var disconnectedCallback = async (elm) => {
|
|
1234
1110
|
hostRef.$onReadyPromise$.then(() => disconnectInstance());
|
1235
1111
|
}
|
1236
1112
|
}
|
1113
|
+
if (rootAppliedStyles.has(elm)) {
|
1114
|
+
rootAppliedStyles.delete(elm);
|
1115
|
+
}
|
1116
|
+
if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
|
1117
|
+
rootAppliedStyles.delete(elm.shadowRoot);
|
1118
|
+
}
|
1237
1119
|
};
|
1238
1120
|
|
1239
1121
|
// src/runtime/bootstrap-lazy.ts
|
@@ -1274,6 +1156,21 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1274
1156
|
this.hasRegisteredEventListeners = false;
|
1275
1157
|
self = this;
|
1276
1158
|
registerHost(self, cmpMeta);
|
1159
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
1160
|
+
{
|
1161
|
+
if (!self.shadowRoot) {
|
1162
|
+
{
|
1163
|
+
self.attachShadow({ mode: "open" });
|
1164
|
+
}
|
1165
|
+
} else {
|
1166
|
+
if (self.shadowRoot.mode !== "open") {
|
1167
|
+
throw new Error(
|
1168
|
+
`Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
|
1169
|
+
);
|
1170
|
+
}
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
}
|
1277
1174
|
}
|
1278
1175
|
connectedCallback() {
|
1279
1176
|
getHostRef(this);
|
@@ -1292,6 +1189,13 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1292
1189
|
}
|
1293
1190
|
disconnectedCallback() {
|
1294
1191
|
plt.jmp(() => disconnectedCallback(this));
|
1192
|
+
plt.raf(() => {
|
1193
|
+
var _a3;
|
1194
|
+
const hostRef = getHostRef(this);
|
1195
|
+
if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
1196
|
+
delete hostRef.$vnode$.$elm$;
|
1197
|
+
}
|
1198
|
+
});
|
1295
1199
|
}
|
1296
1200
|
componentOnReady() {
|
1297
1201
|
return getHostRef(this).$onReadyPromise$;
|
@@ -1338,9 +1242,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1338
1242
|
var setNonce = (nonce) => plt.$nonce$ = nonce;
|
1339
1243
|
|
1340
1244
|
exports.bootstrapLazy = bootstrapLazy;
|
1245
|
+
exports.createEvent = createEvent;
|
1341
1246
|
exports.h = h;
|
1342
1247
|
exports.promiseResolve = promiseResolve;
|
1343
1248
|
exports.registerInstance = registerInstance;
|
1344
1249
|
exports.setNonce = setNonce;
|
1345
1250
|
|
1346
|
-
//# sourceMappingURL=index-
|
1251
|
+
//# sourceMappingURL=index-f786c569.js.map
|