@domternal/angular 0.14.0 → 1.0.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.
@@ -2,7 +2,7 @@ import * as _angular_core from '@angular/core';
2
2
  import { OnDestroy, ElementRef } from '@angular/core';
3
3
  import { ControlValueAccessor } from '@angular/forms';
4
4
  import * as _domternal_core from '@domternal/core';
5
- import { AnyExtension, Content, FocusPosition, Editor, JSONContent, IconSet, ToolbarLayoutEntry, ToolbarGroup, ToolbarDropdown, ToolbarButton, ToolbarItem, FloatingMenuItemsOverride, FloatingMenuKeymap, FloatingMenuItem } from '@domternal/core';
5
+ import { AnyExtension, Content, EditorPreset, FocusPosition, Editor, JSONContent, IconSet, ToolbarLayoutEntry, ToolbarGroup, ToolbarDropdown, ToolbarButton, ToolbarItem, BubbleContexts, BubbleMenuItem, FloatingMenuItemsOverride, FloatingMenuKeymap, FloatingMenuItem } from '@domternal/core';
6
6
  export { AnyExtension, Content, Editor, FocusPosition, JSONContent } from '@domternal/core';
7
7
  import { SafeHtml } from '@angular/platform-browser';
8
8
  import * as prosemirror_state from 'prosemirror-state';
@@ -19,6 +19,12 @@ declare class DomternalEditorComponent implements ControlValueAccessor, OnDestro
19
19
  readonly history: _angular_core.InputSignal<boolean>;
20
20
  readonly content: _angular_core.InputSignal<Content>;
21
21
  readonly editable: _angular_core.InputSignal<boolean>;
22
+ /**
23
+ * Editing experience preset. `'notion'` paints `dm-notion-mode` on this
24
+ * component's host and switches preset-aware extensions to their Notion
25
+ * behavior, replacing the hand-written class. Create-time only.
26
+ */
27
+ readonly preset: _angular_core.InputSignal<EditorPreset>;
22
28
  readonly autofocus: _angular_core.InputSignal<FocusPosition>;
23
29
  readonly outputFormat: _angular_core.InputSignal<"html" | "json">;
24
30
  readonly editorCreated: _angular_core.OutputEmitterRef<Editor>;
@@ -62,7 +68,7 @@ declare class DomternalEditorComponent implements ControlValueAccessor, OnDestro
62
68
  private recreateEditor;
63
69
  private createEditor;
