@mieweb/ui 0.11.0-dev.47 → 0.11.0-dev.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +46 -15
- package/README.md +3 -1
- package/agent/skills/mieweb-ui-tailwind4/SKILL.md +3 -1
- package/dist/{EncounterMdyEditor-XA7HLLVD.cjs → EncounterMdyEditor-KW52MD2Q.cjs} +6 -6
- package/dist/{EncounterMdyEditor-XA7HLLVD.cjs.map → EncounterMdyEditor-KW52MD2Q.cjs.map} +1 -1
- package/dist/{EncounterMdyEditor-ATNWXQ72.js → EncounterMdyEditor-OYO3H5GJ.js} +3 -3
- package/dist/{EncounterMdyEditor-ATNWXQ72.js.map → EncounterMdyEditor-OYO3H5GJ.js.map} +1 -1
- package/dist/{chunk-F6ZTKNAL.cjs → chunk-3XR7BPKD.cjs} +4 -4
- package/dist/{chunk-F6ZTKNAL.cjs.map → chunk-3XR7BPKD.cjs.map} +1 -1
- package/dist/{chunk-ULKDK6W6.js → chunk-3XVDSLDT.js} +4 -4
- package/dist/chunk-3XVDSLDT.js.map +1 -0
- package/dist/{chunk-WI35L5TR.js → chunk-DHCSY2JY.js} +3 -3
- package/dist/{chunk-WI35L5TR.js.map → chunk-DHCSY2JY.js.map} +1 -1
- package/dist/{chunk-IYXZ25E6.js → chunk-ETAYMSCW.js} +4 -4
- package/dist/{chunk-IYXZ25E6.js.map → chunk-ETAYMSCW.js.map} +1 -1
- package/dist/{chunk-LE3HZ7MM.cjs → chunk-LVUSCBG4.cjs} +11 -11
- package/dist/{chunk-LE3HZ7MM.cjs.map → chunk-LVUSCBG4.cjs.map} +1 -1
- package/dist/{chunk-BUM72SAI.cjs → chunk-LWAXTZGG.cjs} +7 -7
- package/dist/{chunk-BUM72SAI.cjs.map → chunk-LWAXTZGG.cjs.map} +1 -1
- package/dist/{chunk-QJ75ZMCG.js → chunk-R4DQRXZY.js} +3 -3
- package/dist/{chunk-QJ75ZMCG.js.map → chunk-R4DQRXZY.js.map} +1 -1
- package/dist/{chunk-5O54NWAL.cjs → chunk-TA5K5546.cjs} +4 -4
- package/dist/chunk-TA5K5546.cjs.map +1 -0
- package/dist/{chunk-2D6TFO2Y.js → chunk-XJ37SWVD.js} +3 -3
- package/dist/{chunk-2D6TFO2Y.js.map → chunk-XJ37SWVD.js.map} +1 -1
- package/dist/{chunk-6I2G26AX.cjs → chunk-YKL66TCM.cjs} +4 -4
- package/dist/{chunk-6I2G26AX.cjs.map → chunk-YKL66TCM.cjs.map} +1 -1
- package/dist/collabKit-652AGQW6.js +99 -0
- package/dist/collabKit-652AGQW6.js.map +1 -0
- package/dist/collabKit-DVSTUBN4.cjs +102 -0
- package/dist/collabKit-DVSTUBN4.cjs.map +1 -0
- package/dist/components/EmailEditor/index.cjs +13 -13
- package/dist/components/EmailEditor/index.js +4 -4
- package/dist/components/Textarea/index.cjs +6 -6
- package/dist/components/Textarea/index.js +3 -3
- package/dist/esheet.cjs +18 -18
- package/dist/esheet.js +5 -5
- package/dist/index.cjs +53 -53
- package/dist/index.js +7 -7
- package/dist/kerebron.cjs +5 -5
- package/dist/kerebron.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-5O54NWAL.cjs.map +0 -1
- package/dist/chunk-ULKDK6W6.js.map +0 -1
- package/dist/collabKit-GCRHP25F.cjs +0 -76
- package/dist/collabKit-GCRHP25F.cjs.map +0 -1
- package/dist/collabKit-SJPDPXU4.js +0 -52
- package/dist/collabKit-SJPDPXU4.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RichEditor/mdyTransaction.ts","../src/components/RichEditor/editorKits.ts","../src/components/RichEditor/RichEditor.tsx"],"names":["RichEditor","doc"],"mappings":";;;;;;;;;;AACO,IAAM,mBAAA,GAAsB;ACqGnC,IAAM,gBAAA,GAAmB,CAAC,cAAA,EAAgB,OAAO,CAAA;AAoBjD,SAAS,sBAAsB,UAAA,EAA6B;AAC1D,EAAA,K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AAW,IAAA,GAAO,MAAA;AAAA,YAC3B,aAAA,EAAe,WAAW,MAAA,GAAS;AAAA;AACrC;AAAA,OACF,EACF,CAAA;AAAA,MAEC,WAAA,oBACC,GAAA,CAAC,KAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,QAAG,QAAA,EAAA,iBAAA,EAAe,CAAA;AAAA,wBACnB,GAAA,CAAC,SAAK,QAAA,EAAA,EAAA,EAAG;AAAA,OAAA,EACX,CAAA,EACF;AAAA,KAAA,EAEJ,CAAA;AAAA,EAEJ;AACF;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"chunk-ULKDK6W6.js","sourcesContent":["/** Shared metadata for host-created MDY projection updates. */\nexport const MDY_PROJECTION_META = 'mdyProjectionRefresh';\n","/**\n * Editor kit assembly for {@link RichEditor}, for both plain and collaborative\n * (Yjs) mode.\n *\n * Both modes start from {@link AdvancedEditorKit} and drop the extensions that\n * are unsafe for our usage — see {@link unsafeExtensions} — then collaborative\n * mode adds the Yjs pieces on top.\n *\n * The Yjs pieces live in `collabKit.ts` behind a dynamic `import()`, so\n * `@kerebron/extension-yjs`, `yjs` and `y-protocols` remain truly optional\n * peers — plain-mode consumers never load them.\n */\nimport type { EditorKit } from '@kerebron/editor';\nimport type { NodeSpec } from 'prosemirror-model';\nimport { AdvancedEditorKit } from '@kerebron/editor-kits/AdvancedEditorKit';\nimport {\n ExtensionMediaUpload,\n type MediaUploadOptions,\n} from '@kerebron/extension-basic-editor/ExtensionMediaUpload';\nimport {\n ExtensionCustomMenu,\n type MenuElement,\n} from '@kerebron/extension-menu';\n\nexport type { MediaUploadOptions };\nexport type { MenuElement };\n\n/**\n * Reshape the toolbar menu before it renders: receives the stock menu's\n * item groups and returns the groups to render. Append custom\n * {@link MenuElement}s (e.g. a Macros toggle) or drop stock groups.\n */\nexport type ModifyMenu = (menus: MenuElement[][]) => MenuElement[][];\n\nexport interface CollabConfig {\n /** Room id — one shared document per room (e.g. a post id). */\n room: string;\n /**\n * WebSocket base URL for the Yjs relay. Defaults to\n * `<ws|wss>://<location.host>/yjs`. The room id is appended by the provider.\n */\n wsUrl?: string;\n /** Extra query params for the socket (e.g. `{ token }` for auth). */\n params?: Record<string, string>;\n /**\n * Who this editor is, published on awareness (`kerebron:user`) so peers see\n * a named, coloured cursor. Without it remote cursors do not render — the\n * position plugin skips awareness states that carry no user — and the\n * `id` is what the cursor colour is derived from (kerebron's `User` shape).\n */\n user?: { id: string; name: string; color?: string };\n /**\n * Custom WebSocket implementation handed to the Yjs provider — e.g. a\n * loopback socket for demos/tests, or a polyfill outside the browser.\n * Defaults to `globalThis.WebSocket`.\n */\n WebSocketPolyfill?: typeof globalThis.WebSocket;\n /**\n * Called when collaborative editing could not be started at all — the Yjs\n * kit failed to load (see {@link createEditorKits}). The editor mounts\n * anyway, as a local one; this is how the host finds out that edits are no\n * longer shared, so it can say so, or tear its own editor down if unshared\n * editing would be unsafe.\n *\n * Not for connection trouble: a room that is reachable but currently\n * disconnected still has the Yjs kit loaded, and the provider retries on its\n * own. This fires once, before the editor is created.\n */\n onUnavailable?: (error: unknown) => void;\n}\n\n/** What {@link createEditorKits} resolves to. */\nexport interface EditorKits {\n kits: EditorKit[];\n /**\n * Whether the returned kits can actually collaborate. False when `config`\n * asked for a room but the Yjs kit could not be loaded, so callers know not\n * to join one.\n */\n collaborative: boolean;\n}\n\n/**\n * Extensions dropped from {@link AdvancedEditorKit}, and why.\n *\n * `autocomplete` and `hover` debounce their DOM handlers (200ms) and then call\n * `dispatchMeta`, which reads `this.editor.state` with no guard that the editor\n * is still alive. Any teardown or document swap inside that debounce window\n * lands the deferred call on a dead view and throws\n * `null.matchesNode()` inside ProseMirror's `EditorView.updateStateInner`,\n * leaving the view permanently broken. Two ways to hit it:\n * - remount (e.g. a `key` change) while the pointer is over the editor, which\n * fires the debounced `onMouseLeave` after the view is destroyed;\n * - a Yjs remote update replacing the document tree under a pending callback.\n * The first applies to *every* editor, so both extensions come out in both\n * modes. No functional cost — autocomplete popups and node-hover tooltips are\n * compositor conveniences, not required for editing.\n *\n * `history` is collab-only: ExtensionYjs supplies its own CRDT-aware undo/redo\n * and the editor throws `Extension conflict: yjs vs history` if both are\n * present. Plain mode keeps it, so undo/redo still works there.\n */\nconst unsafeExtensions = ['autocomplete', 'hover'] as const;\n\n/**\n * Fix the `shortcode_inline` node's DOM round-trip (mieweb/ui#695).\n *\n * The stock node chips `{{merge_tokens}}` into atomic spans but its `toDOM`\n * drops the braces, so serializing a document back to HTML/text silently\n * corrupts every merge token. Patch the spec on the kit's own instance:\n * serialize the braces, strip them again on parse — the `content` attr stays\n * brace-less, which the input rule and the markdown serializer both rely on.\n *\n * Done here, in the kit we ship, so npm consumers on stock\n * `@kerebron/extension-basic-editor` get the fix too — `@kerebron/*` is\n * externalized (`tsup.config.ts`), so a workspace-level package patch would\n * never reach them. Drop once fixed upstream.\n *\n * The node is nested: `AdvancedEditorKit` → `ExtensionBasicEditor`, whose\n * `requires` carries the `BasicEditorKit` extension *instances* (names and\n * instances mix in `requires`), hence the recursive walk.\n */\nfunction fixShortcodeRoundTrip(extensions: unknown[]): void {\n for (const item of extensions) {\n if (!item || typeof item !== 'object') continue; // name-only requires\n const extension = item as {\n name?: unknown;\n requires?: unknown;\n getNodeSpec?: () => NodeSpec;\n };\n if (\n extension.name === 'shortcode_inline' &&\n typeof extension.getNodeSpec === 'function'\n ) {\n const stockSpec = extension.getNodeSpec.bind(extension);\n extension.getNodeSpec = (): NodeSpec => ({\n ...stockSpec(),\n parseDOM: [\n {\n tag: 'span.kb-shortcode-inline',\n getAttrs: (dom) => {\n const text = dom.textContent ?? '';\n const match = /^\\{\\{([^}]+)\\}\\}$/.exec(text);\n return { content: match ? match[1] : text || null };\n },\n },\n ],\n toDOM: (node) => [\n 'span',\n { class: 'kb-shortcode-inline' },\n node.attrs.content ? `{{${String(node.attrs.content)}}}` : '',\n ],\n });\n return;\n }\n if (Array.isArray(extension.requires)) {\n fixShortcodeRoundTrip(extension.requires);\n }\n }\n}\n\n/**\n * Remove extensions by name, wherever they sit: extensions nest (e.g.\n * `ExtensionBasicEditor.requires` carries the BasicEditorKit node instances),\n * so the walk descends `requires` arrays and filters each level in place.\n * Name-only (string) requires entries are left alone — they declare ordering,\n * not instances.\n */\nfunction dropNamedExtensions(\n extensions: unknown[],\n names: readonly string[]\n): unknown[] {\n const kept = extensions.filter(\n (item) =>\n !(\n item &&\n typeof item === 'object' &&\n 'name' in item &&\n names.includes((item as { name: string }).name)\n )\n );\n for (const item of kept) {\n if (!item || typeof item !== 'object') continue;\n const extension = item as { requires?: unknown };\n if (Array.isArray(extension.requires)) {\n extension.requires = dropNamedExtensions(extension.requires, names);\n }\n }\n return kept;\n}\n\n/**\n * {@link AdvancedEditorKit} minus {@link unsafeExtensions} (and, for collab\n * mode, minus `history`), with `mediaUpload` reconfigured when the host asks.\n *\n * `AdvancedEditorKit` constructs `ExtensionMediaUpload` with no options, and an\n * extension's options are fixed at construction — so the only way to configure\n * it is to drop that instance and append one of our own. `modifyMenu` works\n * the same way: the stock `ExtensionCustomMenu` is constructed with no config,\n * so customizing the toolbar means replacing it with a configured instance.\n */\nclass SafeAdvancedEditorKit implements EditorKit {\n name = 'advanced-editor';\n constructor(\n private readonly forCollab: boolean,\n private readonly mediaUpload?: MediaUploadOptions,\n private readonly modifyMenu?: ModifyMenu,\n private readonly omitExtensions?: readonly string[]\n ) {}\n\n getExtensions() {\n const dropped: string[] = [...unsafeExtensions];\n if (this.forCollab) dropped.push('history');\n if (this.mediaUpload) dropped.push('mediaUpload');\n if (this.modifyMenu) dropped.push('customMenu');\n\n let extensions = new AdvancedEditorKit()\n .getExtensions()\n .filter(\n (extension) =>\n !('name' in extension && dropped.includes(extension.name))\n );\n\n if (this.omitExtensions?.length) {\n extensions = dropNamedExtensions(\n extensions,\n this.omitExtensions\n ) as typeof extensions;\n }\n if (this.modifyMenu) {\n extensions.push(new ExtensionCustomMenu({ modifyMenu: this.modifyMenu }));\n }\n if (this.mediaUpload) {\n extensions.push(new ExtensionMediaUpload(this.mediaUpload));\n }\n fixShortcodeRoundTrip(extensions);\n return extensions;\n }\n}\n\n/** MarkYChange + ExtensionYjs live in `collabKit.ts` (lazy-loaded). */\n\n/**\n * Build the editor kits for a session. Pass `config` to join a collaborative\n * room; omit it for a plain local editor. Pass `mediaUpload` to configure how\n * pasted/dropped files are handled — most importantly `uploadHandler`, without\n * which every image is embedded in the document as a base64 `data:` URL.\n * Pass `omitExtensions` to remove schema extensions by name — the toolbar is\n * schema-driven, so dropping a node removes its menu items, input rules and\n * paste handling in one move (e.g. the email surface drops `task_list`).\n *\n * Async because collaborative mode lazy-loads the Yjs kit (and its optional\n * peer deps) on first use; plain mode resolves immediately.\n *\n * That lazy load is allowed to fail. `@kerebron/extension-yjs`, `yjs` and\n * `y-protocols` are optional peers, so the chunk can be absent (peers never\n * installed), stale (a dev server's dependency hash moved under a running\n * page) or simply unreachable (a partial deploy, an offline client). None of\n * that is a reason to leave the caller without an editor: collaboration is an\n * enhancement, editing is the feature. So a failed load degrades to the local\n * kit and reports itself through {@link CollabConfig.onUnavailable} rather\n * than rejecting.\n */\nexport async function createEditorKits(\n config?: CollabConfig,\n mediaUpload?: MediaUploadOptions,\n modifyMenu?: ModifyMenu,\n omitExtensions?: readonly string[]\n): Promise<EditorKits> {\n if (!config) {\n return {\n kits: [\n new SafeAdvancedEditorKit(\n false,\n mediaUpload,\n modifyMenu,\n omitExtensions\n ),\n ],\n collaborative: false,\n };\n }\n\n try {\n const { HuddleYjsKit, defaultWsUrl } = await import('./collabKit');\n const url = config.wsUrl ?? defaultWsUrl();\n return {\n kits: [\n new SafeAdvancedEditorKit(\n true,\n mediaUpload,\n modifyMenu,\n omitExtensions\n ),\n new HuddleYjsKit(\n url,\n config.params ?? {},\n config.WebSocketPolyfill,\n config.user\n ),\n ],\n collaborative: true,\n };\n } catch (error) {\n console.warn(\n '[RichEditor] Collaborative editing unavailable — the Yjs kit failed to load. Continuing as a local editor.',\n error\n );\n config.onUnavailable?.(error);\n // Degrading to a local editor must not also drop `mediaUpload`: without it\n // the stock extension comes back and pasted files are embedded as base64.\n return {\n kits: [\n new SafeAdvancedEditorKit(\n false,\n mediaUpload,\n modifyMenu,\n omitExtensions\n ),\n ],\n collaborative: false,\n };\n }\n}\n","'use client';\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useReducer,\n useRef,\n useState,\n} from 'react';\n\nimport { CoreEditor, type AssetLoad, type EditorKit } from '@kerebron/editor';\nimport { createAssetLoad } from '@kerebron/wasm/web';\n\nimport { useIsDarkMode } from '../../hooks/useIsDarkMode';\nimport { MDY_PROJECTION_META } from './mdyTransaction';\nimport {\n createEditorKits,\n type CollabConfig,\n type MediaUploadOptions,\n type ModifyMenu,\n} from './editorKits';\n\nexport type {\n CollabConfig,\n MediaUploadOptions,\n MenuElement,\n ModifyMenu,\n} from './editorKits';\n\nconst MARKDOWN_TYPE = 'text/x-markdown';\n\n/**\n * The markdown converter's tree-sitter WASM init is not concurrency-safe, so\n * every editor's *first* load queues behind the previous one. Later loads (a\n * `value` change) are free — by then the grammars are warm.\n */\nlet initialLoadQueue: Promise<unknown> = Promise.resolve();\n\nfunction queueInitialLoad(load: () => Promise<void>): Promise<void> {\n const queued = initialLoadQueue.catch(() => undefined).then(load);\n initialLoadQueue = queued.catch(() => undefined);\n return queued;\n}\n\nexport interface RichEditorProps {\n /** Markdown to load. Changing it reloads the editor unless `collab` is set. */\n value?: string;\n /** Called with the editor's markdown content whenever it changes. */\n onChange?: (value: string) => void;\n /** Called when editor setup or a Markdown load fails. getContent also rejects. */\n onError?: (error: unknown) => void;\n /** Called after the initial Markdown load completes. */\n onReady?: (editor: CoreEditor) => void;\n /** Whether to render the live markdown output preview. Defaults to `false`. */\n showPreview?: boolean;\n /**\n * Enable live collaborative editing (Yjs) for the given room. When set, the\n * editor connects to the `/yjs` websocket relay and every peer in the same\n * `room` co-edits one shared document. Uncontrolled like `value` — remount via\n * `key` to switch rooms.\n *\n * Best-effort: if the Yjs kit cannot be loaded the editor still mounts, as a\n * local one, and `collab.onUnavailable` is called. Pass that callback if\n * unshared editing is something your users need to be told about.\n */\n collab?: CollabConfig;\n /** Read-only surface: no typing, and the content dims. */\n disabled?: boolean;\n /**\n * Lock edits while keeping the surface focusable and selectable, without\n * the dimmed `disabled` styling. Applied from creation, so the document\n * cannot be edited even while the initial load is still in flight.\n */\n readOnly?: boolean;\n /**\n * Id for the editor host element — an `aria-labelledby`/`aria-describedby`\n * anchor. The host is a `div`, not a labelable control, so a\n * `<label htmlFor>` will not associate; name the editor with `aria-label`\n * or `aria-labelledby` instead.\n */\n id?: string;\n /** Extra classes on the editor surface, beside `kb-component`. */\n className?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /**\n * Where the tree-sitter WASM grammars load from. Defaults to\n * `createAssetLoad('/kerebron-wasm')`; supply your own when the host serves\n * `@kerebron/wasm`'s `assets/` somewhere else.\n */\n assetLoad?: AssetLoad;\n /**\n * How files pasted or dropped into the editor are handled.\n *\n * **Set `uploadHandler` if your documents are persisted anywhere.** Without\n * it, a pasted image is embedded in the document as a base64 `data:` URL and\n * a video as a blob object URL: a 4 MB screenshot becomes ~5.8 MB of\n * markdown, which most APIs will refuse, and an object URL is dead as soon as\n * the page reloads. `uploadHandler` receives the file and returns the URL to\n * reference it by, so the document carries a link instead of the bytes.\n *\n * ```tsx\n * <RichEditor\n * mediaUpload={{ uploadHandler: (file) => uploadToMyMediaStore(file) }}\n * />\n * ```\n *\n * Read once, when the editor mounts — like {@link collab}, remount via `key`\n * to change it.\n */\n mediaUpload?: MediaUploadOptions;\n /** Additional editor kits, installed once when the editor mounts. */\n editorKits?: EditorKit[];\n /**\n * Reshape the stock toolbar before it renders: receives the menu's item\n * groups and returns the groups to render — append custom controls (a\n * macros toggle, dictation) or drop stock ones. Read once, when the editor\n * mounts — like {@link collab}, remount via `key` to change it.\n */\n modifyMenu?: ModifyMenu;\n /**\n * Schema extensions to remove by name (e.g. `['task_list', 'task_item']`).\n * The toolbar, input rules and paste handling are all schema-driven, so\n * dropping a node here removes the whole feature in one move. Read once,\n * when the editor mounts — like {@link collab}, remount via `key` to\n * change it.\n */\n omitExtensions?: readonly string[];\n /**\n * MIME type of the `value`/`onChange` contract (`'text/x-markdown'` by\n * default; pass `'text/html'` for an HTML-valued surface). Governs both\n * how `value` is parsed and what `onChange`/`getContent()` emit.\n */\n valueType?: string;\n /**\n * Converge the document to `value` on every render, not only when the\n * prop changes — native controlled-input semantics: when a host's\n * `onChange` does not echo an edit back into `value`, the edit reverts.\n * A rejected edit leaves the prop identity unchanged while the document\n * moved on, which a change-gated reload can never see. Off by default,\n * which tolerates read-once hosts that call `getContent()` on submit.\n */\n strictValue?: boolean;\n}\n\nexport interface RichEditorHandle {\n /**\n * The editor's markdown, awaiting the initial load. `onChange` can lag the\n * last keystroke, so read this on submit rather than trusting mirrored state.\n */\n getContent: () => Promise<string>;\n /** Focus the editor, restoring the caret where the writer left it. */\n focus: () => void;\n}\n\n/**\n * Markdown editor over Kerebron's `CoreEditor`.\n *\n * The editor mounts into a **disposable child div**: `CoreEditor.destroy()`\n * replaces its host element with a clone, which would strand React's ref (and,\n * under StrictMode's double-mount, leave the live editor detached behind a\n * dead clone).\n */\nconst RichEditor = forwardRef<RichEditorHandle, RichEditorProps>(\n function RichEditor(\n {\n value = '',\n onChange,\n onError,\n onReady,\n showPreview = false,\n collab,\n disabled = false,\n readOnly = false,\n id,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n assetLoad,\n mediaUpload,\n editorKits: additionalEditorKits,\n modifyMenu,\n omitExtensions,\n valueType = MARKDOWN_TYPE,\n strictValue = false,\n },\n ref\n ) {\n const isDark = useIsDarkMode();\n const hostRef = useRef<HTMLDivElement>(null);\n const editorInstance = useRef<CoreEditor | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n const onReadyRef = useRef(onReady);\n onReadyRef.current = onReady;\n // Mirrors what the editor last held, so an echo of our own `onChange`\n // doesn't reload the document out from under the caret.\n const valueRef = useRef(value);\n const readyRef = useRef<Promise<void> | null>(null);\n const loadingRef = useRef(false);\n const loadVersionRef = useRef(0);\n // Return the exact source until a writer changes the loaded document.\n // Running the Markdown converter alone can normalize whitespace or links.\n const loadedDocRef = useRef<unknown>(null);\n const disabledRef = useRef(disabled);\n const readOnlyRef = useRef(readOnly);\n\n const [md, setMd] = useState<string>('');\n // A strict surface reconciles in an after-render effect, but publishing\n // an edit only mutates refs — a host whose `onChange` ignores the edit\n // (rejection) triggers no render, so the stale document would stay\n // visible. Each publication schedules one render; an accepted update\n // from the host batches into the same pass, so the effect compares the\n // freshest prop either way.\n const [, scheduleStrictReconcile] = useReducer(\n (tick: number) => tick + 1,\n 0\n );\n const strictValueRef = useRef(strictValue);\n strictValueRef.current = strictValue;\n // Serializing the document is the expensive part of a transaction, so the\n // last doc that was serialized is kept to recognise the transactions that\n // did not change it. ProseMirror documents are immutable, so identity is an\n // exact test.\n const lastSerializedDoc = useRef<unknown>(null);\n // Read inside effects created once on mount.\n const showPreviewRef = useRef(showPreview);\n showPreviewRef.current = showPreview;\n const valueTypeRef = useRef(valueType);\n valueTypeRef.current = valueType;\n\n // The contenteditable surface has no implicit ARIA role, so labeling\n // attributes are only permitted alongside an explicit textbox role — and\n // `aria-readonly` is only valid on such a role, not on the host div.\n const surfaceAttributes = useCallback(\n () =>\n ariaLabel || ariaLabelledBy\n ? {\n role: 'textbox',\n 'aria-multiline': 'true',\n ...(ariaLabel ? { 'aria-label': ariaLabel } : {}),\n ...(ariaLabelledBy ? { 'aria-labelledby': ariaLabelledBy } : {}),\n ...(readOnlyRef.current ? { 'aria-readonly': 'true' } : {}),\n }\n : null,\n [ariaLabel, ariaLabelledBy]\n );\n\n // Applies the read state everywhere it matters: the view's `editable`\n // prop, the surface's ARIA attributes, and the stock toolbar — whose\n // buttons dispatch commands regardless of `editable`, so disabled and\n // readOnly must neutralize it with `inert` (blocks pointer and keyboard\n // access while the document's text stays selectable).\n // ProseMirror drops natural tabbability once `editable` is false, so a\n // read-only (not disabled) surface restores it with a direct tabindex —\n // tracked by ownership so a host-supplied tabindex (the TextAreaRich\n // adapter sets its own through `setProps`) is never touched.\n const ownsTabindexRef = useRef(false);\n const syncReadState = useCallback(() => {\n const editor = editorInstance.current;\n if (editor) {\n const attributes = surfaceAttributes();\n editor.view.setProps({\n editable: () => !disabledRef.current && !readOnlyRef.current,\n ...(attributes ? { attributes } : {}),\n });\n const dom = editor.view.dom as HTMLElement;\n if (readOnlyRef.current && !disabledRef.current) {\n if (!dom.hasAttribute('tabindex')) {\n dom.setAttribute('tabindex', '0');\n ownsTabindexRef.current = true;\n }\n } else if (ownsTabindexRef.current) {\n if (dom.getAttribute('tabindex') === '0')\n dom.removeAttribute('tabindex');\n ownsTabindexRef.current = false;\n }\n }\n const inert = disabledRef.current || readOnlyRef.current;\n for (const toolbar of hostRef.current?.querySelectorAll<HTMLElement>(\n '.kb-custom-menu, .kb-custom-menu__overflow-menu'\n ) ?? []) {\n toolbar.inert = inert;\n }\n }, [surfaceAttributes]);\n\n useEffect(() => {\n disabledRef.current = disabled;\n readOnlyRef.current = readOnly;\n syncReadState();\n }, [disabled, readOnly, syncReadState]);\n\n // Runs after every render (no dependency array): a `strictValue` surface\n // must converge even when the prop identity never changed — a rejected\n // edit keeps `value` as-is while the document moved on. The\n // `value === valueRef` guard keeps the common case free; non-strict\n // hosts additionally require the prop itself to have changed (tracked\n // manually below), preserving tolerance for read-once hosts.\n const lastValuePropRef = useRef(value);\n useEffect(() => {\n const propChanged = lastValuePropRef.current !== value;\n lastValuePropRef.current = value;\n // In collab mode the CRDT owns the content; reloading would fight it.\n if (collab || value === valueRef.current) return;\n if (!strictValue && !propChanged) return;\n valueRef.current = value;\n const editor = editorInstance.current;\n if (!editor) return;\n\n loadingRef.current = true;\n const loadVersion = ++loadVersionRef.current;\n const previousReady = readyRef.current;\n // Serialize reloads behind setup and one another. Saving while a reload\n // is pending awaits that same promise rather than reading stale prose.\n const pending = (previousReady ?? Promise.resolve())\n .catch(() => undefined)\n .then(async () => {\n if (editorInstance.current !== editor) return;\n // Reloading the document must not cost the writer their caret: a\n // host-composed update (macro pick, finding) lands mid-flow and\n // the next keystroke should keep going into the editable.\n const hadFocus = editor.view.hasFocus();\n await editor.loadDocumentText(valueTypeRef.current, value);\n if (editorInstance.current !== editor) return;\n loadedDocRef.current = editor.view.state.doc;\n lastSerializedDoc.current = editor.view.state.doc;\n if (hadFocus) {\n // The load can take long enough for the writer to move on —\n // only reclaim the caret when no other control has taken it.\n const active = document.activeElement;\n if (\n !active ||\n active === document.body ||\n (editor.view.dom as HTMLElement).contains(active)\n ) {\n editor.view.focus();\n }\n }\n if (showPreviewRef.current) setMd(value);\n })\n .finally(() => {\n if (\n editorInstance.current === editor &&\n loadVersion === loadVersionRef.current\n ) {\n loadingRef.current = false;\n }\n });\n readyRef.current = pending;\n void pending.catch((error) => {\n if (editorInstance.current !== editor) return;\n console.error('Failed to load markdown:', error);\n onErrorRef.current?.(error);\n });\n });\n\n useEffect(() => {\n if (!hostRef.current) return;\n const host = hostRef.current;\n\n // Set on cleanup so async continuations (kit loading and the\n // `loadDocumentText` chain) don't touch the editor after `destroy()`.\n let disposed = false;\n let editor: CoreEditor | null = null;\n\n const mount = document.createElement('div');\n host.appendChild(mount);\n\n // Listen to transactions and update markdown preview\n const onTransaction = async (event?: Event) => {\n const transaction = (\n event as\n | globalThis.CustomEvent<{\n transaction?: {\n getMeta: (key: string) => unknown;\n before: unknown;\n };\n }>\n | undefined\n )?.detail?.transaction;\n if (transaction?.getMeta(MDY_PROJECTION_META) === true) {\n const doc = editorInstance.current?.view.state.doc;\n if (transaction.before === loadedDocRef.current) {\n loadedDocRef.current = doc;\n lastSerializedDoc.current = doc;\n } else {\n lastSerializedDoc.current = null;\n // A host projection can overtake a pending user-edit save. That\n // older result is discarded below, so publish the newest composed\n // document even if the writer does not make another transaction.\n // A microtask coalesces a burst of clinical updates into one save.\n void Promise.resolve().then(() => {\n if (!disposed) return onTransaction();\n });\n }\n return;\n }\n // Programmatic loads are not edits — reporting them would echo the\n // caller's own `value` back through `onChange`.\n if (loadingRef.current || !editorInstance.current) return;\n\n // ProseMirror fires a transaction for every selection change too —\n // arrow keys, clicks, a blur. Serializing the whole document to\n // markdown for those costs a full tree-sitter pass and two React\n // renders for a caret move, so only a changed document is re-read.\n const { doc } = editorInstance.current.view.state;\n if (doc === lastSerializedDoc.current) return;\n lastSerializedDoc.current = doc;\n const loadVersion = loadVersionRef.current;\n\n try {\n const buffer = await editorInstance.current.saveDocument(\n valueTypeRef.current\n );\n const markdown = new globalThis.TextDecoder().decode(buffer);\n if (\n disposed ||\n loadingRef.current ||\n loadVersion !== loadVersionRef.current ||\n doc !== editorInstance.current?.view.state.doc\n ) {\n return;\n }\n valueRef.current = markdown;\n // `md` only feeds the preview pane; setting it with the preview off\n // re-renders the editor on every keystroke for nothing.\n if (showPreviewRef.current) setMd(markdown);\n onChangeRef.current?.(markdown);\n if (strictValueRef.current) scheduleStrictReconcile();\n // This source is now published. Future clinical-only projections\n // preserve it without starting another authored-prose write.\n loadedDocRef.current = doc;\n } catch (err) {\n // The document was marked as serialized before the attempt, to keep\n // selection-only transactions arriving mid-save from re-entering.\n // A failure has to undo that, or this document is never retried.\n lastSerializedDoc.current = null;\n console.error('Failed to save markdown:', err);\n }\n };\n\n // Initialize the editor. Both modes drop the teardown-unsafe extensions;\n // collaborative mode additionally swaps `history` for the Yjs CRDT sync\n // and lazy-loads the Yjs kit (see `editorKits.ts` for why).\n const setup = async () => {\n loadingRef.current = true;\n const loadVersion = ++loadVersionRef.current;\n // `collaborative` is false when a room was asked for but the Yjs kit\n // could not be loaded — the editor is still created, just a local one,\n // so there is no room to join below.\n const { kits: editorKits, collaborative } = await createEditorKits(\n collab,\n mediaUpload,\n modifyMenu,\n omitExtensions\n );\n if (disposed) return;\n\n editor = CoreEditor.create({\n element: mount,\n uri: 'file:///untitled.md',\n assetLoad: assetLoad ?? createAssetLoad('/kerebron-wasm'),\n editorKits: [...editorKits, ...(additionalEditorKits ?? [])],\n readOnly: disabledRef.current || readOnlyRef.current,\n });\n\n editorInstance.current = editor;\n syncReadState();\n editor.addEventListener('transaction', onTransaction);\n\n // Seed initial content, then populate the preview once on mount.\n //\n // In collaborative mode we still load the local markdown first, then\n // join the room: the Yjs binding seeds an *empty* shared document from\n // this content on the first join, and overwrites the editor with the\n // shared content when the room already has edits — so the stored\n // markdown is the starting point without ever double-inserting.\n const joinRoom = () => {\n if (collaborative && collab && editor && !disposed) {\n (\n editor.run as Record<string, (...args: unknown[]) => boolean>\n ).changeRoom?.(collab.room);\n reseedWhenRoomStaysEmpty();\n }\n };\n\n // The Yjs binding is supposed to seed an empty room from the local\n // content, but the sync import can land as an overwrite that blanks\n // the just-loaded seed (observed with extension-yjs 0.8.x). Heal it:\n // once the join settles, an empty document with a non-empty seed\n // means nobody's content won — reload the seed, which the binding\n // then pushes into the room. Joiners pass no value, so exactly one\n // participant ever does this.\n const seed = valueRef.current;\n const reseedWhenRoomStaysEmpty = () => {\n if (!seed) return;\n const check = async (attempt: number) => {\n if (disposed || !editorInstance.current) return;\n try {\n const buffer =\n await editorInstance.current.saveDocument(MARKDOWN_TYPE);\n const current = new globalThis.TextDecoder()\n .decode(buffer)\n .trim();\n if (disposed || !editorInstance.current) return;\n if (current) return; // somebody's content arrived — done\n if (attempt >= 2) {\n await editorInstance.current.loadDocumentText(\n valueTypeRef.current,\n seed\n );\n return;\n }\n setTimeout(() => void check(attempt + 1), 300);\n } catch {\n // A failed probe must not break the editor; the room stays as-is.\n }\n };\n setTimeout(() => void check(0), 300);\n };\n\n if (valueRef.current) {\n await queueInitialLoad(() =>\n editor!.loadDocumentText(valueTypeRef.current, valueRef.current)\n );\n }\n if (disposed) return;\n loadedDocRef.current = editor.view.state.doc;\n lastSerializedDoc.current = editor.view.state.doc;\n if (showPreviewRef.current) setMd(valueRef.current);\n if (loadVersion === loadVersionRef.current) loadingRef.current = false;\n onReadyRef.current?.(editor);\n joinRoom();\n };\n\n const pending = setup();\n readyRef.current = pending;\n // Observe the rejection without replacing the readiness promise: callers\n // must be able to detect a failed load instead of saving stale content.\n void pending.catch((error) => {\n if (disposed) return;\n loadingRef.current = false;\n console.error('Failed to set up editor:', error);\n onErrorRef.current?.(error);\n });\n\n // Cleanup on unmount\n return () => {\n disposed = true;\n editorInstance.current = null; // makes onTransaction's guard effective\n editor?.removeEventListener('transaction', onTransaction);\n editor?.destroy();\n readyRef.current = null;\n host.replaceChildren();\n };\n // Initial `value`/`collab` are intentionally only applied on mount\n // (uncontrolled). Remount via `key` to switch rooms.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useImperativeHandle(\n ref,\n () => ({\n getContent: async (): Promise<string> => {\n while (true) {\n await readyRef.current;\n const editor = editorInstance.current;\n if (!editor) return valueRef.current;\n const doc = editor.view.state.doc;\n const loadVersion = loadVersionRef.current;\n if (doc === loadedDocRef.current) return valueRef.current;\n const buffer = await editor.saveDocument(valueTypeRef.current);\n if (\n editorInstance.current !== editor ||\n loadVersion !== loadVersionRef.current ||\n doc !== editor.view.state.doc\n )\n continue;\n const markdown = new globalThis.TextDecoder().decode(buffer);\n valueRef.current = markdown;\n loadedDocRef.current = doc;\n lastSerializedDoc.current = doc;\n return markdown;\n }\n },\n focus: (): void => {\n const apply = (): void => {\n const view = editorInstance.current?.view as\n | { focus?: () => void }\n | undefined;\n if (view?.focus) {\n view.focus();\n return;\n }\n hostRef.current\n ?.querySelector<HTMLElement>('[contenteditable=\"true\"], textarea')\n ?.focus();\n };\n // Callers focus on mount; the editor may still be loading its kits.\n if (editorInstance.current) apply();\n else void readyRef.current?.then(apply, () => undefined);\n },\n }),\n []\n );\n\n return (\n <div>\n <div>\n <div\n ref={hostRef}\n id={id}\n className={[\n 'kb-component',\n isDark ? 'kb-component--dark' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ')}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-disabled={disabled || undefined}\n style={{\n isolation: 'isolate',\n opacity: disabled ? 0.65 : undefined,\n pointerEvents: disabled ? 'none' : undefined,\n }}\n />\n </div>\n\n {showPreview && (\n <div>\n <div>\n <h5>Markdown Output</h5>\n <pre>{md}</pre>\n </div>\n </div>\n )}\n </div>\n );\n }\n);\n\nRichEditor.displayName = 'RichEditor';\n\nexport { RichEditor };\n"]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('./chunk-EUAMEVVI.cjs');
|
|
4
|
-
var extensionYjs = require('@kerebron/extension-yjs');
|
|
5
|
-
var WebsocketProvider = require('@kerebron/extension-yjs/WebsocketProvider');
|
|
6
|
-
var MarkYChange = require('@kerebron/extension-yjs/MarkYChange');
|
|
7
|
-
var awarenessProtocol = require('y-protocols/awareness');
|
|
8
|
-
var Y = require('yjs');
|
|
9
|
-
|
|
10
|
-
function _interopNamespace(e) {
|
|
11
|
-
if (e && e.__esModule) return e;
|
|
12
|
-
var n = Object.create(null);
|
|
13
|
-
if (e) {
|
|
14
|
-
Object.keys(e).forEach(function (k) {
|
|
15
|
-
if (k !== 'default') {
|
|
16
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return e[k]; }
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
n.default = e;
|
|
25
|
-
return Object.freeze(n);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var awarenessProtocol__namespace = /*#__PURE__*/_interopNamespace(awarenessProtocol);
|
|
29
|
-
var Y__namespace = /*#__PURE__*/_interopNamespace(Y);
|
|
30
|
-
|
|
31
|
-
function defaultWsUrl() {
|
|
32
|
-
const loc = globalThis.location;
|
|
33
|
-
const protocol = loc && loc.protocol === "https:" ? "wss:" : "ws:";
|
|
34
|
-
const host = loc ? loc.host : "localhost";
|
|
35
|
-
return `${protocol}//${host}/yjs`;
|
|
36
|
-
}
|
|
37
|
-
var HuddleYjsKit = class {
|
|
38
|
-
constructor(url, params, WebSocketImpl, user) {
|
|
39
|
-
this.url = url;
|
|
40
|
-
this.params = params;
|
|
41
|
-
this.WebSocketImpl = WebSocketImpl;
|
|
42
|
-
this.user = user;
|
|
43
|
-
}
|
|
44
|
-
url;
|
|
45
|
-
params;
|
|
46
|
-
WebSocketImpl;
|
|
47
|
-
user;
|
|
48
|
-
name = "yjs-editor";
|
|
49
|
-
getExtensions() {
|
|
50
|
-
const url = this.url;
|
|
51
|
-
const params = this.params;
|
|
52
|
-
const user = this.user;
|
|
53
|
-
const WebSocketImpl = this.WebSocketImpl ?? globalThis.WebSocket;
|
|
54
|
-
const createYjsProvider = (roomId) => {
|
|
55
|
-
const ydoc = new Y__namespace.Doc({ gc: false });
|
|
56
|
-
const provider = new WebsocketProvider.WebsocketProvider(url, roomId, ydoc, {
|
|
57
|
-
connect: true,
|
|
58
|
-
awareness: new awarenessProtocol__namespace.Awareness(ydoc),
|
|
59
|
-
params,
|
|
60
|
-
protocols: [],
|
|
61
|
-
WebSocketPolyfill: WebSocketImpl,
|
|
62
|
-
resyncInterval: -1,
|
|
63
|
-
maxBackoffTime: 2500,
|
|
64
|
-
disableBc: false
|
|
65
|
-
});
|
|
66
|
-
if (user) provider.awareness.setLocalStateField("kerebron:user", user);
|
|
67
|
-
return [provider, ydoc];
|
|
68
|
-
};
|
|
69
|
-
return [new MarkYChange.MarkYChange(), new extensionYjs.ExtensionYjs({ createYjsProvider })];
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
exports.HuddleYjsKit = HuddleYjsKit;
|
|
74
|
-
exports.defaultWsUrl = defaultWsUrl;
|
|
75
|
-
//# sourceMappingURL=collabKit-GCRHP25F.cjs.map
|
|
76
|
-
//# sourceMappingURL=collabKit-GCRHP25F.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/RichEditor/collabKit.ts"],"names":["Y","WebsocketProvider","awarenessProtocol","MarkYChange","ExtensionYjs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,YAAA,GAAuB;AACrC,EAAA,MAAM,MAAM,UAAA,CAAW,QAAA;AACvB,EAAA,MAAM,QAAA,GAAW,GAAA,IAAO,GAAA,CAAI,QAAA,KAAa,WAAW,MAAA,GAAS,KAAA;AAC7D,EAAA,MAAM,IAAA,GAAO,GAAA,GAAM,GAAA,CAAI,IAAA,GAAO,WAAA;AAC9B,EAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAK,IAAI,CAAA,IAAA,CAAA;AAC7B;AAGO,IAAM,eAAN,MAAwC;AAAA,EAE7C,WAAA,CACmB,GAAA,EACA,MAAA,EACA,aAAA,EACA,IAAA,EACjB;AAJiB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AACA,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA;AACA,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAChB;AAAA,EAJgB,GAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA;AAAA,EACA,IAAA;AAAA,EALnB,IAAA,GAAO,YAAA;AAAA,EAQP,aAAA,GAAgB;AACd,IAAA,MAAM,MAAM,IAAA,CAAK,GAAA;AACjB,IAAA,MAAM,SAAS,IAAA,CAAK,MAAA;AACpB,IAAA,MAAM,OAAO,IAAA,CAAK,IAAA;AAClB,IAAA,MAAM,aAAA,GAAgB,IAAA,CAAK,aAAA,IAAiB,UAAA,CAAW,SAAA;AACvD,IAAA,MAAM,iBAAA,GAAoB,CAAC,MAAA,KAA+C;AACxE,MAAA,MAAM,OAAO,IAAMA,YAAA,CAAA,GAAA,CAAI,EAAE,EAAA,EAAI,OAAO,CAAA;AAGpC,MAAA,MAAM,QAAA,GAAW,IAAIC,mCAAA,CAAkB,GAAA,EAAK,QAAQ,IAAA,EAAM;AAAA,QACxD,OAAA,EAAS,IAAA;AAAA,QACT,SAAA,EAAW,IAAsBC,4BAAA,CAAA,SAAA,CAAU,IAAI,CAAA;AAAA,QAC/C,MAAA;AAAA,QACA,WAAW,EAAC;AAAA,QACZ,iBAAA,EAAmB,aAAA;AAAA,QACnB,cAAA,EAAgB,EAAA;AAAA,QAChB,cAAA,EAAgB,IAAA;AAAA,QAChB,SAAA,EAAW;AAAA,OACZ,CAAA;AAED,MAAA,IAAI,IAAA,EAAM,QAAA,CAAS,SAAA,CAAU,kBAAA,CAAmB,iBAAiB,IAAI,CAAA;AACrE,MAAA,OAAO,CAAC,UAAU,IAAI,CAAA;AAAA,IACxB,CAAA;AACA,IAAA,OAAO,CAAC,IAAIC,uBAAA,EAAY,EAAG,IAAIC,yBAAA,CAAa,EAAE,iBAAA,EAAmB,CAAC,CAAA;AAAA,EACpE;AACF","file":"collabKit-GCRHP25F.cjs","sourcesContent":["/**\n * Collaborative (Yjs) editor kit for {@link RichEditor}.\n *\n * Kept in its own module — loaded via dynamic `import()` from `editorKits.ts`\n * only when a `collab` config is passed — so `@kerebron/extension-yjs`, `yjs`\n * and `y-protocols` stay truly optional peers: plain-mode consumers never load\n * them and don't need them installed.\n *\n * We deliberately do not use `@kerebron/editor-kits`' own `YjsEditorKit`: it\n * constructs the `WebsocketProvider` with no query params, leaving no way to\n * authenticate the socket. Here we thread caller-supplied `params` (e.g. an\n * auth token) into the provider so the backend `/yjs` route can authorize the\n * room.\n */\nimport type { EditorKit } from '@kerebron/editor';\nimport { ExtensionYjs } from '@kerebron/extension-yjs';\nimport { WebsocketProvider } from '@kerebron/extension-yjs/WebsocketProvider';\nimport { MarkYChange } from '@kerebron/extension-yjs/MarkYChange';\nimport * as awarenessProtocol from 'y-protocols/awareness';\nimport * as Y from 'yjs';\n\n/** Derive the default `/yjs` websocket URL from the current page origin. */\nexport function defaultWsUrl(): string {\n const loc = globalThis.location;\n const protocol = loc && loc.protocol === 'https:' ? 'wss:' : 'ws:';\n const host = loc ? loc.host : 'localhost';\n return `${protocol}//${host}/yjs`;\n}\n\n/** MarkYChange + ExtensionYjs, with an authenticated websocket provider. */\nexport class HuddleYjsKit implements EditorKit {\n name = 'yjs-editor';\n constructor(\n private readonly url: string,\n private readonly params: Record<string, string>,\n private readonly WebSocketImpl?: typeof globalThis.WebSocket,\n private readonly user?: { id: string; name: string; color?: string }\n ) {}\n\n getExtensions() {\n const url = this.url;\n const params = this.params;\n const user = this.user;\n const WebSocketImpl = this.WebSocketImpl ?? globalThis.WebSocket;\n const createYjsProvider = (roomId: string): [WebsocketProvider, Y.Doc] => {\n const ydoc = new Y.Doc({ gc: false });\n // The provider's opts default is a *default parameter*, not a merge, so we\n // must pass every field when we want to set `params`.\n const provider = new WebsocketProvider(url, roomId, ydoc, {\n connect: true,\n awareness: new awarenessProtocol.Awareness(ydoc),\n params,\n protocols: [],\n WebSocketPolyfill: WebSocketImpl,\n resyncInterval: -1,\n maxBackoffTime: 2500,\n disableBc: false,\n });\n // Named cursors: the position plugin skips states with no user field.\n if (user) provider.awareness.setLocalStateField('kerebron:user', user);\n return [provider, ydoc];\n };\n return [new MarkYChange(), new ExtensionYjs({ createYjsProvider })];\n }\n}\n"]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import './chunk-PX6F3LHL.js';
|
|
2
|
-
import { ExtensionYjs } from '@kerebron/extension-yjs';
|
|
3
|
-
import { WebsocketProvider } from '@kerebron/extension-yjs/WebsocketProvider';
|
|
4
|
-
import { MarkYChange } from '@kerebron/extension-yjs/MarkYChange';
|
|
5
|
-
import * as awarenessProtocol from 'y-protocols/awareness';
|
|
6
|
-
import * as Y from 'yjs';
|
|
7
|
-
|
|
8
|
-
function defaultWsUrl() {
|
|
9
|
-
const loc = globalThis.location;
|
|
10
|
-
const protocol = loc && loc.protocol === "https:" ? "wss:" : "ws:";
|
|
11
|
-
const host = loc ? loc.host : "localhost";
|
|
12
|
-
return `${protocol}//${host}/yjs`;
|
|
13
|
-
}
|
|
14
|
-
var HuddleYjsKit = class {
|
|
15
|
-
constructor(url, params, WebSocketImpl, user) {
|
|
16
|
-
this.url = url;
|
|
17
|
-
this.params = params;
|
|
18
|
-
this.WebSocketImpl = WebSocketImpl;
|
|
19
|
-
this.user = user;
|
|
20
|
-
}
|
|
21
|
-
url;
|
|
22
|
-
params;
|
|
23
|
-
WebSocketImpl;
|
|
24
|
-
user;
|
|
25
|
-
name = "yjs-editor";
|
|
26
|
-
getExtensions() {
|
|
27
|
-
const url = this.url;
|
|
28
|
-
const params = this.params;
|
|
29
|
-
const user = this.user;
|
|
30
|
-
const WebSocketImpl = this.WebSocketImpl ?? globalThis.WebSocket;
|
|
31
|
-
const createYjsProvider = (roomId) => {
|
|
32
|
-
const ydoc = new Y.Doc({ gc: false });
|
|
33
|
-
const provider = new WebsocketProvider(url, roomId, ydoc, {
|
|
34
|
-
connect: true,
|
|
35
|
-
awareness: new awarenessProtocol.Awareness(ydoc),
|
|
36
|
-
params,
|
|
37
|
-
protocols: [],
|
|
38
|
-
WebSocketPolyfill: WebSocketImpl,
|
|
39
|
-
resyncInterval: -1,
|
|
40
|
-
maxBackoffTime: 2500,
|
|
41
|
-
disableBc: false
|
|
42
|
-
});
|
|
43
|
-
if (user) provider.awareness.setLocalStateField("kerebron:user", user);
|
|
44
|
-
return [provider, ydoc];
|
|
45
|
-
};
|
|
46
|
-
return [new MarkYChange(), new ExtensionYjs({ createYjsProvider })];
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { HuddleYjsKit, defaultWsUrl };
|
|
51
|
-
//# sourceMappingURL=collabKit-SJPDPXU4.js.map
|
|
52
|
-
//# sourceMappingURL=collabKit-SJPDPXU4.js.map
|
|
@@ -1 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AAA,EAAS,IAAA;AAAA,QACT,SAAA,EAAW,IAAsB,iBAAA,CAAA,SAAA,CAAU,IAAI,CAAA;AAAA,QAC/C,MAAA;AAAA,QACA,WAAW,EAAC;AAAA,QACZ,iBAAA,EAAmB,aAAA;AAAA,QACnB,cAAA,EAAgB,EAAA;AAAA,QAChB,cAAA,EAAgB,IAAA;AAAA,QAChB,SAAA,EAAW;AAAA,OACZ,CAAA;AAED,MAAA,IAAI,IAAA,EAAM,QAAA,CAAS,SAAA,CAAU,kBAAA,CAAmB,iBAAiB,IAAI,CAAA;AACrE,MAAA,OAAO,CAAC,UAAU,IAAI,CAAA;AAAA,IACxB,CAAA;AACA,IAAA,OAAO,CAAC,IAAI,WAAA,EAAY,EAAG,IAAI,YAAA,CAAa,EAAE,iBAAA,EAAmB,CAAC,CAAA;AAAA,EACpE;AACF","file":"collabKit-SJPDPXU4.js","sourcesContent":["/**\n * Collaborative (Yjs) editor kit for {@link RichEditor}.\n *\n * Kept in its own module — loaded via dynamic `import()` from `editorKits.ts`\n * only when a `collab` config is passed — so `@kerebron/extension-yjs`, `yjs`\n * and `y-protocols` stay truly optional peers: plain-mode consumers never load\n * them and don't need them installed.\n *\n * We deliberately do not use `@kerebron/editor-kits`' own `YjsEditorKit`: it\n * constructs the `WebsocketProvider` with no query params, leaving no way to\n * authenticate the socket. Here we thread caller-supplied `params` (e.g. an\n * auth token) into the provider so the backend `/yjs` route can authorize the\n * room.\n */\nimport type { EditorKit } from '@kerebron/editor';\nimport { ExtensionYjs } from '@kerebron/extension-yjs';\nimport { WebsocketProvider } from '@kerebron/extension-yjs/WebsocketProvider';\nimport { MarkYChange } from '@kerebron/extension-yjs/MarkYChange';\nimport * as awarenessProtocol from 'y-protocols/awareness';\nimport * as Y from 'yjs';\n\n/** Derive the default `/yjs` websocket URL from the current page origin. */\nexport function defaultWsUrl(): string {\n const loc = globalThis.location;\n const protocol = loc && loc.protocol === 'https:' ? 'wss:' : 'ws:';\n const host = loc ? loc.host : 'localhost';\n return `${protocol}//${host}/yjs`;\n}\n\n/** MarkYChange + ExtensionYjs, with an authenticated websocket provider. */\nexport class HuddleYjsKit implements EditorKit {\n name = 'yjs-editor';\n constructor(\n private readonly url: string,\n private readonly params: Record<string, string>,\n private readonly WebSocketImpl?: typeof globalThis.WebSocket,\n private readonly user?: { id: string; name: string; color?: string }\n ) {}\n\n getExtensions() {\n const url = this.url;\n const params = this.params;\n const user = this.user;\n const WebSocketImpl = this.WebSocketImpl ?? globalThis.WebSocket;\n const createYjsProvider = (roomId: string): [WebsocketProvider, Y.Doc] => {\n const ydoc = new Y.Doc({ gc: false });\n // The provider's opts default is a *default parameter*, not a merge, so we\n // must pass every field when we want to set `params`.\n const provider = new WebsocketProvider(url, roomId, ydoc, {\n connect: true,\n awareness: new awarenessProtocol.Awareness(ydoc),\n params,\n protocols: [],\n WebSocketPolyfill: WebSocketImpl,\n resyncInterval: -1,\n maxBackoffTime: 2500,\n disableBc: false,\n });\n // Named cursors: the position plugin skips states with no user field.\n if (user) provider.awareness.setLocalStateField('kerebron:user', user);\n return [provider, ydoc];\n };\n return [new MarkYChange(), new ExtensionYjs({ createYjsProvider })];\n }\n}\n"]}
|