@uh-design-system/component-library 0.4.0 → 0.4.2

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 (151) hide show
  1. package/dist/cjs/component-library.cjs.js +3 -3
  2. package/dist/cjs/controlUtils-041de0fd.js +7 -0
  3. package/dist/cjs/ds-accordion_3.cjs.entry.js +27 -20
  4. package/dist/cjs/ds-checkbox-group.cjs.entry.js +156 -0
  5. package/dist/cjs/ds-checkbox.cjs.entry.js +153 -0
  6. package/dist/cjs/ds-input-validity.cjs.entry.js +38 -0
  7. package/dist/cjs/ds-link-with-arrow.cjs.entry.js +8 -7
  8. package/dist/cjs/ds-link.cjs.entry.js +11 -8
  9. package/dist/cjs/ds-text-input.cjs.entry.js +30 -6
  10. package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
  11. package/dist/cjs/{index-bfa0f441.js → index-b2bddcf4.js} +326 -125
  12. package/dist/cjs/{linkUtils-695da37c.js → linkUtils-e911e899.js} +10 -0
  13. package/dist/cjs/loader.cjs.js +2 -2
  14. package/dist/cjs/utils-c9113835.js +18 -0
  15. package/dist/collection/accessibility/accessibility.stories.js +10 -0
  16. package/dist/collection/accessibility/stories/ariaLabel.stories.js +19 -0
  17. package/dist/collection/accessibility/stories/ariaLabelledBy.stories.js +49 -0
  18. package/dist/collection/accessibility/stories/naming.stories.js +39 -0
  19. package/dist/collection/collection-manifest.json +4 -1
  20. package/dist/collection/components/00-foundations/icons/categories/information.js +4 -0
  21. package/dist/collection/components/00-foundations/typography/stories/typography.stories.js +133 -48
  22. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +1 -1
  23. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
  24. package/dist/collection/components/01-base-components/ds-button/ds-button.css +9 -9
  25. package/dist/collection/components/01-base-components/ds-button/ds-button.js +2 -2
  26. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +53 -12
  27. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +88 -55
  28. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +1 -1
  29. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +144 -0
  30. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +429 -0
  31. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.js +115 -0
  32. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +37 -0
  33. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +38 -0
  34. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +445 -0
  35. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +89 -0
  36. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.js +47 -0
  37. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
  38. package/dist/collection/components/01-base-components/ds-icon/{ds-icon.stories.js → stories/ds-icon.stories.js} +12 -2
  39. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.css +31 -0
  40. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +114 -0
  41. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.js +17 -0
  42. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +21 -0
  43. package/dist/collection/components/01-base-components/ds-link/ds-link.css +19 -139
  44. package/dist/collection/components/01-base-components/ds-link/ds-link.js +68 -8
  45. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +6 -2
  46. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +2 -2
  47. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +15 -4
  48. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +1 -139
  49. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +25 -5
  50. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.js → ds-link-with-arrow.examples.stories.js} +26 -3
  51. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.js → ds-link-with-arrow.stories.js} +5 -4
  52. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +8 -11
  53. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +30 -5
  54. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +29 -7
  55. package/dist/collection/components/01-base-components/ds-text-input/utils.js +0 -6
  56. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  57. package/dist/collection/utils/controls/controlUtils.js +2 -0
  58. package/dist/collection/utils/link/linkUtils.js +9 -0
  59. package/dist/collection/utils/typography/typographyUtils.js +39 -0
  60. package/dist/collection/utils/utils.js +24 -6
  61. package/dist/component-library/component-library.css +1 -1
  62. package/dist/component-library/component-library.esm.js +1 -1
  63. package/dist/component-library/controlUtils-9ca4087b.js +1 -0
  64. package/dist/component-library/ds-accordion_3.entry.js +1 -1
  65. package/dist/component-library/ds-checkbox-group.entry.js +1 -0
  66. package/dist/component-library/ds-checkbox.entry.js +1 -0
  67. package/dist/component-library/ds-input-validity.entry.js +1 -0
  68. package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
  69. package/dist/component-library/ds-link.entry.js +1 -1
  70. package/dist/component-library/ds-text-input.entry.js +1 -1
  71. package/dist/component-library/ds-visually-hidden.entry.js +1 -1
  72. package/dist/component-library/index-50783b0c.js +2 -0
  73. package/dist/component-library/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +1 -1
  74. package/dist/component-library/utils-b5843ae1.js +1 -0
  75. package/dist/components/attributes.js +1 -80
  76. package/dist/components/controlUtils.js +4 -0
  77. package/dist/components/ds-accordion.js +8 -8
  78. package/dist/components/ds-button2.js +4 -3
  79. package/dist/components/ds-checkbox-group.d.ts +11 -0
  80. package/dist/components/ds-checkbox-group.js +206 -0
  81. package/dist/components/ds-checkbox.d.ts +11 -0
  82. package/dist/components/ds-checkbox.js +6 -0
  83. package/dist/components/ds-checkbox2.js +185 -0
  84. package/dist/components/ds-icon2.js +24 -4
  85. package/dist/components/ds-input-validity.d.ts +11 -0
  86. package/dist/components/ds-input-validity.js +6 -0
  87. package/dist/components/ds-input-validity2.js +59 -0
  88. package/dist/components/ds-link-with-arrow.js +10 -8
  89. package/dist/components/ds-link.js +15 -9
  90. package/dist/components/ds-text-input.js +30 -7
  91. package/dist/components/ds-visually-hidden2.js +1 -1
  92. package/dist/components/index2.js +298 -130
  93. package/dist/components/index3.js +80 -0
  94. package/dist/components/linkUtils.js +10 -1
  95. package/dist/esm/component-library.js +4 -4
  96. package/dist/esm/controlUtils-9ca4087b.js +4 -0
  97. package/dist/esm/ds-accordion_3.entry.js +25 -18
  98. package/dist/esm/ds-checkbox-group.entry.js +152 -0
  99. package/dist/esm/ds-checkbox.entry.js +149 -0
  100. package/dist/esm/ds-input-validity.entry.js +34 -0
  101. package/dist/esm/ds-link-with-arrow.entry.js +8 -7
  102. package/dist/esm/ds-link.entry.js +11 -8
  103. package/dist/esm/ds-text-input.entry.js +30 -6
  104. package/dist/esm/ds-visually-hidden.entry.js +2 -2
  105. package/dist/esm/{index-42701395.js → index-50783b0c.js} +326 -126
  106. package/dist/esm/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +10 -1
  107. package/dist/esm/loader.js +3 -3
  108. package/dist/esm/utils-b5843ae1.js +15 -0
  109. package/dist/types/accessibility/accessibility.stories.d.ts +3 -0
  110. package/dist/types/accessibility/stories/ariaLabel.stories.d.ts +5 -0
  111. package/dist/types/accessibility/stories/ariaLabelledBy.stories.d.ts +4 -0
  112. package/dist/types/accessibility/stories/naming.stories.d.ts +4 -0
  113. package/dist/types/components/00-foundations/typography/stories/typography.stories.d.ts +1 -0
  114. package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +2 -0
  115. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +4 -1
  116. package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +49 -0
  117. package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.d.ts +13 -0
  118. package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.d.ts +7 -0
  119. package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +56 -0
  120. package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.d.ts +11 -0
  121. package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.d.ts +7 -0
  122. package/dist/types/components/01-base-components/ds-icon/{ds-icon.stories.d.ts → stories/ds-icon.stories.d.ts} +2 -1
  123. package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +12 -0
  124. package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.d.ts +7 -0
  125. package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.d.ts +7 -0
  126. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +4 -1
  127. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -0
  128. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +5 -0
  129. package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +0 -1
  130. package/dist/types/components.d.ts +142 -2
  131. package/dist/types/utils/controls/controlUtils.d.ts +2 -0
  132. package/dist/types/utils/link/linkUtils.d.ts +1 -0
  133. package/dist/types/utils/typography/typographyUtils.d.ts +5 -0
  134. package/dist/types/utils/utils.d.ts +10 -3
  135. package/package.json +19 -18
  136. package/dist/cjs/utils-8b73aa91.js +0 -10
  137. package/dist/collection/components/00-foundations/typography/typography.stories.js +0 -68
  138. package/dist/component-library/index-42701395.js +0 -2
  139. package/dist/component-library/utils-cca2a41a.js +0 -1
  140. package/dist/components/utils.js +0 -8
  141. package/dist/esm/utils-cca2a41a.js +0 -8
  142. package/dist/types/components/00-foundations/typography/typography.stories.d.ts +0 -7
  143. /package/dist/cjs/{attributes-f7831329.js → attributes-5f5b58be.js} +0 -0
  144. /package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.js → ds-link-with-arrow.features.stories.js} +0 -0
  145. /package/dist/collection/utils/{attributes.js → attributes/attributes.js} +0 -0
  146. /package/dist/component-library/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
  147. /package/dist/esm/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
  148. /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.d.ts → ds-link-with-arrow.examples.stories.d.ts} +0 -0
  149. /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.d.ts → ds-link-with-arrow.features.stories.d.ts} +0 -0
  150. /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.d.ts → ds-link-with-arrow.stories.d.ts} +0 -0
  151. /package/dist/types/utils/{attributes.d.ts → attributes/attributes.d.ts} +0 -0
