@acorex/cdk 21.0.2-next.5 → 21.0.2-next.50

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 (58) hide show
  1. package/fesm2022/acorex-cdk-accordion.mjs +35 -35
  2. package/fesm2022/acorex-cdk-accordion.mjs.map +1 -1
  3. package/fesm2022/acorex-cdk-carousel.mjs +4 -4
  4. package/fesm2022/acorex-cdk-carousel.mjs.map +1 -1
  5. package/fesm2022/acorex-cdk-clipboard.mjs +7 -7
  6. package/fesm2022/acorex-cdk-clipboard.mjs.map +1 -1
  7. package/fesm2022/acorex-cdk-common.mjs +102 -103
  8. package/fesm2022/acorex-cdk-common.mjs.map +1 -1
  9. package/fesm2022/acorex-cdk-dom.mjs +3 -3
  10. package/fesm2022/acorex-cdk-double-click.mjs +5 -5
  11. package/fesm2022/acorex-cdk-double-click.mjs.map +1 -1
  12. package/fesm2022/acorex-cdk-drag-drop.mjs +68 -68
  13. package/fesm2022/acorex-cdk-drag-drop.mjs.map +1 -1
  14. package/fesm2022/acorex-cdk-drawer.mjs +35 -35
  15. package/fesm2022/acorex-cdk-drawer.mjs.map +1 -1
  16. package/fesm2022/acorex-cdk-focus-trap.mjs +19 -19
  17. package/fesm2022/acorex-cdk-focus-trap.mjs.map +1 -1
  18. package/fesm2022/acorex-cdk-full-screen.mjs +4 -4
  19. package/fesm2022/acorex-cdk-full-screen.mjs.map +1 -1
  20. package/fesm2022/acorex-cdk-horizontal-scroll.mjs +136 -0
  21. package/fesm2022/acorex-cdk-horizontal-scroll.mjs.map +1 -0
  22. package/fesm2022/acorex-cdk-input-mask.mjs +19 -13
  23. package/fesm2022/acorex-cdk-input-mask.mjs.map +1 -1
  24. package/fesm2022/acorex-cdk-list-navigation.mjs +17 -17
  25. package/fesm2022/acorex-cdk-list-navigation.mjs.map +1 -1
  26. package/fesm2022/acorex-cdk-outline.mjs +77 -66
  27. package/fesm2022/acorex-cdk-outline.mjs.map +1 -1
  28. package/fesm2022/acorex-cdk-overlay.mjs +17 -13
  29. package/fesm2022/acorex-cdk-overlay.mjs.map +1 -1
  30. package/fesm2022/acorex-cdk-pan-view.mjs +67 -49
  31. package/fesm2022/acorex-cdk-pan-view.mjs.map +1 -1
  32. package/fesm2022/acorex-cdk-resizable.mjs +46 -22
  33. package/fesm2022/acorex-cdk-resizable.mjs.map +1 -1
  34. package/fesm2022/acorex-cdk-selection.mjs +21 -21
  35. package/fesm2022/acorex-cdk-selection.mjs.map +1 -1
  36. package/fesm2022/acorex-cdk-sliding-item.mjs +11 -11
  37. package/fesm2022/acorex-cdk-sliding-item.mjs.map +1 -1
  38. package/fesm2022/acorex-cdk-sticky.mjs +3 -3
  39. package/fesm2022/acorex-cdk-uploader.mjs +298 -188
  40. package/fesm2022/acorex-cdk-uploader.mjs.map +1 -1
  41. package/fesm2022/acorex-cdk-virtual-scroll.mjs +17 -17
  42. package/fesm2022/acorex-cdk-virtual-scroll.mjs.map +1 -1
  43. package/fesm2022/acorex-cdk-wysiwyg.mjs +1 -1
  44. package/fesm2022/acorex-cdk-wysiwyg.mjs.map +1 -1
  45. package/fesm2022/acorex-cdk-z-index.mjs +4 -4
  46. package/fesm2022/acorex-cdk-z-index.mjs.map +1 -1
  47. package/horizontal-scroll/README.md +5 -0
  48. package/package.json +7 -2
  49. package/types/acorex-cdk-common.d.ts +1 -1
  50. package/types/acorex-cdk-drawer.d.ts +2 -0
  51. package/types/acorex-cdk-focus-trap.d.ts +2 -3
  52. package/types/acorex-cdk-horizontal-scroll.d.ts +44 -0
  53. package/types/acorex-cdk-input-mask.d.ts +1 -0
  54. package/types/acorex-cdk-outline.d.ts +1 -0
  55. package/types/acorex-cdk-overlay.d.ts +1 -0
  56. package/types/acorex-cdk-pan-view.d.ts +4 -0
  57. package/types/acorex-cdk-resizable.d.ts +2 -0
  58. package/types/acorex-cdk-uploader.d.ts +120 -110
@@ -1,6 +1,6 @@
1
1
  import { AXClipBoardService } from '@acorex/cdk/clipboard';
2
2
  import { AXUnsubscriber } from '@acorex/core/utils';
3
- import { isPlatformBrowser } from '@angular/common';
3
+ import { DOCUMENT, isPlatformBrowser } from '@angular/common';
4
4
  import * as i0 from '@angular/core';
5
5
  import { inject, NgZone, PLATFORM_ID, ElementRef, input, signal, computed, afterNextRender, Directive } from '@angular/core';
6
6
  import { Subject, BehaviorSubject, fromEvent, map, debounceTime } from 'rxjs';
@@ -9,55 +9,61 @@ class AXOutlineContainerDirective {
9
9
  constructor() {
10
10
  this.zone = inject(NgZone);
11
11
  this.platformId = inject(PLATFORM_ID);
12
+ this.document = inject(DOCUMENT);
12
13
  this.el = inject((ElementRef));
13
14
  this.unsubscriber = inject(AXUnsubscriber);
14
15
  this.clipboardService = inject(AXClipBoardService);
15
- this.target = input(...(ngDevMode ? [undefined, { debugName: "target" }] : []));
16
- this.smoothScroll = input(true, ...(ngDevMode ? [{ debugName: "smoothScroll" }] : []));
17
- this.showHashItem = input(false, ...(ngDevMode ? [{ debugName: "showHashItem" }] : []));
18
- this.activationOffset = input(16, ...(ngDevMode ? [{ debugName: "activationOffset" }] : []));
19
- this.copyUrlOnClick = input(false, ...(ngDevMode ? [{ debugName: "copyUrlOnClick" }] : []));
20
- this.activateLastAtBottom = input(true, ...(ngDevMode ? [{ debugName: "activateLastAtBottom" }] : []));
21
- this.scrollableElementId = input(null, ...(ngDevMode ? [{ debugName: "scrollableElementId" }] : []));
22
- this.scrollTop = signal(0, ...(ngDevMode ? [{ debugName: "scrollTop" }] : []));
23
- this.outlineItems = signal([], ...(ngDevMode ? [{ debugName: "outlineItems" }] : []));
24
- this.scrollableElement = computed(() => this.scrollableElementId()
25
- ? document.getElementById(this.scrollableElementId())
26
- : this.el.nativeElement, ...(ngDevMode ? [{ debugName: "scrollableElement" }] : []));
16
+ this.target = input(...(ngDevMode ? [undefined, { debugName: "target" }] : /* istanbul ignore next */ []));
17
+ this.smoothScroll = input(true, ...(ngDevMode ? [{ debugName: "smoothScroll" }] : /* istanbul ignore next */ []));
18
+ this.showHashItem = input(false, ...(ngDevMode ? [{ debugName: "showHashItem" }] : /* istanbul ignore next */ []));
19
+ this.activationOffset = input(16, ...(ngDevMode ? [{ debugName: "activationOffset" }] : /* istanbul ignore next */ []));
20
+ this.copyUrlOnClick = input(false, ...(ngDevMode ? [{ debugName: "copyUrlOnClick" }] : /* istanbul ignore next */ []));
21
+ this.activateLastAtBottom = input(true, ...(ngDevMode ? [{ debugName: "activateLastAtBottom" }] : /* istanbul ignore next */ []));
22
+ this.scrollableElementId = input(null, ...(ngDevMode ? [{ debugName: "scrollableElementId" }] : /* istanbul ignore next */ []));
23
+ this.scrollTop = signal(0, ...(ngDevMode ? [{ debugName: "scrollTop" }] : /* istanbul ignore next */ []));
24
+ this.outlineItems = signal([], ...(ngDevMode ? [{ debugName: "outlineItems" }] : /* istanbul ignore next */ []));
25
+ this.scrollableElement = computed(() => {
26
+ const scrollableElementId = this.scrollableElementId();
27
+ if (scrollableElementId) {
28
+ return this.document.getElementById(scrollableElementId) ?? this.el.nativeElement;
29
+ }
30
+ return this.el.nativeElement;
31
+ }, ...(ngDevMode ? [{ debugName: "scrollableElement" }] : /* istanbul ignore next */ []));
27
32
  this.mutationSubject = new Subject();
28
33
  this.MUTATION_DEBOUNCE_TIME = 150;
29
34
  this.outlineItems$ = new BehaviorSubject([]);
30
35
  this.#anr = afterNextRender(() => {
36
+ if (!isPlatformBrowser(this.platformId)) {
37
+ return;
38
+ }
31
39
  if (this.smoothScroll()) {
32
40
  this.scrollableElement().style.overflow = 'auto';
33
41
  this.scrollableElement().style.scrollBehavior = 'smooth';
34
42
  }
35
- if (isPlatformBrowser(this.platformId)) {
36
- this.zone.runOutsideAngular(() => {
37
- const scrollable = this.scrollableElement().tagName === 'HTML' ? window : this.scrollableElement();
38
- fromEvent(scrollable, 'scroll')
39
- .pipe(this.unsubscriber.takeUntilDestroy, map(() => this.scrollableElement().scrollTop))
40
- .subscribe((scrollTop) => {
41
- this.scrollTop.set(scrollTop);
42
- this.scrollChanged(scrollTop);
43
- });
44
- this.mutationObserver = new MutationObserver((mutationsList) => {
45
- const relevantMutation = mutationsList.some((mutation) => mutation.type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0));
46
- if (relevantMutation) {
47
- this.mutationSubject.next();
48
- }
49
- });
50
- this.mutationObserver.observe(this.el.nativeElement, {
51
- childList: true,
52
- subtree: true,
53
- });
43
+ this.zone.runOutsideAngular(() => {
44
+ const scrollable = this.scrollableElement().tagName === 'HTML' ? window : this.scrollableElement();
45
+ fromEvent(scrollable, 'scroll')
46
+ .pipe(this.unsubscriber.takeUntilDestroy, map(() => this.scrollableElement().scrollTop))
47
+ .subscribe((scrollTop) => {
48
+ this.scrollTop.set(scrollTop);
49
+ this.scrollChanged(scrollTop);
54
50
  });
55
- this.mutationSubject
56
- .pipe(debounceTime(this.MUTATION_DEBOUNCE_TIME), this.unsubscriber.takeUntilDestroy)
57
- .subscribe(() => {
58
- this.refreshOutlineItems();
51
+ this.mutationObserver = new MutationObserver((mutationsList) => {
52
+ const relevantMutation = mutationsList.some((mutation) => mutation.type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0));
53
+ if (relevantMutation) {
54
+ this.mutationSubject.next();
55
+ }
59
56
  });
60
- }
57
+ this.mutationObserver.observe(this.el.nativeElement, {
58
+ childList: true,
59
+ subtree: true,
60
+ });
61
+ });
62
+ this.mutationSubject
63
+ .pipe(debounceTime(this.MUTATION_DEBOUNCE_TIME), this.unsubscriber.takeUntilDestroy)
64
+ .subscribe(() => {
65
+ this.refreshOutlineItems();
66
+ });
61
67
  });
62
68
  }
63
69
  #anr;
@@ -67,7 +73,9 @@ class AXOutlineContainerDirective {
67
73
  }
68
74
  }
