@atmgrupomaggioli/iris-button 0.0.2 → 0.2.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-f882627f.js → index-f786c569.js} +391 -539
- 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 +153 -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-f7558cea.js → p-913b636c.js} +341 -509
- package/dist/components/p-913b636c.js.map +1 -0
- package/dist/esm/{index-000f519f.js → index-45a8db1c.js} +391 -540
- 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 +5 -8
- package/dist/cjs/index-f882627f.js.map +0 -1
- package/dist/components/p-f7558cea.js.map +0 -1
- package/dist/esm/index-000f519f.js.map +0 -1
- package/dist/iris-button/p-a8ef57f6.entry.js +0 -2
- package/dist/iris-button/p-a8ef57f6.entry.js.map +0 -1
- package/dist/iris-button/p-c58bb129.js +0 -3
- package/dist/iris-button/p-c58bb129.js.map +0 -1
@@ -1,15 +1,22 @@
|
|
1
1
|
const NAMESPACE = 'iris-button';
|
2
|
-
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:
|
2
|
+
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", invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: false, 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, 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 };
|
3
3
|
|
4
4
|
/*
|
5
|
-
Stencil Client Platform v4.
|
5
|
+
Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
|
6
6
|
*/
|
7
7
|
var __defProp = Object.defineProperty;
|
8
8
|
var __export = (target, all) => {
|
9
9
|
for (var name in all)
|
10
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
11
11
|
};
|
12
|
+
|
13
|
+
// src/utils/constants.ts
|
14
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
15
|
+
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
16
|
+
|
17
|
+
// src/client/client-host-ref.ts
|
12
18
|
var hostRefs = /* @__PURE__ */ new WeakMap();
|
19
|
+
var deleteHostRef = (ref) => hostRefs.delete(ref);
|
13
20
|
var getHostRef = (ref) => hostRefs.get(ref);
|
14
21
|
var registerHost = (hostElement, cmpMeta) => {
|
15
22
|
const hostRef = {
|
@@ -23,12 +30,15 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
23
30
|
hostElement["s-p"] = [];
|
24
31
|
hostElement["s-rc"] = [];
|
25
32
|
}
|
26
|
-
|
33
|
+
const ref = hostRefs.set(hostElement, hostRef);
|
34
|
+
return ref;
|
27
35
|
};
|
36
|
+
var isMemberInElement = (elm, memberName) => memberName in elm;
|
28
37
|
var consoleError = (e, el) => (0, console.error)(e, el);
|
29
38
|
|
30
39
|
// src/client/client-style.ts
|
31
40
|
var styles = /* @__PURE__ */ new Map();
|
41
|
+
var HYDRATED_STYLE_ID = "sty-id";
|
32
42
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
33
43
|
var win = typeof window !== "undefined" ? window : {};
|
34
44
|
var doc = win.document || { head: {} };
|
@@ -43,7 +53,6 @@ var plt = {
|
|
43
53
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
44
54
|
ce: (eventName, opts) => new CustomEvent(eventName, opts)
|
45
55
|
};
|
46
|
-
var supportsShadow = BUILD.shadowDom;
|
47
56
|
var promiseResolve = (v) => Promise.resolve(v);
|
48
57
|
var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
|
49
58
|
try {
|
@@ -95,12 +104,6 @@ var getAssetPath = (path) => {
|
|
95
104
|
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
96
105
|
};
|
97
106
|
var setAssetPath = (path) => plt.$resourcesUrl$ = path;
|
98
|
-
|
99
|
-
// src/utils/constants.ts
|
100
|
-
var EMPTY_OBJ = {};
|
101
|
-
|
102
|
-
// src/utils/helpers.ts
|
103
|
-
var isDef = (v) => v != null;
|
104
107
|
var isComplexType = (o) => {
|
105
108
|
o = typeof o;
|
106
109
|
return o === "object" || o === "function";
|
@@ -160,10 +163,15 @@ var unwrapErr = (result) => {
|
|
160
163
|
throw result.value;
|
161
164
|
}
|
162
165
|
};
|
166
|
+
var createTime = (fnName, tagName = "") => {
|
167
|
+
{
|
168
|
+
return () => {
|
169
|
+
return;
|
170
|
+
};
|
171
|
+
}
|
172
|
+
};
|
163
173
|
var h = (nodeName, vnodeData, ...children) => {
|
164
174
|
let child = null;
|
165
|
-
let key = null;
|
166
|
-
let slotName = null;
|
167
175
|
let simple = false;
|
168
176
|
let lastSimple = false;
|
169
177
|
const vNodeChildren = [];
|
@@ -187,12 +195,6 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
187
195
|
};
|
188
196
|
walk(children);
|
189
197
|
if (vnodeData) {
|
190
|
-
if (vnodeData.key) {
|
191
|
-
key = vnodeData.key;
|
192
|
-
}
|
193
|
-
if (vnodeData.name) {
|
194
|
-
slotName = vnodeData.name;
|
195
|
-
}
|
196
198
|
{
|
197
199
|
const classData = vnodeData.className || vnodeData.class;
|
198
200
|
if (classData) {
|
@@ -205,12 +207,6 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
205
207
|
if (vNodeChildren.length > 0) {
|
206
208
|
vnode.$children$ = vNodeChildren;
|
207
209
|
}
|
208
|
-
{
|
209
|
-
vnode.$key$ = key;
|
210
|
-
}
|
211
|
-
{
|
212
|
-
vnode.$name$ = slotName;
|
213
|
-
}
|
214
210
|
return vnode;
|
215
211
|
};
|
216
212
|
var newVNode = (tag, text) => {
|
@@ -224,48 +220,241 @@ var newVNode = (tag, text) => {
|
|
224
220
|
{
|
225
221
|
vnode.$attrs$ = null;
|
226
222
|
}
|
227
|
-
{
|
228
|
-
vnode.$key$ = null;
|
229
|
-
}
|
230
|
-
{
|
231
|
-
vnode.$name$ = null;
|
232
|
-
}
|
233
223
|
return vnode;
|
234
224
|
};
|
235
225
|
var Host = {};
|
236
226
|
var isHost = (node) => node && node.$tag$ === Host;
|
237
|
-
var
|
227
|
+
var parsePropertyValue = (propValue, propType) => {
|
228
|
+
if (propValue != null && !isComplexType(propValue)) {
|
229
|
+
if (propType & 4 /* Boolean */) {
|
230
|
+
return propValue === "false" ? false : propValue === "" || !!propValue;
|
231
|
+
}
|
232
|
+
if (propType & 1 /* String */) {
|
233
|
+
return String(propValue);
|
234
|
+
}
|
235
|
+
return propValue;
|
236
|
+
}
|
237
|
+
return propValue;
|
238
|
+
};
|
239
|
+
var getElement = (ref) => ref;
|
240
|
+
|
241
|
+
// src/runtime/event-emitter.ts
|
242
|
+
var createEvent = (ref, name, flags) => {
|
243
|
+
const elm = getElement(ref);
|
244
|
+
return {
|
245
|
+
emit: (detail) => {
|
246
|
+
return emitEvent(elm, name, {
|
247
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
248
|
+
composed: !!(flags & 2 /* Composed */),
|
249
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
250
|
+
detail
|
251
|
+
});
|
252
|
+
}
|
253
|
+
};
|
254
|
+
};
|
255
|
+
var emitEvent = (elm, name, opts) => {
|
256
|
+
const ev = plt.ce(name, opts);
|
257
|
+
elm.dispatchEvent(ev);
|
258
|
+
return ev;
|
259
|
+
};
|
260
|
+
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
261
|
+
var registerStyle = (scopeId2, cssText, allowCS) => {
|
262
|
+
let style = styles.get(scopeId2);
|
263
|
+
if (supportsConstructableStylesheets && allowCS) {
|
264
|
+
style = style || new CSSStyleSheet();
|
265
|
+
if (typeof style === "string") {
|
266
|
+
style = cssText;
|
267
|
+
} else {
|
268
|
+
style.replaceSync(cssText);
|
269
|
+
}
|
270
|
+
} else {
|
271
|
+
style = cssText;
|
272
|
+
}
|
273
|
+
styles.set(scopeId2, style);
|
274
|
+
};
|
275
|
+
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
276
|
+
var _a;
|
277
|
+
const scopeId2 = getScopeId(cmpMeta);
|
278
|
+
const style = styles.get(scopeId2);
|
279
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
280
|
+
if (style) {
|
281
|
+
if (typeof style === "string") {
|
282
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
283
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
284
|
+
let styleElm;
|
285
|
+
if (!appliedStyles) {
|
286
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
287
|
+
}
|
288
|
+
if (!appliedStyles.has(scopeId2)) {
|
289
|
+
{
|
290
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
|
291
|
+
styleElm.innerHTML = style;
|
292
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
293
|
+
if (nonce != null) {
|
294
|
+
styleElm.setAttribute("nonce", nonce);
|
295
|
+
}
|
296
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
297
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
298
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
299
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
300
|
+
styleContainerNode.insertBefore(
|
301
|
+
styleElm,
|
302
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
303
|
+
);
|
304
|
+
} else if ("host" in styleContainerNode) {
|
305
|
+
if (supportsConstructableStylesheets) {
|
306
|
+
const stylesheet = new CSSStyleSheet();
|
307
|
+
stylesheet.replaceSync(style);
|
308
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
309
|
+
} else {
|
310
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
311
|
+
if (existingStyleContainer) {
|
312
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
313
|
+
} else {
|
314
|
+
styleContainerNode.prepend(styleElm);
|
315
|
+
}
|
316
|
+
}
|
317
|
+
} else {
|
318
|
+
styleContainerNode.append(styleElm);
|
319
|
+
}
|
320
|
+
}
|
321
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
|
322
|
+
styleContainerNode.insertBefore(styleElm, null);
|
323
|
+
}
|
324
|
+
}
|
325
|
+
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
326
|
+
styleElm.innerHTML += SLOT_FB_CSS;
|
327
|
+
}
|
328
|
+
if (appliedStyles) {
|
329
|
+
appliedStyles.add(scopeId2);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
} else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
333
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
334
|
+
}
|
335
|
+
}
|
336
|
+
return scopeId2;
|
337
|
+
};
|
338
|
+
var attachStyles = (hostRef) => {
|
339
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
340
|
+
const elm = hostRef.$hostElement$;
|
341
|
+
const flags = cmpMeta.$flags$;
|
342
|
+
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
343
|
+
const scopeId2 = addStyle(
|
344
|
+
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
345
|
+
cmpMeta);
|
346
|
+
if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
347
|
+
elm["s-sc"] = scopeId2;
|
348
|
+
elm.classList.add(scopeId2 + "-h");
|
349
|
+
}
|
350
|
+
endAttachStyles();
|
351
|
+
};
|
352
|
+
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
353
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
238
354
|
if (oldValue !== newValue) {
|
239
|
-
memberName
|
355
|
+
let isProp = isMemberInElement(elm, memberName);
|
356
|
+
let ln = memberName.toLowerCase();
|
240
357
|
if (memberName === "class") {
|
241
358
|
const classList = elm.classList;
|
242
359
|
const oldClasses = parseClassList(oldValue);
|
243
|
-
|
244
|
-
|
245
|
-
newClasses.
|
360
|
+
let newClasses = parseClassList(newValue);
|
361
|
+
{
|
362
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
363
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
364
|
+
}
|
365
|
+
} else if ((!elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
366
|
+
if (memberName[2] === "-") {
|
367
|
+
memberName = memberName.slice(3);
|
368
|
+
} else if (isMemberInElement(win, ln)) {
|
369
|
+
memberName = ln.slice(2);
|
370
|
+
} else {
|
371
|
+
memberName = ln[2] + memberName.slice(3);
|
372
|
+
}
|
373
|
+
if (oldValue || newValue) {
|
374
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
375
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
376
|
+
if (oldValue) {
|
377
|
+
plt.rel(elm, memberName, oldValue, capture);
|
378
|
+
}
|
379
|
+
if (newValue) {
|
380
|
+
plt.ael(elm, memberName, newValue, capture);
|
381
|
+
}
|
382
|
+
}
|
383
|
+
} else {
|
384
|
+
const isComplex = isComplexType(newValue);
|
385
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
386
|
+
try {
|
387
|
+
if (!elm.tagName.includes("-")) {
|
388
|
+
const n = newValue == null ? "" : newValue;
|
389
|
+
if (memberName === "list") {
|
390
|
+
isProp = false;
|
391
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
392
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
393
|
+
elm[memberName] = n;
|
394
|
+
} else {
|
395
|
+
elm.setAttribute(memberName, n);
|
396
|
+
}
|
397
|
+
}
|
398
|
+
} else if (elm[memberName] !== newValue) {
|
399
|
+
elm[memberName] = newValue;
|
400
|
+
}
|
401
|
+
} catch (e) {
|
402
|
+
}
|
403
|
+
}
|
404
|
+
if (newValue == null || newValue === false) {
|
405
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
406
|
+
{
|
407
|
+
elm.removeAttribute(memberName);
|
408
|
+
}
|
409
|
+
}
|
410
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
411
|
+
newValue = newValue === true ? "" : newValue;
|
412
|
+
{
|
413
|
+
elm.setAttribute(memberName, newValue);
|
414
|
+
}
|
246
415
|
}
|
247
|
-
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
248
|
-
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
249
416
|
}
|
250
417
|
}
|
251
418
|
};
|
252
419
|
var parseClassListRegex = /\s/;
|
253
|
-
var parseClassList = (value) =>
|
420
|
+
var parseClassList = (value) => {
|
421
|
+
if (typeof value === "object" && value && "baseVal" in value) {
|
422
|
+
value = value.baseVal;
|
423
|
+
}
|
424
|
+
if (!value || typeof value !== "string") {
|
425
|
+
return [];
|
426
|
+
}
|
427
|
+
return value.split(parseClassListRegex);
|
428
|
+
};
|
429
|
+
var CAPTURE_EVENT_SUFFIX = "Capture";
|
430
|
+
var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
|
254
431
|
|
255
432
|
// src/runtime/vdom/update-element.ts
|
256
|
-
var updateElement = (oldVnode, newVnode, isSvgMode2) => {
|
433
|
+
var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
257
434
|
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
258
|
-
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ ||
|
259
|
-
const newVnodeAttrs = newVnode.$attrs$ ||
|
435
|
+
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
|
436
|
+
const newVnodeAttrs = newVnode.$attrs$ || {};
|
260
437
|
{
|
261
438
|
for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
|
262
439
|
if (!(memberName in newVnodeAttrs)) {
|
263
|
-
setAccessor(
|
440
|
+
setAccessor(
|
441
|
+
elm,
|
442
|
+
memberName,
|
443
|
+
oldVnodeAttrs[memberName],
|
444
|
+
void 0,
|
445
|
+
isSvgMode2,
|
446
|
+
newVnode.$flags$);
|
264
447
|
}
|
265
448
|
}
|
266
449
|
}
|
267
450
|
for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
|
268
|
-
setAccessor(
|
451
|
+
setAccessor(
|
452
|
+
elm,
|
453
|
+
memberName,
|
454
|
+
oldVnodeAttrs[memberName],
|
455
|
+
newVnodeAttrs[memberName],
|
456
|
+
isSvgMode2,
|
457
|
+
newVnode.$flags$);
|
269
458
|
}
|
270
459
|
};
|
271
460
|
function sortedAttrNames(attrNames) {
|
@@ -277,51 +466,29 @@ function sortedAttrNames(attrNames) {
|
|
277
466
|
attrNames
|
278
467
|
);
|
279
468
|
}
|
280
|
-
|
281
|
-
// src/runtime/vdom/vdom-render.ts
|
282
|
-
var scopeId;
|
283
|
-
var contentRef;
|
284
469
|
var hostTagName;
|
285
470
|
var useNativeShadowDom = false;
|
286
|
-
var
|
287
|
-
var
|
288
|
-
var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
289
|
-
var _a;
|
471
|
+
var isSvgMode = false;
|
472
|
+
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
290
473
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
291
474
|
let i2 = 0;
|
292
475
|
let elm;
|
293
476
|
let childNode;
|
294
|
-
let oldVNode;
|
295
|
-
if (!useNativeShadowDom) {
|
296
|
-
checkSlotRelocate = true;
|
297
|
-
if (newVNode2.$tag$ === "slot") {
|
298
|
-
newVNode2.$flags$ |= newVNode2.$children$ ? (
|
299
|
-
// slot element has fallback content
|
300
|
-
// still create an element that "mocks" the slot element
|
301
|
-
2 /* isSlotFallback */
|
302
|
-
) : (
|
303
|
-
// slot element does not have fallback content
|
304
|
-
// create an html comment we'll use to always reference
|
305
|
-
// where actual slot content should sit next to
|
306
|
-
1 /* isSlotReference */
|
307
|
-
);
|
308
|
-
}
|
309
|
-
}
|
310
477
|
if (newVNode2.$text$ !== null) {
|
311
478
|
elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
|
312
|
-
} else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
|
313
|
-
elm = newVNode2.$elm$ = doc.createTextNode("");
|
314
479
|
} else {
|
315
|
-
|
480
|
+
if (!isSvgMode) {
|
481
|
+
isSvgMode = newVNode2.$tag$ === "svg";
|
482
|
+
}
|
483
|
+
elm = newVNode2.$elm$ = doc.createElementNS(
|
484
|
+
isSvgMode ? SVG_NS : HTML_NS,
|
316
485
|
!useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
317
|
-
);
|
318
|
-
{
|
319
|
-
|
486
|
+
) ;
|
487
|
+
if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
488
|
+
isSvgMode = false;
|
320
489
|
}
|
321
|
-
|
322
|
-
|
323
|
-
if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
324
|
-
elm.classList.add(elm["s-si"] = scopeId);
|
490
|
+
{
|
491
|
+
updateElement(null, newVNode2, isSvgMode);
|
325
492
|
}
|
326
493
|
if (newVNode2.$children$) {
|
327
494
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
@@ -331,59 +498,29 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
331
498
|
}
|
332
499
|
}
|
333
500
|
}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
elm["s-cr"] = contentRef;
|
340
|
-
elm["s-sn"] = newVNode2.$name$ || "";
|
341
|
-
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
342
|
-
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
343
|
-
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
344
|
-
{
|
345
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
346
|
-
}
|
501
|
+
{
|
502
|
+
if (newVNode2.$tag$ === "svg") {
|
503
|
+
isSvgMode = false;
|
504
|
+
} else if (elm.tagName === "foreignObject") {
|
505
|
+
isSvgMode = true;
|
347
506
|
}
|
348
507
|
}
|
349
508
|
}
|
509
|
+
elm["s-hn"] = hostTagName;
|
350
510
|
return elm;
|
351
511
|
};
|
352
|
-
var putBackInOriginalLocation = (parentElm, recursive) => {
|
353
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
354
|
-
const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
|
355
|
-
if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
|
356
|
-
let node = parentElm;
|
357
|
-
while (node = node.nextSibling) {
|
358
|
-
if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
|
359
|
-
oldSlotChildNodes.push(node);
|
360
|
-
}
|
361
|
-
}
|
362
|
-
}
|
363
|
-
for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
|
364
|
-
const childNode = oldSlotChildNodes[i2];
|
365
|
-
if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
|
366
|
-
insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
|
367
|
-
childNode["s-ol"].remove();
|
368
|
-
childNode["s-ol"] = void 0;
|
369
|
-
childNode["s-sh"] = void 0;
|
370
|
-
checkSlotRelocate = true;
|
371
|
-
}
|
372
|
-
if (recursive) {
|
373
|
-
putBackInOriginalLocation(childNode, recursive);
|
374
|
-
}
|
375
|
-
}
|
376
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
377
|
-
};
|
378
512
|
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
379
|
-
let containerElm = parentElm
|
513
|
+
let containerElm = parentElm;
|
380
514
|
let childNode;
|
515
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
516
|
+
containerElm = containerElm.shadowRoot;
|
517
|
+
}
|
381
518
|
for (; startIdx <= endIdx; ++startIdx) {
|
382
519
|
if (vnodes[startIdx]) {
|
383
520
|
childNode = createElm(null, parentVNode, startIdx);
|
384
521
|
if (childNode) {
|
385
522
|
vnodes[startIdx].$elm$ = childNode;
|
386
|
-
insertBefore(containerElm, childNode,
|
523
|
+
insertBefore(containerElm, childNode, before);
|
387
524
|
}
|
388
525
|
}
|
389
526
|
}
|
@@ -394,14 +531,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
394
531
|
if (vnode) {
|
395
532
|
const elm = vnode.$elm$;
|
396
533
|
if (elm) {
|
397
|
-
{
|
398
|
-
checkSlotFallbackVisibility = true;
|
399
|
-
if (elm["s-ol"]) {
|
400
|
-
elm["s-ol"].remove();
|
401
|
-
} else {
|
402
|
-
putBackInOriginalLocation(elm, true);
|
403
|
-
}
|
404
|
-
}
|
405
534
|
elm.remove();
|
406
535
|
}
|
407
536
|
}
|
@@ -410,8 +539,6 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
410
539
|
var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
|
411
540
|
let oldStartIdx = 0;
|
412
541
|
let newStartIdx = 0;
|
413
|
-
let idxInOld = 0;
|
414
|
-
let i2 = 0;
|
415
542
|
let oldEndIdx = oldCh.length - 1;
|
416
543
|
let oldStartVnode = oldCh[0];
|
417
544
|
let oldEndVnode = oldCh[oldEndIdx];
|
@@ -419,7 +546,6 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
419
546
|
let newStartVnode = newCh[0];
|
420
547
|
let newEndVnode = newCh[newEndIdx];
|
421
548
|
let node;
|
422
|
-
let elmToMove;
|
423
549
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
424
550
|
if (oldStartVnode == null) {
|
425
551
|
oldStartVnode = oldCh[++oldStartIdx];
|
@@ -438,48 +564,23 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
438
564
|
oldEndVnode = oldCh[--oldEndIdx];
|
439
565
|
newEndVnode = newCh[--newEndIdx];
|
440
566
|
} else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
441
|
-
if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
442
|
-
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
443
|
-
}
|
444
567
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
445
568
|
insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
446
569
|
oldStartVnode = oldCh[++oldStartIdx];
|
447
570
|
newEndVnode = newCh[--newEndIdx];
|
448
571
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
449
|
-
if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
450
|
-
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
451
|
-
}
|
452
572
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
453
573
|
insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
|
454
574
|
oldEndVnode = oldCh[--oldEndIdx];
|
455
575
|
newStartVnode = newCh[++newStartIdx];
|
456
576
|
} else {
|
457
|
-
idxInOld = -1;
|
458
577
|
{
|
459
|
-
for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
|
460
|
-
if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
|
461
|
-
idxInOld = i2;
|
462
|
-
break;
|
463
|
-
}
|
464
|
-
}
|
465
|
-
}
|
466
|
-
if (idxInOld >= 0) {
|
467
|
-
elmToMove = oldCh[idxInOld];
|
468
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
469
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
|
470
|
-
} else {
|
471
|
-
patch(elmToMove, newStartVnode, isInitialRender);
|
472
|
-
oldCh[idxInOld] = void 0;
|
473
|
-
node = elmToMove.$elm$;
|
474
|
-
}
|
475
|
-
newStartVnode = newCh[++newStartIdx];
|
476
|
-
} else {
|
477
578
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
|
478
579
|
newStartVnode = newCh[++newStartIdx];
|
479
580
|
}
|
480
581
|
if (node) {
|
481
582
|
{
|
482
|
-
insertBefore(
|
583
|
+
insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
|
483
584
|
}
|
484
585
|
}
|
485
586
|
}
|
@@ -499,40 +600,26 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
499
600
|
};
|
500
601
|
var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
501
602
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
502
|
-
if (leftVNode.$
|
503
|
-
|
504
|
-
// The component gets hydrated and no VDOM has been initialized.
|
505
|
-
// Here the comparison can't happen as $name$ property is not set for `leftNode`.
|
506
|
-
"$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
|
507
|
-
// hydration comments to be removed
|
508
|
-
leftVNode.$elm$.nodeType !== 8
|
509
|
-
) {
|
510
|
-
return false;
|
511
|
-
}
|
512
|
-
return leftVNode.$name$ === rightVNode.$name$;
|
513
|
-
}
|
514
|
-
if (!isInitialRender) {
|
515
|
-
return leftVNode.$key$ === rightVNode.$key$;
|
603
|
+
if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
|
604
|
+
leftVNode.$key$ = rightVNode.$key$;
|
516
605
|
}
|
517
606
|
return true;
|
518
607
|
}
|
519
608
|
return false;
|
520
609
|
};
|
521
|
-
var referenceNode = (node) => {
|
522
|
-
return node && node["s-ol"] || node;
|
523
|
-
};
|
524
|
-
var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
|
525
610
|
var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
526
611
|
const elm = newVNode2.$elm$ = oldVNode.$elm$;
|
527
612
|
const oldChildren = oldVNode.$children$;
|
528
613
|
const newChildren = newVNode2.$children$;
|
529
614
|
const tag = newVNode2.$tag$;
|
530
615
|
const text = newVNode2.$text$;
|
531
|
-
let defaultHolder;
|
532
616
|
if (text === null) {
|
533
617
|
{
|
534
|
-
|
535
|
-
|
618
|
+
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
619
|
+
}
|
620
|
+
{
|
621
|
+
{
|
622
|
+
updateElement(oldVNode, newVNode2, isSvgMode);
|
536
623
|
}
|
537
624
|
}
|
538
625
|
if (oldChildren !== null && newChildren !== null) {
|
@@ -548,111 +635,21 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
548
635
|
) {
|
549
636
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
550
637
|
}
|
551
|
-
|
552
|
-
|
638
|
+
if (isSvgMode && tag === "svg") {
|
639
|
+
isSvgMode = false;
|
640
|
+
}
|
553
641
|
} else if (oldVNode.$text$ !== text) {
|
554
642
|
elm.data = text;
|
555
643
|
}
|
556
644
|
};
|
557
|
-
var updateFallbackSlotVisibility = (elm) => {
|
558
|
-
const childNodes = elm.__childNodes || elm.childNodes;
|
559
|
-
for (const childNode of childNodes) {
|
560
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
561
|
-
if (childNode["s-sr"]) {
|
562
|
-
const slotName = childNode["s-sn"];
|
563
|
-
childNode.hidden = false;
|
564
|
-
for (const siblingNode of childNodes) {
|
565
|
-
if (siblingNode !== childNode) {
|
566
|
-
if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
|
567
|
-
if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
|
568
|
-
childNode.hidden = true;
|
569
|
-
break;
|
570
|
-
}
|
571
|
-
} else if (slotName === siblingNode["s-sn"]) {
|
572
|
-
if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
|
573
|
-
childNode.hidden = true;
|
574
|
-
break;
|
575
|
-
}
|
576
|
-
}
|
577
|
-
}
|
578
|
-
}
|
579
|
-
}
|
580
|
-
updateFallbackSlotVisibility(childNode);
|
581
|
-
}
|
582
|
-
}
|
583
|
-
};
|
584
|
-
var relocateNodes = [];
|
585
|
-
var markSlotContentForRelocation = (elm) => {
|
586
|
-
let node;
|
587
|
-
let hostContentNodes;
|
588
|
-
let j;
|
589
|
-
const children = elm.__childNodes || elm.childNodes;
|
590
|
-
for (const childNode of children) {
|
591
|
-
if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
|
592
|
-
hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
|
593
|
-
const slotName = childNode["s-sn"];
|
594
|
-
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
595
|
-
node = hostContentNodes[j];
|
596
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes )) {
|
597
|
-
if (isNodeLocatedInSlot(node, slotName)) {
|
598
|
-
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
599
|
-
checkSlotFallbackVisibility = true;
|
600
|
-
node["s-sn"] = node["s-sn"] || slotName;
|
601
|
-
if (relocateNodeData) {
|
602
|
-
relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
|
603
|
-
relocateNodeData.$slotRefNode$ = childNode;
|
604
|
-
} else {
|
605
|
-
node["s-sh"] = childNode["s-hn"];
|
606
|
-
relocateNodes.push({
|
607
|
-
$slotRefNode$: childNode,
|
608
|
-
$nodeToRelocate$: node
|
609
|
-
});
|
610
|
-
}
|
611
|
-
if (node["s-sr"]) {
|
612
|
-
relocateNodes.map((relocateNode) => {
|
613
|
-
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
|
614
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
615
|
-
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
616
|
-
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
617
|
-
}
|
618
|
-
}
|
619
|
-
});
|
620
|
-
}
|
621
|
-
} else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
622
|
-
relocateNodes.push({
|
623
|
-
$nodeToRelocate$: node
|
624
|
-
});
|
625
|
-
}
|
626
|
-
}
|
627
|
-
}
|
628
|
-
}
|
629
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
630
|
-
markSlotContentForRelocation(childNode);
|
631
|
-
}
|
632
|
-
}
|
633
|
-
};
|
634
|
-
var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
635
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
636
|
-
if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
|
637
|
-
return true;
|
638
|
-
}
|
639
|
-
if (nodeToRelocate.getAttribute("slot") === slotName) {
|
640
|
-
return true;
|
641
|
-
}
|
642
|
-
return false;
|
643
|
-
}
|
644
|
-
if (nodeToRelocate["s-sn"] === slotName) {
|
645
|
-
return true;
|
646
|
-
}
|
647
|
-
return slotName === "";
|
648
|
-
};
|
649
645
|
var insertBefore = (parent, newNode, reference) => {
|
650
|
-
|
651
|
-
|
646
|
+
{
|
647
|
+
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
648
|
+
}
|
652
649
|
};
|
653
650
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
654
|
-
var _a, _b, _c, _d;
|
655
651
|
const hostElm = hostRef.$hostElement$;
|
652
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
656
653
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
657
654
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
658
655
|
hostTagName = hostElm.tagName;
|
@@ -666,192 +663,22 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
666
663
|
rootVnode.$tag$ = null;
|
667
664
|
rootVnode.$flags$ |= 4 /* isHost */;
|
668
665
|
hostRef.$vnode$ = rootVnode;
|
669
|
-
rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
|
670
|
-
useNativeShadowDom =
|
671
|
-
{
|
672
|
-
contentRef = hostElm["s-cr"];
|
673
|
-
checkSlotFallbackVisibility = false;
|
674
|
-
}
|
666
|
+
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
667
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
675
668
|
patch(oldVNode, rootVnode, isInitialLoad);
|
676
|
-
{
|
677
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
678
|
-
if (checkSlotRelocate) {
|
679
|
-
markSlotContentForRelocation(rootVnode.$elm$);
|
680
|
-
for (const relocateData of relocateNodes) {
|
681
|
-
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
682
|
-
if (!nodeToRelocate["s-ol"]) {
|
683
|
-
const orgLocationNode = doc.createTextNode("");
|
684
|
-
orgLocationNode["s-nr"] = nodeToRelocate;
|
685
|
-
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
686
|
-
}
|
687
|
-
}
|
688
|
-
for (const relocateData of relocateNodes) {
|
689
|
-
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
690
|
-
const slotRefNode = relocateData.$slotRefNode$;
|
691
|
-
if (slotRefNode) {
|
692
|
-
const parentNodeRef = slotRefNode.parentNode;
|
693
|
-
let insertBeforeNode = slotRefNode.nextSibling;
|
694
|
-
{
|
695
|
-
let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
|
696
|
-
while (orgLocationNode) {
|
697
|
-
let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
|
698
|
-
if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
|
699
|
-
refNode = refNode.nextSibling;
|
700
|
-
while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
|
701
|
-
refNode = refNode == null ? void 0 : refNode.nextSibling;
|
702
|
-
}
|
703
|
-
if (!refNode || !refNode["s-nr"]) {
|
704
|
-
insertBeforeNode = refNode;
|
705
|
-
break;
|
706
|
-
}
|
707
|
-
}
|
708
|
-
orgLocationNode = orgLocationNode.previousSibling;
|
709
|
-
}
|
710
|
-
}
|
711
|
-
if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
|
712
|
-
if (nodeToRelocate !== insertBeforeNode) {
|
713
|
-
if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
|
714
|
-
nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
|
715
|
-
}
|
716
|
-
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
717
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
718
|
-
nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
|
719
|
-
}
|
720
|
-
}
|
721
|
-
}
|
722
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
|
723
|
-
} else {
|
724
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
725
|
-
if (isInitialLoad) {
|
726
|
-
nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
|
727
|
-
}
|
728
|
-
nodeToRelocate.hidden = true;
|
729
|
-
}
|
730
|
-
}
|
731
|
-
}
|
732
|
-
}
|
733
|
-
if (checkSlotFallbackVisibility) {
|
734
|
-
updateFallbackSlotVisibility(rootVnode.$elm$);
|
735
|
-
}
|
736
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
737
|
-
relocateNodes.length = 0;
|
738
|
-
}
|
739
|
-
contentRef = void 0;
|
740
|
-
};
|
741
|
-
var createTime = (fnName, tagName = "") => {
|
742
|
-
{
|
743
|
-
return () => {
|
744
|
-
return;
|
745
|
-
};
|
746
|
-
}
|
747
|
-
};
|
748
|
-
var parsePropertyValue = (propValue, propType) => {
|
749
|
-
if (propValue != null && !isComplexType(propValue)) {
|
750
|
-
if (propType & 4 /* Boolean */) {
|
751
|
-
return propValue === "false" ? false : propValue === "" || !!propValue;
|
752
|
-
}
|
753
|
-
if (propType & 1 /* String */) {
|
754
|
-
return String(propValue);
|
755
|
-
}
|
756
|
-
return propValue;
|
757
|
-
}
|
758
|
-
return propValue;
|
759
|
-
};
|
760
|
-
var emitEvent = (elm, name, opts) => {
|
761
|
-
const ev = plt.ce(name, opts);
|
762
|
-
elm.dispatchEvent(ev);
|
763
|
-
return ev;
|
764
|
-
};
|
765
|
-
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
766
|
-
var registerStyle = (scopeId2, cssText, allowCS) => {
|
767
|
-
let style = styles.get(scopeId2);
|
768
|
-
if (supportsConstructableStylesheets && allowCS) {
|
769
|
-
style = style || new CSSStyleSheet();
|
770
|
-
if (typeof style === "string") {
|
771
|
-
style = cssText;
|
772
|
-
} else {
|
773
|
-
style.replaceSync(cssText);
|
774
|
-
}
|
775
|
-
} else {
|
776
|
-
style = cssText;
|
777
|
-
}
|
778
|
-
styles.set(scopeId2, style);
|
779
669
|
};
|
780
|
-
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
781
|
-
var _a;
|
782
|
-
const scopeId2 = getScopeId(cmpMeta);
|
783
|
-
const style = styles.get(scopeId2);
|
784
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
785
|
-
if (style) {
|
786
|
-
if (typeof style === "string") {
|
787
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
788
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
789
|
-
let styleElm;
|
790
|
-
if (!appliedStyles) {
|
791
|
-
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
792
|
-
}
|
793
|
-
if (!appliedStyles.has(scopeId2)) {
|
794
|
-
{
|
795
|
-
styleElm = doc.createElement("style");
|
796
|
-
styleElm.innerHTML = style;
|
797
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
798
|
-
if (nonce != null) {
|
799
|
-
styleElm.setAttribute("nonce", nonce);
|
800
|
-
}
|
801
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
802
|
-
if (styleContainerNode.nodeName === "HEAD") {
|
803
|
-
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
804
|
-
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
805
|
-
styleContainerNode.insertBefore(styleElm, referenceNode2);
|
806
|
-
} else if ("host" in styleContainerNode) {
|
807
|
-
if (supportsConstructableStylesheets) {
|
808
|
-
const stylesheet = new CSSStyleSheet();
|
809
|
-
stylesheet.replaceSync(style);
|
810
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
811
|
-
} else {
|
812
|
-
const existingStyleContainer = styleContainerNode.querySelector("style");
|
813
|
-
if (existingStyleContainer) {
|
814
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
815
|
-
} else {
|
816
|
-
styleContainerNode.prepend(styleElm);
|
817
|
-
}
|
818
|
-
}
|
819
|
-
} else {
|
820
|
-
styleContainerNode.append(styleElm);
|
821
|
-
}
|
822
|
-
}
|
823
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
|
824
|
-
styleContainerNode.insertBefore(styleElm, null);
|
825
|
-
}
|
826
|
-
}
|
827
|
-
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
828
|
-
styleElm.innerHTML += SLOT_FB_CSS;
|
829
|
-
}
|
830
|
-
if (appliedStyles) {
|
831
|
-
appliedStyles.add(scopeId2);
|
832
|
-
}
|
833
|
-
}
|
834
|
-
} else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
835
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
836
|
-
}
|
837
|
-
}
|
838
|
-
return scopeId2;
|
839
|
-
};
|
840
|
-
var attachStyles = (hostRef) => {
|
841
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
842
|
-
const elm = hostRef.$hostElement$;
|
843
|
-
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
844
|
-
addStyle(
|
845
|
-
elm.getRootNode(),
|
846
|
-
cmpMeta);
|
847
|
-
endAttachStyles();
|
848
|
-
};
|
849
|
-
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
850
670
|
|
851
671
|
// src/runtime/update-component.ts
|
852
672
|
var attachToAncestor = (hostRef, ancestorComponent) => {
|
853
673
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
854
|
-
ancestorComponent["s-p"].push(
|
674
|
+
const index = ancestorComponent["s-p"].push(
|
675
|
+
new Promise(
|
676
|
+
(r) => hostRef.$onRenderResolve$ = () => {
|
677
|
+
ancestorComponent["s-p"].splice(index - 1, 1);
|
678
|
+
r();
|
679
|
+
}
|
680
|
+
)
|
681
|
+
);
|
855
682
|
}
|
856
683
|
};
|
857
684
|
var scheduleUpdate = (hostRef, isInitialLoad) => {
|
@@ -1004,50 +831,41 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1004
831
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
1005
832
|
members.map(([memberName, [memberFlags]]) => {
|
1006
833
|
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
1007
|
-
|
834
|
+
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
|
835
|
+
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
836
|
+
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
837
|
+
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
1008
838
|
Object.defineProperty(prototype, memberName, {
|
1009
839
|
get() {
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
setValue(this, memberName, newValue, cmpMeta);
|
840
|
+
{
|
841
|
+
return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
842
|
+
}
|
1014
843
|
},
|
1015
844
|
configurable: true,
|
1016
845
|
enumerable: true
|
1017
846
|
});
|
1018
|
-
}
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
}
|
1029
|
-
origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
|
1030
|
-
setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
|
1031
|
-
return;
|
1032
|
-
}
|
1033
|
-
if (!ref) return;
|
1034
|
-
const setterSetVal = () => {
|
1035
|
-
const currentValue = ref.$lazyInstance$[memberName];
|
1036
|
-
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
1037
|
-
ref.$instanceValues$.set(memberName, currentValue);
|
1038
|
-
}
|
1039
|
-
ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
|
1040
|
-
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
1041
|
-
};
|
1042
|
-
if (ref.$lazyInstance$) {
|
1043
|
-
setterSetVal();
|
1044
|
-
} else {
|
1045
|
-
ref.$onReadyPromise$.then(() => setterSetVal());
|
1046
|
-
}
|
847
|
+
}
|
848
|
+
Object.defineProperty(prototype, memberName, {
|
849
|
+
set(newValue) {
|
850
|
+
const ref = getHostRef(this);
|
851
|
+
if (origSetter) {
|
852
|
+
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
853
|
+
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
854
|
+
newValue = ref.$instanceValues$.get(memberName);
|
855
|
+
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
856
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
1047
857
|
}
|
1048
|
-
|
858
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
859
|
+
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
860
|
+
setValue(this, memberName, newValue, cmpMeta);
|
861
|
+
return;
|
862
|
+
}
|
863
|
+
{
|
864
|
+
setValue(this, memberName, newValue, cmpMeta);
|
865
|
+
return;
|
866
|
+
}
|
1049
867
|
}
|
1050
|
-
}
|
868
|
+
});
|
1051
869
|
}
|
1052
870
|
});
|
1053
871
|
{
|
@@ -1056,7 +874,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1056
874
|
plt.jmp(() => {
|
1057
875
|
var _a2;
|
1058
876
|
const propName = attrNameToPropName.get(attrName);
|
1059
|
-
if (this.hasOwnProperty(propName)) {
|
877
|
+
if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
|
1060
878
|
newValue = this[propName];
|
1061
879
|
delete this[propName];
|
1062
880
|
} else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
@@ -1078,8 +896,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1078
896
|
return;
|
1079
897
|
}
|
1080
898
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
1081
|
-
|
1082
|
-
|
899
|
+
newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
|
900
|
+
if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
|
901
|
+
this[propName] = newValue;
|
1083
902
|
}
|
1084
903
|
});
|
1085
904
|
};
|
@@ -1129,7 +948,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1129
948
|
schedule();
|
1130
949
|
}
|
1131
950
|
};
|
1132
|
-
var fireConnectedCallback = (instance) => {
|
951
|
+
var fireConnectedCallback = (instance, elm) => {
|
1133
952
|
};
|
1134
953
|
|
1135
954
|
// src/runtime/connected-callback.ts
|
@@ -1140,12 +959,6 @@ var connectedCallback = (elm) => {
|
|
1140
959
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
1141
960
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
1142
961
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
1143
|
-
{
|
1144
|
-
if (// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
1145
|
-
cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
|
1146
|
-
setContentReference(elm);
|
1147
|
-
}
|
1148
|
-
}
|
1149
962
|
{
|
1150
963
|
let ancestorComponent = elm;
|
1151
964
|
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
@@ -1175,17 +988,16 @@ var connectedCallback = (elm) => {
|
|
1175
988
|
endConnected();
|
1176
989
|
}
|
1177
990
|
};
|
1178
|
-
var setContentReference = (elm) => {
|
1179
|
-
const contentRefElm = elm["s-cr"] = doc.createComment(
|
1180
|
-
""
|
1181
|
-
);
|
1182
|
-
contentRefElm["s-cn"] = true;
|
1183
|
-
insertBefore(elm, contentRefElm, elm.firstChild);
|
1184
|
-
};
|
1185
991
|
var disconnectedCallback = async (elm) => {
|
1186
992
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
1187
993
|
getHostRef(elm);
|
1188
994
|
}
|
995
|
+
if (rootAppliedStyles.has(elm)) {
|
996
|
+
rootAppliedStyles.delete(elm);
|
997
|
+
}
|
998
|
+
if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
|
999
|
+
rootAppliedStyles.delete(elm.shadowRoot);
|
1000
|
+
}
|
1189
1001
|
};
|
1190
1002
|
var proxyCustomElement = (Cstr, compactMeta) => {
|
1191
1003
|
const cmpMeta = {
|
@@ -1209,10 +1021,30 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
1209
1021
|
},
|
1210
1022
|
disconnectedCallback() {
|
1211
1023
|
disconnectedCallback(this);
|
1024
|
+
plt.raf(() => {
|
1025
|
+
var _a;
|
1026
|
+
const hostRef = getHostRef(this);
|
1027
|
+
if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
1028
|
+
delete hostRef.$vnode$;
|
1029
|
+
}
|
1030
|
+
if (this instanceof Node && !this.isConnected) {
|
1031
|
+
deleteHostRef(this);
|
1032
|
+
}
|
1033
|
+
});
|
1212
1034
|
},
|
1213
1035
|
__attachShadow() {
|
1214
1036
|
{
|
1215
|
-
this.shadowRoot
|
1037
|
+
if (!this.shadowRoot) {
|
1038
|
+
{
|
1039
|
+
this.attachShadow({ mode: "open" });
|
1040
|
+
}
|
1041
|
+
} else {
|
1042
|
+
if (this.shadowRoot.mode !== "open") {
|
1043
|
+
throw new Error(
|
1044
|
+
`Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
|
1045
|
+
);
|
1046
|
+
}
|
1047
|
+
}
|
1216
1048
|
}
|
1217
1049
|
}
|
1218
1050
|
});
|
@@ -1226,6 +1058,6 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
1226
1058
|
// src/runtime/platform-options.ts
|
1227
1059
|
var setPlatformOptions = (opts) => Object.assign(plt, opts);
|
1228
1060
|
|
1229
|
-
export { H, setNonce as a, setPlatformOptions as b, getAssetPath as g, h, proxyCustomElement as p, setAssetPath as s };
|
1061
|
+
export { H, setNonce as a, setPlatformOptions as b, createEvent as c, getAssetPath as g, h, proxyCustomElement as p, setAssetPath as s };
|
1230
1062
|
|
1231
|
-
//# sourceMappingURL=p-
|
1063
|
+
//# sourceMappingURL=p-913b636c.js.map
|