@dxos/react-ui-editor 0.3.9-main.7cfe653 → 0.3.9-main.88fb1d9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/lib/browser/index.mjs +134 -14
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/automerge/automerge-plugin/index.d.ts +1 -1
  5. package/dist/types/src/automerge/automerge-plugin/index.d.ts.map +1 -1
  6. package/dist/types/src/automerge/automerge.stories.d.ts.map +1 -1
  7. package/dist/types/src/components/Editor/Editor.stories.d.ts +3 -2
  8. package/dist/types/src/components/Editor/Editor.stories.d.ts.map +1 -1
  9. package/dist/types/src/components/Markdown/Markdown.d.ts.map +1 -1
  10. package/dist/types/src/components/Markdown/Markdown.stories.d.ts +2 -1
  11. package/dist/types/src/components/Markdown/Markdown.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/RichText/RichText.stories.d.ts +2 -1
  13. package/dist/types/src/components/RichText/RichText.stories.d.ts.map +1 -1
  14. package/dist/types/src/components/TextEditor/TextEditor.d.ts +39 -0
  15. package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -0
  16. package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +18 -0
  17. package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -0
  18. package/dist/types/src/components/TextEditor/index.d.ts +5 -0
  19. package/dist/types/src/components/TextEditor/index.d.ts.map +1 -0
  20. package/dist/types/src/components/TextEditor/theme.d.ts +8 -0
  21. package/dist/types/src/components/TextEditor/theme.d.ts.map +1 -0
  22. package/dist/types/src/components/index.d.ts +1 -0
  23. package/dist/types/src/components/index.d.ts.map +1 -1
  24. package/dist/types/src/testing/replicator.d.ts.map +1 -1
  25. package/package.json +19 -17
  26. package/src/automerge/automerge-plugin/index.ts +1 -1
  27. package/src/automerge/automerge.stories.tsx +1 -2
  28. package/src/components/Editor/Editor.stories.tsx +4 -2
  29. package/src/components/Editor/Editor.tsx +2 -2
  30. package/src/components/Markdown/Markdown.stories.tsx +3 -0
  31. package/src/components/Markdown/Markdown.tsx +12 -8
  32. package/src/components/RichText/RichText.stories.tsx +2 -0
  33. package/src/components/TextEditor/TextEditor.stories.tsx +33 -0
  34. package/src/components/TextEditor/TextEditor.tsx +130 -0
  35. package/src/components/TextEditor/index.ts +9 -0
  36. package/src/components/TextEditor/theme.ts +29 -0
  37. package/src/components/index.ts +1 -0
  38. package/src/testing/replicator.ts +0 -1
@@ -541,7 +541,7 @@ var EditorModes = [
541
541
  "default",
542
542
  "vim"
543
543
  ];
