@penn-libraries/web 0.3.0-dev.2 → 0.3.0-dev.3

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 (109) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  3. package/dist/cjs/{index-c02f277e.js → index-B6Rjt_WH.js} +339 -196
  4. package/dist/cjs/index-B6Rjt_WH.js.map +1 -0
  5. package/dist/cjs/index.cjs.js +2 -3
  6. package/dist/cjs/index.cjs.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +4 -5
  8. package/dist/cjs/loader.cjs.js.map +1 -1
  9. package/dist/cjs/pennlibs-banner.cjs.entry.js +3 -5
  10. package/dist/cjs/pennlibs-banner.cjs.entry.js.map +1 -1
  11. package/dist/cjs/pennlibs-banner.entry.cjs.js.map +1 -0
  12. package/dist/cjs/pennlibs-chat.pennlibs-feedback.pennlibs-footer.pennlibs-header.pennlibs-hero.entry.cjs.js.map +1 -0
  13. package/dist/cjs/{pennlibs-chat_4.cjs.entry.js → pennlibs-chat_5.cjs.entry.js} +69 -50
  14. package/dist/cjs/pennlibs-chat_5.cjs.entry.js.map +1 -0
  15. package/dist/cjs/pennlibs-colors.cjs.entry.js +3 -6
  16. package/dist/cjs/pennlibs-colors.cjs.entry.js.map +1 -1
  17. package/dist/cjs/pennlibs-colors.entry.cjs.js.map +1 -0
  18. package/dist/cjs/web.cjs.js +8 -7
  19. package/dist/cjs/web.cjs.js.map +1 -1
  20. package/dist/collection/collection-manifest.json +4 -3
  21. package/dist/collection/components/pennlibs-chat/pennlibs-chat.js.map +1 -1
  22. package/dist/collection/components/pennlibs-colors/pennlibs-colors.js +4 -4
  23. package/dist/collection/components/pennlibs-colors/pennlibs-colors.js.map +1 -1
  24. package/dist/collection/components/pennlibs-feedback/pennlibs-feedback.js.map +1 -1
  25. package/dist/collection/components/pennlibs-footer/pennlibs-footer.js +4 -5
  26. package/dist/collection/components/pennlibs-footer/pennlibs-footer.js.map +1 -1
  27. package/dist/collection/components/pennlibs-header/pennlibs-header.css +2 -114
  28. package/dist/collection/components/pennlibs-header/pennlibs-header.js +35 -27
  29. package/dist/collection/components/pennlibs-header/pennlibs-header.js.map +1 -1
  30. package/dist/collection/components/pennlibs-hero/pennlibs-hero.css +132 -0
  31. package/dist/collection/components/pennlibs-hero/pennlibs-hero.js +71 -0
  32. package/dist/collection/components/pennlibs-hero/pennlibs-hero.js.map +1 -0
  33. package/dist/components/index.d.ts +2 -0
  34. package/dist/components/index.js +2 -0
  35. package/dist/components/index.js.map +1 -1
  36. package/dist/components/pennlibs-banner.js +2 -2
  37. package/dist/components/pennlibs-banner.js.map +1 -1
  38. package/dist/components/pennlibs-chat.js +2 -2
  39. package/dist/components/pennlibs-chat.js.map +1 -1
  40. package/dist/components/pennlibs-colors.js +2 -3
  41. package/dist/components/pennlibs-colors.js.map +1 -1
  42. package/dist/components/pennlibs-feedback.js +2 -2
  43. package/dist/components/pennlibs-feedback.js.map +1 -1
  44. package/dist/components/pennlibs-footer.js +2 -4
  45. package/dist/components/pennlibs-footer.js.map +1 -1
  46. package/dist/components/pennlibs-header.js +10 -41
  47. package/dist/components/pennlibs-header.js.map +1 -1
  48. package/dist/components/pennlibs-hero.d.ts +11 -0
  49. package/dist/components/pennlibs-hero.js +83 -0
  50. package/dist/components/pennlibs-hero.js.map +1 -0
  51. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  52. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  53. package/dist/{web/p-085cc320.js → esm/index-BQRdy1TQ.js} +339 -176
  54. package/dist/esm/index-BQRdy1TQ.js.map +1 -0
  55. package/dist/esm/index.js +2 -1
  56. package/dist/esm/index.js.map +1 -1
  57. package/dist/esm/loader.js +5 -4
  58. package/dist/esm/loader.js.map +1 -1
  59. package/dist/esm/pennlibs-banner.entry.js +3 -3
  60. package/dist/esm/pennlibs-banner.entry.js.map +1 -1
  61. package/dist/esm/pennlibs-chat.pennlibs-feedback.pennlibs-footer.pennlibs-header.pennlibs-hero.entry.js.map +1 -0
  62. package/dist/{web/p-9cc59a0b.entry.js → esm/pennlibs-chat_5.entry.js} +69 -49
  63. package/dist/esm/pennlibs-chat_5.entry.js.map +1 -0
  64. package/dist/esm/pennlibs-colors.entry.js +3 -4
  65. package/dist/esm/pennlibs-colors.entry.js.map +1 -1
  66. package/dist/esm/web.js +7 -5
  67. package/dist/esm/web.js.map +1 -1
  68. package/dist/types/components/pennlibs-header/pennlibs-header.d.ts +4 -3
  69. package/dist/types/components/pennlibs-hero/pennlibs-hero.d.ts +13 -0
  70. package/dist/types/components.d.ts +21 -0
  71. package/dist/types/stencil-public-runtime.d.ts +9 -0
  72. package/dist/web/index.esm.js +2 -1
  73. package/dist/web/index.esm.js.map +1 -1
  74. package/dist/web/loader.esm.js.map +1 -0
  75. package/dist/web/{p-1910ca46.entry.js → p-2edaa432.entry.js} +4 -5
  76. package/dist/web/p-2edaa432.entry.js.map +1 -0
  77. package/dist/{esm/index-99779d4a.js → web/p-BQRdy1TQ.js} +339 -176
  78. package/dist/web/p-BQRdy1TQ.js.map +1 -0
  79. package/dist/web/p-DQuL1Twl.js +6 -0
  80. package/dist/web/p-DQuL1Twl.js.map +1 -0
  81. package/dist/{esm/pennlibs-chat_4.entry.js → web/p-a921fec4.entry.js} +69 -49
  82. package/dist/web/p-a921fec4.entry.js.map +1 -0
  83. package/dist/web/{p-9cf4cb70.entry.js → p-dac033ee.entry.js} +4 -4
  84. package/dist/web/p-dac033ee.entry.js.map +1 -0
  85. package/dist/web/pennlibs-banner.entry.esm.js.map +1 -0
  86. package/dist/web/pennlibs-chat.pennlibs-feedback.pennlibs-footer.pennlibs-header.pennlibs-hero.entry.esm.js.map +1 -0
  87. package/dist/web/pennlibs-colors.entry.esm.js.map +1 -0
  88. package/dist/web/web.css +1 -0
  89. package/dist/web/web.esm.js +7 -5
  90. package/dist/web/web.esm.js.map +1 -1
  91. package/package.json +4 -4
  92. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  93. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  94. package/dist/cjs/index-c02f277e.js.map +0 -1
  95. package/dist/cjs/pennlibs-chat_4.cjs.entry.js.map +0 -1
  96. package/dist/collection/components/pennlibs-header/container.js +0 -8
  97. package/dist/collection/components/pennlibs-header/container.js.map +0 -1
  98. package/dist/esm/app-globals-0f993ce5.js +0 -5
  99. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  100. package/dist/esm/index-99779d4a.js.map +0 -1
  101. package/dist/esm/pennlibs-chat_4.entry.js.map +0 -1
  102. package/dist/types/components/pennlibs-header/container.d.ts +0 -8
  103. package/dist/web/p-085cc320.js.map +0 -1
  104. package/dist/web/p-1910ca46.entry.js.map +0 -1
  105. package/dist/web/p-9cc59a0b.entry.js.map +0 -1
  106. package/dist/web/p-9cf4cb70.entry.js.map +0 -1
  107. package/dist/web/p-e1255160.js +0 -5
  108. package/dist/web/p-e1255160.js.map +0 -1
  109. package/loader/package.json +0 -11
