@uh-design-system/component-library 0.4.1 → 0.5.0

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 (102) hide show
  1. package/dist/cjs/component-library.cjs.js +3 -3
  2. package/dist/cjs/ds-accordion_3.cjs.entry.js +10 -10
  3. package/dist/cjs/ds-checkbox-group.cjs.entry.js +16 -17
  4. package/dist/cjs/ds-checkbox.cjs.entry.js +42 -35
  5. package/dist/cjs/ds-input-validity.cjs.entry.js +4 -6
  6. package/dist/cjs/ds-link-with-arrow.cjs.entry.js +5 -5
  7. package/dist/cjs/ds-link.cjs.entry.js +5 -5
  8. package/dist/cjs/ds-text-input.cjs.entry.js +51 -23
  9. package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
  10. package/dist/cjs/{index-b1d61146.js → index-bf84b124.js} +237 -134
  11. package/dist/cjs/index.cjs.js +8 -0
  12. package/dist/cjs/{linkUtils-e911e899.js → linkUtils-695da37c.js} +0 -10
  13. package/dist/cjs/loader.cjs.js +2 -2
  14. package/dist/cjs/store-9bd20f3c.js +207 -0
  15. package/dist/cjs/{utils-c9113835.js → utils-2ba5e075.js} +10 -0
  16. package/dist/collection/collection-manifest.json +2 -2
  17. package/dist/collection/components/00-foundations/types.js +1 -0
  18. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
  19. package/dist/collection/components/01-base-components/ds-button/ds-button.js +1 -1
  20. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +1 -172
  21. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +68 -56
  22. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +1 -0
  23. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +1 -1
  24. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +27 -67
  25. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
  26. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +6 -9
  27. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +1 -0
  28. package/dist/collection/components/01-base-components/ds-link/ds-link.css +0 -138
  29. package/dist/collection/components/01-base-components/ds-link/ds-link.js +4 -4
  30. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +4 -1
  31. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +0 -138
  32. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +4 -4
  33. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +4 -1
  34. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +73 -27
  35. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +82 -13
  36. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +6 -7
  37. package/dist/collection/components/01-base-components/ds-text-input/utils.js +1 -10
  38. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  39. package/dist/collection/index.js +1 -1
  40. package/dist/collection/store.js +13 -0
  41. package/dist/collection/utils/link/linkUtils.js +0 -9
  42. package/dist/collection/utils/utils.js +9 -0
  43. package/dist/component-library/component-library.esm.js +1 -1
  44. package/dist/component-library/ds-accordion_3.entry.js +1 -1
  45. package/dist/component-library/ds-checkbox-group.entry.js +1 -1
  46. package/dist/component-library/ds-checkbox.entry.js +1 -1
  47. package/dist/component-library/ds-input-validity.entry.js +1 -1
  48. package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
  49. package/dist/component-library/ds-link.entry.js +1 -1
  50. package/dist/component-library/ds-text-input.entry.js +1 -1
  51. package/dist/component-library/ds-visually-hidden.entry.js +1 -1
  52. package/dist/component-library/index-434995e1.js +2 -0
  53. package/dist/component-library/index.esm.js +1 -0
  54. package/dist/component-library/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -1
  55. package/dist/component-library/store-b8d17c10.js +1 -0
  56. package/dist/component-library/utils-5daa5bc0.js +1 -0
  57. package/dist/components/ds-accordion.js +6 -6
  58. package/dist/components/ds-button2.js +1 -1
  59. package/dist/components/ds-checkbox-group.js +22 -24
  60. package/dist/components/ds-checkbox2.js +44 -37
  61. package/dist/components/ds-icon2.js +11 -2
  62. package/dist/components/ds-input-validity2.js +5 -7
  63. package/dist/components/ds-link-with-arrow.js +4 -4
  64. package/dist/components/ds-link.js +4 -4
  65. package/dist/components/ds-text-input.js +57 -28
  66. package/dist/components/ds-visually-hidden2.js +1 -1
  67. package/dist/components/index.js +1 -0
  68. package/dist/components/index2.js +218 -136
  69. package/dist/components/linkUtils.js +1 -10
  70. package/dist/components/store.js +204 -0
  71. package/dist/esm/component-library.js +4 -4
  72. package/dist/esm/ds-accordion_3.entry.js +10 -10
  73. package/dist/esm/ds-checkbox-group.entry.js +16 -17
  74. package/dist/esm/ds-checkbox.entry.js +42 -35
  75. package/dist/esm/ds-input-validity.entry.js +4 -6
  76. package/dist/esm/ds-link-with-arrow.entry.js +5 -5
  77. package/dist/esm/ds-link.entry.js +5 -5
  78. package/dist/esm/ds-text-input.entry.js +51 -23
  79. package/dist/esm/ds-visually-hidden.entry.js +2 -2
  80. package/dist/esm/{index-aaccd233.js → index-434995e1.js} +236 -135
  81. package/dist/esm/index.js +2 -1
  82. package/dist/esm/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -10
  83. package/dist/esm/loader.js +3 -3
  84. package/dist/esm/store-b8d17c10.js +204 -0
  85. package/dist/esm/{utils-b5843ae1.js → utils-5daa5bc0.js} +10 -1
  86. package/dist/types/components/00-foundations/types.d.ts +3 -0
  87. package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +14 -14
  88. package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +14 -16
  89. package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +1 -1
  90. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +1 -1
  91. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -1
  92. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +17 -8
  93. package/dist/types/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.d.ts +1 -0
  94. package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +1 -1
  95. package/dist/types/components.d.ts +42 -28
  96. package/dist/types/index.d.ts +1 -0
  97. package/dist/types/store.d.ts +10 -0
  98. package/dist/types/utils/link/linkUtils.d.ts +0 -1
  99. package/dist/types/utils/utils.d.ts +1 -0
  100. package/package.json +19 -18
  101. package/dist/component-library/index-aaccd233.js +0 -2
  102. package/dist/component-library/utils-b5843ae1.js +0 -1
