@pixerate/editor 0.23.0 → 0.25.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.
Files changed (187) hide show
  1. package/README.md +167 -2
  2. package/THIRD_PARTY_NOTICES.md +80 -0
  3. package/dist/agent/index.cjs +10 -8
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +4 -3
  6. package/dist/agent/index.d.ts +4 -3
  7. package/dist/agent/index.js +4 -2
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/canvas/index.cjs +4437 -411
  10. package/dist/canvas/index.cjs.map +1 -1
  11. package/dist/canvas/index.d.cts +934 -4
  12. package/dist/canvas/index.d.ts +934 -4
  13. package/dist/canvas/index.js +4309 -283
  14. package/dist/canvas/index.js.map +1 -1
  15. package/dist/chunk-4BVP64JJ.cjs +1406 -0
  16. package/dist/chunk-4BVP64JJ.cjs.map +1 -0
  17. package/dist/chunk-664LQYFJ.js +115 -0
  18. package/dist/chunk-664LQYFJ.js.map +1 -0
  19. package/dist/chunk-7WISYZFO.cjs +740 -0
  20. package/dist/chunk-7WISYZFO.cjs.map +1 -0
  21. package/dist/chunk-AL6JMGWW.cjs +783 -0
  22. package/dist/chunk-AL6JMGWW.cjs.map +1 -0
  23. package/dist/chunk-BVP3TSLH.cjs +69 -0
  24. package/dist/chunk-BVP3TSLH.cjs.map +1 -0
  25. package/dist/{chunk-RIKBJLS2.cjs → chunk-C7P22VIP.cjs} +2001 -279
  26. package/dist/chunk-C7P22VIP.cjs.map +1 -0
  27. package/dist/chunk-D6FH2YAX.cjs +131 -0
  28. package/dist/chunk-D6FH2YAX.cjs.map +1 -0
  29. package/dist/chunk-ECCCYKGL.js +740 -0
  30. package/dist/chunk-ECCCYKGL.js.map +1 -0
  31. package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
  32. package/dist/chunk-FD4LPFAE.cjs.map +1 -0
  33. package/dist/{chunk-QBJ22YZR.js → chunk-FH6F67DN.js} +1999 -277
  34. package/dist/chunk-FH6F67DN.js.map +1 -0
  35. package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
  36. package/dist/chunk-FPENXAEJ.js.map +1 -0
  37. package/dist/chunk-HLIMTC6N.js +1 -0
  38. package/dist/chunk-HLIMTC6N.js.map +1 -0
  39. package/dist/chunk-HRMEDT2L.js +1406 -0
  40. package/dist/chunk-HRMEDT2L.js.map +1 -0
  41. package/dist/{chunk-QGHGJ56O.js → chunk-IXHSYOVY.js} +2518 -122
  42. package/dist/chunk-IXHSYOVY.js.map +1 -0
  43. package/dist/chunk-MKA3AHLV.cjs +256 -0
  44. package/dist/chunk-MKA3AHLV.cjs.map +1 -0
  45. package/dist/chunk-NAXVVS5I.js +783 -0
  46. package/dist/chunk-NAXVVS5I.js.map +1 -0
  47. package/dist/chunk-O5RYH2PG.js +69 -0
  48. package/dist/chunk-O5RYH2PG.js.map +1 -0
  49. package/dist/chunk-OXSV64JX.js +689 -0
  50. package/dist/chunk-OXSV64JX.js.map +1 -0
  51. package/dist/chunk-P3RQ5UJE.cjs +689 -0
  52. package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
  53. package/dist/chunk-P6ODPZ4W.js +256 -0
  54. package/dist/chunk-P6ODPZ4W.js.map +1 -0
  55. package/dist/chunk-PL4JB3BF.cjs +1 -0
  56. package/dist/chunk-PL4JB3BF.cjs.map +1 -0
  57. package/dist/{chunk-GVSMRPHB.cjs → chunk-PO6A6QQH.cjs} +2607 -211
  58. package/dist/chunk-PO6A6QQH.cjs.map +1 -0
  59. package/dist/{chunk-JJDLPEWL.js → chunk-QGYDWPRM.js} +2 -2
  60. package/dist/chunk-RR7F5GUM.js +5726 -0
  61. package/dist/chunk-RR7F5GUM.js.map +1 -0
  62. package/dist/chunk-TNNJXF46.cjs +115 -0
  63. package/dist/chunk-TNNJXF46.cjs.map +1 -0
  64. package/dist/chunk-U5HZSFCS.js +131 -0
  65. package/dist/chunk-U5HZSFCS.js.map +1 -0
  66. package/dist/{chunk-MJZBNWG7.js → chunk-UAKDG62Z.js} +309 -581
  67. package/dist/chunk-UAKDG62Z.js.map +1 -0
  68. package/dist/{chunk-CL37JGFW.cjs → chunk-V3CHHWOE.cjs} +4 -4
  69. package/dist/{chunk-CL37JGFW.cjs.map → chunk-V3CHHWOE.cjs.map} +1 -1
  70. package/dist/chunk-WSQKHXW7.cjs +5726 -0
  71. package/dist/chunk-WSQKHXW7.cjs.map +1 -0
  72. package/dist/{chunk-AA4ZEVCC.cjs → chunk-X4N4WUKB.cjs} +336 -608
  73. package/dist/chunk-X4N4WUKB.cjs.map +1 -0
  74. package/dist/commands/index.cjs +74 -1
  75. package/dist/commands/index.cjs.map +1 -1
  76. package/dist/commands/index.d.cts +38 -353
  77. package/dist/commands/index.d.ts +38 -353
  78. package/dist/commands/index.js +73 -0
  79. package/dist/commands/index.js.map +1 -1
  80. package/dist/comment-store-BEMgVlAA.d.cts +135 -0
  81. package/dist/comment-store-BEMgVlAA.d.ts +135 -0
  82. package/dist/compare/index.cjs +15 -0
  83. package/dist/compare/index.cjs.map +1 -0
  84. package/dist/compare/index.d.cts +58 -0
  85. package/dist/compare/index.d.ts +58 -0
  86. package/dist/compare/index.js +15 -0
  87. package/dist/compare/index.js.map +1 -0
  88. package/dist/controller-BIJiNoVs.d.cts +1842 -0
  89. package/dist/controller-BIJiNoVs.d.ts +1842 -0
  90. package/dist/documents-CHT1U5Vs.d.ts +86 -0
  91. package/dist/documents-Gp7wb0Me.d.cts +86 -0
  92. package/dist/extensions/index.cjs +100 -5
  93. package/dist/extensions/index.cjs.map +1 -1
  94. package/dist/extensions/index.d.cts +16 -4
  95. package/dist/extensions/index.d.ts +16 -4
  96. package/dist/extensions/index.js +100 -5
  97. package/dist/generation/index.cjs +2317 -0
  98. package/dist/generation/index.cjs.map +1 -0
  99. package/dist/generation/index.d.cts +1015 -0
  100. package/dist/generation/index.d.ts +1015 -0
  101. package/dist/generation/index.js +2317 -0
  102. package/dist/generation/index.js.map +1 -0
  103. package/dist/grammar/index.cjs +48 -3
  104. package/dist/grammar/index.cjs.map +1 -1
  105. package/dist/grammar/index.d.cts +322 -100
  106. package/dist/grammar/index.d.ts +322 -100
  107. package/dist/grammar/index.js +54 -9
  108. package/dist/image-editor/index.cjs +4392 -481
  109. package/dist/image-editor/index.cjs.map +1 -1
  110. package/dist/image-editor/index.d.cts +1249 -97
  111. package/dist/image-editor/index.d.ts +1249 -97
  112. package/dist/image-editor/index.js +4281 -370
  113. package/dist/image-editor/index.js.map +1 -1
  114. package/dist/index-7a6bHTLy.d.ts +1754 -0
  115. package/dist/index-Csd5qI8u.d.cts +1754 -0
  116. package/dist/index.cjs +1682 -99
  117. package/dist/index.cjs.map +1 -1
  118. package/dist/index.d.cts +118 -21
  119. package/dist/index.d.ts +118 -21
  120. package/dist/index.js +1630 -47
  121. package/dist/index.js.map +1 -1
  122. package/dist/mention-text-CDnCFd3c.d.cts +53 -0
  123. package/dist/mention-text-CDnCFd3c.d.ts +53 -0
  124. package/dist/migrate-iTlm3a8h.d.cts +112 -0
  125. package/dist/migrate-iTlm3a8h.d.ts +112 -0
  126. package/dist/model-C1zApQM8.d.cts +219 -0
  127. package/dist/model-C1zApQM8.d.ts +219 -0
  128. package/dist/persistence/index.cjs +676 -0
  129. package/dist/persistence/index.cjs.map +1 -0
  130. package/dist/persistence/index.d.cts +230 -0
  131. package/dist/persistence/index.d.ts +230 -0
  132. package/dist/persistence/index.js +676 -0
  133. package/dist/persistence/index.js.map +1 -0
  134. package/dist/{registry-D5-R90p0.d.cts → registry-BDe-vlv3.d.ts} +2 -40
  135. package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.cts} +12 -1
  136. package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.ts} +12 -1
  137. package/dist/registry-D32LpIc4.d.cts +354 -0
  138. package/dist/{registry-D5-R90p0.d.ts → registry-DnzpgY27.d.cts} +2 -40
  139. package/dist/registry-evKTP4ls.d.ts +354 -0
  140. package/dist/schema-DYDGdYL9.d.cts +41 -0
  141. package/dist/schema-DYDGdYL9.d.ts +41 -0
  142. package/dist/serializers/index.cjs +12 -3
  143. package/dist/serializers/index.cjs.map +1 -1
  144. package/dist/serializers/index.d.cts +40 -12
  145. package/dist/serializers/index.d.ts +40 -12
  146. package/dist/serializers/index.js +12 -3
  147. package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
  148. package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
  149. package/dist/spreadsheet/index.cjs +161 -3
  150. package/dist/spreadsheet/index.cjs.map +1 -1
  151. package/dist/spreadsheet/index.d.cts +611 -20
  152. package/dist/spreadsheet/index.d.ts +611 -20
  153. package/dist/spreadsheet/index.js +168 -10
  154. package/dist/storage-BpFfspHm.d.cts +120 -0
  155. package/dist/storage-BpFfspHm.d.ts +120 -0
  156. package/dist/tokens/index.cjs +115 -0
  157. package/dist/tokens/index.cjs.map +1 -0
  158. package/dist/tokens/index.d.cts +212 -0
  159. package/dist/tokens/index.d.ts +212 -0
  160. package/dist/tokens/index.js +115 -0
  161. package/dist/tokens/index.js.map +1 -0
  162. package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
  163. package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
  164. package/dist/{track-changes-BSF58RK0.d.cts → track-changes-D_VAPELi.d.cts} +110 -144
  165. package/dist/{track-changes-BSF58RK0.d.ts → track-changes-Db_fGEvx.d.ts} +110 -144
  166. package/package.json +21 -1
  167. package/dist/chunk-4SUNJZWB.cjs.map +0 -1
  168. package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
  169. package/dist/chunk-AXV2ZW34.cjs +0 -118
  170. package/dist/chunk-AXV2ZW34.cjs.map +0 -1
  171. package/dist/chunk-B2ZRLN4S.js +0 -118
  172. package/dist/chunk-B2ZRLN4S.js.map +0 -1
  173. package/dist/chunk-GVSMRPHB.cjs.map +0 -1
  174. package/dist/chunk-K3R5NG2D.js +0 -3100
  175. package/dist/chunk-K3R5NG2D.js.map +0 -1
  176. package/dist/chunk-MJZBNWG7.js.map +0 -1
  177. package/dist/chunk-OYXSKQFR.js.map +0 -1
  178. package/dist/chunk-QBJ22YZR.js.map +0 -1
  179. package/dist/chunk-QGHGJ56O.js.map +0 -1
  180. package/dist/chunk-RIKBJLS2.cjs.map +0 -1
  181. package/dist/chunk-XDMXXC4Z.cjs +0 -3100
  182. package/dist/chunk-XDMXXC4Z.cjs.map +0 -1
  183. package/dist/controller-pePCJLT1.d.cts +0 -959
  184. package/dist/controller-pePCJLT1.d.ts +0 -959
  185. package/dist/index-CCr_z9kF.d.cts +0 -899
  186. package/dist/index-Ck6ajwXh.d.ts +0 -899
  187. /package/dist/{chunk-JJDLPEWL.js.map → chunk-QGYDWPRM.js.map} +0 -0
@@ -1,42 +1,4 @@
1
- /**
2
- * JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,
3
- * plus a small validator for tool-call arguments. Unknown keywords are ignored.
4
- */
5
- type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
6
- interface JsonSchema {
7
- type?: JsonSchemaType | readonly JsonSchemaType[];
8
- description?: string;
9
- title?: string;
10
- enum?: readonly unknown[];
11
- const?: unknown;
12
- default?: unknown;
13
- properties?: {
14
- readonly [key: string]: JsonSchema;
15
- };
16
- required?: readonly string[];
17
- additionalProperties?: boolean | JsonSchema;
18
- items?: JsonSchema;
19
- minItems?: number;
20
- maxItems?: number;
21
- minimum?: number;
22
- maximum?: number;
23
- minLength?: number;
24
- maxLength?: number;
25
- pattern?: string;
26
- [keyword: string]: unknown;
27
- }
28
- interface SchemaValidationError {
29
- /** JSON-pointer-like path to the offending value, e.g. `/node/id` (`""` is the root). */
30
- path: string;
31
- message: string;
32
- }
33
- /**
34
- * Validates `value` against `schema` and returns every error found (an empty
35
- * array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,
36
- * `properties`, `required`, `additionalProperties`, `items`, `minItems`,
37
- * `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.
38
- */
39
- declare function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path?: string): SchemaValidationError[];
1
+ import { J as JsonSchema, S as SchemaValidationError } from './schema-DYDGdYL9.cjs';
40
2
 
41
3
  /**
42
4
  * MCP-shaped tool definition, as returned by `tools/list`.
@@ -206,4 +168,4 @@ declare class ToolRegistry {
206
168
  }
207
169
  declare function createToolRegistry(options?: ToolRegistryOptions): ToolRegistry;
208
170
 
209
- export { type AgentToolProvider as A, type JsonSchema as J, type McpListToolsResult as M, type SchemaValidationError as S, TOOL_NAMESPACE_SEPARATOR as T, type AgentTool as a, type AgentToolHandler as b, type JsonSchemaType as c, type McpToolContent as d, type McpToolDefinition as e, type McpToolResult as f, type ToolCallContext as g, type ToolCallError as h, type ToolErrorCode as i, ToolRegistry as j, ToolRegistryError as k, type ToolRegistryOptions as l, createToolRegistry as m, toToolResult as t, validateJsonSchema as v };
171
+ export { type AgentToolProvider as A, type McpListToolsResult as M, TOOL_NAMESPACE_SEPARATOR as T, type AgentTool as a, type AgentToolHandler as b, type McpToolContent as c, type McpToolDefinition as d, type McpToolResult as e, type ToolCallContext as f, type ToolCallError as g, type ToolErrorCode as h, ToolRegistry as i, ToolRegistryError as j, type ToolRegistryOptions as k, createToolRegistry as l, toToolResult as t };
@@ -0,0 +1,354 @@
1
+ import { J as JsonSchema, S as SchemaValidationError } from './schema-DYDGdYL9.js';
2
+
3
+ /**
4
+ * Keyboard chords in a platform-neutral notation.
5
+ *
6
+ * | token | macOS | Windows / Linux |
7
+ * |---|---|---|
8
+ * | `Mod` | ⌘ Command | Ctrl |
9
+ * | `Ctrl` | ⌃ Control | Ctrl (same key as `Mod`: conflicts are reported) |
10
+ * | `Meta` / `Cmd` | ⌘ Command | Win / Super |
11
+ * | `Alt` / `Option` | ⌥ Option | Alt |
12
+ * | `Shift` | ⇧ Shift | Shift |
13
+ *
14
+ * Keys are stored as `KeyboardEvent.code` values (`KeyZ`, `Digit1`, `BracketRight`,
15
+ * `PageDown`), so Option/Alt chords work on macOS (where Option changes `event.key`).
16
+ */
17
+ type Platform = 'mac' | 'windows' | 'linux';
18
+ declare const PLATFORMS: readonly Platform[];
19
+ /** A parsed chord. `mod` is the platform's primary modifier. */
20
+ interface Chord {
21
+ /** `KeyboardEvent.code` of the key, e.g. `KeyZ`. */
22
+ key: string;
23
+ mod?: boolean;
24
+ ctrl?: boolean;
25
+ meta?: boolean;
26
+ alt?: boolean;
27
+ shift?: boolean;
28
+ }
29
+ /** The modifiers a chord needs on one platform (`mod` resolved to `meta` or `ctrl`). */
30
+ interface EffectiveChord {
31
+ key: string;
32
+ ctrl: boolean;
33
+ meta: boolean;
34
+ alt: boolean;
35
+ shift: boolean;
36
+ }
37
+ /** The current platform from `navigator` (`linux` when unknown, e.g. in Node). */
38
+ declare function detectPlatform(): Platform;
39
+ /** `KeyboardEvent.code` for a key token (`Z`, `1`, `]`, `PageDown`, `F5`, `KeyZ`), or `null`. */
40
+ declare function keyToCode(token: string): string | null;
41
+ /** Neutral text for a code: `KeyZ` → `Z`, `BracketRight` → `]`, `ArrowUp` → `Up`. */
42
+ declare function codeToKeyText(code: string): string;
43
+ /**
44
+ * Parses chord text (`Mod+Shift+Z`, `Alt+]`, `⌥⇧⌘K`, `CmdOrCtrl+K`). Throws on unknown
45
+ * modifiers or keys. The last `+`-separated token is the key (`+` itself is `Plus`).
46
+ */
47
+ declare function parseChord(text: string): Chord;
48
+ /** Canonical platform-neutral text: `Mod+Ctrl+Meta+Alt+Shift+<key>`. */
49
+ declare function chordToString(chord: Chord): string;
50
+ /** Canonical spelling of chord text (`shift+cmdorctrl+z` → `Mod+Shift+Z`). Throws when invalid. */
51
+ declare function normalizeChord(text: string): string;
52
+ /** The modifiers a chord needs on `platform`: `Mod` is ⌘ (meta) on macOS and Ctrl elsewhere. */
53
+ declare function effectiveChord(chord: string | Chord, platform: Platform): EffectiveChord;
54
+ /** Identity of an effective chord, for conflict detection (`Ctrl+Shift+KeyZ`). */
55
+ declare function effectiveChordKey(chord: string | Chord, platform: Platform): string;
56
+ /**
57
+ * Display text: `⌥⇧⌘K` on macOS, `Ctrl+Alt+Shift+K` on Windows / Linux (`Meta` shows as
58
+ * `Win` / `Super`). Invalid text is returned unchanged.
59
+ */
60
+ declare function formatShortcut(chord: string | Chord, platform?: Platform): string;
61
+ /** Minimal keyboard event surface (DOM `KeyboardEvent` satisfies it). */
62
+ interface KeyboardEventLike {
63
+ key?: string;
64
+ code?: string;
65
+ ctrlKey?: boolean;
66
+ metaKey?: boolean;
67
+ altKey?: boolean;
68
+ shiftKey?: boolean;
69
+ target?: EventTarget | null | unknown;
70
+ defaultPrevented?: boolean;
71
+ preventDefault?: () => void;
72
+ }
73
+ /** `event.code`, or one derived from `event.key` for synthetic events without a code. */
74
+ declare function eventCode(event: KeyboardEventLike): string;
75
+ /**
76
+ * The key code a shortcut event is matched by: `event.code` (layout-independent, so
77
+ * Option/Alt chords work on macOS and punctuation chords follow the physical key),
78
+ * except that a letter key producing a different Latin letter without Alt (AZERTY,
79
+ * QWERTZ, Dvorak) uses the produced letter, as browsers and operating systems do.
80
+ */
81
+ declare function shortcutCode(event: KeyboardEventLike): string;
82
+ /** The code a printable `event.key` names on a US layout (`z` → `KeyZ`, `]` → `BracketRight`). */
83
+ declare function codeFromKey(key: string): string | null;
84
+ /**
85
+ * Whether a keyboard event comes from a text-entry element: `<input>`, `<textarea>`,
86
+ * `<select>`, a `contenteditable` element (or a descendant) or a ProseMirror editor.
87
+ * Falls back to `document.activeElement` when the event has no element target.
88
+ */
89
+ declare function isEditableEventTarget(event: {
90
+ target?: unknown;
91
+ }): boolean;
92
+
93
+ /** One key binding: a chord that runs `command`, optionally only in one scope / on some platforms. */
94
+ interface ShortcutBinding {
95
+ command: string;
96
+ /** Chord text (`Mod+Shift+Z`) or a parsed chord. */
97
+ chord: string | Chord;
98
+ /** Scope (e.g. `canvas`, `spreadsheet`); scoped bindings win over global ones. Omit for global. */
99
+ scope?: string;
100
+ /** Platforms the binding exists on (default: all). E.g. `Mod+Y` redo only off macOS. */
101
+ platforms?: readonly Platform[];
102
+ /** Also fire while focus is in an input, textarea or contenteditable (default `false`). */
103
+ allowInEditable?: boolean;
104
+ }
105
+ /** Shortcut declaration on a command: chord text, or an object for platform / scope specifics. */
106
+ type ShortcutInput = string | Omit<ShortcutBinding, 'command'> | ReadonlyArray<string | Omit<ShortcutBinding, 'command'>>;
107
+ /** Expands a command's `shortcut` declaration into bindings. */
108
+ declare function toShortcutBindings(command: string, input: ShortcutInput | undefined, scope?: string): ShortcutBinding[];
109
+ interface ShortcutConflict {
110
+ /** Scope shared by the bindings (`undefined` = global). */
111
+ scope?: string;
112
+ /** Effective chord, e.g. `Ctrl+KeyZ`. */
113
+ chord: string;
114
+ /** Commands bound to it (two or more). */
115
+ commands: string[];
116
+ }
117
+ interface ShortcutMatch {
118
+ command: string;
119
+ binding: ShortcutBinding;
120
+ }
121
+ interface ShortcutResolveOptions {
122
+ /** Active scopes, most specific first. Bindings in these scopes win over global ones. */
123
+ scopes?: string | readonly string[];
124
+ /** Resolve even when the event comes from a text input (default: per binding). */
125
+ allowInEditable?: boolean;
126
+ /** Override the map's platform. */
127
+ platform?: Platform;
128
+ }
129
+ interface ShortcutMapOptions {
130
+ /** Platform used to resolve `Mod` (default: detected from `navigator` on every resolve). */
131
+ platform?: Platform;
132
+ /**
133
+ * `platform` (default): `Mod` means ⌘ on macOS and Ctrl elsewhere, exactly.
134
+ * `either`: `Mod` (and `Ctrl` / `Meta`) match ⌘ or Ctrl on every platform.
135
+ */
136
+ modifierMode?: 'platform' | 'either';
137
+ }
138
+ /**
139
+ * Keyboard shortcuts as data: default bindings plus user overrides, resolved from
140
+ * `KeyboardEvent`s by `event.code` (so Option/Alt chords work on macOS), with scopes
141
+ * (scoped bindings win), conflict detection per platform and display formatting.
142
+ */
143
+ declare class ShortcutMap {
144
+ private defaults;
145
+ private overrides;
146
+ private readonly listeners;
147
+ private readonly options;
148
+ constructor(bindings?: readonly ShortcutBinding[], options?: ShortcutMapOptions);
149
+ get platform(): Platform;
150
+ private entry;
151
+ private changed;
152
+ /** Subscribes to binding changes. Returns an unsubscribe function. */
153
+ subscribe(listener: () => void): () => void;
154
+ /** Adds default bindings (throws on invalid chord text). Returns a function removing them. */
155
+ bind(bindings: ShortcutBinding | readonly ShortcutBinding[]): () => void;
156
+ /**
157
+ * User override for a command: replaces all of its default bindings with `chords`
158
+ * (an empty list unbinds it). Throws on invalid chord text.
159
+ */
160
+ setOverride(command: string, chords: string | Chord | ReadonlyArray<string | Chord | Omit<ShortcutBinding, 'command'>>): void;
161
+ /** Removes a user override (the defaults apply again). */
162
+ clearOverride(command: string): void;
163
+ /** User overrides as plain data (`{ command: ['Mod+K'] }`), e.g. to persist them. */
164
+ getOverrides(): Record<string, string[]>;
165
+ /** Restores overrides saved with `getOverrides` (replacing the current ones). */
166
+ setOverrides(overrides: Record<string, readonly string[]>): void;
167
+ private active;
168
+ /** Effective bindings on `platform` (defaults without overridden commands, plus overrides). */
169
+ bindings(platform?: Platform): ShortcutBinding[];
170
+ /** Canonical chord text bound to `command` on `platform` (first = primary). */
171
+ forCommand(command: string, platform?: Platform): string[];
172
+ /**
173
+ * The command a keydown event runs, or `null`. Events from text inputs are ignored
174
+ * unless the binding (or `options`) allows them. Bindings in the active scopes
175
+ * (in order) win over global bindings; bindings in other scopes never match.
176
+ * Keys are matched by `event.code`, except that a letter key producing another Latin
177
+ * letter (AZERTY, QWERTZ, Dvorak) matches that letter when Alt is not held, so
178
+ * `Mod+Z` follows the Z label (see `shortcutCode`).
179
+ */
180
+ resolve(event: KeyboardEventLike, options?: ShortcutResolveOptions): ShortcutMatch | null;
181
+ private matches;
182
+ /**
183
+ * Groups of bindings that share an effective chord in one scope on `platform`
184
+ * (e.g. `Mod+Y` and `Ctrl+Y` collide off macOS). A scoped binding shadowing a
185
+ * global one is not a conflict.
186
+ */
187
+ findConflicts(platform?: Platform): ShortcutConflict[];
188
+ /** Conflicts on every platform, keyed by platform (only platforms with conflicts). */
189
+ findAllConflicts(): Partial<Record<Platform, ShortcutConflict[]>>;
190
+ }
191
+
192
+ /** Object JSON Schema describing a command's parameters. */
193
+ type CommandParamsSchema = JsonSchema & {
194
+ type: 'object';
195
+ };
196
+ /**
197
+ * Metadata and implementation of one command. Menus, shortcuts, the palette and agent
198
+ * tools all run commands by id, so every entry point shares enablement and validation.
199
+ */
200
+ interface CommandSpec<TContext = any, TParams = any, TResult = unknown> {
201
+ /** Unique id, e.g. `history.undo` or `canvas.alignLeft`. */
202
+ id: string;
203
+ label: string;
204
+ /** Group / menu name shown next to the label, e.g. `Edit` or `Arrange`. */
205
+ group?: string;
206
+ /** Extra search terms for the palette. */
207
+ keywords?: readonly string[];
208
+ description?: string;
209
+ /** Object JSON Schema for `params`. Unknown keys are rejected unless `additionalProperties` allows them. */
210
+ params?: CommandParamsSchema;
211
+ /** Default shortcut(s): platform-neutral chord text such as `Mod+Shift+Z`. */
212
+ shortcut?: ShortcutInput;
213
+ /** Scope the command (and its shortcuts) belong to, e.g. `canvas`. Omit for global commands. */
214
+ scope?: string;
215
+ /**
216
+ * Whether the command can run: `true` (or `undefined`), `false`, or a reason string
217
+ * ("Nothing to undo"). Receives the params a caller named, so a command acting on the
218
+ * selection can still run on targets passed explicitly (`params` is `undefined` for menus).
219
+ */
220
+ enabled?: (context: TContext, params: TParams | undefined) => boolean | string | undefined;
221
+ run: (context: TContext, params: TParams) => TResult;
222
+ /**
223
+ * Runs inside the registry's `history.batch(label, …)`, so all history entries the
224
+ * command records become one undo step and a throw rolls back its partial changes.
225
+ */
226
+ undoable?: boolean;
227
+ /** The command only reads state (agent tools mark it read-only). */
228
+ readOnly?: boolean;
229
+ /** Hide from the palette and `list()` unless `includeHidden` (still runnable by id). */
230
+ hidden?: boolean;
231
+ }
232
+ type CommandErrorCode = 'unknown_command' | 'disabled' | 'invalid_params' | 'failed';
233
+ type CommandResult<T = unknown> = {
234
+ ok: true;
235
+ id: string;
236
+ result: T;
237
+ } | {
238
+ ok: false;
239
+ id: string;
240
+ code: CommandErrorCode;
241
+ message: string;
242
+ details?: SchemaValidationError[];
243
+ };
244
+ /** A command as listed for menus, palettes and agents. */
245
+ interface CommandEntry {
246
+ id: string;
247
+ label: string;
248
+ group?: string;
249
+ keywords?: readonly string[];
250
+ description?: string;
251
+ params?: CommandParamsSchema;
252
+ scope?: string;
253
+ /** Canonical chord text bound on the registry's platform (first = primary). */
254
+ shortcuts: string[];
255
+ enabled: boolean;
256
+ /** Why the command is disabled (only when `enabled` is false). */
257
+ disabledReason?: string;
258
+ undoable: boolean;
259
+ readOnly: boolean;
260
+ }
261
+ interface CommandListOptions<TContext = any> {
262
+ /** Only global commands plus commands of these scopes. */
263
+ scope?: string | readonly string[];
264
+ enabledOnly?: boolean;
265
+ includeHidden?: boolean;
266
+ /** Context for the enablement check (default: the registry's context). */
267
+ context?: TContext;
268
+ }
269
+ /** Minimal history surface (`HistoryManager` satisfies it). */
270
+ interface CommandHistoryTarget {
271
+ batch(name: string, fn: () => void): void;
272
+ }
273
+ interface CommandRegistryOptions<TContext = any> {
274
+ /** Default context passed to `enabled` / `run` (a value or a getter). */
275
+ context?: TContext | (() => TContext);
276
+ /** Wraps `undoable` commands in one history step (see `CommandSpec.undoable`). */
277
+ history?: CommandHistoryTarget;
278
+ /** Options for the registry's `ShortcutMap`. */
279
+ shortcuts?: ShortcutMapOptions;
280
+ }
281
+ declare class CommandRegistryError extends Error {
282
+ readonly code: 'duplicate_command' | 'invalid_command';
283
+ constructor(code: CommandRegistryError['code'], message: string);
284
+ }
285
+ /**
286
+ * Registry of commands: one id per action, shared by shortcuts (`shortcuts`), the
287
+ * command palette (`list` + `rankCommands`) and agent tools (`createCommandToolProvider`).
288
+ */
289
+ declare class CommandRegistry<TContext = any> {
290
+ /** Shortcut bindings of the registered commands (plus any user overrides). */
291
+ readonly shortcuts: ShortcutMap;
292
+ private readonly commands;
293
+ private readonly listeners;
294
+ private readonly options;
295
+ private version;
296
+ private muted;
297
+ constructor(options?: CommandRegistryOptions<TContext>);
298
+ /** Monotonic counter bumped on every change (useful as a snapshot key). */
299
+ getVersion(): number;
300
+ /** The default context. */
301
+ get context(): TContext;
302
+ /**
303
+ * Registers a command (or several) and returns a function that unregisters it.
304
+ * Throws a `CommandRegistryError` for a duplicate or invalid id, or invalid chord text.
305
+ */
306
+ register(spec: CommandSpec<TContext> | readonly CommandSpec<TContext>[]): () => void;
307
+ /** Removes a command by id. Returns whether it was registered. */
308
+ unregister(id: string): boolean;
309
+ private unbindQuietly;
310
+ has(id: string): boolean;
311
+ get(id: string): CommandSpec<TContext> | undefined;
312
+ /** Registered ids in registration order. */
313
+ ids(): string[];
314
+ /** Whether `id` can run now (`{ enabled, reason }`); `params` are the targets a caller named. */
315
+ isEnabled(id: string, params?: unknown, context?: TContext): {
316
+ enabled: boolean;
317
+ reason?: string;
318
+ };
319
+ /** Commands for menus, palettes and agents, with their current enablement. */
320
+ list(options?: CommandListOptions<TContext>): CommandEntry[];
321
+ private check;
322
+ private invoke;
323
+ /**
324
+ * Runs a command synchronously and returns a structured result; never throws.
325
+ * A command whose `run` returns a promise yields `{ ok: true, result: promise }`
326
+ * (use `executeAsync` to await it and catch its rejection).
327
+ */
328
+ execute<T = unknown>(id: string, params?: unknown, context?: TContext): CommandResult<T>;
329
+ /** Like `execute`, but awaits async commands (rejections become `failed` results). */
330
+ executeAsync<T = unknown>(id: string, params?: unknown, context?: TContext): Promise<CommandResult<T>>;
331
+ /**
332
+ * Resolves a keydown event to a command (see `ShortcutMap.resolve`) and runs it when
333
+ * enabled, calling `preventDefault()`. Disabled commands leave the event alone, so the
334
+ * browser or a focused editor can still handle it. Returns the result, or `null`.
335
+ */
336
+ handleKeyDown(event: KeyboardEventLike, options?: ShortcutResolveOptions & {
337
+ context?: TContext;
338
+ }): CommandResult | null;
339
+ /** Display-ready primary shortcut of a command (`⇧⌘Z` / `Ctrl+Shift+Z`), or `undefined`. */
340
+ shortcutFor(id: string, platform?: Platform): string | undefined;
341
+ /**
342
+ * Subscribes to changes: commands registered or removed, shortcut overrides, executed
343
+ * commands and `invalidate()` calls (e.g. when enablement inputs change).
344
+ */
345
+ subscribe(listener: () => void): () => void;
346
+ /** Tells subscribers that enablement may have changed (e.g. the selection changed). */
347
+ invalidate(): void;
348
+ private notify;
349
+ }
350
+ declare function createCommandRegistry<TContext = any>(options?: CommandRegistryOptions<TContext>): CommandRegistry<TContext>;
351
+ /** Identity helper that types a command spec. */
352
+ declare function defineCommand<TContext = any, TParams = any, TResult = unknown>(spec: CommandSpec<TContext, TParams, TResult>): CommandSpec<TContext, TParams, TResult>;
353
+
354
+ export { formatShortcut as A, isEditableEventTarget as B, CommandRegistry as C, keyToCode as D, type EffectiveChord as E, normalizeChord as F, parseChord as G, shortcutCode as H, toShortcutBindings as I, type KeyboardEventLike as K, type Platform as P, type ShortcutBinding as S, type CommandResult as a, type CommandEntry as b, type CommandSpec as c, type Chord as d, type CommandErrorCode as e, type CommandHistoryTarget as f, type CommandListOptions as g, type CommandParamsSchema as h, CommandRegistryError as i, type CommandRegistryOptions as j, PLATFORMS as k, type ShortcutConflict as l, type ShortcutInput as m, ShortcutMap as n, type ShortcutMapOptions as o, type ShortcutMatch as p, type ShortcutResolveOptions as q, chordToString as r, codeFromKey as s, codeToKeyText as t, createCommandRegistry as u, defineCommand as v, detectPlatform as w, effectiveChord as x, effectiveChordKey as y, eventCode as z };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,
3
+ * plus a small validator for tool-call arguments. Unknown keywords are ignored.
4
+ */
5
+ type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
6
+ interface JsonSchema {
7
+ type?: JsonSchemaType | readonly JsonSchemaType[];
8
+ description?: string;
9
+ title?: string;
10
+ enum?: readonly unknown[];
11
+ const?: unknown;
12
+ default?: unknown;
13
+ properties?: {
14
+ readonly [key: string]: JsonSchema;
15
+ };
16
+ required?: readonly string[];
17
+ additionalProperties?: boolean | JsonSchema;
18
+ items?: JsonSchema;
19
+ minItems?: number;
20
+ maxItems?: number;
21
+ minimum?: number;
22
+ maximum?: number;
23
+ minLength?: number;
24
+ maxLength?: number;
25
+ pattern?: string;
26
+ [keyword: string]: unknown;
27
+ }
28
+ interface SchemaValidationError {
29
+ /** JSON-pointer-like path to the offending value, e.g. `/node/id` (`""` is the root). */
30
+ path: string;
31
+ message: string;
32
+ }
33
+ /**
34
+ * Validates `value` against `schema` and returns every error found (an empty
35
+ * array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,
36
+ * `properties`, `required`, `additionalProperties`, `items`, `minItems`,
37
+ * `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.
38
+ */
39
+ declare function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path?: string): SchemaValidationError[];
40
+
41
+ export { type JsonSchema as J, type SchemaValidationError as S, type JsonSchemaType as a, validateJsonSchema as v };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,
3
+ * plus a small validator for tool-call arguments. Unknown keywords are ignored.
4
+ */
5
+ type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
6
+ interface JsonSchema {
7
+ type?: JsonSchemaType | readonly JsonSchemaType[];
8
+ description?: string;
9
+ title?: string;
10
+ enum?: readonly unknown[];
11
+ const?: unknown;
12
+ default?: unknown;
13
+ properties?: {
14
+ readonly [key: string]: JsonSchema;
15
+ };
16
+ required?: readonly string[];
17
+ additionalProperties?: boolean | JsonSchema;
18
+ items?: JsonSchema;
19
+ minItems?: number;
20
+ maxItems?: number;
21
+ minimum?: number;
22
+ maximum?: number;
23
+ minLength?: number;
24
+ maxLength?: number;
25
+ pattern?: string;
26
+ [keyword: string]: unknown;
27
+ }
28
+ interface SchemaValidationError {
29
+ /** JSON-pointer-like path to the offending value, e.g. `/node/id` (`""` is the root). */
30
+ path: string;
31
+ message: string;
32
+ }
33
+ /**
34
+ * Validates `value` against `schema` and returns every error found (an empty
35
+ * array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,
36
+ * `properties`, `required`, `additionalProperties`, `items`, `minItems`,
37
+ * `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.
38
+ */
39
+ declare function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path?: string): SchemaValidationError[];
40
+
41
+ export { type JsonSchema as J, type SchemaValidationError as S, type JsonSchemaType as a, validateJsonSchema as v };
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkCL37JGFWcjs = require('../chunk-CL37JGFW.cjs');
12
+ var _chunkV3CHHWOEcjs = require('../chunk-V3CHHWOE.cjs');
13
13
 
14
14
 
15
15
 
@@ -26,12 +26,14 @@ var _chunkCL37JGFWcjs = require('../chunk-CL37JGFW.cjs');
26
26
 
27
27
 
28
28
 
29
+ var _chunk7WISYZFOcjs = require('../chunk-7WISYZFO.cjs');
29
30
 
30
- var _chunkAA4ZEVCCcjs = require('../chunk-AA4ZEVCC.cjs');
31
31
 
32
32
 
33
33
 
34
34
 
35
+ var _chunkBVP3TSLHcjs = require('../chunk-BVP3TSLH.cjs');
36
+ require('../chunk-X4N4WUKB.cjs');
35
37
 
36
38
 
37
39
 
@@ -54,5 +56,12 @@ var _chunkAA4ZEVCCcjs = require('../chunk-AA4ZEVCC.cjs');
54
56
 
55
57
 
56
58
 
57
- exports.MARKDOWN_MENTION_SPLIT_REGEX = _chunkAA4ZEVCCcjs.MARKDOWN_MENTION_SPLIT_REGEX; exports.MENTION_REGEX = _chunkAA4ZEVCCcjs.MENTION_REGEX; exports.PIXERATE_DOCUMENT_MIME = _chunkCL37JGFWcjs.PIXERATE_DOCUMENT_MIME; exports.escapeHtml = _chunkAA4ZEVCCcjs.escapeHtml; exports.extractMentions = _chunkAA4ZEVCCcjs.extractMentions; exports.extractMentionsFromDoc = _chunkAA4ZEVCCcjs.extractMentionsFromDoc; exports.getClipboardData = _chunkCL37JGFWcjs.getClipboardData; exports.getEditorMarkdown = _chunkAA4ZEVCCcjs.getEditorMarkdown; exports.getEditorText = _chunkAA4ZEVCCcjs.getEditorText; exports.getSchemaSignature = _chunkCL37JGFWcjs.getSchemaSignature; exports.htmlToPlainText = _chunkAA4ZEVCCcjs.htmlToPlainText; exports.markdownToTipTapHtml = _chunkAA4ZEVCCcjs.markdownToTipTapHtml; exports.parseMentionSegments = _chunkAA4ZEVCCcjs.parseMentionSegments; exports.parseRichClipboardPayload = _chunkCL37JGFWcjs.parseRichClipboardPayload; exports.plainTextToParagraphHtml = _chunkCL37JGFWcjs.plainTextToParagraphHtml; exports.plainTextToSlice = _chunkAA4ZEVCCcjs.plainTextToSlice; exports.plainTextToTipTapHtml = _chunkAA4ZEVCCcjs.plainTextToTipTapHtml; exports.preprocessMarkdownFileLinks = _chunkAA4ZEVCCcjs.preprocessMarkdownFileLinks; exports.preprocessMarkdownMentions = _chunkAA4ZEVCCcjs.preprocessMarkdownMentions; exports.readRichClipboard = _chunkCL37JGFWcjs.readRichClipboard; exports.rtfToPlainText = _chunkCL37JGFWcjs.rtfToPlainText; exports.sanitizeHtml = _chunkAA4ZEVCCcjs.sanitizeHtml; exports.sanitizeImportedHtml = _chunkCL37JGFWcjs.sanitizeImportedHtml; exports.serializeRichClipboardPayload = _chunkCL37JGFWcjs.serializeRichClipboardPayload; exports.stripMarkdownCode = _chunkAA4ZEVCCcjs.stripMarkdownCode;
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+ exports.MARKDOWN_MENTION_SPLIT_REGEX = _chunk7WISYZFOcjs.MARKDOWN_MENTION_SPLIT_REGEX; exports.MENTION_REGEX = _chunkBVP3TSLHcjs.MENTION_REGEX; exports.PIXERATE_DOCUMENT_MIME = _chunkV3CHHWOEcjs.PIXERATE_DOCUMENT_MIME; exports.escapeHtml = _chunk7WISYZFOcjs.escapeHtml; exports.extractMentions = _chunk7WISYZFOcjs.extractMentions; exports.extractMentionsFromDoc = _chunk7WISYZFOcjs.extractMentionsFromDoc; exports.findTextMentions = _chunkBVP3TSLHcjs.findTextMentions; exports.formatMentionText = _chunkBVP3TSLHcjs.formatMentionText; exports.getClipboardData = _chunkV3CHHWOEcjs.getClipboardData; exports.getEditorMarkdown = _chunk7WISYZFOcjs.getEditorMarkdown; exports.getEditorText = _chunk7WISYZFOcjs.getEditorText; exports.getSchemaSignature = _chunkV3CHHWOEcjs.getSchemaSignature; exports.htmlToPlainText = _chunk7WISYZFOcjs.htmlToPlainText; exports.markdownToTipTapHtml = _chunk7WISYZFOcjs.markdownToTipTapHtml; exports.parseMentionSegments = _chunk7WISYZFOcjs.parseMentionSegments; exports.parseRichClipboardPayload = _chunkV3CHHWOEcjs.parseRichClipboardPayload; exports.plainTextToParagraphHtml = _chunkV3CHHWOEcjs.plainTextToParagraphHtml; exports.plainTextToSlice = _chunk7WISYZFOcjs.plainTextToSlice; exports.plainTextToTipTapHtml = _chunk7WISYZFOcjs.plainTextToTipTapHtml; exports.preprocessMarkdownFileLinks = _chunk7WISYZFOcjs.preprocessMarkdownFileLinks; exports.preprocessMarkdownMentions = _chunk7WISYZFOcjs.preprocessMarkdownMentions; exports.readRichClipboard = _chunkV3CHHWOEcjs.readRichClipboard; exports.rtfToPlainText = _chunkV3CHHWOEcjs.rtfToPlainText; exports.sanitizeHtml = _chunk7WISYZFOcjs.sanitizeHtml; exports.sanitizeImportedHtml = _chunkV3CHHWOEcjs.sanitizeImportedHtml; exports.serializeRichClipboardPayload = _chunkV3CHHWOEcjs.serializeRichClipboardPayload; exports.setMentionRoleInText = _chunkBVP3TSLHcjs.setMentionRoleInText; exports.stripMarkdownCode = _chunk7WISYZFOcjs.stripMarkdownCode;
58
67
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,gsDAAC","file":"/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"}
1
+ {"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,u4DAAC","file":"/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"}
@@ -1,9 +1,12 @@
1
1
  import { Schema, Slice } from '@tiptap/pm/model';
2
- import { t as TrackedChangesView, h as MentionEntity } from '../track-changes-BSF58RK0.cjs';
2
+ import { r as TrackedChangesView, d as MentionEntity } from '../track-changes-D_VAPELi.cjs';
3
+ import { a as MentionRoleSyntax } from '../mention-text-CDnCFd3c.cjs';
4
+ export { M as MENTION_REGEX, T as TextMention, f as findTextMentions, b as formatMentionText, s as setMentionRoleInText } from '../mention-text-CDnCFd3c.cjs';
3
5
  import '@tiptap/core';
4
6
  import '@tiptap/extension-mention';
5
7
  import '@tiptap/suggestion';
6
8
  import '@tiptap/pm/state';
9
+ import '../comment-store-BEMgVlAA.cjs';
7
10
 
8
11
  interface PlainTextOptions {
9
12
  /**
@@ -44,6 +47,8 @@ interface ExtractedMention {
44
47
  id: string;
45
48
  label: string;
46
49
  type?: string;
50
+ /** Asset role (`data-role`), when set. */
51
+ role?: string;
47
52
  avatarUrl?: string;
48
53
  color?: string;
49
54
  [key: string]: any;
@@ -54,14 +59,6 @@ interface ExtractedMention {
54
59
  */
55
60
  declare function extractMentionsFromDoc(docOrEditor: any): ExtractedMention[];
56
61
 
57
- /**
58
- * Canonical regex pattern for matching @mentions in plain text or markdown.
59
- * Supports:
60
- * - Standard unquoted handles: @username, @user.name, @team_alpha, @sa-1
61
- * - Quoted handles: @"John Doe", &quot;Jane Doe&quot;
62
- * Unquoted handles exclude trailing punctuation (e.g. @violet. matches "violet" without the dot).
63
- */
64
- declare const MENTION_REGEX: RegExp;
65
62
  /**
66
63
  * Split regex identifying markdown code blocks, inline code, URLs, and existing HTML tags.
67
64
  * Used by preprocessMarkdownMentions to ensure non-mention regions remain completely untouched.
@@ -71,6 +68,19 @@ interface MentionSegment {
71
68
  type: "text" | "mention";
72
69
  value: string;
73
70
  handle?: string;
71
+ /** Role written after the handle (`@fox:style`), when role syntax is enabled. */
72
+ role?: string;
73
+ }
74
+ /** A mention with its role (asset mentions: `@fox:style`, or `data-role` on a mention node). */
75
+ interface MentionDetail {
76
+ handle: string;
77
+ role?: string;
78
+ }
79
+ interface ExtractMentionsOptions {
80
+ /** Return `{ handle, role }` objects instead of handles. */
81
+ details?: boolean;
82
+ /** Read `@handle:role` suffixes in text (see {@link MentionRoleSyntax}). Mention nodes' `data-role` is always read in `details` mode. */
83
+ roles?: MentionRoleSyntax;
74
84
  }
75
85
  interface PreprocessMarkdownMentionsOptions {
76
86
  /**
@@ -86,6 +96,11 @@ interface PreprocessMarkdownMentionsOptions {
86
96
  * Custom resolver callback to derive entity metadata for unmatched handles.
87
97
  */
88
98
  resolveMention?: (handle: string) => Partial<MentionEntity> | null | undefined;
99
+ /**
100
+ * Read `@handle:role` and emit the role as `data-role` (the `:role` text is
101
+ * consumed). Off by default. See {@link MentionRoleSyntax}.
102
+ */
103
+ roles?: MentionRoleSyntax;
89
104
  }
90
105
  /**
91
106
  * Strips code blocks and inline code from markdown or HTML content:
@@ -98,13 +113,26 @@ declare function stripMarkdownCode(content: string): string;
98
113
  /**
99
114
  * Extracts unique mention handles from a text, markdown, or HTML string,
100
115
  * ignoring trailing punctuation, code blocks, URLs, and pre-existing HTML mention attributes.
116
+ *
117
+ * With `{ details: true }` it returns `{ handle, role }` objects, unique per
118
+ * handle and role: roles come from mention nodes' `data-role` and, when
119
+ * `roles` is set, from `@handle:role` text. Without options the result is
120
+ * unchanged.
101
121
  */
102
- declare function extractMentions(content: string): string[];
122
+ declare function extractMentions(content: string, options?: ExtractMentionsOptions & {
123
+ details?: false;
124
+ }): string[];
125
+ declare function extractMentions(content: string, options: ExtractMentionsOptions & {
126
+ details: true;
127
+ }): MentionDetail[];
128
+ declare function extractMentions(content: string, options?: ExtractMentionsOptions): string[] | MentionDetail[];
103
129
  /**
104
130
  * Segments a text string into plain text parts and mention tokens.
105
131
  * Correctly leaves trailing punctuation (like ".") as part of the following text segment.
106
132
  */
107
- declare function parseMentionSegments(content: string): MentionSegment[];
133
+ declare function parseMentionSegments(content: string, options?: {
134
+ roles?: MentionRoleSyntax;
135
+ }): MentionSegment[];
108
136
  /**
109
137
  * Preprocesses markdown text by turning raw @mention handles into TipTap-compatible
110
138
  * mention HTML spans (<span class="pixerate-mention-node" data-type="mention" ...>),
@@ -257,4 +285,4 @@ declare function getClipboardData(event: unknown): ClipboardDataLike | null;
257
285
  */
258
286
  declare function readRichClipboard(event: unknown, schema: Schema, mimeType?: string): Slice | null;
259
287
 
260
- export { type ClipboardDataLike, type ExtractedMention, MARKDOWN_MENTION_SPLIT_REGEX, MENTION_REGEX, type MarkdownToHtmlOptions, type MentionSegment, PIXERATE_DOCUMENT_MIME, type PlainTextOptions, type PreprocessMarkdownMentionsOptions, type RichClipboardPayload, type SanitizeHtmlOptions, escapeHtml, extractMentions, extractMentionsFromDoc, getClipboardData, getEditorMarkdown, getEditorText, getSchemaSignature, htmlToPlainText, markdownToTipTapHtml, parseMentionSegments, parseRichClipboardPayload, plainTextToParagraphHtml, plainTextToSlice, plainTextToTipTapHtml, preprocessMarkdownFileLinks, preprocessMarkdownMentions, readRichClipboard, rtfToPlainText, sanitizeHtml, sanitizeImportedHtml, serializeRichClipboardPayload, stripMarkdownCode };
288
+ export { type ClipboardDataLike, type ExtractMentionsOptions, type ExtractedMention, MARKDOWN_MENTION_SPLIT_REGEX, type MarkdownToHtmlOptions, type MentionDetail, MentionRoleSyntax, type MentionSegment, PIXERATE_DOCUMENT_MIME, type PlainTextOptions, type PreprocessMarkdownMentionsOptions, type RichClipboardPayload, type SanitizeHtmlOptions, escapeHtml, extractMentions, extractMentionsFromDoc, getClipboardData, getEditorMarkdown, getEditorText, getSchemaSignature, htmlToPlainText, markdownToTipTapHtml, parseMentionSegments, parseRichClipboardPayload, plainTextToParagraphHtml, plainTextToSlice, plainTextToTipTapHtml, preprocessMarkdownFileLinks, preprocessMarkdownMentions, readRichClipboard, rtfToPlainText, sanitizeHtml, sanitizeImportedHtml, serializeRichClipboardPayload, stripMarkdownCode };