69
75
  ngAfterViewInit() {
70
- this.refreshOutlineItems();
76
+ if (isPlatformBrowser(this.platformId)) {
77
+ this.refreshOutlineItems();
78
+ }
71
79
  }
72
80
  scrollChanged(scrollTop) {
73
81
  this.outlineItems.update((prevItems) => {
@@ -97,6 +105,9 @@ class AXOutlineContainerDirective {
97
105
  this.outlineItems$.next(this.outlineItems());
98
106
  }
99
107
  setOutlineItems() {
108
+ if (!isPlatformBrowser(this.platformId)) {
109
+ return;
110
+ }
100
111
  if (this.mutationObserver) {
101
112
  this.mutationObserver.disconnect();
102
113
  }
@@ -105,18 +116,17 @@ class AXOutlineContainerDirective {
105
116
  targets.push(...this.el.nativeElement.querySelectorAll('[data-ax-outline-item="true"]'));
106
117
  const uniqueTargets = new Set(targets);
107
118
  const outlineItems = Array.from(uniqueTargets)
108
- .filter((el) => {
109
- return el.dataset['axOutlineItem'] !== 'false';
110
- })
119
+ .filter((el) => el.getAttribute('data-ax-outline-item') !== 'false')
111
120
  .map((el) => {
112
- let fragment = el.id;
121
+ const htmlEl = el;
122
+ let fragment = htmlEl.id;
113
123
  if (!fragment) {
114
- const textContentForId = el.textContent?.trim() ?? ''; // Read text BEFORE adding/modifying for hash
124
+ const textContentForId = htmlEl.textContent?.trim() ?? ''; // Read text BEFORE adding/modifying for hash
115
125
  if (textContentForId) {
116
126
  fragment = `${textContentForId.toLowerCase().replace(/\s+/g, '-')}`;
117
127
  let counter = 1;
118
128
  const originalFragment = fragment;
119
- while (document.getElementById(fragment)) {
129
+ while (this.document.getElementById(fragment)) {
120
130
  fragment = `${originalFragment}-${counter}`;
121
131
  counter++;
122
132
  }
@@ -124,15 +134,15 @@ class AXOutlineContainerDirective {
124
134
  else {
125
135
  fragment = `ax-outline-${Math.random().toString(36).slice(2, 7)}`;
126
136
  }
127
- el.id = fragment; // Set the ID on the element
137
+ htmlEl.id = fragment; // Set the ID on the element
128
138
  }
129
- el.style.scrollMargin = `${this.activationOffset()}px`;
130
- const existingLink = el.querySelector('a.ax-outline-hash-link');
139
+ htmlEl.style.scrollMargin = `${this.activationOffset()}px`;
140
+ const existingLink = htmlEl.querySelector('a.ax-outline-hash-link');
131
141
  if (existingLink) {
132
142
  existingLink.remove();
133
143
  }
134
- if (this.showHashItem()) {
135
- const anchor = document.createElement('a');
144
+ if (this.showHashItem() && isPlatformBrowser(this.platformId)) {
145
+ const anchor = this.document.createElement('a');
136
146
  anchor.textContent = '#';
137
147
  anchor.href = `${window.location.pathname}${window.location.search}#${fragment}`;
138
148
  anchor.classList.add('ax-outline-hash-link');
@@ -145,9 +155,9 @@ class AXOutlineContainerDirective {
145
155
  anchor.setAttribute('fragment', fragment);
146
156
  const enterListener = () => (anchor.style.opacity = '1');
147
157
  const leaveListener = () => (anchor.style.opacity = '0');
148
- el.addEventListener('mouseenter', enterListener);
149
- el.addEventListener('mouseleave', leaveListener);
150
- el.appendChild(anchor);
158
+ htmlEl.addEventListener('mouseenter', enterListener);
159
+ htmlEl.addEventListener('mouseleave', leaveListener);
160
+ htmlEl.appendChild(anchor);
151
161
  if (this.copyUrlOnClick()) {
152
162
  anchor.addEventListener('click', async () => {
153
163
  try {
@@ -159,14 +169,14 @@ class AXOutlineContainerDirective {
159
169
  });
160
170
  }
161
171
  }
162
- const parentId = el.dataset['parent'];
172
+ const parentId = htmlEl.getAttribute('data-parent') ?? undefined;
163
173
  // Calculate position relative to the scrollable element
164
174
  const scrollableElement = this.scrollableElement();
165
- const scrollableRect = scrollableElement.getBoundingClientRect();
166
- const elementRect = el.getBoundingClientRect();
167
- const relativeScrollY = elementRect.top - scrollableRect.top + scrollableElement.scrollTop;
175
+ const scrollableRect = scrollableElement?.getBoundingClientRect() ?? { top: 0 };
176
+ const elementRect = htmlEl.getBoundingClientRect();
177
+ const relativeScrollY = elementRect.top - scrollableRect.top + (scrollableElement?.scrollTop ?? 0);
168
178
  return {
169
- el,
179
+ el: htmlEl,
170
180
  id: fragment,
171
181
  active: false,
172
182
  parentId: parentId,
@@ -188,10 +198,10 @@ class AXOutlineContainerDirective {
188
198
  refreshOutlineItems() {
189
199
  this.setOutlineItems();
190
200
  }
191
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: AXOutlineContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
192
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.3", type: AXOutlineContainerDirective, isStandalone: true, selector: "[axOutlineContainer]", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, smoothScroll: { classPropertyName: "smoothScroll", publicName: "smoothScroll", isSignal: true, isRequired: false, transformFunction: null }, showHashItem: { classPropertyName: "showHashItem", publicName: "showHashItem", isSignal: true, isRequired: false, transformFunction: null }, activationOffset: { classPropertyName: "activationOffset", publicName: "activationOffset", isSignal: true, isRequired: false, transformFunction: null }, copyUrlOnClick: { classPropertyName: "copyUrlOnClick", publicName: "copyUrlOnClick", isSignal: true, isRequired: false, transformFunction: null }, activateLastAtBottom: { classPropertyName: "activateLastAtBottom", publicName: "activateLastAtBottom", isSignal: true, isRequired: false, transformFunction: null }, scrollableElementId: { classPropertyName: "scrollableElementId", publicName: "scrollableElementId", isSignal: true, isRequired: false, transformFunction: null } }, providers: [AXUnsubscriber, AXClipBoardService], exportAs: ["axOutlineContainer"], ngImport: i0 }); }
201
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOutlineContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
202
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: AXOutlineContainerDirective, isStandalone: true, selector: "[axOutlineContainer]", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, smoothScroll: { classPropertyName: "smoothScroll", publicName: "smoothScroll", isSignal: true, isRequired: false, transformFunction: null }, showHashItem: { classPropertyName: "showHashItem", publicName: "showHashItem", isSignal: true, isRequired: false, transformFunction: null }, activationOffset: { classPropertyName: "activationOffset", publicName: "activationOffset", isSignal: true, isRequired: false, transformFunction: null }, copyUrlOnClick: { classPropertyName: "copyUrlOnClick", publicName: "copyUrlOnClick", isSignal: true, isRequired: false, transformFunction: null }, activateLastAtBottom: { classPropertyName: "activateLastAtBottom", publicName: "activateLastAtBottom", isSignal: true, isRequired: false, transformFunction: null }, scrollableElementId: { classPropertyName: "scrollableElementId", publicName: "scrollableElementId", isSignal: true, isRequired: false, transformFunction: null } }, providers: [AXUnsubscriber, AXClipBoardService], exportAs: ["axOutlineContainer"], ngImport: i0 }); }
193
203
  }
194
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: AXOutlineContainerDirective, decorators: [{
204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOutlineContainerDirective, decorators: [{
195
205
  type: Directive,
196
206
  args: [{
197
207
  selector: '[axOutlineContainer]',
@@ -203,10 +213,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
203
213
  class AXOutlineItemDirective {
204
214
  constructor() {
205
215
  this.el = inject(ElementRef);
206
- this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
207
- this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
216
+ this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
217
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
208
218
  this.#anr = afterNextRender(() => {
209
- this.el.nativeElement.dataset['axOutlineItem'] = this.disabled() ? 'false' : 'true';
219
+ const element = this.el.nativeElement;
220
+ element.setAttribute('data-ax-outline-item', this.disabled() ? 'false' : 'true');
210
221
  let newId;
211
222
  if (!this.id()) {
212
223
  const textContent = this.el.nativeElement.textContent.trim();
@@ -221,10 +232,10 @@ class AXOutlineItemDirective {
221
232
  });
222
233
  }
223
234
  #anr;
224
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: AXOutlineItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
225
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.3", type: AXOutlineItemDirective, isStandalone: true, selector: "[axOutlineItem]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["axOutlineItem"], ngImport: i0 }); }
235
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOutlineItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
236
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: AXOutlineItemDirective, isStandalone: true, selector: "[axOutlineItem]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["axOutlineItem"], ngImport: i0 }); }
226
237
  }
227
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: AXOutlineItemDirective, decorators: [{
238
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOutlineItemDirective, decorators: [{
228
239
  type: Directive,
229
240
  args: [{
230
241
  selector: '[axOutlineItem]',
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-cdk-outline.mjs","sources":["../../../../packages/cdk/outline/src/lib/outline-container.directive.ts","../../../../packages/cdk/outline/src/lib/outline-item.directive.ts","../../../../packages/cdk/outline/src/acorex-cdk-outline.ts"],"sourcesContent":["import { AXClipBoardService } from '@acorex/cdk/clipboard';\nimport { AXUnsubscriber } from '@acorex/core/utils';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n AfterViewInit,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n NgZone,\n OnDestroy,\n PLATFORM_ID,\n signal,\n} from '@angular/core';\nimport { BehaviorSubject, debounceTime, fromEvent, map, Subject } from 'rxjs';\n\nexport type outlineItemType = {\n id: string;\n el: HTMLElement;\n active: boolean;\n scrollY: number;\n parentId?: string;\n hasAnchor: boolean;\n};\n\n@Directive({\n selector: '[axOutlineContainer]',\n exportAs: 'axOutlineContainer',\n providers: [AXUnsubscriber, AXClipBoardService],\n})\nexport class AXOutlineContainerDirective implements OnDestroy, AfterViewInit {\n private zone = inject(NgZone);\n private platformId = inject(PLATFORM_ID);\n private el = inject(ElementRef<HTMLElement>);\n private unsubscriber = inject(AXUnsubscriber);\n private clipboardService = inject(AXClipBoardService);\n\n target = input<string>();\n smoothScroll = input(true);\n showHashItem = input(false);\n activationOffset = input(16);\n copyUrlOnClick = input(false);\n activateLastAtBottom = input(true);\n scrollableElementId = input<string | null>(null);\n\n private scrollTop = signal(0);\n private outlineItems = signal<outlineItemType[]>([]);\n\n private scrollableElement = computed(() =>\n this.scrollableElementId()\n ? document.getElementById(this.scrollableElementId())\n : (this.el.nativeElement as HTMLElement),\n );\n\n private mutationSubject = new Subject<void>();\n private readonly MUTATION_DEBOUNCE_TIME = 150;\n private mutationObserver: MutationObserver | undefined;\n outlineItems$ = new BehaviorSubject<outlineItemType[]>([]);\n\n #anr = afterNextRender(() => {\n if (this.smoothScroll()) {\n this.scrollableElement().style.overflow = 'auto';\n this.scrollableElement().style.scrollBehavior = 'smooth';\n }\n\n if (isPlatformBrowser(this.platformId)) {\n this.zone.runOutsideAngular(() => {\n const scrollable = this.scrollableElement().tagName === 'HTML' ? window : this.scrollableElement();\n fromEvent(scrollable, 'scroll')\n .pipe(\n this.unsubscriber.takeUntilDestroy,\n map(() => this.scrollableElement().scrollTop),\n )\n .subscribe((scrollTop) => {\n this.scrollTop.set(scrollTop);\n this.scrollChanged(scrollTop);\n });\n\n this.mutationObserver = new MutationObserver((mutationsList) => {\n const relevantMutation = mutationsList.some(\n (mutation) =>\n mutation.type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0),\n );\n if (relevantMutation) {\n this.mutationSubject.next();\n }\n });\n\n this.mutationObserver.observe(this.el.nativeElement, {\n childList: true,\n subtree: true,\n });\n });\n\n this.mutationSubject\n .pipe(debounceTime(this.MUTATION_DEBOUNCE_TIME), this.unsubscriber.takeUntilDestroy)\n .subscribe(() => {\n this.refreshOutlineItems();\n });\n }\n });\n\n ngOnDestroy(): void {\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n }\n\n ngAfterViewInit() {\n this.refreshOutlineItems();\n }\n\n private scrollChanged(scrollTop: number) {\n this.outlineItems.update((prevItems) => {\n if (prevItems.length === 0) return prevItems;\n\n const scrollHeight = this.scrollableElement().scrollHeight;\n const clientHeight = this.scrollableElement().clientHeight;\n const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;\n\n if (isAtBottom && this.activateLastAtBottom()) {\n return prevItems.map((item, index) => ({\n ...item,\n active: index === prevItems.length - 1,\n }));\n }\n\n let activeIndex = -1;\n for (let i = 0; i < prevItems.length; i++) {\n const item = prevItems[i];\n if (scrollTop >= item.scrollY - this.activationOffset()) {\n activeIndex = i;\n }\n }\n return prevItems.map((item, index) => ({\n ...item,\n active: index === activeIndex,\n }));\n });\n this.outlineItems$.next(this.outlineItems());\n }\n\n private setOutlineItems() {\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n\n setTimeout(() => {\n const targets = this.target() ? [...this.el.nativeElement.querySelectorAll(this.target())] : [];\n targets.push(...this.el.nativeElement.querySelectorAll('[data-ax-outline-item=\"true\"]'));\n const uniqueTargets = new Set(targets);\n\n const outlineItems = Array.from(uniqueTargets)\n .filter((el) => {\n return el.dataset['axOutlineItem'] !== 'false';\n })\n .map((el: HTMLElement) => {\n let fragment = el.id;\n if (!fragment) {\n const textContentForId = el.textContent?.trim() ?? ''; // Read text BEFORE adding/modifying for hash\n if (textContentForId) {\n fragment = `${textContentForId.toLowerCase().replace(/\\s+/g, '-')}`;\n let counter = 1;\n const originalFragment = fragment;\n while (document.getElementById(fragment)) {\n fragment = `${originalFragment}-${counter}`;\n counter++;\n }\n } else {\n fragment = `ax-outline-${Math.random().toString(36).slice(2, 7)}`;\n }\n el.id = fragment; // Set the ID on the element\n }\n\n el.style.scrollMargin = `${this.activationOffset()}px`;\n\n const existingLink = el.querySelector('a.ax-outline-hash-link');\n if (existingLink) {\n existingLink.remove();\n }\n\n if (this.showHashItem()) {\n const anchor = document.createElement('a');\n anchor.textContent = '#';\n anchor.href = `${window.location.pathname}${window.location.search}#${fragment}`;\n anchor.classList.add('ax-outline-hash-link');\n\n // Styling for the hash link\n anchor.style.paddingInlineStart = '0.5rem'; // Adjust as needed\n anchor.style.opacity = '0';\n anchor.style.transition = 'opacity 0.2s ease-in-out';\n anchor.style.cursor = 'pointer';\n anchor.setAttribute('aria-hidden', 'true');\n anchor.setAttribute('fragment', fragment);\n\n const enterListener = () => (anchor.style.opacity = '1');\n const leaveListener = () => (anchor.style.opacity = '0');\n\n el.addEventListener('mouseenter', enterListener);\n el.addEventListener('mouseleave', leaveListener);\n\n el.appendChild(anchor);\n\n if (this.copyUrlOnClick()) {\n anchor.addEventListener('click', async () => {\n try {\n await this.clipboardService.copy(anchor.href);\n } catch (err) {\n console.error('Failed to copy outline URL:', err);\n }\n });\n }\n }\n\n const parentId = el.dataset['parent'];\n\n // Calculate position relative to the scrollable element\n const scrollableElement = this.scrollableElement();\n const scrollableRect = scrollableElement.getBoundingClientRect();\n const elementRect = el.getBoundingClientRect();\n const relativeScrollY = elementRect.top - scrollableRect.top + scrollableElement.scrollTop;\n\n return {\n el,\n id: fragment,\n active: false,\n parentId: parentId,\n scrollY: relativeScrollY,\n hasAnchor: this.showHashItem(),\n };\n })\n .sort((a, b) => a.scrollY - b.scrollY);\n\n this.outlineItems.set(outlineItems);\n this.scrollChanged(this.scrollTop());\n\n if (this.mutationObserver) {\n this.mutationObserver.observe(this.el.nativeElement, {\n childList: true,\n subtree: true,\n });\n }\n });\n }\n\n public refreshOutlineItems() {\n this.setOutlineItems();\n }\n}\n","import { afterNextRender, Directive, ElementRef, inject, input } from '@angular/core';\n\n@Directive({\n selector: '[axOutlineItem]',\n exportAs: 'axOutlineItem',\n})\nexport class AXOutlineItemDirective {\n private el = inject(ElementRef);\n\n id = input<string>();\n disabled = input(false);\n\n #anr = afterNextRender(() => {\n (this.el.nativeElement as HTMLElement).dataset['axOutlineItem'] = this.disabled() ? 'false' : 'true';\n\n let newId;\n if (!this.id()) {\n const textContent = this.el.nativeElement.textContent.trim();\n if (textContent) {\n newId = `${textContent.replace(/\\s+/g, '-')}`;\n } else {\n newId = `${Math.random().toString(36).slice(2, 7)}`;\n }\n this.el.nativeElement.id = newId;\n }\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAgCa,2BAA2B,CAAA;AALxC,IAAA,WAAA,GAAA;AAMU,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AACrB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC;AACpC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC;QAErD,IAAA,CAAA,MAAM,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,QAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AACxB,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,IAAI,wDAAC;AAC1B,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,KAAK,wDAAC;AAC3B,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAC,EAAE,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AAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,eAAe;AAC1B,iBAAA;;;ACLD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-cdk-outline.mjs","sources":["../../../../packages/cdk/outline/src/lib/outline-container.directive.ts","../../../../packages/cdk/outline/src/lib/outline-item.directive.ts","../../../../packages/cdk/outline/src/acorex-cdk-outline.ts"],"sourcesContent":["import { AXClipBoardService } from '@acorex/cdk/clipboard';\nimport { AXUnsubscriber } from '@acorex/core/utils';\nimport { isPlatformBrowser, DOCUMENT } from '@angular/common';\nimport {\n afterNextRender,\n AfterViewInit,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n NgZone,\n OnDestroy,\n PLATFORM_ID,\n signal,\n} from '@angular/core';\nimport { BehaviorSubject, debounceTime, fromEvent, map, Subject } from 'rxjs';\n\nexport type outlineItemType = {\n id: string;\n el: HTMLElement;\n active: boolean;\n scrollY: number;\n parentId?: string;\n hasAnchor: boolean;\n};\n\n@Directive({\n selector: '[axOutlineContainer]',\n exportAs: 'axOutlineContainer',\n providers: [AXUnsubscriber, AXClipBoardService],\n})\nexport class AXOutlineContainerDirective implements OnDestroy, AfterViewInit {\n private zone = inject(NgZone);\n private platformId = inject(PLATFORM_ID);\n private document = inject(DOCUMENT);\n private el = inject(ElementRef<HTMLElement>);\n private unsubscriber = inject(AXUnsubscriber);\n private clipboardService = inject(AXClipBoardService);\n\n target = input<string>();\n smoothScroll = input(true);\n showHashItem = input(false);\n activationOffset = input(16);\n copyUrlOnClick = input(false);\n activateLastAtBottom = input(true);\n scrollableElementId = input<string | null>(null);\n\n private scrollTop = signal(0);\n private outlineItems = signal<outlineItemType[]>([]);\n\n private scrollableElement = computed(() => {\n const scrollableElementId = this.scrollableElementId();\n if (scrollableElementId) {\n return this.document.getElementById(scrollableElementId) ?? this.el.nativeElement;\n }\n return this.el.nativeElement;\n });\n\n private mutationSubject = new Subject<void>();\n private readonly MUTATION_DEBOUNCE_TIME = 150;\n private mutationObserver: MutationObserver | undefined;\n outlineItems$ = new BehaviorSubject<outlineItemType[]>([]);\n\n #anr = afterNextRender(() => {\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n if (this.smoothScroll()) {\n this.scrollableElement().style.overflow = 'auto';\n this.scrollableElement().style.scrollBehavior = 'smooth';\n }\n\n this.zone.runOutsideAngular(() => {\n const scrollable = this.scrollableElement().tagName === 'HTML' ? window : this.scrollableElement();\n fromEvent(scrollable, 'scroll')\n .pipe(\n this.unsubscriber.takeUntilDestroy,\n map(() => this.scrollableElement().scrollTop),\n )\n .subscribe((scrollTop) => {\n this.scrollTop.set(scrollTop);\n this.scrollChanged(scrollTop);\n });\n\n this.mutationObserver = new MutationObserver((mutationsList) => {\n const relevantMutation = mutationsList.some(\n (mutation) =>\n mutation.type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0),\n );\n if (relevantMutation) {\n this.mutationSubject.next();\n }\n });\n\n this.mutationObserver.observe(this.el.nativeElement, {\n childList: true,\n subtree: true,\n });\n });\n\n this.mutationSubject\n .pipe(debounceTime(this.MUTATION_DEBOUNCE_TIME), this.unsubscriber.takeUntilDestroy)\n .subscribe(() => {\n this.refreshOutlineItems();\n });\n });\n\n ngOnDestroy(): void {\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n }\n\n ngAfterViewInit() {\n if (isPlatformBrowser(this.platformId)) {\n this.refreshOutlineItems();\n }\n }\n\n private scrollChanged(scrollTop: number) {\n this.outlineItems.update((prevItems) => {\n if (prevItems.length === 0) return prevItems;\n\n const scrollHeight = this.scrollableElement().scrollHeight;\n const clientHeight = this.scrollableElement().clientHeight;\n const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;\n\n if (isAtBottom && this.activateLastAtBottom()) {\n return prevItems.map((item, index) => ({\n ...item,\n active: index === prevItems.length - 1,\n }));\n }\n\n let activeIndex = -1;\n for (let i = 0; i < prevItems.length; i++) {\n const item = prevItems[i];\n if (scrollTop >= item.scrollY - this.activationOffset()) {\n activeIndex = i;\n }\n }\n return prevItems.map((item, index) => ({\n ...item,\n active: index === activeIndex,\n }));\n });\n this.outlineItems$.next(this.outlineItems());\n }\n\n private setOutlineItems() {\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n\n setTimeout(() => {\n const targets = this.target() ? [...this.el.nativeElement.querySelectorAll(this.target())] : [];\n targets.push(...this.el.nativeElement.querySelectorAll('[data-ax-outline-item=\"true\"]'));\n const uniqueTargets = new Set(targets);\n\n const outlineItems = Array.from(uniqueTargets)\n .filter((el) => el.getAttribute('data-ax-outline-item') !== 'false')\n .map((el) => {\n const htmlEl = el as HTMLElement;\n let fragment = htmlEl.id;\n if (!fragment) {\n const textContentForId = htmlEl.textContent?.trim() ?? ''; // Read text BEFORE adding/modifying for hash\n if (textContentForId) {\n fragment = `${textContentForId.toLowerCase().replace(/\\s+/g, '-')}`;\n let counter = 1;\n const originalFragment = fragment;\n while (this.document.getElementById(fragment)) {\n fragment = `${originalFragment}-${counter}`;\n counter++;\n }\n } else {\n fragment = `ax-outline-${Math.random().toString(36).slice(2, 7)}`;\n }\n htmlEl.id = fragment; // Set the ID on the element\n }\n\n htmlEl.style.scrollMargin = `${this.activationOffset()}px`;\n\n const existingLink = htmlEl.querySelector('a.ax-outline-hash-link');\n if (existingLink) {\n existingLink.remove();\n }\n\n if (this.showHashItem() && isPlatformBrowser(this.platformId)) {\n const anchor = this.document.createElement('a');\n anchor.textContent = '#';\n anchor.href = `${window.location.pathname}${window.location.search}#${fragment}`;\n anchor.classList.add('ax-outline-hash-link');\n\n // Styling for the hash link\n anchor.style.paddingInlineStart = '0.5rem'; // Adjust as needed\n anchor.style.opacity = '0';\n anchor.style.transition = 'opacity 0.2s ease-in-out';\n anchor.style.cursor = 'pointer';\n anchor.setAttribute('aria-hidden', 'true');\n anchor.setAttribute('fragment', fragment);\n\n const enterListener = () => (anchor.style.opacity = '1');\n const leaveListener = () => (anchor.style.opacity = '0');\n\n htmlEl.addEventListener('mouseenter', enterListener);\n htmlEl.addEventListener('mouseleave', leaveListener);\n\n htmlEl.appendChild(anchor);\n\n if (this.copyUrlOnClick()) {\n anchor.addEventListener('click', async () => {\n try {\n await this.clipboardService.copy(anchor.href);\n } catch (err) {\n console.error('Failed to copy outline URL:', err);\n }\n });\n }\n }\n\n const parentId = htmlEl.getAttribute('data-parent') ?? undefined;\n\n // Calculate position relative to the scrollable element\n const scrollableElement = this.scrollableElement();\n const scrollableRect = scrollableElement?.getBoundingClientRect() ?? { top: 0 };\n const elementRect = htmlEl.getBoundingClientRect();\n const relativeScrollY = elementRect.top - scrollableRect.top + (scrollableElement?.scrollTop ?? 0);\n\n return {\n el: htmlEl,\n id: fragment,\n active: false,\n parentId: parentId,\n scrollY: relativeScrollY,\n hasAnchor: this.showHashItem(),\n };\n })\n .sort((a, b) => a.scrollY - b.scrollY);\n\n this.outlineItems.set(outlineItems);\n this.scrollChanged(this.scrollTop());\n\n if (this.mutationObserver) {\n this.mutationObserver.observe(this.el.nativeElement, {\n childList: true,\n subtree: true,\n });\n }\n });\n }\n\n public refreshOutlineItems() {\n this.setOutlineItems();\n }\n}\n","import { afterNextRender, Directive, ElementRef, inject, input } from '@angular/core';\n\n@Directive({\n selector: '[axOutlineItem]',\n exportAs: 'axOutlineItem',\n})\nexport class AXOutlineItemDirective {\n private el = inject(ElementRef);\n\n id = input<string>();\n disabled = input(false);\n\n #anr = afterNextRender(() => {\n const element = this.el.nativeElement as HTMLElement;\n element.setAttribute('data-ax-outline-item', this.disabled() ? 'false' : 'true');\n\n let newId;\n if (!this.id()) {\n const textContent = this.el.nativeElement.textContent.trim();\n if (textContent) {\n newId = `${textContent.replace(/\\s+/g, '-')}`;\n } else {\n newId = `${Math.random().toString(36).slice(2, 7)}`;\n }\n this.el.nativeElement.id = newId;\n }\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAgCa,2BAA2B,CAAA;AALxC,IAAA,WAAA,GAAA;AAMU,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AACrB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC;AACpC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC;QAErD,IAAA,CAAA,MAAM,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,QAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AACxB,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,IAAI,mFAAC;AAC1B,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,KAAK,mFAAC;AAC3B,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAC,EAAE,uFAAC;AAC5B,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,KAAK,qFAAC;AAC7B,QAAA,IAAA,CAAA,oBAAoB,GAAG,KAAK,CAAC,IAAI,2FAAC;AAClC,QAAA,IAAA,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IAAA,IAAI;8GANO,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,EAAA,EAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,eAAe;AAC1B,iBAAA;;;ACLD;;AAEG;;;;"}
@@ -4,7 +4,7 @@ import { AXPlatform } from '@acorex/core/platform';
4
4
  import { AXZIndexService } from '@acorex/core/z-index';
5
5
  import { DOCUMENT } from '@angular/common';
6
6
  import * as i0 from '@angular/core';
7
- import { inject, TemplateRef, ElementRef, ComponentRef, Injectable } from '@angular/core';
7
+ import { inject, TemplateRef, ComponentRef, ElementRef, Injectable } from '@angular/core';
8
8
 
9
9
  /**
10
10
  * Calculates the position of an overlay element relative to an anchor element.
@@ -133,15 +133,6 @@ class AXOverlayService {
133
133
  }
134
134
  // Get the host element
135
135
  const hostElement = this.getHostElement(instance);
136
- const el = options.anchorOptions.anchor instanceof ElementRef
137
- ? options.anchorOptions.anchor.nativeElement
138
- : options.anchorOptions.anchor;
139
- const computedStyle = getComputedStyle(el);
140
- const classSize = computedStyle.getPropertyValue('--ax-sys-size');
141
- const themeColor = +computedStyle.getPropertyValue('--ax-sys-theme-isDark');
142
- if (themeColor === 1)
143
- hostElement.classList.add('ax-dark');
144
- hostElement.classList.add(classSize);
145
136
  // Create backdrop if enabled
146
137
  if (options?.backdrop?.enabled) {
147
138
  backdropElement = this.createBackdrop(options, zToken.zIndex);
@@ -204,6 +195,7 @@ class AXOverlayService {
204
195
  dispose();
205
196
  });
206
197
  }
198
+ this.addHostClass(options?.anchorOptions?.anchor, overlayContainer);
207
199
  return {
208
200
  instance,
209
201
  updatePosition,
@@ -390,10 +382,22 @@ class AXOverlayService {
390
382
  container.style.top = `${coords.top}px`;
391
383
  container.style.left = `${coords.left}px`;
392
384
  }
393
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: AXOverlayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
394
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: AXOverlayService, providedIn: 'root' }); }
385
+ addHostClass(refElement, targetElement) {
386
+ if (!refElement || !targetElement)
387
+ return;
388
+ const el = refElement instanceof ElementRef ? refElement.nativeElement : refElement;
389
+ const computedStyle = getComputedStyle(el);
390
+ const classSize = computedStyle.getPropertyValue('--ax-sys-size');
391
+ const themeColor = +computedStyle.getPropertyValue('--ax-sys-theme-isDark');
392
+ if (themeColor === 1)
393
+ targetElement.classList.add('ax-dark');
394
+ if (classSize)
395
+ targetElement.classList.add(classSize);
396
+ }
397
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOverlayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
398
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOverlayService, providedIn: 'root' }); }
395
399
  }
396
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: AXOverlayService, decorators: [{
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOverlayService, decorators: [{
397
401
  type: Injectable,
398
402
  args: [{
399
403
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-cdk-overlay.mjs","sources":["../../../../packages/cdk/overlay/src/lib/overlay.types.ts","../../../../packages/cdk/overlay/src/lib/overlay.service.ts","../../../../packages/cdk/overlay/src/acorex-cdk-overlay.ts"],"sourcesContent":["import { AXConnectedPosition, AXPlacement, AXPlacementType } from '@acorex/cdk/common';\nimport { AXComponentOptions } from '@acorex/core/components';\nimport { AXZToken } from '@acorex/core/z-index';\nimport { ComponentRef, ElementRef, EmbeddedViewRef } from '@angular/core';\n\nexport interface AXOverlayRef<T> {\n instance: EmbeddedViewRef<T> | ComponentRef<T>;\n /** Updates the overlay position relative to the anchor */\n updatePosition: () => void;\n /** Destroys the overlay and removes it from the DOM */\n dispose: () => void;\n /** The overlay container element */\n overlayElement: HTMLElement | null;\n /** The z-index token for this overlay */\n zToken: AXZToken | null;\n /** Brings this overlay to the front of all other overlays */\n bringToFront: () => void;\n}\n\nexport interface AXOverlayAnchorOptions {\n /** The anchor element to position relative to */\n anchor: HTMLElement | ElementRef<HTMLElement>;\n /** Placement of the overlay relative to the anchor */\n placement?: AXPlacementType;\n /** Horizontal offset in pixels */\n offsetX?: number;\n /** Vertical offset in pixels */\n offsetY?: number;\n /** Whether to flip the overlay when it overflows the viewport */\n autoFlip?: boolean;\n}\n\nexport interface AXOverlayOptions extends AXComponentOptions {\n backdrop?: {\n enabled?: boolean;\n background?: boolean;\n backdropClass?: string;\n closeOnClick?: boolean;\n };\n position?: AXPlacement;\n /** Anchor-based positioning options for tooltips, popovers, etc. */\n anchorOptions?: AXOverlayAnchorOptions;\n /** Custom CSS class for the overlay panel */\n panelClass?: string | string[];\n /** Whether to close when clicking outside */\n closeOnOutsideClick?: boolean;\n /** Whether to close when pressing Escape */\n closeOnEscape?: boolean;\n /** Width of the overlay container (e.g., 'auto', '200px', '100%') */\n width?: string;\n /** Callback when the overlay is disposed (e.g., due to scroll) */\n onDispose?: () => void;\n /** Whether to use centered container (default: true). Set to false for positioned overlays like toasts */\n centered?: boolean;\n actionSheetStyle?: boolean;\n}\n\n/**\n * Calculates the position of an overlay element relative to an anchor element.\n */\nexport function calculateAnchorPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n position: AXConnectedPosition,\n): { top: number; left: number } {\n let left = 0;\n let top = 0;\n\n // Calculate origin point on anchor\n switch (position.originX) {\n case 'start':\n left = anchorRect.left;\n break;\n case 'center':\n left = anchorRect.left + anchorRect.width / 2;\n break;\n case 'end':\n left = anchorRect.right;\n break;\n }\n\n switch (position.originY) {\n case 'top':\n top = anchorRect.top;\n break;\n case 'center':\n top = anchorRect.top + anchorRect.height / 2;\n break;\n case 'bottom':\n top = anchorRect.bottom;\n break;\n }\n\n // Adjust for overlay alignment\n switch (position.overlayX) {\n case 'start':\n // left stays the same\n break;\n case 'center':\n left -= overlayRect.width / 2;\n break;\n case 'end':\n left -= overlayRect.width;\n break;\n }\n\n switch (position.overlayY) {\n case 'top':\n // top stays the same\n break;\n case 'center':\n top -= overlayRect.height / 2;\n break;\n case 'bottom':\n top -= overlayRect.height;\n break;\n }\n\n // Apply offsets\n if (position.offsetX) {\n left += position.offsetX;\n }\n if (position.offsetY) {\n top += position.offsetY;\n }\n\n return { top, left };\n}\n\n/**\n * Checks if the overlay position fits within the viewport.\n */\nexport function fitsInViewport(\n position: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n): boolean {\n return (\n position.left >= 0 &&\n position.top >= 0 &&\n position.left + overlayRect.width <= viewportWidth &&\n position.top + overlayRect.height <= viewportHeight\n );\n}\n\n/**\n * Clamps a position to ensure the overlay stays within viewport bounds.\n */\nexport function clampToViewport(\n coords: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n margin = 4,\n): { top: number; left: number } {\n const clampedLeft = Math.max(margin, Math.min(coords.left, viewportWidth - overlayRect.width - margin));\n const clampedTop = Math.max(margin, Math.min(coords.top, viewportHeight - overlayRect.height - margin));\n\n return { top: clampedTop, left: clampedLeft };\n}\n\n/**\n * Finds the best position for an overlay that fits in the viewport.\n */\nexport function findBestPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n positions: AXConnectedPosition[],\n viewportWidth: number,\n viewportHeight: number,\n): { position: AXConnectedPosition; coords: { top: number; left: number } } {\n for (const position of positions) {\n const coords = calculateAnchorPosition(anchorRect, overlayRect, position);\n\n if (fitsInViewport(coords, overlayRect, viewportWidth, viewportHeight)) {\n return { position, coords };\n }\n }\n\n // Fallback to first position if none fit, but clamp to viewport bounds\n const fallbackCoords = calculateAnchorPosition(anchorRect, overlayRect, positions[0]);\n const clampedCoords = clampToViewport(fallbackCoords, overlayRect, viewportWidth, viewportHeight);\n return { position: positions[0], coords: clampedCoords };\n}\n","import { convertToPlacement } from '@acorex/cdk/common';\nimport { AXComponentContent, AXComponentService } from '@acorex/core/components';\nimport { AXPlatform } from '@acorex/core/platform';\nimport { AXZIndexService, AXZToken } from '@acorex/core/z-index';\nimport { DOCUMENT } from '@angular/common';\nimport { ComponentRef, ElementRef, EmbeddedViewRef, inject, Injectable, TemplateRef } from '@angular/core';\nimport { AXOverlayOptions, AXOverlayRef, findBestPosition } from './overlay.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXOverlayService {\n private componentService = inject(AXComponentService);\n private document = inject(DOCUMENT);\n private zIndexService = inject(AXZIndexService);\n private _platform: AXPlatform = inject(AXPlatform);\n\n /**\n * Creates an overlay with optional anchor-based positioning.\n * @param content - Component or template to display\n * @param options - Configuration options for the overlay\n * @returns Promise<AXOverlayRef> - Reference to the created overlay\n */\n async create<T = unknown>(content: AXComponentContent<T>, options?: AXOverlayOptions): Promise<AXOverlayRef<T>> {\n let instance: EmbeddedViewRef<T> | ComponentRef<T>;\n let overlayContainer: HTMLElement | null = null;\n let backdropElement: HTMLElement | null = null;\n let isDisposed = false;\n\n // Acquire a z-index token for this overlay\n let zToken: AXZToken | null = this.zIndexService.acquire();\n\n if (content instanceof TemplateRef) {\n instance = this.componentService.createFromTemplate<T>(content);\n } else {\n instance = this.componentService.createFromComponent<T>(content);\n if (options?.inputs) {\n Object.entries(options.inputs).forEach((c) => {\n (instance as ComponentRef<T>).setInput(c[0], c[1]);\n });\n }\n }\n\n // Get the host element\n const hostElement = this.getHostElement(instance);\n const el =\n options.anchorOptions.anchor instanceof ElementRef\n ? options.anchorOptions.anchor.nativeElement\n : options.anchorOptions.anchor;\n const computedStyle = getComputedStyle(el);\n const classSize = computedStyle.getPropertyValue('--ax-sys-size');\n const themeColor = +computedStyle.getPropertyValue('--ax-sys-theme-isDark');\n if (themeColor === 1) hostElement.classList.add('ax-dark');\n hostElement.classList.add(classSize);\n\n // Create backdrop if enabled\n if (options?.backdrop?.enabled) {\n backdropElement = this.createBackdrop(options, zToken.zIndex);\n }\n\n // If anchor options are provided, set up positioned overlay (for tooltips, popovers)\n if (options?.anchorOptions?.anchor) {\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n this.positionOverlay(overlayContainer, options);\n } else if (options?.centered === false) {\n // Non-centered positioned overlay (for toasts, notifications)\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n } else {\n // No anchor - create centered overlay (for modals, popups)\n overlayContainer = this.createCenteredOverlayContainer(hostElement, options, zToken.zIndex);\n }\n\n const updatePosition = () => {\n if (overlayContainer && options?.anchorOptions?.anchor) {\n this.positionOverlay(overlayContainer, options);\n }\n };\n\n const dispose = () => {\n if (isDisposed) return;\n isDisposed = true;\n\n // Remove backdrop\n if (backdropElement) {\n backdropElement.remove();\n }\n\n if (overlayContainer) {\n overlayContainer.remove();\n }\n if (instance instanceof ComponentRef) {\n instance.destroy();\n } else {\n instance.destroy();\n }\n\n // Release the z-index token\n this.zIndexService.release(zToken);\n zToken = null;\n\n // Notify callback\n options?.onDispose?.();\n };\n\n const bringToFront = () => {\n if (!zToken || isDisposed) return;\n zToken = this.zIndexService.bringToFront(zToken);\n if (backdropElement) {\n backdropElement.style.zIndex = String(zToken.zIndex);\n }\n if (overlayContainer) {\n overlayContainer.style.zIndex = String(zToken.zIndex);\n }\n };\n\n // Set up backdrop click handler\n if (backdropElement && options?.backdrop?.closeOnClick) {\n backdropElement.addEventListener('click', () => {\n dispose();\n });\n }\n\n return {\n instance,\n updatePosition,\n dispose,\n overlayElement: overlayContainer,\n zToken,\n bringToFront,\n };\n }\n\n /**\n * Creates a backdrop element.\n */\n private createBackdrop(options: AXOverlayOptions | undefined, zIndex: number): HTMLElement {\n const backdrop = this.document.createElement('div');\n backdrop.classList.add('ax-overlay-backdrop');\n\n if (options?.backdrop?.backdropClass) {\n backdrop.classList.add(options.backdrop.backdropClass);\n }\n\n // Style the backdrop\n backdrop.style.position = 'fixed';\n backdrop.style.top = '0';\n backdrop.style.left = '0';\n backdrop.style.width = '100%';\n backdrop.style.height = '100%';\n backdrop.style.zIndex = String(zIndex);\n\n if (options?.backdrop?.background) {\n backdrop.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';\n }\n\n this.document.body.appendChild(backdrop);\n return backdrop;\n }\n\n /**\n * Creates a centered overlay container (for modals/popups).\n */\n private createCenteredOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n container.classList.add('ax-overlay-container', 'ax-overlay-centered');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set styles for centered positioning\n container.style.position = 'fixed';\n container.style.top = '0';\n container.style.left = '0';\n container.style.width = '100%';\n container.style.height = '100%';\n container.style.display = 'flex';\n container.style.alignItems = 'center';\n container.style.justifyContent = 'center';\n container.style.zIndex = String(zIndex);\n\n // Create inner wrapper for the content\n const contentWrapper = this.document.createElement('div');\n contentWrapper.classList.add('ax-overlay-content');\n\n // Apply width if provided\n if (options?.width) {\n contentWrapper.style.width = options.width;\n }\n\n // Move content into wrapper\n contentWrapper.appendChild(content);\n container.appendChild(contentWrapper);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Gets the host element from a ComponentRef or EmbeddedViewRef.\n */\n private getHostElement<T>(instance: EmbeddedViewRef<T> | ComponentRef<T>): HTMLElement {\n if (instance instanceof ComponentRef) {\n return instance.location.nativeElement;\n } else {\n // EmbeddedViewRef - get the first root node\n return instance.rootNodes[0] as HTMLElement;\n }\n }\n\n /**\n * Creates an overlay container element and appends the content to it.\n */\n private createOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n const pane = this.document.createElement('div');\n container.classList.add('ax-overlay-container');\n\n if (Array.isArray(options.panelClass)) {\n const check = options.panelClass.some((element) => {\n return element === 'ax-action-sheet-panel';\n });\n if (!check) pane.classList.add('ax-overlay-pane');\n }\n\n if (options.actionSheetStyle && this._platform.is('SM')) pane.classList.add('ax-overlay-actionsheet');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set initial styles for positioning\n container.style.position = 'fixed';\n container.style.zIndex = String(zIndex);\n container.style.maxWidth = '100vw';\n container.style.maxHeight = '100vh';\n\n if (options?.actionSheetStyle) {\n container.style.width = this._platform.is('SM') ? '100%' : 'fit-content';\n } else {\n container.style.width = options?.width || 'fit-content';\n }\n\n // Move content into container\n pane.appendChild(content);\n container.appendChild(pane);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Positions the overlay container relative to the anchor element.\n */\n private positionOverlay(container: HTMLElement, options: AXOverlayOptions): void {\n if (options.actionSheetStyle && this._platform.is('SM')) {\n container.style.bottom = `0px`;\n container.style.left = `0px`;\n return;\n }\n\n const anchorOptions = options.anchorOptions;\n if (!anchorOptions?.anchor) return;\n\n const anchorElement =\n anchorOptions.anchor instanceof ElementRef ? anchorOptions.anchor.nativeElement : anchorOptions.anchor;\n\n const anchorRect = anchorElement.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Get positions from placement\n let positions = convertToPlacement(anchorOptions.placement ?? 'bottom');\n if (positions.length === 0) {\n positions = convertToPlacement('bottom');\n }\n\n // Apply custom offsets to positions with direction-aware inversion\n // When position flips, the offset should also be inverted to maintain the intended gap\n if (anchorOptions.offsetX || anchorOptions.offsetY) {\n const primaryPosition = positions[0];\n positions = positions.map((p) => {\n let adjustedOffsetX = anchorOptions.offsetX ?? 0;\n let adjustedOffsetY = anchorOptions.offsetY ?? 0;\n\n // Invert offsetY when vertical direction flips\n // (from bottom to top or vice versa)\n if (primaryPosition.originY !== p.originY) {\n adjustedOffsetY = -adjustedOffsetY;\n }\n\n // Invert offsetX when horizontal direction flips\n // (from end to start or vice versa)\n if (primaryPosition.originX !== p.originX) {\n adjustedOffsetX = -adjustedOffsetX;\n }\n\n return {\n ...p,\n offsetX: (p.offsetX ?? 0) + adjustedOffsetX,\n offsetY: (p.offsetY ?? 0) + adjustedOffsetY,\n };\n });\n }\n\n // Find the best position that fits in viewport\n const { coords } = anchorOptions.autoFlip\n ? findBestPosition(anchorRect, containerRect, positions, viewportWidth, viewportHeight)\n : {\n coords: {\n top:\n positions[0].originY === 'bottom'\n ? anchorRect.bottom + (positions[0].offsetY ?? 0)\n : anchorRect.top - containerRect.height + (positions[0].offsetY ?? 0),\n left: anchorRect.left + (positions[0].offsetX ?? 0),\n },\n };\n\n // Apply position\n container.style.top = `${coords.top}px`;\n container.style.left = `${coords.left}px`;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAyDA;;AAEG;SACa,uBAAuB,CACrC,UAAmB,EACnB,WAAoB,EACpB,QAA6B,EAAA;IAE7B,IAAI,IAAI,GAAG,CAAC;IACZ,IAAI,GAAG,GAAG,CAAC;;AAGX,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,OAAO;AACV,YAAA,IAAI,GAAG,UAAU,CAAC,IAAI;YACtB;AACF,QAAA,KAAK,QAAQ;YACX,IAAI,GAAG,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK,GAAG,CAAC;YAC7C;AACF,QAAA,KAAK,KAAK;AACR,YAAA,IAAI,GAAG,UAAU,CAAC,KAAK;YACvB;;AAGJ,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,KAAK;AACR,YAAA,GAAG,GAAG,UAAU,CAAC,GAAG;YACpB;AACF,QAAA,KAAK,QAAQ;YACX,GAAG,GAAG,UAAU,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC;YAC5C;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,GAAG,GAAG,UAAU,CAAC,MAAM;YACvB;;;AAIJ,IAAA,QAAQ,QAAQ,CAAC,QAAQ;AACvB,QAAA,KAAK,OAAO;;YAEV;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,IAAI,IAAI,WAAW,CAAC,KAAK,GAAG,CAAC;YAC7B;AACF,QAAA,KAAK,KAAK;AACR,YAAA,IAAI,IAAI,WAAW,CAAC,KAAK;YACzB;;AAGJ,IAAA,QAAQ,QAAQ,CAAC,QAAQ;AACvB,QAAA,KAAK,KAAK;;YAER;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,GAAG,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC;YAC7B;AACF,QAAA,KAAK,QAAQ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UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA,CAAA;;2FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACVD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-cdk-overlay.mjs","sources":["../../../../packages/cdk/overlay/src/lib/overlay.types.ts","../../../../packages/cdk/overlay/src/lib/overlay.service.ts","../../../../packages/cdk/overlay/src/acorex-cdk-overlay.ts"],"sourcesContent":["import { AXConnectedPosition, AXPlacement, AXPlacementType } from '@acorex/cdk/common';\nimport { AXComponentOptions } from '@acorex/core/components';\nimport { AXZToken } from '@acorex/core/z-index';\nimport { ComponentRef, ElementRef, EmbeddedViewRef } from '@angular/core';\n\nexport interface AXOverlayRef<T> {\n instance: EmbeddedViewRef<T> | ComponentRef<T>;\n /** Updates the overlay position relative to the anchor */\n updatePosition: () => void;\n /** Destroys the overlay and removes it from the DOM */\n dispose: () => void;\n /** The overlay container element */\n overlayElement: HTMLElement | null;\n /** The z-index token for this overlay */\n zToken: AXZToken | null;\n /** Brings this overlay to the front of all other overlays */\n bringToFront: () => void;\n}\n\nexport interface AXOverlayAnchorOptions {\n /** The anchor element to position relative to */\n anchor: HTMLElement | ElementRef<HTMLElement>;\n /** Placement of the overlay relative to the anchor */\n placement?: AXPlacementType;\n /** Horizontal offset in pixels */\n offsetX?: number;\n /** Vertical offset in pixels */\n offsetY?: number;\n /** Whether to flip the overlay when it overflows the viewport */\n autoFlip?: boolean;\n}\n\nexport interface AXOverlayOptions extends AXComponentOptions {\n backdrop?: {\n enabled?: boolean;\n background?: boolean;\n backdropClass?: string;\n closeOnClick?: boolean;\n };\n position?: AXPlacement;\n /** Anchor-based positioning options for tooltips, popovers, etc. */\n anchorOptions?: AXOverlayAnchorOptions;\n /** Custom CSS class for the overlay panel */\n panelClass?: string | string[];\n /** Whether to close when clicking outside */\n closeOnOutsideClick?: boolean;\n /** Whether to close when pressing Escape */\n closeOnEscape?: boolean;\n /** Width of the overlay container (e.g., 'auto', '200px', '100%') */\n width?: string;\n /** Callback when the overlay is disposed (e.g., due to scroll) */\n onDispose?: () => void;\n /** Whether to use centered container (default: true). Set to false for positioned overlays like toasts */\n centered?: boolean;\n actionSheetStyle?: boolean;\n}\n\n/**\n * Calculates the position of an overlay element relative to an anchor element.\n */\nexport function calculateAnchorPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n position: AXConnectedPosition,\n): { top: number; left: number } {\n let left = 0;\n let top = 0;\n\n // Calculate origin point on anchor\n switch (position.originX) {\n case 'start':\n left = anchorRect.left;\n break;\n case 'center':\n left = anchorRect.left + anchorRect.width / 2;\n break;\n case 'end':\n left = anchorRect.right;\n break;\n }\n\n switch (position.originY) {\n case 'top':\n top = anchorRect.top;\n break;\n case 'center':\n top = anchorRect.top + anchorRect.height / 2;\n break;\n case 'bottom':\n top = anchorRect.bottom;\n break;\n }\n\n // Adjust for overlay alignment\n switch (position.overlayX) {\n case 'start':\n // left stays the same\n break;\n case 'center':\n left -= overlayRect.width / 2;\n break;\n case 'end':\n left -= overlayRect.width;\n break;\n }\n\n switch (position.overlayY) {\n case 'top':\n // top stays the same\n break;\n case 'center':\n top -= overlayRect.height / 2;\n break;\n case 'bottom':\n top -= overlayRect.height;\n break;\n }\n\n // Apply offsets\n if (position.offsetX) {\n left += position.offsetX;\n }\n if (position.offsetY) {\n top += position.offsetY;\n }\n\n return { top, left };\n}\n\n/**\n * Checks if the overlay position fits within the viewport.\n */\nexport function fitsInViewport(\n position: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n): boolean {\n return (\n position.left >= 0 &&\n position.top >= 0 &&\n position.left + overlayRect.width <= viewportWidth &&\n position.top + overlayRect.height <= viewportHeight\n );\n}\n\n/**\n * Clamps a position to ensure the overlay stays within viewport bounds.\n */\nexport function clampToViewport(\n coords: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n margin = 4,\n): { top: number; left: number } {\n const clampedLeft = Math.max(margin, Math.min(coords.left, viewportWidth - overlayRect.width - margin));\n const clampedTop = Math.max(margin, Math.min(coords.top, viewportHeight - overlayRect.height - margin));\n\n return { top: clampedTop, left: clampedLeft };\n}\n\n/**\n * Finds the best position for an overlay that fits in the viewport.\n */\nexport function findBestPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n positions: AXConnectedPosition[],\n viewportWidth: number,\n viewportHeight: number,\n): { position: AXConnectedPosition; coords: { top: number; left: number } } {\n for (const position of positions) {\n const coords = calculateAnchorPosition(anchorRect, overlayRect, position);\n\n if (fitsInViewport(coords, overlayRect, viewportWidth, viewportHeight)) {\n return { position, coords };\n }\n }\n\n // Fallback to first position if none fit, but clamp to viewport bounds\n const fallbackCoords = calculateAnchorPosition(anchorRect, overlayRect, positions[0]);\n const clampedCoords = clampToViewport(fallbackCoords, overlayRect, viewportWidth, viewportHeight);\n return { position: positions[0], coords: clampedCoords };\n}\n","import { convertToPlacement } from '@acorex/cdk/common';\nimport { AXComponentContent, AXComponentService } from '@acorex/core/components';\nimport { AXPlatform } from '@acorex/core/platform';\nimport { AXZIndexService, AXZToken } from '@acorex/core/z-index';\nimport { DOCUMENT } from '@angular/common';\nimport { ComponentRef, ElementRef, EmbeddedViewRef, inject, Injectable, TemplateRef } from '@angular/core';\nimport { AXOverlayOptions, AXOverlayRef, findBestPosition } from './overlay.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXOverlayService {\n private componentService = inject(AXComponentService);\n private document = inject(DOCUMENT);\n private zIndexService = inject(AXZIndexService);\n private _platform: AXPlatform = inject(AXPlatform);\n\n /**\n * Creates an overlay with optional anchor-based positioning.\n * @param content - Component or template to display\n * @param options - Configuration options for the overlay\n * @returns Promise<AXOverlayRef> - Reference to the created overlay\n */\n async create<T = unknown>(content: AXComponentContent<T>, options?: AXOverlayOptions): Promise<AXOverlayRef<T>> {\n let instance: EmbeddedViewRef<T> | ComponentRef<T>;\n let overlayContainer: HTMLElement | null = null;\n let backdropElement: HTMLElement | null = null;\n let isDisposed = false;\n\n // Acquire a z-index token for this overlay\n let zToken: AXZToken | null = this.zIndexService.acquire();\n\n if (content instanceof TemplateRef) {\n instance = this.componentService.createFromTemplate<T>(content);\n } else {\n instance = this.componentService.createFromComponent<T>(content);\n if (options?.inputs) {\n Object.entries(options.inputs).forEach((c) => {\n (instance as ComponentRef<T>).setInput(c[0], c[1]);\n });\n }\n }\n\n // Get the host element\n const hostElement = this.getHostElement(instance);\n\n // Create backdrop if enabled\n if (options?.backdrop?.enabled) {\n backdropElement = this.createBackdrop(options, zToken.zIndex);\n }\n\n // If anchor options are provided, set up positioned overlay (for tooltips, popovers)\n if (options?.anchorOptions?.anchor) {\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n this.positionOverlay(overlayContainer, options);\n } else if (options?.centered === false) {\n // Non-centered positioned overlay (for toasts, notifications)\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n } else {\n // No anchor - create centered overlay (for modals, popups)\n overlayContainer = this.createCenteredOverlayContainer(hostElement, options, zToken.zIndex);\n }\n\n const updatePosition = () => {\n if (overlayContainer && options?.anchorOptions?.anchor) {\n this.positionOverlay(overlayContainer, options);\n }\n };\n\n const dispose = () => {\n if (isDisposed) return;\n isDisposed = true;\n\n // Remove backdrop\n if (backdropElement) {\n backdropElement.remove();\n }\n\n if (overlayContainer) {\n overlayContainer.remove();\n }\n if (instance instanceof ComponentRef) {\n instance.destroy();\n } else {\n instance.destroy();\n }\n\n // Release the z-index token\n this.zIndexService.release(zToken);\n zToken = null;\n\n // Notify callback\n options?.onDispose?.();\n };\n\n const bringToFront = () => {\n if (!zToken || isDisposed) return;\n zToken = this.zIndexService.bringToFront(zToken);\n if (backdropElement) {\n backdropElement.style.zIndex = String(zToken.zIndex);\n }\n if (overlayContainer) {\n overlayContainer.style.zIndex = String(zToken.zIndex);\n }\n };\n\n // Set up backdrop click handler\n if (backdropElement && options?.backdrop?.closeOnClick) {\n backdropElement.addEventListener('click', () => {\n dispose();\n });\n }\n\n this.addHostClass(options?.anchorOptions?.anchor, overlayContainer);\n\n return {\n instance,\n updatePosition,\n dispose,\n overlayElement: overlayContainer,\n zToken,\n bringToFront,\n };\n }\n\n /**\n * Creates a backdrop element.\n */\n private createBackdrop(options: AXOverlayOptions | undefined, zIndex: number): HTMLElement {\n const backdrop = this.document.createElement('div');\n backdrop.classList.add('ax-overlay-backdrop');\n\n if (options?.backdrop?.backdropClass) {\n backdrop.classList.add(options.backdrop.backdropClass);\n }\n\n // Style the backdrop\n backdrop.style.position = 'fixed';\n backdrop.style.top = '0';\n backdrop.style.left = '0';\n backdrop.style.width = '100%';\n backdrop.style.height = '100%';\n backdrop.style.zIndex = String(zIndex);\n\n if (options?.backdrop?.background) {\n backdrop.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';\n }\n\n this.document.body.appendChild(backdrop);\n return backdrop;\n }\n\n /**\n * Creates a centered overlay container (for modals/popups).\n */\n private createCenteredOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n container.classList.add('ax-overlay-container', 'ax-overlay-centered');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set styles for centered positioning\n container.style.position = 'fixed';\n container.style.top = '0';\n container.style.left = '0';\n container.style.width = '100%';\n container.style.height = '100%';\n container.style.display = 'flex';\n container.style.alignItems = 'center';\n container.style.justifyContent = 'center';\n container.style.zIndex = String(zIndex);\n\n // Create inner wrapper for the content\n const contentWrapper = this.document.createElement('div');\n contentWrapper.classList.add('ax-overlay-content');\n\n // Apply width if provided\n if (options?.width) {\n contentWrapper.style.width = options.width;\n }\n\n // Move content into wrapper\n contentWrapper.appendChild(content);\n container.appendChild(contentWrapper);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Gets the host element from a ComponentRef or EmbeddedViewRef.\n */\n private getHostElement<T>(instance: EmbeddedViewRef<T> | ComponentRef<T>): HTMLElement {\n if (instance instanceof ComponentRef) {\n return instance.location.nativeElement;\n } else {\n // EmbeddedViewRef - get the first root node\n return instance.rootNodes[0] as HTMLElement;\n }\n }\n\n /**\n * Creates an overlay container element and appends the content to it.\n */\n private createOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n const pane = this.document.createElement('div');\n container.classList.add('ax-overlay-container');\n\n if (Array.isArray(options.panelClass)) {\n const check = options.panelClass.some((element) => {\n return element === 'ax-action-sheet-panel';\n });\n if (!check) pane.classList.add('ax-overlay-pane');\n }\n\n if (options.actionSheetStyle && this._platform.is('SM')) pane.classList.add('ax-overlay-actionsheet');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set initial styles for positioning\n container.style.position = 'fixed';\n container.style.zIndex = String(zIndex);\n container.style.maxWidth = '100vw';\n container.style.maxHeight = '100vh';\n\n if (options?.actionSheetStyle) {\n container.style.width = this._platform.is('SM') ? '100%' : 'fit-content';\n } else {\n container.style.width = options?.width || 'fit-content';\n }\n\n // Move content into container\n pane.appendChild(content);\n container.appendChild(pane);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Positions the overlay container relative to the anchor element.\n */\n private positionOverlay(container: HTMLElement, options: AXOverlayOptions): void {\n if (options.actionSheetStyle && this._platform.is('SM')) {\n container.style.bottom = `0px`;\n container.style.left = `0px`;\n return;\n }\n\n const anchorOptions = options.anchorOptions;\n if (!anchorOptions?.anchor) return;\n\n const anchorElement =\n anchorOptions.anchor instanceof ElementRef ? anchorOptions.anchor.nativeElement : anchorOptions.anchor;\n\n const anchorRect = anchorElement.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Get positions from placement\n let positions = convertToPlacement(anchorOptions.placement ?? 'bottom');\n if (positions.length === 0) {\n positions = convertToPlacement('bottom');\n }\n\n // Apply custom offsets to positions with direction-aware inversion\n // When position flips, the offset should also be inverted to maintain the intended gap\n if (anchorOptions.offsetX || anchorOptions.offsetY) {\n const primaryPosition = positions[0];\n positions = positions.map((p) => {\n let adjustedOffsetX = anchorOptions.offsetX ?? 0;\n let adjustedOffsetY = anchorOptions.offsetY ?? 0;\n\n // Invert offsetY when vertical direction flips\n // (from bottom to top or vice versa)\n if (primaryPosition.originY !== p.originY) {\n adjustedOffsetY = -adjustedOffsetY;\n }\n\n // Invert offsetX when horizontal direction flips\n // (from end to start or vice versa)\n if (primaryPosition.originX !== p.originX) {\n adjustedOffsetX = -adjustedOffsetX;\n }\n\n return {\n ...p,\n offsetX: (p.offsetX ?? 0) + adjustedOffsetX,\n offsetY: (p.offsetY ?? 0) + adjustedOffsetY,\n };\n });\n }\n\n // Find the best position that fits in viewport\n const { coords } = anchorOptions.autoFlip\n ? findBestPosition(anchorRect, containerRect, positions, viewportWidth, viewportHeight)\n : {\n coords: {\n top:\n positions[0].originY === 'bottom'\n ? anchorRect.bottom + (positions[0].offsetY ?? 0)\n : anchorRect.top - containerRect.height + (positions[0].offsetY ?? 0),\n left: anchorRect.left + (positions[0].offsetX ?? 0),\n },\n };\n\n // Apply position\n container.style.top = `${coords.top}px`;\n container.style.left = `${coords.left}px`;\n }\n\n private addHostClass(refElement: HTMLElement | ElementRef, targetElement: HTMLElement) {\n if (!refElement || !targetElement) return;\n const el = refElement instanceof ElementRef ? refElement.nativeElement : refElement;\n const computedStyle = getComputedStyle(el);\n const classSize = computedStyle.getPropertyValue('--ax-sys-size');\n const themeColor = +computedStyle.getPropertyValue('--ax-sys-theme-isDark');\n if (themeColor === 1) targetElement.classList.add('ax-dark');\n if (classSize) targetElement.classList.add(classSize);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAyDA;;AAEG;SACa,uBAAuB,CACrC,UAAmB,EACnB,WAAoB,EACpB,QAA6B,EAAA;IAE7B,IAAI,IAAI,GAAG,CAAC;IACZ,IAAI,GAAG,GAAG,CAAC;;AAGX,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,OAAO;AACV,YAAA,IAAI,GAAG,UAAU,CAAC,IAAI;YACtB;AACF,QAAA,KAAK,QAAQ;YACX,IAAI,GAAG,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK,GAAG,CAAC;YAC7C;AACF,QAAA,KAAK,KAAK;AACR,YAAA,IAAI,GAAG,UAAU,CAAC,KAAK;YACvB;;AAGJ,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,KAAK;AACR,YAAA,GAAG,GAAG,UAAU,CAAC,GAAG;YACpB;AACF,QAAA,KAAK,QAAQ;YACX,GAAG,GAAG,UAAU,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC;YAC5C;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,GAAG,GAAG,UAAU,CAAC,MAAM;YACvB;;;AAIJ,IAAA,QAAQ,QAAQ,CAAC,QAAQ;AACvB,QAAA,KAAK,OAAO;;YAEV;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,IAAI,IAAI,WAAW,CAAC,KAAK,GAAG,CAAC;YAC7B;AACF,QAAA,KAAK,KAAK;AACR,YAAA,IAAI,IAAI,WAAW,CAAC,KAAK;YACzB;;AAGJ,IAAA,QAAQ,QAAQ,CAAC,QAAQ;AACvB,QAAA,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