@lostgradient/cinder 0.16.0 → 0.17.0
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/CHANGELOG.md +191 -0
- package/README.md +33 -11
- package/components.json +53 -102
- package/dist/_internal/chart/chart-utilities.d.ts +1 -0
- package/dist/cli/index.js +63 -10
- package/dist/cli/mcp-dependencies.d.ts +4 -0
- package/dist/components/approval-card/approval-card.css +1 -6
- package/dist/components/approval-card/index.js +94 -55
- package/dist/components/area-chart/index.js +40 -6
- package/dist/components/bar-chart/index.js +132 -83
- package/dist/components/code-block/index.js +58 -9
- package/dist/components/command-menu/command-menu.css +9 -0
- package/dist/components/command-menu/index.js +7 -2
- package/dist/components/data-table/index.js +88 -31
- package/dist/components/diff-statistics/diff-statistics.svelte.d.ts +3 -3
- package/dist/components/file-upload/file-upload.schema.js +5 -1
- package/dist/components/file-upload/file-upload.types.d.ts +2 -0
- package/dist/components/file-upload/index.js +37 -27
- package/dist/components/invocation-rule-builder/index.d.ts +1 -1
- package/dist/components/invocation-rule-builder/index.js +244 -199
- package/dist/components/invocation-rule-builder/invocation-rule-builder.css +8 -0
- package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.d.ts +2 -2
- package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.js +309 -193
- package/dist/components/invocation-rule-builder/invocation-rule-builder.svelte.d.ts +3 -2
- package/dist/components/invocation-rule-builder/invocation-rule-builder.types.d.ts +98 -31
- package/dist/components/json-editor/index.d.ts +5 -0
- package/dist/components/json-editor/index.js +261 -0
- package/dist/components/json-editor/json-editor.css +49 -0
- package/dist/components/{diff-viewer/diff-viewer.schema.js → json-editor/json-editor.schema.js} +37 -49
- package/dist/components/json-editor/json-editor.svelte.d.ts +21 -0
- package/dist/components/json-editor/json-editor.types.d.ts +25 -0
- package/dist/components/{diff-viewer/diff-viewer.variables.js → json-editor/json-editor.variables.js} +4 -4
- package/dist/components/json-schema-editor/index.js +2041 -4165
- package/dist/components/json-schema-editor/json-schema-editor-state.svelte.d.ts +17 -1
- package/dist/components/json-schema-editor/json-schema-editor-types.d.ts +8 -1
- package/dist/components/json-schema-editor/json-schema-editor.css +35 -0
- package/dist/components/json-schema-editor/json-schema-editor.svelte.d.ts +0 -1
- package/dist/components/json-schema-editor/json-schema-validator.d.ts +9 -4
- package/dist/components/line-chart/index.js +40 -6
- package/dist/components/matrix-chart/index.js +40 -6
- package/dist/components/payload-inspector/index.js +10 -2
- package/dist/components/payload-inspector/payload-inspector.schema.js +11 -1
- package/dist/components/payload-inspector/payload-inspector.types.d.ts +20 -0
- package/dist/components/run-step-timeline/index.js +158 -110
- package/dist/components/run-step-timeline/run-step-timeline.css +46 -0
- package/dist/components/run-step-timeline/run-step-timeline.schema.js +26 -1
- package/dist/components/run-step-timeline/run-step-timeline.types.d.ts +22 -2
- package/dist/components/schedule-builder/index.js +165 -93
- package/dist/components/schedule-builder/schedule-builder.schema.js +8 -1
- package/dist/components/schedule-builder/schedule-builder.svelte.d.ts +1 -1
- package/dist/components/schedule-builder/schedule-builder.types.d.ts +12 -0
- package/dist/components/schema-form/index.d.ts +1 -1
- package/dist/components/schema-form/index.js +107 -25
- package/dist/components/schema-form/schema-form.schema.js +9 -1
- package/dist/components/schema-form/schema-form.svelte.d.ts +1 -1
- package/dist/components/schema-form/schema-form.types.d.ts +8 -0
- package/dist/components/sidebar/index.js +93 -42
- package/dist/components/sidebar/sidebar.css +7 -16
- package/dist/components/sidebar/sidebar.schema.js +8 -9
- package/dist/components/sidebar/sidebar.types.d.ts +14 -12
- package/dist/components/source-diff-viewer/source-diff-viewer.svelte.d.ts +2 -2
- package/dist/components/spectrogram/index.js +40 -6
- package/dist/components/spectrum-chart/index.js +40 -6
- package/dist/components/table/index.js +85 -28
- package/dist/components/table/table.css +11 -0
- package/dist/components/table/table.schema.js +10 -1
- package/dist/components/table/table.types.d.ts +24 -1
- package/dist/components/tabs/tabs.css +2 -0
- package/dist/components/textarea/textarea.svelte.d.ts +1 -1
- package/dist/components/toast-region/index.js +2 -2
- package/dist/components/toast-region/toast-region.css +1 -1
- package/dist/components/waveform/index.js +40 -6
- package/dist/highlighters/shiki/index.d.ts +47 -5
- package/dist/highlighters/shiki/index.js +58 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.js +15394 -16128
- package/dist/server/components/access-gate/index.js +2 -5
- package/dist/server/components/approval-card/index.js +2 -2
- package/dist/server/components/area-chart/index.js +3 -3
- package/dist/server/components/bar-chart/index.js +3 -3
- package/dist/server/components/command-menu/index.js +1 -1
- package/dist/server/components/context-menu/index.js +5 -5
- package/dist/server/components/data-table/index.js +3 -3
- package/dist/server/components/diff-statistics/index.js +3 -5
- package/dist/server/components/dropdown/index.js +6 -7
- package/dist/server/components/file-upload/index.js +2 -3
- package/dist/server/components/icons/index.js +17 -26
- package/dist/server/components/inline-loading/index.js +1 -1
- package/dist/server/components/invocation-rule-builder/index.js +1 -1
- package/dist/server/components/json-editor/index.js +13 -0
- package/dist/server/components/json-schema-editor/index.js +4 -16
- package/dist/server/components/line-chart/index.js +3 -3
- package/dist/server/components/matrix-chart/index.js +2 -2
- package/dist/server/components/menu-bar/index.js +4 -4
- package/dist/server/components/payload-inspector/index.js +2 -2
- package/dist/server/components/run-step-timeline/index.js +1 -1
- package/dist/server/components/schedule-builder/index.js +3 -3
- package/dist/server/components/schema-form/index.js +1 -1
- package/dist/server/components/selection-popover/index.js +3 -5
- package/dist/server/components/sidebar/index.js +1 -1
- package/dist/server/components/spectrogram/index.js +2 -2
- package/dist/server/components/spectrum-chart/index.js +2 -2
- package/dist/server/components/surface/index.js +3 -5
- package/dist/server/components/table/index.js +3 -3
- package/dist/server/components/tabs/index.js +5 -5
- package/dist/server/components/toast-region/index.js +1 -1
- package/dist/server/components/toolbar/index.js +2 -3
- package/dist/server/components/waveform/index.js +2 -2
- package/dist/server/highlighters/shiki/index.js +61 -25
- package/dist/server/index.js +106 -116
- package/dist/server/{index.server-7yfz2t73.js → index.server-003t81xk.js} +1 -1
- package/dist/server/{index.server-mehav5vs.js → index.server-032p855q.js} +5 -5
- package/dist/server/{index.server-tf2n3ccm.js → index.server-1vfhzhkj.js} +1 -1
- package/dist/server/{index.server-jz5yxwde.js → index.server-4cbqjf14.js} +16 -7
- package/dist/server/{index.server-aqethy0w.js → index.server-66nm5gd5.js} +102 -26
- package/dist/server/{index.server-m0ezemav.js → index.server-6mnbznbt.js} +4 -2
- package/dist/server/{index.server-1nq8h5yb.js → index.server-6vbpz6dd.js} +40 -6
- package/dist/server/{index.server-796hb0r8.js → index.server-7qak74fg.js} +1 -1
- package/dist/server/{index.server-5exh7rmw.js → index.server-7ygdwxre.js} +57 -5
- package/dist/server/{index.server-q1d48s9t.js → index.server-8c6cck0y.js} +6 -4
- package/dist/server/index.server-93vt8ktj.js +95 -0
- package/dist/server/{index.server-ep81fn23.js → index.server-9eccb2fc.js} +2 -2
- package/dist/server/{index.server-zncgb7mw.js → index.server-9nac5z11.js} +92 -49
- package/dist/server/{index.server-bf7d81b4.js → index.server-9vqfmhez.js} +16 -18
- package/dist/server/{index.server-nt304e00.js → index.server-dx58qant.js} +1 -1
- package/dist/server/{index.server-zh3r8vfd.js → index.server-fhrqsg97.js} +1 -1
- package/dist/server/{index.server-dq0k0qf6.js → index.server-geq56xaz.js} +10 -10
- package/dist/server/{index.server-51sxnete.js → index.server-hxveaqg1.js} +10 -10
- package/dist/server/{index.server-c5qv3p61.js → index.server-j87v28yy.js} +59 -30
- package/dist/server/{index.server-s5g7reqp.js → index.server-mewms9dg.js} +2 -2
- package/dist/server/index.server-mm728d0w.js +20 -0
- package/dist/server/{index.server-5mc2vsy0.js → index.server-n0rbn5yf.js} +4 -2
- package/dist/server/{index.server-qv0kkre4.js → index.server-ng8y854r.js} +188 -107
- package/dist/server/{index.server-ne4gzxvz.js → index.server-q5gvb174.js} +5 -5
- package/dist/server/{index.server-g5jgq3jp.js → index.server-qxneqxf8.js} +40 -6
- package/dist/server/{index.server-x1dha7bk.js → index.server-rnddtcb3.js} +4 -2
- package/dist/server/{index.server-7zpzspk6.js → index.server-s4wm4g2a.js} +30 -2
- package/dist/server/index.server-szgghcdh.js +887 -0
- package/dist/server/{index.server-thcda9ny.js → index.server-vd302sxz.js} +11 -4
- package/dist/server/{index.server-3sq9d73w.js → index.server-vz9hqkdq.js} +2 -2
- package/dist/server/{index.server-mvjzcna5.js → index.server-wg6ddzpa.js} +42 -20
- package/dist/server/index.server-xanq9ppe.js +119 -0
- package/dist/server/{index.server-67q8dmbp.js → index.server-y2ncgt7p.js} +1 -1
- package/dist/server/{index.server-4x91gzy1.js → index.server-yqhww50r.js} +4 -4
- package/dist/server/{index.server-7798gc22.js → index.server-zfx4magq.js} +4 -2
- package/package.json +45 -288
- package/src/_internal/chart/chart-utilities.ts +74 -5
- package/src/components/approval-card/approval-card-actions.svelte +12 -28
- package/src/components/approval-card/approval-card.css +1 -6
- package/src/components/bar-chart/bar-chart.examples.json +1 -1
- package/src/components/bar-chart/bar-chart.svelte +3 -1
- package/src/components/command-menu/command-menu.css +9 -0
- package/src/components/command-menu/command-menu.svelte +9 -2
- package/src/components/file-upload/file-upload.schema.json +4 -0
- package/src/components/file-upload/file-upload.schema.ts +4 -0
- package/src/components/file-upload/file-upload.svelte +3 -3
- package/src/components/file-upload/file-upload.types.ts +2 -0
- package/src/components/invocation-rule-builder/index.ts +1 -0
- package/src/components/invocation-rule-builder/invocation-rule-builder.css +8 -0
- package/src/components/invocation-rule-builder/invocation-rule-builder.examples.json +6 -0
- package/src/components/invocation-rule-builder/invocation-rule-builder.schema.json +70 -7
- package/src/components/invocation-rule-builder/invocation-rule-builder.schema.ts +5 -250
- package/src/components/invocation-rule-builder/invocation-rule-builder.svelte +106 -83
- package/src/components/invocation-rule-builder/invocation-rule-builder.types.ts +145 -62
- package/src/components/json-editor/index.ts +6 -0
- package/src/components/json-editor/json-editor.css +49 -0
- package/src/components/json-editor/json-editor.examples.json +13 -0
- package/src/components/json-editor/json-editor.schema.json +57 -0
- package/src/components/json-editor/json-editor.schema.ts +62 -0
- package/src/components/json-editor/json-editor.svelte +104 -0
- package/src/components/json-editor/json-editor.types.ts +29 -0
- package/src/components/json-schema-editor/diff-view.svelte +26 -8
- package/src/components/json-schema-editor/form-view.svelte +1 -1
- package/src/components/json-schema-editor/json-schema-editor-state.svelte.ts +163 -56
- package/src/components/json-schema-editor/json-schema-editor-types.ts +8 -1
- package/src/components/json-schema-editor/json-schema-editor.css +35 -0
- package/src/components/json-schema-editor/json-schema-validator.ts +59 -25
- package/src/components/json-schema-editor/json-view.svelte +52 -18
- package/src/components/payload-inspector/payload-inspector.schema.json +8 -0
- package/src/components/payload-inspector/payload-inspector.schema.ts +10 -0
- package/src/components/payload-inspector/payload-inspector.svelte +2 -2
- package/src/components/payload-inspector/payload-inspector.types.ts +20 -0
- package/src/components/run-step-timeline/run-step-timeline.css +46 -0
- package/src/components/run-step-timeline/run-step-timeline.examples.json +3 -3
- package/src/components/run-step-timeline/run-step-timeline.schema.json +24 -0
- package/src/components/run-step-timeline/run-step-timeline.schema.ts +26 -0
- package/src/components/run-step-timeline/run-step-timeline.svelte +41 -4
- package/src/components/run-step-timeline/run-step-timeline.types.ts +22 -1
- package/src/components/run-step-timeline/run-step-timeline.utilities.ts +9 -1
- package/src/components/schedule-builder/schedule-builder.schema.json +7 -0
- package/src/components/schedule-builder/schedule-builder.schema.ts +8 -0
- package/src/components/schedule-builder/schedule-builder.svelte +94 -22
- package/src/components/schedule-builder/schedule-builder.types.ts +12 -0
- package/src/components/schema-form/index.ts +1 -0
- package/src/components/schema-form/schema-form-body.svelte +94 -17
- package/src/components/schema-form/schema-form.examples.json +1 -1
- package/src/components/schema-form/schema-form.schema.json +5 -0
- package/src/components/schema-form/schema-form.schema.ts +6 -0
- package/src/components/schema-form/schema-form.svelte +4 -0
- package/src/components/schema-form/schema-form.types.ts +9 -0
- package/src/components/side-navigation/side-navigation.examples.json +1 -1
- package/src/components/sidebar/sidebar.css +7 -16
- package/src/components/sidebar/sidebar.examples.json +3 -3
- package/src/components/sidebar/sidebar.schema.json +7 -8
- package/src/components/sidebar/sidebar.schema.ts +8 -8
- package/src/components/sidebar/sidebar.svelte +65 -27
- package/src/components/sidebar/sidebar.types.ts +14 -12
- package/src/components/table/table.css +11 -0
- package/src/components/table/table.examples.json +3 -3
- package/src/components/table/table.schema.json +9 -0
- package/src/components/table/table.schema.ts +11 -0
- package/src/components/table/table.svelte +58 -14
- package/src/components/table/table.types.ts +27 -1
- package/src/components/tabs/tabs.css +2 -0
- package/src/components/toast-region/toast-region.css +1 -1
- package/src/components/toast-region/toast-region.examples.json +1 -1
- package/src/components/toast-region/toast-region.svelte +2 -2
- package/src/highlighters/shiki/index.ts +157 -17
- package/src/index.ts +5 -7
- package/src/styles/components.css +1 -1
- package/src/utilities/change-tracker.svelte.ts +1 -1
- package/dist/commentary/anchor-decorations.d.ts +0 -86
- package/dist/commentary/anchor-decorations.js +0 -490
- package/dist/commentary/anchoring.d.ts +0 -93
- package/dist/commentary/anchoring.js +0 -157
- package/dist/commentary/comments/index.d.ts +0 -12
- package/dist/commentary/comments/index.js +0 -14
- package/dist/commentary/comments/mentions.d.ts +0 -43
- package/dist/commentary/comments/mentions.js +0 -65
- package/dist/commentary/comments/reanchor.d.ts +0 -86
- package/dist/commentary/comments/reanchor.js +0 -220
- package/dist/commentary/comments/types.d.ts +0 -260
- package/dist/commentary/comments/types.js +0 -83
- package/dist/commentary/comments/updates.d.ts +0 -102
- package/dist/commentary/comments/updates.js +0 -226
- package/dist/commentary/export/comments-export.d.ts +0 -42
- package/dist/commentary/export/comments-export.js +0 -258
- package/dist/commentary/export/index.d.ts +0 -12
- package/dist/commentary/export/index.js +0 -12
- package/dist/commentary/export/markdown-summary.d.ts +0 -31
- package/dist/commentary/export/markdown-summary.js +0 -218
- package/dist/commentary/export/types.d.ts +0 -162
- package/dist/commentary/export/types.js +0 -7
- package/dist/commentary/export/unified-diff.d.ts +0 -28
- package/dist/commentary/export/unified-diff.js +0 -250
- package/dist/commentary/index.d.ts +0 -6
- package/dist/commentary/index.js +0 -6
- package/dist/commentary/session/index.d.ts +0 -12
- package/dist/commentary/session/index.js +0 -14
- package/dist/commentary/session/persistence.d.ts +0 -92
- package/dist/commentary/session/persistence.js +0 -253
- package/dist/commentary/session/types.d.ts +0 -208
- package/dist/commentary/session/types.js +0 -26
- package/dist/commentary/session/updates.d.ts +0 -155
- package/dist/commentary/session/updates.js +0 -362
- package/dist/commentary/shared/anchor-types.d.ts +0 -116
- package/dist/commentary/shared/anchor-types.js +0 -9
- package/dist/components/diff-viewer/diff-controller.svelte.d.ts +0 -75
- package/dist/components/diff-viewer/diff-front-matter.svelte.d.ts +0 -28
- package/dist/components/diff-viewer/diff-line.svelte.d.ts +0 -22
- package/dist/components/diff-viewer/diff-summary-bar.svelte.d.ts +0 -13
- package/dist/components/diff-viewer/diff-toolbar.svelte.d.ts +0 -36
- package/dist/components/diff-viewer/diff-viewer.svelte.d.ts +0 -22
- package/dist/components/diff-viewer/diff-viewer.types.d.ts +0 -53
- package/dist/components/diff-viewer/front-matter-header.svelte.d.ts +0 -26
- package/dist/components/diff-viewer/index.d.ts +0 -4
- package/dist/components/diff-viewer/index.js +0 -2848
- package/dist/components/markdown-editor/editor-skeleton.svelte.d.ts +0 -10
- package/dist/components/markdown-editor/editor-toolbar/editor-toolbar.svelte.d.ts +0 -37
- package/dist/components/markdown-editor/editor-toolbar/index.d.ts +0 -11
- package/dist/components/markdown-editor/editor-toolbar/link-popover.svelte.d.ts +0 -30
- package/dist/components/markdown-editor/editor-toolbar/toolbar-button.svelte.d.ts +0 -19
- package/dist/components/markdown-editor/editor-toolbar/toolbar-dropdown.svelte.d.ts +0 -24
- package/dist/components/markdown-editor/editor-toolbar/toolbar-separator.svelte.d.ts +0 -7
- package/dist/components/markdown-editor/editor-toolbar/types.d.ts +0 -13
- package/dist/components/markdown-editor/index.css +0 -61
- package/dist/components/markdown-editor/index.d.ts +0 -4
- package/dist/components/markdown-editor/index.js +0 -7494
- package/dist/components/markdown-editor/markdown-editor.schema.d.ts +0 -3
- package/dist/components/markdown-editor/markdown-editor.schema.js +0 -177
- package/dist/components/markdown-editor/markdown-editor.svelte.d.ts +0 -29
- package/dist/components/markdown-editor/markdown-editor.types.d.ts +0 -100
- package/dist/components/markdown-editor/markdown-editor.variables.d.ts +0 -2
- package/dist/components/markdown-editor/markdown-editor.variables.js +0 -61
- package/dist/components/review-editor/comment-composer.svelte.d.ts +0 -37
- package/dist/components/review-editor/comment-list.svelte.d.ts +0 -19
- package/dist/components/review-editor/comment-sidebar.svelte.d.ts +0 -22
- package/dist/components/review-editor/export-actions.svelte.d.ts +0 -18
- package/dist/components/review-editor/focus-navigation.d.ts +0 -105
- package/dist/components/review-editor/front-matter-fields.svelte.d.ts +0 -10
- package/dist/components/review-editor/index.d.ts +0 -20
- package/dist/components/review-editor/index.js +0 -14731
- package/dist/components/review-editor/live-region.svelte.d.ts +0 -23
- package/dist/components/review-editor/review-editor-anchors.svelte.d.ts +0 -96
- package/dist/components/review-editor/review-editor-controls.svelte.d.ts +0 -41
- package/dist/components/review-editor/review-editor-exports.d.ts +0 -80
- package/dist/components/review-editor/review-editor-front-matter.d.ts +0 -28
- package/dist/components/review-editor/review-editor-impl.svelte.d.ts +0 -31
- package/dist/components/review-editor/review-editor-selection-geometry.d.ts +0 -10
- package/dist/components/review-editor/review-editor-selection-types.d.ts +0 -62
- package/dist/components/review-editor/review-editor-selection.svelte.d.ts +0 -50
- package/dist/components/review-editor/review-editor-state.svelte.d.ts +0 -77
- package/dist/components/review-editor/review-editor-threads.svelte.d.ts +0 -137
- package/dist/components/review-editor/review-editor.css +0 -273
- package/dist/components/review-editor/review-editor.schema.d.ts +0 -3
- package/dist/components/review-editor/review-editor.schema.js +0 -143
- package/dist/components/review-editor/review-editor.svelte.d.ts +0 -19
- package/dist/components/review-editor/review-editor.types.d.ts +0 -77
- package/dist/components/review-editor/review-editor.variables.d.ts +0 -2
- package/dist/components/review-editor/review-editor.variables.js +0 -61
- package/dist/components/review-editor/thread-popover.svelte.d.ts +0 -32
- package/dist/diff/index.d.ts +0 -2
- package/dist/diff/index.js +0 -1
- package/dist/diff/line-diff.d.ts +0 -84
- package/dist/diff/line-diff.js +0 -372
- package/dist/diff/types.d.ts +0 -1
- package/dist/diff/types.js +0 -1
- package/dist/editor/attach.d.ts +0 -30
- package/dist/editor/attach.js +0 -86
- package/dist/editor/bridge.d.ts +0 -110
- package/dist/editor/bridge.js +0 -260
- package/dist/editor/clipboard.d.ts +0 -19
- package/dist/editor/clipboard.js +0 -189
- package/dist/editor/commands.d.ts +0 -167
- package/dist/editor/commands.js +0 -728
- package/dist/editor/component-runtime.d.ts +0 -21
- package/dist/editor/component-runtime.js +0 -20
- package/dist/editor/editor.d.ts +0 -23
- package/dist/editor/editor.js +0 -256
- package/dist/editor/index.d.ts +0 -30
- package/dist/editor/index.js +0 -42
- package/dist/editor/keymap-plugin.d.ts +0 -56
- package/dist/editor/keymap-plugin.js +0 -157
- package/dist/editor/link-input-rule.d.ts +0 -4
- package/dist/editor/link-input-rule.js +0 -26
- package/dist/editor/milkdown-plugin-runtime.d.ts +0 -20
- package/dist/editor/milkdown-plugin-runtime.js +0 -43
- package/dist/editor/placeholder-security.d.ts +0 -22
- package/dist/editor/placeholder-security.js +0 -36
- package/dist/editor/placeholder.d.ts +0 -14
- package/dist/editor/placeholder.js +0 -56
- package/dist/editor/sanitize-html.d.ts +0 -32
- package/dist/editor/sanitize-html.js +0 -111
- package/dist/editor/template-completion-plugin.d.ts +0 -159
- package/dist/editor/template-completion-plugin.js +0 -615
- package/dist/editor/template-invalid-decoration-plugin.d.ts +0 -73
- package/dist/editor/template-invalid-decoration-plugin.js +0 -155
- package/dist/editor/template-placeholders.d.ts +0 -96
- package/dist/editor/template-placeholders.js +0 -355
- package/dist/editor/template-position-utilities.d.ts +0 -34
- package/dist/editor/template-position-utilities.js +0 -63
- package/dist/editor/template-render.d.ts +0 -37
- package/dist/editor/template-render.js +0 -45
- package/dist/editor/test-utilities.d.ts +0 -49
- package/dist/editor/test-utilities.js +0 -93
- package/dist/editor/types.d.ts +0 -234
- package/dist/editor/types.js +0 -8
- package/dist/markdown/diff/compute.d.ts +0 -28
- package/dist/markdown/diff/compute.js +0 -250
- package/dist/markdown/diff/frontmatter.d.ts +0 -66
- package/dist/markdown/diff/frontmatter.js +0 -135
- package/dist/markdown/diff/index.d.ts +0 -27
- package/dist/markdown/diff/index.js +0 -28
- package/dist/markdown/diff/line-diff.d.ts +0 -2
- package/dist/markdown/diff/line-diff.js +0 -1
- package/dist/markdown/diff/positions.d.ts +0 -66
- package/dist/markdown/diff/positions.js +0 -147
- package/dist/markdown/diff/types.d.ts +0 -78
- package/dist/markdown/diff/types.js +0 -7
- package/dist/markdown/index.d.ts +0 -2
- package/dist/markdown/index.js +0 -8
- package/dist/markdown/pipeline/ast.d.ts +0 -302
- package/dist/markdown/pipeline/ast.js +0 -417
- package/dist/markdown/pipeline/errors.d.ts +0 -37
- package/dist/markdown/pipeline/errors.js +0 -49
- package/dist/markdown/pipeline/frontmatter.d.ts +0 -127
- package/dist/markdown/pipeline/frontmatter.js +0 -438
- package/dist/markdown/pipeline/index.d.ts +0 -37
- package/dist/markdown/pipeline/index.js +0 -40
- package/dist/markdown/pipeline/parser.d.ts +0 -65
- package/dist/markdown/pipeline/parser.js +0 -106
- package/dist/markdown/pipeline/serializer.d.ts +0 -67
- package/dist/markdown/pipeline/serializer.js +0 -78
- package/dist/markdown/pipeline/strip-positions.d.ts +0 -20
- package/dist/markdown/pipeline/strip-positions.js +0 -28
- package/dist/markdown/pipeline/types.d.ts +0 -116
- package/dist/markdown/pipeline/types.js +0 -8
- package/dist/markdown/rendering/extract-code-blocks.d.ts +0 -16
- package/dist/markdown/rendering/extract-code-blocks.js +0 -27
- package/dist/markdown/rendering/highlighter.d.ts +0 -109
- package/dist/markdown/rendering/highlighter.js +0 -251
- package/dist/markdown/rendering/index.d.ts +0 -41
- package/dist/markdown/rendering/index.js +0 -46
- package/dist/markdown/rendering/mermaid-cache.d.ts +0 -55
- package/dist/markdown/rendering/mermaid-cache.js +0 -123
- package/dist/markdown/rendering/rehype-shiki-sync.d.ts +0 -57
- package/dist/markdown/rendering/rehype-shiki-sync.js +0 -354
- package/dist/markdown/rendering/render-async.d.ts +0 -43
- package/dist/markdown/rendering/render-async.js +0 -114
- package/dist/markdown/rendering/render-streaming.d.ts +0 -33
- package/dist/markdown/rendering/render-streaming.js +0 -123
- package/dist/markdown/rendering/render-worker.d.ts +0 -19
- package/dist/markdown/rendering/render-worker.js +0 -35
- package/dist/markdown/rendering/render.d.ts +0 -123
- package/dist/markdown/rendering/render.js +0 -477
- package/dist/markdown/rendering/sanitize-schema.d.ts +0 -24
- package/dist/markdown/rendering/sanitize-schema.js +0 -105
- package/dist/markdown/rendering/transform-urls.d.ts +0 -37
- package/dist/markdown/rendering/transform-urls.js +0 -51
- package/dist/markdown/rendering/types.d.ts +0 -51
- package/dist/markdown/rendering/types.js +0 -8
- package/dist/markdown/rendering/worker-dom-shim.d.ts +0 -87
- package/dist/markdown/rendering/worker-dom-shim.js +0 -50
- package/dist/markdown/utilities/safe-url.d.ts +0 -100
- package/dist/markdown/utilities/safe-url.js +0 -236
- package/dist/markdown/utilities/sort-keys.d.ts +0 -19
- package/dist/markdown/utilities/sort-keys.js +0 -33
- package/dist/server/commentary/anchor-decorations.js +0 -490
- package/dist/server/commentary/anchoring.js +0 -157
- package/dist/server/commentary/comments/index.js +0 -14
- package/dist/server/commentary/comments/mentions.js +0 -65
- package/dist/server/commentary/comments/reanchor.js +0 -220
- package/dist/server/commentary/comments/types.js +0 -83
- package/dist/server/commentary/comments/updates.js +0 -226
- package/dist/server/commentary/export/comments-export.js +0 -258
- package/dist/server/commentary/export/index.js +0 -12
- package/dist/server/commentary/export/markdown-summary.js +0 -218
- package/dist/server/commentary/export/types.js +0 -7
- package/dist/server/commentary/export/unified-diff.js +0 -250
- package/dist/server/commentary/index.js +0 -6
- package/dist/server/commentary/session/index.js +0 -14
- package/dist/server/commentary/session/persistence.js +0 -253
- package/dist/server/commentary/session/types.js +0 -26
- package/dist/server/commentary/session/updates.js +0 -362
- package/dist/server/commentary/shared/anchor-types.js +0 -9
- package/dist/server/components/diff-viewer/index.js +0 -33
- package/dist/server/components/markdown-editor/index.js +0 -52
- package/dist/server/components/review-editor/index.js +0 -3493
- package/dist/server/diff/index.js +0 -1
- package/dist/server/diff/line-diff.js +0 -372
- package/dist/server/diff/types.js +0 -1
- package/dist/server/editor/attach.js +0 -86
- package/dist/server/editor/bridge.js +0 -260
- package/dist/server/editor/clipboard.js +0 -189
- package/dist/server/editor/commands.js +0 -728
- package/dist/server/editor/component-runtime.js +0 -20
- package/dist/server/editor/editor.js +0 -256
- package/dist/server/editor/index.js +0 -42
- package/dist/server/editor/keymap-plugin.js +0 -157
- package/dist/server/editor/link-input-rule.js +0 -26
- package/dist/server/editor/milkdown-plugin-runtime.js +0 -43
- package/dist/server/editor/placeholder-security.js +0 -36
- package/dist/server/editor/placeholder.js +0 -56
- package/dist/server/editor/sanitize-html.js +0 -111
- package/dist/server/editor/template-completion-plugin.js +0 -615
- package/dist/server/editor/template-invalid-decoration-plugin.js +0 -155
- package/dist/server/editor/template-placeholders.js +0 -355
- package/dist/server/editor/template-position-utilities.js +0 -63
- package/dist/server/editor/template-render.js +0 -45
- package/dist/server/editor/test-utilities.js +0 -93
- package/dist/server/editor/types.js +0 -8
- package/dist/server/index.server-25wmev4e.js +0 -2
- package/dist/server/index.server-2c56kqws.js +0 -187
- package/dist/server/index.server-45n4s30n.js +0 -35
- package/dist/server/index.server-4jkqgp17.js +0 -1026
- package/dist/server/index.server-8nm871y8.js +0 -176
- package/dist/server/index.server-d04aj37r.js +0 -62
- package/dist/server/index.server-dg19y3m7.js +0 -9
- package/dist/server/index.server-g3726bja.js +0 -9
- package/dist/server/index.server-gyzmkrnz.js +0 -2
- package/dist/server/index.server-jp19145t.js +0 -9
- package/dist/server/index.server-mzj20rfz.js +0 -77
- package/dist/server/index.server-n4jxy52q.js +0 -2
- package/dist/server/index.server-sghkqw5x.js +0 -421
- package/dist/server/index.server-w6am2dxc.js +0 -12
- package/dist/server/index.server-x66zvjfc.js +0 -1163
- package/dist/server/index.server-zdhv33ph.js +0 -124
- package/dist/server/index.server-zke5zt13.js +0 -9
- package/dist/server/markdown/diff/compute.js +0 -250
- package/dist/server/markdown/diff/frontmatter.js +0 -135
- package/dist/server/markdown/diff/index.js +0 -28
- package/dist/server/markdown/diff/line-diff.js +0 -1
- package/dist/server/markdown/diff/positions.js +0 -147
- package/dist/server/markdown/diff/types.js +0 -7
- package/dist/server/markdown/index.js +0 -8
- package/dist/server/markdown/pipeline/ast.js +0 -417
- package/dist/server/markdown/pipeline/errors.js +0 -49
- package/dist/server/markdown/pipeline/frontmatter.js +0 -438
- package/dist/server/markdown/pipeline/index.js +0 -40
- package/dist/server/markdown/pipeline/parser.js +0 -106
- package/dist/server/markdown/pipeline/serializer.js +0 -78
- package/dist/server/markdown/pipeline/strip-positions.js +0 -28
- package/dist/server/markdown/pipeline/types.js +0 -8
- package/dist/server/markdown/rendering/extract-code-blocks.js +0 -27
- package/dist/server/markdown/rendering/highlighter.js +0 -251
- package/dist/server/markdown/rendering/index.js +0 -46
- package/dist/server/markdown/rendering/mermaid-cache.js +0 -123
- package/dist/server/markdown/rendering/rehype-shiki-sync.js +0 -354
- package/dist/server/markdown/rendering/render-async.js +0 -114
- package/dist/server/markdown/rendering/render-streaming.js +0 -123
- package/dist/server/markdown/rendering/render-worker.js +0 -35
- package/dist/server/markdown/rendering/render.js +0 -477
- package/dist/server/markdown/rendering/sanitize-schema.js +0 -105
- package/dist/server/markdown/rendering/transform-urls.js +0 -51
- package/dist/server/markdown/rendering/types.js +0 -8
- package/dist/server/markdown/rendering/worker-dom-shim.js +0 -50
- package/dist/server/markdown/utilities/safe-url.js +0 -236
- package/dist/server/markdown/utilities/sort-keys.js +0 -33
- package/src/components/diff-viewer/diff-controller.svelte.ts +0 -250
- package/src/components/diff-viewer/diff-front-matter.svelte +0 -52
- package/src/components/diff-viewer/diff-line.svelte +0 -340
- package/src/components/diff-viewer/diff-summary-bar.svelte +0 -106
- package/src/components/diff-viewer/diff-toolbar.svelte +0 -182
- package/src/components/diff-viewer/diff-viewer.examples.json +0 -25
- package/src/components/diff-viewer/diff-viewer.schema.json +0 -61
- package/src/components/diff-viewer/diff-viewer.schema.ts +0 -70
- package/src/components/diff-viewer/diff-viewer.svelte +0 -400
- package/src/components/diff-viewer/diff-viewer.types.ts +0 -56
- package/src/components/diff-viewer/front-matter-header.svelte +0 -137
- package/src/components/diff-viewer/index.ts +0 -5
- package/src/components/markdown-editor/editor-skeleton.svelte +0 -85
- package/src/components/markdown-editor/editor-toolbar/editor-toolbar.svelte +0 -318
- package/src/components/markdown-editor/editor-toolbar/index.ts +0 -18
- package/src/components/markdown-editor/editor-toolbar/link-popover.svelte +0 -314
- package/src/components/markdown-editor/editor-toolbar/toolbar-button.svelte +0 -97
- package/src/components/markdown-editor/editor-toolbar/toolbar-dropdown.svelte +0 -106
- package/src/components/markdown-editor/editor-toolbar/toolbar-separator.svelte +0 -30
- package/src/components/markdown-editor/editor-toolbar/types.ts +0 -15
- package/src/components/markdown-editor/index.ts +0 -10
- package/src/components/markdown-editor/markdown-editor.examples.json +0 -19
- package/src/components/markdown-editor/markdown-editor.schema.json +0 -111
- package/src/components/markdown-editor/markdown-editor.schema.ts +0 -122
- package/src/components/markdown-editor/markdown-editor.svelte +0 -872
- package/src/components/markdown-editor/markdown-editor.types.ts +0 -124
- package/src/components/markdown-editor/markdown-editor.variables.json +0 -1
- package/src/components/markdown-editor/markdown-editor.variables.ts +0 -3
- package/src/components/markdown-editor/prosemirror.css +0 -76
- package/src/components/review-editor/comment-composer.svelte +0 -271
- package/src/components/review-editor/comment-list.svelte +0 -311
- package/src/components/review-editor/comment-sidebar.svelte +0 -449
- package/src/components/review-editor/export-actions.svelte +0 -188
- package/src/components/review-editor/focus-navigation.ts +0 -220
- package/src/components/review-editor/front-matter-fields.svelte +0 -159
- package/src/components/review-editor/index.ts +0 -59
- package/src/components/review-editor/live-region.svelte +0 -109
- package/src/components/review-editor/review-editor-anchors.svelte.ts +0 -219
- package/src/components/review-editor/review-editor-controls.svelte +0 -201
- package/src/components/review-editor/review-editor-exports.ts +0 -145
- package/src/components/review-editor/review-editor-front-matter.ts +0 -237
- package/src/components/review-editor/review-editor-impl.svelte +0 -1509
- package/src/components/review-editor/review-editor-selection-geometry.ts +0 -31
- package/src/components/review-editor/review-editor-selection-types.ts +0 -68
- package/src/components/review-editor/review-editor-selection.svelte.ts +0 -292
- package/src/components/review-editor/review-editor-state.svelte.ts +0 -117
- package/src/components/review-editor/review-editor-threads.svelte.ts +0 -435
- package/src/components/review-editor/review-editor.css +0 -273
- package/src/components/review-editor/review-editor.examples.json +0 -19
- package/src/components/review-editor/review-editor.schema.json +0 -83
- package/src/components/review-editor/review-editor.schema.ts +0 -88
- package/src/components/review-editor/review-editor.svelte +0 -18
- package/src/components/review-editor/review-editor.types.ts +0 -92
- package/src/components/review-editor/review-editor.variables.json +0 -1
- package/src/components/review-editor/review-editor.variables.ts +0 -3
- package/src/components/review-editor/thread-popover.svelte +0 -261
- /package/dist/components/{review-editor/review-editor.css.d.ts → json-editor/json-editor.css.d.ts} +0 -0
- /package/dist/components/{diff-viewer/diff-viewer.schema.d.ts → json-editor/json-editor.schema.d.ts} +0 -0
- /package/dist/components/{diff-viewer/diff-viewer.variables.d.ts → json-editor/json-editor.variables.d.ts} +0 -0
- /package/src/components/{diff-viewer/diff-viewer.variables.json → json-editor/json-editor.variables.json} +0 -0
- /package/src/components/{diff-viewer/diff-viewer.variables.ts → json-editor/json-editor.variables.ts} +0 -0
package/dist/diff/line-diff.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Line-based diff computation for the DiffViewer component.
|
|
3
|
-
*
|
|
4
|
-
* Uses diff-match-patch for line-level diffing, with word-level
|
|
5
|
-
* highlighting for modified lines.
|
|
6
|
-
*/
|
|
7
|
-
export type LineDiff = {
|
|
8
|
-
type: 'same';
|
|
9
|
-
text: string;
|
|
10
|
-
} | {
|
|
11
|
-
type: 'added';
|
|
12
|
-
text: string;
|
|
13
|
-
} | {
|
|
14
|
-
type: 'removed';
|
|
15
|
-
text: string;
|
|
16
|
-
} | {
|
|
17
|
-
type: 'modified';
|
|
18
|
-
oldText: string;
|
|
19
|
-
newText: string;
|
|
20
|
-
wordChanges: WordChange[];
|
|
21
|
-
};
|
|
22
|
-
export type WordChange = {
|
|
23
|
-
type: 'same';
|
|
24
|
-
text: string;
|
|
25
|
-
} | {
|
|
26
|
-
type: 'added';
|
|
27
|
-
text: string;
|
|
28
|
-
} | {
|
|
29
|
-
type: 'removed';
|
|
30
|
-
text: string;
|
|
31
|
-
};
|
|
32
|
-
/** Statistics from line-based diff computation */
|
|
33
|
-
export interface LineDiffStats {
|
|
34
|
-
/** Number of lines added */
|
|
35
|
-
added: number;
|
|
36
|
-
/** Number of lines removed */
|
|
37
|
-
removed: number;
|
|
38
|
-
/** Number of lines modified (word-level changes) */
|
|
39
|
-
modified: number;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A hunk is a group of consecutive changes with surrounding context.
|
|
43
|
-
* Used for hunk-based revert operations.
|
|
44
|
-
*/
|
|
45
|
-
export interface DiffHunk {
|
|
46
|
-
/** Index of this hunk in the list */
|
|
47
|
-
index: number;
|
|
48
|
-
/** 1-based line number in original content where hunk starts */
|
|
49
|
-
originalStart: number;
|
|
50
|
-
/** Number of lines in original content affected by this hunk */
|
|
51
|
-
originalCount: number;
|
|
52
|
-
/** 1-based line number in current content where hunk starts */
|
|
53
|
-
currentStart: number;
|
|
54
|
-
/** Number of lines in current content affected by this hunk */
|
|
55
|
-
currentCount: number;
|
|
56
|
-
/** Line diffs within this hunk (includes context) */
|
|
57
|
-
lines: LineDiff[];
|
|
58
|
-
/** Original lines that were changed/removed (for revert) */
|
|
59
|
-
originalLines: string[];
|
|
60
|
-
/** Current lines that were added/modified (for reference) */
|
|
61
|
-
currentLines: string[];
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Compute word-level changes within a single line.
|
|
65
|
-
*/
|
|
66
|
-
export declare function computeWordChanges(oldText: string, newText: string): WordChange[];
|
|
67
|
-
/**
|
|
68
|
-
* Compute line-based diff between two strings.
|
|
69
|
-
* For modified lines, includes word-level changes.
|
|
70
|
-
*/
|
|
71
|
-
export declare function computeLineDiff(original: string, current: string): LineDiff[];
|
|
72
|
-
/**
|
|
73
|
-
* Group line diffs into hunks with surrounding context.
|
|
74
|
-
*
|
|
75
|
-
* A hunk is a group of consecutive changes with CONTEXT_LINES of
|
|
76
|
-
* unchanged lines before and after. When two change regions are
|
|
77
|
-
* close enough (within 2 * CONTEXT_LINES), they're merged into
|
|
78
|
-
* a single hunk.
|
|
79
|
-
*/
|
|
80
|
-
export declare function groupIntoHunks(lineDiffs: LineDiff[]): DiffHunk[];
|
|
81
|
-
/**
|
|
82
|
-
* Get diff statistics from line diff result.
|
|
83
|
-
*/
|
|
84
|
-
export declare function getDiffStats(lineDiffs: LineDiff[]): LineDiffStats;
|
package/dist/diff/line-diff.js
DELETED
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Line-based diff computation for the DiffViewer component.
|
|
3
|
-
*
|
|
4
|
-
* Uses diff-match-patch for line-level diffing, with word-level
|
|
5
|
-
* highlighting for modified lines.
|
|
6
|
-
*/
|
|
7
|
-
import DiffMatchPatch from 'diff-match-patch';
|
|
8
|
-
const dmp = new DiffMatchPatch();
|
|
9
|
-
function getArrayItem(items, index) {
|
|
10
|
-
const item = items[index];
|
|
11
|
-
if (item === undefined) {
|
|
12
|
-
throw new RangeError(`Expected item at index ${index}.`);
|
|
13
|
-
}
|
|
14
|
-
return item;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Compute word-level changes within a single line.
|
|
18
|
-
*/
|
|
19
|
-
export function computeWordChanges(oldText, newText) {
|
|
20
|
-
const diffs = dmp.diff_main(oldText, newText);
|
|
21
|
-
dmp.diff_cleanupSemantic(diffs);
|
|
22
|
-
return diffs.map(([op, text]) => {
|
|
23
|
-
if (op === 0)
|
|
24
|
-
return { type: 'same', text };
|
|
25
|
-
if (op === -1)
|
|
26
|
-
return { type: 'removed', text };
|
|
27
|
-
return { type: 'added', text };
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Compute line-based diff between two strings.
|
|
32
|
-
* For modified lines, includes word-level changes.
|
|
33
|
-
*/
|
|
34
|
-
export function computeLineDiff(original, current) {
|
|
35
|
-
// Fast path for identical content
|
|
36
|
-
if (original === current) {
|
|
37
|
-
return splitLines(original).map((text) => ({ type: 'same', text }));
|
|
38
|
-
}
|
|
39
|
-
// Use diff-match-patch's line diff mode
|
|
40
|
-
const { chars1, chars2, lineArray } = dmp.diff_linesToChars_(original, current);
|
|
41
|
-
const lineDiffs = dmp.diff_main(chars1, chars2, false);
|
|
42
|
-
dmp.diff_cleanupSemantic(lineDiffs);
|
|
43
|
-
dmp.diff_charsToLines_(lineDiffs, lineArray);
|
|
44
|
-
const result = [];
|
|
45
|
-
for (let i = 0; i < lineDiffs.length; i++) {
|
|
46
|
-
const [op, text] = getArrayItem(lineDiffs, i);
|
|
47
|
-
// Split by newlines, removing trailing empty string from final newline
|
|
48
|
-
const lines = splitLines(text);
|
|
49
|
-
if (op === 0) {
|
|
50
|
-
// Equal - these lines are unchanged
|
|
51
|
-
for (const line of lines) {
|
|
52
|
-
result.push({ type: 'same', text: line });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else if (op === -1) {
|
|
56
|
-
// Deletion - check if followed by insertion (modification)
|
|
57
|
-
const next = lineDiffs[i + 1];
|
|
58
|
-
if (next && next[0] === 1) {
|
|
59
|
-
// This is a modification (delete + insert)
|
|
60
|
-
const oldLines = lines;
|
|
61
|
-
const newLines = splitLines(next[1]);
|
|
62
|
-
// Process each line pair
|
|
63
|
-
processModification(oldLines, newLines, result);
|
|
64
|
-
i++; // Skip the insertion we just processed
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
// Pure deletion
|
|
68
|
-
for (const line of lines) {
|
|
69
|
-
result.push({ type: 'removed', text: line });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else if (op === 1) {
|
|
74
|
-
// Insertion (not preceded by deletion - that case is handled above)
|
|
75
|
-
for (const line of lines) {
|
|
76
|
-
result.push({ type: 'added', text: line });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Split text by newlines, handling trailing newline correctly.
|
|
84
|
-
*/
|
|
85
|
-
function splitLines(text) {
|
|
86
|
-
const lines = text.split('\n');
|
|
87
|
-
// If text ends with newline, remove the trailing empty string
|
|
88
|
-
if (lines.length > 1 && lines[lines.length - 1] === '') {
|
|
89
|
-
lines.pop();
|
|
90
|
-
}
|
|
91
|
-
return lines;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Process a modification (paired deletion + insertion).
|
|
95
|
-
*
|
|
96
|
-
* The key insight: when one line is modified, diff-match-patch sees it as
|
|
97
|
-
* "delete old line, insert new line". We need to pair these correctly.
|
|
98
|
-
*
|
|
99
|
-
* Strategy: Use similarity matching to pair old and new lines,
|
|
100
|
-
* rather than naive index-based pairing.
|
|
101
|
-
*/
|
|
102
|
-
function processModification(oldLines, newLines, result) {
|
|
103
|
-
// For simple cases (same number of lines), pair by index
|
|
104
|
-
if (oldLines.length === newLines.length) {
|
|
105
|
-
for (let i = 0; i < oldLines.length; i++) {
|
|
106
|
-
const oldLine = getArrayItem(oldLines, i);
|
|
107
|
-
const newLine = getArrayItem(newLines, i);
|
|
108
|
-
if (oldLine === newLine) {
|
|
109
|
-
result.push({ type: 'same', text: oldLine });
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
result.push({
|
|
113
|
-
type: 'modified',
|
|
114
|
-
oldText: oldLine,
|
|
115
|
-
newText: newLine,
|
|
116
|
-
wordChanges: computeWordChanges(oldLine, newLine),
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
// For unequal line counts, use LCS-based alignment
|
|
123
|
-
// This handles cases like inserting/deleting lines in the middle
|
|
124
|
-
const alignment = alignLines(oldLines, newLines);
|
|
125
|
-
for (const item of alignment) {
|
|
126
|
-
if (item.type === 'same') {
|
|
127
|
-
result.push({ type: 'same', text: item.text });
|
|
128
|
-
}
|
|
129
|
-
else if (item.type === 'removed') {
|
|
130
|
-
result.push({ type: 'removed', text: item.text });
|
|
131
|
-
}
|
|
132
|
-
else if (item.type === 'added') {
|
|
133
|
-
result.push({ type: 'added', text: item.text });
|
|
134
|
-
}
|
|
135
|
-
else if (item.type === 'modified') {
|
|
136
|
-
result.push({
|
|
137
|
-
type: 'modified',
|
|
138
|
-
oldText: item.oldText,
|
|
139
|
-
newText: item.newText,
|
|
140
|
-
wordChanges: computeWordChanges(item.oldText, item.newText),
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Align two arrays of lines using similarity matching.
|
|
147
|
-
*
|
|
148
|
-
* Uses a greedy approach with monotonic matching to ensure output order
|
|
149
|
-
* reflects the visual reading order of the document:
|
|
150
|
-
* 1. Find best match for each old line (must be after previous match)
|
|
151
|
-
* 2. Process in document order: additions, then matched/removed lines
|
|
152
|
-
*/
|
|
153
|
-
function alignLines(oldLines, newLines) {
|
|
154
|
-
const result = [];
|
|
155
|
-
// Track which new lines have been matched
|
|
156
|
-
const matchedNew = new Set();
|
|
157
|
-
// For each old line, find best matching new line (must be monotonically increasing)
|
|
158
|
-
const oldMatches = oldLines.map(() => null);
|
|
159
|
-
let minNewIdx = 0; // Ensures matches are in order
|
|
160
|
-
for (let oldIdx = 0; oldIdx < oldLines.length; oldIdx++) {
|
|
161
|
-
const oldLine = getArrayItem(oldLines, oldIdx);
|
|
162
|
-
let bestMatchIdx = -1;
|
|
163
|
-
let bestSimilarity = 0.5; // Minimum threshold for a match
|
|
164
|
-
// Only consider new lines at or after the last match
|
|
165
|
-
for (let newIdx = minNewIdx; newIdx < newLines.length; newIdx++) {
|
|
166
|
-
if (matchedNew.has(newIdx))
|
|
167
|
-
continue;
|
|
168
|
-
const newLine = getArrayItem(newLines, newIdx);
|
|
169
|
-
const similarity = computeSimilarity(oldLine, newLine);
|
|
170
|
-
if (similarity > bestSimilarity) {
|
|
171
|
-
bestSimilarity = similarity;
|
|
172
|
-
bestMatchIdx = newIdx;
|
|
173
|
-
// Exact matches cannot be improved, but near matches can still hide
|
|
174
|
-
// a better match later in the candidate window.
|
|
175
|
-
if (similarity === 1)
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
if (bestMatchIdx >= 0) {
|
|
180
|
-
oldMatches[oldIdx] = bestMatchIdx;
|
|
181
|
-
matchedNew.add(bestMatchIdx);
|
|
182
|
-
minNewIdx = bestMatchIdx + 1; // Next match must be after this one
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
// Build result by processing in document order
|
|
186
|
-
let oldIdx = 0;
|
|
187
|
-
let newIdx = 0;
|
|
188
|
-
while (oldIdx < oldLines.length || newIdx < newLines.length) {
|
|
189
|
-
if (oldIdx < oldLines.length) {
|
|
190
|
-
const matchIdx = getArrayItem(oldMatches, oldIdx);
|
|
191
|
-
if (matchIdx !== null) {
|
|
192
|
-
// Output any unmatched new lines before this match
|
|
193
|
-
while (newIdx < matchIdx) {
|
|
194
|
-
if (!matchedNew.has(newIdx)) {
|
|
195
|
-
result.push({ type: 'added', text: getArrayItem(newLines, newIdx) });
|
|
196
|
-
}
|
|
197
|
-
newIdx++;
|
|
198
|
-
}
|
|
199
|
-
// Output the matched pair
|
|
200
|
-
const oldLine = getArrayItem(oldLines, oldIdx);
|
|
201
|
-
const newLine = getArrayItem(newLines, matchIdx);
|
|
202
|
-
if (oldLine === newLine) {
|
|
203
|
-
result.push({ type: 'same', text: oldLine });
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
result.push({ type: 'modified', oldText: oldLine, newText: newLine });
|
|
207
|
-
}
|
|
208
|
-
oldIdx++;
|
|
209
|
-
newIdx = matchIdx + 1;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
// No match for this old line - it was removed
|
|
213
|
-
result.push({ type: 'removed', text: getArrayItem(oldLines, oldIdx) });
|
|
214
|
-
oldIdx++;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
// No more old lines - remaining new lines are additions
|
|
219
|
-
if (!matchedNew.has(newIdx)) {
|
|
220
|
-
result.push({ type: 'added', text: getArrayItem(newLines, newIdx) });
|
|
221
|
-
}
|
|
222
|
-
newIdx++;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return result;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Compute similarity between two strings (0-1).
|
|
229
|
-
* Uses character-level comparison.
|
|
230
|
-
*/
|
|
231
|
-
function computeSimilarity(a, b) {
|
|
232
|
-
if (a === b)
|
|
233
|
-
return 1;
|
|
234
|
-
if (a.length === 0 || b.length === 0)
|
|
235
|
-
return 0;
|
|
236
|
-
// Use diff to compute similarity
|
|
237
|
-
const diffs = dmp.diff_main(a, b);
|
|
238
|
-
let commonLength = 0;
|
|
239
|
-
for (const [op, text] of diffs) {
|
|
240
|
-
if (op === 0) {
|
|
241
|
-
commonLength += text.length;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return (2 * commonLength) / (a.length + b.length);
|
|
245
|
-
}
|
|
246
|
-
/** Number of context lines to show around changes in hunks */
|
|
247
|
-
const CONTEXT_LINES = 3;
|
|
248
|
-
/**
|
|
249
|
-
* Group line diffs into hunks with surrounding context.
|
|
250
|
-
*
|
|
251
|
-
* A hunk is a group of consecutive changes with CONTEXT_LINES of
|
|
252
|
-
* unchanged lines before and after. When two change regions are
|
|
253
|
-
* close enough (within 2 * CONTEXT_LINES), they're merged into
|
|
254
|
-
* a single hunk.
|
|
255
|
-
*/
|
|
256
|
-
export function groupIntoHunks(lineDiffs) {
|
|
257
|
-
const hunks = [];
|
|
258
|
-
// Track line numbers as we iterate
|
|
259
|
-
let originalLine = 1;
|
|
260
|
-
let currentLine = 1;
|
|
261
|
-
// Build an array with line number information
|
|
262
|
-
const linesWithNumbers = lineDiffs.map((diff) => {
|
|
263
|
-
const result = {
|
|
264
|
-
diff,
|
|
265
|
-
originalLineNumber: diff.type !== 'added' ? originalLine : undefined,
|
|
266
|
-
currentLineNumber: diff.type !== 'removed' ? currentLine : undefined,
|
|
267
|
-
};
|
|
268
|
-
// Advance line counters based on diff type
|
|
269
|
-
if (diff.type === 'same') {
|
|
270
|
-
originalLine++;
|
|
271
|
-
currentLine++;
|
|
272
|
-
}
|
|
273
|
-
else if (diff.type === 'added') {
|
|
274
|
-
currentLine++;
|
|
275
|
-
}
|
|
276
|
-
else if (diff.type === 'removed') {
|
|
277
|
-
originalLine++;
|
|
278
|
-
}
|
|
279
|
-
else if (diff.type === 'modified') {
|
|
280
|
-
originalLine++;
|
|
281
|
-
currentLine++;
|
|
282
|
-
}
|
|
283
|
-
return result;
|
|
284
|
-
});
|
|
285
|
-
// Find change regions (indices where changes occur)
|
|
286
|
-
const changeIndices = [];
|
|
287
|
-
for (const [index, lineWithNumbers] of linesWithNumbers.entries()) {
|
|
288
|
-
if (lineWithNumbers.diff.type !== 'same') {
|
|
289
|
-
changeIndices.push(index);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
if (changeIndices.length === 0) {
|
|
293
|
-
return []; // No changes, no hunks
|
|
294
|
-
}
|
|
295
|
-
// Group consecutive change indices into ranges
|
|
296
|
-
const changeRanges = [];
|
|
297
|
-
let rangeStart = getArrayItem(changeIndices, 0);
|
|
298
|
-
let rangeEnd = getArrayItem(changeIndices, 0);
|
|
299
|
-
for (let i = 1; i < changeIndices.length; i++) {
|
|
300
|
-
const idx = getArrayItem(changeIndices, i);
|
|
301
|
-
// If this change is close enough to the previous, extend the range
|
|
302
|
-
if (idx - rangeEnd <= 2 * CONTEXT_LINES) {
|
|
303
|
-
rangeEnd = idx;
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
changeRanges.push({ start: rangeStart, end: rangeEnd });
|
|
307
|
-
rangeStart = idx;
|
|
308
|
-
rangeEnd = idx;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
changeRanges.push({ start: rangeStart, end: rangeEnd });
|
|
312
|
-
// Build hunks from change ranges
|
|
313
|
-
for (const [index, range] of changeRanges.entries()) {
|
|
314
|
-
// Calculate hunk boundaries with context
|
|
315
|
-
const hunkStart = Math.max(0, range.start - CONTEXT_LINES);
|
|
316
|
-
const hunkEnd = Math.min(linesWithNumbers.length - 1, range.end + CONTEXT_LINES);
|
|
317
|
-
// Extract lines for this hunk
|
|
318
|
-
const hunkLines = [];
|
|
319
|
-
const originalLines = [];
|
|
320
|
-
const currentLines = [];
|
|
321
|
-
let hunkOriginalStart = Number.MAX_SAFE_INTEGER;
|
|
322
|
-
let hunkCurrentStart = Number.MAX_SAFE_INTEGER;
|
|
323
|
-
let hunkOriginalCount = 0;
|
|
324
|
-
let hunkCurrentCount = 0;
|
|
325
|
-
for (let j = hunkStart; j <= hunkEnd; j++) {
|
|
326
|
-
const { diff, originalLineNumber, currentLineNumber } = getArrayItem(linesWithNumbers, j);
|
|
327
|
-
hunkLines.push(diff);
|
|
328
|
-
if (originalLineNumber !== undefined) {
|
|
329
|
-
hunkOriginalStart = Math.min(hunkOriginalStart, originalLineNumber);
|
|
330
|
-
hunkOriginalCount++;
|
|
331
|
-
if (diff.type === 'removed' || diff.type === 'modified') {
|
|
332
|
-
originalLines.push(diff.type === 'modified' ? diff.oldText : diff.text);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
if (currentLineNumber !== undefined) {
|
|
336
|
-
hunkCurrentStart = Math.min(hunkCurrentStart, currentLineNumber);
|
|
337
|
-
hunkCurrentCount++;
|
|
338
|
-
if (diff.type === 'added' || diff.type === 'modified') {
|
|
339
|
-
currentLines.push(diff.type === 'modified' ? diff.newText : diff.text);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
hunks.push({
|
|
344
|
-
index,
|
|
345
|
-
originalStart: hunkOriginalStart === Number.MAX_SAFE_INTEGER ? 1 : hunkOriginalStart,
|
|
346
|
-
originalCount: hunkOriginalCount,
|
|
347
|
-
currentStart: hunkCurrentStart === Number.MAX_SAFE_INTEGER ? 1 : hunkCurrentStart,
|
|
348
|
-
currentCount: hunkCurrentCount,
|
|
349
|
-
lines: hunkLines,
|
|
350
|
-
originalLines,
|
|
351
|
-
currentLines,
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
return hunks;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Get diff statistics from line diff result.
|
|
358
|
-
*/
|
|
359
|
-
export function getDiffStats(lineDiffs) {
|
|
360
|
-
let added = 0;
|
|
361
|
-
let removed = 0;
|
|
362
|
-
let modified = 0;
|
|
363
|
-
for (const diff of lineDiffs) {
|
|
364
|
-
if (diff.type === 'added')
|
|
365
|
-
added++;
|
|
366
|
-
else if (diff.type === 'removed')
|
|
367
|
-
removed++;
|
|
368
|
-
else if (diff.type === 'modified')
|
|
369
|
-
modified++;
|
|
370
|
-
}
|
|
371
|
-
return { added, removed, modified };
|
|
372
|
-
}
|
package/dist/diff/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { DiffHunk, LineDiff, LineDiffStats, WordChange } from './line-diff.js';
|
package/dist/diff/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/editor/attach.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Svelte 5 attachment factory for Milkdown editor.
|
|
3
|
-
*
|
|
4
|
-
* This module provides the {@attach} integration pattern for mounting
|
|
5
|
-
* Milkdown within Svelte components. The attachment handles:
|
|
6
|
-
* - Editor initialization
|
|
7
|
-
* - Lifecycle management (mount/destroy)
|
|
8
|
-
* - Reactive readonly updates
|
|
9
|
-
* - Two-way binding with effect loop prevention
|
|
10
|
-
*/
|
|
11
|
-
import type { Attachment } from 'svelte/attachments';
|
|
12
|
-
import type { EditorAttachmentOptions } from './types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Create an attachment function for the {@attach} directive.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```svelte
|
|
18
|
-
* <script>
|
|
19
|
-
* const editorAttachment = createEditorAttachment({
|
|
20
|
-
* getInitialValue: () => markdown,
|
|
21
|
-
* getReadonly: () => readonly,
|
|
22
|
-
* onready: (state) => { editorState = state; },
|
|
23
|
-
* onchange: (md) => { markdown = md; },
|
|
24
|
-
* });
|
|
25
|
-
* </script>
|
|
26
|
-
*
|
|
27
|
-
* <div {@attach editorAttachment}></div>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare function createEditorAttachment(options: EditorAttachmentOptions): Attachment<HTMLElement>;
|
package/dist/editor/attach.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Svelte 5 attachment factory for Milkdown editor.
|
|
3
|
-
*
|
|
4
|
-
* This module provides the {@attach} integration pattern for mounting
|
|
5
|
-
* Milkdown within Svelte components. The attachment handles:
|
|
6
|
-
* - Editor initialization
|
|
7
|
-
* - Lifecycle management (mount/destroy)
|
|
8
|
-
* - Reactive readonly updates
|
|
9
|
-
* - Two-way binding with effect loop prevention
|
|
10
|
-
*/
|
|
11
|
-
import { untrack } from 'svelte';
|
|
12
|
-
import { createEditor, destroyEditor } from './editor.js';
|
|
13
|
-
import { DEFAULT_DEBOUNCE_MS } from './types.js';
|
|
14
|
-
/**
|
|
15
|
-
* Create an attachment function for the {@attach} directive.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```svelte
|
|
19
|
-
* <script>
|
|
20
|
-
* const editorAttachment = createEditorAttachment({
|
|
21
|
-
* getInitialValue: () => markdown,
|
|
22
|
-
* getReadonly: () => readonly,
|
|
23
|
-
* onready: (state) => { editorState = state; },
|
|
24
|
-
* onchange: (md) => { markdown = md; },
|
|
25
|
-
* });
|
|
26
|
-
* </script>
|
|
27
|
-
*
|
|
28
|
-
* <div {@attach editorAttachment}></div>
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export function createEditorAttachment(options) {
|
|
32
|
-
const { getInitialValue, getReadonly, getAriaLabel, onready, onchange, onselectionchange, onlinkshortcut, oncommentshortcut, debounceMs = DEFAULT_DEBOUNCE_MS, getPlugins, getPlaceholderCompletion, getPlaceholderDecoration, } = options;
|
|
33
|
-
return (element) => {
|
|
34
|
-
let editorState = null;
|
|
35
|
-
let destroyed = false;
|
|
36
|
-
// Untrack getter calls to prevent the attachment effect from re-running
|
|
37
|
-
// when reactive props (value, readonly, plugins) change. The component
|
|
38
|
-
// handles reactive updates separately via its own $effect blocks.
|
|
39
|
-
const initialContent = untrack(() => getInitialValue());
|
|
40
|
-
const readonly = untrack(() => getReadonly());
|
|
41
|
-
const ariaLabel = untrack(() => getAriaLabel());
|
|
42
|
-
const plugins = untrack(() => getPlugins?.() ?? []);
|
|
43
|
-
const placeholderCompletion = untrack(() => getPlaceholderCompletion?.());
|
|
44
|
-
const placeholderDecoration = untrack(() => getPlaceholderDecoration?.());
|
|
45
|
-
const editorConfiguration = {
|
|
46
|
-
initialContent,
|
|
47
|
-
readonly,
|
|
48
|
-
ariaLabel,
|
|
49
|
-
changeDebounceMs: debounceMs,
|
|
50
|
-
plugins,
|
|
51
|
-
...(onchange && { onchange }),
|
|
52
|
-
...(onselectionchange && { onselectionchange }),
|
|
53
|
-
...(onlinkshortcut && { onlinkshortcut }),
|
|
54
|
-
...(oncommentshortcut && { oncommentshortcut }),
|
|
55
|
-
...(placeholderCompletion && { placeholderCompletion }),
|
|
56
|
-
...(placeholderDecoration && { placeholderDecoration }),
|
|
57
|
-
};
|
|
58
|
-
// Initialize editor asynchronously
|
|
59
|
-
void (async () => {
|
|
60
|
-
try {
|
|
61
|
-
const state = await createEditor(element, editorConfiguration);
|
|
62
|
-
// Guard against race condition if destroyed before init completes
|
|
63
|
-
if (destroyed) {
|
|
64
|
-
destroyEditor(state);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
editorState = state;
|
|
68
|
-
onready?.(state);
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
// If we were unmounted mid-init, swallow the error to avoid unhandled rejections
|
|
72
|
-
// in test environments that rapidly mount/unmount.
|
|
73
|
-
if (destroyed)
|
|
74
|
-
return;
|
|
75
|
-
console.error('[Editor] Failed to initialize Milkdown editor:', error);
|
|
76
|
-
}
|
|
77
|
-
})();
|
|
78
|
-
return () => {
|
|
79
|
-
destroyed = true;
|
|
80
|
-
if (editorState) {
|
|
81
|
-
destroyEditor(editorState);
|
|
82
|
-
editorState = null;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
}
|
package/dist/editor/bridge.d.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bridge between ProseMirror positions and text offsets.
|
|
3
|
-
*
|
|
4
|
-
* This module provides position mapping utilities needed for:
|
|
5
|
-
* - DEP-39: Comment anchoring (map selection to persistable positions)
|
|
6
|
-
* - DEP-43: Suggested edits (map stored positions back to editor)
|
|
7
|
-
*
|
|
8
|
-
* The bridge maintains the invariant that positions can round-trip
|
|
9
|
-
* between ProseMirror and text offset coordinate systems.
|
|
10
|
-
*
|
|
11
|
-
* Key insight: ProseMirror positions include structural characters
|
|
12
|
-
* (node boundaries), while text offsets (from doc.textBetween()) only
|
|
13
|
-
* count text content plus block separators ('\n' between blocks).
|
|
14
|
-
*/
|
|
15
|
-
import type { Node as ProseMirrorNode } from '@milkdown/kit/prose/model';
|
|
16
|
-
import type { EditorSelection, SourcePosition } from './types.js';
|
|
17
|
-
/**
|
|
18
|
-
* Bidirectional map between text offsets and ProseMirror positions.
|
|
19
|
-
*/
|
|
20
|
-
interface PositionOffsetMap {
|
|
21
|
-
/** Map from text offset to ProseMirror position */
|
|
22
|
-
textToPm: Map<number, number>;
|
|
23
|
-
/** Map from ProseMirror position to text offset */
|
|
24
|
-
pmToText: Map<number, number>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Build bidirectional offset map matching doc.textBetween() semantics.
|
|
28
|
-
*
|
|
29
|
-
* textBetween inserts blockSeparator (default '\n') between block nodes.
|
|
30
|
-
* This function mirrors that behavior exactly by walking the document
|
|
31
|
-
* and tracking when we transition between blocks.
|
|
32
|
-
*
|
|
33
|
-
* Key insight: textBetween adds separator BETWEEN consecutive block content,
|
|
34
|
-
* not at every block boundary. We track this by noting when we exit one
|
|
35
|
-
* block's text content and enter another's.
|
|
36
|
-
*
|
|
37
|
-
* @param doc - ProseMirror document node
|
|
38
|
-
* @returns Cached bidirectional position map
|
|
39
|
-
*/
|
|
40
|
-
export declare function buildTextToProseMirrorPositionMap(doc: ProseMirrorNode): PositionOffsetMap;
|
|
41
|
-
/**
|
|
42
|
-
* Convert a text offset (from doc.textBetween()) to a ProseMirror position.
|
|
43
|
-
*
|
|
44
|
-
* @param doc - ProseMirror document node
|
|
45
|
-
* @param offset - Text offset (0-based)
|
|
46
|
-
* @returns ProseMirror position or null if offset not found
|
|
47
|
-
*/
|
|
48
|
-
export declare function textOffsetToProseMirrorPosition(doc: ProseMirrorNode, offset: number): number | null;
|
|
49
|
-
/**
|
|
50
|
-
* Convert a ProseMirror position to a text offset (as from doc.textBetween()).
|
|
51
|
-
*
|
|
52
|
-
* @param doc - ProseMirror document node
|
|
53
|
-
* @param pos - ProseMirror position
|
|
54
|
-
* @returns Text offset or 0 if position not found
|
|
55
|
-
*/
|
|
56
|
-
export declare function proseMirrorPositionToTextOffset(doc: ProseMirrorNode, pos: number): number;
|
|
57
|
-
/**
|
|
58
|
-
* Compute line and column from a text offset within the document text.
|
|
59
|
-
*
|
|
60
|
-
* Unlike mapPosToSource (which maps to markdown source positions), this function
|
|
61
|
-
* computes line/column within the document's text content (doc.textBetween semantics).
|
|
62
|
-
* This is useful for originalPosition storage where we want coordinates that match
|
|
63
|
-
* the text offset coordinate system.
|
|
64
|
-
*
|
|
65
|
-
* @param doc - ProseMirror document node
|
|
66
|
-
* @param textOffset - Text offset (0-based, from doc.textBetween)
|
|
67
|
-
* @returns SourcePosition with offset, line, and column
|
|
68
|
-
*/
|
|
69
|
-
export declare function textOffsetToLineColumn(doc: ProseMirrorNode, textOffset: number): SourcePosition;
|
|
70
|
-
/**
|
|
71
|
-
* Map a ProseMirror position to an mdast source position.
|
|
72
|
-
*
|
|
73
|
-
* This enables persisting selection/anchor positions in a format
|
|
74
|
-
* that survives editor remounts and document changes.
|
|
75
|
-
*
|
|
76
|
-
* @param pmPos - ProseMirror document position
|
|
77
|
-
* @param markdown - Current markdown content
|
|
78
|
-
* @returns Source position or null if mapping fails
|
|
79
|
-
*
|
|
80
|
-
* @remarks
|
|
81
|
-
* This direct mapping is used when the current markdown string is the only
|
|
82
|
-
* available source of truth. Use the ProseMirror document helpers above when
|
|
83
|
-
* mapping from an instantiated editor document.
|
|
84
|
-
*/
|
|
85
|
-
export declare function mapPosToSource(pmPos: number, markdown: string): SourcePosition | null;
|
|
86
|
-
/**
|
|
87
|
-
* Map an mdast source position to a ProseMirror position.
|
|
88
|
-
*
|
|
89
|
-
* This enables jumping to stored positions (comments, suggestions)
|
|
90
|
-
* when the editor loads.
|
|
91
|
-
*
|
|
92
|
-
* @param sourcePos - mdast source position
|
|
93
|
-
* @param markdown - Current markdown content
|
|
94
|
-
* @returns ProseMirror position or null if mapping fails
|
|
95
|
-
*
|
|
96
|
-
* @remarks
|
|
97
|
-
* This direct mapping is used when a stored markdown offset is available. Use
|
|
98
|
-
* the ProseMirror document helpers above when translating through an
|
|
99
|
-
* instantiated editor document.
|
|
100
|
-
*/
|
|
101
|
-
export declare function mapSourceToPos(sourcePos: SourcePosition, markdown: string): number | null;
|
|
102
|
-
/**
|
|
103
|
-
* Enrich an editor selection with source position information.
|
|
104
|
-
*
|
|
105
|
-
* @param selection - Editor selection state
|
|
106
|
-
* @param markdown - Current markdown content
|
|
107
|
-
* @returns Selection with sourcePosition field populated
|
|
108
|
-
*/
|
|
109
|
-
export declare function enrichSelectionWithSource(selection: EditorSelection, markdown: string): EditorSelection;
|
|
110
|
-
export {};
|