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.
Files changed (36) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/cjs/{css-shim-285ec151.js → css-shim-b3e497ca.js} +1 -1
  3. package/dist/cjs/{index-1386590f.js → index-b5d2dca0.js} +172 -116
  4. package/dist/cjs/loader.cjs.js +4 -4
  5. package/dist/cjs/nb-skeleton.cjs.entry.js +2 -2
  6. package/dist/cjs/skeleton-webcomponent.cjs.js +4 -4
  7. package/dist/collection/collection-manifest.json +2 -2
  8. package/dist/collection/components/skeleton/skeleton.js +28 -28
  9. package/dist/custom-elements/index.js +3 -3
  10. package/dist/esm/{css-shim-934c915f.js → css-shim-2f04a37a.js} +1 -1
  11. package/dist/esm/{index-6dfb91e6.js → index-63fd3905.js} +172 -116
  12. package/dist/esm/loader.js +4 -4
  13. package/dist/esm/nb-skeleton.entry.js +2 -2
  14. package/dist/esm/skeleton-webcomponent.js +4 -4
  15. package/dist/esm-es5/{css-shim-934c915f.js → css-shim-2f04a37a.js} +0 -0
  16. package/dist/esm-es5/index-63fd3905.js +1 -0
  17. package/dist/esm-es5/loader.js +1 -1
  18. package/dist/esm-es5/nb-skeleton.entry.js +1 -1
  19. package/dist/esm-es5/skeleton-webcomponent.js +1 -1
  20. package/dist/skeleton-webcomponent/{p-07aa1738.js → p-12077897.js} +0 -0
  21. package/dist/skeleton-webcomponent/{p-6f883149.system.js → p-16aec442.system.js} +0 -0
  22. package/dist/skeleton-webcomponent/p-63ed3b45.entry.js +1 -0
  23. package/dist/skeleton-webcomponent/p-7e96e5d4.js +1 -0
  24. package/dist/skeleton-webcomponent/{p-94c5d705.system.js → p-8bef7229.system.js} +1 -1
  25. package/dist/skeleton-webcomponent/{p-0af0d538.system.entry.js → p-dc1bf577.system.entry.js} +1 -1
  26. package/dist/skeleton-webcomponent/p-f59432d4.system.js +1 -0
  27. package/dist/skeleton-webcomponent/skeleton-webcomponent.esm.js +1 -1
  28. package/dist/skeleton-webcomponent/skeleton-webcomponent.js +1 -1
  29. package/dist/types/stencil-public-runtime.d.ts +196 -186
  30. package/loader/index.d.ts +0 -1
  31. package/package.json +3 -4
  32. package/readme.md +3 -1
  33. package/dist/esm-es5/index-6dfb91e6.js +0 -1
  34. package/dist/skeleton-webcomponent/p-13a85a5d.js +0 -1
  35. package/dist/skeleton-webcomponent/p-437abd94.system.js +0 -1
  36. package/dist/skeleton-webcomponent/p-b1ce4c03.entry.js +0 -1
@@ -5,22 +5,22 @@ let hostTagName;
5
5
  let isSvgMode = false;
6
6
  let queuePending = false;
7
7
  const win = typeof window !== 'undefined' ? window : {};
8
- const CSS = win.CSS ;
8
+ const CSS = win.CSS ;
9
9
  const doc = win.document || { head: {} };
10
10
  const plt = {
11
11
  $flags$: 0,
12
12
  $resourcesUrl$: '',
13
- jmp: h => h(),
14
- raf: h => requestAnimationFrame(h),
13
+ jmp: (h) => h(),
14
+ raf: (h) => requestAnimationFrame(h),
15
15
  ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
16
16
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
17
17
  ce: (eventName, opts) => new CustomEvent(eventName, opts),
18
18
  };
19
19
  const promiseResolve = (v) => Promise.resolve(v);
20
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
20
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
21
21
  try {
22
22
  new CSSStyleSheet();
23
- return typeof (new CSSStyleSheet()).replace === 'function';
23
+ return typeof new CSSStyleSheet().replace === 'function';
24
24
  }
25
25
  catch (e) { }
26
26
  return false;
