@kerebron/extension-yjs 0.4.3 → 0.4.4

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
package/README.md CHANGED
@@ -1,82 +1,160 @@
1
- # Kerebron - Prosemirror based online editor kit
1
+ # YJS Extension
2
2
 
3
- ## Watch a Demo
3
+ Real-time collaborative editing extension for ProseMirror using [Yjs](https://yjs.dev/).
4
4
 
5
- <a href="https://youtube.com/shorts/OdJjhAPj-wA?feature=share" target="_blank">
6
- <img src="https://github.com/user-attachments/assets/b63ec84a-0ed2-4f98-920c-76f6d3215168" alt="Alt Text" width="200">
7
- </a>
5
+ ## Features
8
6
 
9
- ## Playground Demo
7
+ - **Real-time Collaboration**: Multiple users can edit the same document simultaneously
8
+ - **Awareness Protocol**: See other users' cursors and selections
9
+ - **Collaboration Status UI**: Built-in toolbar element showing connection status and active collaborators
10
+ - **User Colors**: Automatic color assignment for collaborators
10
11
 
11
- [playground](https://demo.kerebron.com) - be nice.
12
+ ## Installation
12
13
 
13
- ## Overview
14
+ ```typescript
15
+ import { ExtensionYjs } from '@kerebron/extension-yjs';
16
+ import { WebsocketProvider } from 'y-websocket';
17
+ import * as Y from 'yjs';
18
+ ```
14
19
 
15
- Using vanilla Prosemirror modules is often impossible because of
16
- incompatibilities.
20
+ ## Usage
21
+
22
+ ### Basic Setup
23
+
24
+ ```typescript
25
+ import { Editor } from '@kerebron/editor';
26
+ import { ExtensionYjs } from '@kerebron/extension-yjs';
27
+ import { ExtensionCustomMenu } from '@kerebron/extension-menu';
28
+ import { WebsocketProvider } from 'y-websocket';
29
+ import * as Y from 'yjs';
30
+
31
+ // Create Yjs document and provider
32
+ const ydoc = new Y.Doc();
33
+ const provider = new WebsocketProvider('ws://localhost:1234', 'my-room', ydoc);
34
+
35
+ // Set user info for awareness
36
+ provider.awareness.setLocalStateField('user', {
37
+ name: 'User Name',
38
+ color: '#ff0000',
39
+ });
40
+
41
+ // Create editor with YJS support
42
+ const editor = new Editor({
43
+ extensions: [
44
+ ExtensionCustomMenu(), // Automatically shows collaboration status
45
+ ExtensionYjs({
46
+ ydoc,
47
+ provider,
48
+ type: ydoc.getXmlFragment('prosemirror'),
49
+ }),
50
+ ],
51
+ });
52
+ ```
17
53
 
18
- Kerebron forks several prosemirror projects into one monorepo in order to keep
19
- them in sync.
54
+ ### Collaboration Status
20
55
 
21
- Project is inspired on https://tiptap.dev/, but instead of building wrapper
22
- around a wrapper it borrows concept of extension and command manager.
56
+ When using `ExtensionCustomMenu` with `ExtensionYjs`, a collaboration status button is automatically added to the toolbar. This shows:
23
57
 
24
- It has simplified tooling (deno), fewer dependencies and resulting in lower
25
- number of output npm modules.
58
+ - **Connection Status**: Green dot (connected) or red dot (disconnected)
59
+ - **User Count**: Number of active collaborators
60
+ - **User List**: Dropdown showing all collaborators with their names
26
61
 
27
- **Work in progress**
62
+ #### Automatic Integration
28
63
 
64
+ The collaboration status is added automatically when both extensions are present:
29
65
 
30
- ## Build
66
+ ```typescript
67
+ new Editor({
68
+ extensions: [
69
+ ExtensionCustomMenu(), // Auto-detects YJS
70
+ ExtensionYjs({ ydoc, provider, type }),
71
+ ],
72
+ });
73
+ ```
31
74
 
32
- ### Build static examples and `.wasm` files
75
+ #### Manual Integration
33
76
 
34
- ```sh
35
- deno task build
36
- ```
77
+ If you need more control, you can manually add the collaboration status:
37
78
 
38
- ## Development
79
+ ```typescript
80
+ import { CollaborationStatusElement } from '@kerebron/extension-yjs/CollaborationStatus';
81
+ import '@kerebron/extension-yjs/assets/collaboration-status.css';
39
82
 
40
- To start example server:
83
+ const collabStatus = new CollaborationStatusElement({
84
+ awareness: provider.awareness,
85
+ provider: provider,
86
+ });
41
87
 
42
- ```sh
43
- deno task -f server-deno-hono start
88
+ new Editor({
89
+ extensions: [
90
+ ExtensionCustomMenu({
91
+ autoAddCollaborationStatus: false,
92
+ trailingElements: [collabStatus],
93
+ }),
94
+ ExtensionYjs({ ydoc, provider, type }),
95
+ ],
96
+ });
44
97
  ```
45
98
 
46
- ## Examples
99
+ #### Disable Collaboration Status
47
100
 
48
- TODO
101
+ To disable the automatic collaboration status:
49
102
 
50
- ### NPM packages are generated using DNT
103
+ ```typescript
104
+ new Editor({
105
+ extensions: [
106
+ ExtensionCustomMenu({ autoAddCollaborationStatus: false }),
107
+ ExtensionYjs({ ydoc, provider, type }),
108
+ ],
109
+ });
110
+ ```
51
111
 
52
- - https://deno.com/blog/publish-esm-cjs-module-dnt - the easiest way to publish
53
- a hybrid npm module for ESM and CommonJS
54
- - https://github.com/denoland/dnt
55
- - https://gaubee.com/article/Publishing-Your-Deno-Project-as-a-Monorepo-using-dnt/
112
+ ## Exports
56
113
 
57
- To generate npm packages
114
+ | Export | Description |
115
+ |--------|-------------|
116
+ | `@kerebron/extension-yjs` | Main extension class |
117
+ | `@kerebron/extension-yjs/userColors` | User color utilities |
118
+ | `@kerebron/extension-yjs/CollaborationStatus` | Collaboration status UI element |
119
+ | `@kerebron/extension-yjs/assets/collaboration-status.css` | Styles for collaboration status |
58
120
 
59
- ```sh
60
- deno -A ./build/build_npm.ts
61
- ```
121
+ ## CollaborationStatusElement Options
62
122
 
63
- ## Run through docker
123
+ | Option | Type | Required | Description |
124
+ |--------|------|----------|-------------|
125
+ | `awareness` | `Awareness` | Yes | Yjs awareness instance |
126
+ | `provider` | `WebsocketProvider` | Yes | WebSocket provider for connection status |
64
127
 
65
- ```sh
66
- docker build . -t editor-test
67
- docker run -it -p 8000:8000 -v $PWD:/usr/src/app editor-test
68
- ```
69
-
70
- ## Prerequisites
128
+ ## Styling
71
129
 
72
- Install deno
130
+ The collaboration status element supports both light and dark themes via CSS custom properties. Import the styles:
73
131
 
74
- ```
75
- npm install -g deno
132
+ ```typescript
133
+ import '@kerebron/extension-yjs/assets/collaboration-status.css';
76
134
  ```
77
135
 
78
- Install rust
136
+ Or include via HTML:
79
137
 
138
+ ```html
139
+ <link rel="stylesheet" href="@kerebron/extension-yjs/assets/collaboration-status.css">
80
140
  ```
81
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
82
- ```
141
+
142
+ ### CSS Classes
143
+
144
+ | Class | Description |
145
+ |-------|-------------|
146
+ | `.kb-collab-status` | Main container |
147
+ | `.kb-collab-status__trigger` | Button that shows status and count |
148
+ | `.kb-collab-status__dot` | Connection status indicator |
149
+ | `.kb-collab-status__dot--connected` | Green dot for connected state |
150
+ | `.kb-collab-status__dot--disconnected` | Red dot for disconnected state |
151
+ | `.kb-collab-status__count` | User count badge |
152
+ | `.kb-collab-status__dropdown` | User list dropdown |
153
+ | `.kb-collab-status__user` | Individual user item |
154
+ | `.kb-collab-status__user--self` | Current user indicator |
155
+
156
+ ## Related
157
+
158
+ - [ExtensionCustomMenu](../extension-menu/README.md) - Toolbar with auto YJS integration
159
+ - [Yjs Documentation](https://docs.yjs.dev/)
160
+ - [y-websocket](https://github.com/yjs/y-websocket)
@@ -0,0 +1,172 @@
1
+ /* Collaboration Status Menu Element */
2
+ .kb-collab-status {
3
+ position: relative;
4
+ display: inline-flex;
5
+ align-items: center;
6
+ }
7
+
8
+ .kb-collab-status__button {
9
+ display: inline-flex;
10
+ align-items: center;
11
+ gap: 0.35rem;
12
+ padding: 0.35rem 0.6rem;
13
+ border: 1px solid var(--kb-border, #444);
14
+ border-radius: 4px;
15
+ background: var(--kb-surface, #2a2a2a);
16
+ color: var(--kb-text, #e8e8e8);
17
+ cursor: pointer;
18
+ font-size: 0.85rem;
19
+ transition: background-color 0.15s ease, border-color 0.15s ease;
20
+ }
21
+
22
+ .kb-collab-status__button:hover {
23
+ background: var(--kb-bg, #1a1a1a);
24
+ border-color: var(--kb-accent, #7dd3fc);
25
+ }
26
+
27
+ .kb-collab-status--open .kb-collab-status__button {
28
+ border-color: var(--kb-accent, #7dd3fc);
29
+ }
30
+
31
+ /* Status dot indicator */
32
+ .kb-collab-status__dot {
33
+ width: 8px;
34
+ height: 8px;
35
+ border-radius: 50%;
36
+ flex-shrink: 0;
37
+ }
38
+
39
+ .kb-collab-status__dot--connected {
40
+ background-color: #22c55e;
41
+ box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
42
+ }
43
+
44
+ .kb-collab-status__dot--connecting {
45
+ background-color: #eab308;
46
+ box-shadow: 0 0 4px rgba(234, 179, 8, 0.5);
47
+ animation: pulse 1.5s ease-in-out infinite;
48
+ }
49
+
50
+ .kb-collab-status__dot--disconnected {
51
+ background-color: #ef4444;
52
+ box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
53
+ }
54
+
55
+ @keyframes pulse {
56
+ 0%, 100% {
57
+ opacity: 1;
58
+ }
59
+ 50% {
60
+ opacity: 0.5;
61
+ }
62
+ }
63
+
64
+ /* User count badge */
65
+ .kb-collab-status__count {
66
+ min-width: 1.2em;
67
+ padding: 0 0.25em;
68
+ font-weight: 600;
69
+ font-size: 0.8rem;
70
+ text-align: center;
71
+ }
72
+
73
+ /* Dropdown chevron */
74
+ .kb-collab-status__chevron {
75
+ display: flex;
76
+ align-items: center;
77
+ transition: transform 0.15s ease;
78
+ }
79
+
80
+ .kb-collab-status__chevron svg {
81
+ width: 14px;
82
+ height: 14px;
83
+ }
84
+
85
+ .kb-collab-status--open .kb-collab-status__chevron {
86
+ transform: rotate(180deg);
87
+ }
88
+
89
+ /* Dropdown panel */
90
+ .kb-collab-status__dropdown {
91
+ position: absolute;
92
+ top: calc(100% + 4px);
93
+ right: 0;
94
+ min-width: 180px;
95
+ max-width: 280px;
96
+ background: var(--kb-surface, #2a2a2a);
97
+ border: 1px solid var(--kb-border, #444);
98
+ border-radius: 6px;
99
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
100
+ z-index: 1000;
101
+ overflow: hidden;
102
+ }
103
+
104
+ .kb-collab-status__header {
105
+ padding: 0.6rem 0.8rem;
106
+ font-size: 0.75rem;
107
+ font-weight: 600;
108
+ text-transform: uppercase;
109
+ letter-spacing: 0.05em;
110
+ color: var(--kb-text-muted, #9a9a9a);
111
+ border-bottom: 1px solid var(--kb-border, #444);
112
+ background: var(--kb-bg, #1a1a1a);
113
+ }
114
+
115
+ .kb-collab-status__users {
116
+ max-height: 240px;
117
+ overflow-y: auto;
118
+ padding: 0.4rem 0;
119
+ }
120
+
121
+ .kb-collab-status__user {
122
+ display: flex;
123
+ align-items: center;
124
+ gap: 0.5rem;
125
+ padding: 0.5rem 0.8rem;
126
+ transition: background-color 0.1s ease;
127
+ }
128
+
129
+ .kb-collab-status__user:hover {
130
+ background: var(--kb-bg, #1a1a1a);
131
+ }
132
+
133
+ .kb-collab-status__user-color {
134
+ width: 10px;
135
+ height: 10px;
136
+ border-radius: 50%;
137
+ flex-shrink: 0;
138
+ border: 1px solid rgba(255, 255, 255, 0.2);
139
+ }
140
+
141
+ .kb-collab-status__user-name {
142
+ flex: 1;
143
+ font-size: 0.85rem;
144
+ color: var(--kb-text, #e8e8e8);
145
+ overflow: hidden;
146
+ text-overflow: ellipsis;
147
+ white-space: nowrap;
148
+ }
149
+
150
+ .kb-collab-status__you-badge {
151
+ font-size: 0.7rem;
152
+ color: var(--kb-text-muted, #9a9a9a);
153
+ font-style: italic;
154
+ }
155
+
156
+ .kb-collab-status__empty {
157
+ padding: 1rem 0.8rem;
158
+ text-align: center;
159
+ color: var(--kb-text-muted, #9a9a9a);
160
+ font-size: 0.85rem;
161
+ }
162
+
163
+ /* Light mode overrides */
164
+ .light-mode .kb-collab-status__dropdown,
165
+ .app-container.light-mode .kb-collab-status__dropdown {
166
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
167
+ }
168
+
169
+ .light-mode .kb-collab-status__user-color,
170
+ .app-container.light-mode .kb-collab-status__user-color {
171
+ border-color: rgba(0, 0, 0, 0.2);
172
+ }
@@ -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 const dntGlobalThis: Omit<typeof globalThis, never>;
2
+ //# sourceMappingURL=_dnt.shims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
@@ -0,0 +1,57 @@
1
+ const dntGlobals = {};
2
+ export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
3
+ function createMergeProxy(baseObj, extObj) {
4
+ return new Proxy(baseObj, {
5
+ get(_target, prop, _receiver) {
6
+ if (prop in extObj) {
7
+ return extObj[prop];
8
+ }
9
+ else {
10
+ return baseObj[prop];
11
+ }
12
+ },
13
+ set(_target, prop, value) {
14
+ if (prop in extObj) {
15
+ delete extObj[prop];
16
+ }
17
+ baseObj[prop] = value;
18
+ return true;
19
+ },
20
+ deleteProperty(_target, prop) {
21
+ let success = false;
22
+ if (prop in extObj) {
23
+ delete extObj[prop];
24
+ success = true;
25
+ }
26
+ if (prop in baseObj) {
27
+ delete baseObj[prop];
28
+ success = true;
29
+ }
30
+ return success;
31
+ },
32
+ ownKeys(_target) {
33
+ const baseKeys = Reflect.ownKeys(baseObj);
34
+ const extKeys = Reflect.ownKeys(extObj);
35
+ const extKeysSet = new Set(extKeys);
36
+ return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
37
+ },
38
+ defineProperty(_target, prop, desc) {
39
+ if (prop in extObj) {
40
+ delete extObj[prop];
41
+ }
42
+ Reflect.defineProperty(baseObj, prop, desc);
43
+ return true;
44
+ },
45
+ getOwnPropertyDescriptor(_target, prop) {
46
+ if (prop in extObj) {
47
+ return Reflect.getOwnPropertyDescriptor(extObj, prop);
48
+ }
49
+ else {
50
+ return Reflect.getOwnPropertyDescriptor(baseObj, prop);
51
+ }
52
+ },
53
+ has(_target, prop) {
54
+ return prop in extObj || prop in baseObj;
55
+ },
56
+ });
57
+ }
@@ -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"}