@@ -1,17 +1,30 @@
1
1
  const NAMESPACE = 'web';
2
- const BUILD = /* web */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: true, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: false, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: false };
2
+ const BUILD = /* web */ { hydratedSelectorName: "hydrated", lazyLoad: true, updatable: true, watchCallback: false };
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.20.0 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.29.3 | 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
- var hostRefs = /* @__PURE__ */ new WeakMap();
13
- var getHostRef = (ref) => hostRefs.get(ref);
14
- var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
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
18
+ var getHostRef = (ref) => {
19
+ if (ref.__stencil__getHostRef) {
20
+ return ref.__stencil__getHostRef();
21
+ }
22
+ return void 0;
23
+ };
24
+ var registerInstance = (lazyInstance, hostRef) => {
25
+ lazyInstance.__stencil__getHostRef = () => hostRef;
26
+ hostRef.$lazyInstance$ = lazyInstance;
27
+ };
15
28
  var registerHost = (hostElement, cmpMeta) => {
16
29
  const hostRef = {
17
30
  $flags$: 0,
@@ -24,7 +37,9 @@ var registerHost = (hostElement, cmpMeta) => {
24
37
  hostElement["s-p"] = [];
25
38
  hostElement["s-rc"] = [];
26
39
  }
27
- return hostRefs.set(hostElement, hostRef);
40
+ const ref = hostRef;
41
+ hostElement.__stencil__getHostRef = () => ref;
42
+ return ref;
28
43
  };
29
44
  var isMemberInElement = (elm, memberName) => memberName in elm;
30
45
  var consoleError = (e, el) => (0, console.error)(e, el);
@@ -48,20 +63,25 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
48
63
  /* webpackExclude: /\.system\.entry\.js$/ */
49
64
  /* webpackMode: "lazy" */
50
65
  `./${bundleId}.entry.js${""}`
51
- ).then((importedModule) => {
52
- {
53
- cmpModules.set(bundleId, importedModule);
66
+ ).then(
67
+ (importedModule) => {
68
+ {
69
+ cmpModules.set(bundleId, importedModule);
70
+ }
71
+ return importedModule[exportName];
72
+ },
73
+ (e) => {
74
+ consoleError(e, hostRef.$hostElement$);
54
75
  }
55
- return importedModule[exportName];
56
- }, consoleError);
76
+ );
57
77
  };
