@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
@@ -1,8 +1,8 @@
1
1
  const NAMESPACE = 'component-library';
2
- 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 };
2
+ 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 };
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.27.2 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  var __defProp = Object.defineProperty;
8
8
  var __export = (target, all) => {
@@ -35,10 +35,15 @@ var reWireGetterSetter = (instance, hostRef) => {
35
35
  };
36
36
 
37
37
  // src/client/client-host-ref.ts
38
- var hostRefs = /* @__PURE__ */ new WeakMap();
39
- var getHostRef = (ref) => hostRefs.get(ref);
38
+ var getHostRef = (ref) => {
39
+ if (ref.__stencil__getHostRef) {
40
+ return ref.__stencil__getHostRef();
41
+ }
42
+ return void 0;
43
+ };
40
44
  var registerInstance = (lazyInstance, hostRef) => {
41
- hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
45
+ lazyInstance.__stencil__getHostRef = () => hostRef;
46
+ hostRef.$lazyInstance$ = lazyInstance;
42
47
  {
43
48
  reWireGetterSetter(lazyInstance, hostRef);
44
49
  }
@@ -58,7 +63,8 @@ var registerHost = (hostElement, cmpMeta) => {
58
63
  hostElement["s-p"] = [];
59
64
  hostElement["s-rc"] = [];
60
65
  }
61
- const ref = hostRefs.set(hostElement, hostRef);
66
+ const ref = hostRef;
67
+ hostElement.__stencil__getHostRef = () => ref;
62
68
  return ref;
63
69
  };
64
70
  var isMemberInElement = (elm, memberName) => memberName in elm;
@@ -102,8 +108,13 @@ var HYDRATED_STYLE_ID = "sty-id";
102
108
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
103
109
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
104
110
  var XLINK_NS = "http://www.w3.org/1999/xlink";
111
+ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
112
+ "formAssociatedCallback",
113
+ "formResetCallback",
114
+ "formDisabledCallback",
115
+ "formStateRestoreCallback"
116
+ ];
105
117
  var win = typeof window !== "undefined" ? window : {};
106
- var doc = win.document || { head: {} };
107
118
  var plt = {
108
119
  $flags$: 0,
109
120
  $resourcesUrl$: "",
@@ -113,6 +124,23 @@ var plt = {
113
124
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
114
125
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
115
126
  };
127
+ var supportsListenerOptions = /* @__PURE__ */ (() => {
128
+ var _a;
129
+ let supportsListenerOptions2 = false;
130
+ try {
131
+ (_a = win.document) == null ? void 0 : _a.addEventListener(
132
+ "e",
133
+ null,
134
+ Object.defineProperty({}, "passive", {
135
+ get() {
136
+ supportsListenerOptions2 = true;
137
+ }
138
+ })
139
+ );
140
+ } catch (e) {
141
+ }
142
+ return supportsListenerOptions2;
143
+ })();
116
144
  var promiseResolve = (v) => Promise.resolve(v);
117
145
  var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
118
146
  try {
@@ -166,9 +194,9 @@ var isComplexType = (o) => {
166
194
  };
167
195
 
168
196
  // src/utils/query-nonce-meta-tag-content.ts
169
- function queryNonceMetaTagContent(doc2) {
197
+ function queryNonceMetaTagContent(doc) {
170
198
  var _a, _b, _c;
171
- 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;
199
+ 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;
172
200
  }
173
201
 
174
202
  // src/utils/result.ts
@@ -220,12 +248,11 @@ var unwrapErr = (result) => {
220
248
  }
221
249
  };
222
250
  var updateFallbackSlotVisibility = (elm) => {
223
- const childNodes = elm.__childNodes || elm.childNodes;
251
+ const childNodes = internalCall(elm, "childNodes");
224
252
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
225
253
  getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
226
- var _a;
227
254
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
228
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
255
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
229
256
  slotNode.hidden = true;
230
257
  } else {
231
258
  slotNode.hidden = false;
@@ -233,19 +260,31 @@ var updateFallbackSlotVisibility = (elm) => {
233
260
  }
234
261
  });
235
262
  }