544
- var MarkdownEditor = /* @__PURE__ */ forwardRef(({ model, slots = {}, onChange, editorMode }, forwardedRef) => {
544
+ var MarkdownEditor = /* @__PURE__ */ forwardRef(({ model, slots = {}, editorMode, onChange }, forwardedRef) => {
545
545
  const { id, content, provider, peer } = model ?? {};
546
546
  const { themeMode } = useThemeContext();
547
547
  const tabsterDOMAttribute = useFocusableGroup({
@@ -628,7 +628,7 @@ var MarkdownEditor = /* @__PURE__ */ forwardRef(({ model, slots = {}, onChange,
628
628
  indentWithTab
629
629
  ]),
630
630
  EditorView.lineWrapping,
631
- // Theme
631
+ // Themes.
632
632
  markdown({
633
633
  base: markdownLanguage2,
634
634
  codeLanguages: languages,
@@ -647,7 +647,7 @@ var MarkdownEditor = /* @__PURE__ */ forwardRef(({ model, slots = {}, onChange,
647
647
  ],
648
648
  // TODO(thure): All but one rule here apply to both themes; rename or refactor.
649
649
  syntaxHighlighting(markdownDarkHighlighting),
650
- // Collaboration
650
+ // Replication and awareness (incl. remote selection).
651
651
  ...content instanceof YText ? [
652
652
  yCollab(content, provider?.awareness)
653
653
  ] : []
@@ -671,14 +671,17 @@ var MarkdownEditor = /* @__PURE__ */ forwardRef(({ model, slots = {}, onChange,
671
671
  themeMode,
672
672
  editorMode
673
673
  ]);
674
- const handleKeyUp = useCallback(({ key, altKey, shiftKey, metaKey, ctrlKey }) => {
674
+ const handleKeyUp = useCallback((event) => {
675
+ const { key, altKey, shiftKey, metaKey, ctrlKey } = event;
675
676
  switch (key) {
676
- case "Enter":
677
+ case "Enter": {
677
678
  view?.contentDOM.focus();
678
679
  break;
679
- case "Escape":
680
+ }
681
+ case "Escape": {
680
682
  editorMode === "vim" && (altKey || shiftKey || metaKey || ctrlKey) && parent?.focus();
681
683
  break;
684
+ }
682
685
  }
683
686
  }, [
684
687
  view,
@@ -686,11 +689,11 @@ var MarkdownEditor = /* @__PURE__ */ forwardRef(({ model, slots = {}, onChange,
686
689
  ]);
687
690
  return /* @__PURE__ */ React.createElement("div", {
688
691
  tabIndex: 0,
692
+ ref: setParent,
689
693
  key: id,
690
694
  ...slots.root,
691
- onKeyUp: handleKeyUp,
692
695
  ...editorMode !== "vim" ? tabsterDOMAttribute : {},
693
- ref: setParent
696
+ onKeyUp: handleKeyUp
694
697
  });
695
698
  });
696
699
 
@@ -706,7 +709,7 @@ import StarterKit from "@tiptap/starter-kit";
706
709
  import React2, { forwardRef as forwardRef2, useImperativeHandle as useImperativeHandle2, useMemo as useMemo3 } from "react";
707
710
  import { generateName as generateName2 } from "@dxos/display-name";
708
711
  import { mx as mx2 } from "@dxos/react-ui-theme";
709
- var useEditor = ({ model, placeholder: placeholder2 = "Enter text\u2026", slots = {} }) => {
712
+ var useEditor = ({ model, placeholder: placeholder3 = "Enter text\u2026", slots = {} }) => {
710
713
  const extensions = useMemo3(() => [
711
714
  StarterKit.configure({
712
715
  // Extensions
@@ -811,7 +814,7 @@ var useEditor = ({ model, placeholder: placeholder2 = "Enter text\u2026", slots
811
814
  })
812
815
  ] : [],
813
816
  Placeholder.configure({
814
- placeholder: placeholder2,
817
+ placeholder: placeholder3,
815
818
  emptyEditorClass: "before:content-[attr(data-placeholder)] before:absolute opacity-50 cursor-text"
816
819
  })
817
820
  ], [
@@ -842,8 +845,8 @@ var RichTextEditor = /* @__PURE__ */ forwardRef2((props, ref) => {
842
845
  });
843
846
 
844
847
  // packages/ui/react-ui-editor/src/components/Editor/Editor.tsx
845
- var Editor = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ slots, ...options }, forwardedRef) => {
846
- const model = useTextModel(options);
848
+ var Editor = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ slots, ...params }, forwardedRef) => {
849
+ const model = useTextModel(params);
847
850
  if (model?.content instanceof YXmlFragment) {
848
851
  return /* @__PURE__ */ React3.createElement(RichTextEditor, {
849
852
  ref: forwardedRef,
@@ -859,18 +862,135 @@ var Editor = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ slots, ...optio
859
862
  }
860
863
  }));
861
864
 
865
+ // packages/ui/react-ui-editor/src/components/TextEditor/index.ts
866
+ import { tags as tags2 } from "@lezer/highlight";
867
+
868
+ // packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx
869
+ import { closeBrackets as closeBrackets2 } from "@codemirror/autocomplete";
870
+ import { bracketMatching as bracketMatching2, defaultHighlightStyle as defaultHighlightStyle2, syntaxHighlighting as syntaxHighlighting2 } from "@codemirror/language";
871
+ import { EditorState as EditorState2 } from "@codemirror/state";
872
+ import { oneDarkHighlightStyle as oneDarkHighlightStyle2 } from "@codemirror/theme-one-dark";
873
+ import { EditorView as EditorView2, placeholder as placeholder2 } from "@codemirror/view";
874
+ import React4, { forwardRef as forwardRef4, useEffect as useEffect2, useImperativeHandle as useImperativeHandle3, useState as useState2, useCallback as useCallback2 } from "react";
875
+ import { yCollab as yCollab2 } from "y-codemirror.next";
876
+ import { useThemeContext as useThemeContext2 } from "@dxos/react-ui";
877
+ import { YText as YText2 } from "@dxos/text-model";
878
+
879
+ // packages/ui/react-ui-editor/src/components/TextEditor/theme.ts
880
+ import get2 from "lodash.get";
881
+ import { tailwindConfig as tailwindConfig2 } from "@dxos/react-ui-theme";
882
+ var tokens2 = tailwindConfig2({}).theme;
883
+ var defaultStyles = {
884
+ "&.cm-focused": {
885
+ outline: "none"
886
+ },
887
+ ".cm-placeholder": {
888
+ fontFamily: get2(tokens2, "fontFamily.body", []).join(",")
889
+ },
890
+ "& .cm-scroller": {
891
+ fontFamily: get2(tokens2, "fontFamily.body", []).join(","),
892
+ overflow: "visible"
893
+ }
894
+ };
895
+
896
+ // packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx
897
+ var TextEditor = /* @__PURE__ */ forwardRef4(({ model, extensions = [], theme = defaultStyles, slots = {}, onKeyDown, ...props }, forwardedRef) => {
898
+ const { id, content } = model ?? {};
899
+ const { themeMode } = useThemeContext2();
900
+ const [parent, setParent] = useState2(null);
901
+ const [state, setState] = useState2();
902
+ const [view, setView] = useState2();
903
+ useImperativeHandle3(forwardedRef, () => {
904
+ return {
905
+ editor: parent,
906
+ state,
907
+ view
908
+ };
909
+ }, [
910
+ view
911
+ ]);
912
+ useEffect2(() => {
913
+ if (!parent) {
914
+ return;
915
+ }
916
+ view?.destroy();
917
+ const state2 = EditorState2.create({
918
+ doc: content?.toString(),
919
+ extensions: [
920
+ bracketMatching2(),
921
+ closeBrackets2(),
922
+ placeholder2(slots.editor?.placeholder ?? ""),
923
+ EditorView2.lineWrapping,
924
+ // Themes.
925
+ EditorView2.theme(theme),
926
+ ...themeMode === "dark" ? [
927
+ syntaxHighlighting2(oneDarkHighlightStyle2)
928
+ ] : [
929
+ syntaxHighlighting2(defaultHighlightStyle2)
930
+ ],
931
+ // Replication.
932
+ ...content instanceof YText2 ? [
933
+ yCollab2(content, void 0)
934
+ ] : [],
935
+ // Custom.
936
+ ...extensions
937
+ ]
938
+ });
939
+ setState(state2);
940
+ setView(new EditorView2({
941
+ state: state2,
942
+ parent
943
+ }));
944
+ return () => {
945
+ view?.destroy();
946
+ setView(void 0);
947
+ setState(void 0);
948
+ };
949
+ }, [
950
+ parent,
951
+ content,
952
+ themeMode
953
+ ]);
954
+ const handleKeyDown = useCallback2((event) => {
955
+ if (view) {
956
+ const { head, from, to } = view.state.selection.ranges[0];
957
+ const { number } = view.state.doc.lineAt(head);
958
+ const after = view.state.sliceDoc(from);
959
+ onKeyDown?.(event, {
960
+ from,
961
+ to,
962
+ line: number,
963
+ lines: view.state.doc.lines,
964
+ after
965
+ });
966
+ }
967
+ }, [
968
+ view
969
+ ]);
970
+ return /* @__PURE__ */ React4.createElement("div", {
971
+ key: id,
972
+ ref: setParent,
973
+ ...slots.root,
974
+ onKeyDown: handleKeyDown,
975
+ ...props
976
+ });
977
+ });
978
+
862
979
  // packages/ui/react-ui-editor/src/index.ts
863
980
  import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
864
- import { Doc, YText as YText2, YXmlFragment as YXmlFragment2 } from "@dxos/text-model";
981
+ import { Doc, YText as YText3, YXmlFragment as YXmlFragment2 } from "@dxos/text-model";
865
982
  export {
866
983
  Doc,
867
984
  Editor,
868
985
  EditorModes,
869
986
  MarkdownEditor,
870
987
  RichTextEditor,
988
+ TextEditor,
871
989
  TextKind,
872
- YText2 as YText,
990
+ YText3 as YText,
873
991
  YXmlFragment2 as YXmlFragment,
992
+ defaultStyles,
993
+ tags2 as tags,
874
994
  useTextModel
875
995
  };
876
996
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Editor/Editor.tsx", "../../../src/model.ts", "../../../src/yjs/cursors.ts", "../../../src/yjs/space-provider.ts", "../../../src/components/Markdown/Markdown.tsx", "../../../src/components/Markdown/markdownTags.ts", "../../../src/components/Markdown/markdownTheme.ts", "../../../src/styles/markdown.ts", "../../../src/styles/tokens.ts", "../../../src/components/RichText/RichText.tsx", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef, memo, type Ref } from 'react';\n\nimport { YXmlFragment } from '@dxos/text-model';\n\nimport { type EditorSlots, useTextModel, type UseTextModelOptions } from '../../model';\nimport { MarkdownEditor, type MarkdownEditorRef } from '../Markdown';\nimport { RichTextEditor, type TipTapEditor } from '../RichText';\n\nexport type EditorProps = UseTextModelOptions & {\n slots?: EditorSlots;\n};\n\n/**\n * Memoized editor which depends on DXOS platform.\n *\n * Determines which editor to render based on the kind of text.\n */\n// NOTE: Without `memo`, if parent component uses `observer` the editor re-renders excessively.\n// TODO(wittjosiah): Factor out?\nexport const Editor = memo(\n forwardRef<TipTapEditor | MarkdownEditorRef, EditorProps>(({ slots, ...options }, forwardedRef) => {\n const model = useTextModel(options);\n if (model?.content instanceof YXmlFragment) {\n return <RichTextEditor ref={forwardedRef as Ref<TipTapEditor>} model={model} slots={slots} />;\n } else {\n return <MarkdownEditor ref={forwardedRef as Ref<MarkdownEditorRef>} model={model} slots={slots} />;\n }\n }),\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type EditorView } from '@codemirror/view';\nimport { type ComponentProps, useMemo } from 'react';\nimport type * as awarenessProtocol from 'y-protocols/awareness';\n\nimport { type Space, type TextObject } 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\nexport type EditorSlots = {\n root?: Omit<ComponentProps<'div'>, 'ref'>;\n editor?: {\n className?: string;\n placeholder?: string;\n spellCheck?: boolean;\n tabIndex?: number;\n markdownTheme?: Parameters<typeof EditorView.theme>[0];\n };\n};\n\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;\n provider?: Provider;\n peer?: {\n id: string;\n name?: string;\n };\n};\n\nexport type UseTextModelOptions = {\n identity?: Identity | null;\n space?: Space;\n text?: TextObject;\n};\n\n// TODO(wittjosiah): Factor out to common package? @dxos/react-client?\n// TODO(burdon): Decouple space (make Editor less dependent on entire stack)?\nexport const useTextModel = ({ identity, space, text }: UseTextModelOptions): EditorModel | undefined => {\n const provider = useMemo(() => {\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?.doc]);\n\n if (!text?.doc || !text?.content) {\n return undefined;\n }\n\n return {\n id: text.doc.guid,\n content: text.content,\n provider,\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", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { autocompletion, completionKeymap, closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete';\nimport { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport { markdown, markdownLanguage } 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 { searchKeymap, highlightSelectionMatches } from '@codemirror/search';\nimport { EditorState, StateField, type Text } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport {\n keymap,\n crosshairCursor,\n drawSelection,\n dropCursor,\n highlightActiveLine,\n highlightActiveLineGutter,\n highlightSpecialChars,\n placeholder,\n rectangularSelection,\n EditorView,\n} from '@codemirror/view';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { vim } from '@replit/codemirror-vim';\nimport React, {\n type KeyboardEvent,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n useMemo,\n useCallback,\n} from 'react';\nimport { yCollab } from 'y-codemirror.next';\n\nimport { generateName } from '@dxos/display-name';\nimport { useThemeContext } from '@dxos/react-ui';\nimport { getColorForValue } from '@dxos/react-ui-theme';\nimport { YText } from '@dxos/text-model';\n\nimport { markdownTagsExtension } from './markdownTags';\nimport { markdownDarkHighlighting, markdownTheme } from './markdownTheme';\nimport { type EditorModel, type EditorSlots } from '../../model';\n\nexport const EditorModes = ['default', 'vim'] as const;\nexport type EditorMode = (typeof EditorModes)[number];\n\nexport type MarkdownEditorProps = {\n model?: EditorModel;\n slots?: EditorSlots;\n editorMode?: EditorMode;\n onChange?: (content: string | Text) => void;\n};\n\nexport type MarkdownEditorRef = {\n editor: HTMLDivElement | null;\n state?: EditorState;\n view?: EditorView;\n};\n\nexport const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>(\n ({ model, slots = {}, onChange, editorMode }, forwardedRef) => {\n const { id, content, provider, peer } = model ?? {};\n const { themeMode } = useThemeContext();\n const tabsterDOMAttribute = useFocusableGroup({ tabBehavior: 'limited' });\n\n const [parent, setParent] = useState<HTMLDivElement | null>(null);\n const [state, setState] = useState<EditorState>();\n const [view, setView] = useState<EditorView>();\n\n useImperativeHandle(forwardedRef, () => ({\n editor: parent,\n state,\n view,\n }));\n\n const listenChangesExtension = useMemo(\n () =>\n StateField.define({\n create: () => null,\n update: (_value, transaction) => {\n if (transaction.docChanged && onChange) {\n onChange(transaction.newDoc);\n }\n return null;\n },\n }),\n [onChange],\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 useEffect(() => {\n if (!parent) {\n return;\n }\n\n const state = EditorState.create({\n doc: content?.toString(),\n extensions: [\n // Based on https://github.com/codemirror/dev/issues/44#issuecomment-789093799.\n listenChangesExtension,\n\n ...(editorMode === 'vim' ? [vim()] : []),\n\n // All of https://github.com/codemirror/basic-setup minus line numbers and fold gutter.\n highlightActiveLineGutter(),\n highlightSpecialChars(),\n history(),\n drawSelection(),\n dropCursor(),\n EditorState.allowMultipleSelections.of(true),\n indentOnInput(),\n syntaxHighlighting(defaultHighlightStyle, { fallback: true }),\n bracketMatching(),\n closeBrackets(),\n autocompletion(),\n rectangularSelection(),\n crosshairCursor(),\n highlightActiveLine(),\n highlightSelectionMatches(),\n placeholder(slots.editor?.placeholder ?? ''), // TODO(burdon): Needs consistent styling.\n keymap.of([\n ...closeBracketsKeymap,\n ...defaultKeymap,\n ...searchKeymap,\n ...historyKeymap,\n ...foldKeymap,\n ...completionKeymap,\n ...lintKeymap,\n indentWithTab,\n ]),\n EditorView.lineWrapping,\n // Theme\n markdown({ base: markdownLanguage, codeLanguages: languages, extensions: [markdownTagsExtension] }),\n EditorView.theme({ ...markdownTheme, ...slots.editor?.markdownTheme }),\n ...(themeMode === 'dark'\n ? [syntaxHighlighting(oneDarkHighlightStyle)]\n : [syntaxHighlighting(defaultHighlightStyle)]),\n // TODO(thure): All but one rule here apply to both themes; rename or refactor.\n syntaxHighlighting(markdownDarkHighlighting),\n\n // Collaboration\n ...(content instanceof YText ? [yCollab(content, provider?.awareness)] : []),\n ],\n });\n\n setState(state);\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 }));\n\n return () => {\n view?.destroy();\n setView(undefined);\n setState(undefined);\n };\n }, [parent, content, provider?.awareness, themeMode, editorMode]);\n\n const handleKeyUp = useCallback(\n ({ key, altKey, shiftKey, metaKey, ctrlKey }: KeyboardEvent) => {\n switch (key) {\n case 'Enter':\n view?.contentDOM.focus();\n break;\n\n case 'Escape':\n editorMode === 'vim' && (altKey || shiftKey || metaKey || ctrlKey) && parent?.focus();\n break;\n }\n },\n [view, editorMode],\n );\n\n return (\n <div\n tabIndex={0}\n key={id}\n {...slots.root}\n onKeyUp={handleKeyUp}\n {...(editorMode !== 'vim' ? tabsterDOMAttribute : {})}\n ref={setParent}\n />\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { styleTags, Tag } from '@lezer/highlight';\nimport { type MarkdownConfig } from '@lezer/markdown';\n\nexport const markdownTags = {\n headingMark: Tag.define(),\n quoteMark: Tag.define(),\n listMark: Tag.define(),\n linkMark: Tag.define(),\n emphasisMark: Tag.define(),\n codeMark: Tag.define(),\n codeText: Tag.define(),\n inlineCode: Tag.define(),\n url: Tag.define(),\n linkReference: Tag.define(),\n linkLabel: Tag.define(),\n};\n\nexport const markdownTagsExtension: MarkdownConfig = {\n props: [\n styleTags({\n HeaderMark: markdownTags.headingMark,\n QuoteMark: markdownTags.quoteMark,\n ListMark: markdownTags.listMark,\n LinkMark: markdownTags.linkMark,\n EmphasisMark: markdownTags.emphasisMark,\n CodeMark: markdownTags.codeMark,\n CodeText: markdownTags.codeText,\n InlineCode: markdownTags.inlineCode,\n URL: markdownTags.url,\n LinkReference: markdownTags.linkReference,\n LinkLabel: markdownTags.linkLabel,\n }),\n ],\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { markdownLanguage } from '@codemirror/lang-markdown';\nimport { HighlightStyle } from '@codemirror/language';\nimport { tags } from '@lezer/highlight';\nimport get from 'lodash.get';\n\nimport { markdownTags } from './markdownTags';\nimport { bold, heading, italic, mark, strikethrough, tokens } from '../../styles';\n\n// TODO(burdon): Use theme colors.\n// TODO(burdon): Light mode.\n\nexport const chalky = '#e5c07b';\nexport const coral = '#e06c75';\nexport const cyan = '#56b6c2';\nexport const invalid = '#ffffff';\nexport const ivory = '#abb2bf';\nexport const stone = '#7d8799';\nexport const malibu = '#61afef';\nexport const sage = '#98c379';\nexport const whiskey = '#d19a66';\nexport const violet = '#c678dd';\nconst _darkBackground = '#21252b';\nexport const highlightBackground = '#2c313a';\nconst _background = '#282c34';\nexport const tooltipBackground = '#353a42';\nconst _selection = '#3E4451';\nexport const cursor = '#ffffff';\n\nconst monospace = get(tokens, 'fontFamily.mono', ['monospace']).join(',');\n\nexport const markdownTheme = {\n // TODO(thure): consider whether these commented-out rules from one-dark-theme should be integrated.\n // '&': {\n // color: ivory,\n // backgroundColor: background\n // },\n // '.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },\n // '&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {\n // backgroundColor: selection\n // },\n // '.cm-panels': { backgroundColor: darkBackground, color: ivory },\n // '.cm-panels.cm-panels-top': { borderBottom: '2px solid black' },\n // '.cm-panels.cm-panels-bottom': { borderTop: '2px solid black' },\n // '.cm-searchMatch': {\n // backgroundColor: '#72a1ff59',\n // outline: '1px solid #457dff'\n // },\n // '.cm-searchMatch.cm-searchMatch-selected': {\n // backgroundColor: '#6199ff2f'\n // },\n // '.cm-activeLine': { backgroundColor: '#6699ff0b' },\n // '.cm-selectionMatch': { backgroundColor: '#aafe661a' },\n // '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {\n // backgroundColor: '#bad0f847'\n // },\n // '.cm-gutters': {\n // backgroundColor: background,\n // color: stone,\n // border: 'none'\n // },\n // '.cm-activeLineGutter': {\n // backgroundColor: highlightBackground\n // },\n // '.cm-foldPlaceholder': {\n // backgroundColor: 'transparent',\n // border: 'none',\n // color: '#ddd'\n // },\n\n '.dark & .cm-tooltip': {\n border: 'none',\n backgroundColor: tooltipBackground,\n },\n '.dark & .cm-tooltip .cm-tooltip-arrow:before': {\n borderTopColor: 'transparent',\n borderBottomColor: 'transparent',\n },\n '.dark & .cm-tooltip .cm-tooltip-arrow:after': {\n borderTopColor: tooltipBackground,\n borderBottomColor: tooltipBackground,\n },\n '.dark & .cm-tooltip-autocomplete': {\n '& > ul > li[aria-selected]': {\n backgroundColor: highlightBackground,\n color: ivory,\n },\n },\n '&.cm-focused': {\n outline: 'none',\n },\n '& .cm-line': {\n paddingInline: 0,\n minBlockSize: '1.6em',\n },\n '& .cm-line *': {\n lineHeight: 1.6,\n },\n '&.cm-focused .cm-selectionBackground, & .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 '& .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 '& .cm-content': {\n caretColor: 'black',\n },\n '.dark & .cm-content': {\n caretColor: cursor,\n },\n '& .cm-cursor': {\n borderLeftColor: 'black',\n },\n '.dark & .cm-cursor': {\n borderLeftColor: cursor,\n },\n '.cm-placeholder': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n },\n '& .cm-scroller': {\n fontFamily: get(tokens, 'fontFamily.mono', []).join(','),\n overflow: 'visible',\n },\n '& .cm-activeLine': {\n backgroundColor: 'transparent',\n },\n '.dark & .cm-activeLine': {\n backgroundColor: 'transparent',\n },\n '& .cm-ySelectionInfo': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n padding: '2px 4px',\n marginBlockStart: '-4px',\n },\n '& .cm-ySelection, & .cm-selectionMatch': {\n paddingBlockStart: '.15em',\n paddingBlockEnd: '.15em',\n },\n '& .cm-ySelection, & .cm-yLineSelection': {\n mixBlendMode: 'multiply',\n },\n '.dark & .cm-ySelection, .dark & .cm-yLineSelection': {\n mixBlendMode: 'screen',\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 ...Object.keys(get(tokens, 'extend.fontSize', {})).reduce((acc: Record<string, any>, fontSize) => {\n const height = get(tokens, ['extend', 'fontSize', fontSize, 1, 'lineHeight']);\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 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 markdownDarkHighlighting = 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 tag: [tags.link, tags.url],\n color: 'inherit !important',\n textDecoration: 'none !important',\n },\n {\n tag: [tags.function(tags.variableName), tags.labelName],\n color: malibu,\n fontFamily: monospace,\n },\n {\n tag: [\n markdownTags.codeMark,\n markdownTags.emphasisMark,\n markdownTags.headingMark,\n markdownTags.linkLabel,\n markdownTags.linkReference,\n markdownTags.listMark,\n markdownTags.quoteMark,\n markdownTags.url,\n tags.meta,\n tags.processingInstruction,\n ],\n class: mark,\n },\n { tag: [markdownTags.codeText, markdownTags.inlineCode], class: 'font-mono' },\n { tag: tags.emphasis, class: italic },\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 { tag: tags.strikethrough, class: strikethrough },\n { tag: tags.strong, class: bold },\n ],\n { scope: markdownLanguage, all: { fontFamily: get(tokens, 'fontFamily.body', []).join(',') } },\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\nexport const heading: Record<HeadingLevel, string> = {\n 1: 'mbs-4 mbe-2 text-4xl font-semibold text-inherit no-underline',\n 2: 'mbs-4 mbe-2 text-3xl font-bold text-inherit no-underline',\n 3: 'mbs-4 mbe-2 text-2xl font-bold text-inherit no-underline',\n 4: 'mbs-4 mbe-2 text-xl font-extrabold text-inherit no-underline',\n 5: 'mbs-4 mbe-2 text-lg font-extrabold text-inherit no-underline',\n 6: 'mbs-4 mbe-2 font-black text-inherit no-underline',\n};\n\nexport const blockquote = 'mlb-2 border-is-4 border-neutral-500/50 pis-5';\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\nexport const codeBlock = 'mlb-2 font-mono bg-neutral-500/10 p-3 rounded';\n\nexport const horizontalRule = 'mlb-4 border-neutral-500/50';\n\nexport const paragraph = 'mlb-1';\n\nexport const bold = 'font-bold';\n\nexport const code = 'font-mono bg-neutral-500/10 rounded pli-0.5 plb-0.5 -mlb-0.5';\n\nexport const placeholder = 'font-mono';\n\nexport const codeWithoutMarks = mx(code, 'pli-1.5 mli-0.5');\n\nexport const italic = 'italic';\n\nexport const strikethrough = 'line-through';\n\nexport const mark = '!font-normal !no-underline !text-inherit opacity-40';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { tailwindConfig, type TailwindConfig } from '@dxos/react-ui-theme';\n\n// TODO(thure): Why export the whole theme? Can this be done differently?\nexport const tokens: TailwindConfig['theme'] = tailwindConfig({}).theme;\n", "//\n// Copyright 2022 DXOS.org\n//\nimport { mergeAttributes } from '@tiptap/core';\nimport Collaboration from '@tiptap/extension-collaboration';\nimport CollaborationCursor from '@tiptap/extension-collaboration-cursor';\nimport Heading from '@tiptap/extension-heading';\nimport ListItem from '@tiptap/extension-list-item';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { type Editor, EditorContent, useEditor as useNaturalEditor } from '@tiptap/react';\nimport StarterKit from '@tiptap/starter-kit';\nimport React, { forwardRef, useImperativeHandle, useMemo } from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { type EditorModel, type EditorSlots } from '../../model';\nimport {\n blockquote,\n bold,\n codeBlock,\n heading,\n type HeadingLevel,\n horizontalRule,\n italic,\n listItem,\n orderedList,\n paragraph,\n strikethrough,\n unorderedList,\n codeWithoutMarks,\n} from '../../styles';\nimport { cursorColor } from '../../yjs';\n\nexport type TipTapEditor = Editor;\n\ntype UseEditorOptions = {\n model?: EditorModel;\n placeholder?: string;\n slots?: Pick<EditorSlots, 'editor'>;\n};\n\nconst useEditor = ({ model, placeholder = 'Enter text…', slots = {} }: UseEditorOptions) => {\n const extensions = useMemo(\n () => [\n StarterKit.configure({\n // Extensions\n history: false,\n // Nodes\n blockquote: {\n HTMLAttributes: {\n class: blockquote,\n },\n },\n bulletList: {\n HTMLAttributes: {\n class: unorderedList,\n },\n },\n codeBlock: {\n HTMLAttributes: {\n class: codeBlock,\n },\n },\n heading: false, // (thure): `StarterKit` doesn’t let you configure how headings are rendered, see `Heading` below.\n horizontalRule: {\n HTMLAttributes: {\n class: horizontalRule,\n },\n },\n listItem: false, // (thure): `StarterKit` doesn’t let you configure how list items are rendered, see `ListItem` below.\n orderedList: {\n HTMLAttributes: {\n class: orderedList,\n },\n },\n paragraph: {\n HTMLAttributes: {\n class: paragraph,\n },\n },\n // Marks\n bold: {\n HTMLAttributes: {\n class: bold,\n },\n },\n code: {\n HTMLAttributes: {\n class: codeWithoutMarks,\n },\n },\n italic: {\n HTMLAttributes: {\n class: italic,\n },\n },\n strike: {\n HTMLAttributes: {\n class: strikethrough,\n },\n },\n }),\n Heading.extend({\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level: HeadingLevel = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {\n class: heading[level],\n }),\n 0,\n ];\n },\n }),\n ListItem.extend({\n renderHTML: ({ HTMLAttributes }) => [\n 'li',\n mergeAttributes(HTMLAttributes, {\n marker: '• ',\n class: listItem,\n }),\n ['div', { role: 'none' }, 0],\n ],\n }),\n // https://github.com/ueberdosis/tiptap/tree/main/packages/extension-collaboration\n ...(model && typeof model.content !== 'string' ? [Collaboration.configure({ fragment: model.content })] : []),\n ...(model?.provider\n ? [\n CollaborationCursor.configure({\n provider: model.provider,\n user: model.peer && {\n name: model.peer.name ?? generateName(model.peer.id),\n color: cursorColor.color,\n },\n }),\n ]\n : []),\n Placeholder.configure({\n placeholder,\n emptyEditorClass: 'before:content-[attr(data-placeholder)] before:absolute opacity-50 cursor-text',\n }),\n ],\n [model?.id],\n );\n\n return useNaturalEditor(\n {\n extensions,\n editorProps: {\n attributes: {\n class: mx('focus:outline-none focus-visible:outline-none', slots.editor?.className),\n spellcheck: slots.editor?.spellCheck === false ? 'false' : 'true',\n tabindex: slots.editor?.tabIndex ? String(slots.editor?.tabIndex) : '0',\n },\n },\n },\n [extensions],\n );\n};\n\nexport type RichTextEditorProps = UseEditorOptions & {\n slots?: EditorSlots;\n};\n\n/**\n * @deprecated\n */\n// TODO(burdon): Currently broken.\nexport const RichTextEditor = forwardRef<Editor | null, RichTextEditorProps>((props, ref) => {\n const editor = useEditor(props);\n useImperativeHandle<Editor | null, Editor | null>(ref, () => editor, [editor]);\n\n // Reference:\n // https://tiptap.dev/installation/react\n // https://github.com/ueberdosis/tiptap\n // https://tiptap.dev/guide/output/#option-3-yjs\n return <EditorContent {...props.slots?.root} editor={editor} />;\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport * from './components';\nexport * from './model';\n\nexport { TextKind } from '@dxos/protocols/proto/dxos/echo/model/text';\nexport { Doc, YText, YXmlFragment } from '@dxos/text-model';\n"],
5
- "mappings": ";AAIA,OAAOA,UAASC,cAAAA,aAAYC,YAAsB;AAElD,SAASC,oBAAoB;;;ACD7B,SAA8BC,eAAe;;;ACC7C,YAAYC,YAAY;AAExB,IAAMC,eAAe;EACnB;IAAEC,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;;AAIlC,IAAMC,cAAcH,aAAoBI,cAAM,IAAKJ,aAAaK,MAAM;;;AChB7E,YAAYC,cAAc;AAC1B,YAAYC,cAAc;AAC1B,SAASC,kBAAkB;AAC3B,YAAYC,uBAAuB;AAGnC,SAASC,WAAW;;AAQpB,IAAMC,mBAAmB;AACzB,IAAMC,wBAAwB;AAKvB,IAAMC,yBAAN,cAAqCL,WAAAA;EAM1CM,YAAY,EAAEC,OAAOC,KAAKC,SAASC,UAAS,GAAwE;AAClH,UAAK;AACL,SAAKC,SAASJ;AACd,SAAKK,aAAaF,aAAa,IAAsBG,4BAAUL,GAAAA;AAC/D,SAAKM,WAAWL;AAChB,SAAKM,YAAYP,IAAIQ;AAErB,SAAKJ,WAAWK,GAAG,UAAU,KAAKC,uBAAuBC,KAAK,IAAI,CAAA;AAClE,SAAKR,OAAOS,OAAO,KAAKN,UAAU,KAAKO,oBAAoBF,KAAK,IAAI,CAAA;AAEpE,QAAI,OAAOG,WAAW,aAAa;AACjCA,aAAOC,iBAAiB,gBAAgB,KAAKC,oBAAoBL,KAAK,IAAI,CAA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,gBAAAC,OAAA,cAACC,gBAAAA;MAAeC,KAAKP;MAAmCC;MAAcH;;EAC/E,OAAO;AACL,WAAO,gBAAAO,OAAA,cAACG,gBAAAA;MAAeD,KAAKP;MAAwCC;MAAcH;;EACpF;AACF,CAAA,CAAA;;;AUxBF,SAASW,gBAAgB;AACzB,SAASC,KAAKC,SAAAA,QAAOC,gBAAAA,qBAAoB;",
6
- "names": ["React", "forwardRef", "memo", "YXmlFragment", "useMemo", "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", "doc", "undefined", "SpaceAwarenessProvider", "channel", "id", "content", "guid", "peer", "identityKey", "toHex", "name", "profile", "displayName", "autocompletion", "completionKeymap", "closeBrackets", "closeBracketsKeymap", "defaultKeymap", "history", "historyKeymap", "indentWithTab", "markdown", "markdownLanguage", "bracketMatching", "defaultHighlightStyle", "foldKeymap", "indentOnInput", "syntaxHighlighting", "languages", "lintKeymap", "searchKeymap", "highlightSelectionMatches", "EditorState", "StateField", "oneDarkHighlightStyle", "keymap", "crosshairCursor", "drawSelection", "dropCursor", "highlightActiveLine", "highlightActiveLineGutter", "highlightSpecialChars", "placeholder", "rectangularSelection", "EditorView", "useFocusableGroup", "vim", "React", "forwardRef", "useEffect", "useImperativeHandle", "useState", "useMemo", "useCallback", "yCollab", "generateName", "useThemeContext", "getColorForValue", "YText", "styleTags", "Tag", "markdownTags", "headingMark", "Tag", "define", "quoteMark", "listMark", "linkMark", "emphasisMark", "codeMark", "codeText", "inlineCode", "url", "linkReference", "linkLabel", "markdownTagsExtension", "props", "styleTags", "HeaderMark", "QuoteMark", "ListMark", "LinkMark", "EmphasisMark", "CodeMark", "CodeText", "InlineCode", "URL", "LinkReference", "LinkLabel", "markdownLanguage", "HighlightStyle", "tags", "get", "mx", "heading", "blockquote", "unorderedList", "orderedList", "listItem", "codeBlock", "horizontalRule", "paragraph", "bold", "code", "codeWithoutMarks", "mx", "code", "italic", "strikethrough", "mark", "tailwindConfig", "tokens", "tailwindConfig", "theme", "ivory", "malibu", "highlightBackground", "tooltipBackground", "cursor", "monospace", "get", "tokens", "join", "markdownTheme", "border", "backgroundColor", "tooltipBackground", "borderTopColor", "borderBottomColor", "highlightBackground", "color", "ivory", "outline", "paddingInline", "minBlockSize", "lineHeight", "background", "caretColor", "borderLeftColor", "fontFamily", "overflow", "padding", "marginBlockStart", "paddingBlockStart", "paddingBlockEnd", "mixBlendMode", "display", "insetBlockStart", "blockSize", "verticalAlign", "margin", "Object", "keys", "reduce", "acc", "fontSize", "height", "markdownDarkHighlighting", "HighlightStyle", "define", "tag", "tags", "keyword", "name", "deleted", "character", "propertyName", "macroName", "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", "link", "url", "textDecoration", "function", "labelName", "malibu", "markdownTags", "codeMark", "emphasisMark", "headingMark", "linkLabel", "linkReference", "listMark", "quoteMark", "class", "mark", "codeText", "inlineCode", "emphasis", "italic", "heading1", "heading", "heading2", "heading3", "heading4", "heading5", "heading6", "strikethrough", "strong", "bold", "scope", "markdownLanguage", "all", "EditorModes", "MarkdownEditor", "forwardRef", "model", "slots", "onChange", "editorMode", "forwardedRef", "id", "content", "provider", "peer", "themeMode", "useThemeContext", "tabsterDOMAttribute", "useFocusableGroup", "tabBehavior", "parent", "setParent", "useState", "state", "setState", "view", "setView", "useImperativeHandle", "editor", "listenChangesExtension", "useMemo", "StateField", "define", "create", "update", "_value", "transaction", "docChanged", "newDoc", "useEffect", "awareness", "setLocalStateField", "name", "generateName", "color", "getColorForValue", "value", "type", "colorLight", "EditorState", "doc", "toString", "extensions", "vim", "highlightActiveLineGutter", "highlightSpecialChars", "history", "drawSelection", "dropCursor", "allowMultipleSelections", "of", "indentOnInput", "syntaxHighlighting", "defaultHighlightStyle", "fallback", "bracketMatching", "closeBrackets", "autocompletion", "rectangularSelection", "crosshairCursor", "highlightActiveLine", "highlightSelectionMatches", "placeholder", "keymap", "closeBracketsKeymap", "defaultKeymap", "searchKeymap", "historyKeymap", "foldKeymap", "completionKeymap", "lintKeymap", "indentWithTab", "EditorView", "lineWrapping", "markdown", "base", "markdownLanguage", "codeLanguages", "languages", "markdownTagsExtension", "theme", "markdownTheme", "oneDarkHighlightStyle", "markdownDarkHighlighting", "YText", "yCollab", "destroy", "undefined", "handleKeyUp", "useCallback", "key", "altKey", "shiftKey", "metaKey", "ctrlKey", "contentDOM", "focus", "div", "tabIndex", "root", "onKeyUp", "ref", "mergeAttributes", "Collaboration", "CollaborationCursor", "Heading", "ListItem", "Placeholder", "EditorContent", "useEditor", "useNaturalEditor", "StarterKit", "React", "forwardRef", "useImperativeHandle", "useMemo", "generateName", "mx", "useEditor", "model", "placeholder", "slots", "extensions", "useMemo", "StarterKit", "configure", "history", "blockquote", "HTMLAttributes", "class", "bulletList", "unorderedList", "codeBlock", "heading", "horizontalRule", "listItem", "orderedList", "paragraph", "bold", "code", "codeWithoutMarks", "italic", "strike", "strikethrough", "Heading", "extend", "renderHTML", "node", "hasLevel", "options", "levels", "includes", "attrs", "level", "mergeAttributes", "ListItem", "marker", "role", "content", "Collaboration", "fragment", "provider", "CollaborationCursor", "user", "peer", "name", "generateName", "id", "color", "cursorColor", "Placeholder", "emptyEditorClass", "useNaturalEditor", "editorProps", "attributes", "mx", "editor", "className", "spellcheck", "spellCheck", "tabindex", "tabIndex", "String", "RichTextEditor", "forwardRef", "props", "ref", "useImperativeHandle", "React", "EditorContent", "root", "Editor", "memo", "forwardRef", "slots", "options", "forwardedRef", "model", "useTextModel", "content", "YXmlFragment", "React", "RichTextEditor", "ref", "MarkdownEditor", "TextKind", "Doc", "YText", "YXmlFragment"]
3
+ "sources": ["../../../src/components/Editor/Editor.tsx", "../../../src/model.ts", "../../../src/yjs/cursors.ts", "../../../src/yjs/space-provider.ts", "../../../src/components/Markdown/Markdown.tsx", "../../../src/components/Markdown/markdownTags.ts", "../../../src/components/Markdown/markdownTheme.ts", "../../../src/styles/markdown.ts", "../../../src/styles/tokens.ts", "../../../src/components/RichText/RichText.tsx", "../../../src/components/TextEditor/index.ts", "../../../src/components/TextEditor/TextEditor.tsx", "../../../src/components/TextEditor/theme.ts", "../../../src/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef, memo, type Ref } from 'react';\n\nimport { YXmlFragment } from '@dxos/text-model';\n\nimport { type EditorSlots, useTextModel, type UseTextModelOptions } from '../../model';\nimport { MarkdownEditor, type MarkdownEditorRef } from '../Markdown';\nimport { RichTextEditor, type TipTapEditor } from '../RichText';\n\nexport type EditorProps = UseTextModelOptions & {\n slots?: EditorSlots;\n};\n\n/**\n * Memoized editor which depends on DXOS platform.\n *\n * Determines which editor to render based on the kind of text.\n */\n// NOTE: Without `memo`, if parent component uses `observer` the editor re-renders excessively.\n// TODO(wittjosiah): Factor out?\nexport const Editor = memo(\n forwardRef<TipTapEditor | MarkdownEditorRef, EditorProps>(({ slots, ...params }, forwardedRef) => {\n const model = useTextModel(params);\n if (model?.content instanceof YXmlFragment) {\n return <RichTextEditor ref={forwardedRef as Ref<TipTapEditor>} model={model} slots={slots} />;\n } else {\n return <MarkdownEditor ref={forwardedRef as Ref<MarkdownEditorRef>} model={model} slots={slots} />;\n }\n }),\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type EditorView } from '@codemirror/view';\nimport { type ComponentProps, useMemo } from 'react';\nimport type * as awarenessProtocol from 'y-protocols/awareness';\n\nimport { type Space, type TextObject } 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\nexport type EditorSlots = {\n root?: Omit<ComponentProps<'div'>, 'ref'>;\n editor?: {\n className?: string;\n placeholder?: string;\n spellCheck?: boolean;\n tabIndex?: number;\n markdownTheme?: Parameters<typeof EditorView.theme>[0];\n };\n};\n\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;\n provider?: Provider;\n peer?: {\n id: string;\n name?: string;\n };\n};\n\nexport type UseTextModelOptions = {\n identity?: Identity | null;\n space?: Space;\n text?: TextObject;\n};\n\n// TODO(wittjosiah): Factor out to common package? @dxos/react-client?\n// TODO(burdon): Decouple space (make Editor less dependent on entire stack)?\nexport const useTextModel = ({ identity, space, text }: UseTextModelOptions): EditorModel | undefined => {\n const provider = useMemo(() => {\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?.doc]);\n\n if (!text?.doc || !text?.content) {\n return undefined;\n }\n\n return {\n id: text.doc.guid,\n content: text.content,\n provider,\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", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { autocompletion, completionKeymap, closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete';\nimport { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport { markdown, markdownLanguage } 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 { searchKeymap, highlightSelectionMatches } from '@codemirror/search';\nimport { EditorState, StateField, type Text } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport {\n keymap,\n crosshairCursor,\n drawSelection,\n dropCursor,\n highlightActiveLine,\n highlightActiveLineGutter,\n highlightSpecialChars,\n placeholder,\n rectangularSelection,\n EditorView,\n} from '@codemirror/view';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { vim } from '@replit/codemirror-vim';\nimport React, {\n type KeyboardEvent,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n useMemo,\n useCallback,\n} from 'react';\nimport { yCollab } from 'y-codemirror.next';\n\nimport { generateName } from '@dxos/display-name';\nimport { useThemeContext } from '@dxos/react-ui';\nimport { getColorForValue } from '@dxos/react-ui-theme';\nimport { YText } from '@dxos/text-model';\n\nimport { markdownTagsExtension } from './markdownTags';\nimport { markdownDarkHighlighting, markdownTheme } from './markdownTheme';\nimport { type EditorModel, type EditorSlots } from '../../model';\n\nexport const EditorModes = ['default', 'vim'] as const;\nexport type EditorMode = (typeof EditorModes)[number];\n\nexport type MarkdownEditorProps = {\n model?: EditorModel;\n slots?: EditorSlots;\n editorMode?: EditorMode;\n onChange?: (content: string | Text) => void;\n};\n\nexport type MarkdownEditorRef = {\n editor: HTMLDivElement | null;\n state?: EditorState;\n view?: EditorView;\n};\n\nexport const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>(\n ({ model, slots = {}, editorMode, onChange }, forwardedRef) => {\n const { id, content, provider, peer } = model ?? {};\n const { themeMode } = useThemeContext();\n const tabsterDOMAttribute = useFocusableGroup({ tabBehavior: 'limited' });\n\n const [parent, setParent] = useState<HTMLDivElement | null>(null);\n const [state, setState] = useState<EditorState>();\n const [view, setView] = useState<EditorView>();\n\n useImperativeHandle(forwardedRef, () => ({\n editor: parent,\n state,\n view,\n }));\n\n const listenChangesExtension = useMemo(\n () =>\n StateField.define({\n create: () => null,\n update: (_value, transaction) => {\n if (transaction.docChanged && onChange) {\n onChange(transaction.newDoc);\n }\n return null;\n },\n }),\n [onChange],\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 useEffect(() => {\n if (!parent) {\n return;\n }\n\n const state = EditorState.create({\n doc: content?.toString(),\n extensions: [\n // Based on https://github.com/codemirror/dev/issues/44#issuecomment-789093799.\n listenChangesExtension,\n\n ...(editorMode === 'vim' ? [vim()] : []),\n\n // All of https://github.com/codemirror/basic-setup minus line numbers and fold gutter.\n highlightActiveLineGutter(),\n highlightSpecialChars(),\n history(),\n drawSelection(),\n dropCursor(),\n EditorState.allowMultipleSelections.of(true),\n indentOnInput(),\n syntaxHighlighting(defaultHighlightStyle, { fallback: true }),\n bracketMatching(),\n closeBrackets(),\n autocompletion(),\n rectangularSelection(),\n crosshairCursor(),\n highlightActiveLine(),\n highlightSelectionMatches(),\n placeholder(slots.editor?.placeholder ?? ''), // TODO(burdon): Needs consistent styling.\n keymap.of([\n ...closeBracketsKeymap,\n ...defaultKeymap,\n ...searchKeymap,\n ...historyKeymap,\n ...foldKeymap,\n ...completionKeymap,\n ...lintKeymap,\n indentWithTab,\n ]),\n EditorView.lineWrapping,\n\n // Themes.\n markdown({ base: markdownLanguage, codeLanguages: languages, extensions: [markdownTagsExtension] }),\n EditorView.theme({ ...markdownTheme, ...slots.editor?.markdownTheme }),\n ...(themeMode === 'dark'\n ? [syntaxHighlighting(oneDarkHighlightStyle)]\n : [syntaxHighlighting(defaultHighlightStyle)]),\n // TODO(thure): All but one rule here apply to both themes; rename or refactor.\n syntaxHighlighting(markdownDarkHighlighting),\n\n // Replication and awareness (incl. remote selection).\n ...(content instanceof YText ? [yCollab(content, provider?.awareness)] : []),\n ],\n });\n\n setState(state);\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 }));\n\n return () => {\n view?.destroy();\n setView(undefined);\n setState(undefined);\n };\n }, [parent, content, provider?.awareness, 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) && parent?.focus();\n break;\n }\n }\n },\n [view, editorMode],\n );\n\n return (\n <div\n tabIndex={0}\n ref={setParent}\n key={id}\n {...slots.root}\n {...(editorMode !== 'vim' ? tabsterDOMAttribute : {})}\n onKeyUp={handleKeyUp}\n />\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { styleTags, Tag } from '@lezer/highlight';\nimport { type MarkdownConfig } from '@lezer/markdown';\n\nexport const markdownTags = {\n headingMark: Tag.define(),\n quoteMark: Tag.define(),\n listMark: Tag.define(),\n linkMark: Tag.define(),\n emphasisMark: Tag.define(),\n codeMark: Tag.define(),\n codeText: Tag.define(),\n inlineCode: Tag.define(),\n url: Tag.define(),\n linkReference: Tag.define(),\n linkLabel: Tag.define(),\n};\n\nexport const markdownTagsExtension: MarkdownConfig = {\n props: [\n styleTags({\n HeaderMark: markdownTags.headingMark,\n QuoteMark: markdownTags.quoteMark,\n ListMark: markdownTags.listMark,\n LinkMark: markdownTags.linkMark,\n EmphasisMark: markdownTags.emphasisMark,\n CodeMark: markdownTags.codeMark,\n CodeText: markdownTags.codeText,\n InlineCode: markdownTags.inlineCode,\n URL: markdownTags.url,\n LinkReference: markdownTags.linkReference,\n LinkLabel: markdownTags.linkLabel,\n }),\n ],\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { markdownLanguage } from '@codemirror/lang-markdown';\nimport { HighlightStyle } from '@codemirror/language';\nimport { tags } from '@lezer/highlight';\nimport get from 'lodash.get';\n\nimport { markdownTags } from './markdownTags';\nimport { bold, heading, italic, mark, strikethrough, tokens } from '../../styles';\n\n// TODO(burdon): Use theme colors.\n// TODO(burdon): Light mode.\n\nexport const chalky = '#e5c07b';\nexport const coral = '#e06c75';\nexport const cyan = '#56b6c2';\nexport const invalid = '#ffffff';\nexport const ivory = '#abb2bf';\nexport const stone = '#7d8799';\nexport const malibu = '#61afef';\nexport const sage = '#98c379';\nexport const whiskey = '#d19a66';\nexport const violet = '#c678dd';\nconst _darkBackground = '#21252b';\nexport const highlightBackground = '#2c313a';\nconst _background = '#282c34';\nexport const tooltipBackground = '#353a42';\nconst _selection = '#3E4451';\nexport const cursor = '#ffffff';\n\nconst monospace = get(tokens, 'fontFamily.mono', ['monospace']).join(',');\n\nexport const markdownTheme = {\n // TODO(thure): consider whether these commented-out rules from one-dark-theme should be integrated.\n // '&': {\n // color: ivory,\n // backgroundColor: background\n // },\n // '.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },\n // '&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {\n // backgroundColor: selection\n // },\n // '.cm-panels': { backgroundColor: darkBackground, color: ivory },\n // '.cm-panels.cm-panels-top': { borderBottom: '2px solid black' },\n // '.cm-panels.cm-panels-bottom': { borderTop: '2px solid black' },\n // '.cm-searchMatch': {\n // backgroundColor: '#72a1ff59',\n // outline: '1px solid #457dff'\n // },\n // '.cm-searchMatch.cm-searchMatch-selected': {\n // backgroundColor: '#6199ff2f'\n // },\n // '.cm-activeLine': { backgroundColor: '#6699ff0b' },\n // '.cm-selectionMatch': { backgroundColor: '#aafe661a' },\n // '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {\n // backgroundColor: '#bad0f847'\n // },\n // '.cm-gutters': {\n // backgroundColor: background,\n // color: stone,\n // border: 'none'\n // },\n // '.cm-activeLineGutter': {\n // backgroundColor: highlightBackground\n // },\n // '.cm-foldPlaceholder': {\n // backgroundColor: 'transparent',\n // border: 'none',\n // color: '#ddd'\n // },\n\n '.dark & .cm-tooltip': {\n border: 'none',\n backgroundColor: tooltipBackground,\n },\n '.dark & .cm-tooltip .cm-tooltip-arrow:before': {\n borderTopColor: 'transparent',\n borderBottomColor: 'transparent',\n },\n '.dark & .cm-tooltip .cm-tooltip-arrow:after': {\n borderTopColor: tooltipBackground,\n borderBottomColor: tooltipBackground,\n },\n '.dark & .cm-tooltip-autocomplete': {\n '& > ul > li[aria-selected]': {\n backgroundColor: highlightBackground,\n color: ivory,\n },\n },\n '&.cm-focused': {\n outline: 'none',\n },\n '& .cm-line': {\n paddingInline: 0,\n minBlockSize: '1.6em',\n },\n '& .cm-line *': {\n lineHeight: 1.6,\n },\n '&.cm-focused .cm-selectionBackground, & .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 '& .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 '& .cm-content': {\n caretColor: 'black',\n },\n '.dark & .cm-content': {\n caretColor: cursor,\n },\n '& .cm-cursor': {\n borderLeftColor: 'black',\n },\n '.dark & .cm-cursor': {\n borderLeftColor: cursor,\n },\n '.cm-placeholder': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n },\n '& .cm-scroller': {\n fontFamily: get(tokens, 'fontFamily.mono', []).join(','),\n overflow: 'visible',\n },\n '& .cm-activeLine': {\n backgroundColor: 'transparent',\n },\n '.dark & .cm-activeLine': {\n backgroundColor: 'transparent',\n },\n '& .cm-ySelectionInfo': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n padding: '2px 4px',\n marginBlockStart: '-4px',\n },\n '& .cm-ySelection, & .cm-selectionMatch': {\n paddingBlockStart: '.15em',\n paddingBlockEnd: '.15em',\n },\n '& .cm-ySelection, & .cm-yLineSelection': {\n mixBlendMode: 'multiply',\n },\n '.dark & .cm-ySelection, .dark & .cm-yLineSelection': {\n mixBlendMode: 'screen',\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 ...Object.keys(get(tokens, 'extend.fontSize', {})).reduce((acc: Record<string, any>, fontSize) => {\n const height = get(tokens, ['extend', 'fontSize', fontSize, 1, 'lineHeight']);\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 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 markdownDarkHighlighting = 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 tag: [tags.link, tags.url],\n color: 'inherit !important',\n textDecoration: 'none !important',\n },\n {\n tag: [tags.function(tags.variableName), tags.labelName],\n color: malibu,\n fontFamily: monospace,\n },\n {\n tag: [\n markdownTags.codeMark,\n markdownTags.emphasisMark,\n markdownTags.headingMark,\n markdownTags.linkLabel,\n markdownTags.linkReference,\n markdownTags.listMark,\n markdownTags.quoteMark,\n markdownTags.url,\n tags.meta,\n tags.processingInstruction,\n ],\n class: mark,\n },\n { tag: [markdownTags.codeText, markdownTags.inlineCode], class: 'font-mono' },\n { tag: tags.emphasis, class: italic },\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 { tag: tags.strikethrough, class: strikethrough },\n { tag: tags.strong, class: bold },\n ],\n { scope: markdownLanguage, all: { fontFamily: get(tokens, 'fontFamily.body', []).join(',') } },\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\nexport const heading: Record<HeadingLevel, string> = {\n 1: 'mbs-4 mbe-2 text-4xl font-semibold text-inherit no-underline',\n 2: 'mbs-4 mbe-2 text-3xl font-bold text-inherit no-underline',\n 3: 'mbs-4 mbe-2 text-2xl font-bold text-inherit no-underline',\n 4: 'mbs-4 mbe-2 text-xl font-extrabold text-inherit no-underline',\n 5: 'mbs-4 mbe-2 text-lg font-extrabold text-inherit no-underline',\n 6: 'mbs-4 mbe-2 font-black text-inherit no-underline',\n};\n\nexport const blockquote = 'mlb-2 border-is-4 border-neutral-500/50 pis-5';\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\nexport const codeBlock = 'mlb-2 font-mono bg-neutral-500/10 p-3 rounded';\n\nexport const horizontalRule = 'mlb-4 border-neutral-500/50';\n\nexport const paragraph = 'mlb-1';\n\nexport const bold = 'font-bold';\n\nexport const code = 'font-mono bg-neutral-500/10 rounded pli-0.5 plb-0.5 -mlb-0.5';\n\nexport const placeholder = 'font-mono';\n\nexport const codeWithoutMarks = mx(code, 'pli-1.5 mli-0.5');\n\nexport const italic = 'italic';\n\nexport const strikethrough = 'line-through';\n\nexport const mark = '!font-normal !no-underline !text-inherit opacity-40';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { tailwindConfig, type TailwindConfig } from '@dxos/react-ui-theme';\n\n// TODO(thure): Why export the whole theme? Can this be done differently?\nexport const tokens: TailwindConfig['theme'] = tailwindConfig({}).theme;\n", "//\n// Copyright 2022 DXOS.org\n//\nimport { mergeAttributes } from '@tiptap/core';\nimport Collaboration from '@tiptap/extension-collaboration';\nimport CollaborationCursor from '@tiptap/extension-collaboration-cursor';\nimport Heading from '@tiptap/extension-heading';\nimport ListItem from '@tiptap/extension-list-item';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { type Editor, EditorContent, useEditor as useNaturalEditor } from '@tiptap/react';\nimport StarterKit from '@tiptap/starter-kit';\nimport React, { forwardRef, useImperativeHandle, useMemo } from 'react';\n\nimport { generateName } from '@dxos/display-name';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { type EditorModel, type EditorSlots } from '../../model';\nimport {\n blockquote,\n bold,\n codeBlock,\n heading,\n type HeadingLevel,\n horizontalRule,\n italic,\n listItem,\n orderedList,\n paragraph,\n strikethrough,\n unorderedList,\n codeWithoutMarks,\n} from '../../styles';\nimport { cursorColor } from '../../yjs';\n\nexport type TipTapEditor = Editor;\n\ntype UseEditorOptions = {\n model?: EditorModel;\n placeholder?: string;\n slots?: Pick<EditorSlots, 'editor'>;\n};\n\nconst useEditor = ({ model, placeholder = 'Enter text…', slots = {} }: UseEditorOptions) => {\n const extensions = useMemo(\n () => [\n StarterKit.configure({\n // Extensions\n history: false,\n // Nodes\n blockquote: {\n HTMLAttributes: {\n class: blockquote,\n },\n },\n bulletList: {\n HTMLAttributes: {\n class: unorderedList,\n },\n },\n codeBlock: {\n HTMLAttributes: {\n class: codeBlock,\n },\n },\n heading: false, // (thure): `StarterKit` doesn’t let you configure how headings are rendered, see `Heading` below.\n horizontalRule: {\n HTMLAttributes: {\n class: horizontalRule,\n },\n },\n listItem: false, // (thure): `StarterKit` doesn’t let you configure how list items are rendered, see `ListItem` below.\n orderedList: {\n HTMLAttributes: {\n class: orderedList,\n },\n },\n paragraph: {\n HTMLAttributes: {\n class: paragraph,\n },\n },\n // Marks\n bold: {\n HTMLAttributes: {\n class: bold,\n },\n },\n code: {\n HTMLAttributes: {\n class: codeWithoutMarks,\n },\n },\n italic: {\n HTMLAttributes: {\n class: italic,\n },\n },\n strike: {\n HTMLAttributes: {\n class: strikethrough,\n },\n },\n }),\n Heading.extend({\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level: HeadingLevel = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {\n class: heading[level],\n }),\n 0,\n ];\n },\n }),\n ListItem.extend({\n renderHTML: ({ HTMLAttributes }) => [\n 'li',\n mergeAttributes(HTMLAttributes, {\n marker: '• ',\n class: listItem,\n }),\n ['div', { role: 'none' }, 0],\n ],\n }),\n // https://github.com/ueberdosis/tiptap/tree/main/packages/extension-collaboration\n ...(model && typeof model.content !== 'string' ? [Collaboration.configure({ fragment: model.content })] : []),\n ...(model?.provider\n ? [\n CollaborationCursor.configure({\n provider: model.provider,\n user: model.peer && {\n name: model.peer.name ?? generateName(model.peer.id),\n color: cursorColor.color,\n },\n }),\n ]\n : []),\n Placeholder.configure({\n placeholder,\n emptyEditorClass: 'before:content-[attr(data-placeholder)] before:absolute opacity-50 cursor-text',\n }),\n ],\n [model?.id],\n );\n\n return useNaturalEditor(\n {\n extensions,\n editorProps: {\n attributes: {\n class: mx('focus:outline-none focus-visible:outline-none', slots.editor?.className),\n spellcheck: slots.editor?.spellCheck === false ? 'false' : 'true',\n tabindex: slots.editor?.tabIndex ? String(slots.editor?.tabIndex) : '0',\n },\n },\n },\n [extensions],\n );\n};\n\nexport type RichTextEditorProps = UseEditorOptions & {\n slots?: EditorSlots;\n};\n\n/**\n * @deprecated\n */\n// TODO(burdon): Currently broken.\nexport const RichTextEditor = forwardRef<Editor | null, RichTextEditorProps>((props, ref) => {\n const editor = useEditor(props);\n useImperativeHandle<Editor | null, Editor | null>(ref, () => editor, [editor]);\n\n // Reference:\n // https://tiptap.dev/installation/react\n // https://github.com/ueberdosis/tiptap\n // https://tiptap.dev/guide/output/#option-3-yjs\n return <EditorContent {...props.slots?.root} editor={editor} />;\n});\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport { type StyleSpec } from 'style-mod';\nexport { tags } from '@lezer/highlight';\n\nexport * from './TextEditor';\nexport * from './theme';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { closeBrackets } from '@codemirror/autocomplete';\nimport { bracketMatching, defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { EditorState, type Extension } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport { EditorView, placeholder } from '@codemirror/view';\nimport React, {\n type KeyboardEvent,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n useCallback,\n type HTMLAttributes,\n} from 'react';\nimport { type StyleSpec } from 'style-mod';\nimport { yCollab } from 'y-codemirror.next';\n\nimport { useThemeContext } from '@dxos/react-ui';\nimport { YText } from '@dxos/text-model';\n\nimport { defaultStyles } from './theme';\nimport { type EditorModel, type EditorSlots } from '../../model';\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 editor: HTMLDivElement | null;\n state?: EditorState;\n view?: EditorView;\n};\n\nexport type TextEditorProps = {\n model?: EditorModel;\n extensions?: Extension[];\n theme?: {\n [selector: string]: StyleSpec;\n };\n slots?: EditorSlots;\n onKeyDown?: (event: KeyboardEvent, info: CursorInfo) => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'onBlur' | 'onFocus'>;\n\n/**\n * Simple text editor.\n */\nexport const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(\n ({ model, extensions = [], theme = defaultStyles, slots = {}, onKeyDown, ...props }, forwardedRef) => {\n const { id, content } = model ?? {};\n const { themeMode } = useThemeContext();\n\n const [parent, setParent] = useState<HTMLDivElement | null>(null);\n const [state, setState] = useState<EditorState>();\n const [view, setView] = useState<EditorView>();\n\n // TODO(burdon): The ref may be instantiated before the view is created.\n useImperativeHandle(\n forwardedRef,\n () => {\n return {\n editor: parent,\n state,\n view,\n };\n },\n [view],\n );\n\n useEffect(() => {\n if (!parent) {\n return;\n }\n\n view?.destroy();\n\n const state = EditorState.create({\n doc: content?.toString(),\n extensions: [\n bracketMatching(),\n closeBrackets(),\n placeholder(slots.editor?.placeholder ?? ''),\n EditorView.lineWrapping,\n\n // Themes.\n EditorView.theme(theme),\n ...(themeMode === 'dark'\n ? [syntaxHighlighting(oneDarkHighlightStyle)]\n : [syntaxHighlighting(defaultHighlightStyle)]),\n\n // Replication.\n ...(content instanceof YText ? [yCollab(content, undefined)] : []),\n\n // Custom.\n ...extensions,\n ],\n });\n\n setState(state);\n setView(new EditorView({ state, parent }));\n\n return () => {\n view?.destroy();\n setView(undefined);\n setState(undefined);\n };\n }, [parent, content, themeMode]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (view) {\n const { head, from, to } = view.state.selection.ranges[0];\n const { number } = view.state.doc.lineAt(head);\n const after = view.state.sliceDoc(from);\n onKeyDown?.(event, { from, to, line: number, lines: view.state.doc.lines, after });\n }\n },\n [view],\n );\n\n return <div key={id} ref={setParent} {...slots.root} onKeyDown={handleKeyDown} {...props} />;\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport get from 'lodash.get';\nimport { type StyleSpec } from 'style-mod';\n\nimport { tailwindConfig, type TailwindConfig } from '@dxos/react-ui-theme';\n\nconst tokens: TailwindConfig['theme'] = tailwindConfig({}).theme;\n\n/**\n * https://codemirror.net/examples/styling\n */\n// TODO(burdon): If given a \"theme\" suffix, `__docgen` properties are added to the object.\nexport const defaultStyles: {\n [selector: string]: StyleSpec;\n} = {\n '&.cm-focused': {\n outline: 'none',\n },\n '.cm-placeholder': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n },\n '& .cm-scroller': {\n fontFamily: get(tokens, 'fontFamily.body', []).join(','),\n overflow: 'visible',\n },\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport * from './components';\nexport * from './model';\n\nexport { TextKind } from '@dxos/protocols/proto/dxos/echo/model/text';\nexport { Doc, YText, YXmlFragment } from '@dxos/text-model';\n"],
5
+ "mappings": ";AAIA,OAAOA,UAASC,cAAAA,aAAYC,YAAsB;AAElD,SAASC,oBAAoB;;;ACD7B,SAA8BC,eAAe;;;ACC7C,YAAYC,YAAY;AAExB,IAAMC,eAAe;EACnB;IAAEC,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,OAAO;EAAY;EACvC;IAAED,OAAO;IAAWC,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dzB,YAAY;QACV0B,iBAAAA;QACAC,eAAAA;QACAC,aAAYzB,MAAMgB,QAAQS,eAAe,EAAA;QACzCC,YAAWC;;QAGXD,YAAW5B,MAAMA,KAAAA;WACbQ,cAAc,SACd;UAACsB,oBAAmBC,sBAAAA;YACpB;UAACD,oBAAmBE,sBAAAA;;;WAGpBzB,mBAAmB0B,SAAQ;UAACC,SAAQ3B,SAAS4B,MAAAA;YAAc,CAAA;;WAG5DpC;;IAEP,CAAA;AAEAe,aAASD,MAAAA;AACTG,YAAQ,IAAIY,YAAW;MAAEf,OAAAA;MAAOH;IAAO,CAAA,CAAA;AAEvC,WAAO,MAAA;AACLK,YAAMK,QAAAA;AACNJ,cAAQmB,MAAAA;AACRrB,eAASqB,MAAAA;IACX;EACF,GAAG;IAACzB;IAAQH;IAASC;GAAU;AAE/B,QAAM4B,gBAAgBC,aACpB,CAACC,UAAAA;AACC,QAAIvB,MAAM;AACR,YAAM,EAAEwB,MAAMC,MAAMC,GAAE,IAAK1B,KAAKF,MAAM6B,UAAUC,OAAO,CAAA;AACvD,YAAM,EAAEC,OAAM,IAAK7B,KAAKF,MAAMU,IAAIsB,OAAON,IAAAA;AACzC,YAAMO,QAAQ/B,KAAKF,MAAMkC,SAASP,IAAAA;AAClCrC,kBAAYmC,OAAO;QAAEE;QAAMC;QAAIO,MAAMJ;QAAQK,OAAOlC,KAAKF,MAAMU,IAAI0B;QAAOH;MAAM,CAAA;IAClF;EACF,GACA;IAAC/B;GAAK;AAGR,SAAO,gBAAAmC,OAAA,cAACC,OAAAA;IAAIC,KAAK9C;IAAI+C,KAAK1C;IAAY,GAAGT,MAAMoD;IAAMnD,WAAWiC;IAAgB,GAAGhC;;AACrF,CAAA;;;AEzHF,SAASmD,gBAAgB;AACzB,SAASC,KAAKC,SAAAA,QAAOC,gBAAAA,qBAAoB;",
6
+ "names": ["React", "forwardRef", "memo", "YXmlFragment", "useMemo", "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", "doc", "undefined", "SpaceAwarenessProvider", "channel", "id", "content", "guid", "peer", "identityKey", "toHex", "name", "profile", "displayName", "autocompletion", "completionKeymap", "closeBrackets", "closeBracketsKeymap", "defaultKeymap", "history", "historyKeymap", "indentWithTab", "markdown", "markdownLanguage", "bracketMatching", "defaultHighlightStyle", "foldKeymap", "indentOnInput", "syntaxHighlighting", "languages", "lintKeymap", "searchKeymap", "highlightSelectionMatches", "EditorState", "StateField", "oneDarkHighlightStyle", "keymap", "crosshairCursor", "drawSelection", "dropCursor", "highlightActiveLine", "highlightActiveLineGutter", "highlightSpecialChars", "placeholder", "rectangularSelection", "EditorView", "useFocusableGroup", "vim", "React", "forwardRef", "useEffect", "useImperativeHandle", "useState", "useMemo", "useCallback", "yCollab", "generateName", "useThemeContext", "getColorForValue", "YText", "styleTags", "Tag", "markdownTags", "headingMark", "Tag", "define", "quoteMark", "listMark", "linkMark", "emphasisMark", "codeMark", "codeText", "inlineCode", "url", "linkReference", "linkLabel", "markdownTagsExtension", "props", "styleTags", "HeaderMark", "QuoteMark", "ListMark", "LinkMark", "EmphasisMark", "CodeMark", "CodeText", "InlineCode", "URL", "LinkReference", "LinkLabel", "markdownLanguage", "HighlightStyle", "tags", "get", "mx", "heading", "blockquote", "unorderedList", "orderedList", "listItem", "codeBlock", "horizontalRule", "paragraph", "bold", "code", "codeWithoutMarks", "mx", "code", "italic", "strikethrough", "mark", "tailwindConfig", "tokens", "tailwindConfig", "theme", "ivory", "malibu", "highlightBackground", "tooltipBackground", "cursor", "monospace", "get", "tokens", "join", "markdownTheme", "border", "backgroundColor", "tooltipBackground", "borderTopColor", "borderBottomColor", "highlightBackground", "color", "ivory", "outline", "paddingInline", "minBlockSize", "lineHeight", "background", "caretColor", "borderLeftColor", "fontFamily", "overflow", "padding", "marginBlockStart", "paddingBlockStart", "paddingBlockEnd", "mixBlendMode", "display", "insetBlockStart", "blockSize", "verticalAlign", "margin", "Object", "keys", "reduce", "acc", "fontSize", "height", "markdownDarkHighlighting", "HighlightStyle", "define", "tag", "tags", "keyword", "name", "deleted", "character", "propertyName", "macroName", "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", "link", "url", "textDecoration", "function", "labelName", "malibu", "markdownTags", "codeMark", "emphasisMark", "headingMark", "linkLabel", "linkReference", "listMark", "quoteMark", "class", "mark", "codeText", "inlineCode", "emphasis", "italic", "heading1", "heading", "heading2", "heading3", "heading4", "heading5", "heading6", "strikethrough", "strong", "bold", "scope", "markdownLanguage", "all", "EditorModes", "MarkdownEditor", "forwardRef", "model", "slots", "editorMode", "onChange", "forwardedRef", "id", "content", "provider", "peer", "themeMode", "useThemeContext", "tabsterDOMAttribute", "useFocusableGroup", "tabBehavior", "parent", "setParent", "useState", "state", "setState", "view", "setView", "useImperativeHandle", "editor", "listenChangesExtension", "useMemo", "StateField", "define", "create", "update", "_value", "transaction", "docChanged", "newDoc", "useEffect", "awareness", "setLocalStateField", "name", "generateName", "color", "getColorForValue", "value", "type", "colorLight", "EditorState", "doc", "toString", "extensions", "vim", "highlightActiveLineGutter", "highlightSpecialChars", "history", "drawSelection", "dropCursor", "allowMultipleSelections", "of", "indentOnInput", "syntaxHighlighting", "defaultHighlightStyle", "fallback", "bracketMatching", "closeBrackets", "autocompletion", "rectangularSelection", "crosshairCursor", "highlightActiveLine", "highlightSelectionMatches", "placeholder", "keymap", "closeBracketsKeymap", "defaultKeymap", "searchKeymap", "historyKeymap", "foldKeymap", "completionKeymap", "lintKeymap", "indentWithTab", "EditorView", "lineWrapping", "markdown", "base", "markdownLanguage", "codeLanguages", "languages", "markdownTagsExtension", "theme", "markdownTheme", "oneDarkHighlightStyle", "markdownDarkHighlighting", "YText", "yCollab", "destroy", "undefined", "handleKeyUp", "useCallback", "event", "key", "altKey", "shiftKey", "metaKey", "ctrlKey", "contentDOM", "focus", "div", "tabIndex", "ref", "root", "onKeyUp", "mergeAttributes", "Collaboration", "CollaborationCursor", "Heading", "ListItem", "Placeholder", "EditorContent", "useEditor", "useNaturalEditor", "StarterKit", "React", "forwardRef", "useImperativeHandle", "useMemo", "generateName", "mx", "useEditor", "model", "placeholder", "slots", "extensions", "useMemo", "StarterKit", "configure", "history", "blockquote", "HTMLAttributes", "class", "bulletList", "unorderedList", "codeBlock", "heading", "horizontalRule", "listItem", "orderedList", "paragraph", "bold", "code", "codeWithoutMarks", "italic", "strike", "strikethrough", "Heading", "extend", "renderHTML", "node", "hasLevel", "options", "levels", "includes", "attrs", "level", "mergeAttributes", "ListItem", "marker", "role", "content", "Collaboration", "fragment", "provider", "CollaborationCursor", "user", "peer", "name", "generateName", "id", "color", "cursorColor", "Placeholder", "emptyEditorClass", "useNaturalEditor", "editorProps", "attributes", "mx", "editor", "className", "spellcheck", "spellCheck", "tabindex", "tabIndex", "String", "RichTextEditor", "forwardRef", "props", "ref", "useImperativeHandle", "React", "EditorContent", "root", "Editor", "memo", "forwardRef", "slots", "params", "forwardedRef", "model", "useTextModel", "content", "YXmlFragment", "React", "RichTextEditor", "ref", "MarkdownEditor", "tags", "closeBrackets", "bracketMatching", "defaultHighlightStyle", "syntaxHighlighting", "EditorState", "oneDarkHighlightStyle", "EditorView", "placeholder", "React", "forwardRef", "useEffect", "useImperativeHandle", "useState", "useCallback", "yCollab", "useThemeContext", "YText", "get", "tailwindConfig", "tokens", "tailwindConfig", "theme", "defaultStyles", "outline", "fontFamily", "get", "join", "overflow", "TextEditor", "forwardRef", "model", "extensions", "theme", "defaultStyles", "slots", "onKeyDown", "props", "forwardedRef", "id", "content", "themeMode", "useThemeContext", "parent", "setParent", "useState", "state", "setState", "view", "setView", "useImperativeHandle", "editor", "useEffect", "destroy", "EditorState", "create", "doc", "toString", "bracketMatching", "closeBrackets", "placeholder", "EditorView", "lineWrapping", "syntaxHighlighting", "oneDarkHighlightStyle", "defaultHighlightStyle", "YText", "yCollab", "undefined", "handleKeyDown", "useCallback", "event", "head", "from", "to", "selection", "ranges", "number", "lineAt", "after", "sliceDoc", "line", "lines", "React", "div", "key", "ref", "root", "TextKind", "Doc", "YText", "YXmlFragment"]
7
7
  }