64
70
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DomternalEditorComponent, never>;
65
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DomternalEditorComponent, "domternal-editor", never, { "extensions": { "alias": "extensions"; "required": false; "isSignal": true; }; "history": { "alias": "history"; "required": false; "isSignal": true; }; "content": { "alias": "content"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "outputFormat": { "alias": "outputFormat"; "required": false; "isSignal": true; }; }, { "editorCreated": "editorCreated"; "contentUpdated": "contentUpdated"; "selectionChanged": "selectionChanged"; "focusChanged": "focusChanged"; "blurChanged": "blurChanged"; "editorDestroyed": "editorDestroyed"; }, never, never, true, never>;
71
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DomternalEditorComponent, "domternal-editor", never, { "extensions": { "alias": "extensions"; "required": false; "isSignal": true; }; "history": { "alias": "history"; "required": false; "isSignal": true; }; "content": { "alias": "content"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "preset": { "alias": "preset"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "outputFormat": { "alias": "outputFormat"; "required": false; "isSignal": true; }; }, { "editorCreated": "editorCreated"; "contentUpdated": "contentUpdated"; "selectionChanged": "selectionChanged"; "focusChanged": "focusChanged"; "blurChanged": "blurChanged"; "editorDestroyed": "editorDestroyed"; }, never, never, true, never>;
66
72
  }
67
73
 
68
74
  declare class DomternalToolbarComponent implements OnDestroy {
@@ -77,6 +83,7 @@ declare class DomternalToolbarComponent implements OnDestroy {
77
83
  readonly activeVersion: _angular_core.WritableSignal<number>;
78
84
  private controller;
79
85
  private clickOutsideHandler;
86
+ private escapeKeydownHandler;
80
87
  private dismissOverlayHandler;
81
88
  private editorEl;
82
89
  private cleanupFloating;
@@ -125,11 +132,6 @@ declare class DomternalToolbarComponent implements OnDestroy {
125
132
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DomternalToolbarComponent, "domternal-toolbar", never, { "editor": { "alias": "editor"; "required": true; "isSignal": true; }; "icons": { "alias": "icons"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
126
133
  }
127
134
 
128
- interface BubbleMenuSeparator {
129
- type: 'separator';
130
- name: string;
131
- }
132
- type BubbleMenuItem = ToolbarButton | ToolbarDropdown | BubbleMenuSeparator;
133
135
  declare class DomternalBubbleMenuComponent implements OnDestroy {
134
136
  readonly editor: _angular_core.InputSignal<Editor>;
135
137
  readonly shouldShow: _angular_core.InputSignal<(props: {
@@ -144,8 +146,18 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
144
146
  readonly updateDelay: _angular_core.InputSignal<number>;
145
147
  /** Fixed item names (e.g. ['bold', 'italic', 'code']). Omit for auto mode (all format items). */
146
148
  readonly items: _angular_core.InputSignal<string[]>;
147
- /** Context-aware: map context names to item arrays, `true` for all valid items, or `null` to disable */
148
- readonly contexts: _angular_core.InputSignal<Record<string, true | string[]>>;
149
+ /**
150
+ * Context-aware: map context names to item arrays, `true` for all valid
151
+ * items, or `null` to disable.
152
+ *
153
+ * Typed through core's `BubbleContexts` rather than the same shape written
154
+ * out here. Angular emits an input's declared type into the package types,
155
+ * and an inline union came out of that emit as `Record<string, true |
156
+ * string[]>`: the `null` that disables a context was missing from the
157
+ * published type, so the documented way to switch one off did not
158
+ * type-check. A named type survives the trip intact.
159
+ */
160
+ readonly contexts: _angular_core.InputSignal<BubbleContexts>;
149
161
  /**
150
162
  * Custom icon overrides. Falls back to default Phosphor icons for unmapped keys.
151
163
  * For nullable bindings, use `iconsSignal() ?? {}` to satisfy strict template checks.
@@ -161,6 +173,13 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
161
173
  private resolveContexts;
162
174
  /** Internal - updated on transactions. Not meant to be set from outside. */
163
175
  readonly resolvedItems: _angular_core.WritableSignal<BubbleMenuItem[]>;
176
+ /**
177
+ * The list core hands back, stored once. A default or fallback list comes
178
+ * back by reference and a signal set to its current value notifies nobody,
179
+ * so those passes cost nothing; a list resolved from names is rebuilt each
180
+ * time, as it always was.
181
+ */
182
+ private setResolvedItems;
164
183
  /** Internal - true when the BlockContextMenu extension is loaded; toggles the "..." trailing button. */
165
184
  readonly showBlockMenuButton: _angular_core.WritableSignal<boolean>;
166
185
  /** Internal - true when the selection spans more than one top-level block; the "..." trigger is disabled in that case because block-level commands have no unambiguous target. */
@@ -169,6 +188,14 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
169
188
  readonly isNodeSelection: _angular_core.WritableSignal<boolean>;
170
189
  /** Internal - true when the NotionColorPicker extension is loaded; toggles the "A" color trigger. */
171
190
  readonly showColorPickerButton: _angular_core.WritableSignal<boolean>;
191
+ /**
192
+ * The trailing triggers, resolved once for the template: each is read twice,
193
+ * for the button and for the separator that may lead it.
194
+ */
195
+ readonly showColorTrigger: _angular_core.Signal<boolean>;
196
+ readonly showBlockTrigger: _angular_core.Signal<boolean>;
197
+ /** notionColorPicker extension loaded (immutable per editor). */
198
+ private hasNotionColorPicker;
172
199
  /** Current text color CSS variable expression for the trigger glyph (null = default). */
173
200
  readonly currentTextColorVar: _angular_core.WritableSignal<string>;
174
201
  /** Current background color CSS variable expression for the trigger underline (null = transparent). */
@@ -180,12 +207,11 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
180
207
  private sanitizer;
181
208
  private ngZone;
182
209
  private activeVersion;
183
- private itemMap;
184
- private dropdownMap;
210
+ /** Rebuilt per editor by `setupItemTracking`; empty until then. */
211
+ private maps;
185
212
  private activeMap;
186
213
  private disabledMap;
187
214
  private htmlCache;
188
- private bubbleDefaults;
189
215
  private transactionHandler;
190
216
  readonly openDropdown: _angular_core.WritableSignal<string>;
191
217
  private dropdownCleanupFloating;
@@ -212,14 +238,6 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
212
238
  * "visual block" the user is editing.
213
239
  */
214
240
  openBlockContextMenu(anchor: HTMLElement): void;
215
- private buildItemMap;
216
- private resolveNames;
217
- private getFormatItems;
218
- private detectContext;
219
- private findCellNode;
220
- /** Filters out mark items that the context node type doesn't allow (e.g. bold on codeBlock) */
221
- private filterBySchema;
222
- private buildBubbleDefaults;
223
241
  private setupItemTracking;
224
242
  /**
225
243
  * Refresh state for the optional trailing buttons (A color trigger,
@@ -240,7 +258,6 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
240
258
  * applied at the cursor (Notion-style live preview).
241
259
  */
242
260
  private syncColorTriggerState;
243
- private updateContextItems;
244
261
  private updateStates;
245
262
  asButton(item: BubbleMenuItem): ToolbarButton;
246
263
  asDropdown(item: BubbleMenuItem): ToolbarDropdown;
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@domternal/angular",
3
- "version": "0.14.0",
3
+ "version": "1.0.0",
4
4
  "description": "Angular components for Domternal editor",
5
5
  "author": "https://github.com/ThomasNowHere",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "sideEffects": false,
9
+ "engines": {
10
+ "node": ">=22"
11
+ },
9
12
  "types": "./dist/types/domternal-angular.d.ts",
10
13
  "exports": {
11
14
  ".": {
@@ -17,7 +20,7 @@
17
20
  "@angular/core": ">=17.1.0",
18
21
  "@angular/forms": ">=17.1.0",
19
22
  "@angular/platform-browser": ">=17.1.0",
20
- "@domternal/core": ">=0.14.0"
23
+ "@domternal/core": ">=1.0.0"
21
24
  },
22
25
  "files": [
23
26
  "dist"
@@ -25,12 +28,6 @@
25
28
  "dependencies": {
26
29
  "tslib": "^2.8.0"
27
30
  },
28
- "scripts": {
29
- "build": "ng-packagr -p ng-package.json",
30
- "lint": "eslint src",
31
- "prepublishOnly": "pnpm build && node -e \"const p=JSON.parse(require('fs').readFileSync('package.json','utf8'));delete p.devDependencies;if(p.dependencies){for(const[k,v]of Object.entries(p.dependencies)){if(v==='workspace:*')p.dependencies[k]='>=0.14.0'}}require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')\"",
32
- "postpublish": "git checkout package.json"
33
- },
34
31
  "keywords": [
35
32
  "angular",
36
33
  "prosemirror",
@@ -46,5 +43,9 @@
46
43
  "bugs": {
47
44
  "url": "https://github.com/domternal/domternal/issues"
48
45
  },
49
- "homepage": "https://domternal.dev"
50
- }
46
+ "homepage": "https://domternal.dev",
47
+ "scripts": {
48
+ "build": "ng-packagr -p ng-package.json",
49
+ "lint": "eslint src"
50
+ }
51
+ }