@acorex/cdk 22.1.0-next.9 → 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.
@@ -0,0 +1,120 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { OnDestroy, OutputEmitterRef } from '@angular/core';
3
+
4
+ /**
5
+ * Hammer.js event payload emitted by AXGestureDirective outputs.
6
+ */
7
+ interface AXGestureEvent {
8
+ type: string;
9
+ deltaX: number;
10
+ deltaY: number;
11
+ deltaTime: number;
12
+ distance: number;
13
+ angle: number;
14
+ velocity: number;
15
+ velocityX: number;
16
+ velocityY: number;
17
+ direction: number;
18
+ offsetDirection: number;
19
+ scale: number;
20
+ rotation: number;
21
+ center: {
22
+ x: number;
23
+ y: number;
24
+ };
25
+ srcEvent: Event;
26
+ target: HTMLElement;
27
+ pointerType: string;
28
+ eventType: number;
29
+ isFirst: boolean;
30
+ isFinal: boolean;
31
+ preventDefault: () => void;
32
+ }
33
+ /**
34
+ * Hammer.js constructor options passed through to the manager.
35
+ */
36
+ interface AXGestureOptions {
37
+ touchAction?: string;
38
+ enable?: boolean;
39
+ cssProps?: Record<string, string | number>;
40
+ domEvents?: boolean;
41
+ inputTarget?: EventTarget;
42
+ }
43
+ /**
44
+ * Allowed pan and swipe directions. Maps to Hammer.DIRECTION_* constants.
45
+ */
46
+ type AXGestureDirection = 'all' | 'horizontal' | 'vertical';
47
+ /**
48
+ * Public surface of the Hammer manager exposed via AXGestureDirective.manager.
49
+ */
50
+ interface AXGestureManager {
51
+ get: (name: string) => {
52
+ set: (options: object) => unknown;
53
+ } | null;
54
+ on: (events: string, handler: (ev: AXGestureEvent) => void) => void;
55
+ off: (events: string, handler: (ev: AXGestureEvent) => void) => void;
56
+ destroy: () => void;
57
+ }
58
+
59
+ /**
60
+ * Attaches Hammer.js gesture recognition to the host element.
61
+ *
62
+ * Usage:
63
+ * <div axGesture [direction]="'all'" (tap)="onTap($event)" (pan)="onPan($event)"></div>
64
+ */
65
+ declare class AXGestureDirective implements OnDestroy {
66
+ #private;
67
+ private readonly el;
68
+ private readonly zone;
69
+ private readonly platformId;
70
+ /**
71
+ * Extra Hammer.js options forwarded to the manager constructor.
72
+ */
73
+ options: _angular_core.InputSignal<AXGestureOptions>;
74
+ /**
75
+ * Pan and swipe direction. Defaults to horizontal, matching Hammer.js.
76
+ */
77
+ direction: _angular_core.InputSignal<AXGestureDirection>;
78
+ /**
79
+ * Enables the multi-touch pinch recognizer. Disabled by default.
80
+ */
81
+ enablePinch: _angular_core.InputSignal<boolean>;
82
+ /**
83
+ * Enables the multi-touch rotate recognizer. Disabled by default.
84
+ */
85
+ enableRotate: _angular_core.InputSignal<boolean>;
86
+ /**
87
+ * Stops gesture recognition when true.
88
+ */
89
+ disabled: _angular_core.InputSignal<boolean>;
90
+ tap: OutputEmitterRef<AXGestureEvent>;
91
+ doubletap: OutputEmitterRef<AXGestureEvent>;
92
+ press: OutputEmitterRef<AXGestureEvent>;
93
+ pan: OutputEmitterRef<AXGestureEvent>;
94
+ panstart: OutputEmitterRef<AXGestureEvent>;
95
+ panmove: OutputEmitterRef<AXGestureEvent>;
96
+ panend: OutputEmitterRef<AXGestureEvent>;
97
+ swipe: OutputEmitterRef<AXGestureEvent>;
98
+ pinch: OutputEmitterRef<AXGestureEvent>;
99
+ rotate: OutputEmitterRef<AXGestureEvent>;
100
+ private hammer;
101
+ private hammerLib;
102
+ private setupId;
103
+ private ready;
104
+ private readonly emitters;
105
+ /**
106
+ * The underlying Hammer manager, or null when not initialized.
107
+ */
108
+ get manager(): AXGestureManager | null;
109
+ ngOnDestroy(): void;
110
+ private setup;
111
+ private loadHammer;
112
+ private toHammerDirection;
113
+ private teardown;
114
+ private readonly onHammerEvent;
115
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXGestureDirective, never>;
116
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXGestureDirective, "[axGesture]", ["axGesture"], { "options": { "alias": "options"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "enablePinch": { "alias": "enablePinch"; "required": false; "isSignal": true; }; "enableRotate": { "alias": "enableRotate"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "tap": "tap"; "doubletap": "doubletap"; "press": "press"; "pan": "pan"; "panstart": "panstart"; "panmove": "panmove"; "panend": "panend"; "swipe": "swipe"; "pinch": "pinch"; "rotate": "rotate"; }, never, never, true, never>;
117
+ }
118
+
119
+ export { AXGestureDirective };
120
+ export type { AXGestureDirection, AXGestureEvent, AXGestureManager, AXGestureOptions };
@@ -0,0 +1,81 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { PipeTransform } from '@angular/core';
3
+ import { AXHighlightOptions, AXHighlightSegment } from '@acorex/core/utils';
4
+ import { SafeHtml } from '@angular/platform-browser';
5
+
6
+ /**
7
+ * Directive that highlights text within the host element or its descendants.
8
+ *
9
+ * Usage:
10
+ * ```html
11
+ * <div [axHighlight]="query()">...</div>
12
+ * <table [axHighlight]="query()" highlightSelector="tbody td">...</table>
13
+ * ```
14
+ */
15
+ declare class AXHighlightDirective {
16
+ private readonly host;
17
+ private readonly destroyRef;
18
+ private readonly highlightService;
19
+ /**
20
+ * Text or list of texts to search and highlight.
21
+ */
22
+ readonly axHighlight: _angular_core.InputSignal<string | readonly string[]>;
23
+ /**
24
+ * Optional CSS selector scoped to the host element.
25
+ * When omitted, highlighting is applied to the host element itself.
26
+ */
27
+ readonly highlightSelector: _angular_core.InputSignal<string>;
28
+ /**
29
+ * Optional highlight behavior configuration.
30
+ */
31
+ readonly highlightOptions: _angular_core.InputSignal<AXHighlightOptions>;
32
+ /**
33
+ * When true, highlighting is disabled and any existing highlights are cleared.
34
+ */
35
+ readonly highlightDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
36
+ /**
37
+ * Emits the number of matches highlighted after each render cycle.
38
+ */
39
+ readonly matchCount: _angular_core.OutputEmitterRef<number>;
40
+ constructor();
41
+ private resolveTarget;
42
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXHighlightDirective, never>;
43
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXHighlightDirective, "[axHighlight]", never, { "axHighlight": { "alias": "axHighlight"; "required": false; "isSignal": true; }; "highlightSelector": { "alias": "highlightSelector"; "required": false; "isSignal": true; }; "highlightOptions": { "alias": "highlightOptions"; "required": false; "isSignal": true; }; "highlightDisabled": { "alias": "highlightDisabled"; "required": false; "isSignal": true; }; }, { "matchCount": "matchCount"; }, never, never, true, never>;
44
+ }
45
+
46
+ /**
47
+ * Renders text with search-term matches wrapped in `.ax-highlight` spans.
48
+ *
49
+ * Uses a single innerHTML string so Angular control-flow whitespace cannot insert
50
+ * gaps between highlighted and non-highlighted characters.
51
+ *
52
+ * Does not use the `ax-highlight-text` class on the host — that class is reserved for
53
+ * {@link AXHighlightService} DOM wrappers.
54
+ */
55
+ declare class AXHighlightTextComponent {
56
+ #private;
57
+ private readonly sanitizer;
58
+ /** The full text to render. */
59
+ readonly text: _angular_core.InputSignal<string>;
60
+ /** The search term or terms to highlight within the text. */
61
+ readonly query: _angular_core.InputSignal<string | readonly string[]>;
62
+ /** When true, highlighting is disabled and plain text is shown. */
63
+ readonly highlightDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
64
+ /** Optional highlight behavior configuration. */
65
+ readonly highlightOptions: _angular_core.InputSignal<AXHighlightOptions>;
66
+ protected readonly segments: _angular_core.Signal<AXHighlightSegment[]>;
67
+ protected readonly highlightedHtml: _angular_core.Signal<SafeHtml>;
68
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXHighlightTextComponent, never>;
69
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXHighlightTextComponent, "ax-highlight-text", never, { "text": { "alias": "text"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "highlightDisabled": { "alias": "highlightDisabled"; "required": false; "isSignal": true; }; "highlightOptions": { "alias": "highlightOptions"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
70
+ }
71
+
72
+ /**
73
+ * Pure pipe that splits text into highlight segments for template rendering.
74
+ */
75
+ declare class AXHighlightTextPipe implements PipeTransform {
76
+ transform(text: string | null | undefined, query: string | readonly string[] | null | undefined, options?: AXHighlightOptions): AXHighlightSegment[];
77
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXHighlightTextPipe, never>;
78
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<AXHighlightTextPipe, "axHighlightText", true>;
79
+ }
80
+
81
+ export { AXHighlightDirective, AXHighlightTextComponent, AXHighlightTextPipe };
@@ -1,22 +1,27 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { OnDestroy } from '@angular/core';
3
+ import * as i1 from '@acorex/cdk/gesture';
3
4
 
4
5
  /**
5
- * Converts vertical mouse-wheel scrolling into horizontal scrolling on the host element.
6
- * Applies only when the host can scroll horizontally.
6
+ * Converts vertical mouse-wheel scrolling and horizontal pan into horizontal scrolling on the host element.
7
+ * Applies only when the host can scroll horizontally. Pan is provided by the hosted AXGestureDirective.
7
8
  *
8
9
  * Usage:
9
10
  * <div axHorizontalScroll [speed]="150" class="overflow-x-auto">
10
11
  * ...
11
12
  * </div>
13
+ *
14
+ * Do not put `axGesture` on the same element; this directive already hosts it.
12
15
  */
13
16
  declare class AXHorizontalScrollDirective implements OnDestroy {
14
17
  #private;
15
- private elementRef;
16
- private platformId;
17
- private zone;
18
+ private readonly elementRef;
19
+ private readonly platformId;
20
+ private readonly zone;
21
+ private readonly gesture;
22
+ private readonly destroyRef;
18
23
  /**
19
- * Disables wheel-to-horizontal conversion when true.
24
+ * Disables wheel-to-horizontal conversion and pan scrolling when true.
20
25
  */
21
26
  disabled: _angular_core.InputSignal<boolean>;
22
27
  /**
@@ -28,17 +33,31 @@ declare class AXHorizontalScrollDirective implements OnDestroy {
28
33
  private targetScrollLeft;
29
34
  private scrollPosition;
30
35
  private lastFrameTime;
36
+ private isPanning;
37
+ private ignorePan;
38
+ private panStartScrollLeft;
39
+ private suppressClickListener;
40
+ private suppressClickTimer;
41
+ private readonly interactiveSelector;
31
42
  private readonly wheelListener;
43
+ constructor();
32
44
  ngOnDestroy(): void;
33
45
  private get nativeElement();
34
46
  private handleWheel;
47
+ private handlePanStart;
48
+ private handlePanMove;
49
+ private handlePanEnd;
50
+ private clearPanStyles;
51
+ private suppressClick;
52
+ private clearClickSuppression;
35
53
  private syncScrollState;
36
54
  private startAnimation;
37
55
  private applyScrollPosition;
38
56
  private stopAnimation;
39
57
  private canScrollHorizontally;
58
+ private getMaxScrollLeft;
40
59
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXHorizontalScrollDirective, never>;
41
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXHorizontalScrollDirective, "[axHorizontalScroll]", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "speed": { "alias": "speed"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
60
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXHorizontalScrollDirective, "[axHorizontalScroll]", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "speed": { "alias": "speed"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.AXGestureDirective; inputs: {}; outputs: {}; }]>;
42
61
  }
43
62
 
44
63
  export { AXHorizontalScrollDirective };
@@ -1,18 +1,36 @@
1
1
  import * as _angular_core from '@angular/core';
2
+ import * as i1 from '@acorex/cdk/gesture';
2
3
 
4
+ /**
5
+ * Enables horizontal sliding on the host via the hosted AXGestureDirective pan events.
6
+ *
7
+ * Do not put `axGesture` on the same element; this directive already hosts it.
8
+ */
3
9
  declare class AXSlidingItemDirective {
4
10
  #private;
5
- private hostElement;
6
- private isMouseDown;
7
- private prevX;
11
+ private readonly hostElement;
12
+ private readonly gesture;
13
+ private readonly destroyRef;
8
14
  currentX: _angular_core.WritableSignal<number>;
9
15
  stopPoint: _angular_core.WritableSignal<number>;
10
16
  disableSlidingRight: _angular_core.WritableSignal<boolean>;
11
17
  disableSlidingLeft: _angular_core.WritableSignal<boolean>;
18
+ protected readonly cursor: _angular_core.WritableSignal<string>;
19
+ private originX;
20
+ constructor();
21
+ private handlePanStart;
22
+ private handlePanMove;
23
+ private handlePanEnd;
12
24
  private dismiss;
25
+ /**
26
+ * Sets the position of the sliding element.
27
+ *
28
+ * @param pos - The horizontal position in pixels to set the element to
29
+ * @returns void - No return value. The element's transform is updated to the specified position.
30
+ */
13
31
  setPosition(pos: number): void;
14
32
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXSlidingItemDirective, never>;
15
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXSlidingItemDirective, "[axSlidingItem]", never, {}, {}, never, never, true, never>;
33
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXSlidingItemDirective, "[axSlidingItem]", never, {}, {}, never, never, true, [{ directive: typeof i1.AXGestureDirective; inputs: {}; outputs: {}; }]>;
16
34
  }
17
35
 
18
36
  export { AXSlidingItemDirective };