@db-ux/wc-core-components 4.13.1-angular-signal-forms13-577b861 → 4.14.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 (145) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/bundle/db-badge.js +1 -1
  3. package/bundle/db-brand.js +1 -1
  4. package/bundle/db-checkbox.js +1 -1
  5. package/bundle/db-custom-select.js +1 -1
  6. package/bundle/db-drawer.js +1 -1
  7. package/bundle/db-header.js +1 -1
  8. package/bundle/db-input.js +1 -1
  9. package/bundle/db-navigation-item.js +1 -1
  10. package/bundle/db-notification.js +1 -1
  11. package/bundle/db-popover.js +1 -1
  12. package/bundle/db-select.js +1 -1
  13. package/bundle/db-switch.js +1 -1
  14. package/bundle/db-tabs.js +1 -1
  15. package/bundle/db-tag.js +1 -1
  16. package/bundle/db-textarea.js +1 -1
  17. package/bundle/db-tooltip.js +1 -1
  18. package/bundle/index.js +1 -1
  19. package/bundle/p-BXHP_qH1.js +1 -0
  20. package/bundle/{p-Be1wVxvg.js → p-Bl3Nkowh.js} +1 -1
  21. package/bundle/p-Bsv9xU74.js +1 -0
  22. package/bundle/p-C3D_kjdU.js +1 -0
  23. package/bundle/p-Cm3dPtkD.js +1 -0
  24. package/bundle/{p-By8B0zRG.js → p-Cmc3AFmy.js} +1 -1
  25. package/bundle/{p-C_qYW0Kh.js → p-DmKfvZy3.js} +1 -1
  26. package/bundle/p-DzJeNSBs.js +1 -0
  27. package/bundle/{p-Dd85RhMq.js → p-OXsRLHzG.js} +1 -1
  28. package/dist/cjs/{constants-bMY2_d8A.js → constants-Dy7QIUQi.js} +5 -1
  29. package/dist/cjs/db-badge.cjs.entry.js +1 -1
  30. package/dist/cjs/db-brand.cjs.entry.js +1 -1
  31. package/dist/cjs/db-checkbox.cjs.entry.js +1 -1
  32. package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +1 -1
  33. package/dist/cjs/db-custom-select.cjs.entry.js +40 -25
  34. package/dist/cjs/db-drawer.cjs.entry.js +1 -1
  35. package/dist/cjs/db-header.cjs.entry.js +3 -3
  36. package/dist/cjs/db-navigation-item.cjs.entry.js +3 -3
  37. package/dist/cjs/db-notification.cjs.entry.js +1 -1
  38. package/dist/cjs/db-popover.cjs.entry.js +50 -23
  39. package/dist/cjs/db-select.cjs.entry.js +1 -1
  40. package/dist/cjs/db-switch.cjs.entry.js +1 -1
  41. package/dist/cjs/db-tabs.cjs.entry.js +22 -17
  42. package/dist/cjs/db-textarea.cjs.entry.js +1 -1
  43. package/dist/cjs/db-tooltip.cjs.entry.js +40 -28
  44. package/dist/cjs/db-ux.cjs.js +1 -1
  45. package/dist/cjs/{document-click-listener-Bt1Iysz5.js → document-click-listener-DyO00UZC.js} +5 -9
  46. package/dist/cjs/{floating-components-SpHkZuLA.js → floating-components-Ns3Jt7dw.js} +161 -106
  47. package/dist/cjs/index.cjs.js +9 -6
  48. package/dist/cjs/intersection-observer-listener-BBUA6END.js +101 -0
  49. package/dist/cjs/loader.cjs.js +1 -1
  50. package/dist/cjs/{navigation-DUTSDY4q.js → navigation-fsWSnlKn.js} +1 -1
  51. package/dist/cjs/resize-observer-listener-B1uhHzqv.js +103 -0
  52. package/dist/collection/components/custom-select/custom-select.js +37 -20
  53. package/dist/collection/components/popover/popover.js +75 -46
  54. package/dist/collection/components/tabs/tabs.js +75 -18
  55. package/dist/collection/components/tooltip/tooltip.js +63 -49
  56. package/dist/collection/shared/constants.js +3 -1
  57. package/dist/collection/utils/abstract-document-listener.js +23 -0
  58. package/dist/collection/utils/abstract-observer-listener.js +61 -0
  59. package/dist/collection/utils/document-click-listener.js +5 -9
  60. package/dist/collection/utils/document-scroll-listener.js +5 -9
  61. package/dist/collection/utils/floating-components.js +161 -106
  62. package/dist/collection/utils/intersection-observer-listener.js +36 -0
  63. package/dist/collection/utils/resize-observer-listener.js +36 -0
  64. package/dist/custom-elements.json +232 -257
  65. package/dist/db-ux/db-ux.esm.js +1 -1
  66. package/dist/db-ux/index.esm.js +1 -1
  67. package/dist/db-ux/{p-d40a44ca.entry.js → p-1006233c.entry.js} +1 -1
  68. package/dist/db-ux/p-24767117.entry.js +1 -0
  69. package/dist/db-ux/{p-c83a359f.entry.js → p-40e78127.entry.js} +1 -1
  70. package/dist/db-ux/p-4a1282b9.entry.js +1 -0
  71. package/dist/db-ux/p-5b4ad0fd.entry.js +1 -0
  72. package/dist/db-ux/{p-dfc9ad26.entry.js → p-6a77f198.entry.js} +1 -1
  73. package/dist/db-ux/{p-1f740a3b.entry.js → p-6dfb57d0.entry.js} +1 -1
  74. package/dist/db-ux/p-775ef2b5.entry.js +1 -0
  75. package/dist/db-ux/p-78b4f191.entry.js +1 -0
  76. package/dist/db-ux/{p-2e66b25f.entry.js → p-7c26be27.entry.js} +1 -1
  77. package/dist/db-ux/{p-f4eb1ad4.entry.js → p-7fb6bf32.entry.js} +1 -1
  78. package/dist/db-ux/p-Bn4tE1v7.js +1 -0
  79. package/dist/db-ux/p-C3D_kjdU.js +1 -0
  80. package/dist/db-ux/p-Cm3dPtkD.js +1 -0
  81. package/dist/db-ux/{p-C_qYW0Kh.js → p-DmKfvZy3.js} +1 -1
  82. package/dist/db-ux/p-MhMqbaAW.js +1 -0
  83. package/dist/db-ux/p-aClGBxfA.js +1 -0
  84. package/dist/db-ux/{p-3649de37.entry.js → p-bfaec517.entry.js} +1 -1
  85. package/dist/db-ux/{p-3b9d4cc3.entry.js → p-c9b6ae8f.entry.js} +1 -1
  86. package/dist/db-ux/{p-c33fe9e0.entry.js → p-e8d5f721.entry.js} +1 -1
  87. package/dist/db-ux/{p-e35b2f5d.entry.js → p-fbb85f89.entry.js} +1 -1
  88. package/dist/esm/{constants-BdL-nI5y.js → constants-Cm3dPtkD.js} +4 -2
  89. package/dist/esm/db-badge.entry.js +1 -1
  90. package/dist/esm/db-brand.entry.js +1 -1
  91. package/dist/esm/db-checkbox.entry.js +1 -1
  92. package/dist/esm/db-custom-select-dropdown_5.entry.js +1 -1
  93. package/dist/esm/db-custom-select.entry.js +38 -23
  94. package/dist/esm/db-drawer.entry.js +1 -1
  95. package/dist/esm/db-header.entry.js +3 -3
  96. package/dist/esm/db-navigation-item.entry.js +3 -3
  97. package/dist/esm/db-notification.entry.js +1 -1
  98. package/dist/esm/db-popover.entry.js +48 -21
  99. package/dist/esm/db-select.entry.js +1 -1
  100. package/dist/esm/db-switch.entry.js +1 -1
  101. package/dist/esm/db-tabs.entry.js +22 -17
  102. package/dist/esm/db-textarea.entry.js +1 -1
  103. package/dist/esm/db-tooltip.entry.js +37 -25
  104. package/dist/esm/db-ux.js +1 -1
  105. package/dist/esm/{document-click-listener-B9qg-hEl.js → document-click-listener-Cqaqu5Jn.js} +5 -9
  106. package/dist/esm/{floating-components-C0q9XJSc.js → floating-components-C3D_kjdU.js} +162 -107
  107. package/dist/esm/index.js +6 -5
  108. package/dist/esm/intersection-observer-listener-DNd-fDFa.js +97 -0
  109. package/dist/esm/loader.js +1 -1
  110. package/dist/esm/{navigation-Cd7KZ6E2.js → navigation-BET7zThU.js} +1 -1
  111. package/dist/esm/resize-observer-listener-ed-nCkCj.js +100 -0
  112. package/dist/types/components/custom-select/custom-select.d.ts +3 -2
  113. package/dist/types/components/custom-select/model.d.ts +5 -1
  114. package/dist/types/components/popover/popover.d.ts +3 -2
  115. package/dist/types/components/tabs/model.d.ts +4 -12
  116. package/dist/types/components/tabs/tabs.d.ts +3 -1
  117. package/dist/types/components/tooltip/tooltip.d.ts +3 -2
  118. package/dist/types/components.d.ts +8 -2
  119. package/dist/types/shared/constants.d.ts +2 -0
  120. package/dist/types/shared/model.d.ts +27 -4
  121. package/dist/types/utils/abstract-document-listener.d.ts +18 -0
  122. package/dist/types/utils/abstract-observer-listener.d.ts +39 -0
  123. package/dist/types/utils/document-click-listener.d.ts +3 -3
  124. package/dist/types/utils/document-scroll-listener.d.ts +3 -3
  125. package/dist/types/utils/floating-components.d.ts +29 -6
  126. package/dist/types/utils/intersection-observer-listener.d.ts +15 -0
  127. package/dist/types/utils/resize-observer-listener.d.ts +15 -0
  128. package/dist/vscode.html-custom-data.json +29 -19
  129. package/dist/web-types.json +82 -75
  130. package/package.json +3 -3
  131. package/bundle/p-BdL-nI5y.js +0 -1
  132. package/bundle/p-C0q9XJSc.js +0 -1
  133. package/bundle/p-CTkfdjBp.js +0 -1
  134. package/bundle/p-LpyedXhR.js +0 -1
  135. package/dist/cjs/document-scroll-listener-Dd_hGebZ.js +0 -43
  136. package/dist/db-ux/p-177f3aeb.entry.js +0 -1
  137. package/dist/db-ux/p-2aee37e2.entry.js +0 -1
  138. package/dist/db-ux/p-550bd66a.entry.js +0 -1
  139. package/dist/db-ux/p-91d7fcc4.entry.js +0 -1
  140. package/dist/db-ux/p-B-HK8lhm.js +0 -1
  141. package/dist/db-ux/p-BdL-nI5y.js +0 -1
  142. package/dist/db-ux/p-C0q9XJSc.js +0 -1
  143. package/dist/db-ux/p-Z7eYHp_l.js +0 -1
  144. package/dist/db-ux/p-bc835df4.entry.js +0 -1
  145. package/dist/esm/document-scroll-listener-ewGU9bif.js +0 -41