@@ -21,10 +21,10 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'component-library';
24
- const BUILD = /* component-library */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, 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: true, mode: false, modernPropertyDecls: true, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, 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: true, watchCallback: true };
24
+ const BUILD = /* component-library */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, constructableCSS: true, cssAnnotations: true, devTools: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: true, hasRenderFn: true, hostListener: true, 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: true, mode: false, modernPropertyDecls: true, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, 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: true, watchCallback: true };
25
25
 
26
26
  /*
27
- Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
27
+ Stencil Client Platform v4.27.2 | MIT Licensed | https://stenciljs.com
28
28
  */
29
29
  var __defProp = Object.defineProperty;
30
30
  var __export = (target, all) => {
@@ -57,10 +57,15 @@ var reWireGetterSetter = (instance, hostRef) => {
57
57
  };
58
58
 
59
59
  // src/client/client-host-ref.ts
60
- var hostRefs = /* @__PURE__ */ new WeakMap();
61
- var getHostRef = (ref) => hostRefs.get(ref);
60
+ var getHostRef = (ref) => {
61
+ if (ref.__stencil__getHostRef) {
62
+ return ref.__stencil__getHostRef();
63
+ }
64
+ return void 0;
65
+ };
62
66
  var registerInstance = (lazyInstance, hostRef) => {
63
- hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
67
+ lazyInstance.__stencil__getHostRef = () => hostRef;
68
+ hostRef.$lazyInstance$ = lazyInstance;
64
69
  {
65
70
  reWireGetterSetter(lazyInstance, hostRef);
66
71
  }
@@ -80,7 +85,8 @@ var registerHost = (hostElement, cmpMeta) => {
80
85
  hostElement["s-p"] = [];
81
86
  hostElement["s-rc"] = [];
82
87
  }
83
- const ref = hostRefs.set(hostElement, hostRef);
88
+ const ref = hostRef;
89
+ hostElement.__stencil__getHostRef = () => ref;
84
90
  return ref;
85
91
  };
86
92
  var isMemberInElement = (elm, memberName) => memberName in elm;
@@ -124,8 +130,13 @@ var HYDRATED_STYLE_ID = "sty-id";
124
130
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
125
131
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
126
132
  var XLINK_NS = "http://www.w3.org/1999/xlink";
133
+ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
134
+ "formAssociatedCallback",
135
+ "formResetCallback",
136
+ "formDisabledCallback",
137
+ "formStateRestoreCallback"
138
+ ];
127
139
  var win = typeof window !== "undefined" ? window : {};
