@kerebron/extension-yjs 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 (162) hide show
  1. package/README.md +128 -50
  2. package/assets/collaboration-status.css +172 -0
  3. package/esm/_dnt.polyfills.d.ts +101 -0
  4. package/esm/_dnt.polyfills.d.ts.map +1 -0
  5. package/esm/_dnt.polyfills.js +127 -0
  6. package/esm/_dnt.shims.d.ts +2 -0
  7. package/esm/_dnt.shims.d.ts.map +1 -0
  8. package/esm/_dnt.shims.js +57 -0
  9. package/esm/editor/src/utilities/getShadowRoot.d.ts +2 -0
  10. package/esm/editor/src/utilities/getShadowRoot.d.ts.map +1 -0
  11. package/esm/editor/src/utilities/getShadowRoot.js +16 -0
  12. package/esm/editor/src/utilities/mod.d.ts +6 -0
  13. package/esm/editor/src/utilities/mod.d.ts.map +1 -0
  14. package/esm/editor/src/utilities/mod.js +5 -0
  15. package/esm/editor/src/utilities/toRawTextResult.d.ts +3 -0
  16. package/esm/editor/src/utilities/toRawTextResult.d.ts.map +1 -0
  17. package/esm/editor/src/utilities/toRawTextResult.js +21 -0
  18. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +8 -0
  19. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +1 -0
  20. package/esm/extension-autocomplete/src/AutocompletePlugin.js +232 -0
  21. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +17 -0
  22. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +1 -0
  23. package/esm/extension-autocomplete/src/DefaultRenderer.js +137 -0
  24. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +26 -0
  25. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +1 -0
  26. package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +30 -0
  27. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +11 -0
  28. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +1 -0
  29. package/esm/extension-autocomplete/src/createDefaultMatcher.js +58 -0
  30. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +4 -0
  31. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +1 -0
  32. package/esm/extension-autocomplete/src/createRegexMatcher.js +50 -0
  33. package/esm/extension-autocomplete/src/mod.d.ts +3 -0
  34. package/esm/extension-autocomplete/src/mod.d.ts.map +1 -0
  35. package/esm/extension-autocomplete/src/mod.js +2 -0
  36. package/esm/extension-autocomplete/src/types.d.ts +60 -0
  37. package/esm/extension-autocomplete/src/types.d.ts.map +1 -0
  38. package/esm/extension-autocomplete/src/types.js +1 -0
  39. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +15 -0
  40. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +1 -0
  41. package/esm/extension-basic-editor/src/ExtensionHtml.js +108 -0
  42. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +32 -0
  43. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +1 -0
  44. package/esm/extension-lsp/src/DiagnosticPlugin.js +131 -0
  45. package/esm/extension-lsp/src/ExtensionLsp.d.ts +25 -0
  46. package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +1 -0
  47. package/esm/extension-lsp/src/ExtensionLsp.js +126 -0
  48. package/esm/extension-lsp/src/LSPClient.d.ts +56 -0
  49. package/esm/extension-lsp/src/LSPClient.d.ts.map +1 -0
  50. package/esm/extension-lsp/src/LSPClient.js +449 -0
  51. package/esm/extension-lsp/src/LspStatus.d.ts +34 -0
  52. package/esm/extension-lsp/src/LspStatus.d.ts.map +1 -0
  53. package/esm/extension-lsp/src/LspStatus.js +127 -0
  54. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +8 -0
  55. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +1 -0
  56. package/esm/extension-lsp/src/computeIncrementalChanges.js +82 -0
  57. package/esm/extension-lsp/src/createLspAutocomplete.d.ts +23 -0
  58. package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +1 -0
  59. package/esm/extension-lsp/src/createLspAutocomplete.js +68 -0
  60. package/esm/extension-lsp/src/workspace.d.ts +62 -0
  61. package/esm/extension-lsp/src/workspace.d.ts.map +1 -0
  62. package/esm/extension-lsp/src/workspace.js +168 -0
  63. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +36 -0
  64. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +1 -0
  65. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +240 -0
  66. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +26 -0
  67. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +1 -0
  68. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +115 -0
  69. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +22 -0
  70. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +1 -0
  71. package/esm/extension-markdown/src/ExtensionMarkdown.js +48 -0
  72. package/esm/extension-markdown/src/MarkdownParser.d.ts +61 -0
  73. package/esm/extension-markdown/src/MarkdownParser.d.ts.map +1 -0
  74. package/esm/extension-markdown/src/MarkdownParser.js +249 -0
  75. package/esm/extension-markdown/src/MarkdownSerializer.d.ts +42 -0
  76. package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +1 -0
  77. package/esm/extension-markdown/src/MarkdownSerializer.js +325 -0
  78. package/esm/extension-markdown/src/PositionMapper.d.ts +15 -0
  79. package/esm/extension-markdown/src/PositionMapper.d.ts.map +1 -0
  80. package/esm/extension-markdown/src/PositionMapper.js +100 -0
  81. package/esm/extension-markdown/src/TokenSource.d.ts +11 -0
  82. package/esm/extension-markdown/src/TokenSource.d.ts.map +1 -0
  83. package/esm/extension-markdown/src/TokenSource.js +39 -0
  84. package/esm/extension-markdown/src/mdToPmConverter.d.ts +5 -0
  85. package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +1 -0
  86. package/esm/extension-markdown/src/mdToPmConverter.js +111 -0
  87. package/esm/extension-markdown/src/pmToMdConverter.d.ts +16 -0
  88. package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +1 -0
  89. package/esm/extension-markdown/src/pmToMdConverter.js +433 -0
  90. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +4 -0
  91. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +1 -0
  92. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +151 -0
  93. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +3 -0
  94. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +1 -0
  95. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +34 -0
  96. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +6 -0
  97. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +1 -0
  98. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +380 -0
  99. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +3 -0
  100. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +1 -0
  101. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +323 -0
  102. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +9 -0
  103. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +1 -0
  104. package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +308 -0
  105. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +5 -0
  106. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +1 -0
  107. package/esm/extension-markdown/src/treeSitterTokenizer.js +769 -0
  108. package/esm/extension-markdown/src/types.d.ts +28 -0
  109. package/esm/extension-markdown/src/types.d.ts.map +1 -0
  110. package/esm/extension-markdown/src/types.js +131 -0
  111. package/esm/extension-markdown/src/utils.d.ts +8 -0
  112. package/esm/extension-markdown/src/utils.d.ts.map +1 -0
  113. package/esm/extension-markdown/src/utils.js +86 -0
  114. package/esm/extension-menu/src/CustomMenuPlugin.d.ts +65 -0
  115. package/esm/extension-menu/src/CustomMenuPlugin.d.ts.map +1 -0
  116. package/esm/extension-menu/src/CustomMenuPlugin.js +1186 -0
  117. package/esm/extension-menu/src/ExtensionCustomMenu.d.ts +14 -0
  118. package/esm/extension-menu/src/ExtensionCustomMenu.d.ts.map +1 -0
  119. package/esm/extension-menu/src/ExtensionCustomMenu.js +57 -0
  120. package/esm/extension-menu/src/buildMenu.d.ts +5 -0
  121. package/esm/extension-menu/src/buildMenu.d.ts.map +1 -0
  122. package/esm/extension-menu/src/buildMenu.js +331 -0
  123. package/esm/extension-menu/src/icons.d.ts +15 -0
  124. package/esm/extension-menu/src/icons.d.ts.map +1 -0
  125. package/esm/extension-menu/src/icons.js +123 -0
  126. package/esm/extension-menu/src/menu.d.ts +81 -0
  127. package/esm/extension-menu/src/menu.d.ts.map +1 -0
  128. package/esm/extension-menu/src/menu.js +350 -0
  129. package/esm/extension-menu/src/mod.d.ts +3 -0
  130. package/esm/extension-menu/src/mod.d.ts.map +1 -0
  131. package/esm/extension-menu/src/mod.js +2 -0
  132. package/esm/extension-menu/src/prompt.d.ts +36 -0
  133. package/esm/extension-menu/src/prompt.d.ts.map +1 -0
  134. package/esm/extension-menu/src/prompt.js +158 -0
  135. package/esm/extension-yjs/src/CollaborationStatus.d.ts +60 -0
  136. package/esm/extension-yjs/src/CollaborationStatus.d.ts.map +1 -0
  137. package/esm/extension-yjs/src/CollaborationStatus.js +287 -0
  138. package/esm/extension-yjs/src/ExtensionYjs.d.ts +1 -0
  139. package/esm/extension-yjs/src/ExtensionYjs.d.ts.map +1 -1
  140. package/esm/extension-yjs/src/ExtensionYjs.js +1 -0
  141. package/esm/extension-yjs/src/userColors.d.ts +1 -0
  142. package/esm/extension-yjs/src/userColors.d.ts.map +1 -1
  143. package/esm/extension-yjs/src/userColors.js +1 -0
  144. package/esm/tree-sitter-shim/src/main.d.ts +15 -0
  145. package/esm/tree-sitter-shim/src/main.d.ts.map +1 -0
  146. package/esm/tree-sitter-shim/src/main.js +25 -0
  147. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +6 -0
  148. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +1 -0
  149. package/esm/tree-sitter-shim/src/tree_sitter/node.js +1 -0
  150. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +7 -0
  151. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +1 -0
  152. package/esm/tree-sitter-shim/src/tree_sitter/parser.js +5 -0
  153. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +6 -0
  154. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +1 -0
  155. package/esm/tree-sitter-shim/src/tree_sitter/tree.js +1 -0
  156. package/esm/wasm/src/mod.d.ts +12 -0
  157. package/esm/wasm/src/mod.d.ts.map +1 -0
  158. package/esm/wasm/src/mod.js +48 -0
  159. package/esm/wasm/wasm.d.ts +138 -0
  160. package/esm/wasm/wasm.d.ts.map +1 -0
  161. package/esm/wasm/wasm.js +120 -0
  162. package/package.json +6 -1