58
78
 
59
79
  // src/client/client-style.ts
60
80
  var styles = /* @__PURE__ */ new Map();
81
+ var HYDRATED_STYLE_ID = "sty-id";
61
82
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
62
83
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
63
84
  var win = typeof window !== "undefined" ? window : {};
64
- var doc = win.document || { head: {} };
65
85
  var plt = {
66
86
  $flags$: 0,
67
87
  $resourcesUrl$: "",
@@ -122,25 +142,22 @@ var getAssetPath = (path) => {
122
142
  return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
123
143
  };
124
144
  var setAssetPath = (path) => plt.$resourcesUrl$ = path;
125
-
126
- // src/utils/constants.ts
127
- var EMPTY_OBJ = {};
128
- var SVG_NS = "http://www.w3.org/2000/svg";
129
- var HTML_NS = "http://www.w3.org/1999/xhtml";
130
-
131
- // src/utils/helpers.ts
132
- var isDef = (v) => v != null;
133
145
  var isComplexType = (o) => {
134
146
  o = typeof o;
135
147
  return o === "object" || o === "function";
136
148
  };
137
149
 
138
150
  // src/utils/query-nonce-meta-tag-content.ts
139
- function queryNonceMetaTagContent(doc2) {
151
+ function queryNonceMetaTagContent(doc) {
140
152
  var _a, _b, _c;
141
- return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
153
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
142
154
  }
143
155
 
156
+ // src/utils/regular-expression.ts
157
+ var escapeRegExpSpecialCharacters = (text) => {
158
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
159
+ };
160
+
144
161
  // src/utils/result.ts
145
162
  var result_exports = {};
146
163
  __export(result_exports, {
@@ -304,6 +321,18 @@ var convertToPrivate = (node) => {
304
321
  vnode.$name$ = node.vname;
305
322
  return vnode;
306
323
  };
324
+ var createSupportsRuleRe = (selector) => {
325
+ const safeSelector2 = escapeRegExpSpecialCharacters(selector);
326
+ return new RegExp(
327
+ // First capture group: match any context before the selector that's not inside @supports selector()
328
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
329
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
330
+ "g"
331
+ );
332
+ };
333
+ createSupportsRuleRe("::slotted");
334
+ createSupportsRuleRe(":host");
335
+ createSupportsRuleRe(":host-context");
307
336
  var parsePropertyValue = (propValue, propType) => {
308
337
  if (propValue != null && !isComplexType(propValue)) {
309
338
  if (propType & 1 /* String */) {
@@ -321,9 +350,9 @@ var createEvent = (ref, name, flags) => {
321
350
  return {
322
351
  emit: (detail) => {
323
352
  return emitEvent(elm, name, {
324
- bubbles: !!(flags & 4 /* Bubbles */),
325
- composed: !!(flags & 2 /* Composed */),
326
- cancelable: !!(flags & 1 /* Cancellable */),
353
+ bubbles: true,
354
+ composed: true,
355
+ cancelable: true,
327
356
  detail
328
357
  });
329
358
  }
@@ -353,7 +382,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
353
382
  var _a;
354
383
  const scopeId2 = getScopeId(cmpMeta);
355
384
  const style = styles.get(scopeId2);
356
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
385
+ if (!win.document) {
386
+ return scopeId2;
387
+ }
388
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
357
389
  if (style) {
358
390
  if (typeof style === "string") {
359
391
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -364,23 +396,39 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
364
396
  }
365
397
  if (!appliedStyles.has(scopeId2)) {
366
398
  {
367
- styleElm = doc.createElement("style");
399
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
368
400
  styleElm.innerHTML = style;
369
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
401
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
370
402
  if (nonce != null) {
371
403
  styleElm.setAttribute("nonce", nonce);
372
404
  }
373
- const injectStyle = (
374
- /**
375
- * we render a scoped component
376
- */
377
- !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) || /**
378
- * we are using shadow dom and render the style tag within the shadowRoot
379
- */
380
- cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD"
381
- );
382
- if (injectStyle) {
383
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
405
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
406
+ if (styleContainerNode.nodeName === "HEAD") {
407
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
408
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
409
+ styleContainerNode.insertBefore(
410
+ styleElm,
411
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
412
+ );
413
+ } else if ("host" in styleContainerNode) {
414
+ if (supportsConstructableStylesheets) {
415
+ const stylesheet = new CSSStyleSheet();
416
+ stylesheet.replaceSync(style);
417
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
418
+ } else {
419
+ const existingStyleContainer = styleContainerNode.querySelector("style");
420
+ if (existingStyleContainer) {
421
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
422
+ } else {
423
+ styleContainerNode.prepend(styleElm);
424
+ }
425
+ }
426
+ } else {
427
+ styleContainerNode.append(styleElm);
428
+ }
429
+ }
430
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
431
+ styleContainerNode.insertBefore(styleElm, null);
384
432
  }
385
433
  }
386
434
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
@@ -404,117 +452,144 @@ var attachStyles = (hostRef) => {
404
452
  const scopeId2 = addStyle(
405
453
  elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
406
454
  cmpMeta);
407
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
455
+ if (flags & 10 /* needsScopedEncapsulation */) {
408
456
  elm["s-sc"] = scopeId2;
409
457
  elm.classList.add(scopeId2 + "-h");
410
458
  }
411
459
  endAttachStyles();
412
460
  };
413
461
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
414
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
415
- if (oldValue !== newValue) {
416
- let isProp = isMemberInElement(elm, memberName);
417
- let ln = memberName.toLowerCase();
418
- if (memberName === "class") {
419
- const classList = elm.classList;
420
- const oldClasses = parseClassList(oldValue);
421
- const newClasses = parseClassList(newValue);
462
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
463
+ if (oldValue === newValue) {
464
+ return;
465
+ }
466
+ let isProp = isMemberInElement(elm, memberName);
467
+ let ln = memberName.toLowerCase();
468
+ if (memberName === "class") {
469
+ const classList = elm.classList;
470
+ const oldClasses = parseClassList(oldValue);
471
+ let newClasses = parseClassList(newValue);
472
+ {
422
473
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
423
474
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
424
- } else if (memberName === "style") {
425
- {
426
- for (const prop in oldValue) {
427
- if (!newValue || newValue[prop] == null) {
428
- if (prop.includes("-")) {
429
- elm.style.removeProperty(prop);
430
- } else {
431
- elm.style[prop] = "";
432
- }
433
- }
434
- }
435
- }
436
- for (const prop in newValue) {
437
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
475
+ }
476
+ } else if (memberName === "style") {
477
+ {
478
+ for (const prop in oldValue) {
479
+ if (!newValue || newValue[prop] == null) {
438
480
  if (prop.includes("-")) {
439
- elm.style.setProperty(prop, newValue[prop]);
481
+ elm.style.removeProperty(prop);
440
482
  } else {
441
- elm.style[prop] = newValue[prop];
483
+ elm.style[prop] = "";
442
484
  }
443
485
  }
444
486
  }
445
- } else if (memberName === "key") ; else if (memberName === "ref") {
446
- if (newValue) {
447
- newValue(elm);
448
- }
449
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
450
- if (memberName[2] === "-") {
451
- memberName = memberName.slice(3);
452
- } else if (isMemberInElement(win, ln)) {
453
- memberName = ln.slice(2);
454
- } else {
455
- memberName = ln[2] + memberName.slice(3);
456
- }
457
- if (oldValue || newValue) {
458
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
459
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
460
- if (oldValue) {
461
- plt.rel(elm, memberName, oldValue, capture);
462
- }
463
- if (newValue) {
464
- plt.ael(elm, memberName, newValue, capture);
487
+ }
488
+ for (const prop in newValue) {
489
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
490
+ if (prop.includes("-")) {
491
+ elm.style.setProperty(prop, newValue[prop]);
492
+ } else {
493
+ elm.style[prop] = newValue[prop];
465
494
  }
466
495
  }
496
+ }
497
+ } else if (memberName === "key") ; else if (memberName === "ref") {
498
+ if (newValue) {
499
+ newValue(elm);
500
+ }
501
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
502
+ if (memberName[2] === "-") {
503
+ memberName = memberName.slice(3);
504
+ } else if (isMemberInElement(win, ln)) {
505
+ memberName = ln.slice(2);
467
506
  } else {
468
- const isComplex = isComplexType(newValue);
469
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
470
- try {
471
- if (!elm.tagName.includes("-")) {
472
- const n = newValue == null ? "" : newValue;
473
- if (memberName === "list") {
474
- isProp = false;
475
- } else if (oldValue == null || elm[memberName] != n) {
507
+ memberName = ln[2] + memberName.slice(3);
508
+ }
509
+ if (oldValue || newValue) {
510
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
511
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
512
+ if (oldValue) {
513
+ plt.rel(elm, memberName, oldValue, capture);
514
+ }
515
+ if (newValue) {
516
+ plt.ael(elm, memberName, newValue, capture);
517
+ }
518
+ }
519
+ } else {
520
+ const isComplex = isComplexType(newValue);
521
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
522
+ try {
523
+ if (!elm.tagName.includes("-")) {
524
+ const n = newValue == null ? "" : newValue;
525
+ if (memberName === "list") {
526
+ isProp = false;
527
+ } else if (oldValue == null || elm[memberName] != n) {
528
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
476
529
  elm[memberName] = n;
530
+ } else {
531
+ elm.setAttribute(memberName, n);
477
532
  }
478
- } else {
479
- elm[memberName] = newValue;
480
533
  }
481
- } catch (e) {
534
+ } else if (elm[memberName] !== newValue) {
535
+ elm[memberName] = newValue;
482
536
  }
537
+ } catch (e) {
483
538
  }
484
- if (newValue == null || newValue === false) {
485
- if (newValue !== false || elm.getAttribute(memberName) === "") {
486
- {
487
- elm.removeAttribute(memberName);
488
- }
489
- }
490
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
491
- newValue = newValue === true ? "" : newValue;
539
+ }
540
+ if (newValue == null || newValue === false) {
541
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
492
542
  {
493
- elm.setAttribute(memberName, newValue);
543
+ elm.removeAttribute(memberName);
494
544
  }
495
545
  }
546
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
547
+ newValue = newValue === true ? "" : newValue;
548
+ {
549
+ elm.setAttribute(memberName, newValue);
550
+ }
496
551
  }
497
552
  }
498
553
  };
499
554
  var parseClassListRegex = /\s/;
500
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
555
+ var parseClassList = (value) => {
556
+ if (typeof value === "object" && value && "baseVal" in value) {
557
+ value = value.baseVal;
558
+ }
559
+ if (!value || typeof value !== "string") {
560
+ return [];
561
+ }
562
+ return value.split(parseClassListRegex);
563
+ };
501
564
  var CAPTURE_EVENT_SUFFIX = "Capture";
502
565
  var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
503
566
 
504
567
  // src/runtime/vdom/update-element.ts
505
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
568
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
506
569
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
507
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
508
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
570
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
571
+ const newVnodeAttrs = newVnode.$attrs$ || {};
509
572
  {
510
573
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
511
574
  if (!(memberName in newVnodeAttrs)) {
512
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
575
+ setAccessor(
576
+ elm,
577
+ memberName,
578
+ oldVnodeAttrs[memberName],
579
+ void 0,
580
+ isSvgMode2,
581
+ newVnode.$flags$);
513
582
  }
514
583
  }
515
584
  }
516
585
  for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
517
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
586
+ setAccessor(
587
+ elm,
588
+ memberName,
589
+ oldVnodeAttrs[memberName],
590
+ newVnodeAttrs[memberName],
591
+ isSvgMode2,
592
+ newVnode.$flags$);
518
593
  }
519
594
  };
520
595
  function sortedAttrNames(attrNames) {
@@ -526,26 +601,27 @@ function sortedAttrNames(attrNames) {
526
601
  attrNames
527
602
  );
528
603
  }
529
-
530
- // src/runtime/vdom/vdom-render.ts
531
- var scopeId;
532
604
  var hostTagName;
533
- var useNativeShadowDom = false;
534
605
  var isSvgMode = false;
535
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
606
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
536
607
  const newVNode2 = newParentVNode.$children$[childIndex];
537
608
  let i2 = 0;
538
609
  let elm;
539
610
  let childNode;
540
611
  if (newVNode2.$text$ !== null) {
541
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
612
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
542
613
  } else {
543
614
  if (!isSvgMode) {
544
615
  isSvgMode = newVNode2.$tag$ === "svg";
545
616
  }
546
- elm = newVNode2.$elm$ = doc.createElementNS(
617
+ if (!win.document) {
618
+ throw new Error(
619
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
620
+ );
621
+ }
622
+ elm = newVNode2.$elm$ = win.document.createElementNS(
547
623
  isSvgMode ? SVG_NS : HTML_NS,
548
- !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
624
+ newVNode2.$tag$
549
625
  ) ;
550
626
  if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
551
627
  isSvgMode = false;
@@ -553,11 +629,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
553
629
  {
554
630
  updateElement(null, newVNode2, isSvgMode);
555
631
  }
556
- const rootNode = elm.getRootNode();
557
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
558
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
559
- elm.classList.add(elm["s-si"] = scopeId);
560
- }
561
632
  if (newVNode2.$children$) {
562
633
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
563
634
  childNode = createElm(oldParentVNode, newVNode2, i2);
@@ -694,6 +765,9 @@ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
694
765
  if (!isInitialRender) {
695
766
  return leftVNode.$key$ === rightVNode.$key$;
696
767
  }
768
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
769
+ leftVNode.$key$ = rightVNode.$key$;
770
+ }
697
771
  return true;
698
772
  }
699
773
  return false;
@@ -709,9 +783,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
709
783
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
710
784
  }
711
785
  {
712
- if (tag === "slot" && !useNativeShadowDom) ; else {
713
- updateElement(oldVNode, newVNode2, isSvgMode);
714
- }
786
+ updateElement(oldVNode, newVNode2, isSvgMode);
715
787
  }
716
788
  if (oldChildren !== null && newChildren !== null) {
717
789
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -740,14 +812,15 @@ var nullifyVNodeRefs = (vNode) => {
740
812
  }
741
813
  };
742
814
  var insertBefore = (parent, newNode, reference) => {
743
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
744
- return inserted;
815
+ {
816
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
817
+ }
745
818
  };
746
819
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
747
820
  const hostElm = hostRef.$hostElement$;
748
- const cmpMeta = hostRef.$cmpMeta$;
749
821
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
750
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
822
+ const isHostElement = isHost(renderFnResults);
823
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
751
824
  hostTagName = hostElm.tagName;
752
825
  if (isInitialLoad && rootVnode.$attrs$) {
753
826
  for (const key of Object.keys(rootVnode.$attrs$)) {
@@ -760,17 +833,20 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
760
833
  rootVnode.$flags$ |= 4 /* isHost */;
761
834
  hostRef.$vnode$ = rootVnode;
762
835
  rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
763
- {
764
- scopeId = hostElm["s-sc"];
765
- }
766
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
767
836
  patch(oldVNode, rootVnode, isInitialLoad);
768
837
  };
769
838
 
770
839
  // src/runtime/update-component.ts
771
840
  var attachToAncestor = (hostRef, ancestorComponent) => {
772
841
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
773
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
842
+ const index = ancestorComponent["s-p"].push(
843
+ new Promise(
844
+ (r) => hostRef.$onRenderResolve$ = () => {
845
+ ancestorComponent["s-p"].splice(index - 1, 1);
846
+ r();
847
+ }
848
+ )
849
+ );
774
850
  }
775
851
  };
776
852
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -796,10 +872,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
796
872
  }
797
873
  let maybePromise;
798
874
  if (isInitialLoad) {
799
- {
800
- maybePromise = safeCall(instance, "componentWillLoad");
801
- }
875
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
876
+ } else {
877
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
802
878
  }
879
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
803
880
  endSchedule();
804
881
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
805
882
  };
@@ -842,7 +919,7 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
842
919
  try {
843
920
  instance = instance.render() ;
844
921
  {
845
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
922
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
846
923
  }
847
924
  {
848
925
  hostRef.$flags$ |= 2 /* hasRendered */;
@@ -865,14 +942,13 @@ var postUpdateComponent = (hostRef) => {
865
942
  const endPostUpdate = createTime("postUpdate", tagName);
866
943
  const instance = hostRef.$lazyInstance$ ;
867
944
  const ancestorComponent = hostRef.$ancestorComponent$;
868
- {
869
- safeCall(instance, "componentDidRender");
870
- }
945
+ safeCall(instance, "componentDidRender", void 0, elm);
871
946
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
872
947
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
873
948
  {
874
949
  addHydratedFlag(elm);
875
950
  }
951
+ safeCall(instance, "componentDidLoad", void 0, elm);
876
952
  endPostUpdate();
877
953
  {
878
954
  hostRef.$onReadyResolve$(elm);
@@ -881,6 +957,7 @@ var postUpdateComponent = (hostRef) => {
881
957
  }
882
958
  }
883
959
  } else {
960
+ safeCall(instance, "componentDidUpdate", void 0, elm);
884
961
  endPostUpdate();
885
962
  }
886
963
  {
@@ -891,21 +968,18 @@ var postUpdateComponent = (hostRef) => {
891
968
  if (hostRef.$flags$ & 512 /* needsRerender */) {
892
969
  nextTick(() => scheduleUpdate(hostRef, false));
893
970
  }
894
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
971
+ hostRef.$flags$ &= -517;
895
972
  }
896
973
  };
897
974
  var appDidLoad = (who) => {
898
- {
899
- addHydratedFlag(doc.documentElement);
900
- }
901
975
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
902
976
  };
903
- var safeCall = (instance, method, arg) => {
977
+ var safeCall = (instance, method, arg, elm) => {
904
978
  if (instance && instance[method]) {
905
979
  try {
906
980
  return instance[method](arg);
907
981
  } catch (e) {
908
- consoleError(e);
982
+ consoleError(e, elm);
909
983
  }
910
984
  }
911
985
  return void 0;
@@ -921,7 +995,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
921
995
  const hostRef = getHostRef(ref);
922
996
  if (!hostRef) {
923
997
  throw new Error(
924
- `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
998
+ `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
925
999
  );
926
1000
  }
927
1001
  const oldVal = hostRef.$instanceValues$.get(propName);
@@ -934,6 +1008,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
934
1008
  hostRef.$instanceValues$.set(propName, newVal);
935
1009
  if (instance) {
936
1010
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1011
+ if (instance.componentShouldUpdate) {
1012
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1013
+ return;
1014
+ }
1015
+ }
937
1016
  scheduleUpdate(hostRef, false);
938
1017
  }
939
1018
  }
@@ -944,19 +1023,72 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
944
1023
  var proxyComponent = (Cstr, cmpMeta, flags) => {
945
1024
  var _a, _b;
946
1025
  const prototype = Cstr.prototype;
947
- if (cmpMeta.$members$ || BUILD.watchCallback ) {
1026
+ if (cmpMeta.$members$ || BUILD.watchCallback) {
948
1027
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
949
1028
  members.map(([memberName, [memberFlags]]) => {
950
1029
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1030
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
1031
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1032
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1033
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1034
+ Object.defineProperty(prototype, memberName, {
1035
+ get() {
1036
+ {
1037
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1038
+ return getValue(this, memberName);
1039
+ }
1040
+ const ref = getHostRef(this);
1041
+ const instance = ref ? ref.$lazyInstance$ : prototype;
1042
+ if (!instance) return;
1043
+ return instance[memberName];
1044
+ }
1045
+ },
1046
+ configurable: true,
1047
+ enumerable: true
1048
+ });
1049
+ }
951
1050
  Object.defineProperty(prototype, memberName, {
952
- get() {
953
- return getValue(this, memberName);
954
- },
955
1051
  set(newValue) {
956
- setValue(this, memberName, newValue, cmpMeta);
957
- },
958
- configurable: true,
959
- enumerable: true
1052
+ const ref = getHostRef(this);
1053
+ if (origSetter) {
1054
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1055
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1056
+ newValue = ref.$instanceValues$.get(memberName);
1057
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
1058
+ ref.$instanceValues$.set(memberName, currentValue);
1059
+ }
1060
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
1061
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1062
+ setValue(this, memberName, newValue, cmpMeta);
1063
+ return;
1064
+ }
1065
+ {
1066
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1067
+ setValue(this, memberName, newValue, cmpMeta);
1068
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1069
+ ref.$onReadyPromise$.then(() => {
1070
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1071
+ ref.$lazyInstance$[memberName] = newValue;
1072
+ }
1073
+ });
1074
+ }
1075
+ return;
1076
+ }
1077
+ const setterSetVal = () => {
1078
+ const currentValue = ref.$lazyInstance$[memberName];
1079
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
1080
+ ref.$instanceValues$.set(memberName, currentValue);
1081
+ }
1082
+ ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
1083
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1084
+ };
1085
+ if (ref.$lazyInstance$) {
1086
+ setterSetVal();
1087
+ } else {
1088
+ ref.$onReadyPromise$.then(() => setterSetVal());
1089
+ }
1090
+ }
1091
+ }
960
1092
  });
961
1093
  }
962
1094
  });
@@ -966,7 +1098,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
966
1098
  plt.jmp(() => {
967
1099
  var _a2;
968
1100
  const propName = attrNameToPropName.get(attrName);
969
- if (this.hasOwnProperty(propName)) {
1101
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
970
1102
  newValue = this[propName];
971
1103
  delete this[propName];
972
1104
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
@@ -986,7 +1118,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
986
1118
  }
987
1119
  return;
988
1120
  }
989
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1121
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1122
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1123
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
1124
+ this[propName] = newValue;
1125
+ }
990
1126
  });
991
1127
  };
