@kerebron/extension-lsp 0.4.1
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.
- package/LICENSE +23 -0
- package/README.md +82 -0
- package/esm/_dnt.polyfills.d.ts +101 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +127 -0
- package/esm/_dnt.shims.d.ts +6 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +61 -0
- package/esm/editor/src/CoreEditor.d.ts +40 -0
- package/esm/editor/src/CoreEditor.d.ts.map +1 -0
- package/esm/editor/src/CoreEditor.js +252 -0
- package/esm/editor/src/DummyEditorView.d.ts +60 -0
- package/esm/editor/src/DummyEditorView.d.ts.map +1 -0
- package/esm/editor/src/DummyEditorView.js +277 -0
- package/esm/editor/src/Extension.d.ts +31 -0
- package/esm/editor/src/Extension.d.ts.map +1 -0
- package/esm/editor/src/Extension.js +53 -0
- package/esm/editor/src/ExtensionManager.d.ts +32 -0
- package/esm/editor/src/ExtensionManager.d.ts.map +1 -0
- package/esm/editor/src/ExtensionManager.js +260 -0
- package/esm/editor/src/Mark.d.ts +23 -0
- package/esm/editor/src/Mark.d.ts.map +1 -0
- package/esm/editor/src/Mark.js +51 -0
- package/esm/editor/src/Node.d.ts +32 -0
- package/esm/editor/src/Node.d.ts.map +1 -0
- package/esm/editor/src/Node.js +60 -0
- package/esm/editor/src/commands/CommandManager.d.ts +23 -0
- package/esm/editor/src/commands/CommandManager.d.ts.map +1 -0
- package/esm/editor/src/commands/CommandManager.js +118 -0
- package/esm/editor/src/commands/baseCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/baseCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/baseCommandFactories.js +836 -0
- package/esm/editor/src/commands/createChainableState.d.ts +3 -0
- package/esm/editor/src/commands/createChainableState.d.ts.map +1 -0
- package/esm/editor/src/commands/createChainableState.js +29 -0
- package/esm/editor/src/commands/keyCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/keyCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/keyCommandFactories.js +10 -0
- package/esm/editor/src/commands/mod.d.ts +7 -0
- package/esm/editor/src/commands/mod.d.ts.map +1 -0
- package/esm/editor/src/commands/mod.js +76 -0
- package/esm/editor/src/commands/replaceCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/replaceCommandFactories.js +94 -0
- package/esm/editor/src/commands/types.d.ts +18 -0
- package/esm/editor/src/commands/types.d.ts.map +1 -0
- package/esm/editor/src/commands/types.js +1 -0
- package/esm/editor/src/mod.d.ts +9 -0
- package/esm/editor/src/mod.d.ts.map +1 -0
- package/esm/editor/src/mod.js +8 -0
- package/esm/editor/src/nodeToTreeString.d.ts +10 -0
- package/esm/editor/src/nodeToTreeString.d.ts.map +1 -0
- package/esm/editor/src/nodeToTreeString.js +74 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +6 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +1 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.js +24 -0
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts +23 -0
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts.map +1 -0
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +163 -0
- package/esm/editor/src/plugins/keymap/keymap.d.ts +11 -0
- package/esm/editor/src/plugins/keymap/keymap.d.ts.map +1 -0
- package/esm/editor/src/plugins/keymap/keymap.js +125 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts +4 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts.map +1 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.js +124 -0
- package/esm/editor/src/types.d.ts +52 -0
- package/esm/editor/src/types.d.ts.map +1 -0
- package/esm/editor/src/types.js +1 -0
- package/esm/editor/src/ui.d.ts +15 -0
- package/esm/editor/src/ui.d.ts.map +1 -0
- package/esm/editor/src/ui.js +16 -0
- package/esm/editor/src/utilities/SmartOutput.d.ts +41 -0
- package/esm/editor/src/utilities/SmartOutput.d.ts.map +1 -0
- package/esm/editor/src/utilities/SmartOutput.js +228 -0
- package/esm/editor/src/utilities/createNodeFromContent.d.ts +9 -0
- package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +1 -0
- package/esm/editor/src/utilities/createNodeFromContent.js +32 -0
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts +9 -0
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +1 -0
- package/esm/editor/src/utilities/getHtmlAttributes.js +47 -0
- package/esm/editor/src/utilities/getShadowRoot.d.ts +2 -0
- package/esm/editor/src/utilities/getShadowRoot.d.ts.map +1 -0
- package/esm/editor/src/utilities/getShadowRoot.js +16 -0
- package/esm/editor/src/utilities/mod.d.ts +6 -0
- package/esm/editor/src/utilities/mod.d.ts.map +1 -0
- package/esm/editor/src/utilities/mod.js +5 -0
- package/esm/editor/src/utilities/toRawTextResult.d.ts +3 -0
- package/esm/editor/src/utilities/toRawTextResult.d.ts.map +1 -0
- package/esm/editor/src/utilities/toRawTextResult.js +21 -0
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +8 -0
- package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/AutocompletePlugin.js +232 -0
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +17 -0
- package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/DefaultRenderer.js +137 -0
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +26 -0
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +30 -0
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +11 -0
- package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/createDefaultMatcher.js +58 -0
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +4 -0
- package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/createRegexMatcher.js +50 -0
- package/esm/extension-autocomplete/src/mod.d.ts +3 -0
- package/esm/extension-autocomplete/src/mod.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/mod.js +2 -0
- package/esm/extension-autocomplete/src/types.d.ts +60 -0
- package/esm/extension-autocomplete/src/types.d.ts.map +1 -0
- package/esm/extension-autocomplete/src/types.js +1 -0
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +15 -0
- package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +1 -0
- package/esm/extension-basic-editor/src/ExtensionHtml.js +108 -0
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +32 -0
- package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +1 -0
- package/esm/extension-lsp/src/DiagnosticPlugin.js +131 -0
- package/esm/extension-lsp/src/ExtensionLsp.d.ts +25 -0
- package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +1 -0
- package/esm/extension-lsp/src/ExtensionLsp.js +126 -0
- package/esm/extension-lsp/src/LSPClient.d.ts +56 -0
- package/esm/extension-lsp/src/LSPClient.d.ts.map +1 -0
- package/esm/extension-lsp/src/LSPClient.js +449 -0
- package/esm/extension-lsp/src/LspWebSocketTransport.d.ts +20 -0
- package/esm/extension-lsp/src/LspWebSocketTransport.d.ts.map +1 -0
- package/esm/extension-lsp/src/LspWebSocketTransport.js +137 -0
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +8 -0
- package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +1 -0
- package/esm/extension-lsp/src/computeIncrementalChanges.js +82 -0
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts +23 -0
- package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +1 -0
- package/esm/extension-lsp/src/createLspAutocomplete.js +68 -0
- package/esm/extension-lsp/src/mod.d.ts +5 -0
- package/esm/extension-lsp/src/mod.d.ts.map +1 -0
- package/esm/extension-lsp/src/mod.js +4 -0
- package/esm/extension-lsp/src/types.d.ts +20 -0
- package/esm/extension-lsp/src/types.d.ts.map +1 -0
- package/esm/extension-lsp/src/types.js +1 -0
- package/esm/extension-lsp/src/workspace.d.ts +62 -0
- package/esm/extension-lsp/src/workspace.d.ts.map +1 -0
- package/esm/extension-lsp/src/workspace.js +168 -0
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +36 -0
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +1 -0
- package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +240 -0
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +26 -0
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +1 -0
- package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +115 -0
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +22 -0
- package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +1 -0
- package/esm/extension-markdown/src/ExtensionMarkdown.js +48 -0
- package/esm/extension-markdown/src/MarkdownParser.d.ts +61 -0
- package/esm/extension-markdown/src/MarkdownParser.d.ts.map +1 -0
- package/esm/extension-markdown/src/MarkdownParser.js +249 -0
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts +42 -0
- package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +1 -0
- package/esm/extension-markdown/src/MarkdownSerializer.js +325 -0
- package/esm/extension-markdown/src/PositionMapper.d.ts +15 -0
- package/esm/extension-markdown/src/PositionMapper.d.ts.map +1 -0
- package/esm/extension-markdown/src/PositionMapper.js +100 -0
- package/esm/extension-markdown/src/TokenSource.d.ts +11 -0
- package/esm/extension-markdown/src/TokenSource.d.ts.map +1 -0
- package/esm/extension-markdown/src/TokenSource.js +39 -0
- package/esm/extension-markdown/src/mdToPmConverter.d.ts +5 -0
- package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +1 -0
- package/esm/extension-markdown/src/mdToPmConverter.js +111 -0
- package/esm/extension-markdown/src/pmToMdConverter.d.ts +16 -0
- package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +1 -0
- package/esm/extension-markdown/src/pmToMdConverter.js +433 -0
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +4 -0
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +151 -0
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +3 -0
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +34 -0
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +6 -0
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +380 -0
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +3 -0
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +323 -0
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +9 -0
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +1 -0
- package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +308 -0
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +5 -0
- package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +1 -0
- package/esm/extension-markdown/src/treeSitterTokenizer.js +769 -0
- package/esm/extension-markdown/src/types.d.ts +28 -0
- package/esm/extension-markdown/src/types.d.ts.map +1 -0
- package/esm/extension-markdown/src/types.js +131 -0
- package/esm/extension-markdown/src/utils.d.ts +8 -0
- package/esm/extension-markdown/src/utils.d.ts.map +1 -0
- package/esm/extension-markdown/src/utils.js +86 -0
- package/esm/package.json +3 -0
- package/esm/tree-sitter-shim/src/main.d.ts +15 -0
- package/esm/tree-sitter-shim/src/main.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/main.js +25 -0
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +6 -0
- package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/node.js +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +7 -0
- package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/parser.js +5 -0
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +6 -0
- package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +1 -0
- package/esm/tree-sitter-shim/src/tree_sitter/tree.js +1 -0
- package/esm/wasm/src/mod.d.ts +12 -0
- package/esm/wasm/src/mod.d.ts.map +1 -0
- package/esm/wasm/src/mod.js +48 -0
- package/esm/wasm/wasm.d.ts +138 -0
- package/esm/wasm/wasm.d.ts.map +1 -0
- package/esm/wasm/wasm.js +120 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Permission is hereby granted, free of charge, to any
|
|
2
|
+
person obtaining a copy of this software and associated
|
|
3
|
+
documentation files (the "Software"), to deal in the
|
|
4
|
+
Software without restriction, including without
|
|
5
|
+
limitation the rights to use, copy, modify, merge,
|
|
6
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
7
|
+
the Software, and to permit persons to whom the Software
|
|
8
|
+
is furnished to do so, subject to the following
|
|
9
|
+
conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice
|
|
12
|
+
shall be included in all copies or substantial portions
|
|
13
|
+
of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
16
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
17
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
18
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
19
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
22
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
23
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Kerebron - Prosemirror based online editor kit
|
|
2
|
+
|
|
3
|
+
## Watch a Demo
|
|
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>
|
|
8
|
+
|
|
9
|
+
## Playground Demo
|
|
10
|
+
|
|
11
|
+
[playground](https://demo.kerebron.com) - be nice.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Using vanilla Prosemirror modules is often impossible because of
|
|
16
|
+
incompatibilities.
|
|
17
|
+
|
|
18
|
+
Kerebron forks several prosemirror projects into one monorepo in order to keep
|
|
19
|
+
them in sync.
|
|
20
|
+
|
|
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.
|
|
23
|
+
|
|
24
|
+
It has simplified tooling (deno), fewer dependencies and resulting in lower
|
|
25
|
+
number of output npm modules.
|
|
26
|
+
|
|
27
|
+
**Work in progress**
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Build
|
|
31
|
+
|
|
32
|
+
### Build static examples and `.wasm` files
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
deno task build
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Development
|
|
39
|
+
|
|
40
|
+
To start example server:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
deno task -f server-deno-hono start
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
TODO
|
|
49
|
+
|
|
50
|
+
### NPM packages are generated using DNT
|
|
51
|
+
|
|
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/
|
|
56
|
+
|
|
57
|
+
To generate npm packages
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
deno -A ./build/build_npm.ts
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Run through docker
|
|
64
|
+
|
|
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
|
|
71
|
+
|
|
72
|
+
Install deno
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
npm install -g deno
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Install rust
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
82
|
+
```
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,eAAO,MAAM,aAAa;;CAA2C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Deno } from "@deno/shim-deno";
|
|
2
|
+
export { Deno } from "@deno/shim-deno";
|
|
3
|
+
const dntGlobals = {
|
|
4
|
+
Deno,
|
|
5
|
+
};
|
|
6
|
+
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
7
|
+
function createMergeProxy(baseObj, extObj) {
|
|
8
|
+
return new Proxy(baseObj, {
|
|
9
|
+
get(_target, prop, _receiver) {
|
|
10
|
+
if (prop in extObj) {
|
|
11
|
+
return extObj[prop];
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return baseObj[prop];
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
set(_target, prop, value) {
|
|
18
|
+
if (prop in extObj) {
|
|
19
|
+
delete extObj[prop];
|
|
20
|
+
}
|
|
21
|
+
baseObj[prop] = value;
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
deleteProperty(_target, prop) {
|
|
25
|
+
let success = false;
|
|
26
|
+
if (prop in extObj) {
|
|
27
|
+
delete extObj[prop];
|
|
28
|
+
success = true;
|
|
29
|
+
}
|
|
30
|
+
if (prop in baseObj) {
|
|
31
|
+
delete baseObj[prop];
|
|
32
|
+
success = true;
|
|
33
|
+
}
|
|
34
|
+
return success;
|
|
35
|
+
},
|
|
36
|
+
ownKeys(_target) {
|
|
37
|
+
const baseKeys = Reflect.ownKeys(baseObj);
|
|
38
|
+
const extKeys = Reflect.ownKeys(extObj);
|
|
39
|
+
const extKeysSet = new Set(extKeys);
|
|
40
|
+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
41
|
+
},
|
|
42
|
+
defineProperty(_target, prop, desc) {
|
|
43
|
+
if (prop in extObj) {
|
|
44
|
+
delete extObj[prop];
|
|
45
|
+
}
|
|
46
|
+
Reflect.defineProperty(baseObj, prop, desc);
|
|
47
|
+
return true;
|
|
48
|
+
},
|
|
49
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
50
|
+
if (prop in extObj) {
|
|
51
|
+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
has(_target, prop) {
|
|
58
|
+
return prop in extObj || prop in baseObj;
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { Node as ProseMirrorNode, Schema } from 'prosemirror-model';
|
|
3
|
+
import type { EditorConfig, JSONContent } from './types.js';
|
|
4
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
5
|
+
import { DummyEditorView } from './DummyEditorView.js';
|
|
6
|
+
import { ChainedCommands } from './commands/mod.js';
|
|
7
|
+
import { Extension } from './Extension.js';
|
|
8
|
+
import { EditorUi } from './ui.js';
|
|
9
|
+
export declare class CoreEditor extends EventTarget {
|
|
10
|
+
readonly config: Partial<EditorConfig>;
|
|
11
|
+
private extensionManager;
|
|
12
|
+
private commandManager;
|
|
13
|
+
view: EditorView | DummyEditorView;
|
|
14
|
+
state: EditorState;
|
|
15
|
+
ui: EditorUi;
|
|
16
|
+
constructor(config?: Partial<EditorConfig>);
|
|
17
|
+
getExtension<T extends Extension>(name: string): T | undefined;
|
|
18
|
+
get schema(): Schema<any, any>;
|
|
19
|
+
get run(): {
|
|
20
|
+
[key: string]: (...args: any[]) => boolean;
|
|
21
|
+
};
|
|
22
|
+
get commandFactories(): {
|
|
23
|
+
[key: string]: import("./commands/types.js").CommandFactory;
|
|
24
|
+
};
|
|
25
|
+
chain(): ChainedCommands;
|
|
26
|
+
can(): ChainedCommands;
|
|
27
|
+
private createView;
|
|
28
|
+
dispatchTransaction(transaction: Transaction): void;
|
|
29
|
+
private setupPlugins;
|
|
30
|
+
clearDocument(): void;
|
|
31
|
+
setDocument(content: any): void;
|
|
32
|
+
getDocument(): ProseMirrorNode;
|
|
33
|
+
loadDocument(mediaType: string, content: Uint8Array): Promise<void>;
|
|
34
|
+
saveDocument(mediaType: string): Promise<Uint8Array>;
|
|
35
|
+
getJSON(): JSONContent;
|
|
36
|
+
clone(options?: Partial<EditorConfig>): CoreEditor;
|
|
37
|
+
debug(doc?: ProseMirrorNode): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=CoreEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/src/CoreEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAc9C,qBAAa,UAAW,SAAQ,WAAW;IACzC,SAAgB,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAG3C;IACF,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IAChC,IAAI,EAAG,UAAU,GAAG,eAAe,CAAC;IACpC,KAAK,EAAG,WAAW,CAAC;IACpB,EAAE,EAAE,QAAQ,CAAmB;gBAE1B,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IA+B9C,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI9D,IAAW,MAAM,qBAEhB;IAED,IAAW,GAAG;;MAEb;IAED,IAAW,gBAAgB;;MAE1B;IAEM,KAAK,IAAI,eAAe;IAIxB,GAAG,IAAI,eAAe;IAI7B,OAAO,CAAC,UAAU;IA8CX,mBAAmB,CAAC,WAAW,EAAE,WAAW;IAsBnD,OAAO,CAAC,YAAY;IAcb,aAAa;IASb,WAAW,CAAC,OAAO,EAAE,GAAG;IAyBxB,WAAW;IAIL,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IA0BnD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAY1D,OAAO,IAAI,WAAW;IAItB,KAAK,CAAC,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,UAAU;IAOtD,KAAK,CAAC,GAAG,CAAC,EAAE,eAAe;IAO3B,OAAO;CAOf"}
|