@@ -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: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: 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 };
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;
@@ -131,7 +137,6 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
131
137
  "formStateRestoreCallback"
132
138
  ];
133
139
  var win = typeof window !== "undefined" ? window : {};
134
- var doc = win.document || { head: {} };
135
140
  var plt = {
136
141
  $flags$: 0,
137
142
  $resourcesUrl$: "",
@@ -142,9 +147,10 @@ var plt = {
142
147
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
143
148
  };
144
149
  var supportsListenerOptions = /* @__PURE__ */ (() => {
150
+ var _a;
145
151
  let supportsListenerOptions2 = false;
146
152
  try {
147
- doc.addEventListener(
153
+ (_a = win.document) == null ? void 0 : _a.addEventListener(
148
154
  "e",
149
155
  null,
150
156
  Object.defineProperty({}, "passive", {
@@ -210,9 +216,9 @@ var isComplexType = (o) => {
210
216
  };
211
217
 
212
218
  // src/utils/query-nonce-meta-tag-content.ts
213
- function queryNonceMetaTagContent(doc2) {
219
+ function queryNonceMetaTagContent(doc) {
214
220
  var _a, _b, _c;
215
- 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;
216
222
  }
217
223
 
218
224
  // src/utils/result.ts
@@ -264,12 +270,11 @@ var unwrapErr = (result) => {
264
270
  }
265
271
  };
266
272
  var updateFallbackSlotVisibility = (elm) => {
267
- const childNodes = elm.__childNodes || elm.childNodes;
273
+ const childNodes = internalCall(elm, "childNodes");
268
274
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
269
275
  getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
270
- var _a;
271
276
  if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
272
- if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
277
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
273
278
  slotNode.hidden = true;
274
279
  } else {
275
280
  slotNode.hidden = false;
@@ -277,19 +282,31 @@ var updateFallbackSlotVisibility = (elm) => {
277
282
  }
278
283
  });
279
284
  }
280
- for (const childNode of childNodes) {
281
- 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) {
282
289
  updateFallbackSlotVisibility(childNode);
283
290
  }
284
291
  }
285
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
+ };
286
303
  function getHostSlotNodes(childNodes, hostName, slotName) {
287
304
  let i2 = 0;
288
305
  let slottedNodes = [];
289
306
  let childNode;
290
307
  for (; i2 < childNodes.length; i2++) {
291
308
  childNode = childNodes[i2];
292
- 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)) {
293
310
  slottedNodes.push(childNode);
294
311
  if (typeof slotName !== "undefined") return slottedNodes;
295
312
  }
@@ -297,11 +314,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
297
314
  }
298
315
  return slottedNodes;
299
316
  }
300
- var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
317
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
301
318
  const childNodes = [];
302
- if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
303
- while ((node = node.nextSibling) && node["s-sn"] === slotName) {
304
- 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);
305
323
  }
306
324
  return childNodes;
307
325
  };