992
1128
  Cstr.observedAttributes = Array.from(
@@ -1011,7 +1147,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1011
1147
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1012
1148
  const bundleId = cmpMeta.$lazyBundleId$;
1013
1149
  if (bundleId) {
1014
- const CstrImport = loadModule(cmpMeta);
1150
+ const CstrImport = loadModule(cmpMeta, hostRef);
1015
1151
  if (CstrImport && "then" in CstrImport) {
1016
1152
  const endLoad = uniqueTime();
1017
1153
  Cstr = await CstrImport;
@@ -1033,13 +1169,13 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1033
1169
  try {
1034
1170
  new Cstr(hostRef);
1035
1171
  } catch (e) {
1036
- consoleError(e);
1172
+ consoleError(e, elm);
1037
1173
  }
1038
1174
  {
1039
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1175
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
1040
1176
  }
1041
1177
  endNewInstance();
1042
- fireConnectedCallback(hostRef.$lazyInstance$);
1178
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1043
1179
  } else {
1044
1180
  Cstr = elm.constructor;
1045
1181
  const cmpTag = elm.localName;
@@ -1066,9 +1202,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1066
1202
  schedule();
1067
1203
  }
1068
1204
  };
1069
- var fireConnectedCallback = (instance) => {
1205
+ var fireConnectedCallback = (instance, elm) => {
1070
1206
  {
1071
- safeCall(instance, "connectedCallback");
1207
+ safeCall(instance, "connectedCallback", void 0, elm);
1072
1208
  }
1073
1209
  };
1074
1210
 
@@ -1103,40 +1239,55 @@ var connectedCallback = (elm) => {
1103
1239
  }
1104
1240
  } else {
1105
1241
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1106
- fireConnectedCallback(hostRef.$lazyInstance$);
1242
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1107
1243
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1108
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
1244
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1109
1245
  }
1110
1246
  }