128
- var doc = win.document || { head: {} };
129
140
  var plt = {
130
141
  $flags$: 0,
131
142
  $resourcesUrl$: "",
@@ -135,6 +146,23 @@ var plt = {
135
146
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
136
147
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
137
148
  };
149
+ var supportsListenerOptions = /* @__PURE__ */ (() => {
150
+ var _a;
151
+ let supportsListenerOptions2 = false;
152
+ try {
153
+ (_a = win.document) == null ? void 0 : _a.addEventListener(
154
+ "e",
155
+ null,
156
+ Object.defineProperty({}, "passive", {
157
+ get() {
158
+ supportsListenerOptions2 = true;
159
+ }
160
+ })
161
+ );
162
+ } catch (e) {
163
+ }
164
+ return supportsListenerOptions2;
165
+ })();
138
166
  var promiseResolve = (v) => Promise.resolve(v);
139
167
  var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
140
168
  try {
@@ -188,9 +216,9 @@ var isComplexType = (o) => {
188
216
  };
189
217
 
190
218
  // src/utils/query-nonce-meta-tag-content.ts
191
- function queryNonceMetaTagContent(doc2) {
219
+ function queryNonceMetaTagContent(doc) {
192
220
  var _a, _b, _c;
193
- 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;
221
+ 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;
194
222
  }
195
223
 
196
224
  // src/utils/result.ts
@@ -242,12 +270,11 @@ var unwrapErr = (result) => {
242
270
  }
243
271
  };
244
272
  var updateFallbackSlotVisibility = (elm) => {
245
- const childNodes = elm.__childNodes || elm.childNodes;
273
+ const childNodes = internalCall(elm, "childNodes");
246
274
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
247
275
  getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
248
- var _a;
249
276
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
250
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
277
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
251
278
  slotNode.hidden = true;
252
279
  } else {
253
280
  slotNode.hidden = false;
@@ -255,19 +282,31 @@ var updateFallbackSlotVisibility = (elm) => {
255
282
  }
256
283
  });
257
284
  }