@@ -320,6 +338,44 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
320
338
  }
321
339
  return slotName === "";
322
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
+ }
323
379
  var createTime = (fnName, tagName = "") => {
324
380
  {
325
381
  return () => {
@@ -500,7 +556,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
500
556
  var _a;
501
557
  const scopeId2 = getScopeId(cmpMeta);
502
558
  const style = styles.get(scopeId2);
503
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
559
+ if (!win.document) {
560
+ return scopeId2;
561
+ }
562
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
504
563
  if (style) {
505
564
  if (typeof style === "string") {
506
565
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -511,9 +570,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
511
570
  }
512
571
  if (!appliedStyles.has(scopeId2)) {
513
572
  {
514
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
573
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
515
574
  styleElm.innerHTML = style;
516
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
575
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
517
576
  if (nonce != null) {
518
577
  styleElm.setAttribute("nonce", nonce);
519
578
  }
@@ -575,104 +634,105 @@ var attachStyles = (hostRef) => {
575
634
  };
576
635
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
577
636
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
578
- if (oldValue !== newValue) {
579
- let isProp = isMemberInElement(elm, memberName);
580
- let ln = memberName.toLowerCase();
581
- if (memberName === "class") {
582
- const classList = elm.classList;
583
- const oldClasses = parseClassList(oldValue);
584
- let newClasses = parseClassList(newValue);
585
- {
586
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
587
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
588
- }
589
- } else if (memberName === "style") {
590
- {
591
- for (const prop in oldValue) {
592
- if (!newValue || newValue[prop] == null) {
593
- if (prop.includes("-")) {
594
- elm.style.removeProperty(prop);
595
- } else {
596
- elm.style[prop] = "";
597
- }
598
- }
599
- }
600
- }
601
- for (const prop in newValue) {
602
- 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) {
603
654
  if (prop.includes("-")) {
604
- elm.style.setProperty(prop, newValue[prop]);
655
+ elm.style.removeProperty(prop);
605
656
  } else {
606
- elm.style[prop] = newValue[prop];
657
+ elm.style[prop] = "";
607
658
  }
608
659
  }
609
660
  }
610
- } else if (memberName === "key") ; else if (memberName === "ref") {
611
- if (newValue) {
612
- newValue(elm);
613
- }
614
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
615
- if (memberName[2] === "-") {
616
- memberName = memberName.slice(3);
617
- } else if (isMemberInElement(win, ln)) {
618
- memberName = ln.slice(2);
619
- } else {
620
- memberName = ln[2] + memberName.slice(3);
621
- }
622
- if (oldValue || newValue) {
623
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
624
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
625
- if (oldValue) {
626
- plt.rel(elm, memberName, oldValue, capture);
627
- }
628
- if (newValue) {
629
- 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];
630
668
  }
631
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);
632
680
  } else {
633
- const isComplex = isComplexType(newValue);
634
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
635
- try {
636
- if (!elm.tagName.includes("-")) {
637
- const n = newValue == null ? "" : newValue;
638
- if (memberName === "list") {
639
- isProp = false;
640
- } else if (oldValue == null || elm[memberName] != n) {
641
- if (typeof elm.__lookupSetter__(memberName) === "function") {
642
- elm[memberName] = n;
643
- } else {
644
- elm.setAttribute(memberName, n);
645
- }
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);
646
706
  }
647
- } else if (elm[memberName] !== newValue) {
648
- elm[memberName] = newValue;
649
707
  }
650
- } catch (e) {
708
+ } else if (elm[memberName] !== newValue) {
709
+ elm[memberName] = newValue;
651
710
  }
711
+ } catch (e) {
652
712
  }
653
- let xlink = false;
654
- {
655
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
656
- memberName = ln;
657
- xlink = true;
658
- }
713
+ }
714
+ let xlink = false;
715
+ {
716
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
717
+ memberName = ln;
718
+ xlink = true;
659
719
  }
660
- if (newValue == null || newValue === false) {
661
- if (newValue !== false || elm.getAttribute(memberName) === "") {
662
- if (xlink) {
663
- elm.removeAttributeNS(XLINK_NS, memberName);
664
- } else {
665
- elm.removeAttribute(memberName);
666
- }
667
- }
668
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
669
- newValue = newValue === true ? "" : newValue;
720
+ }
721
+ if (newValue == null || newValue === false) {
722
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
670
723
  if (xlink) {
671
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
724
+ elm.removeAttributeNS(XLINK_NS, memberName);
672
725
  } else {
673
- elm.setAttribute(memberName, newValue);
726
+ elm.removeAttribute(memberName);
674
727
  }
675
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
+ }
676
736
  }
677
737
  }
678
738
  };
