skeleton-webcomponent-loader 2.0.0 → 2.1.4
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/CHANGELOG.md +2 -0
- package/dist/cjs/{css-shim-285ec151.js → css-shim-b3e497ca.js} +1 -1
- package/dist/cjs/{index-1386590f.js → index-b5d2dca0.js} +172 -116
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/nb-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/skeleton-webcomponent.cjs.js +4 -4
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/skeleton/skeleton.js +28 -28
- package/dist/custom-elements/index.js +3 -3
- package/dist/esm/{css-shim-934c915f.js → css-shim-2f04a37a.js} +1 -1
- package/dist/esm/{index-6dfb91e6.js → index-63fd3905.js} +172 -116
- package/dist/esm/loader.js +4 -4
- package/dist/esm/nb-skeleton.entry.js +2 -2
- package/dist/esm/skeleton-webcomponent.js +4 -4
- package/dist/esm-es5/{css-shim-934c915f.js → css-shim-2f04a37a.js} +0 -0
- package/dist/esm-es5/index-63fd3905.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/nb-skeleton.entry.js +1 -1
- package/dist/esm-es5/skeleton-webcomponent.js +1 -1
- package/dist/skeleton-webcomponent/{p-07aa1738.js → p-12077897.js} +0 -0
- package/dist/skeleton-webcomponent/{p-6f883149.system.js → p-16aec442.system.js} +0 -0
- package/dist/skeleton-webcomponent/p-63ed3b45.entry.js +1 -0
- package/dist/skeleton-webcomponent/p-7e96e5d4.js +1 -0
- package/dist/skeleton-webcomponent/{p-94c5d705.system.js → p-8bef7229.system.js} +1 -1
- package/dist/skeleton-webcomponent/{p-0af0d538.system.entry.js → p-dc1bf577.system.entry.js} +1 -1
- package/dist/skeleton-webcomponent/p-f59432d4.system.js +1 -0
- package/dist/skeleton-webcomponent/skeleton-webcomponent.esm.js +1 -1
- package/dist/skeleton-webcomponent/skeleton-webcomponent.js +1 -1
- package/dist/types/stencil-public-runtime.d.ts +196 -186
- package/loader/index.d.ts +0 -1
- package/package.json +3 -4
- package/readme.md +3 -1
- package/dist/esm-es5/index-6dfb91e6.js +0 -1
- package/dist/skeleton-webcomponent/p-13a85a5d.js +0 -1
- package/dist/skeleton-webcomponent/p-437abd94.system.js +0 -1
- package/dist/skeleton-webcomponent/p-b1ce4c03.entry.js +0 -1
|
@@ -27,22 +27,22 @@ let hostTagName;
|
|
|
27
27
|
let isSvgMode = false;
|
|
28
28
|
let queuePending = false;
|
|
29
29
|
const win = typeof window !== 'undefined' ? window : {};
|
|
30
|
-
const CSS =
|
|
30
|
+
const CSS = win.CSS ;
|
|
31
31
|
const doc = win.document || { head: {} };
|
|
32
32
|
const plt = {
|
|
33
33
|
$flags$: 0,
|
|
34
34
|
$resourcesUrl$: '',
|
|
35
|
-
jmp: h => h(),
|
|
36
|
-
raf: h => requestAnimationFrame(h),
|
|
35
|
+
jmp: (h) => h(),
|
|
36
|
+
raf: (h) => requestAnimationFrame(h),
|
|
37
37
|
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
38
38
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
39
39
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
40
40
|
};
|
|
41
41
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
42
|
-
const supportsConstructibleStylesheets =
|
|
42
|
+
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
43
43
|
try {
|
|
44
44
|
new CSSStyleSheet();
|
|
45
|
-
return typeof
|
|
45
|
+
return typeof new CSSStyleSheet().replace === 'function';
|
|
46
46
|
}
|
|
47
47
|
catch (e) { }
|
|
48
48
|
return false;
|
|
@@ -91,7 +91,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
91
91
|
}
|
|
92
92
|
if (!appliedStyles.has(scopeId)) {
|
|
93
93
|
{
|
|
94
|
-
if (
|
|
94
|
+
if (plt.$cssShim$) {
|
|
95
95
|
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
|
|
96
96
|
const newScopeId = styleElm['s-sc'];
|
|
97
97
|
if (newScopeId) {
|
|
@@ -113,7 +113,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
else if (
|
|
116
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
117
117
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -124,8 +124,8 @@ const attachStyles = (hostRef) => {
|
|
|
124
124
|
const elm = hostRef.$hostElement$;
|
|
125
125
|
const flags = cmpMeta.$flags$;
|
|
126
126
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
127
|
-
const scopeId = addStyle(
|
|
128
|
-
if (
|
|
127
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
|
|
128
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
129
129
|
// only required when we're NOT using native shadow dom (slot)
|
|
130
130
|
// or this browser doesn't support native shadow dom
|
|
131
131
|
// and this host element was NOT created with SSR
|
|
@@ -138,7 +138,7 @@ const attachStyles = (hostRef) => {
|
|
|
138
138
|
}
|
|
139
139
|
endAttachStyles();
|
|
140
140
|
};
|
|
141
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
141
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
142
142
|
/**
|
|
143
143
|
* Default style mode id
|
|
144
144
|
*/
|
|
@@ -195,7 +195,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
195
195
|
walk(children);
|
|
196
196
|
if (vnodeData) {
|
|
197
197
|
// normalize class / classname attributes
|
|
198
|
-
if (
|
|
198
|
+
if (vnodeData.key) {
|
|
199
199
|
key = vnodeData.key;
|
|
200
200
|
}
|
|
201
201
|
{
|
|
@@ -205,7 +205,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
205
205
|
typeof classData !== 'object'
|
|
206
206
|
? classData
|
|
207
207
|
: Object.keys(classData)
|
|
208
|
-
.filter(k => classData[k])
|
|
208
|
+
.filter((k) => classData[k])
|
|
209
209
|
.join(' ');
|
|
210
210
|
}
|
|
211
211
|
}
|
|
@@ -249,20 +249,20 @@ const isHost = (node) => node && node.$tag$ === Host;
|
|
|
249
249
|
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
250
250
|
if (oldValue !== newValue) {
|
|
251
251
|
let isProp = isMemberInElement(elm, memberName);
|
|
252
|
-
|
|
253
|
-
if (
|
|
252
|
+
memberName.toLowerCase();
|
|
253
|
+
if (memberName === 'class') {
|
|
254
254
|
const classList = elm.classList;
|
|
255
255
|
const oldClasses = parseClassList(oldValue);
|
|
256
256
|
const newClasses = parseClassList(newValue);
|
|
257
|
-
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
|
258
|
-
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
|
257
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
258
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
259
259
|
}
|
|
260
|
-
else if (
|
|
260
|
+
else if (memberName === 'style') {
|
|
261
261
|
// update style attribute, css properties and values
|
|
262
262
|
{
|
|
263
263
|
for (const prop in oldValue) {
|
|
264
264
|
if (!newValue || newValue[prop] == null) {
|
|
265
|
-
if (
|
|
265
|
+
if (prop.includes('-')) {
|
|
266
266
|
elm.style.removeProperty(prop);
|
|
267
267
|
}
|
|
268
268
|
else {
|
|
@@ -273,7 +273,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
273
273
|
}
|
|
274
274
|
for (const prop in newValue) {
|
|
275
275
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
276
|
-
if (
|
|
276
|
+
if (prop.includes('-')) {
|
|
277
277
|
elm.style.setProperty(prop, newValue[prop]);
|
|
278
278
|
}
|
|
279
279
|
else {
|
|
@@ -282,7 +282,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
else if (
|
|
285
|
+
else if (memberName === 'key')
|
|
286
286
|
;
|
|
287
287
|
else {
|
|
288
288
|
// Set property if it exists and it's not a SVG
|
|
@@ -294,7 +294,6 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
294
294
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
295
295
|
if (memberName === 'list') {
|
|
296
296
|
isProp = false;
|
|
297
|
-
// tslint:disable-next-line: triple-equals
|
|
298
297
|
}
|
|
299
298
|
else if (oldValue == null || elm[memberName] != n) {
|
|
300
299
|
elm[memberName] = n;
|
|
@@ -328,7 +327,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
328
327
|
// if the element passed in is a shadow root, which is a document fragment
|
|
329
328
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
330
329
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
331
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
330
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
331
|
+
? newVnode.$elm$.host
|
|
332
|
+
: newVnode.$elm$;
|
|
332
333
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
333
334
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
334
335
|
{
|
|
@@ -352,12 +353,12 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
352
353
|
let childNode;
|
|
353
354
|
{
|
|
354
355
|
// create element
|
|
355
|
-
elm = newVNode.$elm$ = (
|
|
356
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
|
|
356
357
|
// add css classes, attrs, props, listeners, etc.
|
|
357
358
|
{
|
|
358
359
|
updateElement(null, newVNode, isSvgMode);
|
|
359
360
|
}
|
|
360
|
-
if (
|
|
361
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
361
362
|
// if there is a scopeId and this is the initial render
|
|
362
363
|
// then let's add the scopeId as a css class
|
|
363
364
|
elm.classList.add((elm['s-si'] = scopeId));
|
|
@@ -377,9 +378,9 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
377
378
|
return elm;
|
|
378
379
|
};
|
|
379
380
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
380
|
-
let containerElm = (
|
|
381
|
+
let containerElm = (parentElm);
|
|
381
382
|
let childNode;
|
|
382
|
-
if (
|
|
383
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
383
384
|
containerElm = containerElm.shadowRoot;
|
|
384
385
|
}
|
|
385
386
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -387,7 +388,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
387
388
|
childNode = createElm(null, parentVNode, startIdx);
|
|
388
389
|
if (childNode) {
|
|
389
390
|
vnodes[startIdx].$elm$ = childNode;
|
|
390
|
-
containerElm.insertBefore(childNode,
|
|
391
|
+
containerElm.insertBefore(childNode, before);
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
394
|
}
|
|
@@ -461,7 +462,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
464
|
}
|
|
464
|
-
if (
|
|
465
|
+
if (idxInOld >= 0) {
|
|
465
466
|
elmToMove = oldCh[idxInOld];
|
|
466
467
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
467
468
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
@@ -488,7 +489,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
488
489
|
if (oldStartIdx > oldEndIdx) {
|
|
489
490
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
490
491
|
}
|
|
491
|
-
else if (
|
|
492
|
+
else if (newStartIdx > newEndIdx) {
|
|
492
493
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
493
494
|
}
|
|
494
495
|
};
|
|
@@ -516,7 +517,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
516
517
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
517
518
|
}
|
|
518
519
|
}
|
|
519
|
-
if (
|
|
520
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
520
521
|
// looks like there's child vnodes for both the old and new vnodes
|
|
521
522
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
522
523
|
}
|
|
@@ -524,7 +525,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
524
525
|
// add the new vnode children
|
|
525
526
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
526
527
|
}
|
|
527
|
-
else if (
|
|
528
|
+
else if (oldChildren !== null) {
|
|
528
529
|
// no new child vnodes, but there are old child vnodes to remove
|
|
529
530
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
530
531
|
}
|
|
@@ -538,28 +539,35 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
538
539
|
rootVnode.$tag$ = null;
|
|
539
540
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
540
541
|
hostRef.$vnode$ = rootVnode;
|
|
541
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
542
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
542
543
|
{
|
|
543
544
|
scopeId = hostElm['s-sc'];
|
|
544
545
|
}
|
|
545
546
|
// synchronous patch
|
|
546
547
|
patch(oldVNode, rootVnode);
|
|
547
548
|
};
|
|
549
|
+
/**
|
|
550
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
551
|
+
* @param elm the target of the Event
|
|
552
|
+
* @param name the name to give the custom Event
|
|
553
|
+
* @param opts options for configuring a custom Event
|
|
554
|
+
* @returns the custom Event
|
|
555
|
+
*/
|
|
548
556
|
const emitEvent = (elm, name, opts) => {
|
|
549
557
|
const ev = plt.ce(name, opts);
|
|
550
558
|
elm.dispatchEvent(ev);
|
|
551
559
|
return ev;
|
|
552
560
|
};
|
|
553
561
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
554
|
-
if (
|
|
555
|
-
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
|
|
562
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
563
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
556
564
|
}
|
|
557
565
|
};
|
|
558
566
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
559
567
|
{
|
|
560
568
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
561
569
|
}
|
|
562
|
-
if (
|
|
570
|
+
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
563
571
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
564
572
|
return;
|
|
565
573
|
}
|
|
@@ -568,11 +576,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
568
576
|
// has already fired off its lifecycle update then
|
|
569
577
|
// fire off the initial update
|
|
570
578
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
571
|
-
return
|
|
579
|
+
return writeTask(dispatch) ;
|
|
572
580
|
};
|
|
573
581
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
574
582
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
575
|
-
const instance =
|
|
583
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
576
584
|
let promise;
|
|
577
585
|
if (isInitialLoad) {
|
|
578
586
|
{
|
|
@@ -592,7 +600,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
592
600
|
const elm = hostRef.$hostElement$;
|
|
593
601
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
594
602
|
const rc = elm['s-rc'];
|
|
595
|
-
if (
|
|
603
|
+
if (isInitialLoad) {
|
|
596
604
|
// DOM WRITE!
|
|
597
605
|
attachStyles(hostRef);
|
|
598
606
|
}
|
|
@@ -600,14 +608,14 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
600
608
|
{
|
|
601
609
|
callRender(hostRef, instance);
|
|
602
610
|
}
|
|
603
|
-
if (
|
|
611
|
+
if (plt.$cssShim$) {
|
|
604
612
|
plt.$cssShim$.updateHost(elm);
|
|
605
613
|
}
|
|
606
|
-
if (
|
|
614
|
+
if (rc) {
|
|
607
615
|
// ok, so turns out there are some child host elements
|
|
608
616
|
// waiting on this parent element to load
|
|
609
617
|
// let's fire off all update callbacks waiting
|
|
610
|
-
rc.map(cb => cb());
|
|
618
|
+
rc.map((cb) => cb());
|
|
611
619
|
elm['s-rc'] = undefined;
|
|
612
620
|
}
|
|
613
621
|
endRender();
|
|
@@ -627,7 +635,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
627
635
|
};
|
|
628
636
|
const callRender = (hostRef, instance, elm) => {
|
|
629
637
|
try {
|
|
630
|
-
instance =
|
|
638
|
+
instance = instance.render() ;
|
|
631
639
|
{
|
|
632
640
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
633
641
|
}
|
|
@@ -710,20 +718,21 @@ const safeCall = (instance, method, arg) => {
|
|
|
710
718
|
const then = (promise, thenFn) => {
|
|
711
719
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
712
720
|
};
|
|
713
|
-
const addHydratedFlag = (elm) =>
|
|
721
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
722
|
+
;
|
|
714
723
|
const parsePropertyValue = (propValue, propType) => {
|
|
715
724
|
// ensure this value is of the correct prop type
|
|
716
725
|
if (propValue != null && !isComplexType(propValue)) {
|
|
717
|
-
if (
|
|
726
|
+
if (propType & 4 /* Boolean */) {
|
|
718
727
|
// per the HTML spec, any string value means it is a boolean true value
|
|
719
728
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
720
729
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
721
730
|
}
|
|
722
|
-
if (
|
|
731
|
+
if (propType & 2 /* Number */) {
|
|
723
732
|
// force it to be a number
|
|
724
733
|
return parseFloat(propValue);
|
|
725
734
|
}
|
|
726
|
-
if (
|
|
735
|
+
if (propType & 1 /* String */) {
|
|
727
736
|
// could have been passed as a number or boolean
|
|
728
737
|
// but we still want it as a string
|
|
729
738
|
return String(propValue);
|
|
@@ -741,14 +750,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
741
750
|
const hostRef = getHostRef(ref);
|
|
742
751
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
743
752
|
const flags = hostRef.$flags$;
|
|
744
|
-
const instance =
|
|
753
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
745
754
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
746
|
-
if ((
|
|
755
|
+
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
|
|
747
756
|
// gadzooks! the property's value has changed!!
|
|
748
757
|
// set our new value!
|
|
749
758
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
750
|
-
if (
|
|
751
|
-
if (
|
|
759
|
+
if (instance) {
|
|
760
|
+
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
752
761
|
// looks like this value actually changed, so we've got work to do!
|
|
753
762
|
// but only if we've already rendered, otherwise just chill out
|
|
754
763
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -759,12 +768,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
759
768
|
}
|
|
760
769
|
};
|
|
761
770
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
762
|
-
if (
|
|
771
|
+
if (cmpMeta.$members$) {
|
|
763
772
|
// It's better to have a const than two Object.entries()
|
|
764
773
|
const members = Object.entries(cmpMeta.$members$);
|
|
765
774
|
const prototype = Cstr.prototype;
|
|
766
775
|
members.map(([memberName, [memberFlags]]) => {
|
|
767
|
-
if (
|
|
776
|
+
if ((memberFlags & 31 /* Prop */ ||
|
|
777
|
+
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
768
778
|
// proxyComponent - prop
|
|
769
779
|
Object.defineProperty(prototype, memberName, {
|
|
770
780
|
get() {
|
|
@@ -780,11 +790,56 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
780
790
|
});
|
|
781
791
|
}
|
|
782
792
|
});
|
|
783
|
-
if (
|
|
793
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
784
794
|
const attrNameToPropName = new Map();
|
|
785
795
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
786
796
|
plt.jmp(() => {
|
|
787
797
|
const propName = attrNameToPropName.get(attrName);
|
|
798
|
+
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
|
799
|
+
// in the case where an attribute was set inline.
|
|
800
|
+
// ```html
|
|
801
|
+
// <my-component some-attribute="some-value"></my-component>
|
|
802
|
+
// ```
|
|
803
|
+
//
|
|
804
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
|
805
|
+
// programmatically changes it before it has been upgraded as shown below:
|
|
806
|
+
//
|
|
807
|
+
// ```html
|
|
808
|
+
// <!-- this component has _not_ been upgraded yet -->
|
|
809
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
|
810
|
+
// <script>
|
|
811
|
+
// // grab non-upgraded component
|
|
812
|
+
// el = document.querySelector("#test");
|
|
813
|
+
// el.someAttribute = "another-value";
|
|
814
|
+
// // upgrade component
|
|
815
|
+
// customElements.define('my-component', MyComponent);
|
|
816
|
+
// </script>
|
|
817
|
+
// ```
|
|
818
|
+
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
819
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
820
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
|
821
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
|
|
822
|
+
//
|
|
823
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
824
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
825
|
+
//
|
|
826
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
827
|
+
//
|
|
828
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
|
829
|
+
// properties here given that this goes against best practices outlined here
|
|
830
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
|
831
|
+
if (this.hasOwnProperty(propName)) {
|
|
832
|
+
newValue = this[propName];
|
|
833
|
+
delete this[propName];
|
|
834
|
+
}
|
|
835
|
+
else if (prototype.hasOwnProperty(propName) &&
|
|
836
|
+
typeof this[propName] === 'number' &&
|
|
837
|
+
this[propName] == newValue) {
|
|
838
|
+
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
|
839
|
+
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
|
840
|
+
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
788
843
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
789
844
|
});
|
|
790
845
|
};
|
|
@@ -803,7 +858,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
803
858
|
};
|
|
804
859
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
805
860
|
// initializeComponent
|
|
806
|
-
if (
|
|
861
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
807
862
|
{
|
|
808
863
|
// we haven't initialized this element yet
|
|
809
864
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -817,7 +872,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
817
872
|
Cstr = await Cstr;
|
|
818
873
|
endLoad();
|
|
819
874
|
}
|
|
820
|
-
if (
|
|
875
|
+
if (!Cstr.isProxied) {
|
|
821
876
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
822
877
|
Cstr.isProxied = true;
|
|
823
878
|
}
|
|
@@ -843,7 +898,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
843
898
|
}
|
|
844
899
|
endNewInstance();
|
|
845
900
|
}
|
|
846
|
-
if (
|
|
901
|
+
if (Cstr.style) {
|
|
847
902
|
// this component has styles but we haven't registered them yet
|
|
848
903
|
let style = Cstr.style;
|
|
849
904
|
const scopeId = getScopeId(cmpMeta);
|
|
@@ -857,8 +912,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
857
912
|
// we've successfully created a lazy instance
|
|
858
913
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
859
914
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
860
|
-
if (
|
|
861
|
-
// this is the
|
|
915
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
916
|
+
// this is the initial load and this component it has an ancestor component
|
|
862
917
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
863
918
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
864
919
|
// this will get fired off when the ancestor component
|
|
@@ -885,8 +940,7 @@ const connectedCallback = (elm) => {
|
|
|
885
940
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
886
941
|
// climb up the ancestors looking for the first
|
|
887
942
|
// component that hasn't finished its lifecycle update yet
|
|
888
|
-
if (
|
|
889
|
-
ancestorComponent['s-p']) {
|
|
943
|
+
if (ancestorComponent['s-p']) {
|
|
890
944
|
// we found this components first ancestor component
|
|
891
945
|
// keep a reference to this component's ancestor component
|
|
892
946
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -896,7 +950,7 @@ const connectedCallback = (elm) => {
|
|
|
896
950
|
}
|
|
897
951
|
// Lazy properties
|
|
898
952
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
899
|
-
if (
|
|
953
|
+
if (cmpMeta.$members$) {
|
|
900
954
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
901
955
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
902
956
|
const value = elm[memberName];
|
|
@@ -914,9 +968,9 @@ const connectedCallback = (elm) => {
|
|
|
914
968
|
};
|
|
915
969
|
const disconnectedCallback = (elm) => {
|
|
916
970
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
917
|
-
|
|
971
|
+
getHostRef(elm);
|
|
918
972
|
// clear CSS var-shim tracking
|
|
919
|
-
if (
|
|
973
|
+
if (plt.$cssShim$) {
|
|
920
974
|
plt.$cssShim$.removeHost(elm);
|
|
921
975
|
}
|
|
922
976
|
}
|
|
@@ -934,62 +988,64 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
934
988
|
let isBootstrapping = true;
|
|
935
989
|
Object.assign(plt, options);
|
|
936
990
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
937
|
-
lazyBundles.map(lazyBundle =>
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
991
|
+
lazyBundles.map((lazyBundle) => {
|
|
992
|
+
lazyBundle[1].map((compactMeta) => {
|
|
993
|
+
const cmpMeta = {
|
|
994
|
+
$flags$: compactMeta[0],
|
|
995
|
+
$tagName$: compactMeta[1],
|
|
996
|
+
$members$: compactMeta[2],
|
|
997
|
+
$listeners$: compactMeta[3],
|
|
998
|
+
};
|
|
999
|
+
{
|
|
1000
|
+
cmpMeta.$members$ = compactMeta[2];
|
|
1001
|
+
}
|
|
1002
|
+
const tagName = cmpMeta.$tagName$;
|
|
1003
|
+
const HostElement = class extends HTMLElement {
|
|
1004
|
+
// StencilLazyHost
|
|
1005
|
+
constructor(self) {
|
|
1006
|
+
// @ts-ignore
|
|
1007
|
+
super(self);
|
|
1008
|
+
self = this;
|
|
1009
|
+
registerHost(self, cmpMeta);
|
|
1010
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1011
|
+
// this component is using shadow dom
|
|
1012
|
+
// and this browser supports shadow dom
|
|
1013
|
+
// add the read-only property "shadowRoot" to the host element
|
|
1014
|
+
// adding the shadow root build conditionals to minimize runtime
|
|
961
1015
|
{
|
|
962
|
-
|
|
1016
|
+
{
|
|
1017
|
+
self.attachShadow({ mode: 'open' });
|
|
1018
|
+
}
|
|
963
1019
|
}
|
|
964
1020
|
}
|
|
965
1021
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1022
|
+
connectedCallback() {
|
|
1023
|
+
if (appLoadFallback) {
|
|
1024
|
+
clearTimeout(appLoadFallback);
|
|
1025
|
+
appLoadFallback = null;
|
|
1026
|
+
}
|
|
1027
|
+
if (isBootstrapping) {
|
|
1028
|
+
// connectedCallback will be processed once all components have been registered
|
|
1029
|
+
deferredConnectedCallbacks.push(this);
|
|
1030
|
+
}
|
|
1031
|
+
else {
|
|
1032
|
+
plt.jmp(() => connectedCallback(this));
|
|
1033
|
+
}
|
|
971
1034
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
deferredConnectedCallbacks.push(this);
|
|
1035
|
+
disconnectedCallback() {
|
|
1036
|
+
plt.jmp(() => disconnectedCallback(this));
|
|
975
1037
|
}
|
|
976
|
-
|
|
977
|
-
|
|
1038
|
+
componentOnReady() {
|
|
1039
|
+
return getHostRef(this).$onReadyPromise$;
|
|
978
1040
|
}
|
|
1041
|
+
};
|
|
1042
|
+
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1043
|
+
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1044
|
+
cmpTags.push(tagName);
|
|
1045
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
979
1046
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
}
|
|
983
|
-
componentOnReady() {
|
|
984
|
-
return getHostRef(this).$onReadyPromise$;
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
988
|
-
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
989
|
-
cmpTags.push(tagName);
|
|
990
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
991
|
-
}
|
|
992
|
-
}));
|
|
1047
|
+
});
|
|
1048
|
+
});
|
|
993
1049
|
{
|
|
994
1050
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
995
1051
|
visibilityStyle.setAttribute('data-styles', '');
|
|
@@ -998,7 +1054,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
998
1054
|
// Process deferred connectedCallbacks now all components have been registered
|
|
999
1055
|
isBootstrapping = false;
|
|
1000
1056
|
if (deferredConnectedCallbacks.length) {
|
|
1001
|
-
deferredConnectedCallbacks.map(host => host.connectedCallback());
|
|
1057
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
1002
1058
|
}
|
|
1003
1059
|
else {
|
|
1004
1060
|
{
|
|
@@ -1019,20 +1075,20 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1019
1075
|
$instanceValues$: new Map(),
|
|
1020
1076
|
};
|
|
1021
1077
|
{
|
|
1022
|
-
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
|
|
1078
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1023
1079
|
elm['s-p'] = [];
|
|
1024
1080
|
elm['s-rc'] = [];
|
|
1025
1081
|
}
|
|
1026
1082
|
return hostRefs.set(elm, hostRef);
|
|
1027
1083
|
};
|
|
1028
1084
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1029
|
-
const consoleError = (e, el) => (
|
|
1085
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1030
1086
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1031
1087
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1032
1088
|
// loadModuleImport
|
|
1033
1089
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
1034
1090
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1035
|
-
const module =
|
|
1091
|
+
const module = cmpModules.get(bundleId) ;
|
|
1036
1092
|
if (module) {
|
|
1037
1093
|
return module[exportName];
|
|
1038
1094
|
}
|
|
@@ -1040,7 +1096,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1040
1096
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1041
1097
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1042
1098
|
/* webpackMode: "lazy" */
|
|
1043
|
-
`./${bundleId}.entry.js${
|
|
1099
|
+
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
|
|
1044
1100
|
{
|
|
1045
1101
|
cmpModules.set(bundleId, importedModule);
|
|
1046
1102
|
}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-b5d2dca0.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Esm v2.
|
|
8
|
+
Stencil Client Patch Esm v2.13.0 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchEsm = () => {
|
|
11
11
|
// NOTE!! This fn cannot use async/await!
|
|
12
12
|
// @ts-ignore
|
|
13
|
-
if (
|
|
13
|
+
if (!(index.CSS && index.CSS.supports && index.CSS.supports('color', 'var(--c)'))) {
|
|
14
14
|
// @ts-ignore
|
|
15
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-
|
|
15
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-b3e497ca.js'); }).then(() => {
|
|
16
16
|
if ((index.plt.$cssShim$ = index.win.__cssshim)) {
|
|
17
17
|
return index.plt.$cssShim$.i();
|
|
18
18
|
}
|