@acorex/cdk 22.4.45 → 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.
- package/fesm2022/acorex-cdk-outline.mjs +21 -11
- package/fesm2022/acorex-cdk-outline.mjs.map +1 -1
- package/fesm2022/acorex-cdk-overlay-scrollbar.mjs +1237 -329
- package/fesm2022/acorex-cdk-overlay-scrollbar.mjs.map +1 -1
- package/fesm2022/acorex-cdk-text-editor.mjs +631 -2
- package/fesm2022/acorex-cdk-text-editor.mjs.map +1 -1
- package/overlay-scrollbar/README.md +31 -31
- package/package.json +2 -2
- package/types/acorex-cdk-outline.d.ts +1 -0
- package/types/acorex-cdk-overlay-scrollbar.d.ts +157 -48
- package/types/acorex-cdk-text-editor.d.ts +98 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
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
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
*
|
|
72
|
-
*
|
|
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
|
|
75
|
-
private readonly
|
|
76
|
-
private readonly destroyRef;
|
|
77
|
-
private readonly platformId;
|
|
74
|
+
declare class AXOverlayScrollbarRuntime {
|
|
75
|
+
private readonly hostEl;
|
|
78
76
|
private readonly document;
|
|
79
|
-
private readonly
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 };
|
|
@@ -23,7 +23,7 @@ interface AXTextEditorRecentColor {
|
|
|
23
23
|
color: string;
|
|
24
24
|
kind: 'text' | 'background';
|
|
25
25
|
}
|
|
26
|
-
type AXTextEditorCommandType = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strike' | 'heading' | 'paragraph' | 'align' | 'direction' | 'color' | 'highlight' | 'fontSize' | 'bulletList' | 'orderedList' | 'superscript' | 'subscript' | 'link' | 'unlink' | 'blockquote' | 'code' | 'codeBlock' | 'horizontalRule' | 'image' | 'video' | 'insertTable' | 'addColumnBefore' | 'addColumnAfter' | 'deleteColumn' | 'addRowBefore' | 'addRowAfter' | 'deleteRow' | 'toggleHeaderRow' | 'deleteTable';
|
|
26
|
+
type AXTextEditorCommandType = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strike' | 'spoiler' | 'heading' | 'paragraph' | 'align' | 'direction' | 'color' | 'highlight' | 'fontSize' | 'bulletList' | 'orderedList' | 'superscript' | 'subscript' | 'link' | 'unlink' | 'blockquote' | 'code' | 'codeBlock' | 'horizontalRule' | 'image' | 'video' | 'insertTable' | 'addColumnBefore' | 'addColumnAfter' | 'deleteColumn' | 'addRowBefore' | 'addRowAfter' | 'deleteRow' | 'toggleHeaderRow' | 'deleteTable';
|
|
27
27
|
interface AXTextEditorFeatures {
|
|
28
28
|
table?: boolean;
|
|
29
29
|
image?: boolean;
|
|
@@ -34,17 +34,75 @@ interface AXTextEditorFeatures {
|
|
|
34
34
|
placeholder?: boolean;
|
|
35
35
|
}
|
|
36
36
|
declare const AX_DEFAULT_TEXT_EDITOR_FEATURES: AXTextEditorFeatures;
|
|
37
|
+
/** A person or record offered by the mention suggestion. */
|
|
38
|
+
interface AXTextEditorMentionItem {
|
|
39
|
+
id: string;
|
|
40
|
+
label: string;
|
|
41
|
+
/** HTTP(S), blob, data-image, or root-relative URL. */
|
|
42
|
+
avatar?: string;
|
|
43
|
+
/** Optional icon class used by a custom avatar template. */
|
|
44
|
+
icon?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Draws a mention portrait into `host`. Return a function that removes that view. */
|
|
47
|
+
type AXTextEditorMentionAvatarRenderer = (host: HTMLElement, item: AXTextEditorMentionItem) => void | (() => void);
|
|
48
|
+
interface AXTextEditorMentionRect {
|
|
49
|
+
top: number;
|
|
50
|
+
left: number;
|
|
51
|
+
right: number;
|
|
52
|
+
bottom: number;
|
|
53
|
+
}
|
|
54
|
+
/** Active @-query. `null` means the picker is closed. */
|
|
55
|
+
interface AXTextEditorMentionSuggestion {
|
|
56
|
+
query: string;
|
|
57
|
+
items: readonly AXTextEditorMentionItem[];
|
|
58
|
+
index: number;
|
|
59
|
+
loading: boolean;
|
|
60
|
+
rect: AXTextEditorMentionRect | null;
|
|
61
|
+
}
|
|
62
|
+
/** Runtime source. `items` receives the text typed after the trigger and may resolve later. */
|
|
63
|
+
interface AXTextEditorMentionConfig {
|
|
64
|
+
/** Trigger character. Defaults to `@`. */
|
|
65
|
+
char?: string;
|
|
66
|
+
/** Maximum rows shown. Defaults to 8. */
|
|
67
|
+
limit?: number;
|
|
68
|
+
items: (query: string) => readonly AXTextEditorMentionItem[] | Promise<readonly AXTextEditorMentionItem[]>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Value of the `mentions` input.
|
|
72
|
+
* An array is filtered locally by label and id. A function replaces that filter.
|
|
73
|
+
* An options object sets the trigger character and limit.
|
|
74
|
+
*/
|
|
75
|
+
type AXTextEditorMentionInput = readonly AXTextEditorMentionItem[] | AXTextEditorMentionConfig['items'] | {
|
|
76
|
+
char?: string;
|
|
77
|
+
limit?: number;
|
|
78
|
+
items: readonly AXTextEditorMentionItem[] | AXTextEditorMentionConfig['items'];
|
|
79
|
+
};
|
|
80
|
+
interface AXTextEditorMentionActions {
|
|
81
|
+
apply(item: AXTextEditorMentionItem): void;
|
|
82
|
+
setIndex(index: number): void;
|
|
83
|
+
refresh(): void;
|
|
84
|
+
dismiss(): void;
|
|
85
|
+
}
|
|
86
|
+
/** Bridge between the mention plugin and the editor shell. */
|
|
87
|
+
interface AXTextEditorMentionController {
|
|
88
|
+
getSource(): AXTextEditorMentionConfig | null;
|
|
89
|
+
publish(suggestion: AXTextEditorMentionSuggestion | null): void;
|
|
90
|
+
bind(actions: AXTextEditorMentionActions): void;
|
|
91
|
+
renderMentionAvatar?(host: HTMLElement, item: AXTextEditorMentionItem): void | (() => void);
|
|
92
|
+
}
|
|
37
93
|
interface AXTextEditorLoadExtensionsOptions {
|
|
38
94
|
placeholder?: string | (() => string);
|
|
39
95
|
features?: AXTextEditorFeatures;
|
|
40
96
|
headingLevels?: AXTextEditorHeadingLevel[];
|
|
41
97
|
extensions?: Extensions;
|
|
98
|
+
mentions?: AXTextEditorMentionController;
|
|
42
99
|
}
|
|
43
100
|
interface AXTextEditorState {
|
|
44
101
|
bold: boolean;
|
|
45
102
|
italic: boolean;
|
|
46
103
|
underline: boolean;
|
|
47
104
|
strike: boolean;
|
|
105
|
+
spoiler: boolean;
|
|
48
106
|
code: boolean;
|
|
49
107
|
codeBlock: boolean;
|
|
50
108
|
headingLevel: AXTextEditorHeadingLevel | null;
|
|
@@ -73,6 +131,8 @@ interface AXTextEditorInitOptions {
|
|
|
73
131
|
features?: AXTextEditorFeatures;
|
|
74
132
|
headingLevels?: AXTextEditorHeadingLevel[];
|
|
75
133
|
extensions?: Extensions;
|
|
134
|
+
/** Enter starts the next block without the inline marks active at the caret. */
|
|
135
|
+
exitMarksOnEnter?: boolean;
|
|
76
136
|
editorProps?: _tiptap_core.EditorOptions['editorProps'];
|
|
77
137
|
/** @deprecated Use `editable: false` instead. */
|
|
78
138
|
readOnly?: boolean;
|
|
@@ -90,6 +150,9 @@ declare module '@tiptap/core' {
|
|
|
90
150
|
subscript: {
|
|
91
151
|
toggleSubscript: () => ReturnType;
|
|
92
152
|
};
|
|
153
|
+
spoiler: {
|
|
154
|
+
toggleSpoiler: () => ReturnType;
|
|
155
|
+
};
|
|
93
156
|
axTextEditorFontSize: {
|
|
94
157
|
setFontSize: (size: string | null) => ReturnType;
|
|
95
158
|
};
|
|
@@ -101,12 +164,17 @@ declare module '@tiptap/core' {
|
|
|
101
164
|
}
|
|
102
165
|
}
|
|
103
166
|
|
|
104
|
-
declare class AXTextEditor {
|
|
167
|
+
declare class AXTextEditor implements AXTextEditorMentionController {
|
|
105
168
|
readonly editor: _angular_core.WritableSignal<_tiptap_core.Editor>;
|
|
106
169
|
readonly state: _angular_core.WritableSignal<AXTextEditorState>;
|
|
107
170
|
readonly ready: _angular_core.WritableSignal<boolean>;
|
|
108
171
|
readonly version: _angular_core.WritableSignal<number>;
|
|
172
|
+
readonly mentionSuggestion: _angular_core.WritableSignal<AXTextEditorMentionSuggestion>;
|
|
109
173
|
private readonly platformId;
|
|
174
|
+
private readonly zone;
|
|
175
|
+
private mentionSource;
|
|
176
|
+
private mentionActions;
|
|
177
|
+
private mentionAvatarRenderer;
|
|
110
178
|
private destroyed;
|
|
111
179
|
private applyingContent;
|
|
112
180
|
init(container: HTMLElement | string, options?: AXTextEditorInitOptions): Promise<void>;
|
|
@@ -132,6 +200,8 @@ declare class AXTextEditor {
|
|
|
132
200
|
private commandsApi;
|
|
133
201
|
private getCommandsApi;
|
|
134
202
|
insertContent(value: AXTextEditorTiptapContent): boolean;
|
|
203
|
+
/** Inserts a `<br>` and keeps the inline marks that were active at the caret. */
|
|
204
|
+
insertHardBreak(): boolean;
|
|
135
205
|
clearContent(): boolean;
|
|
136
206
|
insertImage(src: string, alt?: string): void;
|
|
137
207
|
insertVideo(src: string): void;
|
|
@@ -141,6 +211,17 @@ declare class AXTextEditor {
|
|
|
141
211
|
toggleHeading(level: AXTextEditorHeadingLevel): void;
|
|
142
212
|
setTextAlign(align: AXTextEditorTextAlign): void;
|
|
143
213
|
setTextDirection(direction: AXTextEditorTextDirection): void;
|
|
214
|
+
/** Replaces the mention source. Pass `null` to close the picker and ignore `@`. */
|
|
215
|
+
setMentionSource(source: AXTextEditorMentionConfig | null): void;
|
|
216
|
+
selectMention(item: AXTextEditorMentionItem): void;
|
|
217
|
+
setMentionIndex(index: number): void;
|
|
218
|
+
dismissMention(): void;
|
|
219
|
+
/** Replaces the portrait drawn inside mention chips. Pass `null` for the built-in image. */
|
|
220
|
+
setMentionAvatarRenderer(renderer: AXTextEditorMentionAvatarRenderer | null): void;
|
|
221
|
+
renderMentionAvatar(host: HTMLElement, item: AXTextEditorMentionItem): void | (() => void);
|
|
222
|
+
getSource(): AXTextEditorMentionConfig | null;
|
|
223
|
+
publish(suggestion: AXTextEditorMentionSuggestion | null): void;
|
|
224
|
+
bind(actions: AXTextEditorMentionActions): void;
|
|
144
225
|
private refreshState;
|
|
145
226
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXTextEditor, never>;
|
|
146
227
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
|
|
@@ -152,5 +233,18 @@ declare function runTextEditorCommand(editor: AXTextEditorTiptapEditor, command:
|
|
|
152
233
|
|
|
153
234
|
declare function createTextEditorExtensions(placeholderOrOptions?: string | (() => string) | AXTextEditorLoadExtensionsOptions): Promise<_tiptap_core.AnyExtension[]>;
|
|
154
235
|
|
|
155
|
-
|
|
156
|
-
|
|
236
|
+
/** Text before the caret. `start` is the index of the trigger inside `text`. */
|
|
237
|
+
declare function findTextEditorMentionQuery(text: string, char?: string): {
|
|
238
|
+
start: number;
|
|
239
|
+
query: string;
|
|
240
|
+
} | null;
|
|
241
|
+
/** Local filter used when `mentions` is an array. */
|
|
242
|
+
declare function filterTextEditorMentionItems(items: readonly AXTextEditorMentionItem[], query: string, limit?: number): AXTextEditorMentionItem[];
|
|
243
|
+
/** Normalizes the `mentions` input into a suggestion source. `null` disables the picker. */
|
|
244
|
+
declare function resolveTextEditorMentions(source: AXTextEditorMentionInput | null | undefined): AXTextEditorMentionConfig | null;
|
|
245
|
+
/** Keeps only URLs that are safe to put in an `<img src>`. */
|
|
246
|
+
declare function textEditorMentionAvatar(value: string | null | undefined): string | null;
|
|
247
|
+
declare function mentionSuggestionsEqual(left: AXTextEditorMentionSuggestion | null, right: AXTextEditorMentionSuggestion | null): boolean;
|
|
248
|
+
|
|
249
|
+
export { AXTextEditor, AX_DEFAULT_TEXT_EDITOR_FEATURES, AX_EMPTY_TEXT_EDITOR_STATE, AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS, AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS, AX_TEXT_EDITOR_FONT_SIZES, AX_TEXT_EDITOR_FONT_SIZE_TOKEN_VALUES, AX_TEXT_EDITOR_ZOOM_MAX, AX_TEXT_EDITOR_ZOOM_MIN, AX_TEXT_EDITOR_ZOOM_PRESETS, canRunTextEditorCommand, createTextEditorExtensions, filterTextEditorMentionItems, findTextEditorMentionQuery, isTextEditorCommandActive, mentionSuggestionsEqual, resolveTextEditorMentions, runTextEditorCommand, textEditorMentionAvatar };
|
|
250
|
+
export type { AXTextEditorCommandAttrs, AXTextEditorCommandType, AXTextEditorFeatures, AXTextEditorFontSize, AXTextEditorFontSizeToken, AXTextEditorHeadingLevel, AXTextEditorInitOptions, AXTextEditorLoadExtensionsOptions, AXTextEditorMentionActions, AXTextEditorMentionAvatarRenderer, AXTextEditorMentionConfig, AXTextEditorMentionController, AXTextEditorMentionInput, AXTextEditorMentionItem, AXTextEditorMentionRect, AXTextEditorMentionSuggestion, AXTextEditorRecentColor, AXTextEditorState, AXTextEditorTextAlign, AXTextEditorTextDirection, AXTextEditorTiptapChain, AXTextEditorTiptapContent, AXTextEditorTiptapEditor, AXTextEditorTiptapJSON };
|