@acorex/cdk 22.2.0-next.0 → 22.2.0-next.1

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,155 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, EnvironmentProviders } from '@angular/core';
3
+
4
+ /** Default delay (ms) before the overlay scrollbar fades out after scroll. */
5
+ declare const AX_OVERLAY_SCROLLBAR_DEFAULT_HIDE_DELAY_MS = 800;
6
+ /** Default pixels scrolled per navigation arrow click. */
7
+ declare const AX_OVERLAY_SCROLLBAR_DEFAULT_NAV_SCROLL_STEP_PX = 40;
8
+ /**
9
+ * Visual tokens for overlay scrollbars (`--ax-comp-overlay-scrollbar-*`).
10
+ * Values are applied to `:root` when using {@link provideOverlayScrollbar}, and inherited by scroll hosts.
11
+ */
12
+ interface AXOverlayScrollbarDesignTokens {
13
+ size?: string;
14
+ thumbRadius?: string;
15
+ trackRadius?: string;
16
+ trackColor?: string;
17
+ thumbColor?: string;
18
+ thumbActiveColor?: string;
19
+ thumbHoverColor?: string;
20
+ trackActiveColor?: string;
21
+ thumbBorderWidth?: string;
22
+ thumbBorderColor?: string;
23
+ trackBorderWidth?: string;
24
+ trackBorderColor?: string;
25
+ fadeDuration?: string;
26
+ }
27
+ /** Application-wide defaults for {@link AXOverlayScrollbarDirective}. */
28
+ interface AXOverlayScrollbarConfig {
29
+ /** Milliseconds before the scrollbar rail fades out after scrolling stops. */
30
+ hideDelay: number;
31
+ /** When true, shows up/down arrow buttons on the scrollbar rail. */
32
+ navigationButtons: boolean;
33
+ /** Pixels to scroll per navigation arrow click. */
34
+ navScrollStep: number;
35
+ /** Optional global design tokens (CSS custom properties). */
36
+ designTokens?: AXOverlayScrollbarDesignTokens;
37
+ }
38
+ declare const AXOverlayScrollbarDefaultConfig: AXOverlayScrollbarConfig;
39
+ type AXPartialOverlayScrollbarConfig = Partial<AXOverlayScrollbarConfig> & {
40
+ designTokens?: Partial<AXOverlayScrollbarDesignTokens>;
41
+ };
42
+ declare const AX_OVERLAY_SCROLLBAR_CONFIG: InjectionToken<AXOverlayScrollbarConfig>;
43
+ /** Merges partial config with {@link AXOverlayScrollbarDefaultConfig}. */
44
+ 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;
68
+
69
+ declare function clampOverlayScrollbarWidth(px: number): number;
70
+ /**
71
+ * Custom overlay scrollbar: native scrollbars are hidden; a positioned thumb reflects scroll position.
72
+ * Styles are injected once by this directive.
73
+ */
74
+ declare class AXOverlayScrollbarDirective {
75
+ private readonly host;
76
+ private readonly destroyRef;
77
+ private readonly platformId;
78
+ private readonly document;
79
+ private readonly appConfig;
80
+ private rootEl;
81
+ private railEl;
82
+ private trackEl;
83
+ private navUpEl;
84
+ private navDownEl;
85
+ private thumbEl;
86
+ private resizeObserver;
87
+ private designTokenMutationObserver;
88
+ private designTokenSyncFrame;
89
+ private thumbDragPointerId;
90
+ private pointerOverRail;
91
+ private trackPressReleaseListener;
92
+ private unbindRailInteraction;
93
+ /** Thumb size derived from layout; position updates on scroll without re-measuring scrollHeight. */
94
+ 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>;
103
+ private hideTimer;
104
+ constructor();
105
+ /** Host and rail are siblings under the root; mirror CSS variables when the host style/class changes. */
106
+ private observeHostDesignTokenChanges;
107
+ private queueDesignTokenSync;
108
+ /** Rail lives on a wrapper so it stays fixed while the host scrolls. */
109
+ private ensureScrollRoot;
110
+ private mountCustomScrollbar;
111
+ private ensureRailStructure;
112
+ private createNavButton;
113
+ private resolveNavScrollStepPx;
114
+ private scrollByNavStep;
115
+ private bindRailInteraction;
116
+ private unmountCustomScrollbar;
117
+ private remeasureCustomThumb;
118
+ private syncThumbPosition;
119
+ /** Move thumb (and scroll position) to the pointer Y on the track. */
120
+ private jumpScrollToTrackPointer;
121
+ private onThumbPointerDown;
122
+ private showScrollbar;
123
+ private bumpVisibility;
124
+ private deactivateThumb;
125
+ private setScrollbarEngaged;
126
+ private setTrackPressed;
127
+ private isPointerOverThumbVisual;
128
+ private beginTrackPressed;
129
+ private clearTrackPressed;
130
+ private syncEngagedAfterScroll;
131
+ private scheduleHide;
132
+ 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
+ }
136
+
137
+ /** CSS custom properties for overlay scrollbar styling (set on the scroll host or in CSS). */
138
+ declare const AX_OVERLAY_SCROLLBAR_CSS_VARS: {
139
+ readonly size: "--ax-comp-overlay-scrollbar-size";
140
+ readonly thumbRadius: "--ax-comp-overlay-scrollbar-thumb-radius";
141
+ readonly trackRadius: "--ax-comp-overlay-scrollbar-track-radius";
142
+ readonly trackColor: "--ax-comp-overlay-scrollbar-track-color";
143
+ readonly thumbColor: "--ax-comp-overlay-scrollbar-thumb-color";
144
+ readonly thumbActiveColor: "--ax-comp-overlay-scrollbar-thumb-active-color";
145
+ readonly thumbHoverColor: "--ax-comp-overlay-scrollbar-thumb-hover-color";
146
+ readonly trackActiveColor: "--ax-comp-overlay-scrollbar-track-active-color";
147
+ readonly thumbBorderWidth: "--ax-comp-overlay-scrollbar-thumb-border-width";
148
+ readonly thumbBorderColor: "--ax-comp-overlay-scrollbar-thumb-border-color";
149
+ readonly trackBorderWidth: "--ax-comp-overlay-scrollbar-track-border-width";
150
+ readonly trackBorderColor: "--ax-comp-overlay-scrollbar-track-border-color";
151
+ readonly fadeDuration: "--ax-comp-overlay-scrollbar-fade-duration";
152
+ };
153
+
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 };
@@ -0,0 +1,156 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import * as _tiptap_core from '@tiptap/core';
3
+ import { Content, Extensions, Editor, JSONContent } from '@tiptap/core';
4
+
5
+ type AXTextEditorTiptapEditor = Editor;
6
+ type AXTextEditorTiptapContent = Content;
7
+ type AXTextEditorTiptapJSON = JSONContent;
8
+ type AXTextEditorTiptapChain = ReturnType<Editor['chain']>;
9
+ type AXTextEditorHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
10
+ type AXTextEditorTextAlign = 'left' | 'center' | 'right' | 'justify';
11
+ type AXTextEditorTextDirection = 'rtl' | 'ltr';
12
+ type AXTextEditorFontSizeToken = 'small' | 'large' | 'huge';
13
+ declare const AX_TEXT_EDITOR_FONT_SIZE_TOKEN_VALUES: Record<AXTextEditorFontSizeToken, string>;
14
+ type AXTextEditorCommandAttrs = Record<string, unknown>;
15
+ declare const AX_TEXT_EDITOR_ZOOM_PRESETS: readonly [40, 50, 75, 90, 100, 125, 150, 175, 200];
16
+ declare const AX_TEXT_EDITOR_ZOOM_MIN = 40;
17
+ declare const AX_TEXT_EDITOR_ZOOM_MAX = 200;
18
+ declare const AX_TEXT_EDITOR_FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 72];
19
+ type AXTextEditorFontSize = (typeof AX_TEXT_EDITOR_FONT_SIZES)[number];
20
+ declare const AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS: string[];
21
+ declare const AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS: string[];
22
+ interface AXTextEditorRecentColor {
23
+ color: string;
24
+ kind: 'text' | 'background';
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';
27
+ interface AXTextEditorFeatures {
28
+ table?: boolean;
29
+ image?: boolean;
30
+ video?: boolean;
31
+ superscript?: boolean;
32
+ subscript?: boolean;
33
+ keepSelection?: boolean;
34
+ placeholder?: boolean;
35
+ }
36
+ declare const AX_DEFAULT_TEXT_EDITOR_FEATURES: AXTextEditorFeatures;
37
+ interface AXTextEditorLoadExtensionsOptions {
38
+ placeholder?: string | (() => string);
39
+ features?: AXTextEditorFeatures;
40
+ headingLevels?: AXTextEditorHeadingLevel[];
41
+ extensions?: Extensions;
42
+ }
43
+ interface AXTextEditorState {
44
+ bold: boolean;
45
+ italic: boolean;
46
+ underline: boolean;
47
+ strike: boolean;
48
+ code: boolean;
49
+ codeBlock: boolean;
50
+ headingLevel: AXTextEditorHeadingLevel | null;
51
+ bulletList: boolean;
52
+ orderedList: boolean;
53
+ blockquote: boolean;
54
+ superscript: boolean;
55
+ subscript: boolean;
56
+ textAlign: AXTextEditorTextAlign | null;
57
+ textColor: string | null;
58
+ highlightColor: string | null;
59
+ linkHref: string | null;
60
+ fontSize: string | null;
61
+ textDirection: AXTextEditorTextDirection | null;
62
+ table: boolean;
63
+ canUndo: boolean;
64
+ canRedo: boolean;
65
+ isEmpty: boolean;
66
+ isFocused: boolean;
67
+ }
68
+ declare const AX_EMPTY_TEXT_EDITOR_STATE: AXTextEditorState;
69
+ interface AXTextEditorInitOptions {
70
+ content?: AXTextEditorTiptapContent;
71
+ editable?: boolean;
72
+ placeholder?: string | (() => string);
73
+ features?: AXTextEditorFeatures;
74
+ headingLevels?: AXTextEditorHeadingLevel[];
75
+ extensions?: Extensions;
76
+ editorProps?: _tiptap_core.EditorOptions['editorProps'];
77
+ /** @deprecated Use `editable: false` instead. */
78
+ readOnly?: boolean;
79
+ onUpdate?: (editor: AXTextEditorTiptapEditor) => void;
80
+ onFocus?: (editor: AXTextEditorTiptapEditor, event?: FocusEvent) => void;
81
+ onBlur?: (editor: AXTextEditorTiptapEditor, event?: FocusEvent) => void;
82
+ onSelectionUpdate?: (editor: AXTextEditorTiptapEditor) => void;
83
+ onTransaction?: (editor: AXTextEditorTiptapEditor) => void;
84
+ }
85
+ declare module '@tiptap/core' {
86
+ interface Commands<ReturnType> {
87
+ superscript: {
88
+ toggleSuperscript: () => ReturnType;
89
+ };
90
+ subscript: {
91
+ toggleSubscript: () => ReturnType;
92
+ };
93
+ axTextEditorFontSize: {
94
+ setFontSize: (size: string | null) => ReturnType;
95
+ };
96
+ axTextEditorVideo: {
97
+ setVideo: (options: {
98
+ src: string;
99
+ }) => ReturnType;
100
+ };
101
+ }
102
+ }
103
+
104
+ declare class AXTextEditor {
105
+ readonly editor: _angular_core.WritableSignal<_tiptap_core.Editor>;
106
+ readonly state: _angular_core.WritableSignal<AXTextEditorState>;
107
+ readonly ready: _angular_core.WritableSignal<boolean>;
108
+ readonly version: _angular_core.WritableSignal<number>;
109
+ private readonly platformId;
110
+ private destroyed;
111
+ private applyingContent;
112
+ init(container: HTMLElement | string, options?: AXTextEditorInitOptions): Promise<void>;
113
+ destroy(): void;
114
+ refresh(): void;
115
+ setContent(value: AXTextEditorTiptapContent | null | undefined, emit?: boolean): void;
116
+ getHTML(): string;
117
+ getJSON(): AXTextEditorTiptapJSON | null;
118
+ getText(options?: {
119
+ blockSeparator?: string;
120
+ }): string;
121
+ isEmpty(): boolean;
122
+ isFocused(): boolean;
123
+ isEditable(): boolean;
124
+ setEditable(editable: boolean): void;
125
+ focus(): void;
126
+ blur(): void;
127
+ chain(): AXTextEditorTiptapChain | null;
128
+ get commands(): AXTextEditorTiptapEditor['commands'] | undefined;
129
+ isActive(command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
130
+ can(command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
131
+ run(command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
132
+ private commandsApi;
133
+ private getCommandsApi;
134
+ insertContent(value: AXTextEditorTiptapContent): boolean;
135
+ clearContent(): boolean;
136
+ insertImage(src: string, alt?: string): void;
137
+ insertVideo(src: string): void;
138
+ setLink(href: string): void;
139
+ unsetLink(): void;
140
+ clearFormatting(): void;
141
+ toggleHeading(level: AXTextEditorHeadingLevel): void;
142
+ setTextAlign(align: AXTextEditorTextAlign): void;
143
+ setTextDirection(direction: AXTextEditorTextDirection): void;
144
+ private refreshState;
145
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXTextEditor, never>;
146
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
147
+ }
148
+
149
+ declare function isTextEditorCommandActive(editor: AXTextEditorTiptapEditor, command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
150
+ declare function canRunTextEditorCommand(editor: AXTextEditorTiptapEditor, command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
151
+ declare function runTextEditorCommand(editor: AXTextEditorTiptapEditor, command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
152
+
153
+ declare function createTextEditorExtensions(placeholderOrOptions?: string | (() => string) | AXTextEditorLoadExtensionsOptions): Promise<_tiptap_core.AnyExtension[]>;
154
+
155
+ 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, isTextEditorCommandActive, runTextEditorCommand };
156
+ export type { AXTextEditorCommandAttrs, AXTextEditorCommandType, AXTextEditorFeatures, AXTextEditorFontSize, AXTextEditorFontSizeToken, AXTextEditorHeadingLevel, AXTextEditorInitOptions, AXTextEditorLoadExtensionsOptions, AXTextEditorRecentColor, AXTextEditorState, AXTextEditorTextAlign, AXTextEditorTextDirection, AXTextEditorTiptapChain, AXTextEditorTiptapContent, AXTextEditorTiptapEditor, AXTextEditorTiptapJSON };
@@ -64,6 +64,9 @@ interface AXWysiwygLoadExtensionsOptions {
64
64
  placeholder?: string;
65
65
  }
66
66
 
67
+ /**
68
+ * @deprecated Use `AXTextEditor` from `@acorex/cdk/text-editor` instead.
69
+ */
67
70
  declare class AXWysiwyg {
68
71
  readonly editor: _angular_core.WritableSignal<Editor>;
69
72
  readonly state: _angular_core.WritableSignal<AXWysiwygState>;