@domternal/angular 0.15.0 → 1.0.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.
@@ -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, EditorPreset, 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';
@@ -132,11 +132,6 @@ declare class DomternalToolbarComponent implements OnDestroy {
132
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>;
133
133
  }
134
134
 
135
- interface BubbleMenuSeparator {
136
- type: 'separator';
137
- name: string;
138
- }
139
- type BubbleMenuItem = ToolbarButton | ToolbarDropdown | BubbleMenuSeparator;
140
135
  declare class DomternalBubbleMenuComponent implements OnDestroy {
141
136
  readonly editor: _angular_core.InputSignal<Editor>;
142
137
  readonly shouldShow: _angular_core.InputSignal<(props: {
@@ -146,13 +141,23 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
146
141
  from: number;
147
142
  to: number;
148
143
  }) => boolean>;
149
- readonly placement: _angular_core.InputSignal<"top" | "bottom">;
144
+ readonly placement: _angular_core.InputSignal<"bottom" | "top">;
150
145
  readonly offset: _angular_core.InputSignal<number>;
151
146
  readonly updateDelay: _angular_core.InputSignal<number>;
152
147
  /** Fixed item names (e.g. ['bold', 'italic', 'code']). Omit for auto mode (all format items). */
153
148
  readonly items: _angular_core.InputSignal<string[]>;
154
- /** Context-aware: map context names to item arrays, `true` for all valid items, or `null` to disable */
155
- 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>;
156
161
  /**
157
162
  * Custom icon overrides. Falls back to default Phosphor icons for unmapped keys.
158
163
  * For nullable bindings, use `iconsSignal() ?? {}` to satisfy strict template checks.
@@ -168,6 +173,13 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
168
173
  private resolveContexts;
169
174
  /** Internal - updated on transactions. Not meant to be set from outside. */
170
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;
171
183
  /** Internal - true when the BlockContextMenu extension is loaded; toggles the "..." trailing button. */
172
184
  readonly showBlockMenuButton: _angular_core.WritableSignal<boolean>;
173
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. */
@@ -176,6 +188,12 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
176
188
  readonly isNodeSelection: _angular_core.WritableSignal<boolean>;
177
189
  /** Internal - true when the NotionColorPicker extension is loaded; toggles the "A" color trigger. */
178
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>;
179
197
  /** notionColorPicker extension loaded (immutable per editor). */
180
198
  private hasNotionColorPicker;
181
199
  /** Current text color CSS variable expression for the trigger glyph (null = default). */
@@ -189,12 +207,11 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
189
207
  private sanitizer;
190
208
  private ngZone;
191
209
  private activeVersion;
192
- private itemMap;
193
- private dropdownMap;
210
+ /** Rebuilt per editor by `setupItemTracking`; empty until then. */
211
+ private maps;
194
212
  private activeMap;
195
213
  private disabledMap;
196
214
  private htmlCache;
197
- private bubbleDefaults;
198
215
  private transactionHandler;
199
216
  readonly openDropdown: _angular_core.WritableSignal<string>;
200
217
  private dropdownCleanupFloating;
@@ -221,14 +238,6 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
221
238
  * "visual block" the user is editing.
222
239
  */
223
240
  openBlockContextMenu(anchor: HTMLElement): void;
224
- private buildItemMap;
225
- private resolveNames;
226
- private getFormatItems;
227
- private detectContext;
228
- private findCellNode;
229
- /** Filters out mark items that the context node type doesn't allow (e.g. bold on codeBlock) */
230
- private filterBySchema;
231
- private buildBubbleDefaults;
232
241
  private setupItemTracking;
233
242
  /**
234
243
  * Refresh state for the optional trailing buttons (A color trigger,
@@ -249,7 +258,6 @@ declare class DomternalBubbleMenuComponent implements OnDestroy {
249
258
  * applied at the cursor (Notion-style live preview).
250
259
  */
251
260
  private syncColorTriggerState;
252
- private updateContextItems;
253
261
  private updateStates;
254
262
  asButton(item: BubbleMenuItem): ToolbarButton;
255
263
  asDropdown(item: BubbleMenuItem): ToolbarDropdown;
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@domternal/angular",
3
- "version": "0.15.0",
3
+ "version": "1.0.1",
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.15.0"
23
+ "@domternal/core": ">=1.0.0"
21
24
  },
22
25
  "files": [
23
26
  "dist"