@@ -0,0 +1,287 @@
1
+ import "../../_dnt.polyfills.js";
2
+ import { Plugin, PluginKey } from 'prosemirror-state';
3
+ const CSS_PREFIX = 'kb-collab-status';
4
+ /**
5
+ * Plugin key for accessing collaboration status state
6
+ */
7
+ export const collaborationStatusPluginKey = new PluginKey('collaboration-status');
8
+ /**
9
+ * Creates a ProseMirror plugin that tracks collaboration status and user presence.
10
+ * This plugin maintains state that can be accessed by other components.
11
+ */
12
+ export function collaborationStatusPlugin(awareness, options = {}) {
13
+ return new Plugin({
14
+ key: collaborationStatusPluginKey,
15
+ state: {
16
+ init() {
17
+ return {
18
+ status: 'connecting',
19
+ users: getUsers(awareness),
20
+ };
21
+ },
22
+ apply(tr, value) {
23
+ const meta = tr.getMeta(collaborationStatusPluginKey);
24
+ if (meta) {
25
+ return { ...value, ...meta };
26
+ }
27
+ return value;
28
+ },
29
+ },
30
+ view(editorView) {
31
+ const updateUsers = () => {
32
+ const users = getUsers(awareness);
33
+ editorView.dispatch(editorView.state.tr.setMeta(collaborationStatusPluginKey, { users }));
34
+ };
35
+ awareness.on('change', updateUsers);
36
+ return {
37
+ destroy() {
38
+ awareness.off('change', updateUsers);
39
+ },
40
+ };
41
+ },
42
+ });
43
+ }
44
+ function getUsers(awareness) {
45
+ const users = [];
46
+ awareness.getStates().forEach((state, clientId) => {
47
+ if (state.user) {
48
+ users.push({
49
+ clientId,
50
+ name: state.user.name || `User ${clientId}`,
51
+ color: state.user.color || '#888888',
52
+ colorLight: state.user.colorLight,
53
+ });
54
+ }
55
+ });
56
+ return users;
57
+ }
58
+ /**
59
+ * A menu element that displays collaboration status, user count, and a dropdown of users.
60
+ */
61
+ export class CollaborationStatusElement {
62
+ constructor(options) {
63
+ Object.defineProperty(this, "awareness", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: void 0
68
+ });
69
+ Object.defineProperty(this, "provider", {
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true,
73
+ value: void 0
74
+ });
75
+ Object.defineProperty(this, "dom", {
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true,
79
+ value: null
80
+ });
81
+ Object.defineProperty(this, "statusDot", {
82
+ enumerable: true,
83
+ configurable: true,
84
+ writable: true,
85
+ value: null
86
+ });
87
+ Object.defineProperty(this, "userCount", {
88
+ enumerable: true,
89
+ configurable: true,
90
+ writable: true,
91
+ value: null
92
+ });
93
+ Object.defineProperty(this, "dropdown", {
94
+ enumerable: true,
95
+ configurable: true,
96
+ writable: true,
97
+ value: null
98
+ });
99
+ Object.defineProperty(this, "userList", {
100
+ enumerable: true,
101
+ configurable: true,
102
+ writable: true,
103
+ value: null
104
+ });
105
+ Object.defineProperty(this, "isOpen", {
106
+ enumerable: true,
107
+ configurable: true,
108
+ writable: true,
109
+ value: false
110
+ });
111
+ Object.defineProperty(this, "status", {
112
+ enumerable: true,
113
+ configurable: true,
114
+ writable: true,
115
+ value: 'connecting'
116
+ });
117
+ this.awareness = options.awareness;
118
+ this.provider = options.provider;
119
+ }
120
+ render(view) {
121
+ // Create main container
122
+ this.dom = document.createElement('div');
123
+ this.dom.className = `${CSS_PREFIX}`;
124
+ this.dom.setAttribute('role', 'button');
125
+ this.dom.setAttribute('aria-haspopup', 'true');
126
+ this.dom.setAttribute('aria-expanded', 'false');
127
+ // Create status indicator button
128
+ const button = document.createElement('button');
129
+ button.type = 'button';
130
+ button.className = `${CSS_PREFIX}__button`;
131
+ button.title = 'Collaboration status';
132
+ button.setAttribute('aria-label', 'Collaboration status');
133
+ // Status dot
134
+ this.statusDot = document.createElement('span');
135
+ this.statusDot.className =
136
+ `${CSS_PREFIX}__dot ${CSS_PREFIX}__dot--connecting`;
137
+ button.appendChild(this.statusDot);
138
+ // User count badge
139
+ this.userCount = document.createElement('span');
140
+ this.userCount.className = `${CSS_PREFIX}__count`;
141
+ this.userCount.textContent = '0';
142
+ button.appendChild(this.userCount);
143
+ // Dropdown chevron
144
+ const chevron = document.createElement('span');
145
+ chevron.className = `${CSS_PREFIX}__chevron`;
146
+ chevron.innerHTML =
147
+ `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>`;
148
+ button.appendChild(chevron);
149
+ this.dom.appendChild(button);
150
+ // Create dropdown
151
+ this.dropdown = document.createElement('div');
152
+ this.dropdown.className = `${CSS_PREFIX}__dropdown`;
153
+ this.dropdown.style.display = 'none';
154
+ // Dropdown header
155
+ const header = document.createElement('div');
156
+ header.className = `${CSS_PREFIX}__header`;
157
+ header.textContent = 'Collaborators';
158
+ this.dropdown.appendChild(header);
159
+ // User list
160
+ this.userList = document.createElement('div');
161
+ this.userList.className = `${CSS_PREFIX}__users`;
162
+ this.dropdown.appendChild(this.userList);
163
+ this.dom.appendChild(this.dropdown);
164
+ // Event handlers
165
+ button.addEventListener('click', (e) => {
166
+ e.preventDefault();
167
+ e.stopPropagation();
168
+ this.toggleDropdown();
169
+ });
170
+ // Close on outside click
171
+ const closeHandler = (e) => {
172
+ if (this.isOpen && this.dom && !this.dom.contains(e.target)) {
173
+ this.closeDropdown();
174
+ }
175
+ };
176
+ document.addEventListener('click', closeHandler);
177
+ // Listen for awareness changes
178
+ const awarenessChangeHandler = () => {
179
+ this.updateUserList();
180
+ };
181
+ this.awareness.on('change', awarenessChangeHandler);
182
+ // Listen for provider status changes
183
+ if (this.provider && typeof this.provider.on === 'function') {
184
+ this.provider.on('status', (event) => {
185
+ this.setStatus(event.status);
186
+ });
187
+ }
188
+ // Initial update
189
+ this.updateUserList();
190
+ const update = (_state) => {
191
+ // Always visible
192
+ return true;
193
+ };
194
+ return { dom: this.dom, update };
195
+ }
196
+ setStatus(status) {
197
+ this.status = status;
198
+ if (this.statusDot) {
199
+ this.statusDot.className =
200
+ `${CSS_PREFIX}__dot ${CSS_PREFIX}__dot--${status}`;
201
+ }
202
+ if (this.dom) {
203
+ this.dom.setAttribute('data-status', status);
204
+ const button = this.dom.querySelector('button');
205
+ if (button) {
206
+ const statusLabels = {
207
+ connected: 'Connected',
208
+ connecting: 'Connecting...',
209
+ disconnected: 'Disconnected',
210
+ };
211
+ button.title = `${statusLabels[status]} - Click to see collaborators`;
212
+ }
213
+ }
214
+ }
215
+ updateUserList() {
216
+ if (!this.userList || !this.userCount)
217
+ return;
218
+ const users = getUsers(this.awareness);
219
+ const currentClientId = this.awareness.clientID;
220
+ // Update count (including self)
221
+ this.userCount.textContent = String(users.length);
222
+ // Clear and rebuild user list
223
+ this.userList.innerHTML = '';
224
+ if (users.length === 0) {
225
+ const emptyMessage = document.createElement('div');
226
+ emptyMessage.className = `${CSS_PREFIX}__empty`;
227
+ emptyMessage.textContent = 'No users connected';
228
+ this.userList.appendChild(emptyMessage);
229
+ return;
230
+ }
231
+ // Sort users: current user first, then alphabetically
232
+ const sortedUsers = [...users].sort((a, b) => {
233
+ if (a.clientId === currentClientId)
234
+ return -1;
235
+ if (b.clientId === currentClientId)
236
+ return 1;
237
+ return a.name.localeCompare(b.name);
238
+ });
239
+ sortedUsers.forEach((user) => {
240
+ const userItem = document.createElement('div');
241
+ userItem.className = `${CSS_PREFIX}__user`;
242
+ // Color indicator
243
+ const colorDot = document.createElement('span');
244
+ colorDot.className = `${CSS_PREFIX}__user-color`;
245
+ colorDot.style.backgroundColor = user.color;
246
+ userItem.appendChild(colorDot);
247
+ // User name
248
+ const userName = document.createElement('span');
249
+ userName.className = `${CSS_PREFIX}__user-name`;
250
+ userName.textContent = user.name;
251
+ userItem.appendChild(userName);
252
+ // "You" badge for current user
253
+ if (user.clientId === currentClientId) {
254
+ const youBadge = document.createElement('span');
255
+ youBadge.className = `${CSS_PREFIX}__you-badge`;
256
+ youBadge.textContent = '(you)';
257
+ userItem.appendChild(youBadge);
258
+ }
259
+ this.userList.appendChild(userItem);
260
+ });
261
+ }
262
+ toggleDropdown() {
263
+ if (this.isOpen) {
264
+ this.closeDropdown();
265
+ }
266
+ else {
267
+ this.openDropdown();
268
+ }
269
+ }
270
+ openDropdown() {
271
+ if (!this.dropdown || !this.dom)
272
+ return;
273
+ this.isOpen = true;
274
+ this.dropdown.style.display = 'block';
275
+ this.dom.setAttribute('aria-expanded', 'true');
276
+ this.dom.classList.add(`${CSS_PREFIX}--open`);
277
+ this.updateUserList(); // Refresh on open
278
+ }
279
+ closeDropdown() {
280
+ if (!this.dropdown || !this.dom)
281
+ return;
282
+ this.isOpen = false;
283
+ this.dropdown.style.display = 'none';
284
+ this.dom.setAttribute('aria-expanded', 'false');
285
+ this.dom.classList.remove(`${CSS_PREFIX}--open`);
286
+ }
287
+ }
@@ -1,3 +1,4 @@
1
+ import "../../_dnt.polyfills.js";
1
2
  import type { Plugin } from 'prosemirror-state';