1111
1247
  endConnected();
1112
1248
  }
1113
1249
  };
1114
- var disconnectInstance = (instance) => {
1250
+ var disconnectInstance = (instance, elm) => {
1251
+ {
1252
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1253
+ }
1115
1254
  };
1116
1255
  var disconnectedCallback = async (elm) => {
1117
1256
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1118
1257
  const hostRef = getHostRef(elm);
1119
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1120
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1258
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1259
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1260
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1261
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1121
1262
  }
1122
1263
  }
1264
+ if (rootAppliedStyles.has(elm)) {
1265
+ rootAppliedStyles.delete(elm);
1266
+ }
1267
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1268
+ rootAppliedStyles.delete(elm.shadowRoot);
1269
+ }
1123
1270
  };
1124
1271
 
1125
1272
  // src/runtime/bootstrap-lazy.ts
1126
1273
  var bootstrapLazy = (lazyBundles, options = {}) => {
1127
1274
  var _a;
1275
+ if (!win.document) {
1276
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1277
+ return;
1278
+ }
1128
1279
  const endBootstrap = createTime();
1129
1280
  const cmpTags = [];
1130
1281
  const exclude = options.exclude || [];
1131
1282
  const customElements2 = win.customElements;
1132
- const head = doc.head;
1283
+ const head = win.document.head;
1133
1284
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1134
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
1285
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1135
1286
  const deferredConnectedCallbacks = [];
1136
1287
  let appLoadFallback;
1137
1288
  let isBootstrapping = true;
1138
1289
  Object.assign(plt, options);
1139
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
1290
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1140
1291
  let hasSlotRelocation = false;
1141
1292
  lazyBundles.map((lazyBundle) => {
1142
1293
  lazyBundle[1].map((compactMeta) => {
@@ -1193,6 +1344,17 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1193
1344
  }
1194
1345
  disconnectedCallback() {
1195
1346
  plt.jmp(() => disconnectedCallback(this));
1347
+ plt.raf(() => {
1348
+ var _a3;
1349
+ const hostRef = getHostRef(this);
1350
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1351
+ if (i2 > -1) {
1352
+ deferredConnectedCallbacks.splice(i2, 1);
1353
+ }
1354
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1355
+ delete hostRef.$vnode$.$elm$;
1356
+ }
1357
+ });
1196
1358
  }
1197
1359
  componentOnReady() {
1198
1360
  return getHostRef(this).$onReadyPromise$;
@@ -1217,7 +1379,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1217
1379
  }
1218
1380
  if (dataStyles.innerHTML.length) {
1219
1381
  dataStyles.setAttribute("data-styles", "");
1220
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1382
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1221
1383
  if (nonce != null) {
1222
1384
  dataStyles.setAttribute("nonce", nonce);
1223
1385
  }
@@ -1238,6 +1400,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1238
1400
  // src/runtime/nonce.ts
1239
1401
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1240
1402
 
1241
- export { setAssetPath as a, bootstrapLazy as b, createEvent as c, getElement as d, getAssetPath as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1403
+ export { getElement as a, bootstrapLazy as b, createEvent as c, setAssetPath as d, getAssetPath as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1404
+ //# sourceMappingURL=p-BQRdy1TQ.js.map
1242
1405
 
1243
- //# sourceMappingURL=index-99779d4a.js.map
1406
+ //# sourceMappingURL=p-BQRdy1TQ.js.map