@smartdoca/markdown 0.4.2

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 (59) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +43 -0
  3. package/dist/index.cjs +51 -0
  4. package/dist/index.js +2353 -0
  5. package/dist/style.css +1 -0
  6. package/dist/types/components/CodeBlock.d.ts +6 -0
  7. package/dist/types/components/CodeBlock.d.ts.map +1 -0
  8. package/dist/types/components/HostActions.d.ts +7 -0
  9. package/dist/types/components/HostActions.d.ts.map +1 -0
  10. package/dist/types/components/MarkdownPreview.d.ts +12 -0
  11. package/dist/types/components/MarkdownPreview.d.ts.map +1 -0
  12. package/dist/types/components/MermaidDiagram.d.ts +8 -0
  13. package/dist/types/components/MermaidDiagram.d.ts.map +1 -0
  14. package/dist/types/components/Toolbar.d.ts +25 -0
  15. package/dist/types/components/Toolbar.d.ts.map +1 -0
  16. package/dist/types/editor/annotations.d.ts +20 -0
  17. package/dist/types/editor/annotations.d.ts.map +1 -0
  18. package/dist/types/editor/code-highlight.d.ts +11 -0
  19. package/dist/types/editor/code-highlight.d.ts.map +1 -0
  20. package/dist/types/editor/collaboration.d.ts +4 -0
  21. package/dist/types/editor/collaboration.d.ts.map +1 -0
  22. package/dist/types/editor/commands.d.ts +22 -0
  23. package/dist/types/editor/commands.d.ts.map +1 -0
  24. package/dist/types/editor/end-of-document.d.ts +4 -0
  25. package/dist/types/editor/end-of-document.d.ts.map +1 -0
  26. package/dist/types/editor/host-session.d.ts +46 -0
  27. package/dist/types/editor/host-session.d.ts.map +1 -0
  28. package/dist/types/editor/i18n.d.ts +18 -0
  29. package/dist/types/editor/i18n.d.ts.map +1 -0
  30. package/dist/types/editor/integration.d.ts +84 -0
  31. package/dist/types/editor/integration.d.ts.map +1 -0
  32. package/dist/types/editor/markdown-file.d.ts +47 -0
  33. package/dist/types/editor/markdown-file.d.ts.map +1 -0
  34. package/dist/types/editor/pdf-file.d.ts +82 -0
  35. package/dist/types/editor/pdf-file.d.ts.map +1 -0
  36. package/dist/types/editor/preview-interaction.d.ts +22 -0
  37. package/dist/types/editor/preview-interaction.d.ts.map +1 -0
  38. package/dist/types/editor/preview-mapping.d.ts +45 -0
  39. package/dist/types/editor/preview-mapping.d.ts.map +1 -0
  40. package/dist/types/editor/protocol.d.ts +20 -0
  41. package/dist/types/editor/protocol.d.ts.map +1 -0
  42. package/dist/types/editor/scroll-sync.d.ts +9 -0
  43. package/dist/types/editor/scroll-sync.d.ts.map +1 -0
  44. package/dist/types/editor/selection.d.ts +47 -0
  45. package/dist/types/editor/selection.d.ts.map +1 -0
  46. package/dist/types/editor/types.d.ts +51 -0
  47. package/dist/types/editor/types.d.ts.map +1 -0
  48. package/dist/types/editor/upload.d.ts +26 -0
  49. package/dist/types/editor/upload.d.ts.map +1 -0
  50. package/dist/types/editor/use-preview-value.d.ts +3 -0
  51. package/dist/types/editor/use-preview-value.d.ts.map +1 -0
  52. package/dist/types/lib/CollaborativeMarkdownEditor.d.ts +73 -0
  53. package/dist/types/lib/CollaborativeMarkdownEditor.d.ts.map +1 -0
  54. package/dist/types/lib/index.d.ts +29 -0
  55. package/dist/types/lib/index.d.ts.map +1 -0
  56. package/docs/COLLABORATION.md +22 -0
  57. package/examples/DocaComments.tsx +45 -0
  58. package/examples/DocaMarkdownFiles.tsx +54 -0
  59. package/package.json +96 -0
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .exmd-editor{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;color:#292825;font-synthesis:none}.exmd-editor,.exmd-editor *{box-sizing:border-box}.exmd-editor button{font:inherit}.exmd-editor.app-shell{display:grid;grid-template-rows:64px auto 1fr 34px;background:#f7f7f5;overflow:hidden}.topbar{display:flex;align-items:center;gap:22px;padding:0 24px;border-bottom:1px solid #e6e4df;background:#ffffffeb}.brand{display:flex;align-items:center;gap:11px;margin-right:auto}.brand-mark{display:grid;place-items:center;width:34px;height:34px;color:#fff;background:#282725;border-radius:10px;font-family:serif;font-weight:700}.brand div{display:grid;gap:2px}.brand strong{font-size:14px}.brand small{color:#949087;font-size:11px}.sync-state{display:flex;align-items:center;gap:6px;color:#8c887f;font-size:12px}.sync-state svg{width:14px}.sync-state.ready{color:#3d806b}.sync-state.error{color:#b64545}.spin{animation:spin 1s linear infinite}.collaboration-loading{display:grid;min-height:240px;place-items:center;color:#8c887f;font-size:13px}.presence{display:flex;align-items:center;gap:8px;color:#716e67;font-size:12px}.avatars{display:flex}.avatars span{display:grid;place-items:center;width:27px;height:27px;margin-left:-6px;border:2px solid #fff;border-radius:50%;color:#fff;font-size:11px;font-weight:700}.avatars span:first-child{margin-left:0}.toolbar{min-height:50px;display:flex;align-items:center;gap:8px;padding:7px 18px;border-bottom:1px solid #e6e4df;background:#fff;overflow-x:auto}.tool-group{display:flex;gap:2px}.toolbar button{min-width:32px;height:32px;padding:0 8px;border:0;border-radius:7px;color:#56534d;background:transparent;cursor:pointer;font-size:13px;font-weight:650}.toolbar button:hover{background:#f0efeb;color:#242320}.toolbar button.active{color:#6248bd;background:#eee9ff}.toolbar svg{width:16px;height:16px;vertical-align:middle}.toolbar .italic{font-style:italic}.tool-divider{width:1px;height:22px;flex:0 0 auto;background:#ebe9e4}.toolbar-spacer{flex:1}.download-button{display:flex;align-items:center;gap:6px;padding:0 12px!important;background:#282725!important;color:#fff!important}.rich-tools{align-items:center;gap:7px}.rich-tools select{height:32px;max-width:116px;padding:0 24px 0 9px;border:1px solid #e4e1da;border-radius:7px;color:#56534d;background:#fff;font:inherit;font-size:12px;cursor:pointer}.color-tool{position:relative;display:grid;place-items:center;width:32px;height:32px;border-radius:7px;color:#56534d;font-weight:700;cursor:pointer}.color-tool:hover{background:#f0efeb}.color-tool span{border-bottom:3px solid #d14f4f;line-height:18px}.color-tool input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.notice{position:fixed;z-index:20;top:122px;left:50%;transform:translate(-50%);padding:8px 14px;border-radius:8px;color:#fff;background:#292825;box-shadow:0 5px 18px #0002;font-size:12px}.notice.error{background:#b64b4b}.workspace{min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);background:#ebeae6;gap:1px}.workspace.mode-edit,.workspace.mode-preview{grid-template-columns:minmax(0,1fr)}.editor-pane,.preview-pane{min-width:0;min-height:0;position:relative;overflow:auto;background:#fff}.pane-label{position:sticky;z-index:5;top:0;height:32px;padding:0 18px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #efeee9;color:#aaa69d;background:#fcfcfaeb;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);font-size:10px;letter-spacing:.08em;text-transform:uppercase}.cm-editor{min-height:100%;font-size:14px}.cm-editor.cm-focused{outline:none}.cm-scroller{padding:20px 0 80px;font-family:SFMono-Regular,Consolas,Liberation Mono,monospace!important;line-height:1.75}.cm-content{max-width:820px;margin:0 auto;padding:0 36px!important}.cm-gutters{color:#c5c1b9;background:#fff!important;border:0!important}.cm-activeLine,.cm-activeLineGutter{background:#faf9f6!important}.cm-ySelectionInfo{font-family:Inter,sans-serif}.exmd-remote-selection{background:color-mix(in srgb,var(--exmd-selection-color) 24%,transparent);border-bottom:2px solid var(--exmd-selection-color)}.exmd-editor .editor-pane[hidden]{display:none}.exmd-editor .exmd-remote-caret{display:inline;position:relative;border-left:2px solid var(--exmd-selection-color);margin-left:-1px;margin-right:-1px;pointer-events:none}.exmd-editor .exmd-remote-label{position:absolute;bottom:100%;left:-2px;padding:1px 5px;border-radius:3px 3px 3px 0;background:var(--exmd-selection-color);color:#fff;white-space:nowrap;font:11px/1.4 system-ui,sans-serif;z-index:4}.exmd-editor .exmd-comment-anchor{text-decoration:underline 2px #d8a12c;text-underline-offset:3px;cursor:pointer}.exmd-editor .exmd-comment-active{background:#ffe5a1}.exmd-host-actions{display:flex;gap:4px;flex-shrink:0}.exmd-host-actions button{display:inline-flex;align-items:center;justify-content:center;min-height:30px;padding:5px 9px;border:0;border-radius:5px;background:transparent;color:#534622;cursor:pointer;font:13px/1.4 system-ui,sans-serif}.exmd-host-actions button:hover{background:#fff2c6}.exmd-host-actions button:disabled{opacity:.4;cursor:not-allowed}.exmd-host-actions svg{width:16px;height:16px}.exmd-selection-toolbar{padding:4px;background:#fff;border:1px solid #e2d9c0;border-radius:8px;box-shadow:0 4px 18px #0002}.markdown-body{max-width:820px;margin:0 auto;padding:34px 46px 100px;line-height:1.75;color:#363431;overflow-wrap:anywhere}.markdown-body h1,.markdown-body h2,.markdown-body h3{color:#22211f;line-height:1.3;margin:1.6em 0 .65em}.markdown-body h1:first-child{margin-top:.15em}.markdown-body h1{font-size:2em;letter-spacing:-.035em}.markdown-body h2{padding-bottom:.25em;border-bottom:1px solid #ebe8e1;font-size:1.45em}.markdown-body p{margin:.8em 0}.markdown-body a{color:#6550bd}.markdown-body blockquote{margin:1.1em 0;padding:.1em 1em;border-left:3px solid #9a88dc;color:#6b6760;background:#f8f6fd}.markdown-body code{padding:.16em .38em;border-radius:5px;color:#a3475a;background:#f3f1ed;font-family:SFMono-Regular,Consolas,monospace;font-size:.88em}.markdown-body pre{padding:18px;overflow:auto;border:1px solid #e7e4dd;border-radius:10px;background:#f7f6f3}.markdown-body pre code{padding:0;color:inherit;background:transparent}.markdown-body img{display:block;max-width:100%;max-height:620px;margin:22px auto;border-radius:8px;box-shadow:0 2px 12px #00000012}.markdown-body table{width:100%;border-collapse:collapse}.markdown-body th,.markdown-body td{padding:8px 12px;border:1px solid #dedbd4}.markdown-body th{background:#f6f5f2;text-align:left}.markdown-body li.task-list-item{list-style:none}.markdown-body input[type=checkbox]{margin-left:-1.35em}.mermaid-diagram{margin:22px 0;overflow:auto;text-align:center}.mermaid-diagram svg{display:block;max-width:100%;height:auto;margin:0 auto}.diagram-error{margin:18px 0;padding:12px;border-radius:8px;color:#a33d3d;background:#fff0f0;font-size:13px}.markdown-body .highlighted-code{margin:18px 0;padding:16px 0;border:1px solid #e7e4dd;border-radius:10px;font-size:13px;line-height:1.65}.highlighted-code .hljs{display:block;padding:0 18px;color:#24292e;background:transparent}.hljs-comment,.hljs-quote{color:#6a737d;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#d73a49}.hljs-string,.hljs-doctag,.hljs-regexp{color:#032f62}.hljs-title,.hljs-section,.hljs-selector-id{color:#6f42c1;font-weight:600}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable{color:#005cc5}.hljs-type,.hljs-class .hljs-title,.hljs-built_in{color:#e36209}.hljs-attr,.hljs-attribute,.hljs-name{color:#22863a}.hljs-meta{color:#735c0f}.hljs-symbol,.hljs-bullet{color:#005cc5}.katex-display{margin:1.4em 0!important;overflow-x:auto;overflow-y:hidden}.exmd-editor footer{display:flex;justify-content:space-between;align-items:center;padding:0 18px;border-top:1px solid #e4e2dc;color:#9b978e;background:#fafaf8;font-size:10px;letter-spacing:.02em}@keyframes spin{to{transform:rotate(360deg)}}@media(max-width:760px){.workspace.mode-split{grid-template-columns:1fr;grid-template-rows:1fr 1fr}.presence>span,.history-tools,.format-tools button:nth-child(n+7),.tool-divider{display:none}.topbar{padding:0 14px}.toolbar{padding-inline:8px}.markdown-body{padding-inline:24px}.cm-content{padding-inline:18px!important}}
@@ -0,0 +1,6 @@
1
+ export interface CodeBlockProps {
2
+ code: string;
3
+ language: string;
4
+ }
5
+ export declare function CodeBlock({ code, language }: CodeBlockProps): import("react").JSX.Element;
6
+ //# sourceMappingURL=CodeBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAClE,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,cAAc,+BAI3D"}
@@ -0,0 +1,7 @@
1
+ import type { MarkdownSelectionAction, MarkdownSelectionActionContext } from '../editor/integration';
2
+ export declare function HostActions({ actions, context, capture }: {
3
+ actions: MarkdownSelectionAction[];
4
+ context: MarkdownSelectionActionContext;
5
+ capture(): MarkdownSelectionActionContext;
6
+ }): import("react").JSX.Element;
7
+ //# sourceMappingURL=HostActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostActions.d.ts","sourceRoot":"","sources":["../../../src/components/HostActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAA;AAEpG,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACzD,OAAO,EAAE,uBAAuB,EAAE,CAAA;IAClC,OAAO,EAAE,8BAA8B,CAAA;IACvC,OAAO,IAAI,8BAA8B,CAAA;CAC1C,+BAUA"}
@@ -0,0 +1,12 @@
1
+ import type { EditorMessages } from '../editor/i18n';
2
+ import type { MarkdownPreviewInteraction } from '../editor/preview-interaction';
3
+ export interface MarkdownPreviewProps {
4
+ value: string;
5
+ resolveImageUrl?: (path: string) => string | Promise<string>;
6
+ /** Forward unchanged from a custom Preview wrapper to retain precise selection/comment support. */
7
+ interaction?: MarkdownPreviewInteraction;
8
+ locale?: string;
9
+ messages?: EditorMessages;
10
+ }
11
+ export declare const MarkdownPreview: import("react").NamedExoticComponent<MarkdownPreviewProps>;
12
+ //# sourceMappingURL=MarkdownPreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownPreview.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownPreview.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAiB/E,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5D,mGAAmG;IACnG,WAAW,CAAC,EAAE,0BAA0B,CAAA;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,eAAO,MAAM,eAAe,4DAyB1B,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { type EditorMessages } from '../editor/i18n';
2
+ export interface MermaidDiagramProps {
3
+ code: string;
4
+ locale?: string;
5
+ messages?: EditorMessages;
6
+ }
7
+ export declare const MermaidDiagram: import("react").NamedExoticComponent<MermaidDiagramProps>;
8
+ //# sourceMappingURL=MermaidDiagram.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MermaidDiagram.d.ts","sourceRoot":"","sources":["../../../src/components/MermaidDiagram.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAI/D,MAAM,WAAW,mBAAmB;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;AACjG,eAAO,MAAM,cAAc,2DAmBzB,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { type MarkdownAction } from '../editor/commands';
2
+ import { type EditorMessages } from '../editor/i18n';
3
+ import type { ViewMode } from '../editor/types';
4
+ import type { ReactNode } from 'react';
5
+ export interface ToolbarProps {
6
+ readOnly?: boolean;
7
+ mode: ViewMode;
8
+ onModeChange: (mode: ViewMode) => void;
9
+ onAction: (action: MarkdownAction) => void;
10
+ onUndo: () => void;
11
+ onRedo: () => void;
12
+ onImage: () => void;
13
+ onDiagram: () => void;
14
+ onFormula: () => void;
15
+ onCodeBlock: (language: string) => void;
16
+ onColor: (color: string) => void;
17
+ /** Host actions retain native selection and have permissions separate from readOnly. */
18
+ hostActions?: ReactNode;
19
+ /** `zh` or `en`. Omitted stays Chinese. Unknown codes display English. */
20
+ locale?: string;
21
+ /** Replaces individual catalog entries. Other keys keep the built-in translation. */
22
+ messages?: EditorMessages;
23
+ }
24
+ export declare function Toolbar(props: ToolbarProps): import("react").JSX.Element;
25
+ //# sourceMappingURL=Toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/Toolbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,cAAc,EAAwB,MAAM,oBAAoB,CAAA;AACvF,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,QAAQ,CAAA;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAA;IAC1C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,wFAAwF;IACxF,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAMD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAyC1C"}
@@ -0,0 +1,20 @@
1
+ import { StateField } from '@codemirror/state';
2
+ import type * as Y from 'yjs';
3
+ import { type MarkdownCommentAnchor, type RemoteMarkdownSelection } from './selection';
4
+ export declare const setRemoteSelectionsEffect: import("@codemirror/state").StateEffectType<RemoteMarkdownSelection[]>;
5
+ export declare const setCommentAnchorsEffect: import("@codemirror/state").StateEffectType<MarkdownCommentAnchor[]>;
6
+ export declare const activateCommentAnchorEffect: import("@codemirror/state").StateEffectType<string | null>;
7
+ export declare const refreshAnnotationsEffect: import("@codemirror/state").StateEffectType<void>;
8
+ interface AnnotationState {
9
+ remote: RemoteMarkdownSelection[];
10
+ comments: MarkdownCommentAnchor[];
11
+ active: string | null;
12
+ }
13
+ /** Comes after yCollab: resolve relative positions after local Y.Text projection, not before. */
14
+ export declare function createAnnotationsExtension(text: Y.Text, runtime: {
15
+ showRemote(): boolean;
16
+ onAnchorClick(id: string): void;
17
+ cursorLabel?(name: string): string;
18
+ }): (StateField<AnnotationState> | import("@codemirror/state").Extension)[];
19
+ export {};
20
+ //# sourceMappingURL=annotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../src/editor/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,EAA6D,KAAK,qBAAqB,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAEjJ,eAAO,MAAM,yBAAyB,wEAAkD,CAAA;AACxF,eAAO,MAAM,uBAAuB,sEAAgD,CAAA;AACpF,eAAO,MAAM,2BAA2B,4DAAsC,CAAA;AAC9E,eAAO,MAAM,wBAAwB,mDAA6B,CAAA;AAClE,UAAU,eAAe;IACvB,MAAM,EAAE,uBAAuB,EAAE,CAAA;IACjC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AA+BD,iGAAiG;AACjG,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE;IAChE,UAAU,IAAI,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CACnC,2EAmFA"}
@@ -0,0 +1,11 @@
1
+ export interface HighlightedCodeSegment {
2
+ text: string;
3
+ scope?: string;
4
+ }
5
+ export interface HighlightedCode {
6
+ language: string;
7
+ html: string;
8
+ lines: HighlightedCodeSegment[][];
9
+ }
10
+ export declare function highlightCode(source: string, language: string | undefined): HighlightedCode;
11
+ //# sourceMappingURL=code-highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-highlight.d.ts","sourceRoot":"","sources":["../../../src/editor/code-highlight.ts"],"names":[],"mappings":"AAkCA,MAAM,WAAW,sBAAsB;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AACxE,MAAM,WAAW,eAAe;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,sBAAsB,EAAE,EAAE,CAAA;CAAE;AAkCtG,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,CAU3F"}
@@ -0,0 +1,4 @@
1
+ import type { CollaborationOptions, CollaborationSession } from './types';
2
+ export declare const DEFAULT_MARKDOWN = "# \u4E00\u8D77\u5199\u70B9\u4EC0\u4E48\n\n\u8FD9\u662F\u4E00\u4E2A\u652F\u6301 **\u5B9E\u65F6\u534F\u4F5C** \u7684 Markdown \u6587\u6863\u3002\u8BD5\u8BD5\u4ECE\u53E6\u4E00\u4E2A\u7A97\u53E3\u6253\u5F00\u76F8\u540C\u94FE\u63A5\u3002\n\n## \u5FEB\u901F\u5F00\u59CB\n\n- \u4F7F\u7528\u4E0A\u65B9\u5DE5\u5177\u680F\u63D2\u5165\u5E38\u7528\u683C\u5F0F\n- \u62D6\u5165\u6216\u7C98\u8D34\u56FE\u7247\n- \u7528 Mermaid \u63CF\u8FF0\u6D41\u7A0B\u56FE\n\n```mermaid\nflowchart LR\n A[\u60F3\u6CD5] --> B{\u4E00\u8D77\u8BA8\u8BBA}\n B --> C[\u5199\u6210\u6587\u6863]\n B --> D[\u7EE7\u7EED\u8FED\u4EE3]\n```\n";
3
+ export declare function useCollaboration(options: CollaborationOptions): CollaborationSession;
4
+ //# sourceMappingURL=collaboration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../../../src/editor/collaboration.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAoD,MAAM,SAAS,CAAA;AAK3H,eAAO,MAAM,gBAAgB,+lBAgB5B,CAAA;AAeD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CAmGpF"}
@@ -0,0 +1,22 @@
1
+ import type { EditorView } from '@codemirror/view';
2
+ export interface MarkdownCommand {
3
+ id: string;
4
+ label: string;
5
+ titleKey: string;
6
+ prefix: string;
7
+ suffix?: string;
8
+ placeholderKey?: string;
9
+ block?: boolean;
10
+ }
11
+ export interface MarkdownAction {
12
+ label: string;
13
+ title: string;
14
+ prefix: string;
15
+ suffix?: string;
16
+ placeholder?: string;
17
+ block?: boolean;
18
+ }
19
+ export declare const actions: MarkdownCommand[];
20
+ export declare function applyMarkdownAction(view: EditorView, action: MarkdownAction): void;
21
+ export declare function insertAtSelection(view: EditorView, value: string): void;
22
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/editor/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,eAAO,MAAM,OAAO,EAAE,eAAe,EAepC,CAAA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,QAc3E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,QAIhE"}
@@ -0,0 +1,4 @@
1
+ import type { EditorView } from '@codemirror/view';
2
+ /** Handle only the unused space below the final visual line, not text or editor controls. */
3
+ export declare function focusDocumentEnd(view: EditorView, pane: HTMLElement, event: MouseEvent): boolean;
4
+ //# sourceMappingURL=end-of-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-of-document.d.ts","sourceRoot":"","sources":["../../../src/editor/end-of-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAkBhG"}
@@ -0,0 +1,46 @@
1
+ import * as Y from 'yjs';
2
+ import { Awareness } from 'y-protocols/awareness';
3
+ import type { CollaborationError, CollaborationSession, Collaborator, ConnectionState, SaveState } from './types';
4
+ export interface HostMarkdownSessionOptions {
5
+ doc: Y.Doc;
6
+ awareness?: Awareness;
7
+ undoManager?: Y.UndoManager;
8
+ state: ConnectionState;
9
+ saveState: SaveState;
10
+ ready: boolean;
11
+ collaborators?: Collaborator[];
12
+ error?: CollaborationError;
13
+ epochId?: string;
14
+ }
15
+ /** Creates no transport/storage. A helper-owned Awareness has its standard expiry timer; dispose it at session end. */
16
+ export declare function createHostMarkdownSession(options: HostMarkdownSessionOptions): CollaborationSession;
17
+ /** Returns a new status snapshot while retaining the exact Y.Doc, Y.Text, awareness and undo instances. */
18
+ export declare function updateHostMarkdownSession(session: CollaborationSession, state: Pick<CollaborationSession, 'state' | 'ready' | 'saveState'> & Partial<Pick<CollaborationSession, 'collaborators' | 'error' | 'epochId'>>): CollaborationSession;
19
+ export interface LocalMarkdownUpdate {
20
+ update: Uint8Array;
21
+ origin: unknown;
22
+ transaction: Y.Transaction;
23
+ }
24
+ /** Only editor-local正文 transactions pass this filter; bootstrap and remote apply do not. */
25
+ export declare function observeLocalMarkdownUpdates(session: Pick<CollaborationSession, 'doc' | 'text'>, listener: (event: LocalMarkdownUpdate) => void): () => void;
26
+ export declare function applyRemoteMarkdownUpdate(doc: Y.Doc, update: Uint8Array): void;
27
+ export declare const MARKDOWN_HOST_CAPABILITIES: Readonly<{
28
+ protocolVersion: 1;
29
+ codec: "markdown-ytext";
30
+ schemaVersion: 1;
31
+ textRoot: "markdown";
32
+ find: {
33
+ literal: boolean;
34
+ caseSensitive: boolean;
35
+ regex: boolean;
36
+ };
37
+ permanentTextAnchors: true;
38
+ remoteCarets: true;
39
+ commentDecorations: true;
40
+ previewTextAnchors: true;
41
+ previewCommentDecorations: true;
42
+ hostSelectionActions: true;
43
+ anchorKind: "markdown-text-range";
44
+ anchorBoundary: "exclude-both";
45
+ }>;
46
+ //# sourceMappingURL=host-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-session.d.ts","sourceRoot":"","sources":["../../../src/editor/host-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIjH,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAA;IACV,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,WAAW,CAAC,EAAE,CAAC,CAAC,WAAW,CAAA;IAC3B,KAAK,EAAE,eAAe,CAAA;IACtB,SAAS,EAAE,SAAS,CAAA;IACpB,KAAK,EAAE,OAAO,CAAA;IACd,aAAa,CAAC,EAAE,YAAY,EAAE,CAAA;IAC9B,KAAK,CAAC,EAAE,kBAAkB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,uHAAuH;AACvH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,oBAAoB,CAoBnG;AAED,2GAA2G;AAC3G,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,oBAAoB,EACrE,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,GAAG,oBAAoB,CAEvK;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,UAAU,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,WAAW,EAAE,CAAC,CAAC,WAAW,CAAA;CAC3B;AAED,4FAA4F;AAC5F,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,KAAK,GAAG,MAAM,CAAC,EAC7F,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,MAAM,IAAI,CAQ5D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAE9E;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;EAcrC,CAAA"}
@@ -0,0 +1,18 @@
1
+ export type MessageValues = Record<string, string | number>;
2
+ export type EditorMessages = Record<string, string>;
3
+ export type Translate = (key: string, values?: MessageValues) => string;
4
+ /** Omitted locale stays Chinese. Only `zh` and `en` are recognized; anything else is English. */
5
+ export declare function resolveEditorLocale(locale?: string): 'zh' | 'en';
6
+ export declare function editorLanguageTag(locale?: string): 'zh-CN' | 'en';
7
+ export declare function editorMessageKeys(): {
8
+ en: string[];
9
+ zh: string[];
10
+ };
11
+ export declare function translate(locale: string | undefined, key: string, values?: MessageValues, messages?: EditorMessages): string;
12
+ export declare function bindTranslate(locale?: string, messages?: EditorMessages): Translate;
13
+ export declare function collaborationErrorText(error: {
14
+ code: string;
15
+ message: string;
16
+ cause?: unknown;
17
+ }, locale?: string, messages?: EditorMessages): string;
18
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/editor/i18n.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AAC3D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,KAAK,MAAM,CAAA;AAEvE,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAGhE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAEjE;AAqPD,wBAAgB,iBAAiB,IAAI;IAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,CAElE;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAsB5H;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAEnF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAIpJ"}
@@ -0,0 +1,84 @@
1
+ import type { EditorView } from '@codemirror/view';
2
+ import type { ReactNode } from 'react';
3
+ import type { MarkdownCommentAnchor, MarkdownTextAnchor, MarkdownTextSelection, RemoteMarkdownSelection, ResolvedTextRange } from './selection';
4
+ export type EditorMode = 'edit' | 'readonly';
5
+ export type MarkdownActiveView = 'source' | 'preview';
6
+ export interface MarkdownSelectionActionContext {
7
+ view: MarkdownActiveView;
8
+ anchor: MarkdownTextAnchor | null;
9
+ }
10
+ export interface MarkdownSelectionAction {
11
+ id: string;
12
+ icon?: ReactNode;
13
+ title: string;
14
+ /** Host comment permission, independent of document edit permission. */
15
+ disabled?: boolean;
16
+ /** Defaults to true. Set false for explicit document-level actions. */
17
+ requiresSelection?: boolean;
18
+ onClick(context: MarkdownSelectionActionContext): void;
19
+ }
20
+ export interface EditorAsset {
21
+ /** Stable host-owned asset identifier or path. Do not return a temporary signed URL here. */
22
+ path: string;
23
+ name?: string;
24
+ size?: number;
25
+ mimeType?: string;
26
+ width?: number;
27
+ height?: number;
28
+ }
29
+ export interface EditorUploadContext {
30
+ signal: AbortSignal;
31
+ onProgress: (percent: number) => void;
32
+ }
33
+ export interface EditorResources {
34
+ uploadImage?: (file: File, context: EditorUploadContext) => Promise<EditorAsset | string>;
35
+ resolveUrl?: (path: string) => string | Promise<string>;
36
+ resolveDownloadUrl?: (path: string) => string | Promise<string>;
37
+ }
38
+ export interface MarkdownFindOptions {
39
+ caseSensitive?: boolean;
40
+ }
41
+ export interface MarkdownFindMatch {
42
+ id: string;
43
+ from: number;
44
+ to: number;
45
+ text: string;
46
+ revision: number;
47
+ }
48
+ export interface MarkdownFormatState {
49
+ selection: {
50
+ from: number;
51
+ to: number;
52
+ };
53
+ canUndo: boolean;
54
+ canRedo: boolean;
55
+ }
56
+ export interface CollaborativeMarkdownEditorHandle {
57
+ focus(): void;
58
+ getMarkdown(): string;
59
+ /** Explicit whole-source edit; one undoable transaction, not an initialization/sync API. */
60
+ replaceMarkdown(markdown: string, options?: {
61
+ expectedMarkdown?: string;
62
+ }): boolean;
63
+ getEditorView(): EditorView | undefined;
64
+ insertText(text: string): boolean;
65
+ find(query: string, options?: MarkdownFindOptions): MarkdownFindMatch[];
66
+ reveal(match: MarkdownFindMatch): boolean;
67
+ replace(match: MarkdownFindMatch, text: string): boolean;
68
+ replaceAll(query: string, text: string, options?: MarkdownFindOptions): number;
69
+ undo(): boolean;
70
+ redo(): boolean;
71
+ queryFormatState(): MarkdownFormatState;
72
+ onSelectionChange(listener: (selection: MarkdownTextSelection | null) => void): () => void;
73
+ renderRemoteSelections(selections: RemoteMarkdownSelection[]): void;
74
+ clearRemoteSelections(): void;
75
+ captureAnchor(): MarkdownTextAnchor | null;
76
+ resolveAnchor(anchor: MarkdownTextAnchor): ResolvedTextRange | null;
77
+ revealAnchor(anchor: MarkdownTextAnchor): boolean;
78
+ /** Full comment snapshot. Missing, resolved, deleted or orphaned ranges are not drawn. */
79
+ renderAnchors(anchors: MarkdownCommentAnchor[]): void;
80
+ setActiveAnchor(id: string | null): void;
81
+ clearAnchors(): void;
82
+ onAnchorClick(listener: (id: string) => void): () => void;
83
+ }
84
+ //# sourceMappingURL=integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/editor/integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/I,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,CAAA;AAC5C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAA;AACrD,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,kBAAkB,CAAA;IACxB,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAClC;AACD,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,OAAO,CAAC,OAAO,EAAE,8BAA8B,GAAG,IAAI,CAAA;CACvD;AAED,MAAM,WAAW,WAAW;IAC1B,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,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N_FILE_MIME = "text/markdown;charset=utf-8";
3
+ export declare const DEFAULT_MARKDOWN_IMPORT_MAX_BYTES: number;
4
+ export interface MarkdownFileWarning {
5
+ code: 'UTF8_BOM_REMOVED' | 'MIXED_LINE_ENDINGS' | 'RESOURCE_REFERENCES_PRESERVED';
6
+ message: string;
7
+ }
8
+ export interface MarkdownImportOptions {
9
+ maxBytes?: number;
10
+ locale?: string;
11
+ messages?: EditorMessages;
12
+ }
13
+ export type MarkdownLineEndings = 'none' | 'lf' | 'crlf' | 'cr' | 'mixed';
14
+ export type MarkdownImportErrorCode = 'UNSUPPORTED_EXTENSION' | 'FILE_TOO_LARGE' | 'INVALID_UTF8' | 'BINARY_CONTENT' | 'READ_FAILED';
15
+ export type MarkdownImportResult = {
16
+ ok: true;
17
+ markdown: string;
18
+ fileName: string;
19
+ byteLength: number;
20
+ encoding: 'utf-8';
21
+ hadBom: boolean;
22
+ lineEndings: MarkdownLineEndings;
23
+ warnings: MarkdownFileWarning[];
24
+ } | {
25
+ ok: false;
26
+ error: {
27
+ code: MarkdownImportErrorCode;
28
+ message: string;
29
+ };
30
+ warnings: MarkdownFileWarning[];
31
+ };
32
+ export interface MarkdownExportResult {
33
+ blob: Blob;
34
+ fileName: string;
35
+ mimeType: typeof MARKDOWN_FILE_MIME;
36
+ warnings: MarkdownFileWarning[];
37
+ }
38
+ export interface MarkdownExportOptions {
39
+ fileName?: string;
40
+ locale?: string;
41
+ messages?: EditorMessages;
42
+ }
43
+ /** Strict UTF-8 file parsing only. Never writes a model, fetches assets or initializes a document. */
44
+ export declare function importMarkdownFile(file: File, options?: MarkdownImportOptions): Promise<MarkdownImportResult>;
45
+ /** Snapshot raw source using getMarkdown(), then pass it here. Does not trigger a download. */
46
+ export declare function exportMarkdownFile(markdown: string, options?: MarkdownExportOptions): MarkdownExportResult;
47
+ //# sourceMappingURL=markdown-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-file.d.ts","sourceRoot":"","sources":["../../../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Q,EAAE,mBAAmB,EAAE,CAAA;CAChC;AACD,MAAM,WAAW,qBAAqB;IAAG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;AAWxG,sGAAsG;AACtG,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAuBvH;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,oBAAoB,CAG9G"}
@@ -0,0 +1,82 @@
1
+ import 'pdfjs-dist/legacy/build/pdf.worker.mjs';
2
+ import { type EditorMessages } from './i18n';
3
+ export declare const PDF_FILE_MIME: "application/pdf";
4
+ export declare const DEFAULT_PDF_IMPORT_MAX_BYTES: number;
5
+ export declare const DEFAULT_PDF_IMPORT_MAX_PAGES = 100;
6
+ export declare const DEFAULT_PDF_IMPORT_MAX_IMAGE_PIXELS = 40000000;
7
+ export declare const DEFAULT_PDF_IMPORT_TIMEOUT_MS = 30000;
8
+ export type PdfFileWarningCode = 'NO_TEXT_EXTRACTED' | 'COMPLEX_LAYOUT' | 'MULTI_COLUMN_LAYOUT' | 'COMPLEX_TABLE' | 'EXTERNAL_URL_SKIPPED' | 'UNSAFE_URL_SKIPPED' | 'IMAGE_EXTRACT_FAILED' | 'IMAGE_PIXEL_LIMIT' | 'RESOURCE_UNRESOLVED' | 'RESOURCE_RESOLUTION_FAILED' | 'FONT_FALLBACK' | 'MATH_DEGRADED' | 'UNSUPPORTED_CONTENT';
9
+ export interface PdfFileWarning {
10
+ code: PdfFileWarningCode;
11
+ message: string;
12
+ page?: number;
13
+ path?: string;
14
+ }
15
+ export type PdfFileErrorCode = 'READ_FAILED' | 'FILE_TOO_LARGE' | 'PAGE_LIMIT_EXCEEDED' | 'IMAGE_PIXEL_LIMIT' | 'INVALID_PDF' | 'PASSWORD_REQUIRED' | 'ABORTED' | 'TIMEOUT';
16
+ export declare class PdfFileError extends Error {
17
+ readonly code: PdfFileErrorCode;
18
+ readonly cause?: unknown;
19
+ constructor(code: PdfFileErrorCode, message: string, cause?: unknown);
20
+ }
21
+ export interface PdfImportOptions {
22
+ maxBytes?: number;
23
+ maxPages?: number;
24
+ maxImagePixels?: number;
25
+ timeoutMs?: number;
26
+ signal?: AbortSignal;
27
+ locale?: string;
28
+ messages?: EditorMessages;
29
+ }
30
+ export interface PdfImportResource {
31
+ key: string;
32
+ bytes: Uint8Array;
33
+ filename: string;
34
+ mimeType: string;
35
+ alt?: string;
36
+ }
37
+ export interface PdfImportResult {
38
+ ok: true;
39
+ markdown: string;
40
+ resources: PdfImportResource[];
41
+ metadata?: {
42
+ title?: string;
43
+ author?: string;
44
+ };
45
+ warnings: PdfFileWarning[];
46
+ }
47
+ export interface PdfExportOptions {
48
+ fileName?: string;
49
+ signal?: AbortSignal;
50
+ resolveResource?: (resource: {
51
+ path: string;
52
+ alt?: string;
53
+ }) => Promise<{
54
+ bytes: Blob | Uint8Array;
55
+ }>;
56
+ /** Optional embedded TTF/OTF font. Supplying a CJK font preserves Chinese glyphs. */
57
+ fontBytes?: Uint8Array | ArrayBuffer;
58
+ /** Whether to subset the embedded font. Disable for CJK fonts when the renderer has incomplete CMap support. */
59
+ fontSubset?: boolean;
60
+ fontName?: string;
61
+ margin?: number | {
62
+ top?: number;
63
+ right?: number;
64
+ bottom?: number;
65
+ left?: number;
66
+ };
67
+ pageSize?: [number, number];
68
+ locale?: string;
69
+ messages?: EditorMessages;
70
+ }
71
+ export interface PdfExportResult {
72
+ blob: Blob;
73
+ fileName: string;
74
+ mimeType: typeof PDF_FILE_MIME;
75
+ warnings: PdfFileWarning[];
76
+ }
77
+ export type PdfFileInput = Blob | File | ArrayBuffer | ArrayBufferView;
78
+ /** Extracts local PDF content only. It never uses PDF URLs, fetch, Doca APIs or Yjs. */
79
+ export declare function importPdfFile(file: PdfFileInput, options?: PdfImportOptions): Promise<PdfImportResult>;
80
+ /** Generates a PDF from Markdown without mounting or reading the editor DOM. */
81
+ export declare function exportPdfFile(markdown: string, options?: PdfExportOptions): Promise<PdfExportResult>;
82
+ //# sourceMappingURL=pdf-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-file.d.ts","sourceRoot":"","sources":["../../../src/editor/pdf-file.ts"],"names":[],"mappings":"AAIA,OAAO,wCAAwC,CAAA;AAI/C,OAAO,EAAiB,KAAK,cAAc,EAAkB,MAAM,QAAQ,CAAA;AAE3E,eAAO,MAAM,aAAa,EAAG,iBAA0B,CAAA;AACvD,eAAO,MAAM,4BAA4B,QAAmB,CAAA;AAC5D,eAAO,MAAM,4BAA4B,MAAM,CAAA;AAC/C,eAAO,MAAM,mCAAmC,WAAa,CAAA;AAC7D,eAAO,MAAM,6BAA6B,QAAS,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,gBAAgB,GAChB,qBAAqB,GACrB,eAAe,GACf,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,GACnB,qBAAqB,GACrB,4BAA4B,GAC5B,eAAe,GACf,eAAe,GACf,qBAAqB,CAAA;AAEzB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,gBAAgB,GAChB,qBAAqB,GACrB,mBAAmB,GACnB,aAAa,GACb,mBAAmB,GACnB,SAAS,GACT,SAAS,CAAA;AAEb,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;gBAEZ,IAAI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,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAClF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,aAAa,CAAA;IAC9B,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,WAAW,GAAG,eAAe,CAAA;AAsNtE,wFAAwF;AACxF,wBAAsB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAqHhH;AA0JD,gFAAgF;AAChF,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAgP9G"}
@@ -0,0 +1,22 @@
1
+ import type * as Y from 'yjs';
2
+ import { type PreviewMapping } from './preview-mapping';
3
+ import { type MarkdownCommentAnchor, type MarkdownTextAnchor } from './selection';
4
+ /** Forward this prop when wrapping MarkdownPreview. Custom renderers must provide their own precise mapping. */
5
+ export interface MarkdownPreviewInteraction {
6
+ attach(root: HTMLElement, mapping: PreviewMapping): () => void;
7
+ }
8
+ export interface PreviewController extends MarkdownPreviewInteraction {
9
+ capture(): MarkdownTextAnchor | null;
10
+ selectionRect(): DOMRect | null;
11
+ reveal(anchor: MarkdownTextAnchor): boolean;
12
+ setComments(comments: MarkdownCommentAnchor[]): void;
13
+ setActive(id: string | null): void;
14
+ clearSelection(): void;
15
+ }
16
+ export declare function createPreviewController(text: Y.Text, runtime: {
17
+ activate(): void;
18
+ isActive(): boolean;
19
+ selectionChanged(): void;
20
+ click(id: string): void;
21
+ }): PreviewController;
22
+ //# sourceMappingURL=preview-interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-interaction.d.ts","sourceRoot":"","sources":["../../../src/editor/preview-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,EAA4C,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACjG,OAAO,EAAuD,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEtI,gHAAgH;AAChH,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,IAAI,CAAA;CAC/D;AACD,MAAM,WAAW,iBAAkB,SAAQ,0BAA0B;IACnE,OAAO,IAAI,kBAAkB,GAAG,IAAI,CAAA;IACpC,aAAa,IAAI,OAAO,GAAG,IAAI,CAAA;IAC/B,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAA;IAC3C,WAAW,CAAC,QAAQ,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAA;IACpD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAClC,cAAc,IAAI,IAAI,CAAA;CACvB;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE;IAC7D,QAAQ,IAAI,IAAI,CAAA;IAChB,QAAQ,IAAI,OAAO,CAAA;IACnB,gBAAgB,IAAI,IAAI,CAAA;IACxB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB,GAAG,iBAAiB,CAmIpB"}
@@ -0,0 +1,45 @@
1
+ interface Point {
2
+ offset?: number;
3
+ line?: number;
4
+ }
5
+ interface AstNode {
6
+ type: string;
7
+ tagName?: string;
8
+ value?: string;
9
+ properties?: Record<string, unknown>;
10
+ children?: AstNode[];
11
+ position?: {
12
+ start?: Point;
13
+ end?: Point;
14
+ };
15
+ }
16
+ export interface PreviewCharacter {
17
+ from: number;
18
+ to: number;
19
+ }
20
+ export interface PreviewTextRun {
21
+ value: string;
22
+ characters: PreviewCharacter[];
23
+ }
24
+ export interface PreviewMapping {
25
+ source: string;
26
+ runs: Map<string, PreviewTextRun>;
27
+ }
28
+ /** Parser offsets, never a document/selection text search. UTF-16 matches DOM and Y.Text. */
29
+ export declare function createPreviewMapping(source: string): {
30
+ mapping: PreviewMapping;
31
+ beforeRaw: () => (tree: AstNode) => void;
32
+ afterSanitize: () => (tree: AstNode) => void;
33
+ };
34
+ export declare function previewTextNodes(root: HTMLElement, mapping: PreviewMapping): {
35
+ node: Text;
36
+ run: PreviewTextRun;
37
+ }[];
38
+ export declare function capturePreviewRange(root: HTMLElement, mapping: PreviewMapping): {
39
+ from: number;
40
+ to: number;
41
+ range: Range;
42
+ } | null;
43
+ export declare function projectPreviewRange(root: HTMLElement, mapping: PreviewMapping, from: number, to: number): Range[];
44
+ export {};
45
+ //# sourceMappingURL=preview-mapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-mapping.d.ts","sourceRoot":"","sources":["../../../src/editor/preview-mapping.ts"],"names":[],"mappings":"AAIA,UAAU,KAAK;IAAG,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;AAClD,UAAU,OAAO;IACf,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;IAC1D,QAAQ,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,GAAG,CAAC,EAAE,KAAK,CAAA;KAAE,CAAA;CAC1C;AACD,MAAM,WAAW,gBAAgB;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AAC9D,MAAM,WAAW,cAAc;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,gBAAgB,EAAE,CAAA;CAAE;AACjF,MAAM,WAAW,cAAc;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CAAE;AAErF,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM;;sBA2BxB,MAAM,OAAO;0BAuBT,MAAM,OAAO;EAiB3C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc;UAC7C,IAAI;SAAO,cAAc;IAQtD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,IAAI,CAyBjI;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,EAAE,CAajH"}
@@ -0,0 +1,20 @@
1
+ import * as Y from 'yjs';
2
+ export declare const COLLABORATION_PROTOCOL_VERSION = 1;
3
+ export declare const MARKDOWN_CODEC = "markdown-ytext";
4
+ export declare const MARKDOWN_SCHEMA_VERSION = 1;
5
+ export declare const MARKDOWN_TEXT_KEY = "markdown";
6
+ export declare const MARKDOWN_META_KEY = "exmd:meta";
7
+ export declare const TRANSACTION_ORIGINS: {
8
+ readonly bootstrap: symbol;
9
+ readonly remote: symbol;
10
+ };
11
+ export interface MarkdownDocumentMetadata {
12
+ codec: typeof MARKDOWN_CODEC;
13
+ schemaVersion: typeof MARKDOWN_SCHEMA_VERSION;
14
+ }
15
+ export declare function getMarkdownText(doc: Y.Doc): Y.Text;
16
+ export declare function readMarkdownMetadata(doc: Y.Doc): Partial<MarkdownDocumentMetadata>;
17
+ export declare function initializeMarkdownDocument(doc: Y.Doc, initialValue: string): void;
18
+ export declare function assertSupportedMarkdownDocument(doc: Y.Doc): void;
19
+ export declare function encodeMarkdownCheckpoint(doc: Y.Doc): Uint8Array;
20
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/editor/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,eAAO,MAAM,8BAA8B,IAAI,CAAA;AAC/C,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAC9C,eAAO,MAAM,uBAAuB,IAAI,CAAA;AACxC,eAAO,MAAM,iBAAiB,aAAa,CAAA;AAC3C,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAE5C,eAAO,MAAM,mBAAmB;;;CAEtB,CAAA;AAEV,MAAM,WAAW,wBAAwB;IAAG,KAAK,EAAE,OAAO,cAAc,CAAC;IAAC,aAAa,EAAE,OAAO,uBAAuB,CAAA;CAAE;AACzH,wBAAgB,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAA0C;AAC7F,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAIlF;AACD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAOjF;AACD,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,IAAI,CAIhE;AACD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,UAAU,CAAsC"}
@@ -0,0 +1,9 @@
1
+ import type { EditorView } from '@codemirror/view';
2
+ export type ScrollPoint = {
3
+ source: number;
4
+ target: number;
5
+ };
6
+ export declare function projectScroll(points: ScrollPoint[], position: number): number;
7
+ /** UI-only mapping. No selection dispatch or shared-document writes. */
8
+ export declare function bindCenterScroll(view: () => EditorView | undefined, source: HTMLElement, preview: HTMLElement): () => void;
9
+ //# sourceMappingURL=scroll-sync.d.ts.map