258
- for (const childNode of childNodes) {
259
- if (childNode.nodeType === 1 /* ElementNode */ && (childNode.__childNodes || childNode.childNodes).length) {
285
+ let i2 = 0;
286
+ for (i2 = 0; i2 < childNodes.length; i2++) {
287
+ const childNode = childNodes[i2];
288
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
260
289
  updateFallbackSlotVisibility(childNode);
261
290
  }
262
291
  }
263
292
  };
293
+ var getSlottedChildNodes = (childNodes) => {
294
+ const result = [];
295
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
296
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
297
+ if (slottedNode && slottedNode.isConnected) {
298
+ result.push(slottedNode);
299
+ }
300
+ }
301
+ return result;
302
+ };
264
303
  function getHostSlotNodes(childNodes, hostName, slotName) {
265
304
  let i2 = 0;
266
305
  let slottedNodes = [];
267
306
  let childNode;
268
307
  for (; i2 < childNodes.length; i2++) {
269
308
  childNode = childNodes[i2];
270
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
309
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
271
310
  slottedNodes.push(childNode);
272
311
  if (typeof slotName !== "undefined") return slottedNodes;
273
312
  }
@@ -275,11 +314,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
275
314
  }
276
315
  return slottedNodes;
277
316
  }
278
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
317
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
279
318
  const childNodes = [];
280
- if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
281
- while ((node = node.nextSibling) && node["s-sn"] === slotName) {
282
- childNodes.push(node);
319
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
320
+ let node = slot;
321
+ while (node = node.nextSibling) {
322
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
283
323
  }
284
324
  return childNodes;
285
325
  };
@@ -298,6 +338,44 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
298
338
  }
299
339
  return slotName === "";
300
340
  };
