@harbour-enterprises/superdoc 0.21.0-next.4 → 0.21.0-next.6

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 (36) hide show
  1. package/dist/chunks/{PdfViewer-OZDJ7gwT.cjs → PdfViewer-BrJSIJjF.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-D3zo7tPo.es.js → PdfViewer-CJAEtjUD.es.js} +1 -1
  3. package/dist/chunks/{index-MzW5BVNd.es.js → index-BDfKQQiO.es.js} +4 -3
  4. package/dist/chunks/{index-CfYf4T_z.cjs → index-NiOytIlp.cjs} +4 -3
  5. package/dist/chunks/{super-editor.es-U-GVCd_F.cjs → super-editor.es-DmkkMNKU.cjs} +2015 -787
  6. package/dist/chunks/{super-editor.es-Bntob7Wd.es.js → super-editor.es-iVTtEcot.es.js} +2015 -787
  7. package/dist/core/types/index.d.ts +8 -0
  8. package/dist/core/types/index.d.ts.map +1 -1
  9. package/dist/style.css +43 -38
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-3xnF_NHq.js → converter-CYC0HBJe.js} +733 -642
  12. package/dist/super-editor/chunks/{docx-zipper-CZdELYi-.js → docx-zipper-DlwteneT.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-BqYH4kDD.js → editor-BzT9rpXb.js} +59 -13
  14. package/dist/super-editor/chunks/{toolbar-TkaE2kKM.js → toolbar-BnTHDmlP.js} +6 -7
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/src/components/slash-menu/menuItems.d.ts +5 -1
  20. package/dist/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +466 -0
  21. package/dist/super-editor/src/components/slash-menu/utils.d.ts +9 -2
  22. package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts +6 -0
  23. package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/index.d.ts +1 -0
  24. package/dist/super-editor/src/extensions/noderesizer/helpers.d.ts +2 -0
  25. package/dist/super-editor/src/tests/helpers/helpers.d.ts +1 -0
  26. package/dist/super-editor/src/utils/shadow-root.d.ts +12 -0
  27. package/dist/super-editor/style.css +16 -11
  28. package/dist/super-editor/super-editor.es.js +1226 -134
  29. package/dist/super-editor/toolbar.es.js +2 -2
  30. package/dist/super-editor.cjs +1 -1
  31. package/dist/super-editor.es.js +1 -1
  32. package/dist/superdoc.cjs +2 -2
  33. package/dist/superdoc.es.js +2 -2
  34. package/dist/superdoc.umd.js +2017 -788
  35. package/dist/superdoc.umd.js.map +1 -1
  36. package/package.json +1 -1