@@ -758,11 +818,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
758
818
  }
759
819
  }
760
820
  if (newVNode2.$text$ !== null) {
761
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
821
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
762
822
  } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
763
- elm = newVNode2.$elm$ = doc.createTextNode("");
823
+ elm = newVNode2.$elm$ = win.document.createTextNode("");
824
+ {
825
+ updateElement(null, newVNode2, isSvgMode);
826
+ }
764
827
  } else {
765
- 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(
766
834
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
767
835
  );
768
836
  {
@@ -787,6 +855,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
787
855
  elm["s-cr"] = contentRef;
788
856
  elm["s-sn"] = newVNode2.$name$ || "";
789
857
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
858
+ patchSlotNode(elm);
790
859
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
791
860
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
792
861
  {
@@ -976,14 +1045,11 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
976
1045
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
977
1046
  const oldChildren = oldVNode.$children$;
978
1047
  const newChildren = newVNode2.$children$;
979
- const tag = newVNode2.$tag$;
980
1048
  const text = newVNode2.$text$;
981
1049
  let defaultHolder;
982
1050
  if (text === null) {
983
1051
  {
984
- if (tag === "slot" && !useNativeShadowDom) ; else {
985
- updateElement(oldVNode, newVNode2, isSvgMode);
986
- }
1052
+ updateElement(oldVNode, newVNode2, isSvgMode);
987
1053
  }
988
1054
  if (oldChildren !== null && newChildren !== null) {
989
1055
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -1122,8 +1188,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1122
1188
  markSlotContentForRelocation(rootVnode.$elm$);
1123
1189
  for (const relocateData of relocateNodes) {
1124
1190
  const nodeToRelocate = relocateData.$nodeToRelocate$;
1125
- if (!nodeToRelocate["s-ol"]) {
1126
- const orgLocationNode = doc.createTextNode("");
1191
+ if (!nodeToRelocate["s-ol"] && win.document) {
1192
+ const orgLocationNode = win.document.createTextNode("");
1127
1193
  orgLocationNode["s-nr"] = nodeToRelocate;
1128
1194
  insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1129
1195
  }
@@ -1164,7 +1230,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1164
1230
  }
1165
1231
  }
1166
1232
  }
1167
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
1233
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
1168
1234
  } else {
1169
1235
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1170
1236
  if (isInitialLoad) {
@@ -1227,10 +1293,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1227
1293
  hostRef.$queuedListeners$ = void 0;
1228
1294
  }
1229
1295
  }
1230
- {
1231
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1232
- }
1296
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1297
+ } else {
1298
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
1233
1299
  }
1300
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
1234
1301
  endSchedule();
1235
1302
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1236
1303
  };
@@ -1269,8 +1336,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1269
1336
  }
