@acorex/components 22.4.8 → 22.4.9

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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@acorex/components",
3
- "version": "22.4.8",
3
+ "version": "22.4.9",
4
4
  "peerDependencies": {
5
- "@acorex/core": "22.4.8",
6
- "@acorex/cdk": "22.4.8",
5
+ "@acorex/core": "22.4.9",
6
+ "@acorex/cdk": "22.4.9",
7
7
  "@angular/aria": ">=22.1.0",
8
8
  "polytype": ">=0.17.0",
9
9
  "hammerjs": ">=2.0.8",
@@ -2,4 +2,6 @@
2
2
 
3
3
  A lightweight, modular Tiptap wrapper. Project `ax-text-editor-toolbar` and the tools you need; content is created automatically when omitted.
4
4
 
5
- Tiptap packages are loaded lazily at runtime. Use `ax-text-editor-media` for image/video inserts via `AXFileService`, and `ax-text-editor-font-size` for explicit pixel sizes.
5
+ Headless API: `@acorex/cdk/text-editor` (`AXTextEditor`, extensions, commands). The `ax-text-editor` component provides `AXTextEditorService` for toolbar tools.
6
+
7
+ Tiptap packages are loaded lazily at runtime. Use `ax-text-editor-media` for image/video inserts via `AXFileService`, and `ax-text-editor-font-size` for explicit pixel sizes (or token sizes `small` / `large` / `huge` via commands).
@@ -1,8 +1,10 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { OnDestroy } from '@angular/core';
3
- import * as _tiptap_core from '@tiptap/core';
3
+ import * as _acorex_cdk_text_editor from '@acorex/cdk/text-editor';
4
+ import { AXTextEditorCommandType, AXTextEditorCommandAttrs, AXTextEditorTiptapChain, AXTextEditorTiptapEditor, AXTextEditorTiptapJSON, AXTextEditorTiptapContent, AXTextEditorRecentColor } from '@acorex/cdk/text-editor';
4
5
  import * as polytype from 'polytype';
5
6
  import { MXInputBaseValueComponent, MXLookComponent, AXOrientation, AXClickEvent } from '@acorex/cdk/common';
7
+ import * as _tiptap_core from '@tiptap/core';
6
8
 
7
9
  /**
8
10
  * Marker base for projected editor tools and slots.
@@ -10,54 +12,6 @@ import { MXInputBaseValueComponent, MXLookComponent, AXOrientation, AXClickEvent
10
12
  declare abstract class AXTextEditorSlot {
11
13
  }
12
14
 
13
- type AXTextEditorOutputFormat = 'json' | 'html';
14
- type AXTextEditorValue = string | Record<string, unknown> | null;
15
- type AXTextEditorTiptapEditor = _tiptap_core.Editor;
16
- type AXTextEditorTiptapContent = _tiptap_core.Content;
17
- type AXTextEditorTiptapJSON = _tiptap_core.JSONContent;
18
- type AXTextEditorTiptapChain = _tiptap_core.ChainedCommands;
19
- interface AXTextEditorHostBridge {
20
- placeHolder(): string;
21
- outputFormat(): AXTextEditorOutputFormat;
22
- value(): AXTextEditorValue;
23
- disabled(): boolean;
24
- readonly(): boolean;
25
- notifyFocus(event?: FocusEvent): void;
26
- notifyBlur(event?: FocusEvent): void;
27
- notifyValue(value: AXTextEditorValue): void;
28
- }
29
- type AXTextEditorCommandAttrs = Record<string, unknown>;
30
- declare const AX_TEXT_EDITOR_ZOOM_PRESETS: readonly [40, 50, 75, 90, 100, 125, 150, 175, 200];
31
- declare const AX_TEXT_EDITOR_ZOOM_MIN = 40;
32
- declare const AX_TEXT_EDITOR_ZOOM_MAX = 200;
33
- declare const AX_TEXT_EDITOR_FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 72];
34
- type AXTextEditorFontSize = (typeof AX_TEXT_EDITOR_FONT_SIZES)[number];
35
- declare const AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS: string[];
36
- declare const AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS: string[];
37
- interface AXTextEditorRecentColor {
38
- color: string;
39
- kind: 'text' | 'background';
40
- }
41
- 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';
42
- declare module '@tiptap/core' {
43
- interface Commands<ReturnType> {
44
- superscript: {
45
- toggleSuperscript: () => ReturnType;
46
- };
47
- subscript: {
48
- toggleSubscript: () => ReturnType;
49
- };
50
- axTextEditorFontSize: {
51
- setFontSize: (size: string | null) => ReturnType;
52
- };
53
- axTextEditorVideo: {
54
- setVideo: (options: {
55
- src: string;
56
- }) => ReturnType;
57
- };
58
- }
59
- }
60
-
61
15
  declare class AXTextEditorCommandComponent extends AXTextEditorSlot {
62
16
  private readonly editorService;
63
17
  readonly command: _angular_core.InputSignal<AXTextEditorCommandType>;
@@ -73,10 +27,10 @@ declare class AXTextEditorCommandComponent extends AXTextEditorSlot {
73
27
  }
74
28
 
75
29
  declare class AXTextEditorContentComponent extends AXTextEditorSlot implements OnDestroy {
30
+ private readonly textEditor;
76
31
  private readonly editorService;
77
32
  private readonly elementRef;
78
33
  private readonly platformId;
79
- private editor;
80
34
  constructor();
81
35
  private host;
82
36
  ngOnDestroy(): void;
@@ -88,33 +42,41 @@ declare class AXTextEditorContentComponent extends AXTextEditorSlot implements O
88
42
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXTextEditorContentComponent, "ax-text-editor-content", never, {}, {}, never, never, true, never>;
89
43
  }
90
44
 
91
- declare function isTextEditorCommandActive(editor: AXTextEditorTiptapEditor, command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
92
- declare function canRunTextEditorCommand(editor: AXTextEditorTiptapEditor, command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
93
- declare function runTextEditorCommand(editor: AXTextEditorTiptapEditor, command: AXTextEditorCommandType, attrs?: AXTextEditorCommandAttrs): boolean;
45
+ type AXTextEditorOutputFormat = 'json' | 'html';
46
+ type AXTextEditorValue = string | Record<string, unknown> | null;
47
+ interface AXTextEditorHostBridge {
48
+ placeHolder(): string;
49
+ outputFormat(): AXTextEditorOutputFormat;
50
+ value(): AXTextEditorValue;
51
+ disabled(): boolean;
52
+ readonly(): boolean;
53
+ notifyFocus(event?: FocusEvent): void;
54
+ notifyBlur(event?: FocusEvent): void;
55
+ notifyValue(value: AXTextEditorValue): void;
56
+ }
94
57
 
95
58
  /**
96
- * Per-editor Tiptap facade. Provided on `ax-text-editor`, so projected tools and
97
- * custom toolbar children can `inject(AXTextEditorService)` and use either the
98
- * named-command helpers or the full Tiptap instance.
59
+ * Per-editor facade for `ax-text-editor`. Wraps headless {@link AXTextEditor} from `@acorex/cdk/text-editor`.
60
+ * Projected toolbar tools inject this service for commands, selection preservation, and zoom.
99
61
  */
100
62
  declare class AXTextEditorService {
101
- private readonly _editor;
63
+ private readonly core;
102
64
  private host;
103
65
  private preservedRange;
104
- readonly editor: _angular_core.Signal<_tiptap_core.Editor>;
66
+ readonly editor: _angular_core.WritableSignal<_tiptap_core.Editor>;
67
+ readonly state: _angular_core.WritableSignal<_acorex_cdk_text_editor.AXTextEditorState>;
105
68
  readonly version: _angular_core.WritableSignal<number>;
106
69
  readonly disabled: _angular_core.WritableSignal<boolean>;
107
70
  readonly readonly: _angular_core.WritableSignal<boolean>;
108
71
  readonly editable: _angular_core.Signal<boolean>;
109
- readonly textColor: _angular_core.WritableSignal<string>;
110
- readonly highlightColor: _angular_core.WritableSignal<string>;
111
- readonly fontSize: _angular_core.WritableSignal<string>;
72
+ readonly textColor: _angular_core.Signal<string>;
73
+ readonly highlightColor: _angular_core.Signal<string>;
74
+ readonly fontSize: _angular_core.Signal<string>;
112
75
  readonly zoom: _angular_core.WritableSignal<number>;
113
76
  readonly zoomFactor: _angular_core.Signal<number>;
114
77
  bindHost(host: AXTextEditorHostBridge): void;
115
78
  syncHostState(): void;
116
79
  getHost(): AXTextEditorHostBridge | null;
117
- setEditor(editor: AXTextEditorTiptapEditor | null): void;
118
80
  refresh(): void;
119
81
  chain(): AXTextEditorTiptapChain | null;
120
82
  get commands(): AXTextEditorTiptapEditor['commands'] | undefined;
@@ -139,6 +101,7 @@ declare class AXTextEditorService {
139
101
  isFocused(): boolean;
140
102
  isEditable(): boolean;
141
103
  setEditable(editable: boolean): void;
104
+ destroyEditor(): void;
142
105
  setZoom(value: number): void;
143
106
  zoomIn(step?: number): void;
144
107
  zoomOut(step?: number): void;
@@ -179,9 +142,6 @@ declare class AXTextEditorComponent extends AXTextEditorComponent_base {
179
142
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXTextEditorComponent, "ax-text-editor", never, { "disabled": { "alias": "disabled"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "value": { "alias": "value"; "required": false; }; "state": { "alias": "state"; "required": false; }; "name": { "alias": "name"; "required": false; }; "look": { "alias": "look"; "required": false; }; "placeHolder": { "alias": "placeHolder"; "required": false; "isSignal": true; }; "outputFormat": { "alias": "outputFormat"; "required": false; "isSignal": true; }; "initialLine": { "alias": "initialLine"; "required": false; "isSignal": true; }; }, { "onBlur": "onBlur"; "onFocus": "onFocus"; "valueChange": "valueChange"; "stateChange": "stateChange"; "onValueChanged": "onValueChanged"; "readonlyChange": "readonlyChange"; "disabledChange": "disabledChange"; }, ["projected"], ["*", "ax-validation-rule"], true, never>;
180
143
  }
181
144
 
182
- type AXTextEditorExtension = _tiptap_core.Extension;
183
- declare function createTextEditorExtensions(placeholder?: string | (() => string)): Promise<AXTextEditorExtension[]>;
184
-
185
145
  declare const AX_TEXT_EDITOR_I18N: {
186
146
  readonly placeholder: "@acorex:text-editor.placeholder";
187
147
  readonly tools: {
@@ -1265,5 +1225,5 @@ declare class AXTextEditorModule {
1265
1225
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<AXTextEditorModule>;
1266
1226
  }
1267
1227
 
1268
- export { AXTextEditorAlignmentComponent, AXTextEditorBlocksComponent, AXTextEditorColorSwatchesComponent, AXTextEditorColorsComponent, AXTextEditorCommandComponent, AXTextEditorComponent, AXTextEditorContentComponent, AXTextEditorFontSizeComponent, AXTextEditorFontStyleComponent, AXTextEditorHeadingComponent, AXTextEditorHistoryComponent, AXTextEditorLinkComponent, AXTextEditorListComponent, AXTextEditorMediaComponent, AXTextEditorModule, AXTextEditorScriptComponent, AXTextEditorService, AXTextEditorSlot, AXTextEditorTableComponent, AXTextEditorToolbarComponent, AXTextEditorZoomComponent, AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS, AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS, AX_TEXT_EDITOR_FONT_SIZES, AX_TEXT_EDITOR_I18N, AX_TEXT_EDITOR_ZOOM_MAX, AX_TEXT_EDITOR_ZOOM_MIN, AX_TEXT_EDITOR_ZOOM_PRESETS, canRunTextEditorCommand, createTextEditorExtensions, isTextEditorCommandActive, runTextEditorCommand };
1269
- export type { AXTextEditorCommandAttrs, AXTextEditorCommandType, AXTextEditorFontSize, AXTextEditorHostBridge, AXTextEditorOutputFormat, AXTextEditorRecentColor, AXTextEditorTiptapChain, AXTextEditorTiptapContent, AXTextEditorTiptapEditor, AXTextEditorTiptapJSON, AXTextEditorValue };
1228
+ export { AXTextEditorAlignmentComponent, AXTextEditorBlocksComponent, AXTextEditorColorSwatchesComponent, AXTextEditorColorsComponent, AXTextEditorCommandComponent, AXTextEditorComponent, AXTextEditorContentComponent, AXTextEditorFontSizeComponent, AXTextEditorFontStyleComponent, AXTextEditorHeadingComponent, AXTextEditorHistoryComponent, AXTextEditorLinkComponent, AXTextEditorListComponent, AXTextEditorMediaComponent, AXTextEditorModule, AXTextEditorScriptComponent, AXTextEditorService, AXTextEditorSlot, AXTextEditorTableComponent, AXTextEditorToolbarComponent, AXTextEditorZoomComponent, AX_TEXT_EDITOR_I18N };
1229
+ export type { AXTextEditorHostBridge, AXTextEditorOutputFormat, AXTextEditorValue };