@acorex/cdk 22.4.47 → 22.4.48

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.
@@ -1,5 +1,5 @@
1
- import * as _angular_core from '@angular/core';
2
- import { InjectionToken, EnvironmentProviders } from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Type, EnvironmentProviders } from '@angular/core';
3
3
 
4
4
  /** Default delay (ms) before the overlay scrollbar fades out after scroll. */
5
5
  declare const AX_OVERLAY_SCROLLBAR_DEFAULT_HIDE_DELAY_MS = 800;
@@ -26,6 +26,8 @@ interface AXOverlayScrollbarDesignTokens {
26
26
  }
27
27
  /** Application-wide defaults for {@link AXOverlayScrollbarDirective}. */
28
28
  interface AXOverlayScrollbarConfig {
29
+ /** When false, overlay scrollbars are not initialized (native scrollbars remain). */
30
+ enabled: boolean;
29
31
  /** Milliseconds before the scrollbar rail fades out after scrolling stops. */
30
32
  hideDelay: number;
31
33
  /** When true, shows up/down arrow buttons on the scrollbar rail. */
@@ -35,55 +37,60 @@ interface AXOverlayScrollbarConfig {
35
37
  /** Optional global design tokens (CSS custom properties). */
36
38
  designTokens?: AXOverlayScrollbarDesignTokens;
37
39
  }
40
+ /**
41
+ * Defaults used by {@link overlayScrollbarConfig} / {@link provideOverlayScrollbar}.
42
+ * Calling the provider without `enabled` turns overlay scrollbars on.
43
+ */
38
44
  declare const AXOverlayScrollbarDefaultConfig: AXOverlayScrollbarConfig;
39
- type AXPartialOverlayScrollbarConfig = Partial<AXOverlayScrollbarConfig> & {
45
+ /** Config when {@link provideOverlayScrollbar} is not registered — native scrollbars stay intact. */
46
+ declare const AXOverlayScrollbarAbsentConfig: AXOverlayScrollbarConfig;
47
+ type AXPartialOverlayScrollbarConfig = Partial<Omit<AXOverlayScrollbarConfig, 'designTokens'>> & {
40
48
  designTokens?: Partial<AXOverlayScrollbarDesignTokens>;
41
49
  };
42
50
  declare const AX_OVERLAY_SCROLLBAR_CONFIG: InjectionToken<AXOverlayScrollbarConfig>;
43
51
  /** Merges partial config with {@link AXOverlayScrollbarDefaultConfig}. */
44
52
  declare function overlayScrollbarConfig(config?: AXPartialOverlayScrollbarConfig): AXOverlayScrollbarConfig;
45
- /** Sets overlay scrollbar CSS variables on the given element. */
46
- declare function applyOverlayScrollbarDesignTokens(element: HTMLElement, tokens?: AXOverlayScrollbarDesignTokens): void;
47
- /**
48
- * Registers global overlay scrollbar defaults for the application.
49
- *
50
- * @example
51
- * ```ts
52
- * export const appConfig: ApplicationConfig = {
53
- * providers: [
54
- * provideOverlayScrollbar({
55
- * hideDelay: 1200,
56
- * navigationButtons: true,
57
- * navScrollStep: 48,
58
- * designTokens: {
59
- * size: '8px',
60
- * thumbColor: 'var(--ax-sys-scroller-thumb-color)',
61
- * },
62
- * }),
63
- * ],
64
- * };
65
- * ```
66
- */
67
- declare function provideOverlayScrollbar(config?: AXPartialOverlayScrollbarConfig): EnvironmentProviders;
53
+ type AXOverlayScrollbarTokenSnapshot = Record<string, {
54
+ value: string;
55
+ priority: string;
56
+ } | null>;
57
+ /** Sets overlay scrollbar CSS variables on the given element. Returns a snapshot for restore. */
58
+ declare function applyOverlayScrollbarDesignTokens(element: HTMLElement, tokens?: AXOverlayScrollbarDesignTokens): AXOverlayScrollbarTokenSnapshot;
59
+ /** Restores CSS custom properties previously overwritten by {@link applyOverlayScrollbarDesignTokens}. */
60
+ declare function restoreOverlayScrollbarDesignTokens(element: HTMLElement, snapshot: AXOverlayScrollbarTokenSnapshot | null | undefined): void;
68
61
 
62
+ declare const AX_OVERLAY_SCROLLBAR_HOST_INIT_ATTR = "data-ax-overlay-scrollbar-host";
69
63
  declare function clampOverlayScrollbarWidth(px: number): number;
64
+ interface AXOverlayScrollbarRuntimeOptions {
65
+ hideDelay: number;
66
+ navigationButtons: boolean;
67
+ navScrollStep: number;
68
+ documentScroll?: boolean;
69
+ }
70
70
  /**
71
- * Custom overlay scrollbar: native scrollbars are hidden; a positioned thumb reflects scroll position.
72
- * Styles are injected once by this directive.
71
+ * DOM overlay scrollbar that does not require an Angular view on the host.
72
+ * Used by {@link AXOverlayScrollbarDirective} and by {@link provideOverlayScrollbar} auto-attach.
73
73
  */
74
- declare class AXOverlayScrollbarDirective {
75
- private readonly host;
76
- private readonly destroyRef;
77
- private readonly platformId;
74
+ declare class AXOverlayScrollbarRuntime {
75
+ private readonly hostEl;
78
76
  private readonly document;
79
- private readonly appConfig;
77
+ private readonly config;
78
+ private options;
79
+ constructor(hostEl: HTMLElement, document: Document, config: AXOverlayScrollbarConfig, options: AXOverlayScrollbarRuntimeOptions);
80
80
  private rootEl;
81
81
  private railEl;
82
82
  private trackEl;
83
83
  private navUpEl;
84
84
  private navDownEl;
85
85
  private thumbEl;
86
+ private xRailEl;
87
+ private xTrackEl;
88
+ private xThumbEl;
89
+ private navStartEl;
90
+ private navEndEl;
86
91
  private resizeObserver;
92
+ private contentMutationObserver;
93
+ private overflowRemeasureFrame;
87
94
  private designTokenMutationObserver;
88
95
  private designTokenSyncFrame;
89
96
  private thumbDragPointerId;
@@ -92,31 +99,69 @@ declare class AXOverlayScrollbarDirective {
92
99
  private unbindRailInteraction;
93
100
  /** Thumb size derived from layout; position updates on scroll without re-measuring scrollHeight. */
94
101
  private thumbLayout;
95
- readonly hideDelay: _angular_core.InputSignal<number>;
96
- /**
97
- * When true, shows browser-style up/down arrow buttons on the rail.
98
- * Styling follows track/thumb CSS tokens.
99
- */
100
- readonly navigationButtons: _angular_core.InputSignal<boolean>;
101
- /** Pixels to scroll per arrow click. */
102
- readonly navScrollStep: _angular_core.InputSignal<number>;
102
+ private xThumbLayout;
103
103
  private hideTimer;
104
- constructor();
104
+ private navRepeatDelayTimer;
105
+ private navRepeatTimer;
106
+ private scrollIdleTimer;
107
+ private isScrolling;
108
+ private pendingRemeasure;
109
+ /** When true, native scrollbars are hidden (only after overlay mount succeeds). */
110
+ private overlayMounted;
111
+ private addedRootClass;
112
+ private addedContainingBlockClass;
113
+ private retainedDocumentNativeHide;
114
+ private retainedStyles;
115
+ private unbindHostInteraction;
116
+ attach(): boolean;
117
+ isAttached(): boolean;
118
+ updateOptions(patch: Partial<AXOverlayScrollbarRuntimeOptions>): void;
119
+ detach(): void;
120
+ /** Content can grow without the host box changing (side menu items). Remeasure overflow when that happens. */
121
+ private observeOverflowContent;
122
+ private isOverlayChromeNode;
123
+ private queueOverflowRemeasure;
105
124
  /** Host and rail are siblings under the root; mirror CSS variables when the host style/class changes. */
106
125
  private observeHostDesignTokenChanges;
107
126
  private queueDesignTokenSync;
108
- /** Rail lives on a wrapper so it stays fixed while the host scrolls. */
127
+ private isDocumentScroller;
128
+ /** Document-level attachment (invisible anchor); not the same as host `html`/`body`. */
129
+ private isDocumentScrollAttachment;
130
+ private tokenStyleSource;
131
+ private applyConfigDesignTokens;
132
+ /** html/body scroll through `scrollingElement`; nested hosts scroll themselves. */
133
+ private getScrollMetricsElement;
134
+ /**
135
+ * Positions the rail on the scroll host itself. Never wraps or reparents the scroller.
136
+ */
109
137
  private ensureScrollRoot;
138
+ /** Absolute rails need a containing block, but must not override sticky/fixed/absolute hosts. */
139
+ private ensureContainingBlock;
110
140
  private mountCustomScrollbar;
141
+ private createRail;
111
142
  private ensureRailStructure;
112
143
  private createNavButton;
113
144
  private resolveNavScrollStepPx;
114
145
  private scrollByNavStep;
146
+ private startNavRepeat;
147
+ private clearNavRepeat;
115
148
  private bindRailInteraction;
149
+ private bindAxisRailInteraction;
116
150
  private unmountCustomScrollbar;
151
+ private readViewportHeight;
152
+ private readViewportWidth;
153
+ private pinRailsToViewport;
154
+ private layoutMetricsChanged;
155
+ private markScrolling;
156
+ private endScrolling;
157
+ private clearScrollIdleTimer;
117
158
  private remeasureCustomThumb;
159
+ private remeasureVerticalThumb;
160
+ private remeasureHorizontalThumb;
161
+ private applyVerticalThumbOffset;
162
+ private applyHorizontalThumbOffset;
118
163
  private syncThumbPosition;
119
- /** Move thumb (and scroll position) to the pointer Y on the track. */
164
+ /** Move thumb (and scroll position) to the pointer on the track. */
120
165
  private jumpScrollToTrackPointer;
121
166
  private onThumbPointerDown;
122
167
  private showScrollbar;
@@ -130,9 +175,73 @@ declare class AXOverlayScrollbarDirective {
130
175
  private syncEngagedAfterScroll;
131
176
  private scheduleHide;
132
177
  private clearHideTimer;
133
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXOverlayScrollbarDirective, never>;
134
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXOverlayScrollbarDirective, "[axOverlayScrollbar]", ["axOverlayScrollbar"], { "hideDelay": { "alias": "hideDelay"; "required": false; "isSignal": true; }; "navigationButtons": { "alias": "navigationButtons"; "required": false; "isSignal": true; }; "navScrollStep": { "alias": "navScrollStep"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
135
178
  }
179
+ /**
180
+ * Manual opt-in on a host. With {@link provideOverlayScrollbar} enabled, overflow hosts are attached automatically.
181
+ */
182
+ declare class AXOverlayScrollbarDirective {
183
+ private readonly host;
184
+ private readonly destroyRef;
185
+ private readonly platformId;
186
+ private readonly document;
187
+ private readonly appConfig;
188
+ readonly hideDelay: i0.InputSignal<number>;
189
+ readonly navigationButtons: i0.InputSignal<boolean>;
190
+ readonly navScrollStep: i0.InputSignal<number>;
191
+ readonly enabled: i0.InputSignal<boolean>;
192
+ readonly documentScroll: i0.InputSignal<boolean>;
193
+ private runtime;
194
+ private overlayMounted;
195
+ protected overlayChromeActive(): boolean;
196
+ protected isOverlayEnabled(): boolean;
197
+ constructor();
198
+ private activateOverlay;
199
+ private deactivateOverlay;
200
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXOverlayScrollbarDirective, never>;
201
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AXOverlayScrollbarDirective, "[axOverlayScrollbar]", ["axOverlayScrollbar"], { "hideDelay": { "alias": "hideDelay"; "required": false; "isSignal": true; }; "navigationButtons": { "alias": "navigationButtons"; "required": false; "isSignal": true; }; "navScrollStep": { "alias": "navScrollStep"; "required": false; "isSignal": true; }; "enabled": { "alias": "axOverlayScrollbarEnabled"; "required": false; "isSignal": true; }; "documentScroll": { "alias": "axOverlayScrollbarDocument"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
202
+ }
203
+
204
+ /** Hides native document scrollbars while at least one document-level overlay instance is active. */
205
+ declare function retainOverlayDocumentNativeHide(doc: Document): void;
206
+ declare function releaseOverlayDocumentNativeHide(doc: Document): void;
207
+ /** @internal Tests only. */
208
+ declare function resetOverlayDocumentNativeHideRefCount(): void;
209
+ /** Injects shared overlay scrollbar CSS once; last release removes the style node. */
210
+ declare function retainOverlayScrollbarStyles(doc: Document, cssText: string): void;
211
+ declare function releaseOverlayScrollbarStyles(doc: Document): void;
212
+ /** @internal Tests only. */
213
+ declare function resetOverlayScrollbarStyleRefCount(): void;
214
+
215
+ /**
216
+ * Applies {@link AXOverlayScrollbarDirective} to CDK virtual scroll viewports (lists, lookup, data-list, …).
217
+ * Import {@link AX_OVERLAY_SCROLLBAR_VIRTUAL_SCROLL_IMPORTS} (or this directive) on the owning component.
218
+ */
219
+ declare class AXCdkVirtualScrollViewportOverlayDirective {
220
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXCdkVirtualScrollViewportOverlayDirective, never>;
221
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AXCdkVirtualScrollViewportOverlayDirective, "cdk-virtual-scroll-viewport:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled])", never, {}, {}, never, never, true, [{ directive: typeof AXOverlayScrollbarDirective; inputs: {}; outputs: {}; }]>;
222
+ }
223
+ /**
224
+ * Known internal Acorex scroll panels. Must be imported on the component whose template
225
+ * contains the matching scroll host — class selectors do not apply across unrelated templates.
226
+ */
227
+ declare class AXAcorexOverlayScrollHostDirective {
228
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXAcorexOverlayScrollHostDirective, never>;
229
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AXAcorexOverlayScrollHostDirective, " .ax-popup-body-container:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]), .ax-combo-box-listbox:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]), .ax-tags-scroll:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]), .ax-data-table-wrapper:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]), .ax-lookup-tree:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]), .ax-menu-items:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]), .ax-command-container:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]), .ax-action-list:not([axOverlayScrollbar]):not([axOverlayScrollbarDisabled]) ", never, {}, {}, never, never, true, [{ directive: typeof AXOverlayScrollbarDirective; inputs: {}; outputs: {}; }]>;
230
+ }
231
+ /** CDK scrolling plus automatic overlay scrollbar on virtual viewports. */
232
+ declare const AX_OVERLAY_SCROLLBAR_VIRTUAL_SCROLL_IMPORTS: readonly Type<unknown>[];
233
+ /** Scroll-host bridge directives for Acorex shells (popup, combo, tag-box, …). */
234
+ declare const AX_OVERLAY_SCROLLBAR_ACOREX_SCROLL_HOST_IMPORTS: readonly Type<unknown>[];
235
+
236
+ /**
237
+ * Registers overlay scrollbar application config and attaches overlay scrollbars to overflow hosts.
238
+ *
239
+ * When `enabled` is omitted, it defaults to `true` (opt-in by calling this function).
240
+ * Without this provider, {@link AX_OVERLAY_SCROLLBAR_CONFIG} stays disabled and native scrollbars remain.
241
+ */
242
+ declare function provideOverlayScrollbar(config?: AXPartialOverlayScrollbarConfig): EnvironmentProviders;
243
+ /** Restores `:root` tokens written by {@link provideOverlayScrollbar}. Used in tests and teardown. */
244
+ declare function restoreProvidedOverlayScrollbarDesignTokens(element: HTMLElement): void;
136
245
 
137
246
  /** CSS custom properties for overlay scrollbar styling (set on the scroll host or in CSS). */
138
247
  declare const AX_OVERLAY_SCROLLBAR_CSS_VARS: {
@@ -151,5 +260,5 @@ declare const AX_OVERLAY_SCROLLBAR_CSS_VARS: {
151
260
  readonly fadeDuration: "--ax-comp-overlay-scrollbar-fade-duration";
152
261
  };
153
262
 
154
- export { AXOverlayScrollbarDefaultConfig, AXOverlayScrollbarDirective, AX_OVERLAY_SCROLLBAR_CONFIG, AX_OVERLAY_SCROLLBAR_CSS_VARS, AX_OVERLAY_SCROLLBAR_DEFAULT_HIDE_DELAY_MS, AX_OVERLAY_SCROLLBAR_DEFAULT_NAV_SCROLL_STEP_PX, applyOverlayScrollbarDesignTokens, clampOverlayScrollbarWidth, overlayScrollbarConfig, provideOverlayScrollbar };
155
- export type { AXOverlayScrollbarConfig, AXOverlayScrollbarDesignTokens, AXPartialOverlayScrollbarConfig };
263
+ export { AXAcorexOverlayScrollHostDirective, AXCdkVirtualScrollViewportOverlayDirective, AXOverlayScrollbarAbsentConfig, AXOverlayScrollbarDefaultConfig, AXOverlayScrollbarDirective, AXOverlayScrollbarRuntime, AX_OVERLAY_SCROLLBAR_ACOREX_SCROLL_HOST_IMPORTS, AX_OVERLAY_SCROLLBAR_CONFIG, AX_OVERLAY_SCROLLBAR_CSS_VARS, AX_OVERLAY_SCROLLBAR_DEFAULT_HIDE_DELAY_MS, AX_OVERLAY_SCROLLBAR_DEFAULT_NAV_SCROLL_STEP_PX, AX_OVERLAY_SCROLLBAR_HOST_INIT_ATTR, AX_OVERLAY_SCROLLBAR_VIRTUAL_SCROLL_IMPORTS, applyOverlayScrollbarDesignTokens, clampOverlayScrollbarWidth, overlayScrollbarConfig, provideOverlayScrollbar, releaseOverlayDocumentNativeHide, releaseOverlayScrollbarStyles, resetOverlayDocumentNativeHideRefCount, resetOverlayScrollbarStyleRefCount, restoreOverlayScrollbarDesignTokens, restoreProvidedOverlayScrollbarDesignTokens, retainOverlayDocumentNativeHide, retainOverlayScrollbarStyles };
264
+ export type { AXOverlayScrollbarConfig, AXOverlayScrollbarDesignTokens, AXOverlayScrollbarRuntimeOptions, AXOverlayScrollbarTokenSnapshot, AXPartialOverlayScrollbarConfig };