236
- for (const childNode of childNodes) {
237
- if (childNode.nodeType === 1 /* ElementNode */ && (childNode.__childNodes || childNode.childNodes).length) {
263
+ let i2 = 0;
264
+ for (i2 = 0; i2 < childNodes.length; i2++) {
265
+ const childNode = childNodes[i2];
266
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
238
267
  updateFallbackSlotVisibility(childNode);
239
268
  }
240
269
  }
241
270
  };
271
+ var getSlottedChildNodes = (childNodes) => {
272
+ const result = [];
273
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
274
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
275
+ if (slottedNode && slottedNode.isConnected) {
276
+ result.push(slottedNode);
277
+ }
278
+ }
279
+ return result;
280
+ };
242
281
  function getHostSlotNodes(childNodes, hostName, slotName) {
243
282
  let i2 = 0;
244
283
  let slottedNodes = [];
245
284
  let childNode;
246
285
  for (; i2 < childNodes.length; i2++) {
247
286
  childNode = childNodes[i2];
248
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
287
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
249
288
  slottedNodes.push(childNode);
250
289
  if (typeof slotName !== "undefined") return slottedNodes;
251
290
  }
@@ -253,11 +292,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
253
292
  }
254
293
  return slottedNodes;
255
294
  }
256
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
295
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
257
296
  const childNodes = [];
258
- if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
259
- while ((node = node.nextSibling) && node["s-sn"] === slotName) {
260
- childNodes.push(node);
297
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
298
+ let node = slot;
299
+ while (node = node.nextSibling) {
300
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
261
301
  }
262
302
  return childNodes;
263
303
  };
@@ -276,6 +316,44 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
276
316
  }
277
317
  return slotName === "";
278
318
  };