@@ -0,0 +1,466 @@
1
+ /**
2
+ * Test helper utilities for slash menu components
3
+ * Extracts shared patterns from utils.test.js, SlashMenu.test.js, and menuItems.test.js
4
+ */
5
+ /**
6
+ * Creates a mock ProseMirror selection object with configurable properties
7
+ */
8
+ export function createMockSelection(options?: {}): {
9
+ from: number;
10
+ to: number;
11
+ empty: boolean;
12
+ $head: {
13
+ marks: import("vitest").Mock<() => {
14
+ type: {
15
+ name: any;
16
+ };
17
+ }[]>;
18
+ };
19
+ $from: {
20
+ depth: number;
21
+ node: import("vitest").Mock<() => {
22
+ type: {
23
+ name: string;
24
+ };
25
+ }>;
26
+ };
27
+ $to: {
28
+ depth: number;
29
+ node: import("vitest").Mock<() => {
30
+ type: {
31
+ name: string;
32
+ };
33
+ }>;
34
+ };
35
+ constructor: {
36
+ near: import("vitest").Mock<() => {
37
+ from: number;
38
+ to: number;
39
+ }>;
40
+ };
41
+ };
42
+ /**
43
+ * Creates a mock ProseMirror state object with configurable properties
44
+ */
45
+ export function createMockState(options?: {}): {
46
+ selection: {
47
+ from: number;
48
+ to: number;
49
+ empty: boolean;
50
+ $head: {
51
+ marks: import("vitest").Mock<() => {
52
+ type: {
53
+ name: any;
54
+ };
55
+ }[]>;
56
+ };
57
+ $from: {
58
+ depth: number;
59
+ node: import("vitest").Mock<() => {
60
+ type: {
61
+ name: string;
62
+ };
63
+ }>;
64
+ };
65
+ $to: {
66
+ depth: number;
67
+ node: import("vitest").Mock<() => {
68
+ type: {
69
+ name: string;
70
+ };
71
+ }>;
72
+ };
73
+ constructor: {
74
+ near: import("vitest").Mock<() => {
75
+ from: number;
76
+ to: number;
77
+ }>;
78
+ };
79
+ };
80
+ doc: {
81
+ textBetween: import("vitest").Mock<() => string>;
82
+ nodeAt: import("vitest").Mock<() => {
83
+ type: {
84
+ name: string;
85
+ };
86
+ }>;
87
+ resolve: import("vitest").Mock<() => {}>;
88
+ };
89
+ schema: {
90
+ marks: {};
91
+ nodes: {
92
+ paragraph: {
93
+ name: string;
94
+ };
95
+ table: {
96
+ name: string;
97
+ };
98
+ bulletList: {
99
+ name: string;
100
+ };
101
+ documentSection: {
102
+ name: string;
103
+ };
104
+ };
105
+ };
106
+ storedMarks: any;
107
+ history: {
108
+ undoDepth: number;
109
+ redoDepth: number;
110
+ };
111
+ tr: {
112
+ setMeta: import("vitest").Mock<() => any>;
113
+ setSelection: import("vitest").Mock<() => any>;
114
+ };
115
+ };
116
+ /**
117
+ * Creates a mock ProseMirror view object with configurable properties
118
+ */
119
+ export function createMockView(options?: {}): {
120
+ state: {
121
+ selection: {
122
+ from: number;
123
+ to: number;
124
+ empty: boolean;
125
+ $head: {
126
+ marks: import("vitest").Mock<() => {
127
+ type: {
128
+ name: any;
129
+ };
130
+ }[]>;
131
+ };
132
+ $from: {
133
+ depth: number;
134
+ node: import("vitest").Mock<() => {
135
+ type: {
136
+ name: string;
137
+ };
138
+ }>;
139
+ };
140
+ $to: {
141
+ depth: number;
142
+ node: import("vitest").Mock<() => {
143
+ type: {
144
+ name: string;
145
+ };
146
+ }>;
147
+ };
148
+ constructor: {
149
+ near: import("vitest").Mock<() => {
150
+ from: number;
151
+ to: number;
152
+ }>;
153
+ };
154
+ };
155
+ doc: {
156
+ textBetween: import("vitest").Mock<() => string>;
157
+ nodeAt: import("vitest").Mock<() => {
158
+ type: {
159
+ name: string;
160
+ };
161
+ }>;
162
+ resolve: import("vitest").Mock<() => {}>;
163
+ };
164
+ schema: {
165
+ marks: {};
166
+ nodes: {
167
+ paragraph: {
168
+ name: string;
169
+ };
170
+ table: {
171
+ name: string;
172
+ };
173
+ bulletList: {
174
+ name: string;
175
+ };
176
+ documentSection: {
177
+ name: string;
178
+ };
179
+ };
180
+ };
181
+ storedMarks: any;
182
+ history: {
183
+ undoDepth: number;
184
+ redoDepth: number;
185
+ };
186
+ tr: {
187
+ setMeta: import("vitest").Mock<() => any>;
188
+ setSelection: import("vitest").Mock<() => any>;
189
+ };
190
+ };
191
+ coordsAtPos: import("vitest").Mock<() => {
192
+ left: number;
193
+ top: number;
194
+ }>;
195
+ posAtCoords: import("vitest").Mock<() => {
196
+ pos: number;
197
+ }>;
198
+ dispatch: import("vitest").Mock<(...args: any[]) => any>;
199
+ focus: import("vitest").Mock<(...args: any[]) => any>;
200
+ dom: {
201
+ addEventListener: import("vitest").Mock<(...args: any[]) => any>;
202
+ removeEventListener: import("vitest").Mock<(...args: any[]) => any>;
203
+ };
204
+ };
205
+ /**
206
+ * Creates a mock editor object with configurable options
207
+ */
208
+ export function createMockEditor(options?: {}): {
209
+ view: {
210
+ state: {
211
+ selection: {
212
+ from: number;
213
+ to: number;
214
+ empty: boolean;
215
+ $head: {
216
+ marks: import("vitest").Mock<() => {
217
+ type: {
218
+ name: any;
219
+ };
220
+ }[]>;
221
+ };
222
+ $from: {
223
+ depth: number;
224
+ node: import("vitest").Mock<() => {
225
+ type: {
226
+ name: string;
227
+ };
228
+ }>;
229
+ };
230
+ $to: {
231
+ depth: number;
232
+ node: import("vitest").Mock<() => {
233
+ type: {
234
+ name: string;
235
+ };
236
+ }>;
237
+ };
238
+ constructor: {
239
+ near: import("vitest").Mock<() => {
240
+ from: number;
241
+ to: number;
242
+ }>;
243
+ };
244
+ };
245
+ doc: {
246
+ textBetween: import("vitest").Mock<() => string>;
247
+ nodeAt: import("vitest").Mock<() => {
248
+ type: {
249
+ name: string;
250
+ };
251
+ }>;
252
+ resolve: import("vitest").Mock<() => {}>;
253
+ };
254
+ schema: {
255
+ marks: {};
256
+ nodes: {
257
+ paragraph: {
258
+ name: string;
259
+ };
260
+ table: {
261
+ name: string;
262
+ };
263
+ bulletList: {
264
+ name: string;
265
+ };
266
+ documentSection: {
267
+ name: string;
268
+ };
269
+ };
270
+ };
271
+ storedMarks: any;
272
+ history: {
273
+ undoDepth: number;
274
+ redoDepth: number;
275
+ };
276
+ tr: {
277
+ setMeta: import("vitest").Mock<() => any>;
278
+ setSelection: import("vitest").Mock<() => any>;
279
+ };
280
+ };
281
+ coordsAtPos: import("vitest").Mock<() => {
282
+ left: number;
283
+ top: number;
284
+ }>;
285
+ posAtCoords: import("vitest").Mock<() => {
286
+ pos: number;
287
+ }>;
288
+ dispatch: import("vitest").Mock<(...args: any[]) => any>;
289
+ focus: import("vitest").Mock<(...args: any[]) => any>;
290
+ dom: {
291
+ addEventListener: import("vitest").Mock<(...args: any[]) => any>;
292
+ removeEventListener: import("vitest").Mock<(...args: any[]) => any>;
293
+ };
294
+ };
295
+ options: {
296
+ documentMode: string;
297
+ isAiEnabled: boolean;
298
+ slashMenuConfig: any;
299
+ aiApiKey: any;
300
+ aiEndpoint: any;
301
+ };
302
+ isEditable: boolean;
303
+ commands: any;
304
+ on: import("vitest").Mock<(...args: any[]) => any>;
305
+ off: import("vitest").Mock<(...args: any[]) => any>;
306
+ emit: import("vitest").Mock<(...args: any[]) => any>;
307
+ };
308
+ /**
309
+ * Creates a mock editor context object for slash menu utilities
310
+ */
311
+ export function createMockContext(options?: {}): {
312
+ editor: any;
313
+ cursorPosition: {
314
+ x: number;
315
+ y: number;
316
+ };
317
+ pos: number;
318
+ node: {
319
+ type: {
320
+ name: string;
321
+ };
322
+ };
323
+ event: any;
324
+ selectedText: string;
325
+ hasSelection: boolean;
326
+ trigger: string;
327
+ clipboardContent: {
328
+ html: any;
329
+ text: any;
330
+ hasContent: boolean;
331
+ };
332
+ selectionStart: number;
333
+ selectionEnd: number;
334
+ isInTable: boolean;
335
+ isInList: boolean;
336
+ isInSectionNode: boolean;
337
+ currentNodeType: string;
338
+ activeMarks: any[];
339
+ isTrackedChange: boolean;
340
+ documentMode: string;
341
+ canUndo: boolean;
342
+ canRedo: boolean;
343
+ isEditable: boolean;
344
+ };
345
+ /**
346
+ * Sets up common mocks and returns cleanup functions
347
+ * Returns an object with mock functions and a cleanup function
348
+ */
349
+ export function setupCommonMocks(): {
350
+ mocks: {
351
+ readFromClipboard: import("vitest").Mock<(...args: any[]) => any>;
352
+ selectionHasNodeOrMark: import("vitest").Mock<() => boolean>;
353
+ moveCursorToMouseEvent: import("vitest").Mock<(...args: any[]) => any>;
354
+ handleClipboardPaste: import("vitest").Mock<() => boolean>;
355
+ };
356
+ spies: {
357
+ docAddEventListener: import("vitest").MockInstance<{
358
+ <K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
359
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
360
+ }>;
361
+ docRemoveEventListener: import("vitest").MockInstance<{
362
+ <K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
363
+ (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
364
+ }>;
365
+ };
366
+ cleanup: () => void;
367
+ };
368
+ /**
369
+ * Creates a beforeEach setup function with common mock resets
370
+ * Has a callback for any custom setup that needs to be done before each test
371
+ */
372
+ export function createBeforeEachSetup(customSetup?: () => void): () => void;
373
+ /**
374
+ * Mounts a Vue component with common props and returns wrapper with helper methods
375
+ */
376
+ export function mountSlashMenuComponent(component: any, options?: {}): {
377
+ wrapper: import("@vue/test-utils").VueWrapper<unknown, import("vue").ComponentPublicInstance<unknown, Omit<unknown, never>>>;
378
+ props: any;
379
+ openMenu(menuPosition?: {
380
+ left: string;
381
+ top: string;
382
+ }): Promise<void>;
383
+ closeMenu(): Promise<void>;
384
+ triggerKeydown(key: any, target?: string): Promise<void>;
385
+ };
386
+ /**
387
+ * Filters menu items by various criteria (helper for testing menu item filtering)
388
+ */
389
+ export function filterMenuItems(sections: any, criteria?: {}): any;
390
+ /**
391
+ * Creates mock menu items for testing
392
+ */
393
+ export function createMockMenuItems(count?: number, customItems?: any[]): {
394
+ id: string;
395
+ items: any[];
396
+ }[];
397
+ /**
398
+ * Creates a mock item with custom render function for testing
399
+ */
400
+ export function createMockRenderItem(id?: string, renderFn?: any): {
401
+ id: string;
402
+ label: string;
403
+ render: any;
404
+ allowedTriggers: string[];
405
+ };
406
+ /**
407
+ * Common assertions for editor mock objects
408
+ */
409
+ export function assertEditorMockStructure(editor: any): void;
410
+ /**
411
+ * Common assertions for menu sections structure
412
+ */
413
+ export function assertMenuSectionsStructure(sections: any): void;
414
+ /**
415
+ * Asserts that event listeners are properly set up
416
+ */
417
+ export function assertEventListenersSetup(editor: any, documentSpies: any): void;
418
+ /**
419
+ * Asserts that event listeners are properly cleaned up
420
+ */
421
+ export function assertEventListenersCleanup(editor: any, documentSpies: any): void;
422
+ export namespace SlashMenuConfigs {
423
+ namespace withAI {
424
+ let includeDefaultItems: boolean;
425
+ let customItems: any[];
426
+ }
427
+ namespace customOnly {
428
+ let includeDefaultItems_1: boolean;
429
+ export { includeDefaultItems_1 as includeDefaultItems };
430
+ let customItems_1: {
431
+ id: string;
432
+ items: {
433
+ id: string;
434
+ label: string;
435
+ allowedTriggers: string[];
436
+ action: import("vitest").Mock<(...args: any[]) => any>;
437
+ }[];
438
+ }[];
439
+ export { customItems_1 as customItems };
440
+ }
441
+ function withProvider(providerFn: any): {
442
+ includeDefaultItems: boolean;
443
+ menuProvider: any;
444
+ };
445
+ namespace withConditionalItems {
446
+ let includeDefaultItems_2: boolean;
447
+ export { includeDefaultItems_2 as includeDefaultItems };
448
+ let customItems_2: {
449
+ id: string;
450
+ items: ({
451
+ id: string;
452
+ label: string;
453
+ allowedTriggers: string[];
454
+ action: import("vitest").Mock<(...args: any[]) => any>;
455
+ showWhen?: undefined;
456
+ } | {
457
+ id: string;
458
+ label: string;
459
+ allowedTriggers: string[];
460
+ action: import("vitest").Mock<(...args: any[]) => any>;
461
+ showWhen: (context: any) => any;
462
+ })[];
463
+ }[];
464
+ export { customItems_2 as customItems };
465
+ }
466
+ }
@@ -3,7 +3,14 @@
3
3
  *
4
4
  * @param {Object} editor - The editor instance
5
5
  * @param {MouseEvent} [event] - Optional mouse event (for context menu)
6
- * @returns {Object} context - { editor, selectedText, pos, node, event }
6
+ * @returns {Promise<Object>} context - Enhanced editor context with comprehensive state information
7
7
  */
8
- export function getEditorContext(editor: any, event?: MouseEvent): any;
8
+ export function getEditorContext(editor: any, event?: MouseEvent): Promise<any>;
9
9
  export function getPropsByItemId(itemId: string, props: any): any;
10
+ declare function getStructureFromResolvedPos(state: any, pos: any): {
11
+ isInTable: boolean;
12
+ isInList: boolean;
13
+ isInSectionNode: boolean;
14
+ };
15
+ declare function isCollaborationEnabled(editor: any): boolean;
16
+ export { getStructureFromResolvedPos as __getStructureFromResolvedPosForTest, isCollaborationEnabled as __isCollaborationEnabledForTest };
@@ -0,0 +1,6 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * @type {import('@translator').NodeTranslator}
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./alternate-content-translator.js";
@@ -0,0 +1,2 @@
1
+ export function queryWithinRoot(domNode: any, selector: any): any;
2
+ export function findInEventPath(event: any, selector: any): any;
@@ -1,4 +1,5 @@
1
1
  export function getTestDataByFileName(name: string): Promise<any>;
2
+ export function getExtractedDocxData(folderName: any): Promise<{}>;
2
3
  export function getTestDataAsFileBuffer(name: any): Promise<Buffer<ArrayBufferLike>>;
3
4
  export function loadTestDataForEditorTests(filename: string): Promise<[any, any, any, any]>;
4
5
  export function initTestEditor(options?: any): Editor;
@@ -0,0 +1,12 @@
1
+ export function supportsConstructableStylesheets(): boolean;
2
+ export function ensureStyleSheet(root: ShadowRoot | (DocumentFragment & {
3
+ adoptedStyleSheets?: CSSStyleSheet[];
4
+ })): void;
5
+ export function ensureEditorShadowRoot(hostElement: HTMLElement | null): {
6
+ root: ShadowRoot | null;
7
+ mount: HTMLElement | null;
8
+ };
9
+ export function __shadowRootTestUtils(): {
10
+ resetStyleSheetCache: () => void;
11
+ };
12
+ export function __getEditorStylesForTest(): string;
@@ -279,7 +279,7 @@
279
279
  border-radius: 8px !important;
280
280
  }