341
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
342
+ function patchSlotNode(node) {
343
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
344
+ const assignedFactory = (elementsOnly) => (function(opts) {
345
+ const toReturn = [];
346
+ const slotName = this["s-sn"];
347
+ if (opts == null ? void 0 : opts.flatten) {
348
+ console.error(`
349
+ Flattening is not supported for Stencil non-shadow slots.
350
+ You can use \`.childNodes\` to nested slot fallback content.
351
+ If you have a particular use case, please open an issue on the Stencil repo.
352
+ `);
353
+ }
354
+ const parent = this["s-cr"].parentElement;
355
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
356
+ slottedNodes.forEach((n) => {
357
+ if (slotName === getSlotName(n)) {
358
+ toReturn.push(n);
359
+ }
360
+ });
361
+ if (elementsOnly) {
362
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
363
+ }
364
+ return toReturn;
365
+ }).bind(node);
366
+ node.assignedElements = assignedFactory(true);
367
+ node.assignedNodes = assignedFactory(false);
368
+ }
369
+ function internalCall(node, method) {
370
+ if ("__" + method in node) {
371
+ const toReturn = node["__" + method];
372
+ if (typeof toReturn !== "function") return toReturn;
373
+ return toReturn.bind(node);
374
+ } else {
375
+ if (typeof node[method] !== "function") return node[method];
376
+ return node[method].bind(node);
377
+ }
378
+ }
301
379
  var createTime = (fnName, tagName = "") => {
302
380
  {
303
381
  return () => {
@@ -439,6 +517,21 @@ var parsePropertyValue = (propValue, propType) => {
439
517
  return propValue;
440
518
  };
441
519
  var getElement = (ref) => getHostRef(ref).$hostElement$ ;
520
+
521
+ // src/runtime/event-emitter.ts
522
+ var createEvent = (ref, name, flags) => {
523
+ const elm = getElement(ref);
524
+ return {
525
+ emit: (detail) => {
526
+ return emitEvent(elm, name, {
527
+ bubbles: !!(flags & 4 /* Bubbles */),
528
+ composed: !!(flags & 2 /* Composed */),
529
+ cancelable: !!(flags & 1 /* Cancellable */),
530
+ detail
531
+ });
532
+ }
533
+ };
534
+ };
442
535
  var emitEvent = (elm, name, opts) => {
443
536
  const ev = plt.ce(name, opts);
444
537
  elm.dispatchEvent(ev);
@@ -463,7 +556,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
463
556
  var _a;
464
557
  const scopeId2 = getScopeId(cmpMeta);
465
558
  const style = styles.get(scopeId2);
466
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
559
+ if (!win.document) {
560
+ return scopeId2;
561
+ }
562
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
467
563
  if (style) {
468
564
  if (typeof style === "string") {
469
565
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -474,9 +570,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
474
570
  }
475
571
  if (!appliedStyles.has(scopeId2)) {
476
572
  {
477
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
573
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
478
574
  styleElm.innerHTML = style;
479
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
575
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
480
576
  if (nonce != null) {
481
577
  styleElm.setAttribute("nonce", nonce);
482
578
  }
@@ -538,104 +634,105 @@ var attachStyles = (hostRef) => {
538
634
  };
539
635
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
540
636
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
541
- if (oldValue !== newValue) {
542
- let isProp = isMemberInElement(elm, memberName);
543
- let ln = memberName.toLowerCase();
544
- if (memberName === "class") {
545
- const classList = elm.classList;
546
- const oldClasses = parseClassList(oldValue);
547
- let newClasses = parseClassList(newValue);
548
- {
549
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
550
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
551
- }
552
- } else if (memberName === "style") {
553
- {
554
- for (const prop in oldValue) {
555
- if (!newValue || newValue[prop] == null) {
556
- if (prop.includes("-")) {
557
- elm.style.removeProperty(prop);
558
- } else {
559
- elm.style[prop] = "";
560
- }
561
- }
562
- }
563
- }
564
- for (const prop in newValue) {
565
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
637
+ if (oldValue === newValue) {
638
+ return;
639
+ }
640
+ let isProp = isMemberInElement(elm, memberName);
641
+ let ln = memberName.toLowerCase();
642
+ if (memberName === "class") {
643
+ const classList = elm.classList;
644
+ const oldClasses = parseClassList(oldValue);
645
+ let newClasses = parseClassList(newValue);
646
+ {
647
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
648
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
649
+ }
650
+ } else if (memberName === "style") {
651
+ {
652
+ for (const prop in oldValue) {
653
+ if (!newValue || newValue[prop] == null) {
566
654
  if (prop.includes("-")) {
567
- elm.style.setProperty(prop, newValue[prop]);
655
+ elm.style.removeProperty(prop);
568
656
  } else {
569
- elm.style[prop] = newValue[prop];
657
+ elm.style[prop] = "";
570
658
  }
571
659
  }
572
660
  }
573
- } else if (memberName === "key") ; else if (memberName === "ref") {
574
- if (newValue) {
575
- newValue(elm);
576
- }
577
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
578
- if (memberName[2] === "-") {
579
- memberName = memberName.slice(3);
580
- } else if (isMemberInElement(win, ln)) {
581
- memberName = ln.slice(2);
582
- } else {
583
- memberName = ln[2] + memberName.slice(3);
584
- }
585
- if (oldValue || newValue) {
586
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
587
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
588
- if (oldValue) {
589
- plt.rel(elm, memberName, oldValue, capture);
590
- }
591
- if (newValue) {
592
- plt.ael(elm, memberName, newValue, capture);
661
+ }
662
+ for (const prop in newValue) {
663
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
664
+ if (prop.includes("-")) {
665
+ elm.style.setProperty(prop, newValue[prop]);
666
+ } else {
667
+ elm.style[prop] = newValue[prop];
593
668
  }
594
669
  }
670
+ }
671
+ } else if (memberName === "key") ; else if (memberName === "ref") {
672
+ if (newValue) {
673
+ newValue(elm);
674
+ }
675
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
676
+ if (memberName[2] === "-") {
677
+ memberName = memberName.slice(3);
678
+ } else if (isMemberInElement(win, ln)) {
679
+ memberName = ln.slice(2);
595
680
  } else {
596
- const isComplex = isComplexType(newValue);
597
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
598
- try {
599
- if (!elm.tagName.includes("-")) {
600
- const n = newValue == null ? "" : newValue;
601
- if (memberName === "list") {
602
- isProp = false;
603
- } else if (oldValue == null || elm[memberName] != n) {
604
- if (typeof elm.__lookupSetter__(memberName) === "function") {
605
- elm[memberName] = n;
606
- } else {
607
- elm.setAttribute(memberName, n);
608
- }
681
+ memberName = ln[2] + memberName.slice(3);
682
+ }
683
+ if (oldValue || newValue) {
684
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
685
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
686
+ if (oldValue) {
687
+ plt.rel(elm, memberName, oldValue, capture);
688
+ }
689
+ if (newValue) {
690
+ plt.ael(elm, memberName, newValue, capture);
691
+ }
692
+ }
693
+ } else {
694
+ const isComplex = isComplexType(newValue);
695
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
696
+ try {
697
+ if (!elm.tagName.includes("-")) {
698
+ const n = newValue == null ? "" : newValue;
699
+ if (memberName === "list") {
700
+ isProp = false;
701
+ } else if (oldValue == null || elm[memberName] != n) {
702
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
703
+ elm[memberName] = n;
704
+ } else {
705
+ elm.setAttribute(memberName, n);
609
706
  }
610
- } else if (elm[memberName] !== newValue) {
611
- elm[memberName] = newValue;
612
707
  }
613
- } catch (e) {
708
+ } else if (elm[memberName] !== newValue) {
709
+ elm[memberName] = newValue;
614
710
  }
711
+ } catch (e) {
615
712
  }
616
- let xlink = false;
617
- {
618
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
619
- memberName = ln;
620
- xlink = true;
621
- }
713
+ }
714
+ let xlink = false;
715
+ {
716
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
717
+ memberName = ln;
718
+ xlink = true;
622
719
  }
623
- if (newValue == null || newValue === false) {
624
- if (newValue !== false || elm.getAttribute(memberName) === "") {
625
- if (xlink) {
626
- elm.removeAttributeNS(XLINK_NS, memberName);
627
- } else {
628
- elm.removeAttribute(memberName);
629
- }
630
- }
631
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
632
- newValue = newValue === true ? "" : newValue;
720
+ }
721
+ if (newValue == null || newValue === false) {
722
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
633
723
  if (xlink) {
634
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
724
+ elm.removeAttributeNS(XLINK_NS, memberName);
635
725
  } else {
636
- elm.setAttribute(memberName, newValue);
726
+ elm.removeAttribute(memberName);
637
727
  }
638
728
  }
729
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
730
+ newValue = newValue === true ? "" : newValue;
731
+ if (xlink) {
732
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
733
+ } else {
734
+ elm.setAttribute(memberName, newValue);
735
+ }
639
736
  }
640
737
  }
641
738
  };
@@ -721,11 +818,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
721
818
  }
722
819
  }
723
820
  if (newVNode2.$text$ !== null) {
724
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
821
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
725
822
  } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
726
- elm = newVNode2.$elm$ = doc.createTextNode("");
823
+ elm = newVNode2.$elm$ = win.document.createTextNode("");
824
+ {
825
+ updateElement(null, newVNode2, isSvgMode);
826
+ }
727
827
  } else {
728
- elm = newVNode2.$elm$ = doc.createElement(
828
+ if (!win.document) {
829
+ throw new Error(
830
+ "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."
831
+ );
832
+ }
833
+ elm = newVNode2.$elm$ = win.document.createElement(
729
834
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
730
835
  );
731
836
  {
@@ -750,6 +855,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
750
855
  elm["s-cr"] = contentRef;
751
856
  elm["s-sn"] = newVNode2.$name$ || "";
752
857
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
858
+ patchSlotNode(elm);
753
859
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
754
860
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
755
861
  {
@@ -939,14 +1045,11 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
939
1045
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
940
1046
  const oldChildren = oldVNode.$children$;
941
1047
  const newChildren = newVNode2.$children$;
942
- const tag = newVNode2.$tag$;
943
1048
  const text = newVNode2.$text$;
944
1049
  let defaultHolder;
945
1050
  if (text === null) {
946
1051
  {
947
- if (tag === "slot" && !useNativeShadowDom) ; else {
948
- updateElement(oldVNode, newVNode2, isSvgMode);
949
- }
1052
+ updateElement(oldVNode, newVNode2, isSvgMode);
950
1053
  }
951
1054
  if (oldChildren !== null && newChildren !== null) {
952
1055
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -1085,8 +1188,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1085
1188
  markSlotContentForRelocation(rootVnode.$elm$);
1086
1189
  for (const relocateData of relocateNodes) {
1087
1190
  const nodeToRelocate = relocateData.$nodeToRelocate$;
1088
- if (!nodeToRelocate["s-ol"]) {
1089
- const orgLocationNode = doc.createTextNode("");
1191
+ if (!nodeToRelocate["s-ol"] && win.document) {
1192
+ const orgLocationNode = win.document.createTextNode("");
1090
1193
  orgLocationNode["s-nr"] = nodeToRelocate;
1091
1194
  insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1092
1195
  }
@@ -1127,7 +1230,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1127
1230
  }
1128
1231
  }
1129
1232
  }
1130
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
1233
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
1131
1234
  } else {
1132
1235
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1133
1236
  if (isInitialLoad) {
@@ -1184,9 +1287,17 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1184
1287
  let maybePromise;
1185
1288
  if (isInitialLoad) {
1186
1289
  {
1187
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1290
+ hostRef.$flags$ |= 256 /* isListenReady */;
1291
+ if (hostRef.$queuedListeners$) {
1292
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
1293
+ hostRef.$queuedListeners$ = void 0;
1294
+ }
1188
1295
  }
1296
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1297
+ } else {
1298
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
1189
1299
  }
1300
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
1190
1301
  endSchedule();
1191
1302
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1192
1303
  };
@@ -1250,12 +1361,15 @@ var postUpdateComponent = (hostRef) => {
1250
1361
  const tagName = hostRef.$cmpMeta$.$tagName$;
1251
1362
  const elm = hostRef.$hostElement$;
1252
1363
  const endPostUpdate = createTime("postUpdate", tagName);
1364
+ const instance = hostRef.$lazyInstance$ ;
1253
1365
  const ancestorComponent = hostRef.$ancestorComponent$;
1366
+ safeCall(instance, "componentDidRender", void 0, elm);
1254
1367
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1255
1368
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1256
1369
  {
1257
1370
  addHydratedFlag(elm);
1258
1371
  }
1372
+ safeCall(instance, "componentDidLoad", void 0, elm);
1259
1373
  endPostUpdate();
1260
1374
  {
1261
1375
  hostRef.$onReadyResolve$(elm);
@@ -1264,6 +1378,7 @@ var postUpdateComponent = (hostRef) => {
1264
1378
  }
1265
1379
  }
1266
1380
  } else {
1381
+ safeCall(instance, "componentDidUpdate", void 0, elm);
1267
1382
  endPostUpdate();
1268
1383
  }
1269
1384
  {
@@ -1304,7 +1419,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1304
1419
  const hostRef = getHostRef(ref);
1305
1420
  if (!hostRef) {
1306
1421
  throw new Error(
1307
- `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).`
1422
+ `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).`
1308
1423
  );
1309
1424
  }
1310
1425
  const elm = hostRef.$hostElement$ ;
@@ -1330,6 +1445,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1330
1445
  }
1331
1446
  }
1332
1447
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1448
+ if (instance.componentShouldUpdate) {
1449
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1450
+ return;
1451
+ }
1452
+ }
1333
1453
  scheduleUpdate(hostRef, false);
1334
1454
  }
1335
1455
  }
@@ -1340,6 +1460,25 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1340
1460
  var proxyComponent = (Cstr, cmpMeta, flags) => {
1341
1461
  var _a, _b;
1342
1462
  const prototype = Cstr.prototype;
1463
+ if (cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
1464
+ FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
1465
+ Object.defineProperty(prototype, cbName, {
1466
+ value(...args) {
1467
+ const hostRef = getHostRef(this);
1468
+ const instance = hostRef.$lazyInstance$ ;
1469
+ if (!instance) {
1470
+ hostRef.$onReadyPromise$.then((asyncInstance) => {
1471
+ const cb = asyncInstance[cbName];
1472
+ typeof cb === "function" && cb.call(asyncInstance, ...args);
1473
+ });
1474
+ } else {
1475
+ const cb = instance[cbName] ;
1476
+ typeof cb === "function" && cb.call(instance, ...args);
1477
+ }
1478
+ }
1479
+ });
1480
+ });
1481
+ }
1343
1482
  if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
1344
1483
  if (Cstr.watchers && !cmpMeta.$watchers$) {
1345
1484
  cmpMeta.$watchers$ = Cstr.watchers;
@@ -1512,6 +1651,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1512
1651
  hostRef.$flags$ |= 128 /* isWatchReady */;
1513
1652
  }
1514
1653
  endNewInstance();
1654
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1515
1655
  } else {
1516
1656
  Cstr = elm.constructor;
1517
1657
  const cmpTag = elm.localName;
@@ -1539,6 +1679,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1539
1679
  }
1540
1680
  };
1541
1681
  var fireConnectedCallback = (instance, elm) => {
1682
+ {
1683
+ safeCall(instance, "connectedCallback", void 0, elm);
1684
+ }
1542
1685
  };
1543
1686
 
1544
1687
  // src/runtime/connected-callback.ts
@@ -1577,27 +1720,44 @@ var connectedCallback = (elm) => {
1577
1720
  initializeComponent(elm, hostRef, cmpMeta);
1578
1721
  }
1579
1722
  } else {
1580
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1581
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1723
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1724
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1725
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1726
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1727
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1582
1728
  }
1583
1729
  }
1584
1730
  endConnected();
1585
1731
  }
1586
1732
  };
1587
1733
  var setContentReference = (elm) => {
1588
- const contentRefElm = elm["s-cr"] = doc.createComment(
1734
+ if (!win.document) {
1735
+ return;
1736
+ }
1737
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
1589
1738
  ""
1590
1739
  );
1591
1740
  contentRefElm["s-cn"] = true;
1592
1741
  insertBefore(elm, contentRefElm, elm.firstChild);
1593
1742
  };
1594
1743
  var disconnectInstance = (instance, elm) => {
1744
+ {
1745
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1746
+ }
1595
1747
  };
1596
1748
  var disconnectedCallback = async (elm) => {
1597
1749
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1598
1750
  const hostRef = getHostRef(elm);
1599
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1600
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1751
+ {
1752
+ if (hostRef.$rmListeners$) {
1753
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1754
+ hostRef.$rmListeners$ = void 0;
1755
+ }
1756
+ }
1757
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1758
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1759
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1760
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1601
1761
  }
1602
1762
  }