319
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
320
+ function patchSlotNode(node) {
321
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
322
+ const assignedFactory = (elementsOnly) => (function(opts) {
323
+ const toReturn = [];
324
+ const slotName = this["s-sn"];
325
+ if (opts == null ? void 0 : opts.flatten) {
326
+ console.error(`
327
+ Flattening is not supported for Stencil non-shadow slots.
328
+ You can use \`.childNodes\` to nested slot fallback content.
329
+ If you have a particular use case, please open an issue on the Stencil repo.
330
+ `);
331
+ }
332
+ const parent = this["s-cr"].parentElement;
333
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
334
+ slottedNodes.forEach((n) => {
335
+ if (slotName === getSlotName(n)) {
336
+ toReturn.push(n);
337
+ }
338
+ });
339
+ if (elementsOnly) {
340
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
341
+ }
342
+ return toReturn;
343
+ }).bind(node);
344
+ node.assignedElements = assignedFactory(true);
345
+ node.assignedNodes = assignedFactory(false);
346
+ }
347
+ function internalCall(node, method) {
348
+ if ("__" + method in node) {
349
+ const toReturn = node["__" + method];
350
+ if (typeof toReturn !== "function") return toReturn;
351
+ return toReturn.bind(node);
352
+ } else {
353
+ if (typeof node[method] !== "function") return node[method];
354
+ return node[method].bind(node);
355
+ }
356
+ }
279
357
  var createTime = (fnName, tagName = "") => {
280
358
  {
281
359
  return () => {
@@ -417,6 +495,21 @@ var parsePropertyValue = (propValue, propType) => {
417
495
  return propValue;
418
496
  };
419
497
  var getElement = (ref) => getHostRef(ref).$hostElement$ ;
498
+
499
+ // src/runtime/event-emitter.ts
500
+ var createEvent = (ref, name, flags) => {
501
+ const elm = getElement(ref);
502
+ return {
503
+ emit: (detail) => {
504
+ return emitEvent(elm, name, {
505
+ bubbles: !!(flags & 4 /* Bubbles */),
506
+ composed: !!(flags & 2 /* Composed */),
507
+ cancelable: !!(flags & 1 /* Cancellable */),
508
+ detail
509
+ });
510
+ }
511
+ };
512
+ };
420
513
  var emitEvent = (elm, name, opts) => {
421
514
  const ev = plt.ce(name, opts);
422
515
  elm.dispatchEvent(ev);
@@ -441,7 +534,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
441
534
  var _a;
442
535
  const scopeId2 = getScopeId(cmpMeta);
443
536
  const style = styles.get(scopeId2);
444
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
537
+ if (!win.document) {
538
+ return scopeId2;
539
+ }
540
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
445
541
  if (style) {
446
542
  if (typeof style === "string") {
447
543
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -452,9 +548,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
452
548
  }
453
549
  if (!appliedStyles.has(scopeId2)) {
454
550
  {
455
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
551
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
456
552
  styleElm.innerHTML = style;
457
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
553
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
458
554
  if (nonce != null) {
459
555
  styleElm.setAttribute("nonce", nonce);
460
556
  }
@@ -516,104 +612,105 @@ var attachStyles = (hostRef) => {
516
612
  };
517
613
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
518
614
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
519
- if (oldValue !== newValue) {
520
- let isProp = isMemberInElement(elm, memberName);
521
- let ln = memberName.toLowerCase();
522
- if (memberName === "class") {
523
- const classList = elm.classList;
524
- const oldClasses = parseClassList(oldValue);
525
- let newClasses = parseClassList(newValue);
526
- {
527
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
528
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
529
- }
530
- } else if (memberName === "style") {
531
- {
532
- for (const prop in oldValue) {
533
- if (!newValue || newValue[prop] == null) {
534
- if (prop.includes("-")) {
535
- elm.style.removeProperty(prop);
536
- } else {
537
- elm.style[prop] = "";
538
- }
539
- }
540
- }
541
- }
542
- for (const prop in newValue) {
543
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
615
+ if (oldValue === newValue) {
616
+ return;
617
+ }
618
+ let isProp = isMemberInElement(elm, memberName);
619
+ let ln = memberName.toLowerCase();
620
+ if (memberName === "class") {
621
+ const classList = elm.classList;
622
+ const oldClasses = parseClassList(oldValue);
623
+ let newClasses = parseClassList(newValue);
624
+ {
625
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
626
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
627
+ }
628
+ } else if (memberName === "style") {
629
+ {
630
+ for (const prop in oldValue) {
631
+ if (!newValue || newValue[prop] == null) {
544
632
  if (prop.includes("-")) {
545
- elm.style.setProperty(prop, newValue[prop]);
633
+ elm.style.removeProperty(prop);
546
634
  } else {
547
- elm.style[prop] = newValue[prop];
635
+ elm.style[prop] = "";
548
636
  }
549
637
  }
550
638
  }
551
- } else if (memberName === "key") ; else if (memberName === "ref") {
552
- if (newValue) {
553
- newValue(elm);
554
- }
555
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
556
- if (memberName[2] === "-") {
557
- memberName = memberName.slice(3);
558
- } else if (isMemberInElement(win, ln)) {
559
- memberName = ln.slice(2);
560
- } else {
561
- memberName = ln[2] + memberName.slice(3);
562
- }
563
- if (oldValue || newValue) {
564
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
565
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
566
- if (oldValue) {
567
- plt.rel(elm, memberName, oldValue, capture);
568
- }
569
- if (newValue) {
570
- plt.ael(elm, memberName, newValue, capture);
639
+ }
640
+ for (const prop in newValue) {
641
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
642
+ if (prop.includes("-")) {
643
+ elm.style.setProperty(prop, newValue[prop]);
644
+ } else {
645
+ elm.style[prop] = newValue[prop];
571
646
  }
572
647
  }
648
+ }
649
+ } else if (memberName === "key") ; else if (memberName === "ref") {
650
+ if (newValue) {
651
+ newValue(elm);
652
+ }
653
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
654
+ if (memberName[2] === "-") {
655
+ memberName = memberName.slice(3);
656
+ } else if (isMemberInElement(win, ln)) {
657
+ memberName = ln.slice(2);
573
658
  } else {
574
- const isComplex = isComplexType(newValue);
575
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
576
- try {
577
- if (!elm.tagName.includes("-")) {
578
- const n = newValue == null ? "" : newValue;
579
- if (memberName === "list") {
580
- isProp = false;
581
- } else if (oldValue == null || elm[memberName] != n) {
582
- if (typeof elm.__lookupSetter__(memberName) === "function") {
583
- elm[memberName] = n;
584
- } else {
585
- elm.setAttribute(memberName, n);
586
- }
659
+ memberName = ln[2] + memberName.slice(3);
660
+ }
661
+ if (oldValue || newValue) {
662
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
663
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
664
+ if (oldValue) {
665
+ plt.rel(elm, memberName, oldValue, capture);
666
+ }
667
+ if (newValue) {
668
+ plt.ael(elm, memberName, newValue, capture);
669
+ }
670
+ }
671
+ } else {
672
+ const isComplex = isComplexType(newValue);
673
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
674
+ try {
675
+ if (!elm.tagName.includes("-")) {
676
+ const n = newValue == null ? "" : newValue;
677
+ if (memberName === "list") {
678
+ isProp = false;
679
+ } else if (oldValue == null || elm[memberName] != n) {
680
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
681
+ elm[memberName] = n;
682
+ } else {
683
+ elm.setAttribute(memberName, n);
587
684
  }
588
- } else if (elm[memberName] !== newValue) {
589
- elm[memberName] = newValue;
590
685
  }
591
- } catch (e) {
686
+ } else if (elm[memberName] !== newValue) {
687
+ elm[memberName] = newValue;
592
688
  }
689
+ } catch (e) {
593
690
  }
594
- let xlink = false;
595
- {
596
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
597
- memberName = ln;
598
- xlink = true;
599
- }
691
+ }
692
+ let xlink = false;
693
+ {
694
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
695
+ memberName = ln;
696
+ xlink = true;
600
697
  }
601
- if (newValue == null || newValue === false) {
602
- if (newValue !== false || elm.getAttribute(memberName) === "") {
603
- if (xlink) {
604
- elm.removeAttributeNS(XLINK_NS, memberName);
605
- } else {
606
- elm.removeAttribute(memberName);
607
- }
608
- }
609
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
610
- newValue = newValue === true ? "" : newValue;
698
+ }
699
+ if (newValue == null || newValue === false) {
700
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
611
701
  if (xlink) {
612
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
702
+ elm.removeAttributeNS(XLINK_NS, memberName);
613
703
  } else {
614
- elm.setAttribute(memberName, newValue);
704
+ elm.removeAttribute(memberName);
615
705
  }
616
706
  }
707
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
708
+ newValue = newValue === true ? "" : newValue;
709
+ if (xlink) {
710
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
711
+ } else {
712
+ elm.setAttribute(memberName, newValue);
713
+ }
617
714
  }
618
715
  }
619
716
  };
@@ -699,11 +796,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
699
796
  }
700
797
  }
701
798
  if (newVNode2.$text$ !== null) {
702
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
799
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
703
800
  } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
704
- elm = newVNode2.$elm$ = doc.createTextNode("");
801
+ elm = newVNode2.$elm$ = win.document.createTextNode("");
802
+ {
803
+ updateElement(null, newVNode2, isSvgMode);
804
+ }
705
805
  } else {
706
- elm = newVNode2.$elm$ = doc.createElement(
806
+ if (!win.document) {
807
+ throw new Error(
808
+ "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."
809
+ );
810
+ }
811
+ elm = newVNode2.$elm$ = win.document.createElement(
707
812
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
708
813
  );
709
814
  {
@@ -728,6 +833,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
728
833
  elm["s-cr"] = contentRef;
729
834
  elm["s-sn"] = newVNode2.$name$ || "";
730
835
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
836
+ patchSlotNode(elm);
731
837
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
732
838
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
733
839
  {
@@ -917,14 +1023,11 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
917
1023
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
918
1024
  const oldChildren = oldVNode.$children$;
919
1025
  const newChildren = newVNode2.$children$;
920
- const tag = newVNode2.$tag$;
921
1026
  const text = newVNode2.$text$;
922
1027
  let defaultHolder;
923
1028
  if (text === null) {
924
1029
  {
925
- if (tag === "slot" && !useNativeShadowDom) ; else {
926
- updateElement(oldVNode, newVNode2, isSvgMode);
927
- }
1030
+ updateElement(oldVNode, newVNode2, isSvgMode);
928
1031
  }
929
1032
  if (oldChildren !== null && newChildren !== null) {
930
1033
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -1063,8 +1166,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1063
1166
  markSlotContentForRelocation(rootVnode.$elm$);
1064
1167
  for (const relocateData of relocateNodes) {
1065
1168
  const nodeToRelocate = relocateData.$nodeToRelocate$;
1066
- if (!nodeToRelocate["s-ol"]) {
1067
- const orgLocationNode = doc.createTextNode("");
1169
+ if (!nodeToRelocate["s-ol"] && win.document) {
1170
+ const orgLocationNode = win.document.createTextNode("");
1068
1171
  orgLocationNode["s-nr"] = nodeToRelocate;
1069
1172
  insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1070
1173
  }
@@ -1105,7 +1208,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1105
1208
  }
1106
1209
  }
1107
1210
  }
1108
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
1211
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
1109
1212
  } else {
1110
1213
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1111
1214
  if (isInitialLoad) {
@@ -1162,9 +1265,17 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1162
1265
  let maybePromise;
1163
1266
  if (isInitialLoad) {
1164
1267
  {
1165
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1268
+ hostRef.$flags$ |= 256 /* isListenReady */;
1269
+ if (hostRef.$queuedListeners$) {
1270
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
1271
+ hostRef.$queuedListeners$ = void 0;
1272
+ }
1166
1273
  }
1274
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1275
+ } else {
1276
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
1167
1277
  }
1278
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
1168
1279
  endSchedule();
1169
1280
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1170
1281
  };
@@ -1228,12 +1339,15 @@ var postUpdateComponent = (hostRef) => {
1228
1339
  const tagName = hostRef.$cmpMeta$.$tagName$;
1229
1340
  const elm = hostRef.$hostElement$;
1230
1341
  const endPostUpdate = createTime("postUpdate", tagName);
1342
+ const instance = hostRef.$lazyInstance$ ;
1231
1343
  const ancestorComponent = hostRef.$ancestorComponent$;
1344
+ safeCall(instance, "componentDidRender", void 0, elm);
1232
1345
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1233
1346
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1234
1347
  {
1235
1348
  addHydratedFlag(elm);
1236
1349
  }
1350
+ safeCall(instance, "componentDidLoad", void 0, elm);
1237
1351
  endPostUpdate();
1238
1352
  {
1239
1353
  hostRef.$onReadyResolve$(elm);
@@ -1242,6 +1356,7 @@ var postUpdateComponent = (hostRef) => {
1242
1356
  }
1243
1357
  }
1244
1358
  } else {
1359
+ safeCall(instance, "componentDidUpdate", void 0, elm);
1245
1360
  endPostUpdate();
1246
1361
  }
1247
1362
  {
@@ -1282,7 +1397,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1282
1397
  const hostRef = getHostRef(ref);
1283
1398
  if (!hostRef) {
1284
1399
  throw new Error(
1285
- `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).`
1400
+ `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).`
1286
1401
  );
1287
1402
  }
1288
1403
  const elm = hostRef.$hostElement$ ;
@@ -1308,6 +1423,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1308
1423
  }
1309
1424
  }
1310
1425
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1426
+ if (instance.componentShouldUpdate) {
1427
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1428
+ return;
1429
+ }
1430
+ }
1311
1431
  scheduleUpdate(hostRef, false);
1312
1432
  }
1313
1433
  }
@@ -1318,6 +1438,25 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1318
1438
  var proxyComponent = (Cstr, cmpMeta, flags) => {
1319
1439
  var _a, _b;
1320
1440
  const prototype = Cstr.prototype;
1441
+ if (cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
1442
+ FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
1443
+ Object.defineProperty(prototype, cbName, {
1444
+ value(...args) {
1445
+ const hostRef = getHostRef(this);
1446
+ const instance = hostRef.$lazyInstance$ ;
1447
+ if (!instance) {
1448
+ hostRef.$onReadyPromise$.then((asyncInstance) => {
1449
+ const cb = asyncInstance[cbName];
1450
+ typeof cb === "function" && cb.call(asyncInstance, ...args);
1451
+ });
1452
+ } else {
1453
+ const cb = instance[cbName] ;
1454
+ typeof cb === "function" && cb.call(instance, ...args);
1455
+ }
1456
+ }
1457
+ });
1458
+ });
1459
+ }
1321
1460
  if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
1322
1461
  if (Cstr.watchers && !cmpMeta.$watchers$) {
1323
1462
  cmpMeta.$watchers$ = Cstr.watchers;
@@ -1490,6 +1629,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1490
1629
  hostRef.$flags$ |= 128 /* isWatchReady */;
1491
1630
  }
1492
1631
  endNewInstance();
1632
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1493
1633
  } else {
1494
1634
  Cstr = elm.constructor;
1495
1635
  const cmpTag = elm.localName;
@@ -1517,6 +1657,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1517
1657
  }
1518
1658
  };
1519
1659
  var fireConnectedCallback = (instance, elm) => {
1660
+ {
1661
+ safeCall(instance, "connectedCallback", void 0, elm);
1662
+ }
1520
1663
  };
1521
1664
 
1522
1665
  // src/runtime/connected-callback.ts
@@ -1555,27 +1698,44 @@ var connectedCallback = (elm) => {
1555
1698
  initializeComponent(elm, hostRef, cmpMeta);
1556
1699
  }
1557
1700
  } else {
1558
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1559
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1701
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1702
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1703
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1704
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1705
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1560
1706
  }
1561
1707
  }
1562
1708
  endConnected();
1563
1709
  }
1564
1710
  };
1565
1711
  var setContentReference = (elm) => {
1566
- const contentRefElm = elm["s-cr"] = doc.createComment(
1712
+ if (!win.document) {
1713
+ return;
1714
+ }
1715
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
1567
1716
  ""
1568
1717
  );
1569
1718
  contentRefElm["s-cn"] = true;
1570
1719
  insertBefore(elm, contentRefElm, elm.firstChild);
1571
1720
  };
1572
1721
  var disconnectInstance = (instance, elm) => {
1722
+ {
1723
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1724
+ }
1573
1725
  };
1574
1726
  var disconnectedCallback = async (elm) => {
1575
1727
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1576
1728
  const hostRef = getHostRef(elm);
1577
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1578
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1729
+ {
1730
+ if (hostRef.$rmListeners$) {
1731
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1732
+ hostRef.$rmListeners$ = void 0;
1733
+ }
1734
+ }
1735
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1736
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1737
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1738
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1579
1739
  }
1580
1740
  }
