@acorex/cdk 22.1.0-next.8 → 22.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/acorex-cdk-common.mjs +23 -1
- package/fesm2022/acorex-cdk-common.mjs.map +1 -1
- package/fesm2022/acorex-cdk-gesture.mjs +173 -0
- package/fesm2022/acorex-cdk-gesture.mjs.map +1 -0
- package/fesm2022/acorex-cdk-highlight.mjs +178 -0
- package/fesm2022/acorex-cdk-highlight.mjs.map +1 -0
- package/fesm2022/acorex-cdk-horizontal-scroll.mjs +111 -9
- package/fesm2022/acorex-cdk-horizontal-scroll.mjs.map +1 -1
- package/fesm2022/acorex-cdk-overlay.mjs +6 -4
- package/fesm2022/acorex-cdk-overlay.mjs.map +1 -1
- package/fesm2022/acorex-cdk-sliding-item.mjs +70 -60
- package/fesm2022/acorex-cdk-sliding-item.mjs.map +1 -1
- package/gesture/README.md +3 -0
- package/horizontal-scroll/README.md +1 -1
- package/package.json +12 -3
- package/sliding-item/README.md +4 -2
- package/types/acorex-cdk-gesture.d.ts +120 -0
- package/types/acorex-cdk-highlight.d.ts +81 -0
- package/types/acorex-cdk-horizontal-scroll.d.ts +26 -7
- package/types/acorex-cdk-sliding-item.d.ts +22 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-cdk-horizontal-scroll.mjs","sources":["../../../../packages/cdk/horizontal-scroll/src/lib/horizontal-scroll.directive.ts","../../../../packages/cdk/horizontal-scroll/src/acorex-cdk-horizontal-scroll.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { afterNextRender, Directive, ElementRef, inject, input, NgZone, OnDestroy, PLATFORM_ID } from '@angular/core';\n\n/**\n * Converts vertical mouse-wheel scrolling into horizontal scrolling on the host element.\n * Applies only when the host can scroll horizontally.\n *\n * Usage:\n * <div axHorizontalScroll [speed]=\"150\" class=\"overflow-x-auto\">\n * ...\n * </div>\n */\n@Directive({\n selector: '[axHorizontalScroll]',\n})\nexport class AXHorizontalScrollDirective implements OnDestroy {\n private elementRef = inject(ElementRef<HTMLElement>);\n private platformId = inject(PLATFORM_ID);\n private zone = inject(NgZone);\n\n /**\n * Disables wheel-to-horizontal conversion when true.\n */\n disabled = input(false);\n\n /**\n * Horizontal scroll animation duration in milliseconds.\n * Lower values scroll faster; `0` applies the scroll instantly.\n */\n speed = input(200);\n\n private animationFrameId: number | null = null;\n private targetScrollLeft: number | null = null;\n private scrollPosition = 0;\n private lastFrameTime = 0;\n\n private readonly wheelListener = (event: WheelEvent) => this.handleWheel(event);\n\n #init = afterNextRender(() => {\n if (!isPlatformBrowser(this.platformId)) return;\n\n this.zone.runOutsideAngular(() => {\n this.nativeElement.addEventListener('wheel', this.wheelListener, { passive: false });\n });\n });\n\n ngOnDestroy(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n\n this.stopAnimation();\n this.nativeElement.removeEventListener('wheel', this.wheelListener);\n }\n\n private get nativeElement(): HTMLElement {\n return this.elementRef.nativeElement;\n }\n\n private handleWheel(event: WheelEvent): void {\n if (this.disabled() || !this.canScrollHorizontally()) return;\n if (event.shiftKey || Math.abs(event.deltaX) > Math.abs(event.deltaY)) return;\n if (event.deltaY === 0) return;\n\n const element = this.nativeElement;\n const maxScrollLeft = element.scrollWidth - element.clientWidth;\n\n this.syncScrollState();\n\n const currentPosition = this.targetScrollLeft ?? this.scrollPosition;\n const atStart = currentPosition <= 0 && event.deltaY < 0;\n const atEnd = currentPosition >= maxScrollLeft && event.deltaY > 0;\n\n if (atStart || atEnd) return;\n\n event.preventDefault();\n\n const nextTarget = Math.max(0, Math.min(maxScrollLeft, currentPosition + event.deltaY));\n this.targetScrollLeft = nextTarget;\n\n if (this.speed() <= 0) {\n this.applyScrollPosition(nextTarget);\n this.targetScrollLeft = null;\n return;\n }\n\n this.startAnimation();\n }\n\n private syncScrollState(): void {\n if (this.targetScrollLeft !== null) return;\n\n this.scrollPosition = this.nativeElement.scrollLeft;\n this.targetScrollLeft = this.scrollPosition;\n }\n\n private startAnimation(): void {\n if (this.animationFrameId !== null) return;\n\n this.lastFrameTime = performance.now();\n\n const step = (currentTime: number): void => {\n const target = this.targetScrollLeft;\n\n if (target === null) {\n this.stopAnimation();\n return;\n }\n\n const deltaTime = Math.max(currentTime - this.lastFrameTime, 1);\n this.lastFrameTime = currentTime;\n\n const factor = 1 - Math.exp(-deltaTime / this.speed());\n this.scrollPosition += (target - this.scrollPosition) * factor;\n this.applyScrollPosition(this.scrollPosition);\n\n if (Math.abs(target - this.scrollPosition) < 0.5) {\n this.applyScrollPosition(target);\n this.targetScrollLeft = null;\n this.stopAnimation();\n return;\n }\n\n this.animationFrameId = requestAnimationFrame(step);\n };\n\n this.animationFrameId = requestAnimationFrame(step);\n }\n\n private applyScrollPosition(position: number): void {\n this.scrollPosition = position;\n this.nativeElement.scrollLeft = position;\n }\n\n private stopAnimation(): void {\n if (this.animationFrameId === null) return;\n\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n\n private canScrollHorizontally(): boolean {\n const element = this.nativeElement;\n return element.scrollWidth > element.clientWidth;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;AAQG;MAIU,2BAA2B,CAAA;AAHxC,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,EAAC,UAAuB,EAAC;AAC5C,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AAE7B;;AAEG;QACH,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK;qFAAC;AAEvB;;;AAGG;QACH,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,GAAG;kFAAC;QAEV,IAAA,CAAA,gBAAgB,GAAkB,IAAI;QACtC,IAAA,CAAA,gBAAgB,GAAkB,I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,GAAG,IAAI,CAAC,aAAa;AAClC,QAAA,OAAO,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW;IAClD;8GA/HW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,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,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAHvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AACjC,iBAAA;;;ACdD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-cdk-horizontal-scroll.mjs","sources":["../../../../packages/cdk/horizontal-scroll/src/lib/horizontal-scroll.directive.ts","../../../../packages/cdk/horizontal-scroll/src/acorex-cdk-horizontal-scroll.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { AXGestureDirective, AXGestureEvent } from '@acorex/cdk/gesture';\nimport {\n afterNextRender,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n input,\n NgZone,\n OnDestroy,\n PLATFORM_ID,\n} from '@angular/core';\n\n/**\n * Converts vertical mouse-wheel scrolling and horizontal pan into horizontal scrolling on the host element.\n * Applies only when the host can scroll horizontally. Pan is provided by the hosted AXGestureDirective.\n *\n * Usage:\n * <div axHorizontalScroll [speed]=\"150\" class=\"overflow-x-auto\">\n * ...\n * </div>\n *\n * Do not put `axGesture` on the same element; this directive already hosts it.\n */\n@Directive({\n selector: '[axHorizontalScroll]',\n hostDirectives: [AXGestureDirective],\n host: {\n '[style.touch-action]': 'disabled() ? null : \"pan-y\"',\n },\n})\nexport class AXHorizontalScrollDirective implements OnDestroy {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n private readonly platformId = inject(PLATFORM_ID);\n private readonly zone = inject(NgZone);\n private readonly gesture = inject(AXGestureDirective);\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Disables wheel-to-horizontal conversion and pan scrolling when true.\n */\n disabled = input(false);\n\n /**\n * Horizontal scroll animation duration in milliseconds.\n * Lower values scroll faster; `0` applies the scroll instantly.\n */\n speed = input(200);\n\n private animationFrameId: number | null = null;\n private targetScrollLeft: number | null = null;\n private scrollPosition = 0;\n private lastFrameTime = 0;\n\n private isPanning = false;\n private ignorePan = false;\n private panStartScrollLeft = 0;\n private suppressClickListener: ((event: Event) => void) | null = null;\n private suppressClickTimer: ReturnType<typeof setTimeout> | null = null;\n\n private readonly interactiveSelector =\n 'input, textarea, select, option, [contenteditable]:not([contenteditable=\"false\"])';\n\n private readonly wheelListener = (event: WheelEvent) => this.handleWheel(event);\n\n constructor() {\n const subscriptions = [\n this.gesture.panstart.subscribe((event) => this.handlePanStart(event)),\n this.gesture.panmove.subscribe((event) => this.handlePanMove(event)),\n this.gesture.panend.subscribe((event) => this.handlePanEnd(event)),\n ];\n this.destroyRef.onDestroy(() => {\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n });\n }\n\n #init = afterNextRender(() => {\n if (!isPlatformBrowser(this.platformId)) return;\n\n this.zone.runOutsideAngular(() => {\n this.nativeElement.addEventListener('wheel', this.wheelListener, { passive: false });\n });\n });\n\n ngOnDestroy(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n\n this.stopAnimation();\n this.clearPanStyles();\n this.clearClickSuppression();\n this.nativeElement.removeEventListener('wheel', this.wheelListener);\n }\n\n private get nativeElement(): HTMLElement {\n return this.elementRef.nativeElement;\n }\n\n private handleWheel(event: WheelEvent): void {\n if (this.disabled() || this.isPanning || !this.canScrollHorizontally()) return;\n if (event.shiftKey || Math.abs(event.deltaX) > Math.abs(event.deltaY)) return;\n if (event.deltaY === 0) return;\n\n const maxScrollLeft = this.getMaxScrollLeft();\n\n this.syncScrollState();\n\n const currentPosition = this.targetScrollLeft ?? this.scrollPosition;\n const atStart = currentPosition <= 0 && event.deltaY < 0;\n const atEnd = currentPosition >= maxScrollLeft && event.deltaY > 0;\n\n if (atStart || atEnd) return;\n\n event.preventDefault();\n\n const nextTarget = Math.max(0, Math.min(maxScrollLeft, currentPosition + event.deltaY));\n this.targetScrollLeft = nextTarget;\n\n if (this.speed() <= 0) {\n this.applyScrollPosition(nextTarget);\n this.targetScrollLeft = null;\n return;\n }\n\n this.startAnimation();\n }\n\n private handlePanStart(event: AXGestureEvent): void {\n if (this.disabled() || !this.canScrollHorizontally()) {\n this.ignorePan = true;\n return;\n }\n if (event.target instanceof Element && event.target.closest(this.interactiveSelector)) {\n this.ignorePan = true;\n return;\n }\n\n this.ignorePan = false;\n this.isPanning = true;\n this.stopAnimation();\n this.targetScrollLeft = null;\n this.scrollPosition = this.nativeElement.scrollLeft;\n this.panStartScrollLeft = this.scrollPosition;\n this.nativeElement.style.userSelect = 'none';\n if (event.pointerType === 'mouse') {\n this.nativeElement.style.cursor = 'grabbing';\n }\n }\n\n private handlePanMove(event: AXGestureEvent): void {\n if (this.ignorePan || this.disabled() || !this.isPanning) return;\n\n event.preventDefault();\n const next = Math.max(0, Math.min(this.getMaxScrollLeft(), this.panStartScrollLeft - event.deltaX));\n this.applyScrollPosition(next);\n }\n\n private handlePanEnd(event: AXGestureEvent): void {\n if (this.ignorePan) {\n this.ignorePan = false;\n this.isPanning = false;\n return;\n }\n\n this.isPanning = false;\n this.clearPanStyles();\n\n if (this.disabled()) return;\n\n this.suppressClick();\n\n if (this.speed() <= 0) return;\n\n const distance = -event.velocityX * this.speed();\n if (Math.abs(distance) < 8) return;\n\n this.targetScrollLeft = Math.max(0, Math.min(this.getMaxScrollLeft(), this.scrollPosition + distance));\n this.startAnimation();\n }\n\n private clearPanStyles(): void {\n this.nativeElement.style.userSelect = '';\n this.nativeElement.style.cursor = '';\n }\n\n private suppressClick(): void {\n this.clearClickSuppression();\n\n const preventClick = (event: Event): void => {\n event.preventDefault();\n event.stopImmediatePropagation();\n this.clearClickSuppression();\n };\n\n this.suppressClickListener = preventClick;\n this.nativeElement.addEventListener('click', preventClick, true);\n this.suppressClickTimer = setTimeout(() => this.clearClickSuppression(), 400);\n }\n\n private clearClickSuppression(): void {\n if (this.suppressClickTimer !== null) {\n clearTimeout(this.suppressClickTimer);\n this.suppressClickTimer = null;\n }\n\n if (!this.suppressClickListener) return;\n\n this.nativeElement.removeEventListener('click', this.suppressClickListener, true);\n this.suppressClickListener = null;\n }\n\n private syncScrollState(): void {\n if (this.targetScrollLeft !== null) return;\n\n this.scrollPosition = this.nativeElement.scrollLeft;\n this.targetScrollLeft = this.scrollPosition;\n }\n\n private startAnimation(): void {\n if (this.animationFrameId !== null) return;\n\n this.lastFrameTime = performance.now();\n\n const step = (currentTime: number): void => {\n const target = this.targetScrollLeft;\n\n if (target === null) {\n this.stopAnimation();\n return;\n }\n\n const deltaTime = Math.max(currentTime - this.lastFrameTime, 1);\n this.lastFrameTime = currentTime;\n\n const factor = 1 - Math.exp(-deltaTime / this.speed());\n this.scrollPosition += (target - this.scrollPosition) * factor;\n this.applyScrollPosition(this.scrollPosition);\n\n if (Math.abs(target - this.scrollPosition) < 0.5) {\n this.applyScrollPosition(target);\n this.targetScrollLeft = null;\n this.stopAnimation();\n return;\n }\n\n this.animationFrameId = requestAnimationFrame(step);\n };\n\n this.animationFrameId = requestAnimationFrame(step);\n }\n\n private applyScrollPosition(position: number): void {\n this.scrollPosition = position;\n this.nativeElement.scrollLeft = position;\n }\n\n private stopAnimation(): void {\n if (this.animationFrameId === null) return;\n\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n\n private canScrollHorizontally(): boolean {\n const element = this.nativeElement;\n return element.scrollWidth > element.clientWidth;\n }\n\n private getMaxScrollLeft(): number {\n const element = this.nativeElement;\n return element.scrollWidth - element.clientWidth;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAcA;;;;;;;;;;AAUG;MAQU,2BAA2B,CAAA;AAkCtC,IAAA,WAAA,GAAA;AAjCiB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,EAAC,UAAuB,EAAC;AAC5C,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AACrB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACpC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAEhD;;AAEG;QACH,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK;qFAAC;AAEvB;;;AAGG;QACH,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,GAAG;kFAAC;QAEV,IAAA,CAAA,gBAAgB,GAAkB,IAAI;QACtC,IAAA,CAAA,gBAAgB,GAAkB,IAAI;QACtC,IAAA,CAAA,cAAc,GAAG,CAAC;QAClB,IAAA,CAAA,aAAa,GAAG,CAAC;QAEjB,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,kBAAkB,GAAG,CAAC;QACtB,IAAA,CAAA,qBAAqB,GAAoC,IAAI;QAC7D,IAAA,CAAA,kBAAkB,GAAyC,IAAI;QAEtD,IAAA,CAAA,mBAAmB,GAClC,mFAAmF;AAEpE,QAAA,IAAA,CAAA,aAAa,GAAG,C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EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,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,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,oBAAA,EAAA,+BAAA,EAAA,EAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,kBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAPvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;oBAChC,cAAc,EAAE,CAAC,kBAAkB,CAAC;AACpC,oBAAA,IAAI,EAAE;AACJ,wBAAA,sBAAsB,EAAE,6BAA6B;AACtD,qBAAA;AACF,iBAAA;;;AC/BD;;AAEG;;;;"}
|
|
@@ -420,8 +420,8 @@ class AXOverlayService {
|
|
|
420
420
|
// Set initial styles for positioning
|
|
421
421
|
container.style.position = 'fixed';
|
|
422
422
|
container.style.zIndex = String(zIndex);
|
|
423
|
-
container.style.maxWidth = '
|
|
424
|
-
container.style.maxHeight = '
|
|
423
|
+
container.style.maxWidth = '100%';
|
|
424
|
+
container.style.maxHeight = '100%';
|
|
425
425
|
if (options?.actionSheetStyle) {
|
|
426
426
|
container.style.width = this._platform.is('SM') ? '100%' : 'fit-content';
|
|
427
427
|
}
|
|
@@ -442,6 +442,8 @@ class AXOverlayService {
|
|
|
442
442
|
if (options.actionSheetStyle && this._platform.is('SM')) {
|
|
443
443
|
container.style.bottom = `0px`;
|
|
444
444
|
container.style.left = `0px`;
|
|
445
|
+
container.style.right = `0px`;
|
|
446
|
+
container.style.width = 'auto';
|
|
445
447
|
return;
|
|
446
448
|
}
|
|
447
449
|
const anchorOptions = options.anchorOptions;
|
|
@@ -450,8 +452,8 @@ class AXOverlayService {
|
|
|
450
452
|
const anchorElement = anchorOptions.anchor instanceof ElementRef ? anchorOptions.anchor.nativeElement : anchorOptions.anchor;
|
|
451
453
|
const anchorRect = anchorElement.getBoundingClientRect();
|
|
452
454
|
const containerRect = container.getBoundingClientRect();
|
|
453
|
-
const viewportWidth =
|
|
454
|
-
const viewportHeight =
|
|
455
|
+
const viewportWidth = this.document.documentElement.clientWidth;
|
|
456
|
+
const viewportHeight = this.document.documentElement.clientHeight;
|
|
455
457
|
// Get positions from placement
|
|
456
458
|
let positions = convertToPlacement(anchorOptions.placement ?? 'bottom');
|
|
457
459
|
if (positions.length === 0) {
|
|
@@ -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 = '100vw';\n container.style.maxHeight = '100vh';\n\n if (options?.actionSheetStyle) {\n container.style.width = this._platform.is('SM') ? '100%' : 'fit-content';\n } else {\n container.style.width = options?.width || 'fit-content';\n }\n\n // Move content into container\n pane.appendChild(content);\n container.appendChild(pane);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Positions the overlay container relative to the anchor element.\n */\n private positionOverlay(container: HTMLElement, options: AXOverlayOptions): void {\n if (options.actionSheetStyle && this._platform.is('SM')) {\n container.style.bottom = `0px`;\n container.style.left = `0px`;\n return;\n }\n\n const anchorOptions = options.anchorOptions;\n if (!anchorOptions?.anchor) return;\n\n const anchorElement =\n anchorOptions.anchor instanceof ElementRef ? anchorOptions.anchor.nativeElement : anchorOptions.anchor;\n\n const anchorRect = anchorElement.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Get positions from placement\n let positions = convertToPlacement(anchorOptions.placement ?? 'bottom');\n if (positions.length === 0) {\n positions = convertToPlacement('bottom');\n }\n\n // Apply custom offsets to positions with direction-aware inversion\n // When position flips, the offset should also be inverted to maintain the intended gap\n if (anchorOptions.offsetX || anchorOptions.offsetY) {\n const primaryPosition = positions[0];\n positions = positions.map((p) => {\n let adjustedOffsetX = anchorOptions.offsetX ?? 0;\n let adjustedOffsetY = anchorOptions.offsetY ?? 0;\n\n // Invert offsetY when vertical direction flips\n // (from bottom to top or vice versa)\n if (primaryPosition.originY !== p.originY) {\n adjustedOffsetY = -adjustedOffsetY;\n }\n\n // Invert offsetX when horizontal direction flips\n // (from end to start or vice versa)\n if (primaryPosition.originX !== p.originX) {\n adjustedOffsetX = -adjustedOffsetX;\n }\n\n return {\n ...p,\n offsetX: (p.offsetX ?? 0) + adjustedOffsetX,\n offsetY: (p.offsetY ?? 0) + adjustedOffsetY,\n };\n });\n }\n\n // Find the best position that fits in viewport\n const { coords } = anchorOptions.autoFlip\n ? findBestPosition(anchorRect, containerRect, positions, viewportWidth, viewportHeight)\n : {\n coords: {\n top:\n positions[0].originY === 'bottom'\n ? anchorRect.bottom + (positions[0].offsetY ?? 0)\n : anchorRect.top - containerRect.height + (positions[0].offsetY ?? 0),\n left: anchorRect.left + (positions[0].offsetX ?? 0),\n },\n };\n\n // Apply position\n container.style.top = `${coords.top}px`;\n container.style.left = `${coords.left}px`;\n }\n\n private 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,OAAO,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AAA,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 /** 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,OAAO,EAAE,OAAO,EAAE,OAAO;AAEjE,MAAM,8BAA8B,GAAG;AAC5C,IAAA,GAAG,kBAAkB;AACrB,IAAA,GAAG,aAAa;AAChB,IAAA,GAAG,gBAAgB;AACnB,IAAA,GAAG,YAAY;;AAGjB;;;AAGG;AACG,SAAU,oBAAoB,CAClC,MAAsC,EACtC,YAAiC,EAAA;IAEjC,MAAM,OAAO,GAA2B,EAAE;IAC1C,MAAM,IAAI,GAAG,YAAY,KAAK,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,CAAC,eAAe,GAA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UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import * as i1 from '@acorex/cdk/gesture';
|
|
2
|
+
import { AXGestureDirective } from '@acorex/cdk/gesture';
|
|
1
3
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, signal, effect, afterNextRender, Directive } from '@angular/core';
|
|
4
|
+
import { inject, ElementRef, DestroyRef, signal, effect, afterNextRender, Directive } from '@angular/core';
|
|
3
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Enables horizontal sliding on the host via the hosted AXGestureDirective pan events.
|
|
8
|
+
*
|
|
9
|
+
* Do not put `axGesture` on the same element; this directive already hosts it.
|
|
10
|
+
*/
|
|
4
11
|
class AXSlidingItemDirective {
|
|
5
12
|
constructor() {
|
|
6
|
-
this.hostElement = inject(ElementRef);
|
|
7
|
-
this.
|
|
8
|
-
|
|
9
|
-
this.prevX = signal(0, /* @ts-ignore */
|
|
10
|
-
...(ngDevMode ? [{ debugName: "prevX" }] : /* istanbul ignore next */ []));
|
|
13
|
+
this.hostElement = inject((ElementRef));
|
|
14
|
+
this.gesture = inject(AXGestureDirective);
|
|
15
|
+
this.destroyRef = inject(DestroyRef);
|
|
11
16
|
this.currentX = signal(0, /* @ts-ignore */
|
|
12
17
|
...(ngDevMode ? [{ debugName: "currentX" }] : /* istanbul ignore next */ []));
|
|
13
18
|
this.stopPoint = signal(0, /* @ts-ignore */
|
|
@@ -16,6 +21,9 @@ class AXSlidingItemDirective {
|
|
|
16
21
|
...(ngDevMode ? [{ debugName: "disableSlidingRight" }] : /* istanbul ignore next */ []));
|
|
17
22
|
this.disableSlidingLeft = signal(false, /* @ts-ignore */
|
|
18
23
|
...(ngDevMode ? [{ debugName: "disableSlidingLeft" }] : /* istanbul ignore next */ []));
|
|
24
|
+
this.cursor = signal('grab', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "cursor" }] : /* istanbul ignore next */ []));
|
|
26
|
+
this.originX = 0;
|
|
19
27
|
this.#positionChange = effect(() => {
|
|
20
28
|
if (this.currentX() > 0 && this.disableSlidingRight())
|
|
21
29
|
return;
|
|
@@ -26,77 +34,79 @@ class AXSlidingItemDirective {
|
|
|
26
34
|
...(ngDevMode ? [{ debugName: "#positionChange" }] : /* istanbul ignore next */ []));
|
|
27
35
|
this.#init = afterNextRender(() => {
|
|
28
36
|
const el = this.hostElement.nativeElement.parentElement;
|
|
37
|
+
if (!el)
|
|
38
|
+
return;
|
|
29
39
|
el.style.display = 'flex';
|
|
30
40
|
el.style.justifyContent = 'space-between';
|
|
31
41
|
el.style.position = 'relative';
|
|
32
42
|
el.style.overflow = 'hidden';
|
|
33
43
|
});
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.hostElement.nativeElement.onpointerdown = (e) => {
|
|
45
|
-
this.hostElement.nativeElement.style.transition = 'none';
|
|
46
|
-
this.hostElement.nativeElement.style.cursor = 'grabbing';
|
|
47
|
-
this.isMouseDown.set(true);
|
|
48
|
-
this.prevX.set(e.clientX);
|
|
49
|
-
};
|
|
50
|
-
this.hostElement.nativeElement.onpointermove = (e) => {
|
|
51
|
-
if (!this.isMouseDown())
|
|
52
|
-
return;
|
|
53
|
-
const currentX = e.clientX;
|
|
54
|
-
const deltaX = currentX - this.prevX();
|
|
55
|
-
this.currentX.update((prev) => prev + deltaX);
|
|
56
|
-
this.prevX.set(currentX);
|
|
57
|
-
};
|
|
58
|
-
this.hostElement.nativeElement.onpointerup = () => {
|
|
59
|
-
this.isMouseDown.set(false);
|
|
60
|
-
this.dismiss();
|
|
61
|
-
};
|
|
62
|
-
this.hostElement.nativeElement.onpointerleave = () => {
|
|
63
|
-
if (!this.isMouseDown())
|
|
64
|
-
return;
|
|
65
|
-
this.isMouseDown.set(false);
|
|
66
|
-
this.dismiss();
|
|
67
|
-
};
|
|
68
|
-
}, /* @ts-ignore */
|
|
69
|
-
...(ngDevMode ? [{ debugName: "#effect2" }] : /* istanbul ignore next */ []));
|
|
44
|
+
const subscriptions = [
|
|
45
|
+
this.gesture.panstart.subscribe(() => this.handlePanStart()),
|
|
46
|
+
this.gesture.panmove.subscribe((event) => this.handlePanMove(event)),
|
|
47
|
+
this.gesture.panend.subscribe(() => this.handlePanEnd()),
|
|
48
|
+
];
|
|
49
|
+
this.destroyRef.onDestroy(() => {
|
|
50
|
+
for (const subscription of subscriptions) {
|
|
51
|
+
subscription.unsubscribe();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
70
54
|
}
|
|
71
55
|
#positionChange;
|
|
72
56
|
#init;
|
|
73
|
-
|
|
57
|
+
handlePanStart() {
|
|
58
|
+
this.hostElement.nativeElement.style.transition = 'none';
|
|
59
|
+
this.cursor.set('grabbing');
|
|
60
|
+
this.originX = this.currentX();
|
|
61
|
+
}
|
|
62
|
+
handlePanMove(event) {
|
|
63
|
+
let next = this.originX + event.deltaX;
|
|
64
|
+
if (next > 0 && this.disableSlidingRight())
|
|
65
|
+
next = 0;
|
|
66
|
+
if (next < 0 && this.disableSlidingLeft())
|
|
67
|
+
next = 0;
|
|
68
|
+
this.currentX.set(next);
|
|
69
|
+
}
|
|
70
|
+
handlePanEnd() {
|
|
71
|
+
this.dismiss();
|
|
72
|
+
}
|
|
74
73
|
dismiss() {
|
|
75
|
-
const el = this.hostElement.nativeElement;
|
|
76
74
|
this.hostElement.nativeElement.style.transition = '.5s transform ease';
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.prevX.set(this.stopPoint());
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
el.style.transform = `translate(0, 0)`;
|
|
85
|
-
this.currentX.set(0);
|
|
86
|
-
this.prevX.set(0);
|
|
87
|
-
}
|
|
75
|
+
this.cursor.set('grab');
|
|
76
|
+
const target = this.stopPoint();
|
|
77
|
+
this.currentX.set(target);
|
|
78
|
+
this.setPosition(target);
|
|
88
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Sets the position of the sliding element.
|
|
82
|
+
*
|
|
83
|
+
* @param pos - The horizontal position in pixels to set the element to
|
|
84
|
+
* @returns void - No return value. The element's transform is updated to the specified position.
|
|
85
|
+
*/
|
|
89
86
|
setPosition(pos) {
|
|
90
|
-
|
|
91
|
-
el.style.transform = `translate(${pos}px, 0)`;
|
|
87
|
+
this.hostElement.nativeElement.style.transform = `translate(${pos}px, 0)`;
|
|
92
88
|
}
|
|
93
89
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXSlidingItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
94
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: AXSlidingItemDirective, isStandalone: true, selector: "[axSlidingItem]", ngImport: i0 }); }
|
|
90
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: AXSlidingItemDirective, isStandalone: true, selector: "[axSlidingItem]", host: { properties: { "style.position": "\"absolute\"", "style.top": "\"0\"", "style.left": "\"0\"", "style.width": "\"100%\"", "style.height": "\"100%\"", "style.z-index": "\"1\"", "style.cursor": "cursor()", "style.user-select": "\"none\"", "style.touch-action": "\"none\"" } }, hostDirectives: [{ directive: i1.AXGestureDirective }], ngImport: i0 }); }
|
|
95
91
|
}
|
|
96
92
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXSlidingItemDirective, decorators: [{
|
|
97
93
|
type: Directive,
|
|
98
|
-
args: [{
|
|
99
|
-
|
|
94
|
+
args: [{
|
|
95
|
+
selector: '[axSlidingItem]',
|
|
96
|
+
hostDirectives: [AXGestureDirective],
|
|
97
|
+
host: {
|
|
98
|
+
'[style.position]': '"absolute"',
|
|
99
|
+
'[style.top]': '"0"',
|
|
100
|
+
'[style.left]': '"0"',
|
|
101
|
+
'[style.width]': '"100%"',
|
|
102
|
+
'[style.height]': '"100%"',
|
|
103
|
+
'[style.z-index]': '"1"',
|
|
104
|
+
'[style.cursor]': 'cursor()',
|
|
105
|
+
'[style.user-select]': '"none"',
|
|
106
|
+
'[style.touch-action]': '"none"',
|
|
107
|
+
},
|
|
108
|
+
}]
|
|
109
|
+
}], ctorParameters: () => [] });
|
|
100
110
|
|
|
101
111
|
/**
|
|
102
112
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-cdk-sliding-item.mjs","sources":["../../../../packages/cdk/sliding-item/src/lib/sliding-item.directive.ts","../../../../packages/cdk/sliding-item/src/acorex-cdk-sliding-item.ts"],"sourcesContent":["import { afterNextRender, Directive, effect, ElementRef, inject, signal } from '@angular/core';\n\n@Directive({
|
|
1
|
+
{"version":3,"file":"acorex-cdk-sliding-item.mjs","sources":["../../../../packages/cdk/sliding-item/src/lib/sliding-item.directive.ts","../../../../packages/cdk/sliding-item/src/acorex-cdk-sliding-item.ts"],"sourcesContent":["import { AXGestureDirective, AXGestureEvent } from '@acorex/cdk/gesture';\nimport { afterNextRender, DestroyRef, Directive, effect, ElementRef, inject, signal } from '@angular/core';\n\n/**\n * Enables horizontal sliding on the host via the hosted AXGestureDirective pan events.\n *\n * Do not put `axGesture` on the same element; this directive already hosts it.\n */\n@Directive({\n selector: '[axSlidingItem]',\n hostDirectives: [AXGestureDirective],\n host: {\n '[style.position]': '\"absolute\"',\n '[style.top]': '\"0\"',\n '[style.left]': '\"0\"',\n '[style.width]': '\"100%\"',\n '[style.height]': '\"100%\"',\n '[style.z-index]': '\"1\"',\n '[style.cursor]': 'cursor()',\n '[style.user-select]': '\"none\"',\n '[style.touch-action]': '\"none\"',\n },\n})\nexport class AXSlidingItemDirective {\n private readonly hostElement = inject(ElementRef<HTMLElement>);\n private readonly gesture = inject(AXGestureDirective);\n private readonly destroyRef = inject(DestroyRef);\n\n currentX = signal(0);\n stopPoint = signal(0);\n disableSlidingRight = signal(false);\n disableSlidingLeft = signal(false);\n\n protected readonly cursor = signal('grab');\n private originX = 0;\n\n constructor() {\n const subscriptions = [\n this.gesture.panstart.subscribe(() => this.handlePanStart()),\n this.gesture.panmove.subscribe((event) => this.handlePanMove(event)),\n this.gesture.panend.subscribe(() => this.handlePanEnd()),\n ];\n this.destroyRef.onDestroy(() => {\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n });\n }\n\n #positionChange = effect(() => {\n if (this.currentX() > 0 && this.disableSlidingRight()) return;\n if (this.currentX() < 0 && this.disableSlidingLeft()) return;\n this.setPosition(this.currentX());\n });\n\n #init = afterNextRender(() => {\n const el = this.hostElement.nativeElement.parentElement;\n if (!el) return;\n el.style.display = 'flex';\n el.style.justifyContent = 'space-between';\n el.style.position = 'relative';\n el.style.overflow = 'hidden';\n });\n\n private handlePanStart(): void {\n this.hostElement.nativeElement.style.transition = 'none';\n this.cursor.set('grabbing');\n this.originX = this.currentX();\n }\n\n private handlePanMove(event: AXGestureEvent): void {\n let next = this.originX + event.deltaX;\n if (next > 0 && this.disableSlidingRight()) next = 0;\n if (next < 0 && this.disableSlidingLeft()) next = 0;\n this.currentX.set(next);\n }\n\n private handlePanEnd(): void {\n this.dismiss();\n }\n\n private dismiss(): void {\n this.hostElement.nativeElement.style.transition = '.5s transform ease';\n this.cursor.set('grab');\n const target = this.stopPoint();\n this.currentX.set(target);\n this.setPosition(target);\n }\n\n /**\n * Sets the position of the sliding element.\n *\n * @param pos - The horizontal position in pixels to set the element to\n * @returns void - No return value. The element's transform is updated to the specified position.\n */\n setPosition(pos: number): void {\n this.hostElement.nativeElement.style.transform = `translate(${pos}px, 0)`;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names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AkB,CAAC;AACpC,oBAAA,IAAI,EAAE;AACJ,wBAAA,kBAAkB,EAAE,YAAY;AAChC,wBAAA,aAAa,EAAE,KAAK;AACpB,wBAAA,cAAc,EAAE,KAAK;AACrB,wBAAA,eAAe,EAAE,QAAQ;AACzB,wBAAA,gBAAgB,EAAE,QAAQ;AAC1B,wBAAA,iBAAiB,EAAE,KAAK;AACxB,wBAAA,gBAAgB,EAAE,UAAU;AAC5B,wBAAA,qBAAqB,EAAE,QAAQ;AAC/B,wBAAA,sBAAsB,EAAE,QAAQ;AACjC,qBAAA;AACF,iBAAA;;;ACtBD;;AAEG;;;;"}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Secondary entry point of `@acorex/cdk`. It can be used by importing from `@acorex/cdk/horizontal-scroll`.
|
|
4
4
|
|
|
5
|
-
Converts vertical mouse-wheel scrolling into horizontal scrolling on scrollable host elements.
|
|
5
|
+
Converts vertical mouse-wheel scrolling and horizontal pan into horizontal scrolling on scrollable host elements. Pan is provided by a hosted `AXGestureDirective`. Do not put `axGesture` on the same element.
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acorex/cdk",
|
|
3
|
-
"version": "22.1.0
|
|
3
|
+
"version": "22.1.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@acorex/core": "22.1.0
|
|
5
|
+
"@acorex/core": "22.1.0",
|
|
6
6
|
"quill": ">=2.0.2",
|
|
7
7
|
"qrcode": ">=1.5.4",
|
|
8
8
|
"swiper": ">=11.1.15",
|
|
9
|
-
"maska": ">=3.1.1"
|
|
9
|
+
"maska": ">=3.1.1",
|
|
10
|
+
"hammerjs": ">=2.0.8"
|
|
10
11
|
},
|
|
11
12
|
"sideEffects": false,
|
|
12
13
|
"module": "fesm2022/acorex-cdk.mjs",
|
|
@@ -59,6 +60,14 @@
|
|
|
59
60
|
"types": "./types/acorex-cdk-full-screen.d.ts",
|
|
60
61
|
"default": "./fesm2022/acorex-cdk-full-screen.mjs"
|
|
61
62
|
},
|
|
63
|
+
"./gesture": {
|
|
64
|
+
"types": "./types/acorex-cdk-gesture.d.ts",
|
|
65
|
+
"default": "./fesm2022/acorex-cdk-gesture.mjs"
|
|
66
|
+
},
|
|
67
|
+
"./highlight": {
|
|
68
|
+
"types": "./types/acorex-cdk-highlight.d.ts",
|
|
69
|
+
"default": "./fesm2022/acorex-cdk-highlight.mjs"
|
|
70
|
+
},
|
|
62
71
|
"./horizontal-scroll": {
|
|
63
72
|
"types": "./types/acorex-cdk-horizontal-scroll.d.ts",
|
|
64
73
|
"default": "./fesm2022/acorex-cdk-horizontal-scroll.mjs"
|
package/sliding-item/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
# @acorex/cdk/sliding-
|
|
1
|
+
# @acorex/cdk/sliding-item
|
|
2
2
|
|
|
3
|
-
Secondary entry point of `@acorex/cdk`. It can be used by importing from `@acorex/cdk/sliding-
|
|
3
|
+
Secondary entry point of `@acorex/cdk`. It can be used by importing from `@acorex/cdk/sliding-item`.
|
|
4
|
+
|
|
5
|
+
Enables horizontal sliding on the host via a hosted `AXGestureDirective`. Do not put `axGesture` on the same element.
|