1270
1337
  }
1271
1338
  };
1339
+ var renderingRef = null;
1272
1340
  var callRender = (hostRef, instance, elm, isInitialLoad) => {
1273
1341
  try {
1342
+ renderingRef = instance;
1274
1343
  instance = instance.render() ;
1275
1344
  {
1276
1345
  hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
@@ -1288,22 +1357,23 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
1288
1357
  } catch (e) {
1289
1358
  consoleError(e, hostRef.$hostElement$);
1290
1359
  }
1360
+ renderingRef = null;
1291
1361
  return null;
1292
1362
  };
1363
+ var getRenderingRef = () => renderingRef;
1293
1364
  var postUpdateComponent = (hostRef) => {
1294
1365
  const tagName = hostRef.$cmpMeta$.$tagName$;
1295
1366
  const elm = hostRef.$hostElement$;
1296
1367
  const endPostUpdate = createTime("postUpdate", tagName);
1297
1368
  const instance = hostRef.$lazyInstance$ ;
1298
1369
  const ancestorComponent = hostRef.$ancestorComponent$;
1370
+ safeCall(instance, "componentDidRender", void 0, elm);
1299
1371
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1300
1372
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1301
1373
  {
1302
1374
  addHydratedFlag(elm);
1303
1375
  }
1304
- {
1305
- safeCall(instance, "componentDidLoad", void 0, elm);
1306
- }
1376
+ safeCall(instance, "componentDidLoad", void 0, elm);
1307
1377
  endPostUpdate();
1308
1378
  {
1309
1379
  hostRef.$onReadyResolve$(elm);
@@ -1312,9 +1382,7 @@ var postUpdateComponent = (hostRef) => {
1312
1382
  }
1313
1383
  }
1314
1384
  } else {
1315
- {
1316
- safeCall(instance, "componentDidUpdate", void 0, elm);
1317
- }
1385
+ safeCall(instance, "componentDidUpdate", void 0, elm);
1318
1386
  endPostUpdate();
1319
1387
  }
1320
1388
  {
@@ -1331,6 +1399,16 @@ var postUpdateComponent = (hostRef) => {
1331
1399
  hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1332
1400
  }
1333
1401
  };
1402
+ var forceUpdate = (ref) => {
1403
+ {
1404
+ const hostRef = getHostRef(ref);
1405
+ const isConnected = hostRef.$hostElement$.isConnected;
1406
+ if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1407
+ scheduleUpdate(hostRef, false);
1408
+ }
1409
+ return isConnected;
1410
+ }
1411
+ };
1334
1412
  var appDidLoad = (who) => {
1335
1413
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1336
1414
  };
@@ -1355,7 +1433,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1355
1433
  const hostRef = getHostRef(ref);
1356
1434
  if (!hostRef) {
1357
1435
  throw new Error(
1358
- `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).`
1436
+ `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).`
1359
1437
  );
1360
1438
  }
1361
1439
  const elm = hostRef.$hostElement$ ;
@@ -1381,6 +1459,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1381
1459
  }
1382
1460
  }
1383
1461
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1462
+ if (instance.componentShouldUpdate) {
1463
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1464
+ return;
1465
+ }
1466
+ }
1384
1467
  scheduleUpdate(hostRef, false);
1385
1468
  }
1386
1469
  }
@@ -1582,6 +1665,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1582
1665
  hostRef.$flags$ |= 128 /* isWatchReady */;
1583
1666
  }
1584
1667
  endNewInstance();
1668
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1585
1669
  } else {
1586
1670
  Cstr = elm.constructor;
1587
1671
  const cmpTag = elm.localName;
@@ -1609,6 +1693,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1609
1693
  }
1610
1694
  };
