@dxos/react-ui-editor 0.3.10-main.3645708 → 0.3.10-main.375af01
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/dist/lib/browser/index.mjs +74 -99
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/hooks/automerge/PatchSemaphore.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/amToCodemirror.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/automerge.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/codeMirrorToAm.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/handle.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/index.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/plugin.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextModel.d.ts +3 -4
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/testing/replicator.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/components/TextEditor/TextEditor.tsx +7 -10
- package/src/{automerge → hooks/automerge}/automerge.stories.tsx +2 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useTextModel.ts +47 -42
- package/src/testing/replicator.ts +2 -3
- package/dist/types/src/automerge/automerge-plugin/PatchSemaphore.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-plugin/amToCodemirror.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-plugin/codeMirrorToAm.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-plugin/handle.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-plugin/index.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-plugin/plugin.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/useCollaboration.d.ts +0 -9
- package/dist/types/src/hooks/useCollaboration.d.ts.map +0 -1
- package/src/hooks/useCollaboration.ts +0 -45
- /package/dist/types/src/{automerge/automerge-plugin → hooks/automerge}/PatchSemaphore.d.ts +0 -0
- /package/dist/types/src/{automerge/automerge-plugin → hooks/automerge}/amToCodemirror.d.ts +0 -0
- /package/dist/types/src/{automerge → hooks/automerge}/automerge.stories.d.ts +0 -0
- /package/dist/types/src/{automerge/automerge-plugin → hooks/automerge}/codeMirrorToAm.d.ts +0 -0
- /package/dist/types/src/{automerge/automerge-plugin → hooks/automerge}/handle.d.ts +0 -0
- /package/dist/types/src/{automerge/automerge-plugin → hooks/automerge}/index.d.ts +0 -0
- /package/dist/types/src/{automerge/automerge-plugin → hooks/automerge}/plugin.d.ts +0 -0
- /package/src/{automerge/automerge-plugin → hooks/automerge}/PatchSemaphore.ts +0 -0
- /package/src/{automerge/automerge-plugin → hooks/automerge}/amToCodemirror.ts +0 -0
- /package/src/{automerge/automerge-plugin → hooks/automerge}/codeMirrorToAm.ts +0 -0
- /package/src/{automerge/automerge-plugin → hooks/automerge}/handle.ts +0 -0
- /package/src/{automerge/automerge-plugin → hooks/automerge}/index.ts +0 -0
- /package/src/{automerge/automerge-plugin → hooks/automerge}/plugin.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/index.ts", "../../../src/components/TextEditor/index.ts", "../../../src/components/TextEditor/extensions/autocomplete.ts", "../../../src/components/TextEditor/extensions/basic.ts", "../../../src/components/TextEditor/extensions/link.ts", "../../../src/components/TextEditor/extensions/listener.ts", "../../../src/components/TextEditor/extensions/markdown/bundle.ts", "../../../src/components/TextEditor/extensions/markdown/highlight.ts", "../../../src/styles/markdown.ts", "../../../src/styles/tokens.ts", "../../../src/components/TextEditor/extensions/tasklist.ts", "../../../src/components/TextEditor/extensions/tooltip.tsx", "../../../src/components/TextEditor/themes/default.ts", "../../../src/components/TextEditor/TextEditor.tsx", "../../../src/hooks/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nexport { TextKind } from '@dxos/protocols/proto/dxos/echo/model/text';\nexport { Doc, YText, YXmlFragment } from '@dxos/text-model';\n\nexport * from './components';\nexport * from './hooks';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport { tags } from '@lezer/highlight';\nexport { type Extension } from '@codemirror/state';\n\nexport * from './extensions';\nexport * from './themes';\n\nexport * from './TextEditor';\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Automcomplete: https://codemirror.net/5/doc/manual.html#addon_runmode\n// TODO(burdon): Modes: parallel parsing and decoration (e.g., associated with language).\n// TODO(burdon): Add-on: runmode: run lexer over content (with rendering codemirror).\n// https://codemirror.net/5/doc/manual.html#addon_runmode\n// TODO(burdon): Add-on: dialog.\n// TODO(burdon): Comments: https://codemirror.net/5/doc/manual.html#setBookmark\n// TODO(burdon): Split view: https://codemirror.net/examples/split\n\n// https://codemirror.net/examples/autocompletion\n// https://codemirror.net/docs/ref/#autocomplete.autocompletion\n// https://codemirror.net/docs/ref/#autocomplete.Completion\n\nimport {\n autocompletion,\n type Completion,\n type CompletionContext,\n completionKeymap,\n type CompletionResult,\n} from '@codemirror/autocomplete';\nimport { keymap } from '@codemirror/view';\n\nexport type AutocompleteOptions = {\n getOptions: (text: string) => Completion[];\n};\n\n/**\n * Autocomplete extension.\n */\nexport const autocomplete = ({ getOptions }: AutocompleteOptions) => {\n return [\n // https://codemirror.net/docs/ref/#view.keymap\n // https://discuss.codemirror.net/t/how-can-i-replace-the-default-autocompletion-keymap-v6/3322\n keymap.of(completionKeymap),\n\n // https://codemirror.net/examples/autocompletion\n // https://codemirror.net/docs/ref/#autocomplete.autocompletion\n autocompletion({\n // TODO(burdon): Set custom keymap.\n // defaultKeymap: false,\n\n // Don't start unless key press.\n activateOnTyping: false,\n\n // TODO(burdon): Option to create new page?\n // TODO(burdon): Optional decoration via addToOptions\n override: [\n (context: CompletionContext): CompletionResult | null => {\n const word = context.matchBefore(/\\w*/);\n if (!word || (word.from === word.to && !context.explicit)) {\n return null;\n }\n\n // TODO(burdon): Option to convert to links?\n return {\n from: word.from,\n options: getOptions(word.text.toLowerCase()),\n // options: [\n // { label: 'apple', type: 'keyword' },\n // { label: 'amazon', type: 'keyword' },\n // { label: 'hello', type: 'variable', info: '(World)' },\n // { label: 'magic', type: 'text', apply: '⠁⭒*.✩.*⭒⠁', detail: 'macro' },\n // ],\n };\n },\n ],\n }),\n ];\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { closeBrackets } from '@codemirror/autocomplete';\nimport { bracketMatching, defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { type Extension } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport { EditorView, placeholder } from '@codemirror/view';\n\nimport type { ThemeMode } from '@dxos/react-ui';\n\nexport type BasicBundleOptions = {\n themeMode?: ThemeMode;\n placeholder?: string;\n};\n\nexport const basicBundle = ({ themeMode, placeholder: _placeholder }: BasicBundleOptions): Extension[] =>\n [\n // TODO(burdon): Compare with minimalSetup.\n // https://codemirror.net/docs/ref/#codemirror.minimalSetup\n bracketMatching(),\n closeBrackets(),\n EditorView.lineWrapping,\n\n _placeholder && placeholder(_placeholder),\n\n // TODO(burdon): Is this required?\n themeMode === 'dark' ? syntaxHighlighting(oneDarkHighlightStyle) : syntaxHighlighting(defaultHighlightStyle),\n ].filter(Boolean) as Extension[];\n", "//\n// Copyright 2023 DXOS.org\n// Copyright CodeMirror\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport {\n type EditorState,\n type Extension,\n type RangeSet,\n RangeSetBuilder,\n StateField,\n type Transaction,\n} from '@codemirror/state';\nimport { Decoration, EditorView, WidgetType } from '@codemirror/view';\n\n// Adapted from:\n// https://codemirror.net/try/?c=aW1wb3J0IHsgYmFzaWNTZXR1cCwgRWRp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ICAgIGVudGVyOiAobm9kZSkgPT4gewogICAgICAgIGlmICgoY3Vyc29yIDwgbm9kZS5mcm9tIHx8IGN1cnNvciA+IG5vZGUudG8pICYmIG5vZGUubmFtZSA9PSAiTGluayIpIHsKICAgICAgICAgIGxldCBtYXJrcyA9IG5vZGUubm9kZS5nZXRDaGlsZHJlbigiTGlua01hcmsiKTsKICAgICAgICAgIGxldCB0ZXh0ID0gbWFya3MubGVuZ3RoID49IDIgPyB0ci5zdGF0ZS5zbGljZURvYyhtYXJrc1swXS50bywgbWFya3NbMV0uZnJvbSkgOiAiIgoKICAgICAgICAgIGxldCB1cmxOb2RlID0gbm9kZS5ub2RlLmdldENoaWxkKCJVUkwiKTsKICAgICAgICAgIGxldCB1cmwgPSB1cmxOb2RlID8gdHIuc3RhdGUuc2xpY2VEb2ModXJsTm9kZS5mcm9tLCB1cmxOb2RlLnRvKSA6ICIiCiAgICAgICAgICBidWlsZGVyLmFkZChub2RlLmZyb20sIG5vZGUudG8sIERlY29yYXRpb24ucmVwbGFjZSh7CiAgICAgICAgICAgIHdpZGdldDogbmV3IExpbmsodGV4dCwgdXJsKSwKICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfSwKICAgIH0pOwogICAgcmV0dXJuIGJ1aWxkZXIuZmluaXNoKCk7CiAgfSwKICBwcm92aWRlOiAoZikgPT4gRWRpdG9yVmlldy5kZWNvcmF0aW9ucy5mcm9tKGYpLAp9KTsKCmxldCB2aWV3ID0gbmV3IEVkaXRvclZpZXcoewogIGRvYzogIiMgSGVsbG8gV29ybGRcblxuW1Rlc3RdKGh0dHBzOi8vZXhhbXBsZS5jb20pXG5cblxuIiwKICBleHRlbnNpb25zOiBbZGVjb3JhdGlvbnNGaWVsZCwgbWFya2Rvd24oKV0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5LAp9KTsKCnZpZXcuZm9jdXMoKTs=\n// https://discuss.codemirror.net/t/link-widget-is-clicked-only-if-editor-is-out-of-focus/7433\n\n// TODO(burdon): Adapt to make all markdown editable?\n\n// TODO(burdon): Research overlays.\n// https://stackoverflow.com/questions/26933344/codemirror-detect-and-create-links-inside-editor\n// https://codemirror.net/5/doc/manual.html#addOverlay\n// https://codemirror.net/5/demo/simplemode.html\n// https://codemirror.net/5/demo/search.html (Search dialog).\n\nclass LinkButton extends WidgetType {\n constructor(\n private readonly _pos: number,\n private readonly _url: string,\n private readonly _onAttach: LinkOptions['onRender'],\n ) {\n super();\n }\n\n override eq(other: LinkButton) {\n return this._pos === other._pos && this._url === other._url;\n }\n\n toDOM(view: EditorView) {\n const el = document.createElement('span');\n this._onAttach!(el, this._url);\n return el;\n }\n}\n\nclass LinkText extends WidgetType {\n constructor(private readonly _pos: number, private readonly _text: string, private readonly _url?: string) {\n super();\n }\n\n override eq(other: LinkText) {\n return this._pos === other._pos && this._url === other._url;\n }\n\n toDOM(view: EditorView) {\n const link = document.createElement('a');\n link.setAttribute('class', 'cm-link');\n link.textContent = this._text;\n if (this._url) {\n link.setAttribute('rel', 'noreferrer');\n link.setAttribute('target', '_blank');\n link.href = this._url;\n } else {\n link.onclick = () => {\n view.dispatch({\n selection: {\n anchor: this._pos,\n },\n });\n };\n }\n\n return link;\n }\n}\n\nconst update = (state: EditorState, options: LinkOptions) => {\n const builder = new RangeSetBuilder();\n const cursor = state.selection.main.head;\n syntaxTree(state).iterate({\n enter: (node) => {\n // Check if cursor is inside text.\n if (node.name === 'Link') {\n const marks = node.node.getChildren('LinkMark');\n const text = marks.length >= 2 ? state.sliceDoc(marks[0].to, marks[1].from) : '';\n\n const urlNode = node.node.getChild('URL');\n const url = urlNode ? state.sliceDoc(urlNode.from, urlNode.to) : '';\n\n if (cursor < node.from || cursor > node.to) {\n builder.add(\n node.from,\n node.to,\n Decoration.replace({\n widget: new LinkText(node.from, text, options.link ? url : undefined),\n }),\n );\n }\n\n if (options.onRender) {\n builder.add(\n node.to,\n node.to,\n Decoration.replace({\n widget: new LinkButton(node.from, url, options.onRender),\n }),\n );\n }\n }\n\n return true;\n },\n });\n\n return builder.finish();\n};\n\nexport type LinkOptions = {\n link?: boolean;\n onRender?: (el: Element, url: string) => void;\n};\n\n/**\n * Creates a state field to replace AST elements with a hyperlink widget.\n * https://codemirror.net/docs/ref/#state.StateField\n */\nexport const link = (options: LinkOptions = {}): Extension => {\n return StateField.define<RangeSet<any>>({\n create: (state) => update(state, options),\n update: (_: RangeSet<any>, tr: Transaction) => update(tr.state, options),\n provide: (field) => EditorView.decorations.from(field),\n });\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StateField } from '@codemirror/state';\n\nexport type TextListener = (text: string) => void;\n\n/**\n * Based on https://github.com/codemirror/dev/issues/44#issuecomment-789093799\n */\nexport const listener = (onChange: TextListener) =>\n StateField.define({\n create: () => null,\n update: (_value, transaction) => {\n if (transaction.docChanged && onChange) {\n onChange(transaction.newDoc.toString());\n }\n\n return null;\n },\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete';\nimport { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport { markdownLanguage, markdown } from '@codemirror/lang-markdown';\nimport {\n bracketMatching,\n defaultHighlightStyle,\n foldKeymap,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { languages } from '@codemirror/language-data';\nimport { lintKeymap } from '@codemirror/lint';\nimport { highlightSelectionMatches, searchKeymap } from '@codemirror/search';\nimport { EditorState, type Extension } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport {\n crosshairCursor,\n drawSelection,\n dropCursor,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n highlightSpecialChars,\n keymap,\n placeholder,\n rectangularSelection,\n} from '@codemirror/view';\n\nimport type { ThemeMode } from '@dxos/react-ui';\n\nimport { markdownHighlightStyle, markdownTagsExtension } from './highlight';\n\nexport type MarkdownBundleOptions = {\n themeMode?: ThemeMode;\n placeholder?: string;\n};\n\nexport const markdownBundle = ({ themeMode, placeholder: _placeholder }: MarkdownBundleOptions): Extension[] => {\n // All of https://github.com/codemirror/basic-setup minus line numbers and fold gutter.\n // https://codemirror.net/docs/ref/#codemirror.basicSetup\n return [\n bracketMatching(),\n closeBrackets(),\n _placeholder && placeholder(_placeholder),\n\n EditorState.allowMultipleSelections.of(true),\n EditorView.lineWrapping,\n\n // autocompletion(),\n crosshairCursor(),\n dropCursor(),\n drawSelection(),\n highlightActiveLine(),\n highlightActiveLineGutter(),\n highlightSelectionMatches(),\n highlightSpecialChars(),\n history(),\n indentOnInput(),\n rectangularSelection(),\n\n keymap.of([\n ...closeBracketsKeymap,\n // ...completionKeymap,\n ...defaultKeymap,\n ...foldKeymap,\n ...historyKeymap,\n ...lintKeymap,\n ...searchKeymap,\n indentWithTab,\n ]),\n\n // Main extension.\n // https://github.com/codemirror/lang-markdown\n // https://codemirror.net/5/mode/markdown/index.html (demo).\n markdown({\n // GRM by default (vs strict CommonMark):\n // Table, TaskList, Strikethrough, and Autolink.\n // NOTE: This extends the parser; it doesn't affect rendering.\n // https://github.github.com/gfm\n // https://github.com/lezer-parser/markdown?tab=readme-ov-file#github-flavored-markdown\n base: markdownLanguage,\n\n // Languages for syntax highlighting fenced code blocks.\n codeLanguages: languages,\n\n // Parser extensions.\n extensions: [\n // GFM, // TODO(burdon): Provided by default?\n markdownTagsExtension,\n ],\n }),\n\n // Custom styles.\n syntaxHighlighting(markdownHighlightStyle),\n\n // TODO(thure): All but one rule here apply to both themes; rename or refactor.\n themeMode === 'dark' ? syntaxHighlighting(oneDarkHighlightStyle) : syntaxHighlighting(defaultHighlightStyle),\n ].filter(Boolean) as Extension[];\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { markdownLanguage } from '@codemirror/lang-markdown';\nimport { HighlightStyle } from '@codemirror/language';\nimport { tags, styleTags, Tag } from '@lezer/highlight';\nimport { type MarkdownConfig } from '@lezer/markdown';\nimport get from 'lodash.get';\n\nimport {\n blockquote,\n bold,\n code,\n codeMark,\n heading,\n horizontalRule,\n inlineUrl,\n italic,\n mark,\n strikethrough,\n tokens,\n} from '../../../../styles';\n\n/**\n * Custom tags defined and processed by the GFM lezer extension.\n * https://github.com/lezer-parser/markdown\n * https://github.com/lezer-parser/markdown/blob/main/src/markdown.ts\n */\nexport const markdownTags = {\n Blockquote: Tag.define(),\n CodeMark: Tag.define(),\n CodeText: Tag.define(),\n EmphasisMark: Tag.define(),\n HeaderMark: Tag.define(),\n HorizontalRule: Tag.define(),\n InlineCode: Tag.define(),\n LinkLabel: Tag.define(),\n LinkReference: Tag.define(),\n ListMark: Tag.define(),\n QuoteMark: Tag.define(),\n URL: Tag.define(),\n};\n\nexport const markdownTagsExtension: MarkdownConfig = {\n props: [styleTags(markdownTags)],\n};\n\n/**\n * Styling based on `lezer` parser tags.\n * https://codemirror.net/examples/styling\n * https://github.com/lezer-parser/highlight\n * https://lezer.codemirror.net/docs/ref/#highlight (list of tags)\n */\nexport const markdownHighlightStyle = HighlightStyle.define(\n [\n {\n tag: [\n tags.keyword,\n tags.name,\n tags.deleted,\n tags.character,\n tags.propertyName,\n tags.macroName,\n tags.color,\n tags.constant(tags.name),\n tags.standard(tags.name),\n tags.definition(tags.name),\n tags.separator,\n tags.typeName,\n tags.className,\n tags.number,\n tags.changed,\n tags.annotation,\n tags.modifier,\n tags.self,\n tags.namespace,\n tags.operator,\n tags.operatorKeyword,\n tags.escape,\n tags.regexp,\n tags.special(tags.string),\n tags.meta,\n tags.comment,\n tags.atom,\n tags.bool,\n tags.special(tags.variableName),\n tags.processingInstruction,\n tags.string,\n tags.inserted,\n tags.invalid,\n ],\n color: 'inherit !important',\n },\n\n // Markdown marks.\n {\n tag: [\n tags.meta,\n tags.processingInstruction,\n markdownTags.CodeMark,\n markdownTags.EmphasisMark,\n markdownTags.HeaderMark,\n markdownTags.LinkLabel,\n markdownTags.LinkReference,\n markdownTags.ListMark,\n markdownTags.QuoteMark,\n ],\n class: mark,\n },\n\n // Headings.\n { tag: tags.heading1, class: heading[1] },\n { tag: tags.heading2, class: heading[2] },\n { tag: tags.heading3, class: heading[3] },\n { tag: tags.heading4, class: heading[4] },\n { tag: tags.heading5, class: heading[5] },\n { tag: tags.heading6, class: heading[6] },\n\n // Emphasis.\n { tag: tags.emphasis, class: italic },\n { tag: tags.strong, class: bold },\n { tag: tags.strikethrough, class: strikethrough },\n\n // Naked URLs.\n {\n tag: [markdownTags.URL],\n class: inlineUrl,\n },\n\n // E.g., code block language (after ```).\n {\n tag: [tags.function(tags.variableName), tags.labelName],\n class: codeMark,\n },\n\n // The `markdown` extension configures extensions for `lezer` to parse markdown tokens (incl. below).\n // However, since `codeLanguages` is also defined, the `lezer` will not parse fenced code blocks,\n // when a language is specified. In this case, the syntax highlighting extensions will colorize\n // the code, but all other CSS properties will be inherited.\n {\n tag: [markdownTags.CodeText, markdownTags.InlineCode],\n class: code,\n },\n\n {\n tag: [markdownTags.QuoteMark],\n class: blockquote,\n },\n\n {\n tag: [markdownTags.HorizontalRule],\n class: horizontalRule,\n },\n\n // Main content, paragraphs, etc.\n // {\n // tag: [tags.content],\n // fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n // },\n ],\n {\n scope: markdownLanguage,\n all: { fontFamily: get(tokens, 'fontFamily.body', []).join(',') },\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { mx } from '@dxos/react-ui-theme';\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n// https://tailwindcss.com/docs/font-weight\nexport const heading: Record<HeadingLevel, string> = {\n 1: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-4xl',\n 2: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-3xl',\n 3: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-2xl',\n 4: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-xl',\n 5: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-lg',\n 6: 'mbs-4 mbe-2 font-medium text-inherit no-underline',\n};\n\nexport const text = 'text-neutral-800 dark:text-neutral-200';\nexport const light = 'text-neutral-200 dark:text-neutral-800';\n\nexport const mark = mx('!font-normal !no-underline !text-inherit opacity-40', light);\n\nexport const paragraph = 'mlb-1';\n\nexport const bold = 'font-bold';\nexport const italic = 'italic';\nexport const strikethrough = 'line-through';\n\nexport const code = 'font-mono !no-underline text-neutral-700 dark:text-neutral-300';\nexport const codeMark = 'font-mono text-primary-500';\nexport const codeBlock = 'mlb-2 font-mono bg-neutral-500/10 p-3 rounded';\n\nexport const inlineUrl = mx(code, 'px-1');\n\n// TODO(burdon): Replace with widget.\nexport const blockquote = mx('pl-1 mr-1 border-is-4 border-primary-500/70 dark:border-primary-500/30', light);\n\n// TODO(burdon): Replace with widget.\nexport const horizontalRule = 'flex mlb-4 border-b text-neutral-100 dark:text-neutral-900 border-neutral-500/50';\n\n// TODO(thure): Tailwind was not seeing `[&>li:before]:content-[\"•\"]` as a utility class, but it would work if instead of `\"•\"` it was `\"X\"`… why?\nexport const unorderedList =\n 'mlb-2 grid grid-cols-[min-content_1fr] [&>li:before]:content-[attr(marker)] [&>li:before]:mlb-1 [&>li:before]:mie-2';\nexport const orderedList =\n 'mlb-2 grid grid-cols-[min-content_1fr] [&>li:before]:content-[counters(section,_\".\")_\"._\"] [counter-reset:section] [&>li:before]:mlb-1';\n\nexport const listItem = 'contents before:[counter-increment:section]';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { StyleSpec } from 'style-mod';\n\nimport { tailwindConfig, type TailwindConfig } from '@dxos/react-ui-theme';\n\nexport type ThemeStyles = {\n [selector: string]: StyleSpec;\n};\n\n// TODO(thure): Why export the whole theme? Can this be done differently?\nexport const tokens: TailwindConfig['theme'] = tailwindConfig({}).theme;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport {\n type EditorState,\n type Extension,\n type RangeSet,\n RangeSetBuilder,\n StateField,\n type Transaction,\n} from '@codemirror/state';\nimport { EditorView, Decoration, WidgetType } from '@codemirror/view';\n\nclass CheckboxWidget extends WidgetType {\n constructor(private readonly _pos: number, private readonly _getCursor: () => number, private _checked: boolean) {\n super();\n }\n\n override eq(other: CheckboxWidget) {\n // Uniqueness based on position; also checks state.\n // TODO(burdon): Is this efficient? Check life-cycle.\n return this._pos === other._pos && this._checked === other._checked;\n }\n\n toDOM(view: EditorView) {\n // console.log('toDom', this._pos);\n const wrap = document.createElement('span');\n wrap.setAttribute('aria-hidden', 'true');\n wrap.className = 'cm-task-item';\n\n const box = wrap.appendChild(document.createElement('input'));\n box.type = 'checkbox';\n box.checked = this._checked;\n box.onclick = (event) => {\n this._checked = !isChecked(view.state, this._pos);\n view.dispatch({\n changes: {\n from: this._pos + 1,\n to: this._pos + 2,\n insert: this._checked ? 'x' : ' ',\n },\n // TODO(burdon): Restore cursor position? More useful to move to end of line (can indent).\n selection: {\n anchor: this._pos + 4,\n // anchor: this._getCursor(),\n },\n });\n return true;\n };\n\n return wrap;\n }\n\n // TODO(burdon): Remove listener?\n // override destroy() {\n // console.log('destroy', this._pos);\n // }\n\n override ignoreEvent() {\n return false;\n }\n}\n\nconst isChecked = (state: EditorState, pos: number) => {\n return state.sliceDoc(pos, pos + 3).toLowerCase() === '[x]';\n};\n\nexport const statefield = (): Extension => {\n let lastPosition: number = 0;\n const listener = EditorView.updateListener.of((update) => {\n lastPosition = update.startState.selection.main.head;\n });\n\n const checkbox = (state: EditorState) => {\n const builder = new RangeSetBuilder();\n syntaxTree(state).iterate({\n enter: (node) => {\n // console.log(node.name, node.from, node.to);\n if (node.name === 'TaskMarker') {\n builder.add(\n node.from,\n node.to,\n Decoration.replace({\n widget: new CheckboxWidget(node.from, () => lastPosition, isChecked(state, node.from)),\n }),\n );\n }\n },\n });\n\n return builder.finish();\n };\n\n return [\n listener,\n StateField.define<RangeSet<any>>({\n create: (state) => checkbox(state),\n update: (_: RangeSet<any>, tr: Transaction) => checkbox(tr.state),\n provide: (field) => EditorView.decorations.from(field),\n }),\n ];\n};\n\n// TODO(burdon): Reconcile with theme.\nexport const styles = EditorView.baseTheme({\n '& .cm-task-item': {\n padding: '0 4px',\n },\n});\n\nexport const tasklist = () => [statefield(), styles];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Extension } from '@codemirror/state';\nimport { hoverTooltip } from '@codemirror/view';\n\nimport { tooltipContent } from '@dxos/react-ui-theme';\n\nconst markdownLinkRegexp = /\\[([^\\]]+)]\\(([^)]+)\\)/;\n\nexport type TooltipOptions = {\n onHover: (el: Element, url: string) => void;\n regexp?: RegExp;\n};\n\n/**\n * https://codemirror.net/examples/tooltip\n * https://codemirror.net/docs/ref/#view.hoverTooltip\n * https://github.com/codemirror/view/blob/main/src/tooltip.ts\n */\nexport const tooltip = ({ onHover, regexp = markdownLinkRegexp }: TooltipOptions): Extension =>\n hoverTooltip((view, pos) => {\n const { from, text } = view.state.doc.lineAt(pos);\n const p = pos - from;\n\n let idx = 0;\n let match;\n do {\n match = text.substring(idx).match(regexp);\n if (!match) {\n match = undefined;\n break;\n }\n\n idx = text.indexOf(match[0]);\n if (p >= idx && p < idx + match[0].length) {\n break;\n }\n\n idx += match[0].length;\n } while (true);\n\n if (!match) {\n return null;\n }\n\n const [, , url] = match ?? [];\n\n return {\n pos: idx + from,\n end: idx + from + match[0].length,\n above: true,\n create: () => {\n const el = document.createElement('div');\n el.className = tooltipContent({}, 'pli-2 plb-1');\n onHover(el, url);\n return { dom: el, offset: { x: 0, y: 12 } };\n },\n };\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport get from 'lodash.get';\nimport { type StyleSpec } from 'style-mod';\n\nimport { tokens } from '../../../styles';\n\n/**\n * Minimal styles.\n * https://codemirror.net/examples/styling\n * NOTE: Use one of '&', '&light', and '&dark' prefix to scope instance.\n * NOTE: `light` and `dark` selectors are preprocessed by CodeMirror and can only be in the base theme.\n */\nexport const defaultTheme: {\n [selector: string]: StyleSpec;\n} = {\n //\n // Main layout:\n // <div class=\".cm-editor .cm-focused\">\n // <div class=\".cm-scroller\">\n // <div class=\".cm-content\" role=\"textbox\" contenteditable=\"true\">\n // <div class=\".cm-line\" />\n // </div>\n // </div>\n // </div>\n //\n '&': {},\n '&.cm-focused': {\n outline: 'none',\n },\n '& .cm-scroller': {\n overflow: 'visible',\n },\n '& .cm-content': {\n padding: 0,\n // Base font size (otherwise defined by HTML tag, which might be different for storybook).\n fontSize: '16px',\n },\n '&light .cm-content': {\n color: get(tokens, 'extend.colors.neutral.900', 'black'),\n caretColor: 'black',\n },\n '&dark .cm-content': {\n color: get(tokens, 'extend.colors.neutral.100', 'white'),\n caretColor: 'white',\n },\n\n //\n // Cursor\n //\n '&light .cm-cursor': {\n borderLeft: '2px solid black',\n },\n '&dark .cm-cursor': {\n borderLeft: '2px solid white',\n },\n '& .cm-placeholder': {\n fontWeight: 100,\n },\n\n //\n // line\n //\n '& .cm-line': {\n paddingInline: 0,\n },\n '& .cm-line *': {},\n '& .cm-activeLine': {\n backgroundColor: 'transparent',\n },\n\n //\n // selection\n //\n\n '&light .cm-selectionBackground, &light.cm-focused .cm-selectionBackground': {\n background: get(tokens, 'extend.colors.primary.150', '#00ffff'),\n },\n '&dark .cm-selectionBackground, &dark.cm-focused .cm-selectionBackground': {\n background: get(tokens, 'extend.colors.primary.850', '#00ffff'),\n },\n '&light .cm-selectionMatch': {\n background: get(tokens, 'extend.colors.primary.250', '#00ffff') + '44',\n },\n '&dark .cm-selectionMatch': {\n background: get(tokens, 'extend.colors.primary.600', '#00ffff') + '44',\n },\n\n //\n // collaboration\n // TODO(burdon): Review classnames (YJS dependent?)\n //\n\n '&light .cm-ySelection, &light .cm-yLineSelection': {\n mixBlendMode: 'multiply',\n },\n '&dark .cm-ySelection, &dark .cm-yLineSelection': {\n mixBlendMode: 'screen',\n },\n\n '& .cm-ySelectionInfo': {\n padding: '2px 4px',\n marginBlockStart: '-4px',\n },\n '& .cm-ySelection, & .cm-selectionMatch': {\n paddingBlockStart: '.15em',\n paddingBlockEnd: '.15em',\n },\n '& .cm-ySelectionCaret': {\n display: 'inline-block',\n insetBlockStart: '.1em',\n blockSize: '1.4em',\n verticalAlign: 'top',\n },\n '& .cm-yLineSelection': {\n margin: 0,\n },\n\n //\n // link\n //\n '& .cm-link': {\n color: get(tokens, 'extend.colors.primary.500'),\n textDecorationLine: 'underline',\n textDecorationThickness: '1px',\n textUnderlineOffset: '2px',\n borderRadius: '.125rem',\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n },\n\n //\n // tooltip\n //\n '& .cm-tooltip': {\n border: 'none',\n },\n // '& .cm-tooltip-below': {},\n // '& .cm-tooltip-autocomplete': {},\n\n //\n // font size\n // TODO(thure): This appears to be the best or only way to set selection caret heights, but it's far more verbose than it needs to be.\n //\n ...Object.keys(get(tokens, 'extend.fontSize', {})).reduce((acc: Record<string, any>, fontSize) => {\n const height = get(tokens, ['extend', 'fontSize', fontSize, 1, 'lineHeight']);\n\n acc[`& .text-${fontSize} + .cm-ySelectionCaret`] = { height };\n acc[`& .text-${fontSize} + .cm-ySelection + .cm-ySelectionCaret`] = { height };\n acc[`& .text-${fontSize} + .cm-widgetBuffer + .cm-ySelectionCaret`] = { height };\n return acc;\n }, {}),\n};\n\nexport const textTheme: {\n [selector: string]: StyleSpec;\n} = {\n '& .cm-scroller': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n },\n};\n\nexport const codeTheme: {\n [selector: string]: StyleSpec;\n} = {\n '& .cm-scroller': {\n fontFamily: get(tokens, 'fontFamily.mono', []).join(','),\n },\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { EditorState, type Extension } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { vim } from '@replit/codemirror-vim';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport React, {\n type ComponentProps,\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { yCollab } from 'y-codemirror.next';\n\nimport { generateName } from '@dxos/display-name';\nimport { useThemeContext } from '@dxos/react-ui';\nimport { getColorForValue, inputSurface, mx } from '@dxos/react-ui-theme';\nimport { type YText } from '@dxos/text-model';\n\nimport { basicBundle, markdownBundle } from './extensions';\nimport { defaultTheme, textTheme } from './themes';\nimport { type EditorModel } from '../../hooks';\nimport { type ThemeStyles } from '../../styles';\n\nexport const EditorModes = ['default', 'vim'] as const;\nexport type EditorMode = (typeof EditorModes)[number];\n\nexport type CursorInfo = {\n from: number;\n to: number;\n line: number;\n lines: number;\n after?: string;\n};\n\nexport type TextEditorRef = {\n root: HTMLDivElement | null;\n state?: EditorState;\n view?: EditorView;\n};\n\nexport type TextEditorSlots = {\n root?: Omit<ComponentProps<'div'>, 'ref'>;\n editor?: {\n className?: string;\n placeholder?: string;\n spellCheck?: boolean;\n tabIndex?: number;\n theme?: ThemeStyles;\n };\n};\n\nexport type TextEditorProps = {\n model: EditorModel;\n extensions?: Extension[];\n slots?: TextEditorSlots;\n editorMode?: EditorMode;\n};\n\n/**\n * Base text editor.\n * NOTE: Rather than adding properties, try to create extensions that can be reused.\n */\nexport const BaseTextEditor = forwardRef<TextEditorRef, TextEditorProps>(\n ({ model, extensions = [], slots = defaultSlots, editorMode }, forwardedRef) => {\n const { themeMode } = useThemeContext();\n const tabsterDOMAttribute = useFocusableGroup({ tabBehavior: 'limited' });\n\n // TODO(burdon): Factor out extension (remove logic from react-ui-editor).\n // const collaboration = useCollaboration(model, themeMode);\n const { provider, peer } = model;\n useEffect(() => {\n if (provider && peer) {\n provider.awareness.setLocalStateField('user', {\n name: peer.name ?? generateName(peer.id),\n color: getColorForValue({ value: peer.id, type: 'color' }),\n colorLight: getColorForValue({ value: peer.id, themeMode, type: 'highlight' }),\n });\n }\n }, [provider, peer, themeMode]);\n\n const [root, setRoot] = useState<HTMLDivElement | null>(null);\n const [state, setState] = useState<EditorState>();\n const [view, setView] = useState<EditorView>();\n useImperativeHandle(forwardedRef, () => ({ root, state, view }), [view, state, root]);\n\n useEffect(() => {\n if (!root) {\n return;\n }\n\n const state = EditorState.create({\n doc: model.text(),\n extensions: [\n // TODO(burdon): Factor out VIM mode?\n editorMode === 'vim' && vim(),\n\n // Theme.\n EditorView.baseTheme(defaultTheme),\n EditorView.theme(slots?.editor?.theme ?? {}),\n // TODO(burdon): themeMode doesn't change in storybooks.\n EditorView.darkTheme.of(themeMode === 'dark'),\n\n // Storage and replication.\n yCollab(model.content as YText, model.provider?.awareness),\n\n // Custom.\n ...extensions,\n ].filter(Boolean) as Extension[],\n });\n\n // NOTE: This repaints the editor.\n // If the new state is derived from the old state, it will likely not be visible other than the cursor resetting.\n // Ideally this should not be hit except when changing between text objects.\n view?.destroy();\n setView(new EditorView({ state, parent: root }));\n setState(state);\n\n return () => {\n view?.destroy();\n setView(undefined);\n setState(undefined);\n };\n }, [root, model.content, themeMode, editorMode]);\n\n const handleKeyUp = useCallback(\n (event: KeyboardEvent) => {\n const { key, altKey, shiftKey, metaKey, ctrlKey } = event;\n switch (key) {\n case 'Enter': {\n view?.contentDOM.focus();\n break;\n }\n\n case 'Escape': {\n editorMode === 'vim' && (altKey || shiftKey || metaKey || ctrlKey) && root?.focus();\n break;\n }\n }\n },\n [view, editorMode],\n );\n\n return (\n <div\n key={model.id}\n ref={setRoot}\n tabIndex={0}\n {...slots?.root}\n {...(editorMode !== 'vim' && tabsterDOMAttribute)}\n onKeyUp={handleKeyUp}\n />\n );\n },\n);\n\n// TODO(burdon): Set default text theme?\nexport const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(\n ({ extensions = [], slots: _slots, ...props }, forwardedRef) => {\n const { themeMode } = useThemeContext();\n const slots = defaultsDeep({}, _slots, defaultTextSlots);\n return (\n <BaseTextEditor\n ref={forwardedRef}\n extensions={[basicBundle({ themeMode, placeholder: slots?.editor?.placeholder }), ...extensions]}\n slots={slots}\n {...props}\n />\n );\n },\n);\n\nexport const MarkdownEditor = forwardRef<TextEditorRef, TextEditorProps>(\n ({ extensions = [], slots: _slots, ...props }, forwardedRef) => {\n const { themeMode } = useThemeContext();\n const slots = defaultsDeep({}, _slots, defaultSlots);\n return (\n <BaseTextEditor\n ref={forwardedRef}\n extensions={[markdownBundle({ themeMode, placeholder: slots?.editor?.placeholder }), ...extensions]}\n slots={slots}\n {...props}\n />\n );\n },\n);\n\nexport const defaultSlots: TextEditorSlots = {\n root: {\n className: mx('p-2', inputSurface),\n },\n};\n\nexport const defaultTextSlots: TextEditorSlots = {\n ...defaultSlots,\n editor: {\n theme: textTheme,\n },\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Extension } from '@codemirror/state';\nimport { useEffect, useState } from 'react';\nimport { yCollab } from 'y-codemirror.next';\n\nimport { generateName } from '@dxos/display-name';\nimport { isDocAccessor } from '@dxos/echo-schema';\nimport type { ThemeMode } from '@dxos/react-ui';\nimport { getColorForValue } from '@dxos/react-ui-theme';\nimport { YText } from '@dxos/text-model';\n\nimport type { EditorModel } from './useTextModel';\nimport { automergePlugin } from '../automerge/automerge-plugin';\n\n/**\n * Replication and awareness (incl. remote selection).\n * https://codemirror.net/docs/ref/#collab\n */\nexport const useCollaboration = (model: EditorModel, themeMode: ThemeMode): Extension | undefined => {\n const { content, provider, peer } = model;\n const [extension] = useState(() => {\n if (content instanceof YText) {\n return yCollab(content, provider?.awareness);\n } else if (isDocAccessor(content)) {\n return automergePlugin(content.handle, content.path);\n } else {\n return undefined;\n }\n });\n\n useEffect(() => {\n if (provider && peer) {\n provider.awareness.setLocalStateField('user', {\n name: peer.name ?? generateName(peer.id),\n color: getColorForValue({ value: peer.id, type: 'color' }),\n colorLight: getColorForValue({ value: peer.id, themeMode, type: 'highlight' }),\n });\n }\n }, [provider, peer, themeMode]);\n\n return extension;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {\n Annotation,\n type EditorState,\n type Extension,\n Facet,\n StateEffect,\n StateField,\n type Transaction,\n type TransactionSpec,\n} from '@codemirror/state';\nimport { ViewPlugin, type EditorView, type PluginValue, type ViewUpdate } from '@codemirror/view';\n\nimport * as automerge from '@dxos/automerge/automerge';\nimport { type Heads, type Prop } from '@dxos/automerge/automerge';\n\nimport { PatchSemaphore } from './PatchSemaphore';\nimport { type IDocHandle } from './handle';\n\nexport type Value = {\n lastHeads: Heads;\n path: Prop[];\n unreconciledTransactions: Transaction[];\n};\n\ntype UpdateHeads = {\n newHeads: Heads;\n};\n\nexport const effectType = StateEffect.define<UpdateHeads>({});\n\nexport const updateHeads = (newHeads: Heads): StateEffect<UpdateHeads> => effectType.of({ newHeads });\n\nexport const getLastHeads = (state: EditorState, field: Field): Heads => state.field(field).lastHeads;\n\nexport const getPath = (state: EditorState, field: Field): Prop[] => state.field(field).path;\n\nexport type Field = StateField<Value>;\n\nconst semaphoreFacet = Facet.define<PatchSemaphore, PatchSemaphore>({\n combine: (values) => values.at(-1)!, // Take last.\n});\n\nexport type AutomergePlugin = {\n extension: Extension;\n};\n\nexport const automergePlugin = (handle: IDocHandle, path: Prop[]): AutomergePlugin => {\n const stateField: StateField<Value> = StateField.define({\n create: () => ({\n lastHeads: automerge.getHeads(handle.docSync()!),\n unreconciledTransactions: [],\n path: path.slice(),\n }),\n update: (value: Value, tr: Transaction) => {\n const result: Value = {\n lastHeads: value.lastHeads,\n unreconciledTransactions: value.unreconciledTransactions.slice(),\n path: path.slice(),\n };\n let clearUnreconciled = false;\n for (const effect of tr.effects) {\n if (effect.is(effectType)) {\n result.lastHeads = effect.value.newHeads;\n clearUnreconciled = true;\n }\n }\n if (clearUnreconciled) {\n result.unreconciledTransactions = [];\n } else {\n if (!isReconcileTx(tr)) {\n result.unreconciledTransactions.push(tr);\n }\n }\n return result;\n },\n });\n const semaphore = new PatchSemaphore(stateField);\n\n const viewPlugin = ViewPlugin.fromClass(\n class AutomergeCodemirrorViewPlugin implements PluginValue {\n private _view: EditorView;\n\n constructor(view: EditorView) {\n this._view = view;\n handle.addListener('change', this._handleChange);\n }\n\n update(update: ViewUpdate) {\n if (update.transactions.length > 0 && update.transactions.some((t) => !isReconcileTx(t))) {\n queueMicrotask(() => {\n this._view.state.facet(semaphoreFacet).reconcile(handle, this._view);\n });\n }\n }\n\n destroy() {\n handle.addListener('change', this._handleChange);\n }\n\n private _handleChange = () => {\n this._view.state.facet(semaphoreFacet).reconcile(handle, this._view);\n };\n },\n );\n\n return {\n extension: [stateField, semaphoreFacet.of(semaphore), viewPlugin],\n };\n};\n\nexport const reconcileAnnotationType = Annotation.define<unknown>();\n\nexport const isReconcileTx = (tr: Transaction): boolean => !!tr.annotation(reconcileAnnotationType);\n\nexport const makeReconcile = (tr: TransactionSpec) => {\n if (tr.annotations != null) {\n if (tr.annotations instanceof Array) {\n tr.annotations = [...tr.annotations, reconcileAnnotationType.of({})];\n } else {\n tr.annotations = [tr.annotations, reconcileAnnotationType.of({})];\n }\n } else {\n tr.annotations = [reconcileAnnotationType.of({})];\n }\n // return {\n // ...tr,\n // annotations: reconcileAnnotationType.of({})\n // }\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type EditorView } from '@codemirror/view';\n\nimport { next as automerge } from '@dxos/automerge/automerge';\n\nimport amToCodemirror from './amToCodemirror';\nimport codeMirrorToAm from './codeMirrorToAm';\nimport { type IDocHandle } from './handle';\nimport { type Field, isReconcileTx, getPath, reconcileAnnotationType, updateHeads, getLastHeads } from './plugin';\n\ntype Doc<T> = automerge.Doc<T>;\ntype Heads = automerge.Heads;\n\ntype ChangeFn = (atHeads: Heads, change: (doc: Doc<unknown>) => void) => Heads | undefined;\n\nexport class PatchSemaphore {\n _field!: Field;\n _inReconcile = false;\n _queue: Array<ChangeFn> = [];\n\n constructor(field?: Field) {\n if (field !== undefined) {\n this._field = field;\n }\n }\n\n reconcile = (handle: IDocHandle, view: EditorView) => {\n if (this._inReconcile) {\n return;\n }\n this._inReconcile = true;\n\n const path = getPath(view.state, this._field);\n const oldHeads = getLastHeads(view.state, this._field);\n let selection = view.state.selection;\n\n const transactions = view.state.field(this._field).unreconciledTransactions.filter((tx) => !isReconcileTx(tx));\n\n // First undo all the unreconciled transactions\n const toInvert = transactions.slice().reverse();\n for (const tx of toInvert) {\n const inverted = tx.changes.invert(tx.startState.doc);\n selection = selection.map(inverted);\n view.dispatch({\n changes: inverted,\n annotations: reconcileAnnotationType.of(true),\n });\n }\n\n // now apply the unreconciled transactions to the document\n let newHeads = codeMirrorToAm(this._field, handle, transactions, view.state);\n\n // NOTE: null and undefined each come from automerge and repo respectively\n if (newHeads === null || newHeads === undefined) {\n // TODO: @alexjg this is the call that's resetting the editor state on click\n newHeads = automerge.getHeads(handle.docSync()!);\n }\n\n // now get the diff between the updated state of the document and the heads\n // and apply that to the codemirror doc\n const diff = automerge.equals(oldHeads, newHeads) ? [] : automerge.diff(handle.docSync()!, oldHeads, newHeads);\n amToCodemirror(view, selection, path, diff);\n\n view.dispatch({\n effects: updateHeads(newHeads),\n annotations: reconcileAnnotationType.of({}),\n });\n\n this._inReconcile = false;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ChangeSet, type ChangeSpec, type EditorSelection, type EditorState } from '@codemirror/state';\nimport { type EditorView } from '@codemirror/view';\n\nimport {\n type DelPatch,\n type InsertPatch,\n type Patch,\n type Prop,\n type PutPatch,\n type SpliceTextPatch,\n} from '@dxos/automerge/automerge';\n\nimport { reconcileAnnotationType } from './plugin';\n\nexport default (view: EditorView, selection: EditorSelection, target: Prop[], patches: Patch[]) => {\n for (const patch of patches) {\n const changeSpec = handlePatch(patch, target, view.state);\n if (changeSpec != null) {\n const changeSet = ChangeSet.of(changeSpec, view.state.doc.length, '\\n');\n selection = selection.map(changeSet, 1);\n view.dispatch({\n changes: changeSet,\n annotations: reconcileAnnotationType.of({}),\n });\n }\n }\n view.dispatch({\n selection,\n annotations: reconcileAnnotationType.of({}),\n });\n};\n\nconst handlePatch = (patch: Patch, target: Prop[], state: EditorState): ChangeSpec | null => {\n if (patch.action === 'insert') {\n return handleInsert(target, patch);\n } else if (patch.action === 'splice') {\n return handleSplice(target, patch);\n } else if (patch.action === 'del') {\n return handleDel(target, patch);\n } else if (patch.action === 'put') {\n return handlePut(target, patch, state);\n } else {\n return null;\n }\n};\n\nconst handleInsert = (target: Prop[], patch: InsertPatch): Array<ChangeSpec> => {\n const index = charPath(target, patch.path);\n if (index == null) {\n return [];\n }\n const text = patch.values.map((v) => (v ? v.toString() : '')).join('');\n return [{ from: index, to: index, insert: text }];\n};\n\nconst handleSplice = (target: Prop[], patch: SpliceTextPatch): Array<ChangeSpec> => {\n const index = charPath(target, patch.path);\n if (index == null) {\n return [];\n }\n return [{ from: index, insert: patch.value }];\n};\n\nconst handleDel = (target: Prop[], patch: DelPatch): Array<ChangeSpec> => {\n const index = charPath(target, patch.path);\n if (index == null) {\n return [];\n }\n const length = patch.length || 1;\n return [{ from: index, to: index + length }];\n};\n\nconst handlePut = (target: Prop[], patch: PutPatch, state: EditorState): Array<ChangeSpec> => {\n const index = charPath(target, [...patch.path, 0]);\n if (index == null) {\n return [];\n }\n const length = state.doc.length;\n if (typeof patch.value !== 'string') {\n return []; // TODO(dmaretskyi): How to handle non string values?\n }\n return [{ from: 0, to: length, insert: patch.value as any }];\n};\n\n// If the path of the patch is of the form [path, <index>] then we know this is\n// a path to a character within the sequence given by path\nconst charPath = (textPath: Prop[], candidatePath: Prop[]): number | null => {\n if (candidatePath.length !== textPath.length + 1) {\n return null;\n }\n for (let i = 0; i < textPath.length; i++) {\n if (textPath[i] !== candidatePath[i]) {\n return null;\n }\n }\n const index = candidatePath[candidatePath.length - 1];\n if (typeof index === 'number') {\n return index;\n }\n return null;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type EditorState, type Text, type Transaction } from '@codemirror/state';\n\nimport { next as am, type Heads } from '@dxos/automerge/automerge';\n\nimport { type IDocHandle } from './handle';\nimport { type Field } from './plugin';\n\nexport default (\n field: Field,\n handle: IDocHandle,\n transactions: Transaction[],\n state: EditorState,\n): Heads | undefined => {\n const { lastHeads, path } = state.field(field);\n\n // We don't want to call `automerge.updateAt` if there are no changes.\n // Otherwise later on `automerge.diff` will return empty patches that result in a no-op but still mess up the selection.\n let hasChanges = false;\n for (const tr of transactions) {\n tr.changes.iterChanges(() => {\n hasChanges = true;\n });\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n const newHeads = handle.changeAt(lastHeads, (doc: am.Doc<unknown>) => {\n for (const tr of transactions) {\n tr.changes.iterChanges((fromA: number, toA: number, _fromB: number, _toB: number, inserted: Text) => {\n am.splice(doc, path, fromA, toA - fromA, inserted.toString());\n });\n }\n });\n return newHeads ?? undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useMemo } from 'react';\nimport type * as awarenessProtocol from 'y-protocols/awareness';\n\nimport {\n type DocAccessor,\n type Space,\n type TextObject,\n type AutomergeTextCompat,\n getRawDoc,\n isActualAutomergeObject,\n} from '@dxos/react-client/echo';\nimport { type Identity } from '@dxos/react-client/halo';\nimport type { YText, YXmlFragment } from '@dxos/text-model';\n\nimport { SpaceAwarenessProvider } from './yjs';\n\n// TODO(burdon): Move.\ntype Awareness = awarenessProtocol.Awareness;\ntype Provider = { awareness: Awareness };\n\n// TODO(wittjosiah): Factor out to common package? @dxos/react-client?\nexport type EditorModel = {\n id: string;\n content: string | YText | YXmlFragment | DocAccessor;\n text: () => string;\n provider?: Provider;\n peer?: {\n id: string;\n name?: string;\n };\n};\n\n// TODO(burdon): Remove space/identity dependency. Define interface for the framework re content and presence.\nexport type UseTextModelOptions = {\n identity?: Identity | null;\n space?: Space;\n text?: TextObject;\n};\n\n// TODO(burdon): Don't support returning undefined (and remove checks from calling code).\n// TODO(burdon): Decouple space (make Editor less dependent on entire stack)?\n// TODO(wittjosiah): Factor out to common package? @dxos/react-client?\nexport const useTextModel = ({ identity, space, text }: UseTextModelOptions): EditorModel | undefined => {\n // TODO(burdon): Remove?\n // eslint-disable-next-line unused-imports/no-unused-vars\n const provider = useMemo(() => {\n if (isActualAutomergeObject(text)) {\n return undefined;\n }\n\n if (!space || !text?.doc) {\n return undefined;\n }\n\n return new SpaceAwarenessProvider({ space, doc: text.doc, channel: `yjs.awareness.${text.id}` });\n }, [identity, space, text, text?.doc]);\n\n const content = useMemo(() => {\n if (isActualAutomergeObject(text)) {\n const obj = text as any as AutomergeTextCompat;\n return getRawDoc(obj, [obj.field]);\n } else {\n return text?.content;\n }\n }, [text]);\n\n if (!text?.doc || !text?.content) {\n return undefined;\n }\n\n if (isActualAutomergeObject(text)) {\n const obj = text as any as AutomergeTextCompat;\n return {\n id: obj.id,\n content: content!,\n text: () => content!.toString(),\n provider: undefined,\n peer: identity\n ? {\n id: identity.identityKey.toHex(),\n name: identity.profile?.displayName,\n }\n : undefined,\n };\n }\n\n return {\n id: text.doc.guid,\n content: text.content,\n text: () => text.content!.toString(),\n peer: identity\n ? {\n id: identity.identityKey.toHex(),\n name: identity.profile?.displayName,\n }\n : undefined,\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// Copied from https://github.com/yjs/y-codemirror.next#example.\n\nimport * as random from 'lib0/random';\n\nconst cursorColors = [\n { color: '#30bced', light: '#30bced33' },\n { color: '#6eeb83', light: '#6eeb8333' },\n { color: '#ffbc42', light: '#ffbc4233' },\n { color: '#ecd444', light: '#ecd44433' },\n { color: '#ee6352', light: '#ee635233' },\n { color: '#9ac2c9', light: '#9ac2c933' },\n { color: '#8acb88', light: '#8acb8833' },\n { color: '#1be7ff', light: '#1be7ff33' },\n];\n\n// Select a random color for this user.\nexport const cursorColor = cursorColors[random.uint32() % cursorColors.length];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as decoding from 'lib0/decoding';\nimport * as encoding from 'lib0/encoding';\nimport { Observable } from 'lib0/observable';\nimport * as awarenessProtocol from 'y-protocols/awareness';\nimport { type Doc } from 'yjs';\n\nimport { log } from '@dxos/log';\nimport { type Space } from '@dxos/react-client/echo';\nimport { type GossipMessage } from '@dxos/react-client/mesh';\n\ntype Awareness = awarenessProtocol.Awareness;\n\n// Based on https://github.com/yjs/y-webrtc/blob/88baab2/src/y-webrtc.js.\n\nconst messageAwareness = 1;\nconst messageQueryAwareness = 3;\n\n/**\n * Yjs awareness provider on top of a DXOS space.\n */\nexport class SpaceAwarenessProvider extends Observable<any> {\n private readonly _space: Space;\n private readonly _awareness: Awareness;\n private readonly _clientId: number;\n private readonly _channel: string;\n\n constructor({ space, doc, channel, awareness }: { space: Space; doc: Doc; channel: string; awareness?: Awareness }) {\n super();\n this._space = space;\n this._awareness = awareness ?? new awarenessProtocol.Awareness(doc);\n this._channel = channel;\n this._clientId = doc.clientID;\n\n this._awareness.on('update', this._handleAwarenessUpdate.bind(this));\n this._space.listen(this._channel, this._handleSpaceMessage.bind(this));\n\n if (typeof window !== 'undefined') {\n window.addEventListener('beforeunload', this._handleBeforeUnload.bind(this));\n } else if (typeof process !== 'undefined') {\n process.on('exit', this._handleBeforeUnload.bind(this));\n }\n\n // Post queryAwareness.\n const encoderAwarenessQuery = encoding.createEncoder();\n encoding.writeVarUint(encoderAwarenessQuery, messageQueryAwareness);\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwarenessQuery));\n\n // Post local awareness state.\n const encoderAwarenessState = encoding.createEncoder();\n encoding.writeVarUint(encoderAwarenessState, messageAwareness);\n encoding.writeVarUint8Array(\n encoderAwarenessState,\n awarenessProtocol.encodeAwarenessUpdate(this.awareness, [this._clientId]),\n );\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwarenessState));\n }\n\n get awareness(): Awareness {\n return this._awareness;\n }\n\n private _handleAwarenessUpdate({ added, updated, removed }: any, origin: any) {\n log('awareness update', { added, updated, removed, origin });\n const changedClients = added.concat(updated).concat(removed);\n const encoderAwareness = encoding.createEncoder();\n encoding.writeVarUint(encoderAwareness, messageAwareness);\n encoding.writeVarUint8Array(\n encoderAwareness,\n awarenessProtocol.encodeAwarenessUpdate(this._awareness, changedClients),\n );\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwareness));\n }\n\n private _handleSpaceMessage({ payload }: GossipMessage) {\n log('space message', payload);\n const data = new Uint8Array(Array.from(Object.values(payload)));\n const encoder = this._readMessage(data);\n if (encoder) {\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoder));\n }\n }\n\n private _readMessage(message: Uint8Array) {\n const decoder = decoding.createDecoder(message);\n const encoder = encoding.createEncoder();\n const messageType = decoding.readVarUint(decoder);\n\n let sendReply = false;\n switch (messageType) {\n case messageAwareness: {\n awarenessProtocol.applyAwarenessUpdate(this._awareness, decoding.readVarUint8Array(decoder), this);\n break;\n }\n\n case messageQueryAwareness: {\n encoding.writeVarUint(encoder, messageAwareness);\n encoding.writeVarUint8Array(\n encoder,\n awarenessProtocol.encodeAwarenessUpdate(this._awareness, Array.from(this._awareness.getStates().keys())),\n );\n sendReply = true;\n break;\n }\n\n default: {\n console.error('Invalid message:', messageType);\n return encoder;\n }\n }\n\n if (!sendReply) {\n // Nothing has been written, no answer created.\n return null;\n }\n\n return encoder;\n }\n\n private _handleBeforeUnload() {\n awarenessProtocol.removeAwarenessStates(this._awareness, [this._clientId], 'window unload');\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,gBAAgB;AACzB,SAASC,KAAKC,SAAAA,QAAOC,oBAAoB;;;ACDzC,SAASC,QAAAA,aAAY;;;ACYrB,SACEC,gBAGAC,wBAEK;AACP,SAASC,cAAc;AAShB,IAAMC,eAAe,CAAC,EAAEC,WAAU,MAAuB;AAC9D,SAAO;;;IAGLC,OAAOC,GAAGC,gBAAAA;;;IAIVC,eAAe;;;;MAKbC,kBAAkB;;;MAIlBC,UAAU;QACR,CAACC,YAAAA;AACC,gBAAMC,OAAOD,QAAQE,YAAY,KAAA;AACjC,cAAI,CAACD,QAASA,KAAKE,SAASF,KAAKG,MAAM,CAACJ,QAAQK,UAAW;AACzD,mBAAO;UACT;AAG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QACEU,IAAIV,SAASiB,YAAYC,MAAK;QAC9BC,MAAMnB,SAASoB,SAASC;MAC1B,IACAf;IACN;EACF;AAEA,SAAO;IACLI,IAAIR,KAAKK,IAAIe;IACbX,SAAST,KAAKS;IACdT,MAAM,MAAMA,KAAKS,QAASI,SAAQ;IAClCC,MAAMhB,WACF;MACEU,IAAIV,SAASiB,YAAYC,MAAK;MAC9BC,MAAMnB,SAASoB,SAASC;IAC1B,IACAf;EACN;AACF;",
|
|
6
|
-
"names": ["TextKind", "Doc", "YText", "YXmlFragment", "tags", "autocompletion", "completionKeymap", "keymap", "autocomplete", "getOptions", "keymap", "of", "completionKeymap", "autocompletion", "activateOnTyping", "override", "context", "word", "matchBefore", "from", "to", "explicit", "options", "text", "toLowerCase", "closeBrackets", "bracketMatching", "defaultHighlightStyle", "syntaxHighlighting", "oneDarkHighlightStyle", "EditorView", "placeholder", "basicBundle", "themeMode", "placeholder", "_placeholder", "bracketMatching", "closeBrackets", "EditorView", "lineWrapping", "syntaxHighlighting", "oneDarkHighlightStyle", "defaultHighlightStyle", "filter", "Boolean", "syntaxTree", "RangeSetBuilder", "StateField", "Decoration", "EditorView", "WidgetType", "LinkButton", "WidgetType", "constructor", "_pos", "_url", "_onAttach", "eq", "other", "toDOM", "view", "el", "document", "createElement", "LinkText", "_text", "link", "setAttribute", "textContent", "href", "onclick", "dispatch", "selection", "anchor", "update", "state", "options", "builder", "RangeSetBuilder", "cursor", "main", "head", "syntaxTree", "iterate", "enter", "node", "name", "marks", "getChildren", "text", "length", "sliceDoc", "to", "from", "urlNode", "getChild", "url", "add", "Decoration", "replace", "widget", "undefined", "onRender", "finish", "StateField", "define", "create", "_", "tr", "provide", "field", "EditorView", "decorations", "StateField", "listener", "onChange", "StateField", "define", "create", "update", "_value", "transaction", "docChanged", "newDoc", "toString", "closeBrackets", "closeBracketsKeymap", "defaultKeymap", "history", "historyKeymap", "indentWithTab", "markdownLanguage", "markdown", "bracketMatching", "defaultHighlightStyle", "foldKeymap", "indentOnInput", "syntaxHighlighting", "languages", "lintKeymap", "highlightSelectionMatches", "searchKeymap", "EditorState", "oneDarkHighlightStyle", "crosshairCursor", "drawSelection", "dropCursor", "EditorView", "highlightActiveLine", "highlightActiveLineGutter", "highlightSpecialChars", "keymap", "placeholder", "rectangularSelection", "markdownLanguage", "HighlightStyle", "tags", "styleTags", "Tag", "get", "mx", "heading", "light", "mark", "mx", "bold", "italic", "strikethrough", "code", "codeMark", "inlineUrl", "mx", "code", "blockquote", "light", "horizontalRule", "tailwindConfig", "tokens", "tailwindConfig", "theme", "markdownTags", "Blockquote", "Tag", "define", "CodeMark", "CodeText", "EmphasisMark", "HeaderMark", "HorizontalRule", "InlineCode", "LinkLabel", "LinkReference", "ListMark", "QuoteMark", "URL", "markdownTagsExtension", "props", "styleTags", "markdownHighlightStyle", "HighlightStyle", "tag", "tags", "keyword", "name", "deleted", "character", "propertyName", "macroName", "color", "constant", "standard", "definition", "separator", "typeName", "className", "number", "changed", "annotation", "modifier", "self", "namespace", "operator", "operatorKeyword", "escape", "regexp", "special", "string", "meta", "comment", "atom", "bool", "variableName", "processingInstruction", "inserted", "invalid", "class", "mark", "heading1", "heading", "heading2", "heading3", "heading4", "heading5", "heading6", "emphasis", "italic", "strong", "bold", "strikethrough", "inlineUrl", "function", "labelName", "codeMark", "code", "blockquote", "horizontalRule", "scope", "markdownLanguage", "all", "fontFamily", "get", "tokens", "join", "markdownBundle", "themeMode", "placeholder", "_placeholder", "bracketMatching", "closeBrackets", "EditorState", "allowMultipleSelections", "of", "EditorView", "lineWrapping", "crosshairCursor", "dropCursor", "drawSelection", "highlightActiveLine", "highlightActiveLineGutter", "highlightSelectionMatches", "highlightSpecialChars", "history", "indentOnInput", "rectangularSelection", "keymap", "closeBracketsKeymap", "defaultKeymap", "foldKeymap", "historyKeymap", "lintKeymap", "searchKeymap", "indentWithTab", "markdown", "base", "markdownLanguage", "codeLanguages", "languages", "extensions", "markdownTagsExtension", "syntaxHighlighting", "markdownHighlightStyle", "oneDarkHighlightStyle", "defaultHighlightStyle", "filter", "Boolean", "syntaxTree", "RangeSetBuilder", "StateField", "EditorView", "Decoration", "WidgetType", "CheckboxWidget", "WidgetType", "constructor", "_pos", "_getCursor", "_checked", "eq", "other", "toDOM", "view", "wrap", "document", "createElement", "setAttribute", "className", "box", "appendChild", "type", "checked", "onclick", "event", "isChecked", "state", "dispatch", "changes", "from", "to", "insert", "selection", "anchor", "ignoreEvent", "pos", "sliceDoc", "toLowerCase", "statefield", "lastPosition", "listener", "EditorView", "updateListener", "of", "update", "startState", "main", "head", "checkbox", "builder", "RangeSetBuilder", "syntaxTree", "iterate", "enter", "node", "name", "add", "Decoration", "replace", "widget", "finish", "StateField", "define", "create", "_", "tr", "provide", "field", "decorations", "styles", "baseTheme", "padding", "tasklist", "hoverTooltip", "tooltipContent", "markdownLinkRegexp", "tooltip", "onHover", "regexp", "hoverTooltip", "view", "pos", "from", "text", "state", "doc", "lineAt", "p", "idx", "match", "substring", "undefined", "indexOf", "length", "url", "end", "above", "create", "el", "document", "createElement", "className", "tooltipContent", "dom", "offset", "x", "y", "get", "defaultTheme", "outline", "overflow", "padding", "fontSize", "color", "get", "tokens", "caretColor", "borderLeft", "fontWeight", "paddingInline", "backgroundColor", "background", "mixBlendMode", "marginBlockStart", "paddingBlockStart", "paddingBlockEnd", "display", "insetBlockStart", "blockSize", "verticalAlign", "margin", "textDecorationLine", "textDecorationThickness", "textUnderlineOffset", "borderRadius", "fontFamily", "join", "border", "Object", "keys", "reduce", "acc", "height", "textTheme", "codeTheme", "EditorState", "EditorView", "useFocusableGroup", "vim", "defaultsDeep", "React", "forwardRef", "useCallback", "useEffect", "useImperativeHandle", "useState", "yCollab", "generateName", "useThemeContext", "getColorForValue", "inputSurface", "mx", "EditorModes", "BaseTextEditor", "forwardRef", "model", "extensions", "slots", "defaultSlots", "editorMode", "forwardedRef", "themeMode", "useThemeContext", "tabsterDOMAttribute", "useFocusableGroup", "tabBehavior", "provider", "peer", "useEffect", "awareness", "setLocalStateField", "name", "generateName", "id", "color", "getColorForValue", "value", "type", "colorLight", "root", "setRoot", "useState", "state", "setState", "view", "setView", "useImperativeHandle", "EditorState", "create", "doc", "text", "vim", "EditorView", "baseTheme", "defaultTheme", "theme", "editor", "darkTheme", "of", "yCollab", "content", "filter", "Boolean", "destroy", "parent", "undefined", "handleKeyUp", "useCallback", "event", "key", "altKey", "shiftKey", "metaKey", "ctrlKey", "contentDOM", "focus", "div", "ref", "tabIndex", "onKeyUp", "TextEditor", "_slots", "props", "defaultsDeep", "defaultTextSlots", "basicBundle", "placeholder", "MarkdownEditor", "markdownBundle", "className", "mx", "inputSurface", "textTheme", "useEffect", "useState", "yCollab", "generateName", "isDocAccessor", "getColorForValue", "YText", "Annotation", "Facet", "StateEffect", "StateField", "ViewPlugin", "automerge", "next", "automerge", "ChangeSet", "view", "selection", "target", "patches", "patch", "changeSpec", "handlePatch", "state", "changeSet", "ChangeSet", "of", "doc", "length", "map", "dispatch", "changes", "annotations", "reconcileAnnotationType", "action", "handleInsert", "handleSplice", "handleDel", "handlePut", "index", "charPath", "path", "text", "values", "v", "toString", "join", "from", "to", "insert", "value", "textPath", "candidatePath", "i", "next", "am", "field", "handle", "transactions", "state", "lastHeads", "path", "hasChanges", "tr", "changes", "iterChanges", "undefined", "newHeads", "changeAt", "doc", "fromA", "toA", "_fromB", "_toB", "inserted", "am", "splice", "toString", "PatchSemaphore", "constructor", "field", "_inReconcile", "_queue", "reconcile", "handle", "view", "path", "getPath", "state", "_field", "oldHeads", "getLastHeads", "selection", "transactions", "unreconciledTransactions", "filter", "tx", "isReconcileTx", "toInvert", "slice", "reverse", "inverted", "changes", "invert", "startState", "doc", "map", "dispatch", "annotations", "reconcileAnnotationType", "of", "newHeads", "codeMirrorToAm", "undefined", "automerge", "getHeads", "docSync", "diff", "equals", "amToCodemirror", "effects", "updateHeads", "effectType", "StateEffect", "define", "updateHeads", "newHeads", "of", "getLastHeads", "state", "field", "lastHeads", "getPath", "path", "semaphoreFacet", "Facet", "combine", "values", "at", "automergePlugin", "handle", "stateField", "StateField", "create", "getHeads", "docSync", "unreconciledTransactions", "slice", "update", "value", "tr", "result", "clearUnreconciled", "effect", "effects", "is", "isReconcileTx", "push", "semaphore", "PatchSemaphore", "viewPlugin", "ViewPlugin", "fromClass", "AutomergeCodemirrorViewPlugin", "constructor", "view", "_handleChange", "_view", "facet", "reconcile", "addListener", "transactions", "length", "some", "t", "queueMicrotask", "destroy", "extension", "reconcileAnnotationType", "Annotation", "annotation", "useCollaboration", "model", "themeMode", "content", "provider", "peer", "extension", "useState", "YText", "yCollab", "awareness", "isDocAccessor", "automergePlugin", "handle", "path", "undefined", "useEffect", "setLocalStateField", "name", "generateName", "id", "color", "getColorForValue", "value", "type", "colorLight", "useMemo", "getRawDoc", "isActualAutomergeObject", "random", "cursorColors", "color", "light", "cursorColor", "uint32", "length", "decoding", "encoding", "Observable", "awarenessProtocol", "log", "messageAwareness", "messageQueryAwareness", "SpaceAwarenessProvider", "constructor", "space", "doc", "channel", "awareness", "_space", "_awareness", "Awareness", "_channel", "_clientId", "clientID", "on", "_handleAwarenessUpdate", "bind", "listen", "_handleSpaceMessage", "window", "addEventListener", "_handleBeforeUnload", "process", "encoderAwarenessQuery", "createEncoder", "writeVarUint", "postMessage", "toUint8Array", "encoderAwarenessState", "writeVarUint8Array", "encodeAwarenessUpdate", "added", "updated", "removed", "origin", "changedClients", "concat", "encoderAwareness", "payload", "data", "Uint8Array", "Array", "from", "Object", "values", "encoder", "_readMessage", "message", "decoder", "createDecoder", "messageType", "readVarUint", "sendReply", "applyAwarenessUpdate", "readVarUint8Array", "getStates", "keys", "console", "error", "removeAwarenessStates", "useTextModel", "identity", "space", "text", "provider", "useMemo", "isActualAutomergeObject", "undefined", "doc", "SpaceAwarenessProvider", "channel", "id", "content", "obj", "getRawDoc", "field", "toString", "peer", "identityKey", "toHex", "name", "profile", "displayName", "guid"]
|
|
3
|
+
"sources": ["../../../src/index.ts", "../../../src/components/TextEditor/index.ts", "../../../src/components/TextEditor/extensions/autocomplete.ts", "../../../src/components/TextEditor/extensions/basic.ts", "../../../src/components/TextEditor/extensions/link.ts", "../../../src/components/TextEditor/extensions/listener.ts", "../../../src/components/TextEditor/extensions/markdown/bundle.ts", "../../../src/components/TextEditor/extensions/markdown/highlight.ts", "../../../src/styles/markdown.ts", "../../../src/styles/tokens.ts", "../../../src/components/TextEditor/extensions/tasklist.ts", "../../../src/components/TextEditor/extensions/tooltip.tsx", "../../../src/components/TextEditor/themes/default.ts", "../../../src/components/TextEditor/TextEditor.tsx", "../../../src/hooks/useTextModel.ts", "../../../src/hooks/automerge/plugin.ts", "../../../src/hooks/automerge/PatchSemaphore.ts", "../../../src/hooks/automerge/amToCodemirror.ts", "../../../src/hooks/automerge/codeMirrorToAm.ts", "../../../src/hooks/yjs/cursors.ts", "../../../src/hooks/yjs/space-provider.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nexport { TextKind } from '@dxos/protocols/proto/dxos/echo/model/text';\nexport { Doc, YText, YXmlFragment } from '@dxos/text-model';\n\nexport * from './components';\nexport * from './hooks';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport { tags } from '@lezer/highlight';\nexport { type Extension } from '@codemirror/state';\n\nexport * from './extensions';\nexport * from './themes';\n\nexport * from './TextEditor';\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Automcomplete: https://codemirror.net/5/doc/manual.html#addon_runmode\n// TODO(burdon): Modes: parallel parsing and decoration (e.g., associated with language).\n// TODO(burdon): Add-on: runmode: run lexer over content (with rendering codemirror).\n// https://codemirror.net/5/doc/manual.html#addon_runmode\n// TODO(burdon): Add-on: dialog.\n// TODO(burdon): Comments: https://codemirror.net/5/doc/manual.html#setBookmark\n// TODO(burdon): Split view: https://codemirror.net/examples/split\n\n// https://codemirror.net/examples/autocompletion\n// https://codemirror.net/docs/ref/#autocomplete.autocompletion\n// https://codemirror.net/docs/ref/#autocomplete.Completion\n\nimport {\n autocompletion,\n type Completion,\n type CompletionContext,\n completionKeymap,\n type CompletionResult,\n} from '@codemirror/autocomplete';\nimport { keymap } from '@codemirror/view';\n\nexport type AutocompleteOptions = {\n getOptions: (text: string) => Completion[];\n};\n\n/**\n * Autocomplete extension.\n */\nexport const autocomplete = ({ getOptions }: AutocompleteOptions) => {\n return [\n // https://codemirror.net/docs/ref/#view.keymap\n // https://discuss.codemirror.net/t/how-can-i-replace-the-default-autocompletion-keymap-v6/3322\n keymap.of(completionKeymap),\n\n // https://codemirror.net/examples/autocompletion\n // https://codemirror.net/docs/ref/#autocomplete.autocompletion\n autocompletion({\n // TODO(burdon): Set custom keymap.\n // defaultKeymap: false,\n\n // Don't start unless key press.\n activateOnTyping: false,\n\n // TODO(burdon): Option to create new page?\n // TODO(burdon): Optional decoration via addToOptions\n override: [\n (context: CompletionContext): CompletionResult | null => {\n const word = context.matchBefore(/\\w*/);\n if (!word || (word.from === word.to && !context.explicit)) {\n return null;\n }\n\n // TODO(burdon): Option to convert to links?\n return {\n from: word.from,\n options: getOptions(word.text.toLowerCase()),\n // options: [\n // { label: 'apple', type: 'keyword' },\n // { label: 'amazon', type: 'keyword' },\n // { label: 'hello', type: 'variable', info: '(World)' },\n // { label: 'magic', type: 'text', apply: '⠁⭒*.✩.*⭒⠁', detail: 'macro' },\n // ],\n };\n },\n ],\n }),\n ];\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { closeBrackets } from '@codemirror/autocomplete';\nimport { bracketMatching, defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { type Extension } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport { EditorView, placeholder } from '@codemirror/view';\n\nimport type { ThemeMode } from '@dxos/react-ui';\n\nexport type BasicBundleOptions = {\n themeMode?: ThemeMode;\n placeholder?: string;\n};\n\nexport const basicBundle = ({ themeMode, placeholder: _placeholder }: BasicBundleOptions): Extension[] =>\n [\n // TODO(burdon): Compare with minimalSetup.\n // https://codemirror.net/docs/ref/#codemirror.minimalSetup\n bracketMatching(),\n closeBrackets(),\n EditorView.lineWrapping,\n\n _placeholder && placeholder(_placeholder),\n\n // TODO(burdon): Is this required?\n themeMode === 'dark' ? syntaxHighlighting(oneDarkHighlightStyle) : syntaxHighlighting(defaultHighlightStyle),\n ].filter(Boolean) as Extension[];\n", "//\n// Copyright 2023 DXOS.org\n// Copyright CodeMirror\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport {\n type EditorState,\n type Extension,\n type RangeSet,\n RangeSetBuilder,\n StateField,\n type Transaction,\n} from '@codemirror/state';\nimport { Decoration, EditorView, WidgetType } from '@codemirror/view';\n\n// Adapted from:\n// https://codemirror.net/try/?c=aW1wb3J0IHsgYmFzaWNTZXR1cCwgRWRpdG9yVmlldyB9IGZyb20gImNvZGVtaXJyb3IiCmltcG9ydCB7IG1hcmtkb3duIH0gZnJvbSAiQGNvZGVtaXJyb3IvbGFuZy1tYXJrZG93biIKaW1wb3J0IHsgc3ludGF4VHJlZSB9IGZyb20gIkBjb2RlbWlycm9yL2xhbmd1YWdlIjsKaW1wb3J0IHsgRWRpdG9yU3RhdGUsIFJhbmdlU2V0QnVpbGRlciwgU3RhdGVGaWVsZCB9IGZyb20gIkBjb2RlbWlycm9yL3N0YXRlIjsKaW1wb3J0IHsgRGVjb3JhdGlvbiwgV2lkZ2V0VHlwZSB9IGZyb20gIkBjb2RlbWlycm9yL3ZpZXciOwoKY2xhc3MgTGluayBleHRlbmRzIFdpZGdldFR5cGUgewogIGNvbnN0cnVjdG9yKHRleHQsIHVybCkgewogICAgc3VwZXIoKQogICAgdGhpcy50ZXh0ID0gdGV4dAogICAgdGhpcy51cmwgPSB1cmwKICB9CiAgZXEob3RoZXIpIHsgcmV0dXJuIHRoaXMudGV4dCA9PSBvdGhlci50ZXh0ICYmIHRoaXMudXJsID09IG90aGVyLnVybCB9CiAgdG9ET00oKSB7CiAgICBsZXQgbGluayA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImEiKQogICAgbGluay50ZXh0Q29udGVudCA9IHRoaXMudGV4dAogICAgbGluay5ocmVmID0gdGhpcy51cmwKICAgIHJldHVybiBsaW5rOwogIH0KfQoKbGV0IGRlY29yYXRpb25zRmllbGQgPSBTdGF0ZUZpZWxkLmRlZmluZSh7CiAgY3JlYXRlKCkgewogICAgcmV0dXJuIERlY29yYXRpb24ubm9uZTsKICB9LAogIHVwZGF0ZShfLCB0cikgewogICAgY29uc3QgYnVpbGRlciA9IG5ldyBSYW5nZVNldEJ1aWxkZXIoKTsKICAgIGxldCBjdXJzb3IgPSB0ci5zdGF0ZS5zZWxlY3Rpb24ubWFpbi5oZWFkOwogICAgc3ludGF4VHJlZSh0ci5zdGF0ZSkuaXRlcmF0ZSh7CiAgICAgIGVudGVyOiAobm9kZSkgPT4gewogICAgICAgIGlmICgoY3Vyc29yIDwgbm9kZS5mcm9tIHx8IGN1cnNvciA+IG5vZGUudG8pICYmIG5vZGUubmFtZSA9PSAiTGluayIpIHsKICAgICAgICAgIGxldCBtYXJrcyA9IG5vZGUubm9kZS5nZXRDaGlsZHJlbigiTGlua01hcmsiKTsKICAgICAgICAgIGxldCB0ZXh0ID0gbWFya3MubGVuZ3RoID49IDIgPyB0ci5zdGF0ZS5zbGljZURvYyhtYXJrc1swXS50bywgbWFya3NbMV0uZnJvbSkgOiAiIgoKICAgICAgICAgIGxldCB1cmxOb2RlID0gbm9kZS5ub2RlLmdldENoaWxkKCJVUkwiKTsKICAgICAgICAgIGxldCB1cmwgPSB1cmxOb2RlID8gdHIuc3RhdGUuc2xpY2VEb2ModXJsTm9kZS5mcm9tLCB1cmxOb2RlLnRvKSA6ICIiCiAgICAgICAgICBidWlsZGVyLmFkZChub2RlLmZyb20sIG5vZGUudG8sIERlY29yYXRpb24ucmVwbGFjZSh7CiAgICAgICAgICAgIHdpZGdldDogbmV3IExpbmsodGV4dCwgdXJsKSwKICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfSwKICAgIH0pOwogICAgcmV0dXJuIGJ1aWxkZXIuZmluaXNoKCk7CiAgfSwKICBwcm92aWRlOiAoZikgPT4gRWRpdG9yVmlldy5kZWNvcmF0aW9ucy5mcm9tKGYpLAp9KTsKCmxldCB2aWV3ID0gbmV3IEVkaXRvclZpZXcoewogIGRvYzogIiMgSGVsbG8gV29ybGRcblxuW1Rlc3RdKGh0dHBzOi8vZXhhbXBsZS5jb20pXG5cblxuIiwKICBleHRlbnNpb25zOiBbZGVjb3JhdGlvbnNGaWVsZCwgbWFya2Rvd24oKV0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5LAp9KTsKCnZpZXcuZm9jdXMoKTs=\n// https://discuss.codemirror.net/t/link-widget-is-clicked-only-if-editor-is-out-of-focus/7433\n\n// TODO(burdon): Adapt to make all markdown editable?\n\n// TODO(burdon): Research overlays.\n// https://stackoverflow.com/questions/26933344/codemirror-detect-and-create-links-inside-editor\n// https://codemirror.net/5/doc/manual.html#addOverlay\n// https://codemirror.net/5/demo/simplemode.html\n// https://codemirror.net/5/demo/search.html (Search dialog).\n\nclass LinkButton extends WidgetType {\n constructor(\n private readonly _pos: number,\n private readonly _url: string,\n private readonly _onAttach: LinkOptions['onRender'],\n ) {\n super();\n }\n\n override eq(other: LinkButton) {\n return this._pos === other._pos && this._url === other._url;\n }\n\n toDOM(view: EditorView) {\n const el = document.createElement('span');\n this._onAttach!(el, this._url);\n return el;\n }\n}\n\nclass LinkText extends WidgetType {\n constructor(private readonly _pos: number, private readonly _text: string, private readonly _url?: string) {\n super();\n }\n\n override eq(other: LinkText) {\n return this._pos === other._pos && this._url === other._url;\n }\n\n toDOM(view: EditorView) {\n const link = document.createElement('a');\n link.setAttribute('class', 'cm-link');\n link.textContent = this._text;\n if (this._url) {\n link.setAttribute('rel', 'noreferrer');\n link.setAttribute('target', '_blank');\n link.href = this._url;\n } else {\n link.onclick = () => {\n view.dispatch({\n selection: {\n anchor: this._pos,\n },\n });\n };\n }\n\n return link;\n }\n}\n\nconst update = (state: EditorState, options: LinkOptions) => {\n const builder = new RangeSetBuilder();\n const cursor = state.selection.main.head;\n syntaxTree(state).iterate({\n enter: (node) => {\n // Check if cursor is inside text.\n if (node.name === 'Link') {\n const marks = node.node.getChildren('LinkMark');\n const text = marks.length >= 2 ? state.sliceDoc(marks[0].to, marks[1].from) : '';\n\n const urlNode = node.node.getChild('URL');\n const url = urlNode ? state.sliceDoc(urlNode.from, urlNode.to) : '';\n\n if (cursor < node.from || cursor > node.to) {\n builder.add(\n node.from,\n node.to,\n Decoration.replace({\n widget: new LinkText(node.from, text, options.link ? url : undefined),\n }),\n );\n }\n\n if (options.onRender) {\n builder.add(\n node.to,\n node.to,\n Decoration.replace({\n widget: new LinkButton(node.from, url, options.onRender),\n }),\n );\n }\n }\n\n return true;\n },\n });\n\n return builder.finish();\n};\n\nexport type LinkOptions = {\n link?: boolean;\n onRender?: (el: Element, url: string) => void;\n};\n\n/**\n * Creates a state field to replace AST elements with a hyperlink widget.\n * https://codemirror.net/docs/ref/#state.StateField\n */\nexport const link = (options: LinkOptions = {}): Extension => {\n return StateField.define<RangeSet<any>>({\n create: (state) => update(state, options),\n update: (_: RangeSet<any>, tr: Transaction) => update(tr.state, options),\n provide: (field) => EditorView.decorations.from(field),\n });\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StateField } from '@codemirror/state';\n\nexport type TextListener = (text: string) => void;\n\n/**\n * Based on https://github.com/codemirror/dev/issues/44#issuecomment-789093799\n */\nexport const listener = (onChange: TextListener) =>\n StateField.define({\n create: () => null,\n update: (_value, transaction) => {\n if (transaction.docChanged && onChange) {\n onChange(transaction.newDoc.toString());\n }\n\n return null;\n },\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete';\nimport { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport { markdownLanguage, markdown } from '@codemirror/lang-markdown';\nimport {\n bracketMatching,\n defaultHighlightStyle,\n foldKeymap,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { languages } from '@codemirror/language-data';\nimport { lintKeymap } from '@codemirror/lint';\nimport { highlightSelectionMatches, searchKeymap } from '@codemirror/search';\nimport { EditorState, type Extension } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport {\n crosshairCursor,\n drawSelection,\n dropCursor,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n highlightSpecialChars,\n keymap,\n placeholder,\n rectangularSelection,\n} from '@codemirror/view';\n\nimport type { ThemeMode } from '@dxos/react-ui';\n\nimport { markdownHighlightStyle, markdownTagsExtension } from './highlight';\n\nexport type MarkdownBundleOptions = {\n themeMode?: ThemeMode;\n placeholder?: string;\n};\n\nexport const markdownBundle = ({ themeMode, placeholder: _placeholder }: MarkdownBundleOptions): Extension[] => {\n // All of https://github.com/codemirror/basic-setup minus line numbers and fold gutter.\n // https://codemirror.net/docs/ref/#codemirror.basicSetup\n return [\n bracketMatching(),\n closeBrackets(),\n _placeholder && placeholder(_placeholder),\n\n EditorState.allowMultipleSelections.of(true),\n EditorView.lineWrapping,\n\n // autocompletion(),\n crosshairCursor(),\n dropCursor(),\n drawSelection(),\n highlightActiveLine(),\n highlightActiveLineGutter(),\n highlightSelectionMatches(),\n highlightSpecialChars(),\n history(),\n indentOnInput(),\n rectangularSelection(),\n\n keymap.of([\n ...closeBracketsKeymap,\n // ...completionKeymap,\n ...defaultKeymap,\n ...foldKeymap,\n ...historyKeymap,\n ...lintKeymap,\n ...searchKeymap,\n indentWithTab,\n ]),\n\n // Main extension.\n // https://github.com/codemirror/lang-markdown\n // https://codemirror.net/5/mode/markdown/index.html (demo).\n markdown({\n // GRM by default (vs strict CommonMark):\n // Table, TaskList, Strikethrough, and Autolink.\n // NOTE: This extends the parser; it doesn't affect rendering.\n // https://github.github.com/gfm\n // https://github.com/lezer-parser/markdown?tab=readme-ov-file#github-flavored-markdown\n base: markdownLanguage,\n\n // Languages for syntax highlighting fenced code blocks.\n codeLanguages: languages,\n\n // Parser extensions.\n extensions: [\n // GFM, // TODO(burdon): Provided by default?\n markdownTagsExtension,\n ],\n }),\n\n // Custom styles.\n syntaxHighlighting(markdownHighlightStyle),\n\n // TODO(thure): All but one rule here apply to both themes; rename or refactor.\n themeMode === 'dark' ? syntaxHighlighting(oneDarkHighlightStyle) : syntaxHighlighting(defaultHighlightStyle),\n ].filter(Boolean) as Extension[];\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { markdownLanguage } from '@codemirror/lang-markdown';\nimport { HighlightStyle } from '@codemirror/language';\nimport { tags, styleTags, Tag } from '@lezer/highlight';\nimport { type MarkdownConfig } from '@lezer/markdown';\nimport get from 'lodash.get';\n\nimport {\n blockquote,\n bold,\n code,\n codeMark,\n heading,\n horizontalRule,\n inlineUrl,\n italic,\n mark,\n strikethrough,\n tokens,\n} from '../../../../styles';\n\n/**\n * Custom tags defined and processed by the GFM lezer extension.\n * https://github.com/lezer-parser/markdown\n * https://github.com/lezer-parser/markdown/blob/main/src/markdown.ts\n */\nexport const markdownTags = {\n Blockquote: Tag.define(),\n CodeMark: Tag.define(),\n CodeText: Tag.define(),\n EmphasisMark: Tag.define(),\n HeaderMark: Tag.define(),\n HorizontalRule: Tag.define(),\n InlineCode: Tag.define(),\n LinkLabel: Tag.define(),\n LinkReference: Tag.define(),\n ListMark: Tag.define(),\n QuoteMark: Tag.define(),\n URL: Tag.define(),\n};\n\nexport const markdownTagsExtension: MarkdownConfig = {\n props: [styleTags(markdownTags)],\n};\n\n/**\n * Styling based on `lezer` parser tags.\n * https://codemirror.net/examples/styling\n * https://github.com/lezer-parser/highlight\n * https://lezer.codemirror.net/docs/ref/#highlight (list of tags)\n */\nexport const markdownHighlightStyle = HighlightStyle.define(\n [\n {\n tag: [\n tags.keyword,\n tags.name,\n tags.deleted,\n tags.character,\n tags.propertyName,\n tags.macroName,\n tags.color,\n tags.constant(tags.name),\n tags.standard(tags.name),\n tags.definition(tags.name),\n tags.separator,\n tags.typeName,\n tags.className,\n tags.number,\n tags.changed,\n tags.annotation,\n tags.modifier,\n tags.self,\n tags.namespace,\n tags.operator,\n tags.operatorKeyword,\n tags.escape,\n tags.regexp,\n tags.special(tags.string),\n tags.meta,\n tags.comment,\n tags.atom,\n tags.bool,\n tags.special(tags.variableName),\n tags.processingInstruction,\n tags.string,\n tags.inserted,\n tags.invalid,\n ],\n color: 'inherit !important',\n },\n\n // Markdown marks.\n {\n tag: [\n tags.meta,\n tags.processingInstruction,\n markdownTags.CodeMark,\n markdownTags.EmphasisMark,\n markdownTags.HeaderMark,\n markdownTags.LinkLabel,\n markdownTags.LinkReference,\n markdownTags.ListMark,\n markdownTags.QuoteMark,\n ],\n class: mark,\n },\n\n // Headings.\n { tag: tags.heading1, class: heading[1] },\n { tag: tags.heading2, class: heading[2] },\n { tag: tags.heading3, class: heading[3] },\n { tag: tags.heading4, class: heading[4] },\n { tag: tags.heading5, class: heading[5] },\n { tag: tags.heading6, class: heading[6] },\n\n // Emphasis.\n { tag: tags.emphasis, class: italic },\n { tag: tags.strong, class: bold },\n { tag: tags.strikethrough, class: strikethrough },\n\n // Naked URLs.\n {\n tag: [markdownTags.URL],\n class: inlineUrl,\n },\n\n // E.g., code block language (after ```).\n {\n tag: [tags.function(tags.variableName), tags.labelName],\n class: codeMark,\n },\n\n // The `markdown` extension configures extensions for `lezer` to parse markdown tokens (incl. below).\n // However, since `codeLanguages` is also defined, the `lezer` will not parse fenced code blocks,\n // when a language is specified. In this case, the syntax highlighting extensions will colorize\n // the code, but all other CSS properties will be inherited.\n {\n tag: [markdownTags.CodeText, markdownTags.InlineCode],\n class: code,\n },\n\n {\n tag: [markdownTags.QuoteMark],\n class: blockquote,\n },\n\n {\n tag: [markdownTags.HorizontalRule],\n class: horizontalRule,\n },\n\n // Main content, paragraphs, etc.\n // {\n // tag: [tags.content],\n // fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n // },\n ],\n {\n scope: markdownLanguage,\n all: { fontFamily: get(tokens, 'fontFamily.body', []).join(',') },\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { mx } from '@dxos/react-ui-theme';\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n// https://tailwindcss.com/docs/font-weight\nexport const heading: Record<HeadingLevel, string> = {\n 1: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-4xl',\n 2: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-3xl',\n 3: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-2xl',\n 4: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-xl',\n 5: 'mbs-4 mbe-2 font-medium text-inherit no-underline text-lg',\n 6: 'mbs-4 mbe-2 font-medium text-inherit no-underline',\n};\n\nexport const text = 'text-neutral-800 dark:text-neutral-200';\nexport const light = 'text-neutral-200 dark:text-neutral-800';\n\nexport const mark = mx('!font-normal !no-underline !text-inherit opacity-40', light);\n\nexport const paragraph = 'mlb-1';\n\nexport const bold = 'font-bold';\nexport const italic = 'italic';\nexport const strikethrough = 'line-through';\n\nexport const code = 'font-mono !no-underline text-neutral-700 dark:text-neutral-300';\nexport const codeMark = 'font-mono text-primary-500';\nexport const codeBlock = 'mlb-2 font-mono bg-neutral-500/10 p-3 rounded';\n\nexport const inlineUrl = mx(code, 'px-1');\n\n// TODO(burdon): Replace with widget.\nexport const blockquote = mx('pl-1 mr-1 border-is-4 border-primary-500/70 dark:border-primary-500/30', light);\n\n// TODO(burdon): Replace with widget.\nexport const horizontalRule = 'flex mlb-4 border-b text-neutral-100 dark:text-neutral-900 border-neutral-500/50';\n\n// TODO(thure): Tailwind was not seeing `[&>li:before]:content-[\"•\"]` as a utility class, but it would work if instead of `\"•\"` it was `\"X\"`… why?\nexport const unorderedList =\n 'mlb-2 grid grid-cols-[min-content_1fr] [&>li:before]:content-[attr(marker)] [&>li:before]:mlb-1 [&>li:before]:mie-2';\nexport const orderedList =\n 'mlb-2 grid grid-cols-[min-content_1fr] [&>li:before]:content-[counters(section,_\".\")_\"._\"] [counter-reset:section] [&>li:before]:mlb-1';\n\nexport const listItem = 'contents before:[counter-increment:section]';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { StyleSpec } from 'style-mod';\n\nimport { tailwindConfig, type TailwindConfig } from '@dxos/react-ui-theme';\n\nexport type ThemeStyles = {\n [selector: string]: StyleSpec;\n};\n\n// TODO(thure): Why export the whole theme? Can this be done differently?\nexport const tokens: TailwindConfig['theme'] = tailwindConfig({}).theme;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport {\n type EditorState,\n type Extension,\n type RangeSet,\n RangeSetBuilder,\n StateField,\n type Transaction,\n} from '@codemirror/state';\nimport { EditorView, Decoration, WidgetType } from '@codemirror/view';\n\nclass CheckboxWidget extends WidgetType {\n constructor(private readonly _pos: number, private readonly _getCursor: () => number, private _checked: boolean) {\n super();\n }\n\n override eq(other: CheckboxWidget) {\n // Uniqueness based on position; also checks state.\n // TODO(burdon): Is this efficient? Check life-cycle.\n return this._pos === other._pos && this._checked === other._checked;\n }\n\n toDOM(view: EditorView) {\n // console.log('toDom', this._pos);\n const wrap = document.createElement('span');\n wrap.setAttribute('aria-hidden', 'true');\n wrap.className = 'cm-task-item';\n\n const box = wrap.appendChild(document.createElement('input'));\n box.type = 'checkbox';\n box.checked = this._checked;\n box.onclick = (event) => {\n this._checked = !isChecked(view.state, this._pos);\n view.dispatch({\n changes: {\n from: this._pos + 1,\n to: this._pos + 2,\n insert: this._checked ? 'x' : ' ',\n },\n // TODO(burdon): Restore cursor position? More useful to move to end of line (can indent).\n selection: {\n anchor: this._pos + 4,\n // anchor: this._getCursor(),\n },\n });\n return true;\n };\n\n return wrap;\n }\n\n // TODO(burdon): Remove listener?\n // override destroy() {\n // console.log('destroy', this._pos);\n // }\n\n override ignoreEvent() {\n return false;\n }\n}\n\nconst isChecked = (state: EditorState, pos: number) => {\n return state.sliceDoc(pos, pos + 3).toLowerCase() === '[x]';\n};\n\nexport const statefield = (): Extension => {\n let lastPosition: number = 0;\n const listener = EditorView.updateListener.of((update) => {\n lastPosition = update.startState.selection.main.head;\n });\n\n const checkbox = (state: EditorState) => {\n const builder = new RangeSetBuilder();\n syntaxTree(state).iterate({\n enter: (node) => {\n // console.log(node.name, node.from, node.to);\n if (node.name === 'TaskMarker') {\n builder.add(\n node.from,\n node.to,\n Decoration.replace({\n widget: new CheckboxWidget(node.from, () => lastPosition, isChecked(state, node.from)),\n }),\n );\n }\n },\n });\n\n return builder.finish();\n };\n\n return [\n listener,\n StateField.define<RangeSet<any>>({\n create: (state) => checkbox(state),\n update: (_: RangeSet<any>, tr: Transaction) => checkbox(tr.state),\n provide: (field) => EditorView.decorations.from(field),\n }),\n ];\n};\n\n// TODO(burdon): Reconcile with theme.\nexport const styles = EditorView.baseTheme({\n '& .cm-task-item': {\n padding: '0 4px',\n },\n});\n\nexport const tasklist = () => [statefield(), styles];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Extension } from '@codemirror/state';\nimport { hoverTooltip } from '@codemirror/view';\n\nimport { tooltipContent } from '@dxos/react-ui-theme';\n\nconst markdownLinkRegexp = /\\[([^\\]]+)]\\(([^)]+)\\)/;\n\nexport type TooltipOptions = {\n onHover: (el: Element, url: string) => void;\n regexp?: RegExp;\n};\n\n/**\n * https://codemirror.net/examples/tooltip\n * https://codemirror.net/docs/ref/#view.hoverTooltip\n * https://github.com/codemirror/view/blob/main/src/tooltip.ts\n */\nexport const tooltip = ({ onHover, regexp = markdownLinkRegexp }: TooltipOptions): Extension =>\n hoverTooltip((view, pos) => {\n const { from, text } = view.state.doc.lineAt(pos);\n const p = pos - from;\n\n let idx = 0;\n let match;\n do {\n match = text.substring(idx).match(regexp);\n if (!match) {\n match = undefined;\n break;\n }\n\n idx = text.indexOf(match[0]);\n if (p >= idx && p < idx + match[0].length) {\n break;\n }\n\n idx += match[0].length;\n } while (true);\n\n if (!match) {\n return null;\n }\n\n const [, , url] = match ?? [];\n\n return {\n pos: idx + from,\n end: idx + from + match[0].length,\n above: true,\n create: () => {\n const el = document.createElement('div');\n el.className = tooltipContent({}, 'pli-2 plb-1');\n onHover(el, url);\n return { dom: el, offset: { x: 0, y: 12 } };\n },\n };\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport get from 'lodash.get';\nimport { type StyleSpec } from 'style-mod';\n\nimport { tokens } from '../../../styles';\n\n/**\n * Minimal styles.\n * https://codemirror.net/examples/styling\n * NOTE: Use one of '&', '&light', and '&dark' prefix to scope instance.\n * NOTE: `light` and `dark` selectors are preprocessed by CodeMirror and can only be in the base theme.\n */\nexport const defaultTheme: {\n [selector: string]: StyleSpec;\n} = {\n //\n // Main layout:\n // <div class=\".cm-editor .cm-focused\">\n // <div class=\".cm-scroller\">\n // <div class=\".cm-content\" role=\"textbox\" contenteditable=\"true\">\n // <div class=\".cm-line\" />\n // </div>\n // </div>\n // </div>\n //\n '&': {},\n '&.cm-focused': {\n outline: 'none',\n },\n '& .cm-scroller': {\n overflow: 'visible',\n },\n '& .cm-content': {\n padding: 0,\n // Base font size (otherwise defined by HTML tag, which might be different for storybook).\n fontSize: '16px',\n },\n '&light .cm-content': {\n color: get(tokens, 'extend.colors.neutral.900', 'black'),\n caretColor: 'black',\n },\n '&dark .cm-content': {\n color: get(tokens, 'extend.colors.neutral.100', 'white'),\n caretColor: 'white',\n },\n\n //\n // Cursor\n //\n '&light .cm-cursor': {\n borderLeft: '2px solid black',\n },\n '&dark .cm-cursor': {\n borderLeft: '2px solid white',\n },\n '& .cm-placeholder': {\n fontWeight: 100,\n },\n\n //\n // line\n //\n '& .cm-line': {\n paddingInline: 0,\n },\n '& .cm-line *': {},\n '& .cm-activeLine': {\n backgroundColor: 'transparent',\n },\n\n //\n // selection\n //\n\n '&light .cm-selectionBackground, &light.cm-focused .cm-selectionBackground': {\n background: get(tokens, 'extend.colors.primary.150', '#00ffff'),\n },\n '&dark .cm-selectionBackground, &dark.cm-focused .cm-selectionBackground': {\n background: get(tokens, 'extend.colors.primary.850', '#00ffff'),\n },\n '&light .cm-selectionMatch': {\n background: get(tokens, 'extend.colors.primary.250', '#00ffff') + '44',\n },\n '&dark .cm-selectionMatch': {\n background: get(tokens, 'extend.colors.primary.600', '#00ffff') + '44',\n },\n\n //\n // collaboration\n // TODO(burdon): Review classnames (YJS dependent?)\n //\n\n '&light .cm-ySelection, &light .cm-yLineSelection': {\n mixBlendMode: 'multiply',\n },\n '&dark .cm-ySelection, &dark .cm-yLineSelection': {\n mixBlendMode: 'screen',\n },\n\n '& .cm-ySelectionInfo': {\n padding: '2px 4px',\n marginBlockStart: '-4px',\n },\n '& .cm-ySelection, & .cm-selectionMatch': {\n paddingBlockStart: '.15em',\n paddingBlockEnd: '.15em',\n },\n '& .cm-ySelectionCaret': {\n display: 'inline-block',\n insetBlockStart: '.1em',\n blockSize: '1.4em',\n verticalAlign: 'top',\n },\n '& .cm-yLineSelection': {\n margin: 0,\n },\n\n //\n // link\n //\n '& .cm-link': {\n color: get(tokens, 'extend.colors.primary.500'),\n textDecorationLine: 'underline',\n textDecorationThickness: '1px',\n textUnderlineOffset: '2px',\n borderRadius: '.125rem',\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n },\n\n //\n // tooltip\n //\n '& .cm-tooltip': {\n border: 'none',\n },\n // '& .cm-tooltip-below': {},\n // '& .cm-tooltip-autocomplete': {},\n\n //\n // font size\n // TODO(thure): This appears to be the best or only way to set selection caret heights, but it's far more verbose than it needs to be.\n //\n ...Object.keys(get(tokens, 'extend.fontSize', {})).reduce((acc: Record<string, any>, fontSize) => {\n const height = get(tokens, ['extend', 'fontSize', fontSize, 1, 'lineHeight']);\n\n acc[`& .text-${fontSize} + .cm-ySelectionCaret`] = { height };\n acc[`& .text-${fontSize} + .cm-ySelection + .cm-ySelectionCaret`] = { height };\n acc[`& .text-${fontSize} + .cm-widgetBuffer + .cm-ySelectionCaret`] = { height };\n return acc;\n }, {}),\n};\n\nexport const textTheme: {\n [selector: string]: StyleSpec;\n} = {\n '& .cm-scroller': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n },\n};\n\nexport const codeTheme: {\n [selector: string]: StyleSpec;\n} = {\n '& .cm-scroller': {\n fontFamily: get(tokens, 'fontFamily.mono', []).join(','),\n },\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { EditorState, type Extension } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { vim } from '@replit/codemirror-vim';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport React, {\n type ComponentProps,\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { useThemeContext } from '@dxos/react-ui';\nimport { getColorForValue, inputSurface, mx } from '@dxos/react-ui-theme';\n\nimport { basicBundle, markdownBundle } from './extensions';\nimport { defaultTheme, textTheme } from './themes';\nimport { type EditorModel } from '../../hooks';\nimport { type ThemeStyles } from '../../styles';\n\nexport const EditorModes = ['default', 'vim'] as const;\nexport type EditorMode = (typeof EditorModes)[number];\n\nexport type CursorInfo = {\n from: number;\n to: number;\n line: number;\n lines: number;\n after?: string;\n};\n\nexport type TextEditorRef = {\n root: HTMLDivElement | null;\n state?: EditorState;\n view?: EditorView;\n};\n\nexport type TextEditorSlots = {\n root?: Omit<ComponentProps<'div'>, 'ref'>;\n editor?: {\n className?: string;\n placeholder?: string;\n spellCheck?: boolean;\n tabIndex?: number;\n theme?: ThemeStyles;\n };\n};\n\nexport type TextEditorProps = {\n model: EditorModel;\n extensions?: Extension[];\n slots?: TextEditorSlots;\n editorMode?: EditorMode;\n};\n\n/**\n * Base text editor.\n * NOTE: Rather than adding properties, try to create extensions that can be reused.\n */\nexport const BaseTextEditor = forwardRef<TextEditorRef, TextEditorProps>(\n ({ model, extensions = [], slots = defaultSlots, editorMode }, forwardedRef) => {\n const { themeMode } = useThemeContext();\n const tabsterDOMAttribute = useFocusableGroup({ tabBehavior: 'limited' });\n\n // TODO(burdon): Factor out?\n const { awareness, peer } = model;\n useEffect(() => {\n if (awareness && peer) {\n awareness.setLocalStateField('user', {\n name: peer.name ?? generateName(peer.id),\n color: getColorForValue({ value: peer.id, type: 'color' }),\n colorLight: getColorForValue({ value: peer.id, themeMode, type: 'highlight' }),\n });\n }\n }, [awareness, peer, themeMode]);\n\n const [root, setRoot] = useState<HTMLDivElement | null>(null);\n const [state, setState] = useState<EditorState>();\n const [view, setView] = useState<EditorView>();\n useImperativeHandle(forwardedRef, () => ({ root, state, view }), [view, state, root]);\n\n useEffect(() => {\n if (!root) {\n return;\n }\n\n const state = EditorState.create({\n doc: model.text(),\n extensions: [\n // TODO(burdon): Factor out VIM mode?\n editorMode === 'vim' && vim(),\n\n // Theme.\n EditorView.baseTheme(defaultTheme),\n EditorView.theme(slots?.editor?.theme ?? {}),\n // TODO(burdon): themeMode doesn't change in storybooks.\n EditorView.darkTheme.of(themeMode === 'dark'),\n\n // Storage and replication.\n model.extension,\n\n // Custom.\n ...extensions,\n ].filter(Boolean) as Extension[],\n });\n\n // NOTE: This repaints the editor.\n // If the new state is derived from the old state, it will likely not be visible other than the cursor resetting.\n // Ideally this should not be hit except when changing between text objects.\n view?.destroy();\n setView(new EditorView({ state, parent: root }));\n setState(state);\n\n return () => {\n view?.destroy();\n setView(undefined);\n setState(undefined);\n };\n }, [root, model, themeMode, editorMode]);\n\n const handleKeyUp = useCallback(\n (event: KeyboardEvent) => {\n const { key, altKey, shiftKey, metaKey, ctrlKey } = event;\n switch (key) {\n case 'Enter': {\n view?.contentDOM.focus();\n break;\n }\n\n case 'Escape': {\n editorMode === 'vim' && (altKey || shiftKey || metaKey || ctrlKey) && root?.focus();\n break;\n }\n }\n },\n [view, editorMode],\n );\n\n return (\n <div\n key={model.id}\n ref={setRoot}\n tabIndex={0}\n {...slots?.root}\n {...(editorMode !== 'vim' && tabsterDOMAttribute)}\n onKeyUp={handleKeyUp}\n />\n );\n },\n);\n\n// TODO(burdon): Set default text theme?\nexport const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(\n ({ extensions = [], slots: _slots, ...props }, forwardedRef) => {\n const { themeMode } = useThemeContext();\n const slots = defaultsDeep({}, _slots, defaultTextSlots);\n return (\n <BaseTextEditor\n ref={forwardedRef}\n extensions={[basicBundle({ themeMode, placeholder: slots?.editor?.placeholder }), ...extensions]}\n slots={slots}\n {...props}\n />\n );\n },\n);\n\nexport const MarkdownEditor = forwardRef<TextEditorRef, TextEditorProps>(\n ({ extensions = [], slots: _slots, ...props }, forwardedRef) => {\n const { themeMode } = useThemeContext();\n const slots = defaultsDeep({}, _slots, defaultSlots);\n return (\n <BaseTextEditor\n ref={forwardedRef}\n extensions={[markdownBundle({ themeMode, placeholder: slots?.editor?.placeholder }), ...extensions]}\n slots={slots}\n {...props}\n />\n );\n },\n);\n\nexport const defaultSlots: TextEditorSlots = {\n root: {\n className: mx('p-2', inputSurface),\n },\n};\n\nexport const defaultTextSlots: TextEditorSlots = {\n ...defaultSlots,\n editor: {\n theme: textTheme,\n },\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Extension } from '@codemirror/state';\nimport get from 'lodash.get';\nimport { useEffect, useState } from 'react';\nimport { yCollab } from 'y-codemirror.next';\nimport type * as awarenessProtocol from 'y-protocols/awareness';\n\nimport { invariant } from '@dxos/invariant';\nimport {\n type DocAccessor,\n type Space,\n type TextObject,\n type AutomergeTextCompat,\n getRawDoc,\n isActualAutomergeObject,\n} from '@dxos/react-client/echo';\nimport { type Identity } from '@dxos/react-client/halo';\nimport type { YText, YXmlFragment } from '@dxos/text-model';\n\nimport { automergePlugin } from './automerge';\nimport { SpaceAwarenessProvider } from './yjs';\n\n// TODO(burdon): Move.\ntype Awareness = awarenessProtocol.Awareness;\n\n// TODO(wittjosiah): Factor out to common package? @dxos/react-client?\nexport type EditorModel = {\n id: string;\n content: string | YText | YXmlFragment | DocAccessor;\n text: () => string;\n extension?: Extension;\n awareness?: Awareness;\n peer?: {\n id: string;\n name?: string;\n };\n};\n\n// TODO(burdon): Remove space/identity dependency. Define interface for the framework re content and presence.\nexport type UseTextModelOptions = {\n identity?: Identity | null;\n space?: Space;\n text?: TextObject;\n};\n\n// TODO(burdon): Remove YJS/Automerge deps (from UI component -- create abstraction; incl. all ECHO/Space deps).\n// TODO(wittjosiah): Factor out to common package? @dxos/react-client?\nexport const useTextModel = ({ identity, space, text }: UseTextModelOptions): EditorModel | undefined => {\n const [model, setModel] = useState<EditorModel | undefined>(() => createModel({ identity, space, text }));\n useEffect(() => {\n setModel(createModel({ identity, space, text }));\n }, [identity, space, text]);\n return model;\n};\n\nconst createModel = (options: UseTextModelOptions) => {\n const { space, text } = options;\n\n if (isActualAutomergeObject(text)) {\n return createAutomergeModel(options);\n } else {\n if (!space || !text?.doc || !text?.content) {\n return undefined;\n }\n return createYjsModel(options);\n }\n};\n\nconst createYjsModel = ({ identity, space, text }: UseTextModelOptions): EditorModel => {\n invariant(space && text?.doc && text?.content);\n const provider = new SpaceAwarenessProvider({ space, doc: text.doc, channel: `yjs.awareness.${text.id}` });\n\n return {\n id: text.doc.guid,\n content: text.content,\n text: () => text.content!.toString(),\n extension: yCollab(text.content as YText, provider.awareness),\n awareness: provider.awareness,\n peer: identity\n ? {\n id: identity.identityKey.toHex(),\n name: identity.profile?.displayName,\n }\n : undefined,\n };\n};\n\nconst createAutomergeModel = ({ identity, space, text }: UseTextModelOptions): EditorModel => {\n const obj = text as any as AutomergeTextCompat;\n const doc = getRawDoc(obj, [obj.field]);\n\n return {\n id: obj.id,\n content: doc,\n text: () => get(doc.handle.docSync(), doc.path),\n extension: automergePlugin(doc.handle, doc.path),\n peer: identity\n ? {\n id: identity.identityKey.toHex(),\n name: identity.profile?.displayName,\n }\n : undefined,\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {\n Annotation,\n type EditorState,\n type Extension,\n Facet,\n StateEffect,\n StateField,\n type Transaction,\n type TransactionSpec,\n} from '@codemirror/state';\nimport { ViewPlugin, type EditorView, type PluginValue, type ViewUpdate } from '@codemirror/view';\n\nimport * as automerge from '@dxos/automerge/automerge';\nimport { type Heads, type Prop } from '@dxos/automerge/automerge';\n\nimport { PatchSemaphore } from './PatchSemaphore';\nimport { type IDocHandle } from './handle';\n\nexport type Value = {\n lastHeads: Heads;\n path: Prop[];\n unreconciledTransactions: Transaction[];\n};\n\ntype UpdateHeads = {\n newHeads: Heads;\n};\n\nexport const effectType = StateEffect.define<UpdateHeads>({});\n\nexport const updateHeads = (newHeads: Heads): StateEffect<UpdateHeads> => effectType.of({ newHeads });\n\nexport const getLastHeads = (state: EditorState, field: Field): Heads => state.field(field).lastHeads;\n\nexport const getPath = (state: EditorState, field: Field): Prop[] => state.field(field).path;\n\nexport type Field = StateField<Value>;\n\nconst semaphoreFacet = Facet.define<PatchSemaphore, PatchSemaphore>({\n combine: (values) => values.at(-1)!, // Take last.\n});\n\nexport type AutomergePlugin = {\n extension: Extension;\n};\n\nexport const automergePlugin = (handle: IDocHandle, path: Prop[]): AutomergePlugin => {\n const stateField: StateField<Value> = StateField.define({\n create: () => ({\n lastHeads: automerge.getHeads(handle.docSync()!),\n unreconciledTransactions: [],\n path: path.slice(),\n }),\n update: (value: Value, tr: Transaction) => {\n const result: Value = {\n lastHeads: value.lastHeads,\n unreconciledTransactions: value.unreconciledTransactions.slice(),\n path: path.slice(),\n };\n let clearUnreconciled = false;\n for (const effect of tr.effects) {\n if (effect.is(effectType)) {\n result.lastHeads = effect.value.newHeads;\n clearUnreconciled = true;\n }\n }\n if (clearUnreconciled) {\n result.unreconciledTransactions = [];\n } else {\n if (!isReconcileTx(tr)) {\n result.unreconciledTransactions.push(tr);\n }\n }\n return result;\n },\n });\n const semaphore = new PatchSemaphore(stateField);\n\n const viewPlugin = ViewPlugin.fromClass(\n class AutomergeCodemirrorViewPlugin implements PluginValue {\n private _view: EditorView;\n\n constructor(view: EditorView) {\n this._view = view;\n handle.addListener('change', this._handleChange);\n }\n\n update(update: ViewUpdate) {\n if (update.transactions.length > 0 && update.transactions.some((t) => !isReconcileTx(t))) {\n queueMicrotask(() => {\n this._view.state.facet(semaphoreFacet).reconcile(handle, this._view);\n });\n }\n }\n\n destroy() {\n handle.addListener('change', this._handleChange);\n }\n\n private _handleChange = () => {\n this._view.state.facet(semaphoreFacet).reconcile(handle, this._view);\n };\n },\n );\n\n return {\n extension: [stateField, semaphoreFacet.of(semaphore), viewPlugin],\n };\n};\n\nexport const reconcileAnnotationType = Annotation.define<unknown>();\n\nexport const isReconcileTx = (tr: Transaction): boolean => !!tr.annotation(reconcileAnnotationType);\n\nexport const makeReconcile = (tr: TransactionSpec) => {\n if (tr.annotations != null) {\n if (tr.annotations instanceof Array) {\n tr.annotations = [...tr.annotations, reconcileAnnotationType.of({})];\n } else {\n tr.annotations = [tr.annotations, reconcileAnnotationType.of({})];\n }\n } else {\n tr.annotations = [reconcileAnnotationType.of({})];\n }\n // return {\n // ...tr,\n // annotations: reconcileAnnotationType.of({})\n // }\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type EditorView } from '@codemirror/view';\n\nimport { next as automerge } from '@dxos/automerge/automerge';\n\nimport amToCodemirror from './amToCodemirror';\nimport codeMirrorToAm from './codeMirrorToAm';\nimport { type IDocHandle } from './handle';\nimport { type Field, isReconcileTx, getPath, reconcileAnnotationType, updateHeads, getLastHeads } from './plugin';\n\ntype Doc<T> = automerge.Doc<T>;\ntype Heads = automerge.Heads;\n\ntype ChangeFn = (atHeads: Heads, change: (doc: Doc<unknown>) => void) => Heads | undefined;\n\nexport class PatchSemaphore {\n _field!: Field;\n _inReconcile = false;\n _queue: Array<ChangeFn> = [];\n\n constructor(field?: Field) {\n if (field !== undefined) {\n this._field = field;\n }\n }\n\n reconcile = (handle: IDocHandle, view: EditorView) => {\n if (this._inReconcile) {\n return;\n }\n this._inReconcile = true;\n\n const path = getPath(view.state, this._field);\n const oldHeads = getLastHeads(view.state, this._field);\n let selection = view.state.selection;\n\n const transactions = view.state.field(this._field).unreconciledTransactions.filter((tx) => !isReconcileTx(tx));\n\n // First undo all the unreconciled transactions\n const toInvert = transactions.slice().reverse();\n for (const tx of toInvert) {\n const inverted = tx.changes.invert(tx.startState.doc);\n selection = selection.map(inverted);\n view.dispatch({\n changes: inverted,\n annotations: reconcileAnnotationType.of(true),\n });\n }\n\n // now apply the unreconciled transactions to the document\n let newHeads = codeMirrorToAm(this._field, handle, transactions, view.state);\n\n // NOTE: null and undefined each come from automerge and repo respectively\n if (newHeads === null || newHeads === undefined) {\n // TODO: @alexjg this is the call that's resetting the editor state on click\n newHeads = automerge.getHeads(handle.docSync()!);\n }\n\n // now get the diff between the updated state of the document and the heads\n // and apply that to the codemirror doc\n const diff = automerge.equals(oldHeads, newHeads) ? [] : automerge.diff(handle.docSync()!, oldHeads, newHeads);\n amToCodemirror(view, selection, path, diff);\n\n view.dispatch({\n effects: updateHeads(newHeads),\n annotations: reconcileAnnotationType.of({}),\n });\n\n this._inReconcile = false;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ChangeSet, type ChangeSpec, type EditorSelection, type EditorState } from '@codemirror/state';\nimport { type EditorView } from '@codemirror/view';\n\nimport {\n type DelPatch,\n type InsertPatch,\n type Patch,\n type Prop,\n type PutPatch,\n type SpliceTextPatch,\n} from '@dxos/automerge/automerge';\n\nimport { reconcileAnnotationType } from './plugin';\n\nexport default (view: EditorView, selection: EditorSelection, target: Prop[], patches: Patch[]) => {\n for (const patch of patches) {\n const changeSpec = handlePatch(patch, target, view.state);\n if (changeSpec != null) {\n const changeSet = ChangeSet.of(changeSpec, view.state.doc.length, '\\n');\n selection = selection.map(changeSet, 1);\n view.dispatch({\n changes: changeSet,\n annotations: reconcileAnnotationType.of({}),\n });\n }\n }\n view.dispatch({\n selection,\n annotations: reconcileAnnotationType.of({}),\n });\n};\n\nconst handlePatch = (patch: Patch, target: Prop[], state: EditorState): ChangeSpec | null => {\n if (patch.action === 'insert') {\n return handleInsert(target, patch);\n } else if (patch.action === 'splice') {\n return handleSplice(target, patch);\n } else if (patch.action === 'del') {\n return handleDel(target, patch);\n } else if (patch.action === 'put') {\n return handlePut(target, patch, state);\n } else {\n return null;\n }\n};\n\nconst handleInsert = (target: Prop[], patch: InsertPatch): Array<ChangeSpec> => {\n const index = charPath(target, patch.path);\n if (index == null) {\n return [];\n }\n const text = patch.values.map((v) => (v ? v.toString() : '')).join('');\n return [{ from: index, to: index, insert: text }];\n};\n\nconst handleSplice = (target: Prop[], patch: SpliceTextPatch): Array<ChangeSpec> => {\n const index = charPath(target, patch.path);\n if (index == null) {\n return [];\n }\n return [{ from: index, insert: patch.value }];\n};\n\nconst handleDel = (target: Prop[], patch: DelPatch): Array<ChangeSpec> => {\n const index = charPath(target, patch.path);\n if (index == null) {\n return [];\n }\n const length = patch.length || 1;\n return [{ from: index, to: index + length }];\n};\n\nconst handlePut = (target: Prop[], patch: PutPatch, state: EditorState): Array<ChangeSpec> => {\n const index = charPath(target, [...patch.path, 0]);\n if (index == null) {\n return [];\n }\n const length = state.doc.length;\n if (typeof patch.value !== 'string') {\n return []; // TODO(dmaretskyi): How to handle non string values?\n }\n return [{ from: 0, to: length, insert: patch.value as any }];\n};\n\n// If the path of the patch is of the form [path, <index>] then we know this is\n// a path to a character within the sequence given by path\nconst charPath = (textPath: Prop[], candidatePath: Prop[]): number | null => {\n if (candidatePath.length !== textPath.length + 1) {\n return null;\n }\n for (let i = 0; i < textPath.length; i++) {\n if (textPath[i] !== candidatePath[i]) {\n return null;\n }\n }\n const index = candidatePath[candidatePath.length - 1];\n if (typeof index === 'number') {\n return index;\n }\n return null;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type EditorState, type Text, type Transaction } from '@codemirror/state';\n\nimport { next as am, type Heads } from '@dxos/automerge/automerge';\n\nimport { type IDocHandle } from './handle';\nimport { type Field } from './plugin';\n\nexport default (\n field: Field,\n handle: IDocHandle,\n transactions: Transaction[],\n state: EditorState,\n): Heads | undefined => {\n const { lastHeads, path } = state.field(field);\n\n // We don't want to call `automerge.updateAt` if there are no changes.\n // Otherwise later on `automerge.diff` will return empty patches that result in a no-op but still mess up the selection.\n let hasChanges = false;\n for (const tr of transactions) {\n tr.changes.iterChanges(() => {\n hasChanges = true;\n });\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n const newHeads = handle.changeAt(lastHeads, (doc: am.Doc<unknown>) => {\n for (const tr of transactions) {\n tr.changes.iterChanges((fromA: number, toA: number, _fromB: number, _toB: number, inserted: Text) => {\n am.splice(doc, path, fromA, toA - fromA, inserted.toString());\n });\n }\n });\n return newHeads ?? undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// Copied from https://github.com/yjs/y-codemirror.next#example.\n\nimport * as random from 'lib0/random';\n\nconst cursorColors = [\n { color: '#30bced', light: '#30bced33' },\n { color: '#6eeb83', light: '#6eeb8333' },\n { color: '#ffbc42', light: '#ffbc4233' },\n { color: '#ecd444', light: '#ecd44433' },\n { color: '#ee6352', light: '#ee635233' },\n { color: '#9ac2c9', light: '#9ac2c933' },\n { color: '#8acb88', light: '#8acb8833' },\n { color: '#1be7ff', light: '#1be7ff33' },\n];\n\n// Select a random color for this user.\nexport const cursorColor = cursorColors[random.uint32() % cursorColors.length];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as decoding from 'lib0/decoding';\nimport * as encoding from 'lib0/encoding';\nimport { Observable } from 'lib0/observable';\nimport * as awarenessProtocol from 'y-protocols/awareness';\nimport { type Doc } from 'yjs';\n\nimport { log } from '@dxos/log';\nimport { type Space } from '@dxos/react-client/echo';\nimport { type GossipMessage } from '@dxos/react-client/mesh';\n\ntype Awareness = awarenessProtocol.Awareness;\n\n// Based on https://github.com/yjs/y-webrtc/blob/88baab2/src/y-webrtc.js.\n\nconst messageAwareness = 1;\nconst messageQueryAwareness = 3;\n\n/**\n * Yjs awareness provider on top of a DXOS space.\n */\nexport class SpaceAwarenessProvider extends Observable<any> {\n private readonly _space: Space;\n private readonly _awareness: Awareness;\n private readonly _clientId: number;\n private readonly _channel: string;\n\n constructor({ space, doc, channel, awareness }: { space: Space; doc: Doc; channel: string; awareness?: Awareness }) {\n super();\n this._space = space;\n this._awareness = awareness ?? new awarenessProtocol.Awareness(doc);\n this._channel = channel;\n this._clientId = doc.clientID;\n\n this._awareness.on('update', this._handleAwarenessUpdate.bind(this));\n this._space.listen(this._channel, this._handleSpaceMessage.bind(this));\n\n if (typeof window !== 'undefined') {\n window.addEventListener('beforeunload', this._handleBeforeUnload.bind(this));\n } else if (typeof process !== 'undefined') {\n process.on('exit', this._handleBeforeUnload.bind(this));\n }\n\n // Post queryAwareness.\n const encoderAwarenessQuery = encoding.createEncoder();\n encoding.writeVarUint(encoderAwarenessQuery, messageQueryAwareness);\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwarenessQuery));\n\n // Post local awareness state.\n const encoderAwarenessState = encoding.createEncoder();\n encoding.writeVarUint(encoderAwarenessState, messageAwareness);\n encoding.writeVarUint8Array(\n encoderAwarenessState,\n awarenessProtocol.encodeAwarenessUpdate(this.awareness, [this._clientId]),\n );\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwarenessState));\n }\n\n get awareness(): Awareness {\n return this._awareness;\n }\n\n private _handleAwarenessUpdate({ added, updated, removed }: any, origin: any) {\n log('awareness update', { added, updated, removed, origin });\n const changedClients = added.concat(updated).concat(removed);\n const encoderAwareness = encoding.createEncoder();\n encoding.writeVarUint(encoderAwareness, messageAwareness);\n encoding.writeVarUint8Array(\n encoderAwareness,\n awarenessProtocol.encodeAwarenessUpdate(this._awareness, changedClients),\n );\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwareness));\n }\n\n private _handleSpaceMessage({ payload }: GossipMessage) {\n log('space message', payload);\n const data = new Uint8Array(Array.from(Object.values(payload)));\n const encoder = this._readMessage(data);\n if (encoder) {\n void this._space.postMessage(this._channel, encoding.toUint8Array(encoder));\n }\n }\n\n private _readMessage(message: Uint8Array) {\n const decoder = decoding.createDecoder(message);\n const encoder = encoding.createEncoder();\n const messageType = decoding.readVarUint(decoder);\n\n let sendReply = false;\n switch (messageType) {\n case messageAwareness: {\n awarenessProtocol.applyAwarenessUpdate(this._awareness, decoding.readVarUint8Array(decoder), this);\n break;\n }\n\n case messageQueryAwareness: {\n encoding.writeVarUint(encoder, messageAwareness);\n encoding.writeVarUint8Array(\n encoder,\n awarenessProtocol.encodeAwarenessUpdate(this._awareness, Array.from(this._awareness.getStates().keys())),\n );\n sendReply = true;\n break;\n }\n\n default: {\n console.error('Invalid message:', messageType);\n return encoder;\n }\n }\n\n if (!sendReply) {\n // Nothing has been written, no answer created.\n return null;\n }\n\n return encoder;\n }\n\n private _handleBeforeUnload() {\n awarenessProtocol.removeAwarenessStates(this._awareness, [this._clientId], 'window unload');\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,gBAAgB;AACzB,SAASC,KAAKC,OAAOC,oBAAoB;;;ACDzC,SAASC,QAAAA,aAAY;;;ACYrB,SACEC,gBAGAC,wBAEK;AACP,SAASC,cAAc;AAShB,IAAMC,eAAe,CAAC,EAAEC,WAAU,MAAuB;AAC9D,SAAO;;;IAGLC,OAAOC,GAAGC,gBAAAA;;;IAIVC,eAAe;;;;MAKbC,kBAAkB;;;MAIlBC,UAAU;QACR,CAACC,YAAAA;AACC,gBAAMC,OAAOD,QAAQE,YAAY,KAAA;AACjC,cAAI,CAACD,QAASA,KAAKE,SAASF,KAAKG,MAAM,CAACJ,QAAQK,UAAW;AACzD,mBAAO;UACT;AAGA,iBAAO;YACLF,MAAMF,KAAKE;YACXG,SAASb,WAAWQ,KAAKM,KAAKC,YAAW,CAAA;UAO3C;QACF;;IAEJ,CAAA;;AAEJ;;;ACnEA,SA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OAAAA;EACxB;AACF;AAEA,IAAMM,iBAAiB,CAAC,EAAEd,UAAUC,OAAOC,KAAI,MAAuB;AACpEa,YAAUd,SAASC,MAAMS,OAAOT,MAAMU,SAAAA,QAAAA;;;;;;;;;AACtC,QAAMI,WAAW,IAAIC,uBAAuB;IAAEhB;IAAOU,KAAKT,KAAKS;IAAKO,SAAS,iBAAiBhB,KAAKiB,EAAE;EAAG,CAAA;AAExG,SAAO;IACLA,IAAIjB,KAAKS,IAAIS;IACbR,SAASV,KAAKU;IACdV,MAAM,MAAMA,KAAKU,QAASS,SAAQ;IAClCC,WAAWC,QAAQrB,KAAKU,SAAkBI,SAASQ,SAAS;IAC5DA,WAAWR,SAASQ;IACpBC,MAAMzB,WACF;MACEmB,IAAInB,SAAS0B,YAAYC,MAAK;MAC9BC,MAAM5B,SAAS6B,SAASC;IAC1B,IACAjB;EACN;AACF;AAEA,IAAMH,uBAAuB,CAAC,EAAEV,UAAUC,OAAOC,KAAI,MAAuB;AAC1E,QAAM6B,MAAM7B;AACZ,QAAMS,MAAMqB,UAAUD,KAAK;IAACA,IAAIE;GAAM;AAEtC,SAAO;IACLd,IAAIY,IAAIZ;IACRP,SAASD;IACTT,MAAM,MAAMgC,KAAIvB,IAAIwB,OAAOC,QAAO,GAAIzB,IAAI0B,IAAI;IAC9Cf,WAAWgB,gBAAgB3B,IAAIwB,QAAQxB,IAAI0B,IAAI;IAC/CZ,MAAMzB,WACF;MACEmB,IAAInB,SAAS0B,YAAYC,MAAK;MAC9BC,MAAM5B,SAAS6B,SAASC;IAC1B,IACAjB;EACN;AACF;",
|
|
6
|
+
"names": ["TextKind", "Doc", "YText", "YXmlFragment", "tags", "autocompletion", "completionKeymap", "keymap", "autocomplete", "getOptions", "keymap", "of", "completionKeymap", "autocompletion", "activateOnTyping", "override", "context", "word", "matchBefore", "from", "to", "explicit", "options", "text", "toLowerCase", "closeBrackets", "bracketMatching", "defaultHighlightStyle", "syntaxHighlighting", "oneDarkHighlightStyle", "EditorView", "placeholder", "basicBundle", "themeMode", "placeholder", "_placeholder", "bracketMatching", "closeBrackets", "EditorView", "lineWrapping", "syntaxHighlighting", "oneDarkHighlightStyle", "defaultHighlightStyle", "filter", "Boolean", "syntaxTree", "RangeSetBuilder", "StateField", "Decoration", "EditorView", "WidgetType", "LinkButton", "WidgetType", "constructor", "_pos", "_url", "_onAttach", "eq", "other", "toDOM", "view", "el", "document", "createElement", "LinkText", "_text", "link", "setAttribute", "textContent", "href", "onclick", "dispatch", "selection", "anchor", "update", "state", "options", "builder", "RangeSetBuilder", "cursor", "main", "head", "syntaxTree", "iterate", "enter", "node", "name", "marks", "getChildren", "text", "length", "sliceDoc", "to", "from", "urlNode", "getChild", "url", "add", "Decoration", "replace", "widget", "undefined", "onRender", "finish", "StateField", "define", "create", "_", "tr", "provide", "field", "EditorView", "decorations", "StateField", "listener", "onChange", "StateField", "define", "create", "update", "_value", "transaction", "docChanged", "newDoc", "toString", "closeBrackets", "closeBracketsKeymap", "defaultKeymap", "history", "historyKeymap", "indentWithTab", "markdownLanguage", "markdown", "bracketMatching", "defaultHighlightStyle", "foldKeymap", "indentOnInput", "syntaxHighlighting", "languages", "lintKeymap", "highlightSelectionMatches", "searchKeymap", "EditorState", "oneDarkHighlightStyle", "crosshairCursor", "drawSelection", "dropCursor", "EditorView", "highlightActiveLine", "highlightActiveLineGutter", "highlightSpecialChars", "keymap", "placeholder", "rectangularSelection", "markdownLanguage", "HighlightStyle", "tags", "styleTags", "Tag", "get", "mx", "heading", "light", "mark", "mx", "bold", "italic", "strikethrough", "code", "codeMark", "inlineUrl", "mx", "code", "blockquote", "light", "horizontalRule", "tailwindConfig", "tokens", "tailwindConfig", "theme", "markdownTags", "Blockquote", "Tag", "define", "CodeMark", "CodeText", "EmphasisMark", "HeaderMark", "HorizontalRule", "InlineCode", "LinkLabel", "LinkReference", "ListMark", "QuoteMark", "URL", "markdownTagsExtension", "props", "styleTags", "markdownHighlightStyle", "HighlightStyle", "tag", "tags", "keyword", "name", "deleted", "character", "propertyName", "macroName", "color", "constant", "standard", "definition", "separator", "typeName", "className", "number", "changed", "annotation", "modifier", "self", "namespace", "operator", "operatorKeyword", "escape", "regexp", "special", "string", "meta", "comment", "atom", "bool", "variableName", "processingInstruction", "inserted", "invalid", "class", "mark", "heading1", "heading", "heading2", "heading3", "heading4", "heading5", "heading6", "emphasis", "italic", "strong", "bold", "strikethrough", "inlineUrl", "function", "labelName", "codeMark", "code", "blockquote", "horizontalRule", "scope", "markdownLanguage", "all", "fontFamily", "get", "tokens", "join", "markdownBundle", "themeMode", "placeholder", "_placeholder", "bracketMatching", "closeBrackets", "EditorState", "allowMultipleSelections", "of", "EditorView", "lineWrapping", "crosshairCursor", "dropCursor", "drawSelection", "highlightActiveLine", "highlightActiveLineGutter", "highlightSelectionMatches", "highlightSpecialChars", "history", "indentOnInput", "rectangularSelection", "keymap", "closeBracketsKeymap", "defaultKeymap", "foldKeymap", "historyKeymap", "lintKeymap", "searchKeymap", "indentWithTab", "markdown", "base", "markdownLanguage", "codeLanguages", "languages", "extensions", "markdownTagsExtension", "syntaxHighlighting", "markdownHighlightStyle", "oneDarkHighlightStyle", "defaultHighlightStyle", "filter", "Boolean", "syntaxTree", "RangeSetBuilder", "StateField", "EditorView", "Decoration", "WidgetType", "CheckboxWidget", "WidgetType", "constructor", "_pos", "_getCursor", "_checked", "eq", "other", "toDOM", "view", "wrap", "document", "createElement", "setAttribute", "className", "box", "appendChild", "type", "checked", "onclick", "event", "isChecked", "state", "dispatch", "changes", "from", "to", "insert", "selection", "anchor", "ignoreEvent", "pos", "sliceDoc", "toLowerCase", "statefield", "lastPosition", "listener", "EditorView", "updateListener", "of", "update", "startState", "main", "head", "checkbox", "builder", "RangeSetBuilder", "syntaxTree", "iterate", "enter", "node", "name", "add", "Decoration", "replace", "widget", "finish", "StateField", "define", "create", "_", "tr", "provide", "field", "decorations", "styles", "baseTheme", "padding", "tasklist", "hoverTooltip", "tooltipContent", "markdownLinkRegexp", "tooltip", "onHover", "regexp", "hoverTooltip", "view", "pos", "from", "text", "state", "doc", "lineAt", "p", "idx", "match", "substring", "undefined", "indexOf", "length", "url", "end", "above", "create", "el", "document", "createElement", "className", "tooltipContent", "dom", "offset", "x", "y", "get", "defaultTheme", "outline", "overflow", "padding", "fontSize", "color", "get", "tokens", "caretColor", "borderLeft", "fontWeight", "paddingInline", "backgroundColor", "background", "mixBlendMode", "marginBlockStart", "paddingBlockStart", "paddingBlockEnd", "display", "insetBlockStart", "blockSize", "verticalAlign", "margin", "textDecorationLine", "textDecorationThickness", "textUnderlineOffset", "borderRadius", "fontFamily", "join", "border", "Object", "keys", "reduce", "acc", "height", "textTheme", "codeTheme", "EditorState", "EditorView", "useFocusableGroup", "vim", "defaultsDeep", "React", "forwardRef", "useCallback", "useEffect", "useImperativeHandle", "useState", "generateName", "useThemeContext", "getColorForValue", "inputSurface", "mx", "EditorModes", "BaseTextEditor", "forwardRef", "model", "extensions", "slots", "defaultSlots", "editorMode", "forwardedRef", "themeMode", "useThemeContext", "tabsterDOMAttribute", "useFocusableGroup", "tabBehavior", "awareness", "peer", "useEffect", "setLocalStateField", "name", "generateName", "id", "color", "getColorForValue", "value", "type", "colorLight", "root", "setRoot", "useState", "state", "setState", "view", "setView", "useImperativeHandle", "EditorState", "create", "doc", "text", "vim", "EditorView", "baseTheme", "defaultTheme", "theme", "editor", "darkTheme", "of", "extension", "filter", "Boolean", "destroy", "parent", "undefined", "handleKeyUp", "useCallback", "event", "key", "altKey", "shiftKey", "metaKey", "ctrlKey", "contentDOM", "focus", "div", "ref", "tabIndex", "onKeyUp", "TextEditor", "_slots", "props", "defaultsDeep", "defaultTextSlots", "basicBundle", "placeholder", "MarkdownEditor", "markdownBundle", "className", "mx", "inputSurface", "textTheme", "get", "useEffect", "useState", "yCollab", "invariant", "getRawDoc", "isActualAutomergeObject", "Annotation", "Facet", "StateEffect", "StateField", "ViewPlugin", "automerge", "next", "automerge", "ChangeSet", "view", "selection", "target", "patches", "patch", "changeSpec", "handlePatch", "state", "changeSet", "ChangeSet", "of", "doc", "length", "map", "dispatch", "changes", "annotations", "reconcileAnnotationType", "action", "handleInsert", "handleSplice", "handleDel", "handlePut", "index", "charPath", "path", "text", "values", "v", "toString", "join", "from", "to", "insert", "value", "textPath", "candidatePath", "i", "next", "am", "field", "handle", "transactions", "state", "lastHeads", "path", "hasChanges", "tr", "changes", "iterChanges", "undefined", "newHeads", "changeAt", "doc", "fromA", "toA", "_fromB", "_toB", "inserted", "am", "splice", "toString", "PatchSemaphore", "constructor", "field", "_inReconcile", "_queue", "reconcile", "handle", "view", "path", "getPath", "state", "_field", "oldHeads", "getLastHeads", "selection", "transactions", "unreconciledTransactions", "filter", "tx", "isReconcileTx", "toInvert", "slice", "reverse", "inverted", "changes", "invert", "startState", "doc", "map", "dispatch", "annotations", "reconcileAnnotationType", "of", "newHeads", "codeMirrorToAm", "undefined", "automerge", "getHeads", "docSync", "diff", "equals", "amToCodemirror", "effects", "updateHeads", "effectType", "StateEffect", "define", "updateHeads", "newHeads", "of", "getLastHeads", "state", "field", "lastHeads", "getPath", "path", "semaphoreFacet", "Facet", "combine", "values", "at", "automergePlugin", "handle", "stateField", "StateField", "create", "getHeads", "docSync", "unreconciledTransactions", "slice", "update", "value", "tr", "result", "clearUnreconciled", "effect", "effects", "is", "isReconcileTx", "push", "semaphore", "PatchSemaphore", "viewPlugin", "ViewPlugin", "fromClass", "AutomergeCodemirrorViewPlugin", "constructor", "view", "_handleChange", "_view", "facet", "reconcile", "addListener", "transactions", "length", "some", "t", "queueMicrotask", "destroy", "extension", "reconcileAnnotationType", "Annotation", "annotation", "random", "cursorColors", "color", "light", "cursorColor", "uint32", "length", "decoding", "encoding", "Observable", "awarenessProtocol", "log", "messageAwareness", "messageQueryAwareness", "SpaceAwarenessProvider", "constructor", "space", "doc", "channel", "awareness", "_space", "_awareness", "Awareness", "_channel", "_clientId", "clientID", "on", "_handleAwarenessUpdate", "bind", "listen", "_handleSpaceMessage", "window", "addEventListener", "_handleBeforeUnload", "process", "encoderAwarenessQuery", "createEncoder", "writeVarUint", "postMessage", "toUint8Array", "encoderAwarenessState", "writeVarUint8Array", "encodeAwarenessUpdate", "added", "updated", "removed", "origin", "changedClients", "concat", "encoderAwareness", "payload", "data", "Uint8Array", "Array", "from", "Object", "values", "encoder", "_readMessage", "message", "decoder", "createDecoder", "messageType", "readVarUint", "sendReply", "applyAwarenessUpdate", "readVarUint8Array", "getStates", "keys", "console", "error", "removeAwarenessStates", "useTextModel", "identity", "space", "text", "model", "setModel", "useState", "createModel", "useEffect", "options", "isActualAutomergeObject", "createAutomergeModel", "doc", "content", "undefined", "createYjsModel", "invariant", "provider", "SpaceAwarenessProvider", "channel", "id", "guid", "toString", "extension", "yCollab", "awareness", "peer", "identityKey", "toHex", "name", "profile", "displayName", "obj", "getRawDoc", "field", "get", "handle", "docSync", "path", "automergePlugin"]
|
|
7
7
|
}
|