@acorex/cdk 22.2.15 → 22.2.17
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.
- package/fesm2022/acorex-cdk-outline.mjs +271 -68
- package/fesm2022/acorex-cdk-outline.mjs.map +1 -1
- package/fesm2022/acorex-cdk-overlay.mjs +13 -0
- package/fesm2022/acorex-cdk-overlay.mjs.map +1 -1
- package/package.json +2 -2
- package/types/acorex-cdk-outline.d.ts +20 -0
- package/types/acorex-cdk-overlay.d.ts +3 -0
|
@@ -31,6 +31,8 @@ class AXOutlineContainerDirective {
|
|
|
31
31
|
...(ngDevMode ? [{ debugName: "scrollTop" }] : /* istanbul ignore next */ []));
|
|
32
32
|
this.outlineItems = signal([], /* @ts-ignore */
|
|
33
33
|
...(ngDevMode ? [{ debugName: "outlineItems" }] : /* istanbul ignore next */ []));
|
|
34
|
+
this.lastScrollSpyIndex = 0;
|
|
35
|
+
this.heldActiveIndex = null;
|
|
34
36
|
this.scrollableElement = computed(() => {
|
|
35
37
|
const scrollableElementId = this.scrollableElementId();
|
|
36
38
|
if (scrollableElementId) {
|
|
@@ -51,12 +53,12 @@ class AXOutlineContainerDirective {
|
|
|
51
53
|
this.scrollableElement().style.scrollBehavior = 'smooth';
|
|
52
54
|
}
|
|
53
55
|
this.zone.runOutsideAngular(() => {
|
|
54
|
-
const scrollable = this.
|
|
56
|
+
const scrollable = this.resolveScrollEventTarget();
|
|
55
57
|
fromEvent(scrollable, 'scroll')
|
|
56
|
-
.pipe(this.unsubscriber.takeUntilDestroy, map(() => this.
|
|
58
|
+
.pipe(this.unsubscriber.takeUntilDestroy, map(() => this.readScrollTop()))
|
|
57
59
|
.subscribe((scrollTop) => {
|
|
58
60
|
this.scrollTop.set(scrollTop);
|
|
59
|
-
this.scrollChanged(scrollTop);
|
|
61
|
+
this.zone.run(() => this.scrollChanged(scrollTop));
|
|
60
62
|
});
|
|
61
63
|
this.mutationObserver = new MutationObserver((mutationsList) => {
|
|
62
64
|
const relevantMutation = mutationsList.some((mutation) => mutation.type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0));
|
|
@@ -68,12 +70,36 @@ class AXOutlineContainerDirective {
|
|
|
68
70
|
childList: true,
|
|
69
71
|
subtree: true,
|
|
70
72
|
});
|
|
73
|
+
this.bindUserScrollIntent(scrollable);
|
|
71
74
|
});
|
|
75
|
+
fromEvent(this.el.nativeElement, 'click', { capture: true })
|
|
76
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
|
77
|
+
.subscribe((event) => {
|
|
78
|
+
if (event instanceof MouseEvent) {
|
|
79
|
+
this.handleInContentOutlineLinkClick(event);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const view = this.document.defaultView;
|
|
83
|
+
if (view) {
|
|
84
|
+
fromEvent(view, 'hashchange')
|
|
85
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
|
86
|
+
.subscribe(() => {
|
|
87
|
+
const id = decodeURIComponent(view.location.hash?.slice(1) ?? '');
|
|
88
|
+
if (!id || !this.outlineItems().some((item) => item.id === id)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.heldActiveIndex = null;
|
|
92
|
+
const index = this.outlineItems().findIndex((item) => item.id === id);
|
|
93
|
+
this.lastScrollSpyIndex = index;
|
|
94
|
+
this.applyActiveIndex(index);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
72
97
|
this.mutationSubject
|
|
73
98
|
.pipe(debounceTime(this.MUTATION_DEBOUNCE_TIME), this.unsubscriber.takeUntilDestroy)
|
|
74
99
|
.subscribe(() => {
|
|
75
100
|
this.refreshOutlineItems();
|
|
76
101
|
});
|
|
102
|
+
this.zone.run(() => this.scrollChanged(this.readScrollTop()));
|
|
77
103
|
});
|
|
78
104
|
}
|
|
79
105
|
#anr;
|
|
@@ -87,68 +113,236 @@ class AXOutlineContainerDirective {
|
|
|
87
113
|
this.refreshOutlineItems();
|
|
88
114
|
}
|
|
89
115
|
}
|
|
90
|
-
|
|
91
|
-
this.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
scrollToItem(id) {
|
|
117
|
+
this.scrollToItemFromHash(true, id);
|
|
118
|
+
}
|
|
119
|
+
resolveScrollEventTarget() {
|
|
120
|
+
const scrollable = this.scrollableElement();
|
|
121
|
+
if (scrollable === this.document.documentElement || scrollable.tagName === 'HTML') {
|
|
122
|
+
return this.document.defaultView ?? scrollable;
|
|
123
|
+
}
|
|
124
|
+
return scrollable;
|
|
125
|
+
}
|
|
126
|
+
readScrollTop() {
|
|
127
|
+
const scrollable = this.scrollableElement();
|
|
128
|
+
if (scrollable === this.document.documentElement || scrollable.tagName === 'HTML') {
|
|
129
|
+
return this.document.defaultView?.scrollY ?? scrollable.scrollTop;
|
|
130
|
+
}
|
|
131
|
+
return scrollable.scrollTop;
|
|
132
|
+
}
|
|
133
|
+
handleInContentOutlineLinkClick(event) {
|
|
134
|
+
const target = event.target;
|
|
135
|
+
if (!(target instanceof Element)) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const anchor = target.closest('a');
|
|
139
|
+
if (!anchor || anchor.classList.contains('ax-outline-hash-link')) {
|
|
140
|
+
if (anchor?.classList.contains('ax-outline-hash-link')) {
|
|
141
|
+
const id = this.getOutlineIdFromHref(anchor.getAttribute('href'));
|
|
142
|
+
if (id) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
this.scrollToItem(id);
|
|
106
145
|
}
|
|
107
146
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const id = this.getOutlineIdFromHref(anchor.getAttribute('href'));
|
|
150
|
+
if (!id || !this.outlineItems().some((item) => item.id === id)) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
this.scrollToItem(id);
|
|
155
|
+
}
|
|
156
|
+
scrollToItemFromHash(scrollToTarget, explicitId) {
|
|
157
|
+
const id = explicitId ?? decodeURIComponent(this.document.defaultView?.location.hash?.slice(1) ?? '');
|
|
158
|
+
if (!id) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const item = this.outlineItems().find((entry) => entry.id === id);
|
|
162
|
+
if (!item) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const activeIndex = this.outlineItems().findIndex((entry) => entry.id === id);
|
|
166
|
+
if (activeIndex < 0) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
this.heldActiveIndex = activeIndex;
|
|
170
|
+
this.lastScrollSpyIndex = activeIndex;
|
|
171
|
+
this.applyActiveIndex(activeIndex);
|
|
172
|
+
if (!scrollToTarget) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this.syncLocationHash(id);
|
|
176
|
+
const offset = this.activationOffset();
|
|
177
|
+
const scrollable = this.scrollableElement();
|
|
178
|
+
const isWindow = scrollable === this.document.documentElement ||
|
|
179
|
+
scrollable.tagName === 'HTML' ||
|
|
180
|
+
this.resolveScrollEventTarget() === this.document.defaultView;
|
|
181
|
+
const itemRect = item.el.getBoundingClientRect();
|
|
182
|
+
if (isWindow) {
|
|
183
|
+
const top = itemRect.top + (this.document.defaultView?.scrollY ?? 0) - offset;
|
|
184
|
+
this.document.defaultView?.scrollTo({
|
|
185
|
+
top: Math.max(0, top),
|
|
186
|
+
behavior: this.smoothScroll() ? 'smooth' : 'auto',
|
|
187
|
+
});
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const scrollableRect = scrollable.getBoundingClientRect();
|
|
191
|
+
const top = scrollable.scrollTop + (itemRect.top - scrollableRect.top) - offset;
|
|
192
|
+
const maxScrollTop = Math.max(0, scrollable.scrollHeight - scrollable.clientHeight);
|
|
193
|
+
scrollable.scrollTo({
|
|
194
|
+
top: Math.max(0, Math.min(top, maxScrollTop)),
|
|
195
|
+
behavior: this.smoothScroll() ? 'smooth' : 'auto',
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
releaseHeldActiveIndex() {
|
|
199
|
+
if (this.heldActiveIndex === null) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
this.stopOngoingSmoothScroll();
|
|
203
|
+
this.heldActiveIndex = null;
|
|
204
|
+
this.scrollChanged(this.readScrollTop());
|
|
205
|
+
}
|
|
206
|
+
stopOngoingSmoothScroll() {
|
|
207
|
+
const scrollable = this.scrollableElement();
|
|
208
|
+
const isWindow = scrollable === this.document.documentElement ||
|
|
209
|
+
scrollable.tagName === 'HTML' ||
|
|
210
|
+
this.resolveScrollEventTarget() === this.document.defaultView;
|
|
211
|
+
if (isWindow) {
|
|
212
|
+
const view = this.document.defaultView;
|
|
213
|
+
view?.scrollTo({ top: view.scrollY, behavior: 'auto' });
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
scrollable.scrollTo({ top: scrollable.scrollTop, behavior: 'auto' });
|
|
217
|
+
}
|
|
218
|
+
getOutlineIdFromHref(href) {
|
|
219
|
+
if (!href || !href.includes('#')) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const id = decodeURIComponent(href.split('#')[1] ?? '');
|
|
223
|
+
return id || null;
|
|
224
|
+
}
|
|
225
|
+
syncLocationHash(id) {
|
|
226
|
+
const view = this.document.defaultView;
|
|
227
|
+
if (!view || view.location.hash === `#${id}`) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
view.history.pushState(null, '', `#${id}`);
|
|
231
|
+
}
|
|
232
|
+
scrollChanged(scrollTop) {
|
|
233
|
+
if (this.heldActiveIndex !== null) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const activeIndex = this.resolveActiveIndex(scrollTop);
|
|
237
|
+
if (activeIndex === this.lastScrollSpyIndex) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
this.lastScrollSpyIndex = activeIndex;
|
|
241
|
+
this.applyActiveIndex(activeIndex);
|
|
242
|
+
}
|
|
243
|
+
bindUserScrollIntent(scrollable) {
|
|
244
|
+
const releaseHold = () => {
|
|
245
|
+
this.zone.run(() => this.releaseHeldActiveIndex());
|
|
246
|
+
};
|
|
247
|
+
fromEvent(scrollable, 'wheel', { passive: true }).pipe(this.unsubscriber.takeUntilDestroy).subscribe(releaseHold);
|
|
248
|
+
fromEvent(scrollable, 'touchmove', { passive: true })
|
|
249
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
|
250
|
+
.subscribe(releaseHold);
|
|
251
|
+
fromEvent(scrollable, 'pointerdown', { passive: true })
|
|
252
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
|
253
|
+
.subscribe(releaseHold);
|
|
254
|
+
fromEvent(scrollable, 'keydown')
|
|
255
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
|
256
|
+
.subscribe((event) => {
|
|
257
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
258
|
+
return;
|
|
118
259
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
activeIndex = i;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const lastReachableIndex = firstUnreachableIndex - 1;
|
|
126
|
-
const zoneStart = lastReachableIndex >= 0 ? prevItems[lastReachableIndex].scrollY - offset : 0;
|
|
127
|
-
const zoneRange = maxScrollTop - zoneStart;
|
|
128
|
-
if (zoneRange <= 0) {
|
|
129
|
-
activeIndex = this.activateLastAtBottom()
|
|
130
|
-
? prevItems.length - 1
|
|
131
|
-
: Math.max(0, lastReachableIndex);
|
|
132
|
-
}
|
|
133
|
-
else if (scrollTop >= zoneStart) {
|
|
134
|
-
// Map the remaining scroll range across the last reachable item and all
|
|
135
|
-
// unreachable trailing items so short end sections are not skipped.
|
|
136
|
-
const progress = Math.min(1, Math.max(0, (scrollTop - zoneStart) / zoneRange));
|
|
137
|
-
const startIndex = Math.max(0, lastReachableIndex);
|
|
138
|
-
const span = prevItems.length - 1 - startIndex;
|
|
139
|
-
if (progress >= 1 || (isAtBottom && this.activateLastAtBottom())) {
|
|
140
|
-
activeIndex = prevItems.length - 1;
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
activeIndex = startIndex + Math.floor(progress * span);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
260
|
+
const scrollKeys = ['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '];
|
|
261
|
+
if (scrollKeys.includes(event.key)) {
|
|
262
|
+
releaseHold();
|
|
146
263
|
}
|
|
147
|
-
return prevItems.map((item, index) => ({
|
|
148
|
-
...item,
|
|
149
|
-
active: index === activeIndex,
|
|
150
|
-
}));
|
|
151
264
|
});
|
|
265
|
+
}
|
|
266
|
+
resolveActiveIndex(scrollTop) {
|
|
267
|
+
const prevItems = this.outlineItems();
|
|
268
|
+
if (prevItems.length === 0) {
|
|
269
|
+
return -1;
|
|
270
|
+
}
|
|
271
|
+
if (prevItems.length === 1) {
|
|
272
|
+
return 0;
|
|
273
|
+
}
|
|
274
|
+
const scrollable = this.scrollableElement();
|
|
275
|
+
const offset = this.activationOffset();
|
|
276
|
+
const maxScrollTop = Math.max(0, scrollable.scrollHeight - scrollable.clientHeight);
|
|
277
|
+
const scrollableRect = scrollable.getBoundingClientRect();
|
|
278
|
+
const activationScrollTops = prevItems.map((item) => {
|
|
279
|
+
const itemTop = item.el.getBoundingClientRect().top;
|
|
280
|
+
return scrollTop + (itemTop - scrollableRect.top) - offset;
|
|
281
|
+
});
|
|
282
|
+
const count = prevItems.length;
|
|
283
|
+
if (this.activateLastAtBottom() && maxScrollTop > 0 && scrollTop >= maxScrollTop - 1) {
|
|
284
|
+
return count - 1;
|
|
285
|
+
}
|
|
286
|
+
let thresholdIndex = 0;
|
|
287
|
+
for (let i = 0; i < count; i++) {
|
|
288
|
+
if (activationScrollTops[i] <= scrollTop) {
|
|
289
|
+
thresholdIndex = i;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const slotIndex = this.resolveByScrollSlots(scrollTop, activationScrollTops, maxScrollTop);
|
|
293
|
+
if (slotIndex <= thresholdIndex) {
|
|
294
|
+
return thresholdIndex;
|
|
295
|
+
}
|
|
296
|
+
const minSlot = Math.max(1, maxScrollTop / Math.max(count * 6, 1));
|
|
297
|
+
const slotActivation = activationScrollTops[slotIndex];
|
|
298
|
+
if (scrollTop >= slotActivation - minSlot) {
|
|
299
|
+
return slotIndex;
|
|
300
|
+
}
|
|
301
|
+
return thresholdIndex;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Maps scroll position to the active outline item. Sections with little content often
|
|
305
|
+
* have overlapping activation thresholds; each section gets a minimum scroll slot so
|
|
306
|
+
* short blocks are not skipped while scrolling.
|
|
307
|
+
*/
|
|
308
|
+
resolveByScrollSlots(scrollTop, activationScrollTops, maxScrollTop) {
|
|
309
|
+
const count = activationScrollTops.length;
|
|
310
|
+
if (maxScrollTop <= 0) {
|
|
311
|
+
return 0;
|
|
312
|
+
}
|
|
313
|
+
const minSlot = Math.max(1, maxScrollTop / Math.max(count * 6, 1));
|
|
314
|
+
const weights = [];
|
|
315
|
+
for (let i = 0; i < count; i++) {
|
|
316
|
+
const sectionStart = Math.max(0, Math.min(activationScrollTops[i], maxScrollTop));
|
|
317
|
+
let sectionEnd = maxScrollTop;
|
|
318
|
+
if (i < count - 1) {
|
|
319
|
+
sectionEnd = Math.max(sectionStart, Math.min(activationScrollTops[i + 1], maxScrollTop));
|
|
320
|
+
}
|
|
321
|
+
weights.push(Math.max(minSlot, sectionEnd - sectionStart));
|
|
322
|
+
}
|
|
323
|
+
const totalWeight = weights.reduce((sum, weight) => sum + weight, 0);
|
|
324
|
+
const scaledPosition = (scrollTop / maxScrollTop) * totalWeight;
|
|
325
|
+
let consumed = 0;
|
|
326
|
+
for (let i = 0; i < count; i++) {
|
|
327
|
+
consumed += weights[i];
|
|
328
|
+
if (scaledPosition <= consumed || i === count - 1) {
|
|
329
|
+
return i;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return count - 1;
|
|
333
|
+
}
|
|
334
|
+
applyActiveIndex(activeIndex) {
|
|
335
|
+
if (activeIndex < 0) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const current = this.outlineItems();
|
|
339
|
+
if (current.length > 0 && current.every((item, index) => item.active === (index === activeIndex))) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
this.outlineItems.update((prevItems) => prevItems.map((item, index) => ({
|
|
343
|
+
...item,
|
|
344
|
+
active: index === activeIndex,
|
|
345
|
+
})));
|
|
152
346
|
this.outlineItems$.next(this.outlineItems());
|
|
153
347
|
}
|
|
154
348
|
setOutlineItems() {
|
|
@@ -168,7 +362,7 @@ class AXOutlineContainerDirective {
|
|
|
168
362
|
const htmlEl = el;
|
|
169
363
|
let fragment = htmlEl.id;
|
|
170
364
|
if (!fragment) {
|
|
171
|
-
const textContentForId = htmlEl.textContent?.trim() ?? '';
|
|
365
|
+
const textContentForId = htmlEl.textContent?.trim() ?? '';
|
|
172
366
|
if (textContentForId) {
|
|
173
367
|
fragment = `${textContentForId.toLowerCase().replace(/\s+/g, '-')}`;
|
|
174
368
|
let counter = 1;
|
|
@@ -181,7 +375,7 @@ class AXOutlineContainerDirective {
|
|
|
181
375
|
else {
|
|
182
376
|
fragment = `ax-outline-${Math.random().toString(36).slice(2, 7)}`;
|
|
183
377
|
}
|
|
184
|
-
htmlEl.id = fragment;
|
|
378
|
+
htmlEl.id = fragment;
|
|
185
379
|
}
|
|
186
380
|
htmlEl.style.scrollMargin = `${this.activationOffset()}px`;
|
|
187
381
|
const existingLink = htmlEl.querySelector('a.ax-outline-hash-link');
|
|
@@ -193,8 +387,7 @@ class AXOutlineContainerDirective {
|
|
|
193
387
|
anchor.textContent = '#';
|
|
194
388
|
anchor.href = `${window.location.pathname}${window.location.search}#${fragment}`;
|
|
195
389
|
anchor.classList.add('ax-outline-hash-link');
|
|
196
|
-
|
|
197
|
-
anchor.style.paddingInlineStart = '0.5rem'; // Adjust as needed
|
|
390
|
+
anchor.style.paddingInlineStart = '0.5rem';
|
|
198
391
|
anchor.style.opacity = '0';
|
|
199
392
|
anchor.style.transition = 'opacity 0.2s ease-in-out';
|
|
200
393
|
anchor.style.cursor = 'pointer';
|
|
@@ -206,7 +399,10 @@ class AXOutlineContainerDirective {
|
|
|
206
399
|
htmlEl.addEventListener('mouseleave', leaveListener);
|
|
207
400
|
htmlEl.appendChild(anchor);
|
|
208
401
|
if (this.copyUrlOnClick()) {
|
|
209
|
-
anchor.addEventListener('click', async () => {
|
|
402
|
+
anchor.addEventListener('click', async (event) => {
|
|
403
|
+
event.preventDefault();
|
|
404
|
+
event.stopPropagation();
|
|
405
|
+
this.scrollToItem(fragment);
|
|
210
406
|
try {
|
|
211
407
|
await this.clipboardService.copy(anchor.href);
|
|
212
408
|
}
|
|
@@ -217,7 +413,6 @@ class AXOutlineContainerDirective {
|
|
|
217
413
|
}
|
|
218
414
|
}
|
|
219
415
|
const parentId = htmlEl.getAttribute('data-parent') ?? undefined;
|
|
220
|
-
// Calculate position relative to the scrollable element
|
|
221
416
|
const scrollableElement = this.scrollableElement();
|
|
222
417
|
const scrollableRect = scrollableElement?.getBoundingClientRect() ?? { top: 0 };
|
|
223
418
|
const elementRect = htmlEl.getBoundingClientRect();
|
|
@@ -233,7 +428,15 @@ class AXOutlineContainerDirective {
|
|
|
233
428
|
})
|
|
234
429
|
.sort((a, b) => a.scrollY - b.scrollY);
|
|
235
430
|
this.outlineItems.set(outlineItems);
|
|
236
|
-
|
|
431
|
+
const hashId = decodeURIComponent(this.document.defaultView?.location.hash?.slice(1) ?? '');
|
|
432
|
+
if (hashId && outlineItems.some((item) => item.id === hashId)) {
|
|
433
|
+
const hashIndex = outlineItems.findIndex((item) => item.id === hashId);
|
|
434
|
+
this.lastScrollSpyIndex = hashIndex;
|
|
435
|
+
this.applyActiveIndex(hashIndex);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
this.scrollChanged(this.readScrollTop());
|
|
439
|
+
}
|
|
237
440
|
if (this.mutationObserver) {
|
|
238
441
|
this.mutationObserver.observe(this.el.nativeElement, {
|
|
239
442
|
childList: true,
|
|
@@ -271,7 +474,7 @@ class AXOutlineItemDirective {
|
|
|
271
474
|
if (!this.id()) {
|
|
272
475
|
const textContent = this.el.nativeElement.textContent.trim();
|
|
273
476
|
if (textContent) {
|
|
274
|
-
newId = `${textContent.replace(/\s+/g, '-')}`;
|
|
477
|
+
newId = `${textContent.toLowerCase().replace(/\s+/g, '-')}`;
|
|
275
478
|
}
|
|
276
479
|
else {
|
|
277
480
|
newId = `${Math.random().toString(36).slice(2, 7)}`;
|
|
@@ -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, 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 scrollable = this.scrollableElement();\n const maxScrollTop = Math.max(0, scrollable.scrollHeight - scrollable.clientHeight);\n const offset = this.activationOffset();\n const isAtBottom = maxScrollTop > 0 && scrollTop >= maxScrollTop - 1;\n\n // Items whose activation threshold sits beyond maxScrollTop can never become\n // active via normal scroll comparison. Jumping straight to the last item at\n // the bottom (previous behavior) skipped those intermediate sections.\n let firstUnreachableIndex = prevItems.length;\n for (let i = 0; i < prevItems.length; i++) {\n if (prevItems[i].scrollY - offset > maxScrollTop) {\n firstUnreachableIndex = i;\n break;\n }\n }\n\n let activeIndex = -1;\n\n if (firstUnreachableIndex === prevItems.length) {\n for (let i = 0; i < prevItems.length; i++) {\n if (scrollTop >= prevItems[i].scrollY - offset) {\n activeIndex = i;\n }\n }\n if (isAtBottom && this.activateLastAtBottom()) {\n activeIndex = prevItems.length - 1;\n }\n } else {\n for (let i = 0; i < firstUnreachableIndex; i++) {\n if (scrollTop >= prevItems[i].scrollY - offset) {\n activeIndex = i;\n }\n }\n\n const lastReachableIndex = firstUnreachableIndex - 1;\n const zoneStart = lastReachableIndex >= 0 ? prevItems[lastReachableIndex].scrollY - offset : 0;\n const zoneRange = maxScrollTop - zoneStart;\n\n if (zoneRange <= 0) {\n activeIndex = this.activateLastAtBottom()\n ? prevItems.length - 1\n : Math.max(0, lastReachableIndex);\n } else if (scrollTop >= zoneStart) {\n // Map the remaining scroll range across the last reachable item and all\n // unreachable trailing items so short end sections are not skipped.\n const progress = Math.min(1, Math.max(0, (scrollTop - zoneStart) / zoneRange));\n const startIndex = Math.max(0, lastReachableIndex);\n const span = prevItems.length - 1 - startIndex;\n\n if (progress >= 1 || (isAtBottom && this.activateLastAtBottom())) {\n activeIndex = prevItems.length - 1;\n } else {\n activeIndex = startIndex + Math.floor(progress * span);\n }\n }\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;AAErD,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK;8FAAU;QACxB,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,IAAI;yFAAC;QAC1B,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,KAAK;yFAAC;QAC3B,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAC,EAAE;6FAAC;QAC5B,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,KAAK;2FAAC;QAC7B,IAAA,CAAA,oBAAoB,GAAG,KAAK,CAAC,IAAI;iGAAC;QAClC,IAAA,CAAA,mBAAmB,GAAG,KAAK,CAAgB,IAAI;gGAAC;QAExC,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,CAAC;sFAAC;QACrB,IAAA,CAAA,YAAY,GAAG,MAAM,CAAoB,EAAE;yFAAC;AAE5C,QAAA,IAAA,CAAA,iBAAiB,GAAG,QAAQ,CAAC,MAAK;AACxC,YAAA,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,EAAE;YACtD,IAAI,mBAAmB,EAAE;AACvB,gBAAA,OAAO,IAAI,CAAC,QA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,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;;;;"}
|
|
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 { DOCUMENT, 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 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 private lastScrollSpyIndex = 0;\n private heldActiveIndex: number | null = null;\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.resolveScrollEventTarget();\n fromEvent(scrollable, 'scroll')\n .pipe(\n this.unsubscriber.takeUntilDestroy,\n map(() => this.readScrollTop()),\n )\n .subscribe((scrollTop) => {\n this.scrollTop.set(scrollTop);\n this.zone.run(() => 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 this.bindUserScrollIntent(scrollable);\n });\n\n fromEvent(this.el.nativeElement, 'click', { capture: true })\n .pipe(this.unsubscriber.takeUntilDestroy)\n .subscribe((event) => {\n if (event instanceof MouseEvent) {\n this.handleInContentOutlineLinkClick(event);\n }\n });\n\n const view = this.document.defaultView;\n if (view) {\n fromEvent(view, 'hashchange')\n .pipe(this.unsubscriber.takeUntilDestroy)\n .subscribe(() => {\n const id = decodeURIComponent(view.location.hash?.slice(1) ?? '');\n if (!id || !this.outlineItems().some((item) => item.id === id)) {\n return;\n }\n this.heldActiveIndex = null;\n const index = this.outlineItems().findIndex((item) => item.id === id);\n this.lastScrollSpyIndex = index;\n this.applyActiveIndex(index);\n });\n }\n\n this.mutationSubject\n .pipe(debounceTime(this.MUTATION_DEBOUNCE_TIME), this.unsubscriber.takeUntilDestroy)\n .subscribe(() => {\n this.refreshOutlineItems();\n });\n\n this.zone.run(() => this.scrollChanged(this.readScrollTop()));\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 scrollToItem(id: string): void {\n this.scrollToItemFromHash(true, id);\n }\n\n private resolveScrollEventTarget(): EventTarget {\n const scrollable = this.scrollableElement();\n if (scrollable === this.document.documentElement || scrollable.tagName === 'HTML') {\n return this.document.defaultView ?? scrollable;\n }\n return scrollable;\n }\n\n private readScrollTop(): number {\n const scrollable = this.scrollableElement();\n if (scrollable === this.document.documentElement || scrollable.tagName === 'HTML') {\n return this.document.defaultView?.scrollY ?? scrollable.scrollTop;\n }\n return scrollable.scrollTop;\n }\n\n private handleInContentOutlineLinkClick(event: MouseEvent): void {\n const target = event.target;\n if (!(target instanceof Element)) {\n return;\n }\n\n const anchor = target.closest('a');\n if (!anchor || anchor.classList.contains('ax-outline-hash-link')) {\n if (anchor?.classList.contains('ax-outline-hash-link')) {\n const id = this.getOutlineIdFromHref(anchor.getAttribute('href'));\n if (id) {\n event.preventDefault();\n this.scrollToItem(id);\n }\n }\n return;\n }\n\n const id = this.getOutlineIdFromHref(anchor.getAttribute('href'));\n if (!id || !this.outlineItems().some((item) => item.id === id)) {\n return;\n }\n\n event.preventDefault();\n this.scrollToItem(id);\n }\n\n private scrollToItemFromHash(scrollToTarget: boolean, explicitId?: string): void {\n const id = explicitId ?? decodeURIComponent(this.document.defaultView?.location.hash?.slice(1) ?? '');\n if (!id) {\n return;\n }\n\n const item = this.outlineItems().find((entry) => entry.id === id);\n if (!item) {\n return;\n }\n\n const activeIndex = this.outlineItems().findIndex((entry) => entry.id === id);\n if (activeIndex < 0) {\n return;\n }\n\n this.heldActiveIndex = activeIndex;\n this.lastScrollSpyIndex = activeIndex;\n this.applyActiveIndex(activeIndex);\n\n if (!scrollToTarget) {\n return;\n }\n\n this.syncLocationHash(id);\n\n const offset = this.activationOffset();\n const scrollable = this.scrollableElement();\n const isWindow =\n scrollable === this.document.documentElement ||\n scrollable.tagName === 'HTML' ||\n this.resolveScrollEventTarget() === this.document.defaultView;\n const itemRect = item.el.getBoundingClientRect();\n\n if (isWindow) {\n const top = itemRect.top + (this.document.defaultView?.scrollY ?? 0) - offset;\n this.document.defaultView?.scrollTo({\n top: Math.max(0, top),\n behavior: this.smoothScroll() ? 'smooth' : 'auto',\n });\n return;\n }\n\n const scrollableRect = scrollable.getBoundingClientRect();\n const top = scrollable.scrollTop + (itemRect.top - scrollableRect.top) - offset;\n const maxScrollTop = Math.max(0, scrollable.scrollHeight - scrollable.clientHeight);\n scrollable.scrollTo({\n top: Math.max(0, Math.min(top, maxScrollTop)),\n behavior: this.smoothScroll() ? 'smooth' : 'auto',\n });\n }\n\n private releaseHeldActiveIndex(): void {\n if (this.heldActiveIndex === null) {\n return;\n }\n\n this.stopOngoingSmoothScroll();\n this.heldActiveIndex = null;\n this.scrollChanged(this.readScrollTop());\n }\n\n private stopOngoingSmoothScroll(): void {\n const scrollable = this.scrollableElement();\n const isWindow =\n scrollable === this.document.documentElement ||\n scrollable.tagName === 'HTML' ||\n this.resolveScrollEventTarget() === this.document.defaultView;\n\n if (isWindow) {\n const view = this.document.defaultView;\n view?.scrollTo({ top: view.scrollY, behavior: 'auto' });\n return;\n }\n\n scrollable.scrollTo({ top: scrollable.scrollTop, behavior: 'auto' });\n }\n\n private getOutlineIdFromHref(href: string | null): string | null {\n if (!href || !href.includes('#')) {\n return null;\n }\n const id = decodeURIComponent(href.split('#')[1] ?? '');\n return id || null;\n }\n\n private syncLocationHash(id: string): void {\n const view = this.document.defaultView;\n if (!view || view.location.hash === `#${id}`) {\n return;\n }\n view.history.pushState(null, '', `#${id}`);\n }\n\n private scrollChanged(scrollTop: number) {\n if (this.heldActiveIndex !== null) {\n return;\n }\n\n const activeIndex = this.resolveActiveIndex(scrollTop);\n if (activeIndex === this.lastScrollSpyIndex) {\n return;\n }\n\n this.lastScrollSpyIndex = activeIndex;\n this.applyActiveIndex(activeIndex);\n }\n\n private bindUserScrollIntent(scrollable: EventTarget): void {\n const releaseHold = () => {\n this.zone.run(() => this.releaseHeldActiveIndex());\n };\n\n fromEvent(scrollable, 'wheel', { passive: true }).pipe(this.unsubscriber.takeUntilDestroy).subscribe(releaseHold);\n\n fromEvent(scrollable, 'touchmove', { passive: true })\n .pipe(this.unsubscriber.takeUntilDestroy)\n .subscribe(releaseHold);\n\n fromEvent(scrollable, 'pointerdown', { passive: true })\n .pipe(this.unsubscriber.takeUntilDestroy)\n .subscribe(releaseHold);\n\n fromEvent(scrollable, 'keydown')\n .pipe(this.unsubscriber.takeUntilDestroy)\n .subscribe((event) => {\n if (!(event instanceof KeyboardEvent)) {\n return;\n }\n const scrollKeys = ['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '];\n if (scrollKeys.includes(event.key)) {\n releaseHold();\n }\n });\n }\n\n private resolveActiveIndex(scrollTop: number): number {\n const prevItems = this.outlineItems();\n if (prevItems.length === 0) {\n return -1;\n }\n if (prevItems.length === 1) {\n return 0;\n }\n\n const scrollable = this.scrollableElement();\n const offset = this.activationOffset();\n const maxScrollTop = Math.max(0, scrollable.scrollHeight - scrollable.clientHeight);\n const scrollableRect = scrollable.getBoundingClientRect();\n const activationScrollTops = prevItems.map((item) => {\n const itemTop = item.el.getBoundingClientRect().top;\n return scrollTop + (itemTop - scrollableRect.top) - offset;\n });\n\n const count = prevItems.length;\n if (this.activateLastAtBottom() && maxScrollTop > 0 && scrollTop >= maxScrollTop - 1) {\n return count - 1;\n }\n\n let thresholdIndex = 0;\n for (let i = 0; i < count; i++) {\n if (activationScrollTops[i] <= scrollTop) {\n thresholdIndex = i;\n }\n }\n\n const slotIndex = this.resolveByScrollSlots(scrollTop, activationScrollTops, maxScrollTop);\n if (slotIndex <= thresholdIndex) {\n return thresholdIndex;\n }\n\n const minSlot = Math.max(1, maxScrollTop / Math.max(count * 6, 1));\n const slotActivation = activationScrollTops[slotIndex];\n if (scrollTop >= slotActivation - minSlot) {\n return slotIndex;\n }\n\n return thresholdIndex;\n }\n\n /**\n * Maps scroll position to the active outline item. Sections with little content often\n * have overlapping activation thresholds; each section gets a minimum scroll slot so\n * short blocks are not skipped while scrolling.\n */\n private resolveByScrollSlots(scrollTop: number, activationScrollTops: number[], maxScrollTop: number): number {\n const count = activationScrollTops.length;\n if (maxScrollTop <= 0) {\n return 0;\n }\n\n const minSlot = Math.max(1, maxScrollTop / Math.max(count * 6, 1));\n const weights: number[] = [];\n\n for (let i = 0; i < count; i++) {\n const sectionStart = Math.max(0, Math.min(activationScrollTops[i], maxScrollTop));\n let sectionEnd = maxScrollTop;\n if (i < count - 1) {\n sectionEnd = Math.max(sectionStart, Math.min(activationScrollTops[i + 1], maxScrollTop));\n }\n weights.push(Math.max(minSlot, sectionEnd - sectionStart));\n }\n\n const totalWeight = weights.reduce((sum, weight) => sum + weight, 0);\n const scaledPosition = (scrollTop / maxScrollTop) * totalWeight;\n\n let consumed = 0;\n for (let i = 0; i < count; i++) {\n consumed += weights[i];\n if (scaledPosition <= consumed || i === count - 1) {\n return i;\n }\n }\n\n return count - 1;\n }\n\n private applyActiveIndex(activeIndex: number): void {\n if (activeIndex < 0) {\n return;\n }\n\n const current = this.outlineItems();\n if (current.length > 0 && current.every((item, index) => item.active === (index === activeIndex))) {\n return;\n }\n\n this.outlineItems.update((prevItems) =>\n 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() ?? '';\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;\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 anchor.style.paddingInlineStart = '0.5rem';\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 (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.scrollToItem(fragment);\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 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\n const hashId = decodeURIComponent(this.document.defaultView?.location.hash?.slice(1) ?? '');\n if (hashId && outlineItems.some((item) => item.id === hashId)) {\n const hashIndex = outlineItems.findIndex((item) => item.id === hashId);\n this.lastScrollSpyIndex = hashIndex;\n this.applyActiveIndex(hashIndex);\n } else {\n this.scrollChanged(this.readScrollTop());\n }\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.toLowerCase().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;AAErD,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK;8FAAU;QACxB,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,IAAI;yFAAC;QAC1B,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,KAAK;yFAAC;QAC3B,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAC,EAAE;6FAAC;QAC5B,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,KAAK;2FAAC;QAC7B,IAAA,CAAA,oBAAoB,GAAG,KAAK,CAAC,IAAI;iGAAC;QAClC,IAAA,CAAA,mBAAmB,GAAG,KAAK,CAAgB,IAAI;gGAAC;QAExC,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,CAAC;sFAAC;QACrB,IAAA,CAAA,YAAY,GAAG,MAAM,CAAoB,EAAE;yFAAC;QAC5C,IAAA,CAAA,kB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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;;;;"}
|
|
@@ -5,6 +5,8 @@ import { AXZIndexService } from '@acorex/core/z-index';
|
|
|
5
5
|
import { DOCUMENT } from '@angular/common';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
7
|
import { ElementRef, inject, TemplateRef, ComponentRef, Injectable } from '@angular/core';
|
|
8
|
+
import { Router, NavigationStart } from '@angular/router';
|
|
9
|
+
import { filter } from 'rxjs/operators';
|
|
8
10
|
|
|
9
11
|
const APPEARANCE_CLASSES = [
|
|
10
12
|
'ax-appearance-flat',
|
|
@@ -207,6 +209,7 @@ class AXOverlayService {
|
|
|
207
209
|
this.document = inject(DOCUMENT);
|
|
208
210
|
this.zIndexService = inject(AXZIndexService);
|
|
209
211
|
this._platform = inject(AXPlatform);
|
|
212
|
+
this.router = inject(Router, { optional: true });
|
|
210
213
|
}
|
|
211
214
|
/**
|
|
212
215
|
* Creates an overlay with optional anchor-based positioning.
|
|
@@ -219,6 +222,7 @@ class AXOverlayService {
|
|
|
219
222
|
let overlayContainer = null;
|
|
220
223
|
let backdropElement = null;
|
|
221
224
|
let isDisposed = false;
|
|
225
|
+
let navigationSubscription = null;
|
|
222
226
|
// Acquire a z-index token for this overlay
|
|
223
227
|
let zToken = this.zIndexService.acquire(options?.zIndexBase);
|
|
224
228
|
if (content instanceof TemplateRef) {
|
|
@@ -260,6 +264,8 @@ class AXOverlayService {
|
|
|
260
264
|
if (isDisposed)
|
|
261
265
|
return;
|
|
262
266
|
isDisposed = true;
|
|
267
|
+
navigationSubscription?.unsubscribe();
|
|
268
|
+
navigationSubscription = null;
|
|
263
269
|
// Remove backdrop
|
|
264
270
|
if (backdropElement) {
|
|
265
271
|
backdropElement.remove();
|
|
@@ -296,6 +302,13 @@ class AXOverlayService {
|
|
|
296
302
|
dispose();
|
|
297
303
|
});
|
|
298
304
|
}
|
|
305
|
+
if (options?.closeOnNavigation !== false && this.router) {
|
|
306
|
+
navigationSubscription = this.router.events
|
|
307
|
+
.pipe(filter((event) => event instanceof NavigationStart))
|
|
308
|
+
.subscribe(() => {
|
|
309
|
+
dispose();
|
|
310
|
+
});
|
|
311
|
+
}
|
|
299
312
|
this.applyOverlayVisualContext(options, overlayContainer);
|
|
300
313
|
return {
|
|
301
314
|
instance,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-cdk-overlay.mjs","sources":["../../../../packages/cdk/overlay/src/lib/overlay-visual-context.ts","../../../../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 { ElementRef } from '@angular/core';\n\nexport type AXOverlayVisualContextScope = 'full' | 'theme';\n\nexport interface AXOverlayVisualContext {\n appearance?: string;\n theme?: 'ax-light' | 'ax-dark';\n contrast?: string;\n size?: string;\n}\n\nexport const APPEARANCE_CLASSES = [\n 'ax-appearance-flat',\n 'ax-appearance-depth',\n 'ax-appearance-translucent',\n] as const;\n\nexport const THEME_CLASSES = ['ax-light', 'ax-dark'] as const;\n\nexport const CONTRAST_CLASSES = ['ax-contrast-enhanced', 'ax-contrast-high'] as const;\n\nexport const SIZE_CLASSES = ['ax-xs', 'ax-sm', 'ax-md', 'ax-lg', 'ax-xl'] as const;\n\nexport const MANAGED_OVERLAY_VISUAL_CLASSES = [\n ...APPEARANCE_CLASSES,\n ...THEME_CLASSES,\n ...CONTRAST_CLASSES,\n ...SIZE_CLASSES,\n] as const;\n\n/**\n * Resolves the nearest effective visual context from an anchor or context source.\n * Theme uses nearest ax-light / ax-dark so nested Light overrides Dark ancestors.\n */\nexport function resolveVisualContext(\n source: HTMLElement | null | undefined,\n fallbackRoot?: HTMLElement | null,\n): AXOverlayVisualContext {\n const context: AXOverlayVisualContext = {};\n const root = fallbackRoot ?? (typeof document !== 'undefined' ? document.documentElement : null);\n\n let node: HTMLElement | null = source ?? root;\n while (node) {\n if (!context.appearance) {\n for (const cls of APPEARANCE_CLASSES) {\n if (node.classList.contains(cls)) {\n context.appearance = cls;\n break;\n }\n }\n }\n\n if (!context.contrast) {\n for (const cls of CONTRAST_CLASSES) {\n if (node.classList.contains(cls)) {\n context.contrast = cls;\n break;\n }\n }\n }\n\n if (!context.size) {\n for (const cls of SIZE_CLASSES) {\n if (node.classList.contains(cls)) {\n context.size = cls;\n break;\n }\n }\n\n if (!context.size && typeof getComputedStyle !== 'undefined') {\n const computedSize = getComputedStyle(node).getPropertyValue('--ax-sys-size').trim();\n if (SIZE_CLASSES.includes(computedSize as (typeof SIZE_CLASSES)[number])) {\n context.size = computedSize;\n }\n }\n }\n\n if (!context.theme) {\n if (node.classList.contains('ax-light')) {\n context.theme = 'ax-light';\n } else if (node.classList.contains('ax-dark')) {\n context.theme = 'ax-dark';\n }\n }\n\n node = node.parentElement;\n }\n\n if (!context.theme && root) {\n if (root.classList.contains('ax-light')) {\n context.theme = 'ax-light';\n } else if (root.classList.contains('ax-dark')) {\n context.theme = 'ax-dark';\n }\n }\n\n return context;\n}\n\n/** Applies resolved visual context classes to an overlay container. */\nexport function applyVisualContext(\n target: HTMLElement,\n context: AXOverlayVisualContext,\n scope: AXOverlayVisualContextScope = 'full',\n): void {\n for (const cls of MANAGED_OVERLAY_VISUAL_CLASSES) {\n target.classList.remove(cls);\n }\n\n if (scope === 'full' && context.appearance) {\n target.classList.add(context.appearance);\n }\n if (context.theme) {\n target.classList.add(context.theme);\n }\n if (scope === 'full' && context.contrast) {\n target.classList.add(context.contrast);\n }\n if (context.size) {\n target.classList.add(context.size);\n }\n}\n\nexport function resolveContextElement(\n contextElement: HTMLElement | ElementRef<HTMLElement> | undefined,\n anchor: HTMLElement | ElementRef<HTMLElement> | undefined,\n fallbackRoot: HTMLElement,\n): HTMLElement {\n if (contextElement) {\n return contextElement instanceof ElementRef ? contextElement.nativeElement : contextElement;\n }\n if (anchor) {\n return anchor instanceof ElementRef ? anchor.nativeElement : anchor;\n }\n return fallbackRoot;\n}\n","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';\nimport type { AXOverlayVisualContextScope } from './overlay-visual-context';\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 /** Base z-index for this overlay */\n zIndexBase?: number;\n /**\n * Visual context source for anchorless overlays (toast, dialog, notification).\n * Falls back to anchor, then document root.\n */\n contextElement?: HTMLElement | ElementRef<HTMLElement>;\n /**\n * Which visual context dimensions propagate to the overlay shell.\n * `theme` keeps light/dark (+ size) only; floating surfaces opt out of\n * appearance/contrast classes (popup, toast, dropdown).\n */\n visualContextScope?: AXOverlayVisualContextScope;\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 { applyVisualContext, resolveContextElement, resolveVisualContext } from './overlay-visual-context';\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(options?.zIndexBase);\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.applyOverlayVisualContext(options, 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 } else if (this.hasPanelClass(options?.panelClass, 'ax-popup-overlay')) {\n contentWrapper.style.width = 'auto';\n contentWrapper.style.maxWidth = '100%';\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 hasPanelClass(panelClass: string | string[] | undefined, className: string): boolean {\n if (!panelClass) return false;\n const classes = Array.isArray(panelClass) ? panelClass : [panelClass];\n return classes.some((cls) => cls === className);\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 = '100%';\n container.style.maxHeight = '100%';\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 container.style.right = `0px`;\n container.style.width = 'auto';\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 = this.document.documentElement.clientWidth;\n const viewportHeight = this.document.documentElement.clientHeight;\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 applyOverlayVisualContext(options: AXOverlayOptions | undefined, targetElement: HTMLElement | null): void {\n if (!targetElement) return;\n\n const fallbackRoot = this.document.documentElement;\n const source = resolveContextElement(options?.contextElement, options?.anchorOptions?.anchor, fallbackRoot);\n const context = resolveVisualContext(source, fallbackRoot);\n const scope = options?.visualContextScope ?? 'full';\n applyVisualContext(targetElement, context, scope);\n\n const pane = targetElement.querySelector('.ax-overlay-pane');\n // Pane is a separate stacking context; mirror context classes so portaled content\n // inherits the same CSS variables when the pane is not a descendant of the container.\n if (pane instanceof HTMLElement) {\n applyVisualContext(pane, context, scope);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAWO,MAAM,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,qBAAqB;IACrB,2BAA2B;;MAGhB,aAAa,GAAG,CAAC,UAAU,EAAE,SAAS;MAEtC,gBAAgB,GAAG,CAAC,sBAAsB,EAAE,kBAAkB;AAEpE,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,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GAvWW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,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;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-cdk-overlay.mjs","sources":["../../../../packages/cdk/overlay/src/lib/overlay-visual-context.ts","../../../../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 { ElementRef } from '@angular/core';\n\nexport type AXOverlayVisualContextScope = 'full' | 'theme';\n\nexport interface AXOverlayVisualContext {\n appearance?: string;\n theme?: 'ax-light' | 'ax-dark';\n contrast?: string;\n size?: string;\n}\n\nexport const APPEARANCE_CLASSES = [\n 'ax-appearance-flat',\n 'ax-appearance-depth',\n 'ax-appearance-translucent',\n] as const;\n\nexport const THEME_CLASSES = ['ax-light', 'ax-dark'] as const;\n\nexport const CONTRAST_CLASSES = ['ax-contrast-enhanced', 'ax-contrast-high'] as const;\n\nexport const SIZE_CLASSES = ['ax-xs', 'ax-sm', 'ax-md', 'ax-lg', 'ax-xl'] as const;\n\nexport const MANAGED_OVERLAY_VISUAL_CLASSES = [\n ...APPEARANCE_CLASSES,\n ...THEME_CLASSES,\n ...CONTRAST_CLASSES,\n ...SIZE_CLASSES,\n] as const;\n\n/**\n * Resolves the nearest effective visual context from an anchor or context source.\n * Theme uses nearest ax-light / ax-dark so nested Light overrides Dark ancestors.\n */\nexport function resolveVisualContext(\n source: HTMLElement | null | undefined,\n fallbackRoot?: HTMLElement | null,\n): AXOverlayVisualContext {\n const context: AXOverlayVisualContext = {};\n const root = fallbackRoot ?? (typeof document !== 'undefined' ? document.documentElement : null);\n\n let node: HTMLElement | null = source ?? root;\n while (node) {\n if (!context.appearance) {\n for (const cls of APPEARANCE_CLASSES) {\n if (node.classList.contains(cls)) {\n context.appearance = cls;\n break;\n }\n }\n }\n\n if (!context.contrast) {\n for (const cls of CONTRAST_CLASSES) {\n if (node.classList.contains(cls)) {\n context.contrast = cls;\n break;\n }\n }\n }\n\n if (!context.size) {\n for (const cls of SIZE_CLASSES) {\n if (node.classList.contains(cls)) {\n context.size = cls;\n break;\n }\n }\n\n if (!context.size && typeof getComputedStyle !== 'undefined') {\n const computedSize = getComputedStyle(node).getPropertyValue('--ax-sys-size').trim();\n if (SIZE_CLASSES.includes(computedSize as (typeof SIZE_CLASSES)[number])) {\n context.size = computedSize;\n }\n }\n }\n\n if (!context.theme) {\n if (node.classList.contains('ax-light')) {\n context.theme = 'ax-light';\n } else if (node.classList.contains('ax-dark')) {\n context.theme = 'ax-dark';\n }\n }\n\n node = node.parentElement;\n }\n\n if (!context.theme && root) {\n if (root.classList.contains('ax-light')) {\n context.theme = 'ax-light';\n } else if (root.classList.contains('ax-dark')) {\n context.theme = 'ax-dark';\n }\n }\n\n return context;\n}\n\n/** Applies resolved visual context classes to an overlay container. */\nexport function applyVisualContext(\n target: HTMLElement,\n context: AXOverlayVisualContext,\n scope: AXOverlayVisualContextScope = 'full',\n): void {\n for (const cls of MANAGED_OVERLAY_VISUAL_CLASSES) {\n target.classList.remove(cls);\n }\n\n if (scope === 'full' && context.appearance) {\n target.classList.add(context.appearance);\n }\n if (context.theme) {\n target.classList.add(context.theme);\n }\n if (scope === 'full' && context.contrast) {\n target.classList.add(context.contrast);\n }\n if (context.size) {\n target.classList.add(context.size);\n }\n}\n\nexport function resolveContextElement(\n contextElement: HTMLElement | ElementRef<HTMLElement> | undefined,\n anchor: HTMLElement | ElementRef<HTMLElement> | undefined,\n fallbackRoot: HTMLElement,\n): HTMLElement {\n if (contextElement) {\n return contextElement instanceof ElementRef ? contextElement.nativeElement : contextElement;\n }\n if (anchor) {\n return anchor instanceof ElementRef ? anchor.nativeElement : anchor;\n }\n return fallbackRoot;\n}\n","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';\nimport type { AXOverlayVisualContextScope } from './overlay-visual-context';\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 /** Dispose this overlay when Angular starts a navigation. Default: true. */\n closeOnNavigation?: boolean;\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 /** Base z-index for this overlay */\n zIndexBase?: number;\n /**\n * Visual context source for anchorless overlays (toast, dialog, notification).\n * Falls back to anchor, then document root.\n */\n contextElement?: HTMLElement | ElementRef<HTMLElement>;\n /**\n * Which visual context dimensions propagate to the overlay shell.\n * `theme` keeps light/dark (+ size) only; floating surfaces opt out of\n * appearance/contrast classes (popup, toast, dropdown).\n */\n visualContextScope?: AXOverlayVisualContextScope;\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 { NavigationStart, Router } from '@angular/router';\nimport { Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { applyVisualContext, resolveContextElement, resolveVisualContext } from './overlay-visual-context';\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 private router = inject(Router, { optional: true });\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 let navigationSubscription: Subscription | null = null;\n\n // Acquire a z-index token for this overlay\n let zToken: AXZToken | null = this.zIndexService.acquire(options?.zIndexBase);\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 navigationSubscription?.unsubscribe();\n navigationSubscription = null;\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 if (options?.closeOnNavigation !== false && this.router) {\n navigationSubscription = this.router.events\n .pipe(filter((event): event is NavigationStart => event instanceof NavigationStart))\n .subscribe(() => {\n dispose();\n });\n }\n\n this.applyOverlayVisualContext(options, 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 } else if (this.hasPanelClass(options?.panelClass, 'ax-popup-overlay')) {\n contentWrapper.style.width = 'auto';\n contentWrapper.style.maxWidth = '100%';\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 hasPanelClass(panelClass: string | string[] | undefined, className: string): boolean {\n if (!panelClass) return false;\n const classes = Array.isArray(panelClass) ? panelClass : [panelClass];\n return classes.some((cls) => cls === className);\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 = '100%';\n container.style.maxHeight = '100%';\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 container.style.right = `0px`;\n container.style.width = 'auto';\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 = this.document.documentElement.clientWidth;\n const viewportHeight = this.document.documentElement.clientHeight;\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 applyOverlayVisualContext(options: AXOverlayOptions | undefined, targetElement: HTMLElement | null): void {\n if (!targetElement) return;\n\n const fallbackRoot = this.document.documentElement;\n const source = resolveContextElement(options?.contextElement, options?.anchorOptions?.anchor, fallbackRoot);\n const context = resolveVisualContext(source, fallbackRoot);\n const scope = options?.visualContextScope ?? 'full';\n applyVisualContext(targetElement, context, scope);\n\n const pane = targetElement.querySelector('.ax-overlay-pane');\n // Pane is a separate stacking context; mirror context classes so portaled content\n // inherits the same CSS variables when the pane is not a descendant of the container.\n if (pane instanceof HTMLElement) {\n applyVisualContext(pane, context, scope);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAWO,MAAM,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,qBAAqB;IACrB,2BAA2B;;MAGhB,aAAa,GAA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AAiC,EAAA;AACxG,QAAA,IAAI,CAAC,aAAa;YAAE;AAEpB,QAAA,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe;AAClD,QAAA,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC;QAC3G,MAAM,OAAO,GAAG,oBAAoB,CAAC,MAAM,EAAE,YAAY,CAAC;AAC1D,QAAA,MAAM,KAAK,GAAG,OAAO,EAAE,kBAAkB,IAAI,MAAM;AACnD,QAAA,kBAAkB,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;QAEjD,MAAM,IAAI,GAAG,aAAa,CAAC,aAAa,CAAC,kBAAkB,CAAC;;;AAG5D,QAAA,IAAI,IAAI,YAAY,WAAW,EAAE;AAC/B,YAAA,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC;QAC1C;IACF;8GApXW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,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;;;ACdD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,8 @@ declare class AXOutlineContainerDirective implements OnDestroy, AfterViewInit {
|
|
|
27
27
|
scrollableElementId: _angular_core.InputSignal<string>;
|
|
28
28
|
private scrollTop;
|
|
29
29
|
private outlineItems;
|
|
30
|
+
private lastScrollSpyIndex;
|
|
31
|
+
private heldActiveIndex;
|
|
30
32
|
private scrollableElement;
|
|
31
33
|
private mutationSubject;
|
|
32
34
|
private readonly MUTATION_DEBOUNCE_TIME;
|
|
@@ -34,7 +36,25 @@ declare class AXOutlineContainerDirective implements OnDestroy, AfterViewInit {
|
|
|
34
36
|
outlineItems$: BehaviorSubject<outlineItemType[]>;
|
|
35
37
|
ngOnDestroy(): void;
|
|
36
38
|
ngAfterViewInit(): void;
|
|
39
|
+
scrollToItem(id: string): void;
|
|
40
|
+
private resolveScrollEventTarget;
|
|
41
|
+
private readScrollTop;
|
|
42
|
+
private handleInContentOutlineLinkClick;
|
|
43
|
+
private scrollToItemFromHash;
|
|
44
|
+
private releaseHeldActiveIndex;
|
|
45
|
+
private stopOngoingSmoothScroll;
|
|
46
|
+
private getOutlineIdFromHref;
|
|
47
|
+
private syncLocationHash;
|
|
37
48
|
private scrollChanged;
|
|
49
|
+
private bindUserScrollIntent;
|
|
50
|
+
private resolveActiveIndex;
|
|
51
|
+
/**
|
|
52
|
+
* Maps scroll position to the active outline item. Sections with little content often
|
|
53
|
+
* have overlapping activation thresholds; each section gets a minimum scroll slot so
|
|
54
|
+
* short blocks are not skipped while scrolling.
|
|
55
|
+
*/
|
|
56
|
+
private resolveByScrollSlots;
|
|
57
|
+
private applyActiveIndex;
|
|
38
58
|
private setOutlineItems;
|
|
39
59
|
refreshOutlineItems(): void;
|
|
40
60
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXOutlineContainerDirective, never>;
|
|
@@ -68,6 +68,8 @@ interface AXOverlayOptions extends AXComponentOptions {
|
|
|
68
68
|
closeOnEscape?: boolean;
|
|
69
69
|
/** Width of the overlay container (e.g., 'auto', '200px', '100%') */
|
|
70
70
|
width?: string;
|
|
71
|
+
/** Dispose this overlay when Angular starts a navigation. Default: true. */
|
|
72
|
+
closeOnNavigation?: boolean;
|
|
71
73
|
/** Callback when the overlay is disposed (e.g., due to scroll) */
|
|
72
74
|
onDispose?: () => void;
|
|
73
75
|
/** Whether to use centered container (default: true). Set to false for positioned overlays like toasts */
|
|
@@ -127,6 +129,7 @@ declare class AXOverlayService {
|
|
|
127
129
|
private document;
|
|
128
130
|
private zIndexService;
|
|
129
131
|
private _platform;
|
|
132
|
+
private router;
|
|
130
133
|
/**
|
|
131
134
|
* Creates an overlay with optional anchor-based positioning.
|
|
132
135
|
* @param content - Component or template to display
|