1603
1763
  if (rootAppliedStyles.has(elm)) {
@@ -1611,18 +1771,22 @@ var disconnectedCallback = async (elm) => {
1611
1771
  // src/runtime/bootstrap-lazy.ts
1612
1772
  var bootstrapLazy = (lazyBundles, options = {}) => {
1613
1773
  var _a;
1774
+ if (!win.document) {
1775
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1776
+ return;
1777
+ }
1614
1778
  const endBootstrap = createTime();
1615
1779
  const cmpTags = [];
1616
1780
  const exclude = options.exclude || [];
1617
1781
  const customElements2 = win.customElements;
1618
- const head = doc.head;
1782
+ const head = win.document.head;
1619
1783
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1620
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
1784
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1621
1785
  const deferredConnectedCallbacks = [];
1622
1786
  let appLoadFallback;
1623
1787
  let isBootstrapping = true;
1624
1788
  Object.assign(plt, options);
1625
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
1789
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1626
1790
  let hasSlotRelocation = false;
1627
1791
  lazyBundles.map((lazyBundle) => {
1628
1792
  lazyBundle[1].map((compactMeta) => {
@@ -1639,6 +1803,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1639
1803
  {
1640
1804
  cmpMeta.$members$ = compactMeta[2];
1641
1805
  }
1806
+ {
1807
+ cmpMeta.$listeners$ = compactMeta[3];
1808
+ }
1642
1809
  {
1643
1810
  cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1644
1811
  }
@@ -1667,9 +1834,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1667
1834
  }
1668
1835
  }
1669
1836
  connectedCallback() {
1670
- getHostRef(this);
1837
+ const hostRef = getHostRef(this);
1671
1838
  if (!this.hasRegisteredEventListeners) {
1672
1839
  this.hasRegisteredEventListeners = true;
1840
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
1673
1841
  }
1674
1842
  if (appLoadFallback) {
1675
1843
  clearTimeout(appLoadFallback);
@@ -1699,6 +1867,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1699
1867
  return getHostRef(this).$onReadyPromise$;
1700
1868
  }
1701
1869
  };
1870
+ if (cmpMeta.$flags$ & 64 /* formAssociated */) {
1871
+ HostElement.formAssociated = true;
1872
+ }
1702
1873
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1703
1874
  if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
1704
1875
  cmpTags.push(tagName);
@@ -1718,7 +1889,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1718
1889
  }
1719
1890
  if (dataStyles.innerHTML.length) {
1720
1891
  dataStyles.setAttribute("data-styles", "");
1721
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1892
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1722
1893
  if (nonce != null) {
1723
1894
  dataStyles.setAttribute("nonce", nonce);
1724
1895
  }
@@ -1738,12 +1909,42 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1738
1909
 
1739
1910
  // src/runtime/fragment.ts
1740
1911
  var Fragment = (_, children) => children;
1912
+ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1913
+ if (listeners && win.document) {
1914
+ listeners.map(([flags, name, method]) => {
1915
+ const target = elm;
1916
+ const handler = hostListenerProxy(hostRef, method);
1917
+ const opts = hostListenerOpts(flags);
1918
+ plt.ael(target, name, handler, opts);
1919
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1920
+ });
1921
+ }
1922
+ };
1923
+ var hostListenerProxy = (hostRef, methodName) => (ev) => {
1924
+ var _a;
1925
+ try {
1926
+ {
1927
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
1928
+ (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
1929
+ } else {
1930
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1931
+ }
1932
+ }
1933
+ } catch (e) {
1934
+ consoleError(e, hostRef.$hostElement$);
1935
+ }
1936
+ };
1937
+ var hostListenerOpts = (flags) => supportsListenerOptions ? {
1938
+ passive: (flags & 1 /* Passive */) !== 0,
1939
+ capture: (flags & 2 /* Capture */) !== 0
1940
+ } : (flags & 2 /* Capture */) !== 0;
1741
1941
 
1742
1942
  // src/runtime/nonce.ts
1743
1943
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1744
1944
 
1745
1945
  exports.Fragment = Fragment;
1746
1946
  exports.bootstrapLazy = bootstrapLazy;
1947
+ exports.createEvent = createEvent;
1747
1948
  exports.getElement = getElement;
1748
1949
  exports.h = h;
1749
1950
  exports.promiseResolve = promiseResolve;