2
3
  import * as awarenessProtocol from 'y-protocols/awareness';
3
4
  import { Extension } from '../../editor/src/mod.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionYjs.d.ts","sourceRoot":"","sources":["../../../src/extension-yjs/src/ExtensionYjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAM1C,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IAC5D,SAAS,EAAE,iBAAiB,CAAC,SAAS,CAAC;CACxC;AAED,qBAAa,YAAa,SAAQ,SAAS;IACzC,IAAI,SAAS;IAEJ,SAAS,WAAe;IACjC,QAAQ,WAAwB;IAGvB,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAOhD,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAOjD,qBAAqB,IAAI,MAAM,EAAE;CAY3C"}
1
+ {"version":3,"file":"ExtensionYjs.d.ts","sourceRoot":"","sources":["../../../src/extension-yjs/src/ExtensionYjs.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAM1C,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IAC5D,SAAS,EAAE,iBAAiB,CAAC,SAAS,CAAC;CACxC;AAED,qBAAa,YAAa,SAAQ,SAAS;IACzC,IAAI,SAAS;IAEJ,SAAS,WAAe;IACjC,QAAQ,WAAwB;IAGvB,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAOhD,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAOjD,qBAAqB,IAAI,MAAM,EAAE;CAY3C"}
@@ -1,3 +1,4 @@
1
+ import "../../_dnt.polyfills.js";
1
2
  import { Extension } from '../../editor/src/mod.js';
2
3
  import { ySyncPlugin } from './ySyncPlugin.js';
3
4
  import { yPositionPlugin } from './yPositionPlugin.js';
@@ -1,3 +1,4 @@
1
+ import "../../_dnt.polyfills.js";
1
2
  export declare const userColors: {
2
3
  color: string;
3
4
  light: string;
@@ -1 +1 @@
1
- {"version":3,"file":"userColors.d.ts","sourceRoot":"","sources":["../../../src/extension-yjs/src/userColors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;GAStB,CAAC"}
1
+ {"version":3,"file":"userColors.d.ts","sourceRoot":"","sources":["../../../src/extension-yjs/src/userColors.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,eAAO,MAAM,UAAU;;;GAStB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import "../../_dnt.polyfills.js";
1
2
  export const userColors = [
2
3
  { color: '#30bced', light: '#30bced33' },
3
4
  { color: '#6eeb83', light: '#6eeb8333' },
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Compatibility shim for deno_tree_sitter -> web-tree-sitter
3
+ * This provides the same createParser API that deno_tree_sitter exports
4
+ */
5
+ import Parser from 'web-tree-sitter';
6
+ /**
7
+ * Creates a tree-sitter parser from WASM binary data.
8
+ * Compatible with deno_tree_sitter's createParser API.
9
+ *
10
+ * @param wasmBinary - The WASM binary data (Uint8Array or ArrayBuffer)
11
+ * @returns A configured Parser instance with the language set
12
+ */
13
+ export declare function createParser(wasmBinary: Uint8Array | ArrayBuffer): Promise<Parser>;
14
+ export { Parser };
15
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/tree-sitter-shim/src/main.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,UAAU,GAAG,WAAW,GACnC,OAAO,CAAC,MAAM,CAAC,CAWjB;AAGD,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Compatibility shim for deno_tree_sitter -> web-tree-sitter
3
+ * This provides the same createParser API that deno_tree_sitter exports
4
+ */
5
+ import Parser from 'web-tree-sitter';
6
+ let initialized = false;
7
+ /**
8
+ * Creates a tree-sitter parser from WASM binary data.
9
+ * Compatible with deno_tree_sitter's createParser API.
10
+ *
11
+ * @param wasmBinary - The WASM binary data (Uint8Array or ArrayBuffer)
12
+ * @returns A configured Parser instance with the language set
13
+ */
14
+ export async function createParser(wasmBinary) {
15
+ if (!initialized) {
16
+ await Parser.init();
17
+ initialized = true;
18
+ }
19
+ const parser = new Parser();
20
+ const language = await Parser.Language.load(wasmBinary);
21
+ parser.setLanguage(language);
22
+ return parser;
23
+ }
24
+ // Re-export other items from main.js for compatibility
25
+ export { Parser };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Compatibility shim for deno_tree_sitter Node type -> web-tree-sitter
3
+ */
4
+ import type Parser from 'web-tree-sitter';
5
+ export type Node = Parser.SyntaxNode;
6
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../src/tree-sitter-shim/src/tree_sitter/node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE1C,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Compatibility shim for deno_tree_sitter parser types -> web-tree-sitter
3
+ */
4
+ import Parser from 'web-tree-sitter';
5
+ export { Parser };
6
+ export type { Parser };
7
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/tree-sitter-shim/src/tree_sitter/parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Compatibility shim for deno_tree_sitter parser types -> web-tree-sitter
3
+ */
4
+ import Parser from 'web-tree-sitter';
5
+ export { Parser };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Compatibility shim for deno_tree_sitter Tree type -> web-tree-sitter
3
+ */
4
+ import type Parser from 'web-tree-sitter';
5
+ export type Tree = Parser.Tree;
6
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../src/tree-sitter-shim/src/tree_sitter/tree.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE1C,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import manifest from '../wasm.js';
2
+ export declare function getLangsList(): string[];
3
+ export declare function getLangTreeSitter(lang: string, cdnUrl?: string): {
4
+ lang: string;
5
+ repo: string;
6
+ files: string[];
7
+ queries: any;
8
+ };
9
+ export declare function fetchWasm(wasmUrl: string): Promise<Uint8Array>;
10
+ export declare function fetchTextResource(url: string): Promise<string>;
11
+ export { manifest };
12
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/wasm/src/mod.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAIlC,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAMvC;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,SAAgC;;;;;EAuBvC;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWpE;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAapE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ import * as dntShim from "../../_dnt.shims.js";
2
+ import manifest from '../wasm.js';
3
+ const __dirname = globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).dirname;
4
+ export function getLangsList() {
5
+ return manifest
6
+ .map((item) => item.repo.split('-').pop())
7
+ .filter((item) => 'string' === typeof item);
8
+ }
9
+ export function getLangTreeSitter(lang, cdnUrl = 'http://localhost:8000/wasm/') {
10
+ const langManifest = manifest.find((item) => item.repo.endsWith('-' + lang));
11
+ if (!langManifest) {
12
+ throw new Error('No grammar for: ' + lang);
13
+ }
14
+ if (!cdnUrl.endsWith('/')) {
15
+ cdnUrl += '/';
16
+ }
17
+ const dir = langManifest.repo.split('/')[1];
18
+ cdnUrl += dir + '/';
19
+ const queries = Object.entries(langManifest.queries)
20
+ .map((entry) => [entry[0], cdnUrl + entry[0]]);
21
+ return {
22
+ lang,
23
+ repo: langManifest.repo,
24
+ files: langManifest.files.map((file) => cdnUrl + file),
25
+ queries: Object.fromEntries(queries),
26
+ };
27
+ }
28
+ export async function fetchWasm(wasmUrl) {
29
+ if ('Deno' in dntShim.dntGlobalThis) { // Test or server-side
30
+ return globalThis.Deno.readFileSync(__dirname + '/../files' + wasmUrl);
31
+ }
32
+ const response = await fetch(wasmUrl);
33
+ if (response.status >= 400) {
34
+ throw new Error(`Error fetching ${response.status}`);
35
+ }
36
+ return new Uint8Array(await response.arrayBuffer());
37
+ }
38
+ export async function fetchTextResource(url) {
39
+ if ('Deno' in dntShim.dntGlobalThis) {
40
+ return new TextDecoder().decode(globalThis.Deno.readFileSync(__dirname + '/../files' + url));
41
+ }
42
+ const responseScm = await fetch(url);
43
+ if (responseScm.status >= 400) {
44
+ throw new Error(`Error fetching ${responseScm.status}`);
45
+ }
46
+ return await responseScm.text();
47
+ }
48
+ export { manifest };
@@ -0,0 +1,138 @@
1
+ declare const _default: ({
2
+ repo: string;
3
+ version: string;
4
+ files: string[];
5
+ queries: {
6
+ "highlights.scm": string;
7
+ "injections.scm": string;
8
+ "highlights-inline.scm": string;
9
+ "injections-inline.scm": string;
10
+ "highlights-dtd.scm"?: undefined;
11
+ "tags.scm"?: undefined;
12
+ "locals.scm"?: undefined;
13
+ "highlights-jsx.scm"?: undefined;
14
+ "highlights-params.scm"?: undefined;
15
+ };
16
+ } | {
17
+ repo: string;
18
+ version: string;
19
+ files: string[];
20
+ queries: {
21
+ "highlights.scm": string;
22
+ "injections.scm"?: undefined;
23
+ "highlights-inline.scm"?: undefined;
24
+ "injections-inline.scm"?: undefined;
25
+ "highlights-dtd.scm"?: undefined;
26
+ "tags.scm"?: undefined;
27
+ "locals.scm"?: undefined;
28
+ "highlights-jsx.scm"?: undefined;
29
+ "highlights-params.scm"?: undefined;
30
+ };
31
+ } | {
32
+ repo: string;
33
+ version: string;
34
+ files: string[];
35
+ queries: {
36
+ "highlights.scm": string;
37
+ "highlights-dtd.scm": string;
38
+ "injections.scm"?: undefined;
39
+ "highlights-inline.scm"?: undefined;
40
+ "injections-inline.scm"?: undefined;
41
+ "tags.scm"?: undefined;
42
+ "locals.scm"?: undefined;
43
+ "highlights-jsx.scm"?: undefined;
44
+ "highlights-params.scm"?: undefined;
45
+ };
46
+ } | {
47
+ repo: string;
48
+ version: string;
49
+ files: string[];
50
+ queries: {
51
+ "highlights.scm": string;
52
+ "injections.scm": string;
53
+ "highlights-inline.scm"?: undefined;
54
+ "injections-inline.scm"?: undefined;
55
+ "highlights-dtd.scm"?: undefined;
56
+ "tags.scm"?: undefined;
57
+ "locals.scm"?: undefined;
58
+ "highlights-jsx.scm"?: undefined;
59
+ "highlights-params.scm"?: undefined;
60
+ };
61
+ } | {
62
+ repo: string;
63
+ version: string;
64
+ files: string[];
65
+ queries: {
66
+ "highlights.scm": string;
67
+ "injections.scm": string;
68
+ "tags.scm": string;
69
+ "highlights-inline.scm"?: undefined;
70
+ "injections-inline.scm"?: undefined;
71
+ "highlights-dtd.scm"?: undefined;
72
+ "locals.scm"?: undefined;
73
+ "highlights-jsx.scm"?: undefined;
74
+ "highlights-params.scm"?: undefined;
75
+ };
76
+ } | {
77
+ repo: string;
78
+ version: string;
79
+ files: string[];
80
+ queries: {
81
+ "highlights.scm": string;
82
+ "locals.scm": string;
83
+ "tags.scm": string;
84
+ "injections.scm"?: undefined;
85
+ "highlights-inline.scm"?: undefined;
86
+ "injections-inline.scm"?: undefined;
87
+ "highlights-dtd.scm"?: undefined;
88
+ "highlights-jsx.scm"?: undefined;
89
+ "highlights-params.scm"?: undefined;
90
+ };
91
+ } | {
92
+ repo: string;
93
+ version: string;
94
+ files: string[];
95
+ queries: {
96
+ "highlights.scm": string;
97
+ "tags.scm": string;
98
+ "injections.scm"?: undefined;
99
+ "highlights-inline.scm"?: undefined;
100
+ "injections-inline.scm"?: undefined;
101
+ "highlights-dtd.scm"?: undefined;
102
+ "locals.scm"?: undefined;
103
+ "highlights-jsx.scm"?: undefined;
104
+ "highlights-params.scm"?: undefined;
105
+ };
106
+ } | {
107
+ repo: string;
108
+ version: string;
109
+ files: string[];
110
+ queries: {
111
+ "highlights.scm": string;
112
+ "highlights-jsx.scm": string;
113
+ "highlights-params.scm": string;
114
+ "injections.scm": string;
115
+ "locals.scm": string;
116
+ "tags.scm": string;
117
+ "highlights-inline.scm"?: undefined;
118
+ "injections-inline.scm"?: undefined;
119
+ "highlights-dtd.scm"?: undefined;
120
+ };
121
+ } | {
122
+ repo: string;
123
+ files: string[];
124
+ queries: {
125
+ "highlights.scm": string;
126
+ "injections.scm"?: undefined;
127
+ "highlights-inline.scm"?: undefined;
128
+ "injections-inline.scm"?: undefined;
129
+ "highlights-dtd.scm"?: undefined;
130
+ "tags.scm"?: undefined;
131
+ "locals.scm"?: undefined;
132
+ "highlights-jsx.scm"?: undefined;
133
+ "highlights-params.scm"?: undefined;
134
+ };
135
+ version?: undefined;
136
+ })[];
137
+ export default _default;
138
+ //# sourceMappingURL=wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../src/wasm/wasm.js"],"names":[],"mappings":""}