1581
1741
  if (rootAppliedStyles.has(elm)) {
@@ -1589,18 +1749,22 @@ var disconnectedCallback = async (elm) => {
1589
1749
  // src/runtime/bootstrap-lazy.ts
1590
1750
  var bootstrapLazy = (lazyBundles, options = {}) => {
1591
1751
  var _a;
1752
+ if (!win.document) {
1753
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1754
+ return;
1755
+ }
1592
1756
  const endBootstrap = createTime();
1593
1757
  const cmpTags = [];
1594
1758
  const exclude = options.exclude || [];
1595
1759
  const customElements2 = win.customElements;
1596
- const head = doc.head;
1760
+ const head = win.document.head;
1597
1761
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1598
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
1762
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1599
1763
  const deferredConnectedCallbacks = [];
1600
1764
  let appLoadFallback;
1601
1765
  let isBootstrapping = true;
1602
1766
  Object.assign(plt, options);
1603
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
1767
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1604
1768
  let hasSlotRelocation = false;
1605
1769
  lazyBundles.map((lazyBundle) => {
1606
1770
  lazyBundle[1].map((compactMeta) => {
@@ -1617,6 +1781,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1617
1781
  {
1618
1782
  cmpMeta.$members$ = compactMeta[2];
1619
1783
  }
1784
+ {
1785
+ cmpMeta.$listeners$ = compactMeta[3];
1786
+ }
1620
1787
  {
1621
1788
  cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1622
1789
  }
@@ -1645,9 +1812,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1645
1812
  }
1646
1813
  }
1647
1814
  connectedCallback() {
1648
- getHostRef(this);
1815
+ const hostRef = getHostRef(this);
1649
1816
  if (!this.hasRegisteredEventListeners) {
1650
1817
  this.hasRegisteredEventListeners = true;
1818
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
1651
1819
  }
1652
1820
  if (appLoadFallback) {
1653
1821
  clearTimeout(appLoadFallback);
@@ -1677,6 +1845,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1677
1845
  return getHostRef(this).$onReadyPromise$;
1678
1846
  }
1679
1847
  };
1848
+ if (cmpMeta.$flags$ & 64 /* formAssociated */) {
1849
+ HostElement.formAssociated = true;
1850
+ }
1680
1851
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1681
1852
  if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
1682
1853
  cmpTags.push(tagName);
@@ -1696,7 +1867,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1696
1867
  }
1697
1868
  if (dataStyles.innerHTML.length) {
1698
1869
  dataStyles.setAttribute("data-styles", "");
1699
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1870
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1700
1871
  if (nonce != null) {
1701
1872
  dataStyles.setAttribute("nonce", nonce);
1702
1873
  }
@@ -1716,8 +1887,37 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1716
1887
 
1717
1888
  // src/runtime/fragment.ts
1718
1889
  var Fragment = (_, children) => children;
1890
+ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1891
+ if (listeners && win.document) {
1892
+ listeners.map(([flags, name, method]) => {
1893
+ const target = elm;
1894
+ const handler = hostListenerProxy(hostRef, method);
1895
+ const opts = hostListenerOpts(flags);
1896
+ plt.ael(target, name, handler, opts);
1897
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1898
+ });
1899
+ }
1900
+ };
1901
+ var hostListenerProxy = (hostRef, methodName) => (ev) => {
1902
+ var _a;
1903
+ try {
1904
+ {
1905
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
1906
+ (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
1907
+ } else {
1908
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1909
+ }
1910
+ }
1911
+ } catch (e) {
1912
+ consoleError(e, hostRef.$hostElement$);
1913
+ }
1914
+ };
1915
+ var hostListenerOpts = (flags) => supportsListenerOptions ? {
1916
+ passive: (flags & 1 /* Passive */) !== 0,
1917
+ capture: (flags & 2 /* Capture */) !== 0
1918
+ } : (flags & 2 /* Capture */) !== 0;
1719
1919
 
1720
1920
  // src/runtime/nonce.ts
1721
1921
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1722
1922
 
1723
- export { Fragment as F, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1923
+ export { Fragment as F, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };