@pixerate/editor 0.24.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 (133) hide show
  1. package/README.md +71 -1
  2. package/THIRD_PARTY_NOTICES.md +29 -0
  3. package/dist/agent/index.cjs +10 -9
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +1 -1
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +4 -3
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/canvas/index.cjs +3173 -340
  10. package/dist/canvas/index.cjs.map +1 -1
  11. package/dist/canvas/index.d.cts +617 -4
  12. package/dist/canvas/index.d.ts +617 -4
  13. package/dist/canvas/index.js +3105 -272
  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-XNORY7M6.cjs → chunk-7WISYZFO.cjs} +105 -50
  18. package/dist/chunk-7WISYZFO.cjs.map +1 -0
  19. package/dist/{chunk-OLZJXL4R.cjs → chunk-AL6JMGWW.cjs} +59 -25
  20. package/dist/chunk-AL6JMGWW.cjs.map +1 -0
  21. package/dist/chunk-BVP3TSLH.cjs +69 -0
  22. package/dist/chunk-BVP3TSLH.cjs.map +1 -0
  23. package/dist/{chunk-MCSJFWAO.cjs → chunk-C7P22VIP.cjs} +670 -96
  24. package/dist/chunk-C7P22VIP.cjs.map +1 -0
  25. package/dist/{chunk-PGNZKFQS.js → chunk-ECCCYKGL.js} +76 -21
  26. package/dist/chunk-ECCCYKGL.js.map +1 -0
  27. package/dist/{chunk-3CN2WD3X.js → chunk-FH6F67DN.js} +646 -72
  28. package/dist/chunk-FH6F67DN.js.map +1 -0
  29. package/dist/chunk-HRMEDT2L.js +1406 -0
  30. package/dist/chunk-HRMEDT2L.js.map +1 -0
  31. package/dist/{chunk-ITBSKI26.js → chunk-IXHSYOVY.js} +941 -9
  32. package/dist/chunk-IXHSYOVY.js.map +1 -0
  33. package/dist/{chunk-FODNLX5N.js → chunk-NAXVVS5I.js} +38 -4
  34. package/dist/chunk-NAXVVS5I.js.map +1 -0
  35. package/dist/chunk-O5RYH2PG.js +69 -0
  36. package/dist/chunk-O5RYH2PG.js.map +1 -0
  37. package/dist/{chunk-SBCZ6RN5.cjs → chunk-PO6A6QQH.cjs} +1039 -107
  38. package/dist/chunk-PO6A6QQH.cjs.map +1 -0
  39. package/dist/{chunk-3LV6RRPH.js → chunk-QGYDWPRM.js} +2 -2
  40. package/dist/{chunk-U5KWZU4X.js → chunk-RR7F5GUM.js} +2632 -129
  41. package/dist/chunk-RR7F5GUM.js.map +1 -0
  42. package/dist/{chunk-5S3Z4PPF.js → chunk-UAKDG62Z.js} +232 -25
  43. package/dist/chunk-UAKDG62Z.js.map +1 -0
  44. package/dist/{chunk-SML64VJG.cjs → chunk-V3CHHWOE.cjs} +4 -4
  45. package/dist/{chunk-SML64VJG.cjs.map → chunk-V3CHHWOE.cjs.map} +1 -1
  46. package/dist/chunk-WSQKHXW7.cjs +5726 -0
  47. package/dist/chunk-WSQKHXW7.cjs.map +1 -0
  48. package/dist/{chunk-D27YFC46.cjs → chunk-X4N4WUKB.cjs} +267 -60
  49. package/dist/chunk-X4N4WUKB.cjs.map +1 -0
  50. package/dist/commands/index.cjs +74 -1
  51. package/dist/commands/index.cjs.map +1 -1
  52. package/dist/commands/index.d.cts +34 -1
  53. package/dist/commands/index.d.ts +34 -1
  54. package/dist/commands/index.js +73 -0
  55. package/dist/commands/index.js.map +1 -1
  56. package/dist/compare/index.cjs +3 -3
  57. package/dist/compare/index.d.cts +1 -1
  58. package/dist/compare/index.d.ts +1 -1
  59. package/dist/compare/index.js +2 -2
  60. package/dist/controller-BIJiNoVs.d.cts +1842 -0
  61. package/dist/controller-BIJiNoVs.d.ts +1842 -0
  62. package/dist/{documents-BQjzJNe2.d.ts → documents-CHT1U5Vs.d.ts} +10 -0
  63. package/dist/{documents-KRTPhvst.d.cts → documents-Gp7wb0Me.d.cts} +10 -0
  64. package/dist/extensions/index.cjs +53 -6
  65. package/dist/extensions/index.cjs.map +1 -1
  66. package/dist/extensions/index.d.cts +12 -4
  67. package/dist/extensions/index.d.ts +12 -4
  68. package/dist/extensions/index.js +53 -6
  69. package/dist/generation/index.cjs +1013 -69
  70. package/dist/generation/index.cjs.map +1 -1
  71. package/dist/generation/index.d.cts +474 -13
  72. package/dist/generation/index.d.ts +474 -13
  73. package/dist/generation/index.js +976 -32
  74. package/dist/generation/index.js.map +1 -1
  75. package/dist/image-editor/index.cjs +3385 -1275
  76. package/dist/image-editor/index.cjs.map +1 -1
  77. package/dist/image-editor/index.d.cts +693 -128
  78. package/dist/image-editor/index.d.ts +693 -128
  79. package/dist/image-editor/index.js +3325 -1215
  80. package/dist/image-editor/index.js.map +1 -1
  81. package/dist/{index-fJrlkJCd.d.ts → index-7a6bHTLy.d.ts} +494 -5
  82. package/dist/{index-BhJBSm2d.d.cts → index-Csd5qI8u.d.cts} +494 -5
  83. package/dist/index.cjs +1491 -45
  84. package/dist/index.cjs.map +1 -1
  85. package/dist/index.d.cts +110 -19
  86. package/dist/index.d.ts +110 -19
  87. package/dist/index.js +1464 -18
  88. package/dist/index.js.map +1 -1
  89. package/dist/mention-text-CDnCFd3c.d.cts +53 -0
  90. package/dist/mention-text-CDnCFd3c.d.ts +53 -0
  91. package/dist/model-C1zApQM8.d.cts +219 -0
  92. package/dist/model-C1zApQM8.d.ts +219 -0
  93. package/dist/persistence/index.d.cts +3 -120
  94. package/dist/persistence/index.d.ts +3 -120
  95. package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.cts} +12 -1
  96. package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.ts} +12 -1
  97. package/dist/serializers/index.cjs +12 -4
  98. package/dist/serializers/index.cjs.map +1 -1
  99. package/dist/serializers/index.d.cts +39 -12
  100. package/dist/serializers/index.d.ts +39 -12
  101. package/dist/serializers/index.js +12 -4
  102. package/dist/spreadsheet/index.cjs +127 -3
  103. package/dist/spreadsheet/index.cjs.map +1 -1
  104. package/dist/spreadsheet/index.d.cts +431 -11
  105. package/dist/spreadsheet/index.d.ts +431 -11
  106. package/dist/spreadsheet/index.js +127 -3
  107. package/dist/storage-BpFfspHm.d.cts +120 -0
  108. package/dist/storage-BpFfspHm.d.ts +120 -0
  109. package/dist/tokens/index.cjs +115 -0
  110. package/dist/tokens/index.cjs.map +1 -0
  111. package/dist/tokens/index.d.cts +212 -0
  112. package/dist/tokens/index.d.ts +212 -0
  113. package/dist/tokens/index.js +115 -0
  114. package/dist/tokens/index.js.map +1 -0
  115. package/dist/{track-changes-BK5sVf4_.d.cts → track-changes-D_VAPELi.d.cts} +95 -11
  116. package/dist/{track-changes-CDjCrwKe.d.ts → track-changes-Db_fGEvx.d.ts} +95 -11
  117. package/package.json +6 -1
  118. package/dist/chunk-3CN2WD3X.js.map +0 -1
  119. package/dist/chunk-5S3Z4PPF.js.map +0 -1
  120. package/dist/chunk-D27YFC46.cjs.map +0 -1
  121. package/dist/chunk-FODNLX5N.js.map +0 -1
  122. package/dist/chunk-ITBSKI26.js.map +0 -1
  123. package/dist/chunk-MA2F5KHF.cjs +0 -3223
  124. package/dist/chunk-MA2F5KHF.cjs.map +0 -1
  125. package/dist/chunk-MCSJFWAO.cjs.map +0 -1
  126. package/dist/chunk-OLZJXL4R.cjs.map +0 -1
  127. package/dist/chunk-PGNZKFQS.js.map +0 -1
  128. package/dist/chunk-SBCZ6RN5.cjs.map +0 -1
  129. package/dist/chunk-U5KWZU4X.js.map +0 -1
  130. package/dist/chunk-XNORY7M6.cjs.map +0 -1
  131. package/dist/controller-BhLLAoi8.d.cts +0 -1000
  132. package/dist/controller-BhLLAoi8.d.ts +0 -1000
  133. /package/dist/{chunk-3LV6RRPH.js.map → chunk-QGYDWPRM.js.map} +0 -0
@@ -1,3 +1,5 @@
1
+ import { S as StorageAdapter } from '../storage-BpFfspHm.js';
2
+ export { I as IdbFactoryLike, a as IndexedDbAdapterOptions, b as InjectedStorageError, L as LocalStorageAdapterOptions, M as MemoryStorage, O as OpfsAdapterOptions, c as OpfsDirectoryLike, d as OpfsFileLike, e as StorageAdapterOptions, f as StorageFailureMode, g as StorageOperation, h as StorageUnavailableError, W as WebStorageLike, i as createIndexedDbAdapter, j as createLocalStorageAdapter, k as createMemoryStorage, l as createOpfsAdapter, m as isIndexedDbAvailable, n as isLocalStorageAvailable, o as isOpfsAvailable, w as withStorageFailures } from '../storage-BpFfspHm.js';
1
3
  export { J as JsonObject, L as LoadDocumentOptions, a as LoadDocumentResult, b as LoadReport, c as LoadSectionsOptions, d as LoadSectionsResult, M as MigrateOptions, e as MigrateResult, f as MigrationStep, R as ReadOnlyReason, S as SectionProblem, g as SectionSpec, h as SectionSpecs, i as createLoadReport, j as hasLoadProblems, l as loadDocument, k as loadSections, m as migrateDocument } from '../migrate-iTlm3a8h.js';
2
4
 
3
5
  /**
@@ -63,125 +65,6 @@ declare function exponentialBackoff(failures: number, base?: number, max?: numbe
63
65
  */
64
66
  declare function createRecoveryPolicy(options?: RecoveryPolicyOptions): RecoveryPolicy;
65
67
 
66
- /**
67
- * Key/value storage adapters for autosave and crash recovery. Every adapter is
68
- * async, stores strings, feature-detects its backend (an unavailable backend
69
- * rejects every call with `StorageUnavailableError` instead of throwing at
70
- * construction, so SSR and old browsers are safe) and accepts an injectable
71
- * failure mode for tests.
72
- */
73
- type StorageOperation = "get" | "set" | "remove";
74
- /**
75
- * Injected failure: return `true` (or an `Error`) to make that operation fail.
76
- * Example: `failure: (op) => op === "set"` simulates a full disk.
77
- */
78
- type StorageFailureMode = (operation: StorageOperation, key: string) => boolean | Error | undefined | void;
79
- interface StorageAdapter {
80
- /** Short backend name, e.g. `"memory"`, `"localStorage"`, `"indexedDB"`, `"opfs"`. */
81
- readonly kind: string;
82
- /** Whether the backend was found. When `false`, every call rejects. */
83
- readonly available: boolean;
84
- get(key: string): Promise<string | null>;
85
- set(key: string, value: string): Promise<void>;
86
- remove(key: string): Promise<void>;
87
- }
88
- interface StorageAdapterOptions {
89
- failure?: StorageFailureMode;
90
- }
91
- declare class StorageUnavailableError extends Error {
92
- constructor(kind: string);
93
- }
94
- declare class InjectedStorageError extends Error {
95
- constructor(operation: StorageOperation, key: string);
96
- }
97
- /** Wraps an adapter so `failure` can make any of its operations fail. */
98
- declare function withStorageFailures(inner: StorageAdapter, failure: StorageFailureMode): StorageAdapter;
99
- interface MemoryStorage extends StorageAdapter {
100
- /** The underlying map (inspect it in tests). */
101
- readonly entries: Map<string, string>;
102
- }
103
- /** In-memory storage (tests, SSR, or a session-only fallback). */
104
- declare function createMemoryStorage(options?: StorageAdapterOptions & {
105
- initial?: Record<string, string>;
106
- }): MemoryStorage;
107
- /** Minimal `Storage` surface used by the localStorage adapter. */
108
- interface WebStorageLike {
109
- getItem(key: string): string | null;
110
- setItem(key: string, value: string): void;
111
- removeItem(key: string): void;
112
- }
113
- interface LocalStorageAdapterOptions extends StorageAdapterOptions {
114
- /** Storage to use (default `globalThis.localStorage`, e.g. pass `sessionStorage`). */
115
- storage?: WebStorageLike;
116
- }
117
- /** Whether `localStorage` can be used (it throws when site data is blocked). */
118
- declare function isLocalStorageAvailable(): boolean;
119
- /**
120
- * `localStorage` adapter; every key is prefixed with `prefix`. Writes are
121
- * synchronous under the hood, so they complete even inside `pagehide`.
122
- * A full quota rejects the `set` (`QuotaExceededError`).
123
- */
124
- declare function createLocalStorageAdapter(prefix?: string, options?: LocalStorageAdapterOptions): StorageAdapter;
125
- /** Minimal `IDBFactory` surface (the real `indexedDB`, or a fake in tests). */
126
- interface IdbFactoryLike {
127
- open(name: string, version?: number): any;
128
- }
129
- interface IndexedDbAdapterOptions extends StorageAdapterOptions {
130
- /** Object store name (default `"kv"`). */
131
- store?: string;
132
- /** Factory to use (default `globalThis.indexedDB`). */
133
- indexedDB?: IdbFactoryLike;
134
- }
135
- /** Whether `indexedDB` exists in this environment. */
136
- declare function isIndexedDbAvailable(): boolean;
137
- /**
138
- * IndexedDB adapter: one database `name` with a single key/value object store.
139
- * A `set` resolves when its transaction completes (not merely when the request
140
- * succeeds), so a resolved write is durable.
141
- */
142
- declare function createIndexedDbAdapter(name?: string, options?: IndexedDbAdapterOptions): StorageAdapter;
143
- /** Minimal `FileSystemDirectoryHandle` surface used by the OPFS adapter. */
144
- interface OpfsDirectoryLike {
145
- getDirectoryHandle(name: string, options?: {
146
- create?: boolean;
147
- }): Promise<OpfsDirectoryLike>;
148
- getFileHandle(name: string, options?: {
149
- create?: boolean;
150
- }): Promise<OpfsFileLike>;
151
- removeEntry(name: string): Promise<void>;
152
- }
153
- interface OpfsFileLike {
154
- getFile(): Promise<{
155
- text(): Promise<string>;
156
- }>;
157
- createWritable?(): Promise<{
158
- write(data: string): Promise<void>;
159
- close(): Promise<void>;
160
- }>;
161
- /** Rename in place (Chromium, Safari). Used for temp-file + rename writes. */
162
- move?(name: string): Promise<void>;
163
- }
164
- interface OpfsAdapterOptions extends StorageAdapterOptions {
165
- /** Root directory (default `navigator.storage.getDirectory()`). */
166
- root?: () => Promise<OpfsDirectoryLike>;
167
- /** Force the write-then-pointer-swap strategy even when `move` exists. */
168
- disableRename?: boolean;
169
- }
170
- /** Whether the Origin Private File System exists (`navigator.storage.getDirectory`). */
171
- declare function isOpfsAvailable(): boolean;
172
- /**
173
- * Origin Private File System adapter. Values are files in `dir` (created on
174
- * demand), named after the URI-encoded key.
175
- *
176
- * Writes never leave a half-written value behind: where file handles support
177
- * `move`, the value is written to `<file>.tmp` and renamed over `<file>`;
178
- * otherwise it alternates between two slots (`<file>.a` / `<file>.b`) and then
179
- * swaps a pointer file (`<file>.ptr`), so a crash mid-write keeps the previous
180
- * value. Main-thread writes need `createWritable` (missing in some Safari
181
- * versions); without it, `set` rejects with `StorageUnavailableError`.
182
- */
183
- declare function createOpfsAdapter(dir?: string, options?: OpfsAdapterOptions): StorageAdapter;
184
-
185
68
  type AutosaveStatus = "idle" | "dirty" | "saving" | "saved" | "error";
186
69
  interface AutosaveStatusInfo {
187
70
  status: AutosaveStatus;
@@ -344,4 +227,4 @@ interface RevisionTracker {
344
227
  */
345
228
  declare function createRevisionTracker(options?: RevisionTrackerOptions): RevisionTracker;
346
229
 
347
- export { type AutosaveController, type AutosaveControllerOptions, type AutosaveRecovery, type AutosaveStatus, type AutosaveStatusInfo, type DirtyFlagSource, type IdbFactoryLike, type IndexedDbAdapterOptions, InjectedStorageError, type LocalStorageAdapterOptions, type MemoryStorage, type OpfsAdapterOptions, type OpfsDirectoryLike, type OpfsFileLike, type RecoveryAction, type RecoveryMeta, type RecoveryPolicy, type RecoveryPolicyOptions, type RecoveryTickOptions, type RevisionChangeSource, type RevisionTracker, type RevisionTrackerOptions, type StorageAdapter, type StorageAdapterOptions, type StorageFailureMode, type StorageOperation, StorageUnavailableError, type WebStorageLike, createAutosaveController, createIndexedDbAdapter, createLocalStorageAdapter, createMemoryStorage, createOpfsAdapter, createRecoveryPolicy, createRevisionTracker, exponentialBackoff, formatRecoveryMessage, isIndexedDbAvailable, isLocalStorageAvailable, isOpfsAvailable, recoveryMetaKey, withStorageFailures };
230
+ export { type AutosaveController, type AutosaveControllerOptions, type AutosaveRecovery, type AutosaveStatus, type AutosaveStatusInfo, type DirtyFlagSource, type RecoveryAction, type RecoveryMeta, type RecoveryPolicy, type RecoveryPolicyOptions, type RecoveryTickOptions, type RevisionChangeSource, type RevisionTracker, type RevisionTrackerOptions, StorageAdapter, createAutosaveController, createRecoveryPolicy, createRevisionTracker, exponentialBackoff, formatRecoveryMessage, recoveryMetaKey };
@@ -35,6 +35,11 @@ interface ImportContext {
35
35
  * exports) can import nested files with the same adapters.
36
36
  */
37
37
  registry?: ImportAdapterRegistry;
38
+ /**
39
+ * Per-import options for this adapter: `ImportFileOptions.adapterOptions[adapter.id]`.
40
+ * Adapters document what they accept (e.g. the PDF adapter's `{ structure: false }`).
41
+ */
42
+ options?: unknown;
38
43
  }
39
44
  interface ImportAdapter<TResult = unknown> {
40
45
  /** Unique id, e.g. `markdown`, `html`, `csv`. */
@@ -65,6 +70,11 @@ interface ImportFileOptions {
65
70
  fileName?: string;
66
71
  /** Overrides the input's own `type`. */
67
72
  mimeType?: string;
73
+ /**
74
+ * Options for individual adapters, keyed by adapter id; the matching entry
75
+ * reaches the adapter as `context.options`. Example: `{ pdf: { structure: false } }`.
76
+ */
77
+ adapterOptions?: Record<string, unknown>;
68
78
  }
69
79
  interface ImportOutcome<TResult = unknown> {
70
80
  adapterId: string;
@@ -96,6 +106,7 @@ declare function createImportContext(input: ImportInput, details: {
96
106
  mimeType?: string;
97
107
  target: ImportTarget;
98
108
  registry?: ImportAdapterRegistry;
109
+ options?: unknown;
99
110
  }): ImportContext;
100
111
  /**
101
112
  * A set of import adapters with type matching. Use the default registry via
@@ -136,4 +147,4 @@ declare class ImportAdapterRegistry {
136
147
  importFile<TResult = unknown>(input: ImportInput, options?: ImportFileOptions): Promise<ImportOutcome<TResult>>;
137
148
  }
138
149
 
139
- export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type FindImportAdapterQuery as b, type ImportAdapter as c, type ImportContext as d, ImportError as e, type ImportErrorCode as f, type ImportFileOptions as g, type ImportInput as h, type ImportTarget as i, createImportContext as j };
150
+ export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type ImportAdapter as b, type FindImportAdapterQuery as c, type ImportContext as d, ImportError as e, type ImportErrorCode as f, type ImportFileOptions as g, type ImportInput as h, type ImportTarget as i, createImportContext as j };
@@ -35,6 +35,11 @@ interface ImportContext {
35
35
  * exports) can import nested files with the same adapters.
36
36
  */
37
37
  registry?: ImportAdapterRegistry;
38
+ /**
39
+ * Per-import options for this adapter: `ImportFileOptions.adapterOptions[adapter.id]`.
40
+ * Adapters document what they accept (e.g. the PDF adapter's `{ structure: false }`).
41
+ */
42
+ options?: unknown;
38
43
  }
39
44
  interface ImportAdapter<TResult = unknown> {
40
45
  /** Unique id, e.g. `markdown`, `html`, `csv`. */
@@ -65,6 +70,11 @@ interface ImportFileOptions {
65
70
  fileName?: string;
66
71
  /** Overrides the input's own `type`. */
67
72
  mimeType?: string;
73
+ /**
74
+ * Options for individual adapters, keyed by adapter id; the matching entry
75
+ * reaches the adapter as `context.options`. Example: `{ pdf: { structure: false } }`.
76
+ */
77
+ adapterOptions?: Record<string, unknown>;
68
78
  }
69
79
  interface ImportOutcome<TResult = unknown> {
70
80
  adapterId: string;
@@ -96,6 +106,7 @@ declare function createImportContext(input: ImportInput, details: {
96
106
  mimeType?: string;
97
107
  target: ImportTarget;
98
108
  registry?: ImportAdapterRegistry;
109
+ options?: unknown;
99
110
  }): ImportContext;
100
111
  /**
101
112
  * A set of import adapters with type matching. Use the default registry via
@@ -136,4 +147,4 @@ declare class ImportAdapterRegistry {
136
147
  importFile<TResult = unknown>(input: ImportInput, options?: ImportFileOptions): Promise<ImportOutcome<TResult>>;
137
148
  }
138
149
 
139
- export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type FindImportAdapterQuery as b, type ImportAdapter as c, type ImportContext as d, ImportError as e, type ImportErrorCode as f, type ImportFileOptions as g, type ImportInput as h, type ImportTarget as i, createImportContext as j };
150
+ export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type ImportAdapter as b, type FindImportAdapterQuery as c, type ImportContext as d, ImportError as e, type ImportErrorCode as f, type ImportFileOptions as g, type ImportInput as h, type ImportTarget as i, createImportContext as j };
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkSML64VJGcjs = require('../chunk-SML64VJG.cjs');
12
+ var _chunkV3CHHWOEcjs = require('../chunk-V3CHHWOE.cjs');
13
13
 
14
14
 
15
15
 
@@ -26,13 +26,14 @@ var _chunkSML64VJGcjs = require('../chunk-SML64VJG.cjs');
26
26
 
27
27
 
28
28
 
29
+ var _chunk7WISYZFOcjs = require('../chunk-7WISYZFO.cjs');
29
30
 
30
- var _chunkXNORY7M6cjs = require('../chunk-XNORY7M6.cjs');
31
- require('../chunk-D27YFC46.cjs');
32
31
 
33
32
 
34
33
 
35
34
 
35
+ var _chunkBVP3TSLHcjs = require('../chunk-BVP3TSLH.cjs');
36
+ require('../chunk-X4N4WUKB.cjs');
36
37
 
37
38
 
38
39
 
@@ -55,5 +56,12 @@ require('../chunk-D27YFC46.cjs');
55
56
 
56
57
 
57
58
 
58
- exports.MARKDOWN_MENTION_SPLIT_REGEX = _chunkXNORY7M6cjs.MARKDOWN_MENTION_SPLIT_REGEX; exports.MENTION_REGEX = _chunkXNORY7M6cjs.MENTION_REGEX; exports.PIXERATE_DOCUMENT_MIME = _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME; exports.escapeHtml = _chunkXNORY7M6cjs.escapeHtml; exports.extractMentions = _chunkXNORY7M6cjs.extractMentions; exports.extractMentionsFromDoc = _chunkXNORY7M6cjs.extractMentionsFromDoc; exports.getClipboardData = _chunkSML64VJGcjs.getClipboardData; exports.getEditorMarkdown = _chunkXNORY7M6cjs.getEditorMarkdown; exports.getEditorText = _chunkXNORY7M6cjs.getEditorText; exports.getSchemaSignature = _chunkSML64VJGcjs.getSchemaSignature; exports.htmlToPlainText = _chunkXNORY7M6cjs.htmlToPlainText; exports.markdownToTipTapHtml = _chunkXNORY7M6cjs.markdownToTipTapHtml; exports.parseMentionSegments = _chunkXNORY7M6cjs.parseMentionSegments; exports.parseRichClipboardPayload = _chunkSML64VJGcjs.parseRichClipboardPayload; exports.plainTextToParagraphHtml = _chunkSML64VJGcjs.plainTextToParagraphHtml; exports.plainTextToSlice = _chunkXNORY7M6cjs.plainTextToSlice; exports.plainTextToTipTapHtml = _chunkXNORY7M6cjs.plainTextToTipTapHtml; exports.preprocessMarkdownFileLinks = _chunkXNORY7M6cjs.preprocessMarkdownFileLinks; exports.preprocessMarkdownMentions = _chunkXNORY7M6cjs.preprocessMarkdownMentions; exports.readRichClipboard = _chunkSML64VJGcjs.readRichClipboard; exports.rtfToPlainText = _chunkSML64VJGcjs.rtfToPlainText; exports.sanitizeHtml = _chunkXNORY7M6cjs.sanitizeHtml; exports.sanitizeImportedHtml = _chunkSML64VJGcjs.sanitizeImportedHtml; exports.serializeRichClipboardPayload = _chunkSML64VJGcjs.serializeRichClipboardPayload; exports.stripMarkdownCode = _chunkXNORY7M6cjs.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;
59
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,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;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,5 +1,7 @@
1
1
  import { Schema, Slice } from '@tiptap/pm/model';
2
- import { n as TrackedChangesView, a as MentionEntity } from '../track-changes-BK5sVf4_.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';
@@ -45,6 +47,8 @@ interface ExtractedMention {
45
47
  id: string;
46
48
  label: string;
47
49
  type?: string;
50
+ /** Asset role (`data-role`), when set. */
51
+ role?: string;
48
52
  avatarUrl?: string;
49
53
  color?: string;
50
54
  [key: string]: any;
@@ -55,14 +59,6 @@ interface ExtractedMention {
55
59
  */
56
60
  declare function extractMentionsFromDoc(docOrEditor: any): ExtractedMention[];
57
61
 
58
- /**
59
- * Canonical regex pattern for matching @mentions in plain text or markdown.
60
- * Supports:
61
- * - Standard unquoted handles: @username, @user.name, @team_alpha, @sa-1
62
- * - Quoted handles: @"John Doe", &quot;Jane Doe&quot;
63
- * Unquoted handles exclude trailing punctuation (e.g. @violet. matches "violet" without the dot).
64
- */
65
- declare const MENTION_REGEX: RegExp;
66
62
  /**
67
63
  * Split regex identifying markdown code blocks, inline code, URLs, and existing HTML tags.
68
64
  * Used by preprocessMarkdownMentions to ensure non-mention regions remain completely untouched.
@@ -72,6 +68,19 @@ interface MentionSegment {
72
68
  type: "text" | "mention";
73
69
  value: string;
74
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;
75
84
  }
76
85
  interface PreprocessMarkdownMentionsOptions {
77
86
  /**
@@ -87,6 +96,11 @@ interface PreprocessMarkdownMentionsOptions {
87
96
  * Custom resolver callback to derive entity metadata for unmatched handles.
88
97
  */
89
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;
90
104
  }
91
105
  /**
92
106
  * Strips code blocks and inline code from markdown or HTML content:
@@ -99,13 +113,26 @@ declare function stripMarkdownCode(content: string): string;
99
113
  /**
100
114
  * Extracts unique mention handles from a text, markdown, or HTML string,
101
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.
102
121
  */
103
- 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[];
104
129
  /**
105
130
  * Segments a text string into plain text parts and mention tokens.
106
131
  * Correctly leaves trailing punctuation (like ".") as part of the following text segment.
107
132
  */
108
- declare function parseMentionSegments(content: string): MentionSegment[];
133
+ declare function parseMentionSegments(content: string, options?: {
134
+ roles?: MentionRoleSyntax;
135
+ }): MentionSegment[];
109
136
  /**
110
137
  * Preprocesses markdown text by turning raw @mention handles into TipTap-compatible
111
138
  * mention HTML spans (<span class="pixerate-mention-node" data-type="mention" ...>),
@@ -258,4 +285,4 @@ declare function getClipboardData(event: unknown): ClipboardDataLike | null;
258
285
  */
259
286
  declare function readRichClipboard(event: unknown, schema: Schema, mimeType?: string): Slice | null;
260
287
 
261
- 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 };
@@ -1,5 +1,7 @@
1
1
  import { Schema, Slice } from '@tiptap/pm/model';
2
- import { n as TrackedChangesView, a as MentionEntity } from '../track-changes-CDjCrwKe.js';
2
+ import { r as TrackedChangesView, d as MentionEntity } from '../track-changes-Db_fGEvx.js';
3
+ import { a as MentionRoleSyntax } from '../mention-text-CDnCFd3c.js';
4
+ export { M as MENTION_REGEX, T as TextMention, f as findTextMentions, b as formatMentionText, s as setMentionRoleInText } from '../mention-text-CDnCFd3c.js';
3
5
  import '@tiptap/core';
4
6
  import '@tiptap/extension-mention';
5
7
  import '@tiptap/suggestion';
@@ -45,6 +47,8 @@ interface ExtractedMention {
45
47
  id: string;
46
48
  label: string;
47
49
  type?: string;
50
+ /** Asset role (`data-role`), when set. */
51
+ role?: string;
48
52
  avatarUrl?: string;
49
53
  color?: string;
50
54
  [key: string]: any;
@@ -55,14 +59,6 @@ interface ExtractedMention {
55
59
  */
56
60
  declare function extractMentionsFromDoc(docOrEditor: any): ExtractedMention[];
57
61
 
58
- /**
59
- * Canonical regex pattern for matching @mentions in plain text or markdown.
60
- * Supports:
61
- * - Standard unquoted handles: @username, @user.name, @team_alpha, @sa-1
62
- * - Quoted handles: @"John Doe", &quot;Jane Doe&quot;
63
- * Unquoted handles exclude trailing punctuation (e.g. @violet. matches "violet" without the dot).
64
- */
65
- declare const MENTION_REGEX: RegExp;
66
62
  /**
67
63
  * Split regex identifying markdown code blocks, inline code, URLs, and existing HTML tags.
68
64
  * Used by preprocessMarkdownMentions to ensure non-mention regions remain completely untouched.
@@ -72,6 +68,19 @@ interface MentionSegment {
72
68
  type: "text" | "mention";
73
69
  value: string;
74
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;
75
84
  }
76
85
  interface PreprocessMarkdownMentionsOptions {
77
86
  /**
@@ -87,6 +96,11 @@ interface PreprocessMarkdownMentionsOptions {
87
96
  * Custom resolver callback to derive entity metadata for unmatched handles.
88
97
  */
89
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;
90
104
  }
91
105
  /**
92
106
  * Strips code blocks and inline code from markdown or HTML content:
@@ -99,13 +113,26 @@ declare function stripMarkdownCode(content: string): string;
99
113
  /**
100
114
  * Extracts unique mention handles from a text, markdown, or HTML string,
101
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.
102
121
  */
103
- 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[];
104
129
  /**
105
130
  * Segments a text string into plain text parts and mention tokens.
106
131
  * Correctly leaves trailing punctuation (like ".") as part of the following text segment.
107
132
  */
108
- declare function parseMentionSegments(content: string): MentionSegment[];
133
+ declare function parseMentionSegments(content: string, options?: {
134
+ roles?: MentionRoleSyntax;
135
+ }): MentionSegment[];
109
136
  /**
110
137
  * Preprocesses markdown text by turning raw @mention handles into TipTap-compatible
111
138
  * mention HTML spans (<span class="pixerate-mention-node" data-type="mention" ...>),
@@ -258,4 +285,4 @@ declare function getClipboardData(event: unknown): ClipboardDataLike | null;
258
285
  */
259
286
  declare function readRichClipboard(event: unknown, schema: Schema, mimeType?: string): Slice | null;
260
287
 
261
- 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 };
@@ -9,10 +9,9 @@ import {
9
9
  rtfToPlainText,
10
10
  sanitizeImportedHtml,
11
11
  serializeRichClipboardPayload
12
- } from "../chunk-3LV6RRPH.js";
12
+ } from "../chunk-QGYDWPRM.js";
13
13
  import {
14
14
  MARKDOWN_MENTION_SPLIT_REGEX,
15
- MENTION_REGEX,
16
15
  escapeHtml,
17
16
  extractMentions,
18
17
  extractMentionsFromDoc,
@@ -27,8 +26,14 @@ import {
27
26
  preprocessMarkdownMentions,
28
27
  sanitizeHtml,
29
28
  stripMarkdownCode
30
- } from "../chunk-PGNZKFQS.js";
31
- import "../chunk-5S3Z4PPF.js";
29
+ } from "../chunk-ECCCYKGL.js";
30
+ import {
31
+ MENTION_REGEX,
32
+ findTextMentions,
33
+ formatMentionText,
34
+ setMentionRoleInText
35
+ } from "../chunk-O5RYH2PG.js";
36
+ import "../chunk-UAKDG62Z.js";
32
37
  export {
33
38
  MARKDOWN_MENTION_SPLIT_REGEX,
34
39
  MENTION_REGEX,
@@ -36,6 +41,8 @@ export {
36
41
  escapeHtml,
37
42
  extractMentions,
38
43
  extractMentionsFromDoc,
44
+ findTextMentions,
45
+ formatMentionText,
39
46
  getClipboardData,
40
47
  getEditorMarkdown,
41
48
  getEditorText,
@@ -54,6 +61,7 @@ export {
54
61
  sanitizeHtml,
55
62
  sanitizeImportedHtml,
56
63
  serializeRichClipboardPayload,
64
+ setMentionRoleInText,
57
65
  stripMarkdownCode
58
66
  };
59
67
  //# sourceMappingURL=index.js.map