@@ -1,4 +1,6 @@
1
+ import { DEFAULT_SCROLL_LEFT, DEFAULT_SCROLL_RIGHT, } from "../../shared/constants.js";
1
2
  import { cls, uuid } from "../../utils/index.js";
3
+ import { ResizeObserverListener } from "../../utils/resize-observer-listener.js";
2
4
  import { h, Fragment } from "@stencil/core";
3
5
  /**
4
6
  * @slot children - This is a default/unnamed slot
@@ -11,7 +13,7 @@ export class DBTabs {
11
13
  this.showScrollLeft = false;
12
14
  this.showScrollRight = false;
13
15
  this.scrollContainer = null;
14
- this._resizeObserver = undefined;
16
+ this._resizeObserverCallbackId = undefined;
15
17
  this.observer = undefined;
16
18
  }
17
19
  convertTabs() {
@@ -57,13 +59,14 @@ export class DBTabs {
57
59
  container.addEventListener("scroll", () => {
58
60
  this.evaluateScrollButtons(container);
59
61
  });
60
- // Use ResizeObserver to re-evaluate scroll buttons because it provides more accurate, container-specific resize detection than global window resize events.
61
- if (!this._resizeObserver) {
62
- const observer = new ResizeObserver(() => {
63
- this.evaluateScrollButtons(container);
64
- });
65
- observer.observe(container);
66
- this._resizeObserver = observer;
62
+ // Re-evaluate scroll buttons on container resize because it
63
+ // provides more accurate, container-specific resize
64
+ // detection than global window resize events.
65
+ if (!this._resizeObserverCallbackId) {
66
+ this._resizeObserverCallbackId =
67
+ new ResizeObserverListener().observe(container, () => {
68
+ this.evaluateScrollButtons(container);
69
+ });
67
70
  }
68
71
  }
69
72
  }
@@ -72,7 +75,7 @@ export class DBTabs {
72
75
  }
73
76
  initTabs(init) {
74
77
  if (this._ref) {
75
- const tabItems = Array.from(this._ref.getElementsByClassName("db-tab-item"));
78
+ const tabItems = Array.from(this._ref.querySelectorAll(":is(:scope > db-tab-list .db-tab-item, :scope > .db-tab-list .db-tab-item)"));
76
79
  const tabPanels = Array.from(this._ref.querySelectorAll(":is(:scope > .db-tab-panel, :scope > db-tab-panel > .db-tab-panel)"));
77
80
  for (const tabItem of tabItems) {
78
81
  const index = tabItems.indexOf(tabItem);
@@ -239,17 +242,19 @@ export class DBTabs {
239
242
  this.watch0Fn();
240
243
  }
241
244
  disconnectedCallback() {
242
- var _a, _b;
243
- (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
244
- this._resizeObserver = undefined;
245
- (_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
245
+ var _a;
246
+ if (this._resizeObserverCallbackId) {
247
+ new ResizeObserverListener().unobserve(this._resizeObserverCallbackId);
248
+ this._resizeObserverCallbackId = undefined;
249
+ }
250
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
246
251
  }
247
252
  render() {
248
- var _a, _b, _c, _d, _e, _f;
249
- return (h("div", { key: '4ea02dd31be437dd343d13cac953658f1799762f', class: cls("db-tabs", this.className), ref: (el) => {
253
+ var _a, _b, _c, _d, _e, _f, _g, _h;
254
+ return (h("div", { key: 'b56d0a78607c1e2c2f5f486243800136f3e15d09', class: cls("db-tabs", this.className), ref: (el) => {
250
255
  this._ref = el;
251
- }, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-orientation": this.orientation, "data-scroll-behavior": this.behavior, "data-alignment": (_c = this.alignment) !== null && _c !== void 0 ? _c : "start", "data-width": (_d = this.width) !== null && _d !== void 0 ? _d : "auto", onInput: (event) => this.handleChange(event), onChange: (event) => this.handleChange(event) }, this.showScrollLeft ? (h("db-button", { class: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: () => this.scroll(true) }, "Scroll left")) : null, this.tabs ? (h(Fragment, null, h("db-tab-list", null, (_e = this.convertTabs()) === null || _e === void 0 ? void 0 : _e.map((tab, index) => (h("db-tab-item", { key: this.name + "tab-item" + index, active: tab.active, label: tab.label, iconTrailing: tab.iconTrailing, icon: tab.icon, noText: tab.noText })))), (_f = this.convertTabs()) === null || _f === void 0 ? void 0 :
252
- _f.map((tab, index) => (h("db-tab-panel", { key: this.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null, this.showScrollRight ? (h("db-button", { class: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: () => this.scroll() }, "Scroll right")) : null, h("slot", { key: 'c7b47c275a5784b8658e9c8b339445e083bc40d6' })));
256
+ }, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-orientation": this.orientation, "data-scroll-behavior": this.behavior, "data-alignment": (_c = this.alignment) !== null && _c !== void 0 ? _c : "start", "data-width": (_d = this.width) !== null && _d !== void 0 ? _d : "auto", onInput: (event) => this.handleChange(event), onChange: (event) => this.handleChange(event) }, this.showScrollLeft ? (h("db-button", { class: "overflow-scroll-left-button", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: () => this.scroll(true) }, (_e = this.scrollLeftText) !== null && _e !== void 0 ? _e : DEFAULT_SCROLL_LEFT)) : null, this.tabs ? (h(Fragment, null, h("db-tab-list", null, (_f = this.convertTabs()) === null || _f === void 0 ? void 0 : _f.map((tab, index) => (h("db-tab-item", { key: this.name + "tab-item" + index, active: tab.active, label: tab.label, iconTrailing: tab.iconTrailing, icon: tab.icon, noText: tab.noText })))), (_g = this.convertTabs()) === null || _g === void 0 ? void 0 :
257
+ _g.map((tab, index) => (h("db-tab-panel", { key: this.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null, this.showScrollRight ? (h("db-button", { class: "overflow-scroll-right-button", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: () => this.scroll() }, (_h = this.scrollRightText) !== null && _h !== void 0 ? _h : DEFAULT_SCROLL_RIGHT)) : null, h("slot", { key: '7ebaa60822df074fd5435bd9e889519c8400c9a6' })));
253
258
  }
254
259
  static get is() { return "db-tabs"; }
255
260
  static get properties() {
@@ -563,6 +568,58 @@ export class DBTabs {
563
568
  "setter": false,
564
569
  "reflect": false,
565
570
  "attribute": "width"
571
+ },
572
+ "scrollLeftText": {
573
+ "type": "string",
574
+ "mutable": false,
575
+ "complexType": {
576
+ "original": "DBTabsProps[\"scrollLeftText\"]",
577
+ "resolved": "string",
578
+ "references": {
579
+ "DBTabsProps": {
580
+ "location": "import",
581
+ "path": "./model.js",
582
+ "id": "src/components/tabs/model.ts::DBTabsProps",
583
+ "referenceLocation": "DBTabsProps"
584
+ }
585
+ }
586
+ },
587
+ "required": false,
588
+ "optional": false,
589
+ "docs": {
590
+ "tags": [],
591
+ "text": ""
592
+ },
593
+ "getter": false,
594
+ "setter": false,
595
+ "reflect": false,
596
+ "attribute": "scroll-left-text"
597
+ },
598
+ "scrollRightText": {
599
+ "type": "string",
600
+ "mutable": false,
601
+ "complexType": {
602
+ "original": "DBTabsProps[\"scrollRightText\"]",
603
+ "resolved": "string",
604
+ "references": {
605
+ "DBTabsProps": {
606
+ "location": "import",
607
+ "path": "./model.js",
608
+ "id": "src/components/tabs/model.ts::DBTabsProps",
609
+ "referenceLocation": "DBTabsProps"
610
+ }
611
+ }
612
+ },
613
+ "required": false,
614
+ "optional": false,
615
+ "docs": {
616
+ "tags": [],
617
+ "text": ""
618
+ },
619
+ "getter": false,
620
+ "setter": false,
621
+ "reflect": false,
622
+ "attribute": "scroll-right-text"
566
623
  }
567
624
  };
568
625
  }
@@ -573,7 +630,7 @@ export class DBTabs {
573
630
  "showScrollLeft": {},
574
631
  "showScrollRight": {},
575
632
  "scrollContainer": {},
576
- "_resizeObserver": {},
633
+ "_resizeObserverCallbackId": {},
577
634
  "observer": {}
578
635
  };
579
636
  }
@@ -2,6 +2,8 @@ import { DEFAULT_ID } from "../../shared/constants.js";
2
2
  import { cls, getBooleanAsString, delay as utilsDelay, uuid, } from "../../utils/index.js";
3
3
  import { DocumentScrollListener } from "../../utils/document-scroll-listener.js";
4
4
  import { handleFixedPopover } from "../../utils/floating-components.js";
5
+ import { IntersectionObserverListener } from "../../utils/intersection-observer-listener.js";
6
+ import { ResizeObserverListener } from "../../utils/resize-observer-listener.js";
5
7
  import { h } from "@stencil/core";
6
8
  /**
7
9
  * @slot children - This is a default/unnamed slot
@@ -12,7 +14,8 @@ export class DBTooltip {
12
14
  this._id = DEFAULT_ID;
13
15
  this.initialized = false;
14
16
  this._documentScrollListenerCallbackId = undefined;
15
- this._observer = undefined;
17
+ this._intersectionObserverCallbackId = undefined;
18
+ this._resizeObserverCallbackId = undefined;
16
19
  this._attachedParent = undefined;
17
20
  this._attachedId = undefined;
18
21
  this._activeTriggerCount = 0;
@@ -43,10 +46,9 @@ export class DBTooltip {
43
46
  if (this._ref) {
44
47
  // This is a workaround for angular
45
48
  void utilsDelay(() => {
46
- var _a;
47
49
  // Due to race conditions we need to check for _ref again
48
50
  if (this._ref) {
49
- handleFixedPopover(this._ref, parent, (_a = this.placement) !== null && _a !== void 0 ? _a : "bottom");
51
+ handleFixedPopover(this._ref, parent);
50
52
  }
51
53
  }, 1);
52
54
  }
@@ -58,7 +60,7 @@ export class DBTooltip {
58
60
  }
59
61
  }
60
62
  handleLeave() {
61
- var _a, _b, _c;
63
+ var _a, _b;
62
64
  // Multiple triggers (hover + focus) can be active at once. Only tear
63
65
  // down the shared scroll callback/observer once the last one leaves.
64
66
  this._activeTriggerCount = Math.max(((_a = this._activeTriggerCount) !== null && _a !== void 0 ? _a : 0) - 1, 0);
@@ -69,10 +71,17 @@ export class DBTooltip {
69
71
  new DocumentScrollListener().removeCallback(this._documentScrollListenerCallbackId);
70
72
  this._documentScrollListenerCallbackId = undefined;
71
73
  }
72
- (_c = this._observer) === null || _c === void 0 ? void 0 : _c.unobserve(this.getParent());
74
+ if (this._resizeObserverCallbackId) {
75
+ new ResizeObserverListener().unobserve(this._resizeObserverCallbackId);
76
+ this._resizeObserverCallbackId = undefined;
77
+ }
78
+ if (this._intersectionObserverCallbackId) {
79
+ new IntersectionObserverListener().unobserve(this._intersectionObserverCallbackId);
80
+ this._intersectionObserverCallbackId = undefined;
81
+ }
73
82
  }
74
83
  handleEnter(parent) {
75
- var _a, _b;
84
+ var _a;
76
85
  // Register the shared scroll callback only for the first active
77
86
  // trigger; a second enter (e.g. focusin after mouseenter) must not
78
87
  // orphan the first callback.
@@ -80,7 +89,13 @@ export class DBTooltip {
80
89
  if (this._activeTriggerCount === 1) {
81
90
  this._documentScrollListenerCallbackId =
82
91
  new DocumentScrollListener().addCallback((event) => this.handleDocumentScroll(event, parent));
83
- (_b = this._observer) === null || _b === void 0 ? void 0 : _b.observe(this.getParent());
92
+ this._resizeObserverCallbackId = new ResizeObserverListener().observe(document.documentElement, () => this.handleAutoPlacement(parent));
93
+ this._intersectionObserverCallbackId =
94
+ new IntersectionObserverListener().observe(this.getParent(), (entry) => {
95
+ if (!entry.isIntersecting) {
96
+ this.handleEscape(false);
97
+ }
98
+ });
84
99
  }
85
100
  this.handleAutoPlacement(parent);
86
101
  }
@@ -89,16 +104,22 @@ export class DBTooltip {
89
104
  this._id = (_c = (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : "tooltip-" + uuid();
90
105
  }
91
106
  _detachListeners() {
92
- var _a, _b, _c;
107
+ var _a, _b;
93
108
  const callbackId = this._documentScrollListenerCallbackId;
94
109
  if (callbackId) {
95
110
  new DocumentScrollListener().removeCallback(callbackId);
96
111
  this._documentScrollListenerCallbackId = undefined;
97
112
  }
98
- (_a = this._observer) === null || _a === void 0 ? void 0 : _a.disconnect();
99
- this._observer = undefined;
113
+ if (this._resizeObserverCallbackId) {
114
+ new ResizeObserverListener().unobserve(this._resizeObserverCallbackId);
115
+ this._resizeObserverCallbackId = undefined;
116
+ }
117
+ if (this._intersectionObserverCallbackId) {
118
+ new IntersectionObserverListener().unobserve(this._intersectionObserverCallbackId);
119
+ this._intersectionObserverCallbackId = undefined;
120
+ }
100
121
  this._activeTriggerCount = 0;
101
- const bound = (_b = this._boundListeners) !== null && _b !== void 0 ? _b : [];
122
+ const bound = (_a = this._boundListeners) !== null && _a !== void 0 ? _a : [];
102
123
  bound.forEach((entry) => {
103
124
  entry.parent.removeEventListener(entry.type, entry.fn);
104
125
  });
@@ -107,7 +128,7 @@ export class DBTooltip {
107
128
  // they still belong to this tooltip (avoid clobbering another one).
108
129
  const parent = this._attachedParent;
109
130
  if (parent) {
110
- const attachedId = (_c = this._attachedId) !== null && _c !== void 0 ? _c : this._id;
131
+ const attachedId = (_b = this._attachedId) !== null && _b !== void 0 ? _b : this._id;
111
132
  // Only remove data-has-tooltip when no other .db-tooltip
112
133
  // siblings remain inside the same parent.
113
134
  const remainingTooltips = parent.querySelectorAll(".db-tooltip");
@@ -247,14 +268,6 @@ export class DBTooltip {
247
268
  this._attachedParent = parent;
248
269
  this._attachedId = this._id;
249
270
  }
250
- if (typeof window !== "undefined" && "IntersectionObserver" in window) {
251
- this._observer = new IntersectionObserver((payload) => {
252
- const entry = payload.find(({ target }) => target === this.getParent());
253
- if (entry && !entry.isIntersecting) {
254
- this.handleEscape(false);
255
- }
256
- });
257
- }
258
271
  this.initialized = false;
259
272
  }
260
273
  }
@@ -288,9 +301,9 @@ export class DBTooltip {
288
301
  }
289
302
  render() {
290
303
  var _a, _b;
291
- return (h("i", { key: 'a35fc9349a599145e2ea2287aa6467500854fadd', class: cls("db-tooltip", this.className), role: "tooltip", "aria-hidden": "true", "data-gap": "true", ref: (el) => {
304
+ return (h("i", { key: '326304e82ffcd0b203a89b26770c5ce31a37b409', class: cls("db-tooltip", this.className), role: "tooltip", "aria-hidden": "true", "data-gap": "true", ref: (el) => {
292
305
  this._ref = el;
293
- }, id: this._id, "data-emphasis": this.emphasis, "data-wrap": getBooleanAsString(this.wrap, "wrap"), "data-animation": getBooleanAsString((_a = this.animation) !== null && _a !== void 0 ? _a : true, "animation"), "data-delay": this.delay, "data-width": this.width, "data-show-arrow": getBooleanAsString((_b = this.showArrow) !== null && _b !== void 0 ? _b : true, "showArrow"), "data-placement": this.placement, onClick: (event) => this.handleClick(event) }, this.text ? this.text : null, h("slot", { key: '63d102dc8c4c4022c2dc3bad582f0167635adcb2' })));
306
+ }, id: this._id, "data-emphasis": this.emphasis, "data-wrap": getBooleanAsString(this.wrap, "wrap"), "data-animation": getBooleanAsString((_a = this.animation) !== null && _a !== void 0 ? _a : true, "animation"), "data-delay": this.delay, "data-width": this.width, "data-show-arrow": getBooleanAsString((_b = this.showArrow) !== null && _b !== void 0 ? _b : true, "showArrow"), "data-placement": this.placement, onClick: (event) => this.handleClick(event) }, this.text ? this.text : null, h("slot", { key: 'b85ec92d00150a21204c5afaa5e0e21933eb89c4' })));
294
307
  }
295
308
  static get is() { return "db-tooltip"; }
296
309
  static get properties() {
@@ -371,32 +384,6 @@ export class DBTooltip {
371
384
  "reflect": false,
372
385
  "attribute": "variant"
373
386
  },
374
- "placement": {
375
- "type": "string",
376
- "mutable": false,
377
- "complexType": {
378
- "original": "DBTooltipProps[\"placement\"]",
379
- "resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
380
- "references": {
381
- "DBTooltipProps": {
382
- "location": "import",
383
- "path": "./model.js",
384
- "id": "src/components/tooltip/model.ts::DBTooltipProps",
385
- "referenceLocation": "DBTooltipProps"
386
- }
387
- }
388
- },
389
- "required": false,
390
- "optional": false,
391
- "docs": {
392
- "tags": [],
393
- "text": ""
394
- },
395
- "getter": false,
396
- "setter": false,
397
- "reflect": false,
398
- "attribute": "placement"
399
- },
400
387
  "className": {
401
388
  "type": "string",
402
389
  "mutable": false,
@@ -579,6 +566,32 @@ export class DBTooltip {
579
566
  "reflect": false,
580
567
  "attribute": "show-arrow"
581
568
  },
569
+ "placement": {
570
+ "type": "string",
571
+ "mutable": false,
572
+ "complexType": {
573
+ "original": "DBTooltipProps[\"placement\"]",
574
+ "resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
575
+ "references": {
576
+ "DBTooltipProps": {
577
+ "location": "import",
578
+ "path": "./model.js",
579
+ "id": "src/components/tooltip/model.ts::DBTooltipProps",
580
+ "referenceLocation": "DBTooltipProps"
581
+ }
582
+ }
583
+ },
584
+ "required": false,
585
+ "optional": false,
586
+ "docs": {
587
+ "tags": [],
588
+ "text": ""
589
+ },
590
+ "getter": false,
591
+ "setter": false,
592
+ "reflect": false,
593
+ "attribute": "placement"
594
+ },
582
595
  "text": {
583
596
  "type": "string",
584
597
  "mutable": false,
@@ -612,7 +625,8 @@ export class DBTooltip {
612
625
  "_id": {},
613
626
  "initialized": {},
614
627
  "_documentScrollListenerCallbackId": {},
615
- "_observer": {},
628
+ "_intersectionObserverCallbackId": {},
629
+ "_resizeObserverCallbackId": {},
616
630
  "_attachedParent": {},
617
631
  "_attachedId": {},
618
632
  "_activeTriggerCount": {},
@@ -14,7 +14,9 @@ export const DEFAULT_INVALID_MESSAGE = 'TODO: Add an invalidMessage';
14
14
  export const DEFAULT_REMOVE = 'Remove';
15
15
  export const DEFAULT_BACK = 'Back';
16
16
  export const DEFAULT_SELECTED = 'Selected';
17
- export const DEFAULT_BURGER_MENU = 'BurgerMenu';
17
+ export const DEFAULT_SCROLL_LEFT = 'Scroll left';
18
+ export const DEFAULT_SCROLL_RIGHT = 'Scroll right';
19
+ export const DEFAULT_BURGER_MENU = 'Open navigation menu';
18
20
  export const DEFAULT_ICON = 'brand';
19
21
  export const DEFAULT_ROWS = 4;
20
22
  export const DEFAULT_CLOSE_BUTTON = 'Close';
@@ -0,0 +1,23 @@
1
+ import { uuid } from "./index.js";
2
+ /**
3
+ * Generic base class for singleton document event listeners.
4
+ * Manages a shared set of callbacks dispatched when a document-level
5
+ * event fires.
6
+ *
7
+ * Subclasses own their static state (callbacks, instance) and expose
8
+ * it via the abstract accessor methods below.
9
+ *
10
+ * @template TEvent - The event type passed to callbacks (Event, MouseEvent, etc.)
11
+ */
12
+ export class AbstractDocumentListener {
13
+ addCallback(callback) {
14
+ const id = uuid();
15
+ const callbacks = this.getCallbacks();
16
+ callbacks[id] = callback;
17
+ return id;
18
+ }
19
+ removeCallback(id) {
20
+ const callbacks = this.getCallbacks();
21
+ delete callbacks[id];
22
+ }
23
+ }
@@ -0,0 +1,61 @@
1
+ import { uuid } from "./index.js";
2
+ /**
3
+ * Generic base class for singleton observer listeners.
4
+ * Uses a Map<Element, Map<id, callback>> for O(1) element lookup in the
5
+ * observer handler — avoids quadratic scanning when many elements are observed.
6
+ *
7
+ * Subclasses own their static state (callbacksByElement, idToElement, observer,
8
+ * instance) and expose it via the abstract accessor methods below.
9
+ *
10
+ * @template TObserver - The observer type (ResizeObserver, IntersectionObserver, etc.)
11
+ * @template TEntry - The entry type passed to the callback
12
+ */
13
+ export class AbstractObserverListener {
14
+ observe(element, callback) {
15
+ const observer = this.getObserver();
16
+ if (!observer)
17
+ return undefined;
18
+ const id = uuid();
19
+ const callbacksByElement = this.getCallbacksByElement();
20
+ const idToElement = this.getIdToElement();
21
+ let elementCallbacks = callbacksByElement.get(element);
22
+ if (!elementCallbacks) {
23
+ elementCallbacks = new Map();
24
+ callbacksByElement.set(element, elementCallbacks);
25
+ // Only call observe on the native observer if this is a new element
26
+ this.observeElement(observer, element);
27
+ }
28
+ elementCallbacks.set(id, callback);
29
+ idToElement.set(id, element);
30
+ return id;
31
+ }
32
+ unobserve(id) {
33
+ const callbacksByElement = this.getCallbacksByElement();
34
+ const idToElement = this.getIdToElement();
35
+ const observer = this.getObserver();
36
+ const element = idToElement.get(id);
37
+ if (!element || !observer)
38
+ return;
39
+ const elementCallbacks = callbacksByElement.get(element);
40
+ if (elementCallbacks) {
41
+ elementCallbacks.delete(id);
42
+ // If no more callbacks for this element, unobserve it
43
+ if (elementCallbacks.size === 0) {
44
+ callbacksByElement.delete(element);
45
+ this.unobserveElement(observer, element);
46
+ }
47
+ }
48
+ idToElement.delete(id);
49
+ }
50
+ /**
51
+ * Called by subclass observer handlers to dispatch callbacks for an entry.
52
+ */
53
+ dispatchEntry(element, entry) {
54
+ const elementCallbacks = this.getCallbacksByElement().get(element);
55
+ if (elementCallbacks) {
56
+ elementCallbacks.forEach(callback => {
57
+ callback(entry);
58
+ });
59
+ }
60
+ }
61
+ }
@@ -1,5 +1,5 @@
1
- import { uuid } from "./index.js";
2
- export class DocumentClickListener {
1
+ import { AbstractDocumentListener } from "./abstract-document-listener.js";
2
+ export class DocumentClickListener extends AbstractDocumentListener {
3
3
  static runCallbacks(event) {
4
4
  for (const callback of Object.values(DocumentClickListener.callbacks)) {
5
5
  if (typeof callback === 'function') {
@@ -8,6 +8,7 @@ export class DocumentClickListener {
8
8
  }
9
9
  }
10
10
  constructor() {
11
+ super();
11
12
  if (DocumentClickListener._instance) {
12
13
  return DocumentClickListener._instance;
13
14
  }
@@ -16,13 +17,8 @@ export class DocumentClickListener {
16
17
  self.document.addEventListener('click', event => DocumentClickListener.runCallbacks(event));
17
18
  }
18
19
  }
19
- addCallback(callback) {
20
- const callbackID = uuid();
21
- DocumentClickListener.callbacks[callbackID] = callback;
22
- return callbackID;
23
- }
24
- removeCallback(id) {
25
- delete DocumentClickListener.callbacks[id];
20
+ getCallbacks() {
21
+ return DocumentClickListener.callbacks;
26
22
  }
27
23
  }
28
24
  DocumentClickListener.callbacks = {};
@@ -1,5 +1,5 @@
1
- import { uuid } from "./index.js";
2
- export class DocumentScrollListener {
1
+ import { AbstractDocumentListener } from "./abstract-document-listener.js";
2
+ export class DocumentScrollListener extends AbstractDocumentListener {
3
3
  static runCallbacks(event) {
4
4
  for (const callback of Object.values(DocumentScrollListener.callbacks)) {
5
5
  if (typeof callback === 'function') {
@@ -8,6 +8,7 @@ export class DocumentScrollListener {
8
8
  }
9
9
  }
10
10
  constructor() {
11
+ super();
11
12
  this.ticking = false;
12
13
  if (DocumentScrollListener._instance) {
13
14
  return DocumentScrollListener._instance;
@@ -25,13 +26,8 @@ export class DocumentScrollListener {
25
26
  }, true);
26
27
  }
27
28
  }
28
- addCallback(callback) {
29
- const callbackID = uuid();
30
- DocumentScrollListener.callbacks[callbackID] = callback;
31
- return callbackID;
32
- }
33
- removeCallback(id) {
34
- delete DocumentScrollListener.callbacks[id];
29
+ getCallbacks() {
30
+ return DocumentScrollListener.callbacks;
35
31
  }
36
32
  }
37
33
  DocumentScrollListener.callbacks = {};