@kerebron/extension-menu 0.4.3 → 0.4.5

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 (142) hide show
  1. package/README.md +80 -0
  2. package/assets/custom-menu.css +26 -6
  3. package/assets/menu.css +2 -2
  4. package/esm/_dnt.polyfills.d.ts +101 -0
  5. package/esm/_dnt.polyfills.d.ts.map +1 -0
  6. package/esm/_dnt.polyfills.js +127 -0
  7. package/esm/editor/src/utilities/getShadowRoot.d.ts +2 -0
  8. package/esm/editor/src/utilities/getShadowRoot.d.ts.map +1 -0
  9. package/esm/editor/src/utilities/getShadowRoot.js +16 -0
  10. package/esm/editor/src/utilities/mod.d.ts +6 -0
  11. package/esm/editor/src/utilities/mod.d.ts.map +1 -0
  12. package/esm/editor/src/utilities/mod.js +5 -0
  13. package/esm/editor/src/utilities/toRawTextResult.d.ts +3 -0
  14. package/esm/editor/src/utilities/toRawTextResult.d.ts.map +1 -0
  15. package/esm/editor/src/utilities/toRawTextResult.js +21 -0
  16. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +8 -0
  17. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +1 -0
  18. package/esm/extension-autocomplete/src/AutocompletePlugin.js +232 -0
  19. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +17 -0
  20. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +1 -0
  21. package/esm/extension-autocomplete/src/DefaultRenderer.js +137 -0
  22. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +26 -0
  23. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +1 -0
  24. package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +30 -0
  25. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +11 -0
  26. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +1 -0
  27. package/esm/extension-autocomplete/src/createDefaultMatcher.js +58 -0
  28. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +4 -0
  29. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +1 -0
  30. package/esm/extension-autocomplete/src/createRegexMatcher.js +50 -0
  31. package/esm/extension-autocomplete/src/mod.d.ts +3 -0
  32. package/esm/extension-autocomplete/src/mod.d.ts.map +1 -0
  33. package/esm/extension-autocomplete/src/mod.js +2 -0
  34. package/esm/extension-autocomplete/src/types.d.ts +60 -0
  35. package/esm/extension-autocomplete/src/types.d.ts.map +1 -0
  36. package/esm/extension-autocomplete/src/types.js +1 -0
  37. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +15 -0
  38. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +1 -0
  39. package/esm/extension-basic-editor/src/ExtensionHtml.js +108 -0
  40. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +32 -0
  41. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +1 -0
  42. package/esm/extension-lsp/src/DiagnosticPlugin.js +131 -0
  43. package/esm/extension-lsp/src/ExtensionLsp.d.ts +25 -0
  44. package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +1 -0
  45. package/esm/extension-lsp/src/ExtensionLsp.js +126 -0
  46. package/esm/extension-lsp/src/LSPClient.d.ts +56 -0
  47. package/esm/extension-lsp/src/LSPClient.d.ts.map +1 -0
  48. package/esm/extension-lsp/src/LSPClient.js +449 -0
  49. package/esm/extension-lsp/src/LspStatus.d.ts +34 -0
  50. package/esm/extension-lsp/src/LspStatus.d.ts.map +1 -0
  51. package/esm/extension-lsp/src/LspStatus.js +127 -0
  52. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +8 -0
  53. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +1 -0
  54. package/esm/extension-lsp/src/computeIncrementalChanges.js +82 -0
  55. package/esm/extension-lsp/src/createLspAutocomplete.d.ts +23 -0
  56. package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +1 -0
  57. package/esm/extension-lsp/src/createLspAutocomplete.js +68 -0
  58. package/esm/extension-lsp/src/workspace.d.ts +62 -0
  59. package/esm/extension-lsp/src/workspace.d.ts.map +1 -0
  60. package/esm/extension-lsp/src/workspace.js +168 -0
  61. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +36 -0
  62. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +1 -0
  63. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +240 -0
  64. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +26 -0
  65. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +1 -0
  66. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +115 -0
  67. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +22 -0
  68. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +1 -0
  69. package/esm/extension-markdown/src/ExtensionMarkdown.js +48 -0
  70. package/esm/extension-markdown/src/MarkdownParser.d.ts +61 -0
  71. package/esm/extension-markdown/src/MarkdownParser.d.ts.map +1 -0
  72. package/esm/extension-markdown/src/MarkdownParser.js +249 -0
  73. package/esm/extension-markdown/src/MarkdownSerializer.d.ts +42 -0
  74. package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +1 -0
  75. package/esm/extension-markdown/src/MarkdownSerializer.js +325 -0
  76. package/esm/extension-markdown/src/PositionMapper.d.ts +15 -0
  77. package/esm/extension-markdown/src/PositionMapper.d.ts.map +1 -0
  78. package/esm/extension-markdown/src/PositionMapper.js +100 -0
  79. package/esm/extension-markdown/src/TokenSource.d.ts +11 -0
  80. package/esm/extension-markdown/src/TokenSource.d.ts.map +1 -0
  81. package/esm/extension-markdown/src/TokenSource.js +39 -0
  82. package/esm/extension-markdown/src/mdToPmConverter.d.ts +5 -0
  83. package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +1 -0
  84. package/esm/extension-markdown/src/mdToPmConverter.js +111 -0
  85. package/esm/extension-markdown/src/pmToMdConverter.d.ts +16 -0
  86. package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +1 -0
  87. package/esm/extension-markdown/src/pmToMdConverter.js +433 -0
  88. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +4 -0
  89. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +1 -0
  90. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +151 -0
  91. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +3 -0
  92. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +1 -0
  93. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +34 -0
  94. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +6 -0
  95. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +1 -0
  96. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +380 -0
  97. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +3 -0
  98. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +1 -0
  99. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +323 -0
  100. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +9 -0
  101. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +1 -0
  102. package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +308 -0
  103. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +5 -0
  104. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +1 -0
  105. package/esm/extension-markdown/src/treeSitterTokenizer.js +769 -0
  106. package/esm/extension-markdown/src/types.d.ts +28 -0
  107. package/esm/extension-markdown/src/types.d.ts.map +1 -0
  108. package/esm/extension-markdown/src/types.js +131 -0
  109. package/esm/extension-markdown/src/utils.d.ts +8 -0
  110. package/esm/extension-markdown/src/utils.d.ts.map +1 -0
  111. package/esm/extension-markdown/src/utils.js +86 -0
  112. package/esm/extension-menu/src/CustomMenuPlugin.d.ts +7 -3
  113. package/esm/extension-menu/src/CustomMenuPlugin.d.ts.map +1 -1
  114. package/esm/extension-menu/src/CustomMenuPlugin.js +60 -4
  115. package/esm/extension-menu/src/ExtensionCustomMenu.d.ts +6 -2
  116. package/esm/extension-menu/src/ExtensionCustomMenu.d.ts.map +1 -1
  117. package/esm/extension-menu/src/ExtensionCustomMenu.js +36 -1
  118. package/esm/extension-menu/src/mod.d.ts +1 -0
  119. package/esm/extension-menu/src/mod.d.ts.map +1 -1
  120. package/esm/extension-menu/src/mod.js +1 -0
  121. package/esm/extension-yjs/src/CollaborationStatus.d.ts +59 -0
  122. package/esm/extension-yjs/src/CollaborationStatus.d.ts.map +1 -0
  123. package/esm/extension-yjs/src/CollaborationStatus.js +286 -0
  124. package/esm/tree-sitter-shim/src/main.d.ts +15 -0
  125. package/esm/tree-sitter-shim/src/main.d.ts.map +1 -0
  126. package/esm/tree-sitter-shim/src/main.js +25 -0
  127. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +6 -0
  128. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +1 -0
  129. package/esm/tree-sitter-shim/src/tree_sitter/node.js +1 -0
  130. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +7 -0
  131. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +1 -0
  132. package/esm/tree-sitter-shim/src/tree_sitter/parser.js +5 -0
  133. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +6 -0
  134. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +1 -0
  135. package/esm/tree-sitter-shim/src/tree_sitter/tree.js +1 -0
  136. package/esm/wasm/src/mod.d.ts +12 -0
  137. package/esm/wasm/src/mod.d.ts.map +1 -0
  138. package/esm/wasm/src/mod.js +48 -0
  139. package/esm/wasm/wasm.d.ts +138 -0
  140. package/esm/wasm/wasm.d.ts.map +1 -0
  141. package/esm/wasm/wasm.js +120 -0
  142. package/package.json +4 -2