281
281
 
282
- .button-group[data-v-f42ec7e6] {
282
+ .button-group[data-v-c1b3551b] {
283
283
  display: flex;
284
284
  }
285
285
 
@@ -1748,6 +1748,11 @@ on the right if it is inside shape textbox.
1748
1748
  height: 12px;
1749
1749
  width: 12px;
1750
1750
  }
1751
+ .slash-menu-custom-item {
1752
+ display: flex;
1753
+ align-items: center;
1754
+ width: 100%;
1755
+ }
1751
1756
  .popover {
1752
1757
  background: white;
1753
1758
  border-radius: 6px;
@@ -1836,10 +1841,10 @@ on the right if it is inside shape textbox.
1836
1841
  min-height: 40px;
1837
1842
  }
1838
1843
 
1839
- .editor-element[data-v-0c36dd72] {
1844
+ .editor-element[data-v-3d49a1a6] {
1840
1845
  position: relative;
1841
1846
  }
1842
- .super-editor-container[data-v-0c36dd72] {
1847
+ .super-editor-container[data-v-3d49a1a6] {
1843
1848
  width: auto;
1844
1849
  height: auto;
1845
1850
  min-width: 8in;
@@ -1848,13 +1853,13 @@ on the right if it is inside shape textbox.
1848
1853
  display: flex;
1849
1854
  flex-direction: column;
1850
1855
  }
1851
- .ruler[data-v-0c36dd72] {
1856
+ .ruler[data-v-3d49a1a6] {
1852
1857
  margin-bottom: 2px;
1853
1858
  }
1854
- .super-editor[data-v-0c36dd72] {
1859
+ .super-editor[data-v-3d49a1a6] {
1855
1860
  color: initial;
1856
1861
  }
1857
- .placeholder-editor[data-v-0c36dd72] {
1862
+ .placeholder-editor[data-v-3d49a1a6] {
1858
1863
  position: absolute;
1859
1864
  top: 0;
1860
1865
  left: 0;
@@ -1866,13 +1871,13 @@ on the right if it is inside shape textbox.
1866
1871
  background-color: white;
1867
1872
  box-sizing: border-box;
1868
1873
  }
1869
- .placeholder-title[data-v-0c36dd72] {
1874
+ .placeholder-title[data-v-3d49a1a6] {
1870
1875
  display: flex;
1871
1876
  justify-content: center;
1872
1877
  margin-bottom: 40px;
1873
1878
  }
1874
1879
 
1875
- .super-editor[data-v-4d5cff52] {
1880
+ .super-editor[data-v-23a4e794] {
1876
1881
  box-sizing: border-box;
1877
1882
  width: 100%;
1878
1883
  height: 100%;
@@ -1881,17 +1886,17 @@ on the right if it is inside shape textbox.
1881
1886
  transition: border 0.2s ease;
1882
1887
  background-color: white;
1883
1888
  }
1884
- .super-input[data-v-4d5cff52] {
1889
+ .super-input[data-v-23a4e794] {
1885
1890
  font-size: 13px;
1886
1891
  font-family: inherit;
1887
1892
  }
1888
- .editor-element[data-v-4d5cff52] {
1893
+ .editor-element[data-v-23a4e794] {
1889
1894
  height: 100%;
1890
1895
  width: 100%;
1891
1896
  border: none;
1892
1897
  outline: none;
1893
1898
  }
1894
- .super-input-active[data-v-4d5cff52] {
1899
+ .super-input-active[data-v-23a4e794] {
1895
1900
  border: 1px solid #007bff;
1896
1901
  outline: none;
1897
1902
  }