@@ -69,7 +69,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
69
69
  }
70
70
  if (!appliedStyles.has(scopeId)) {
71
71
  {
72
- if ( plt.$cssShim$) {
72
+ if (plt.$cssShim$) {
73
73
  styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
74
74
  const newScopeId = styleElm['s-sc'];
75
75
  if (newScopeId) {
@@ -91,7 +91,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
91
91
  }
92
92
  }
93
93
  }
94
- else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) {
94
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
95
95
  styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
96
96
  }
97
97
  }
@@ -102,8 +102,8 @@ const attachStyles = (hostRef) => {
102
102
  const elm = hostRef.$hostElement$;
103
103
  const flags = cmpMeta.$flags$;
104
104
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
105
- const scopeId = addStyle( elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
106
- if ( flags & 10 /* needsScopedEncapsulation */) {
105
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
106
+ if (flags & 10 /* needsScopedEncapsulation */) {
107
107
  // only required when we're NOT using native shadow dom (slot)
108
108
  // or this browser doesn't support native shadow dom
109
109
  // and this host element was NOT created with SSR
@@ -116,7 +116,7 @@ const attachStyles = (hostRef) => {
116
116
  }
117
117
  endAttachStyles();
118
118
  };
119
- const getScopeId = (cmp, mode) => 'sc-' + ( cmp.$tagName$);
119
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
120
120
  /**
121
121
  * Default style mode id
122
122
  */
@@ -173,7 +173,7 @@ const h = (nodeName, vnodeData, ...children) => {
173
173
  walk(children);
174
174
  if (vnodeData) {
175
175
  // normalize class / classname attributes
176
- if ( vnodeData.key) {
176
+ if (vnodeData.key) {
177
177
  key = vnodeData.key;
178
178
  }
179
179
  {
@@ -183,7 +183,7 @@ const h = (nodeName, vnodeData, ...children) => {
183
183
  typeof classData !== 'object'
184
184
  ? classData
185
185
  : Object.keys(classData)
186
- .filter(k => classData[k])
186
+ .filter((k) => classData[k])
187
187
  .join(' ');
188
188
  }
189
189
  }
@@ -227,20 +227,20 @@ const isHost = (node) => node && node.$tag$ === Host;
227
227
  const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
228
228
  if (oldValue !== newValue) {
229
229
  let isProp = isMemberInElement(elm, memberName);
230
- let ln = memberName.toLowerCase();
231
- if ( memberName === 'class') {
230
+ memberName.toLowerCase();
231
+ if (memberName === 'class') {
232
232
  const classList = elm.classList;
233
233
  const oldClasses = parseClassList(oldValue);
234
234
  const newClasses = parseClassList(newValue);
235
- classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
236
- classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
235
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
236
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
237
237
  }
238
- else if ( memberName === 'style') {
238
+ else if (memberName === 'style') {
239
239
  // update style attribute, css properties and values
240
240
  {
241
241
  for (const prop in oldValue) {
242
242
  if (!newValue || newValue[prop] == null) {
243
- if ( prop.includes('-')) {
243
+ if (prop.includes('-')) {
244
244
  elm.style.removeProperty(prop);
245
245
  }
246
246
  else {
@@ -251,7 +251,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
251
251
  }
252
252
  for (const prop in newValue) {
253
253
  if (!oldValue || newValue[prop] !== oldValue[prop]) {
254
- if ( prop.includes('-')) {
254
+ if (prop.includes('-')) {
255
255
  elm.style.setProperty(prop, newValue[prop]);
256
256
  }
257
257
  else {
@@ -260,7 +260,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
260
260
  }
261
261
  }
262
262
  }
263
- else if ( memberName === 'key')
263
+ else if (memberName === 'key')
264
264
  ;
265
265
  else {
266
266
  // Set property if it exists and it's not a SVG
@@ -272,7 +272,6 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
272
272
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
273
273
  if (memberName === 'list') {
274
274
  isProp = false;
275
- // tslint:disable-next-line: triple-equals
276
275
  }
277
276
  else if (oldValue == null || elm[memberName] != n) {
278
277
  elm[memberName] = n;
@@ -306,7 +305,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
306
305
  // if the element passed in is a shadow root, which is a document fragment
307
306
  // then we want to be adding attrs/props to the shadow root's "host" element
308
307
  // if it's not a shadow root, then we add attrs/props to the same element
309
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
308
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
309
+ ? newVnode.$elm$.host
310
+ : newVnode.$elm$;
310
311
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
311
312
  const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
312
313
  {
@@ -330,12 +331,12 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
330
331
  let childNode;
331
332
  {
332
333
  // create element
333
- elm = newVNode.$elm$ = ( doc.createElement( newVNode.$tag$));
334
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
334
335
  // add css classes, attrs, props, listeners, etc.
335
336
  {
336
337
  updateElement(null, newVNode, isSvgMode);
337
338
  }
338
- if ( isDef(scopeId) && elm['s-si'] !== scopeId) {
339
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
339
340
  // if there is a scopeId and this is the initial render
340
341
  // then let's add the scopeId as a css class
341
342
  elm.classList.add((elm['s-si'] = scopeId));
@@ -355,9 +356,9 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
355
356
  return elm;
356
357
  };
357
358
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
358
- let containerElm = ( parentElm);
359
+ let containerElm = (parentElm);
359
360
  let childNode;
360
- if ( containerElm.shadowRoot && containerElm.tagName === hostTagName) {
361
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
361
362
  containerElm = containerElm.shadowRoot;
362
363
  }
363
364
  for (; startIdx <= endIdx; ++startIdx) {
@@ -365,7 +366,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
365
366
  childNode = createElm(null, parentVNode, startIdx);
366
367
  if (childNode) {
367
368
  vnodes[startIdx].$elm$ = childNode;
368
- containerElm.insertBefore(childNode, before);
369
+ containerElm.insertBefore(childNode, before);
369
370
  }
370
371
  }
371
372
  }
@@ -439,7 +440,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
439
440
  }
440
441
  }
441
442
  }
442
- if ( idxInOld >= 0) {
443
+ if (idxInOld >= 0) {
443
444
  elmToMove = oldCh[idxInOld];
444
445
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
445
446
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
@@ -466,7 +467,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
466
467
  if (oldStartIdx > oldEndIdx) {
467
468
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
468
469
  }
469
- else if ( newStartIdx > newEndIdx) {
470
+ else if (newStartIdx > newEndIdx) {
470
471
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
471
472
  }
472
473
  };
@@ -494,7 +495,7 @@ const patch = (oldVNode, newVNode) => {
494
495
  updateElement(oldVNode, newVNode, isSvgMode);
495
496
  }
496
497
  }
497
- if ( oldChildren !== null && newChildren !== null) {
498
+ if (oldChildren !== null && newChildren !== null) {
498
499
  // looks like there's child vnodes for both the old and new vnodes
499
500
  updateChildren(elm, oldChildren, newVNode, newChildren);
500
501
  }
@@ -502,7 +503,7 @@ const patch = (oldVNode, newVNode) => {
502
503
  // add the new vnode children
503
504
  addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
504
505
  }
505
- else if ( oldChildren !== null) {
506
+ else if (oldChildren !== null) {
506
507
  // no new child vnodes, but there are old child vnodes to remove
507
508
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
508
509
  }
@@ -516,28 +517,35 @@ const renderVdom = (hostRef, renderFnResults) => {
516
517
  rootVnode.$tag$ = null;
517
518
  rootVnode.$flags$ |= 4 /* isHost */;
518
519
  hostRef.$vnode$ = rootVnode;
519
- rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm.shadowRoot || hostElm );
520
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
520
521
  {
521
522
  scopeId = hostElm['s-sc'];
522
523
  }
523
524
  // synchronous patch
524
525
  patch(oldVNode, rootVnode);
525
526
  };
527
+ /**
528
+ * Helper function to create & dispatch a custom Event on a provided target
529
+ * @param elm the target of the Event
530
+ * @param name the name to give the custom Event
531
+ * @param opts options for configuring a custom Event
532
+ * @returns the custom Event
533
+ */
526
534
  const emitEvent = (elm, name, opts) => {
527
535
  const ev = plt.ce(name, opts);
528
536
  elm.dispatchEvent(ev);
529
537
  return ev;
530
538
  };
531
539
  const attachToAncestor = (hostRef, ancestorComponent) => {
532
- if ( ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
533
- ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
540
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
541
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
534
542
  }
535
543
  };
536
544
  const scheduleUpdate = (hostRef, isInitialLoad) => {
537
545
  {
538
546
  hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
539
547
  }
540
- if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) {
548
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
541
549
  hostRef.$flags$ |= 512 /* needsRerender */;
542
550
  return;
543
551
  }
@@ -546,11 +554,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
546
554
  // has already fired off its lifecycle update then
547
555
  // fire off the initial update
548
556
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
549
- return writeTask(dispatch) ;
557
+ return writeTask(dispatch) ;
550
558
  };
551
559
  const dispatchHooks = (hostRef, isInitialLoad) => {
552
560
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
553
- const instance = hostRef.$lazyInstance$ ;
561
+ const instance = hostRef.$lazyInstance$ ;
554
562
  let promise;
555
563
  if (isInitialLoad) {
556
564
  {
@@ -570,7 +578,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
570
578
  const elm = hostRef.$hostElement$;
571
579
  const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
572
580
  const rc = elm['s-rc'];
573
- if ( isInitialLoad) {
581
+ if (isInitialLoad) {
574
582
  // DOM WRITE!
575
583
  attachStyles(hostRef);
576
584
  }
@@ -578,14 +586,14 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
578
586
  {
579
587
  callRender(hostRef, instance);
580
588
  }
581
- if ( plt.$cssShim$) {
589
+ if (plt.$cssShim$) {
582
590
  plt.$cssShim$.updateHost(elm);
583
591
  }
584
- if ( rc) {
592
+ if (rc) {
585
593
  // ok, so turns out there are some child host elements
586
594
  // waiting on this parent element to load
587
595
  // let's fire off all update callbacks waiting
588
- rc.map(cb => cb());
596
+ rc.map((cb) => cb());
589
597
  elm['s-rc'] = undefined;
590
598
  }
591
599
  endRender();
@@ -605,7 +613,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
605
613
  };
606
614
  const callRender = (hostRef, instance, elm) => {
607
615
  try {
608
- instance = instance.render() ;
616
+ instance = instance.render() ;
609
617
  {
610
618
  hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
611
619
  }
@@ -688,20 +696,21 @@ const safeCall = (instance, method, arg) => {
688
696
  const then = (promise, thenFn) => {
689
697
  return promise && promise.then ? promise.then(thenFn) : thenFn();
690
698
  };
691
- const addHydratedFlag = (elm) => ( elm.classList.add('hydrated') );
699
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
700
+ ;
692
701
  const parsePropertyValue = (propValue, propType) => {
693
702
  // ensure this value is of the correct prop type
694
703
  if (propValue != null && !isComplexType(propValue)) {
695
- if ( propType & 4 /* Boolean */) {
704
+ if (propType & 4 /* Boolean */) {
696
705
  // per the HTML spec, any string value means it is a boolean true value
697
706
  // but we'll cheat here and say that the string "false" is the boolean false
698
707
  return propValue === 'false' ? false : propValue === '' || !!propValue;
699
708
  }
700
- if ( propType & 2 /* Number */) {
709
+ if (propType & 2 /* Number */) {
701
710
  // force it to be a number
702
711
  return parseFloat(propValue);
703
712
  }
704
- if ( propType & 1 /* String */) {
713
+ if (propType & 1 /* String */) {
705
714
  // could have been passed as a number or boolean
706
715
  // but we still want it as a string
707
716
  return String(propValue);
@@ -719,14 +728,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
719
728
  const hostRef = getHostRef(ref);
720
729
  const oldVal = hostRef.$instanceValues$.get(propName);
721
730
  const flags = hostRef.$flags$;
722
- const instance = hostRef.$lazyInstance$ ;
731
+ const instance = hostRef.$lazyInstance$ ;
723
732
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
724
- if (( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
733
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
725
734
  // gadzooks! the property's value has changed!!
726
735
  // set our new value!
727
736
  hostRef.$instanceValues$.set(propName, newVal);
728
- if ( instance) {
729
- if ( (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
737
+ if (instance) {
738
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
730
739
  // looks like this value actually changed, so we've got work to do!
731
740
  // but only if we've already rendered, otherwise just chill out
732
741
  // queue that we need to do an update, but don't worry about queuing
@@ -737,12 +746,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
737
746
  }
738
747
  };
739
748
  const proxyComponent = (Cstr, cmpMeta, flags) => {
740
- if ( cmpMeta.$members$) {
749
+ if (cmpMeta.$members$) {
741
750
  // It's better to have a const than two Object.entries()
742
751
  const members = Object.entries(cmpMeta.$members$);
743
752
  const prototype = Cstr.prototype;
744
753
  members.map(([memberName, [memberFlags]]) => {
745
- if ( (memberFlags & 31 /* Prop */ || (( flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
754
+ if ((memberFlags & 31 /* Prop */ ||
755
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
746
756
  // proxyComponent - prop
747
757
  Object.defineProperty(prototype, memberName, {
748
758
  get() {
@@ -758,11 +768,56 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
758
768
  });
759
769
  }
760
770
  });
761
- if ( ( flags & 1 /* isElementConstructor */)) {
771
+ if ((flags & 1 /* isElementConstructor */)) {
762
772
  const attrNameToPropName = new Map();
763
773
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
764
774
  plt.jmp(() => {
765
775
  const propName = attrNameToPropName.get(attrName);
776
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
777
+ // in the case where an attribute was set inline.
778
+ // ```html
779
+ // <my-component some-attribute="some-value"></my-component>
780
+ // ```
781
+ //
782
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
783
+ // programmatically changes it before it has been upgraded as shown below:
784
+ //
785
+ // ```html
786
+ // <!-- this component has _not_ been upgraded yet -->
787
+ // <my-component id="test" some-attribute="some-value"></my-component>
788
+ // <script>
789
+ // // grab non-upgraded component
790
+ // el = document.querySelector("#test");
791
+ // el.someAttribute = "another-value";
792
+ // // upgrade component
793
+ // customElements.define('my-component', MyComponent);
794
+ // </script>
795
+ // ```
796
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
797
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
798
+ // to the value that was set inline i.e. "some-value" from above example. When
799
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
800
+ //
801
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
802
+ // by connectedCallback as this attributeChangedCallback will not fire.
803
+ //
804
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
805
+ //
806
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
807
+ // properties here given that this goes against best practices outlined here
808
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
809
+ if (this.hasOwnProperty(propName)) {
810
+ newValue = this[propName];
811
+ delete this[propName];
812
+ }
813
+ else if (prototype.hasOwnProperty(propName) &&
814
+ typeof this[propName] === 'number' &&
815
+ this[propName] == newValue) {
816
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
817
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
818
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
819
+ return;
820
+ }
766
821
  this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
767
822
  });
768
823
  };
@@ -781,7 +836,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
781
836
  };
782
837
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
783
838
  // initializeComponent
784
- if ( (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
839
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
785
840
  {
786
841
  // we haven't initialized this element yet
787
842
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
@@ -795,7 +850,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
795
850
  Cstr = await Cstr;
796
851
  endLoad();
797
852
  }
798
- if ( !Cstr.isProxied) {
853
+ if (!Cstr.isProxied) {
799
854
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
800
855
  Cstr.isProxied = true;
801
856
  }
@@ -821,7 +876,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
821
876
  }
822
877
  endNewInstance();
823
878
  }
824
- if ( Cstr.style) {
879
+ if (Cstr.style) {
825
880
  // this component has styles but we haven't registered them yet
826
881
  let style = Cstr.style;
827
882
  const scopeId = getScopeId(cmpMeta);
@@ -835,8 +890,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
835
890
  // we've successfully created a lazy instance
836
891
  const ancestorComponent = hostRef.$ancestorComponent$;
837
892
  const schedule = () => scheduleUpdate(hostRef, true);
838
- if ( ancestorComponent && ancestorComponent['s-rc']) {
839
- // this is the intial load and this component it has an ancestor component
893
+ if (ancestorComponent && ancestorComponent['s-rc']) {
894
+ // this is the initial load and this component it has an ancestor component
840
895
  // but the ancestor component has NOT fired its will update lifecycle yet
841
896
  // so let's just cool our jets and wait for the ancestor to continue first
842
897
  // this will get fired off when the ancestor component
@@ -863,8 +918,7 @@ const connectedCallback = (elm) => {
863
918
  while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
864
919
  // climb up the ancestors looking for the first
865
920
  // component that hasn't finished its lifecycle update yet
866
- if (
867
- ancestorComponent['s-p']) {
921
+ if (ancestorComponent['s-p']) {
868
922
  // we found this components first ancestor component
869
923
  // keep a reference to this component's ancestor component
870
924
  attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
@@ -874,7 +928,7 @@ const connectedCallback = (elm) => {
874
928
  }
875
929
  // Lazy properties
876
930
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
877
- if ( cmpMeta.$members$) {
931
+ if (cmpMeta.$members$) {
878
932
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
879
933
  if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
880
934
  const value = elm[memberName];
@@ -892,9 +946,9 @@ const connectedCallback = (elm) => {
892
946
  };
893
947
  const disconnectedCallback = (elm) => {
894
948
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
895
- const hostRef = getHostRef(elm);
949
+ getHostRef(elm);
896
950
  // clear CSS var-shim tracking
897
- if ( plt.$cssShim$) {
951
+ if (plt.$cssShim$) {
898
952
  plt.$cssShim$.removeHost(elm);
899
953
  }
900
954
  }
@@ -912,62 +966,64 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
912
966
  let isBootstrapping = true;
913
967
  Object.assign(plt, options);
914
968
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
915
- lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
916
- const cmpMeta = {
917
- $flags$: compactMeta[0],
918
- $tagName$: compactMeta[1],
919
- $members$: compactMeta[2],
920
- $listeners$: compactMeta[3],
921
- };
922
- {
923
- cmpMeta.$members$ = compactMeta[2];
924
- }
925
- const tagName = cmpMeta.$tagName$;
926
- const HostElement = class extends HTMLElement {
927
- // StencilLazyHost
928
- constructor(self) {
929
- // @ts-ignore
930
- super(self);
931
- self = this;
932
- registerHost(self, cmpMeta);
933
- if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
934
- // this component is using shadow dom
935
- // and this browser supports shadow dom
936
- // add the read-only property "shadowRoot" to the host element
937
- // adding the shadow root build conditionals to minimize runtime
938
- {
969
+ lazyBundles.map((lazyBundle) => {
970
+ lazyBundle[1].map((compactMeta) => {
971
+ const cmpMeta = {
972
+ $flags$: compactMeta[0],
973
+ $tagName$: compactMeta[1],
974
+ $members$: compactMeta[2],
975
+ $listeners$: compactMeta[3],
976
+ };
977
+ {
978
+ cmpMeta.$members$ = compactMeta[2];
979
+ }
980
+ const tagName = cmpMeta.$tagName$;
981
+ const HostElement = class extends HTMLElement {
982
+ // StencilLazyHost
983
+ constructor(self) {
984
+ // @ts-ignore
985
+ super(self);
986
+ self = this;
987
+ registerHost(self, cmpMeta);
988
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
989
+ // this component is using shadow dom
990
+ // and this browser supports shadow dom
991
+ // add the read-only property "shadowRoot" to the host element
992
+ // adding the shadow root build conditionals to minimize runtime
939
993
  {
940
- self.attachShadow({ mode: 'open' });
994
+ {
995
+ self.attachShadow({ mode: 'open' });
996
+ }
941
997
  }
942
998
  }
943
999
  }
944
- }
945
- connectedCallback() {
946
- if (appLoadFallback) {
947
- clearTimeout(appLoadFallback);
948
- appLoadFallback = null;
1000
+ connectedCallback() {
1001
+ if (appLoadFallback) {
1002
+ clearTimeout(appLoadFallback);
1003
+ appLoadFallback = null;
1004
+ }
1005
+ if (isBootstrapping) {
1006
+ // connectedCallback will be processed once all components have been registered
1007
+ deferredConnectedCallbacks.push(this);
1008
+ }
1009
+ else {
1010
+ plt.jmp(() => connectedCallback(this));
1011
+ }
949
1012
  }
950
- if (isBootstrapping) {
951
- // connectedCallback will be processed once all components have been registered
952
- deferredConnectedCallbacks.push(this);
1013
+ disconnectedCallback() {
1014
+ plt.jmp(() => disconnectedCallback(this));
953
1015
  }
954
- else {
955
- plt.jmp(() => connectedCallback(this));
1016
+ componentOnReady() {
1017
+ return getHostRef(this).$onReadyPromise$;
956
1018
  }
1019
+ };
1020
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1021
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1022
+ cmpTags.push(tagName);
1023
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
957
1024
  }
958
- disconnectedCallback() {
959
- plt.jmp(() => disconnectedCallback(this));
960
- }
961
- componentOnReady() {
962
- return getHostRef(this).$onReadyPromise$;
963
- }
964
- };
965
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
966
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
967
- cmpTags.push(tagName);
968
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
969
- }
970
- }));
1025
+ });
1026
+ });
971
1027
  {
972
1028
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
973
1029
  visibilityStyle.setAttribute('data-styles', '');
@@ -976,7 +1032,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
976
1032
  // Process deferred connectedCallbacks now all components have been registered
977
1033
  isBootstrapping = false;
978
1034
  if (deferredConnectedCallbacks.length) {
979
- deferredConnectedCallbacks.map(host => host.connectedCallback());
1035
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
980
1036
  }
981
1037
  else {
982
1038
  {
@@ -997,20 +1053,20 @@ const registerHost = (elm, cmpMeta) => {
997
1053
  $instanceValues$: new Map(),
998
1054
  };
999
1055
  {
1000
- hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
1056
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1001
1057
  elm['s-p'] = [];
1002
1058
  elm['s-rc'] = [];
1003
1059
  }
1004
1060
  return hostRefs.set(elm, hostRef);
1005
1061
  };
1006
1062
  const isMemberInElement = (elm, memberName) => memberName in elm;
1007
- const consoleError = (e, el) => ( 0, console.error)(e, el);
1063
+ const consoleError = (e, el) => (0, console.error)(e, el);
1008
1064
  const cmpModules = /*@__PURE__*/ new Map();
1009
1065
  const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1010
1066
  // loadModuleImport
1011
1067
  const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1012
1068
  const bundleId = cmpMeta.$lazyBundleId$;
1013
- const module = cmpModules.get(bundleId) ;
1069
+ const module = cmpModules.get(bundleId) ;
1014
1070
  if (module) {
1015
1071
  return module[exportName];
1016
1072
  }
@@ -1018,7 +1074,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1018
1074
  /* webpackInclude: /\.entry\.js$/ */
1019
1075
  /* webpackExclude: /\.system\.entry\.js$/ */
1020
1076
  /* webpackMode: "lazy" */
1021
- `./${bundleId}.entry.js${ ''}`).then(importedModule => {
1077
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1022
1078
  {
1023
1079
  cmpModules.set(bundleId, importedModule);
1024
1080
  }
@@ -1,14 +1,14 @@
1
- import { C as CSS, p as plt, w as win, a as promiseResolve, b as bootstrapLazy } from './index-6dfb91e6.js';
1
+ import { C as CSS, p as plt, w as win, a as promiseResolve, b as bootstrapLazy } from './index-63fd3905.js';
2
2
 
3
3
  /*
4
- Stencil Client Patch Esm v2.4.0 | MIT Licensed | https://stenciljs.com
4
+ Stencil Client Patch Esm v2.13.0 | MIT Licensed | https://stenciljs.com
5
5
  */
6
6
  const patchEsm = () => {
7
7
  // NOTE!! This fn cannot use async/await!
8
8
  // @ts-ignore
9
- if ( !(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) {
9
+ if (!(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) {
10
10
  // @ts-ignore
11
- return import(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-934c915f.js').then(() => {
11
+ return import(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-2f04a37a.js').then(() => {
12
12
  if ((plt.$cssShim$ = win.__cssshim)) {
13
13
  return plt.$cssShim$.i();
14
14
  }