package/README.md CHANGED
@@ -8,6 +8,86 @@ Custom menu system for ProseMirror editors with pinnable tools and overflow mana
8
8
  - **Overflow Menu**: Tools that don't fit in the toolbar appear in an overflow menu
9
9
  - **Mobile Responsive**: Automatically limits toolbar to 4 tools on narrow screens (< 768px)
10
10
  - **State Persistence**: Pinned tool configuration saved to localStorage
11
+ - **Trailing Elements**: Support for fixed elements on the right side of the toolbar (e.g., status indicators)
12
+ - **Auto YJS Integration**: Automatically adds collaboration status when YJS extension is detected
13
+ - **Auto LSP Integration**: Automatically adds LSP status when LSP extension is detected
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import { ExtensionCustomMenu } from '@kerebron/extension-menu';
19
+
20
+ // Basic usage - auto-detects YJS and LSP, adds status indicators
21
+ new Editor({
22
+ extensions: [
23
+ // ... other extensions
24
+ ExtensionYjs({ ydoc, provider }), // Optional: for collaboration
25
+ ExtensionLsp({ getLspTransport }), // Optional: for LSP support
26
+ ExtensionCustomMenu(), // Must come LAST for auto-detection
27
+ ],
28
+ });
29
+
30
+ // Disable auto status indicators
31
+ new Editor({
32
+ extensions: [
33
+ ExtensionCustomMenu({
34
+ autoAddCollaborationStatus: false,
35
+ autoAddLspStatus: false,
36
+ }),
37
+ // ... other extensions
38
+ ],
39
+ });
40
+
41
+ // Custom trailing elements
42
+ import { CollaborationStatusElement } from '@kerebron/extension-yjs/CollaborationStatus';
43
+ import { LspStatusElement } from '@kerebron/extension-lsp/LspStatus';
44
+
45
+ new Editor({
46
+ extensions: [
47
+ ExtensionCustomMenu({
48
+ autoAddCollaborationStatus: false,
49
+ autoAddLspStatus: false,
50
+ trailingElements: [
51
+ new CollaborationStatusElement({ awareness, provider }),
52
+ new LspStatusElement({ lspExtension, label: 'LSP' }),
53
+ ],
54
+ }),
55
+ // ... other extensions
56
+ ],
57
+ });
58
+ ```
59
+
60
+ ## Extension Order
61
+
62
+ **Important**: For auto-detection to work, `ExtensionCustomMenu` must be registered **after** any extensions you want it to detect:
63
+
64
+ ```typescript
65
+ extensions: [
66
+ // ... other extensions
67
+ new ExtensionYjs({ ... }), // Register first (if using)
68
+ new ExtensionLsp({ ... }), // Register second (if using)
69
+ new ExtensionCustomMenu(), // Register LAST for auto-detection
70
+ ]
71
+ ```
72
+
73
+ ## Options
74
+
75
+ | Option | Type | Default | Description |
76
+ |--------|------|---------|-------------|
77
+ | `content` | `MenuElement[][]` | Auto-generated | Custom menu content (pinnable tools) |
78
+ | `trailingElements` | `MenuElement[]` | `[]` | Fixed elements on the right side of toolbar |
79
+ | `autoAddCollaborationStatus` | `boolean` | `true` | Auto-add collaboration status when YJS is detected |
80
+ | `autoAddLspStatus` | `boolean` | `true` | Auto-add LSP status when LSP extension is detected |
81
+
82
+ ## CSS Imports
83
+
84
+ Don't forget to import the necessary CSS files:
85
+
86
+ ```typescript
87
+ import '@kerebron/extension-menu/assets/custom-menu.css';
88
+ import '@kerebron/extension-yjs/assets/collaboration-status.css'; // If using YJS
89
+ import '@kerebron/extension-lsp/assets/lsp-status.css'; // If using LSP
90
+ ```
11
91
 
12
92
  ## Debug Mode
13
93
 
@@ -74,7 +74,7 @@
74
74
  padding: 6px var(--kb-space-sm);
75
75
  background: var(--kb-color-surface-elevated);
76
76
  border-bottom: 1px solid var(--kb-color-border-strong);
77
- z-index: 1000;
77
+ z-index: var(--kb-z-dropdown, 100);
78
78
  overflow: visible;
79
79
  }
80
80
 
@@ -188,6 +188,24 @@
188
188
  margin-left: auto;
189
189
  }
190
190
 
191
+ /* Trailing separator (before trailing elements) */
192
+ .kb-custom-menu__separator--trailing {
193
+ margin-left: 0;
194
+ }
195
+
196
+ /* Trailing elements group (always visible, not pinnable) */
197
+ .kb-custom-menu__trailing-group {
198
+ display: flex;
199
+ align-items: center;
200
+ gap: var(--kb-space-xs);
201
+ flex-shrink: 0;
202
+ }
203
+
204
+ .kb-custom-menu__trailing-item {
205
+ display: inline-flex;
206
+ align-items: center;
207
+ }
208
+
191
209
  /* Overflow toggle button (3-dot menu) */
192
210
  .kb-custom-menu__overflow-toggle {
193
211
  display: inline-flex;
@@ -226,7 +244,7 @@
226
244
  border: 1px solid var(--kb-color-border-strong);
227
245
  border-radius: var(--kb-radius-lg);
228
246
  box-shadow: var(--kb-shadow-lg);
229
- z-index: 1001;
247
+ z-index: calc(var(--kb-z-dropdown, 100) + 1);
230
248
  max-height: 80vh;
231
249
  display: flex;
232
250
  flex-direction: column;
@@ -276,7 +294,7 @@
276
294
  padding: var(--kb-space-sm) 0;
277
295
  border: none;
278
296
  background: transparent;
279
- color: var(--kb-color-text);
297
+ color: var(--kb-menu-dropdown-dark-text);
280
298
  cursor: pointer;
281
299
  border-radius: 0;
282
300
  transition: none;
@@ -361,7 +379,7 @@
361
379
  /* Overflow item label */
362
380
  .kb-custom-menu__overflow-item-label {
363
381
  flex: 1;
364
- color: var(--kb-color-text);
382
+ color: var(--kb-menu-dropdown-dark-text);
365
383
  font-size: var(--kb-text-sm);
366
384
  white-space: nowrap;
367
385
  overflow: hidden;
@@ -374,7 +392,8 @@
374
392
  align-items: center;
375
393
  margin-left: auto;
376
394
  padding-left: var(--kb-space-sm);
377
- color: var(--kb-color-text-muted);
395
+ color: var(--kb-menu-dropdown-dark-text);
396
+ opacity: 0.7;
378
397
  }
379
398
 
380
399
  .kb-custom-menu__overflow-item-chevron svg {
@@ -484,7 +503,7 @@
484
503
  right: 0;
485
504
  bottom: 0;
486
505
  background: rgba(0, 0, 0, 0.5);
487
- z-index: 10000;
506
+ z-index: var(--kb-z-modal, 300);
488
507
  display: flex;
489
508
  align-items: center;
490
509
  justify-content: center;
@@ -830,6 +849,7 @@
830
849
  min-width: 200px;
831
850
  max-width: 300px;
832
851
  background: var(--kb-menu-dropdown-dark-bg) !important;
852
+ color: var(--kb-menu-dropdown-dark-text);
833
853
  border: 1px solid var(--kb-color-border-strong);
834
854
  border-radius: var(--kb-radius-lg);
835
855
  box-shadow: var(--kb-shadow-lg);
package/assets/menu.css CHANGED
@@ -15,7 +15,7 @@
15
15
  padding: 4px 8px;
16
16
  background: #f9f9f9;
17
17
  border-bottom: 1px solid #dadce0;
18
- z-index: var(--kb-z-dropdown, 1000);
18
+ z-index: var(--kb-z-dropdown, 100);
19
19
  overflow: visible;
20
20
  }
21
21
 
@@ -122,7 +122,7 @@
122
122
 
123
123
  .kb-menu {
124
124
  background-color: var(--kb-color-surface);
125
- z-index: 10000;
125
+ z-index: var(--kb-z-dropdown, 100);
126
126
  }
127
127
 
128
128
  /* Toolbar items */
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
3
+ * but instead of using npm to install additional dependencies,
4
+ * this approach manually consolidates cjs/mjs/d.ts into a single file.
5
+ *
6
+ * Note that this code might be imported multiple times
7
+ * (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
8
+ * or Node.js might dynamically clear the cache and then force a require).
9
+ * Therefore, it's important to avoid redundant writes to global objects.
10
+ * Additionally, consider that commonjs is used alongside esm,
11
+ * so the two ponyfill functions are stored independently in two separate global objects.
12
+ */
13
+ import { createRequire } from "node:module";
14
+ import { type URL } from "node:url";
15
+ declare global {
16
+ interface ImportMeta {
17
+ /** A string representation of the fully qualified module URL. When the
18
+ * module is loaded locally, the value will be a file URL (e.g.
19
+ * `file:///path/module.ts`).
20
+ *
21
+ * You can also parse the string as a URL to determine more information about
22
+ * how the current module was loaded. For example to determine if a module was
23
+ * local or not:
24
+ *
25
+ * ```ts
26
+ * const url = new URL(import.meta.url);
27
+ * if (url.protocol === "file:") {
28
+ * console.log("this module was loaded locally");
29
+ * }
30
+ * ```
31
+ */
32
+ url: string;
33
+ /**
34
+ * A function that returns resolved specifier as if it would be imported
35
+ * using `import(specifier)`.
36
+ *
37
+ * ```ts
38
+ * console.log(import.meta.resolve("./foo.js"));
39
+ * // file:///dev/foo.js
40
+ * ```
41
+ *
42
+ * @param specifier The module specifier to resolve relative to `parent`.
43
+ * @param parent The absolute parent module URL to resolve from.
44
+ * @returns The absolute (`file:`) URL string for the resolved module.
45
+ */
46
+ resolve(specifier: string, parent?: string | URL | undefined): string;
47
+ /** A flag that indicates if the current module is the main module that was
48
+ * called when starting the program under Deno.
49
+ *
50
+ * ```ts
51
+ * if (import.meta.main) {
52
+ * // this was loaded as the main module, maybe do some bootstrapping
53
+ * }
54
+ * ```
55
+ */
56
+ main: boolean;
57
+ /** The absolute path of the current module.
58
+ *
59
+ * This property is only provided for local modules (ie. using `file://` URLs).
60
+ *
61
+ * Example:
62
+ * ```
63
+ * // Unix
64
+ * console.log(import.meta.filename); // /home/alice/my_module.ts
65
+ *
66
+ * // Windows
67
+ * console.log(import.meta.filename); // C:\alice\my_module.ts
68
+ * ```
69
+ */
70
+ filename: string;
71
+ /** The absolute path of the directory containing the current module.
72
+ *
73
+ * This property is only provided for local modules (ie. using `file://` URLs).
74
+ *
75
+ * * Example:
76
+ * ```
77
+ * // Unix
78
+ * console.log(import.meta.dirname); // /home/alice
79
+ *
80
+ * // Windows
81
+ * console.log(import.meta.dirname); // C:\alice
82
+ * ```
83
+ */
84
+ dirname: string;
85
+ }
86
+ }
87
+ type NodeRequest = ReturnType<typeof createRequire>;
88
+ type NodeModule = NonNullable<NodeRequest["main"]>;
89
+ interface ImportMetaPonyfillCommonjs {
90
+ (require: NodeRequest, module: NodeModule): ImportMeta;
91
+ }
92
+ interface ImportMetaPonyfillEsmodule {
93
+ (importMeta: ImportMeta): ImportMeta;
94
+ }
95
+ interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
96
+ }
97
+ export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
98
+ export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
99
+ export declare let import_meta_ponyfill: ImportMetaPonyfill;
100
+ export {};
101
+ //# sourceMappingURL=_dnt.polyfills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
3
+ * but instead of using npm to install additional dependencies,
4
+ * this approach manually consolidates cjs/mjs/d.ts into a single file.
5
+ *
6
+ * Note that this code might be imported multiple times
7
+ * (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
8
+ * or Node.js might dynamically clear the cache and then force a require).
9
+ * Therefore, it's important to avoid redundant writes to global objects.
10
+ * Additionally, consider that commonjs is used alongside esm,
11
+ * so the two ponyfill functions are stored independently in two separate global objects.
12
+ */
13
+ //@ts-ignore
14
+ import { createRequire } from "node:module";
15
+ //@ts-ignore
16
+ import { fileURLToPath, pathToFileURL } from "node:url";
17
+ //@ts-ignore
18
+ import { dirname } from "node:path";
19
+ const defineGlobalPonyfill = (symbolFor, fn) => {
20
+ if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
21
+ Object.defineProperty(globalThis, Symbol.for(symbolFor), {
22
+ configurable: true,
23
+ get() {
24
+ return fn;
25
+ },
26
+ });
27
+ }
28
+ };
29
+ export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
30
+ (() => {
31
+ const moduleImportMetaWM = new WeakMap();
32
+ return (require, module) => {
33
+ let importMetaCache = moduleImportMetaWM.get(module);
34
+ if (importMetaCache == null) {
35
+ const importMeta = Object.assign(Object.create(null), {
36
+ url: pathToFileURL(module.filename).href,
37
+ main: require.main == module,
38
+ resolve: (specifier, parentURL = importMeta.url) => {
39
+ return pathToFileURL((importMeta.url === parentURL
40
+ ? require
41
+ : createRequire(parentURL))
42
+ .resolve(specifier)).href;
43
+ },
44
+ filename: module.filename,
45
+ dirname: module.path,
46
+ });
47
+ moduleImportMetaWM.set(module, importMeta);
48
+ importMetaCache = importMeta;
49
+ }
50
+ return importMetaCache;
51
+ };
52
+ })());
53
+ defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
54
+ export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
55
+ ((importMeta) => {
56
+ const resolveFunStr = String(importMeta.resolve);
57
+ const shimWs = new WeakSet();
58
+ //@ts-ignore
59
+ const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
60
+ .replace(/\/{3,}/, "///");
61
+ const commonShim = (importMeta) => {
62
+ if (typeof importMeta.main !== "boolean") {
63
+ importMeta.main = importMeta.url === mainUrl;
64
+ }
65
+ if (typeof importMeta.filename !== "string") {
66
+ importMeta.filename = fileURLToPath(importMeta.url);
67
+ importMeta.dirname = dirname(importMeta.filename);
68
+ }
69
+ };
70
+ if (
71
+ // v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
72
+ resolveFunStr === "undefined" ||
73
+ // v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
74
+ resolveFunStr.startsWith("async")
75
+ // enable by --experimental-import-meta-resolve flag
76
+ ) {
77
+ import_meta_ponyfill_esmodule = (importMeta) => {
78
+ if (!shimWs.has(importMeta)) {
79
+ shimWs.add(importMeta);
80
+ const importMetaUrlRequire = {
81
+ url: importMeta.url,
82
+ require: createRequire(importMeta.url),
83
+ };
84
+ importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
85
+ return pathToFileURL((importMetaUrlRequire.url === parentURL
86
+ ? importMetaUrlRequire.require
87
+ : createRequire(parentURL)).resolve(specifier)).href;
88
+ };
89
+ commonShim(importMeta);
90
+ }
91
+ return importMeta;
92
+ };
93
+ }
94
+ else {
95
+ /// native support
96
+ import_meta_ponyfill_esmodule = (importMeta) => {
97
+ if (!shimWs.has(importMeta)) {
98
+ shimWs.add(importMeta);
99
+ commonShim(importMeta);
100
+ }
101
+ return importMeta;
102
+ };
103
+ }
104
+ return import_meta_ponyfill_esmodule(importMeta);
105
+ }));
106
+ defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
107
+ export let import_meta_ponyfill = ((...args) => {
108
+ const _MODULE = (() => {
109
+ if (typeof require === "function" && typeof module === "object") {
110
+ return "commonjs";
111
+ }
112
+ else {
113
+ // eval("typeof import.meta");
114
+ return "esmodule";
115
+ }
116
+ })();
117
+ if (_MODULE === "commonjs") {
118
+ //@ts-ignore
119
+ import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
120
+ }
121
+ else {
122
+ //@ts-ignore
123
+ import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
124
+ }
125
+ //@ts-ignore
126
+ return import_meta_ponyfill(...args);
127
+ });
@@ -0,0 +1,2 @@
1
+ export declare function getShadowRoot(element?: Element): ShadowRoot | undefined;
2
+ //# sourceMappingURL=getShadowRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getShadowRoot.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/getShadowRoot.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAiBvE"}
@@ -0,0 +1,16 @@
1
+ export function getShadowRoot(element) {
2
+ let current = element;
3
+ while (current) {
4
+ if (current.toString() === '[object ShadowRoot]') {
5
+ return current;
6
+ }
7
+ if (current instanceof ShadowRoot) {
8
+ if (current.host) {
9
+ return current.host.shadowRoot || undefined;
10
+ }
11
+ }
12
+ current = current.parentElement ||
13
+ ((current instanceof ShadowRoot) ? current.host : undefined);
14
+ }
15
+ return undefined;
16
+ }
@@ -0,0 +1,6 @@
1
+ export * from './getHtmlAttributes.js';
2
+ export * from './createNodeFromContent.js';
3
+ export * from './SmartOutput.js';
4
+ export * from './getShadowRoot.js';
5
+ export * from './toRawTextResult.js';
6
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/mod.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './getHtmlAttributes.js';
2
+ export * from './createNodeFromContent.js';
3
+ export * from './SmartOutput.js';
4
+ export * from './getShadowRoot.js';
5
+ export * from './toRawTextResult.js';
@@ -0,0 +1,3 @@
1
+ import { RawTextResult } from '../types.js';
2
+ export declare function toRawTextResult(content: string, nodeIdx?: number): RawTextResult;
3
+ //# sourceMappingURL=toRawTextResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toRawTextResult.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/toRawTextResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,aAAa,CAwB3E"}
@@ -0,0 +1,21 @@
1
+ export function toRawTextResult(content, nodeIdx = 0) {
2
+ const lines = content.split('\n');
3
+ const rawTextMap = [];
4
+ let targetPos = 0;
5
+ let targetRow = 0;
6
+ for (const line of lines) {
7
+ rawTextMap.push({
8
+ nodeIdx,
9
+ targetRow,
10
+ targetCol: 0,
11
+ targetPos,
12
+ });
13
+ targetRow++;
14
+ targetPos += line.length + 1;
15
+ nodeIdx += line.length + 1;
16
+ }
17
+ return {
18
+ content,
19
+ rawTextMap,
20
+ };
21
+ }
@@ -0,0 +1,8 @@
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ import { type CoreEditor } from '../../editor/src/mod.js';
3
+ import type { AutocompleteConfig } from './ExtensionAutocomplete.js';
4
+ export declare const AutocompletePluginKey: PluginKey<any>;
5
+ export declare class AutocompletePlugin<Item, TSelected> extends Plugin {
6
+ constructor(config: AutocompleteConfig, editor: CoreEditor);
7
+ }
8
+ //# sourceMappingURL=AutocompletePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutocompletePlugin.d.ts","sourceRoot":"","sources":["../../../src/extension-autocomplete/src/AutocompletePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,yBAAyB,CAAC;AAE1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AASrE,eAAO,MAAM,qBAAqB,gBAAgC,CAAC;AAEnE,qBAAa,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAE,SAAQ,MAAM;gBACjD,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU;CA2R3D"}