1611
1695
  var fireConnectedCallback = (instance, elm) => {
1696
+ {
1697
+ safeCall(instance, "connectedCallback", void 0, elm);
1698
+ }
1612
1699
  };
1613
1700
 
1614
1701
  // src/runtime/connected-callback.ts
@@ -1648,21 +1735,29 @@ var connectedCallback = (elm) => {
1648
1735
  }
1649
1736
  } else {
1650
1737
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1651
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1652
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1738
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1739
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1740
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1741
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1653
1742
  }
1654
1743
  }
1655
1744
  endConnected();
1656
1745
  }
1657
1746
  };
1658
1747
  var setContentReference = (elm) => {
1659
- const contentRefElm = elm["s-cr"] = doc.createComment(
1748
+ if (!win.document) {
1749
+ return;
1750
+ }
1751
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
1660
1752
  ""
1661
1753
  );
1662
1754
  contentRefElm["s-cn"] = true;
1663
1755
  insertBefore(elm, contentRefElm, elm.firstChild);
1664
1756
  };
1665
1757
  var disconnectInstance = (instance, elm) => {
1758
+ {
1759
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1760
+ }
1666
1761
  };
1667
1762
  var disconnectedCallback = async (elm) => {
1668
1763
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -1673,8 +1768,10 @@ var disconnectedCallback = async (elm) => {
1673
1768
  hostRef.$rmListeners$ = void 0;
1674
1769
  }
1675
1770
  }
1676
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1677
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1771
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1772
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1773
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1774
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1678
1775
  }
1679
1776
  }
1680
1777
  if (rootAppliedStyles.has(elm)) {
@@ -1688,18 +1785,22 @@ var disconnectedCallback = async (elm) => {
1688
1785
  // src/runtime/bootstrap-lazy.ts
1689
1786
  var bootstrapLazy = (lazyBundles, options = {}) => {
1690
1787
  var _a;
1788
+ if (!win.document) {
1789
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1790
+ return;
1791
+ }
1691
1792
  const endBootstrap = createTime();
1692
1793
  const cmpTags = [];
1693
1794
  const exclude = options.exclude || [];
1694
1795
  const customElements2 = win.customElements;
1695
- const head = doc.head;
1796
+ const head = win.document.head;
1696
1797
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1697
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
1798
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1698
1799
  const deferredConnectedCallbacks = [];
1699
1800
  let appLoadFallback;
1700
1801
  let isBootstrapping = true;
1701
1802
  Object.assign(plt, options);
1702
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
1803
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1703
1804
  let hasSlotRelocation = false;
1704
1805
  lazyBundles.map((lazyBundle) => {
1705
1806
  lazyBundle[1].map((compactMeta) => {
@@ -1802,7 +1903,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1802
1903
  }
1803
1904
  if (dataStyles.innerHTML.length) {
1804
1905
  dataStyles.setAttribute("data-styles", "");
1805
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1906
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1806
1907
  if (nonce != null) {
1807
1908
  dataStyles.setAttribute("nonce", nonce);
1808
1909
  }
@@ -1823,7 +1924,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1823
1924
  // src/runtime/fragment.ts
1824
1925
  var Fragment = (_, children) => children;
1825
1926
  var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1826
- if (listeners) {
1927
+ if (listeners && win.document) {
1827
1928
  listeners.map(([flags, name, method]) => {
1828
1929
  const target = elm;
1829
1930
  const handler = hostListenerProxy(hostRef, method);
@@ -1858,7 +1959,9 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
1858
1959
  exports.Fragment = Fragment;
1859
1960
  exports.bootstrapLazy = bootstrapLazy;
1860
1961
  exports.createEvent = createEvent;
1962
+ exports.forceUpdate = forceUpdate;
1861
1963
  exports.getElement = getElement;
1964
+ exports.getRenderingRef = getRenderingRef;
1862
1965
  exports.h = h;
1863
1966
  exports.promiseResolve = promiseResolve;
1864
1967
  exports.registerInstance = registerInstance;