@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
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Synchronous rehype plugin for Shiki syntax highlighting.
|
|
3
|
-
*
|
|
4
|
-
* DEP-79: Add syntax highlighting to code blocks across the application.
|
|
5
|
-
*
|
|
6
|
-
* This plugin transforms `pre > code` elements in hast to highlighted HTML
|
|
7
|
-
* using a pre-initialized Shiki highlighter. Unlike the standard @shikijs/rehype
|
|
8
|
-
* plugin, this one is fully synchronous, enabling use with unified's `runSync()`.
|
|
9
|
-
*
|
|
10
|
-
* **Important**: The highlighter must be initialized before this plugin runs.
|
|
11
|
-
* If the highlighter is not ready, code blocks are left unhighlighted.
|
|
12
|
-
*
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
import { visit } from 'unist-util-visit';
|
|
16
|
-
import { getHighlighterSync, isBundledLanguage, PLAINTEXT_LANGUAGE, } from './highlighter.js';
|
|
17
|
-
/**
|
|
18
|
-
* Extract language from a code element's class list.
|
|
19
|
-
*
|
|
20
|
-
* Looks for classes matching `language-*` or `lang-*` patterns,
|
|
21
|
-
* which are the standard ways to specify language in markdown code blocks.
|
|
22
|
-
*
|
|
23
|
-
* @param element - The code element to extract language from
|
|
24
|
-
* @returns The language identifier, or null if not found
|
|
25
|
-
*/
|
|
26
|
-
function extractLanguage(element) {
|
|
27
|
-
const className = element.properties?.['className'];
|
|
28
|
-
if (!Array.isArray(className))
|
|
29
|
-
return null;
|
|
30
|
-
for (const cls of className) {
|
|
31
|
-
if (typeof cls !== 'string')
|
|
32
|
-
continue;
|
|
33
|
-
// Check for language-* pattern (standard)
|
|
34
|
-
if (cls.startsWith('language-')) {
|
|
35
|
-
return cls.slice(9); // Remove 'language-' prefix
|
|
36
|
-
}
|
|
37
|
-
// Check for lang-* pattern (alternative)
|
|
38
|
-
if (cls.startsWith('lang-')) {
|
|
39
|
-
return cls.slice(5); // Remove 'lang-' prefix
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Extract text content from a hast element.
|
|
46
|
-
*
|
|
47
|
-
* Recursively collects all text nodes within the element.
|
|
48
|
-
*
|
|
49
|
-
* @param element - The element to extract text from
|
|
50
|
-
* @returns The concatenated text content
|
|
51
|
-
*/
|
|
52
|
-
function extractText(element) {
|
|
53
|
-
let text = '';
|
|
54
|
-
function walk(nodes) {
|
|
55
|
-
for (const node of nodes) {
|
|
56
|
-
if (node.type === 'text') {
|
|
57
|
-
text += node.value;
|
|
58
|
-
}
|
|
59
|
-
else if (node.type === 'element' && 'children' in node) {
|
|
60
|
-
walk(node.children);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
walk(element.children);
|
|
65
|
-
return text;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Parse Shiki's HTML output into hast nodes.
|
|
69
|
-
*
|
|
70
|
-
* Shiki returns a string like `<pre class="shiki" ...><code>...</code></pre>`.
|
|
71
|
-
* We need to convert this to hast nodes to insert into the tree.
|
|
72
|
-
*
|
|
73
|
-
* This is a simplified parser that handles Shiki's specific output format.
|
|
74
|
-
* It extracts the attributes from the pre element and the inner content.
|
|
75
|
-
*
|
|
76
|
-
* @param html - The HTML string from Shiki
|
|
77
|
-
* @returns The parsed hast element
|
|
78
|
-
*/
|
|
79
|
-
function parseShikiHtml(html) {
|
|
80
|
-
// Shiki outputs: <pre class="..." style="..." tabindex="0"><code>...</code></pre>
|
|
81
|
-
// We need to extract the pre element's attributes and the code content
|
|
82
|
-
// Extract pre tag attributes
|
|
83
|
-
const preMatch = html.match(/<pre([^>]*)>/);
|
|
84
|
-
const preAttrs = preMatch?.[1] ?? '';
|
|
85
|
-
// Extract classes
|
|
86
|
-
const classMatch = preAttrs.match(/class="([^"]*)"/);
|
|
87
|
-
const className = classMatch?.[1]?.split(/\s+/) ?? [];
|
|
88
|
-
// Extract style (for Shiki's inline styles)
|
|
89
|
-
const styleMatch = preAttrs.match(/style="([^"]*)"/);
|
|
90
|
-
const style = styleMatch?.[1];
|
|
91
|
-
// Extract data-language attribute
|
|
92
|
-
const langMatch = preAttrs.match(/data-language="([^"]*)"/);
|
|
93
|
-
const dataLanguage = langMatch?.[1];
|
|
94
|
-
// Extract tabindex
|
|
95
|
-
const tabindexMatch = preAttrs.match(/tabindex="([^"]*)"/);
|
|
96
|
-
const tabindex = tabindexMatch?.[1];
|
|
97
|
-
// Extract the inner content (between <pre...> and </pre>)
|
|
98
|
-
const innerMatch = html.match(/<pre[^>]*>([\s\S]*)<\/pre>/);
|
|
99
|
-
const innerHtml = innerMatch?.[1] ?? '';
|
|
100
|
-
// Parse the inner code element
|
|
101
|
-
const codeMatch = innerHtml.match(/<code([^>]*)>([\s\S]*)<\/code>/);
|
|
102
|
-
const codeAttrs = codeMatch?.[1] ?? '';
|
|
103
|
-
const codeContent = codeMatch?.[2] ?? innerHtml;
|
|
104
|
-
// Extract code classes
|
|
105
|
-
const codeClassMatch = codeAttrs.match(/class="([^"]*)"/);
|
|
106
|
-
const codeClassName = codeClassMatch?.[1]?.split(/\s+/) ?? [];
|
|
107
|
-
// Parse the highlighted spans within the code
|
|
108
|
-
const codeChildren = parseSpans(codeContent);
|
|
109
|
-
// Build the code element
|
|
110
|
-
const codeElement = {
|
|
111
|
-
type: 'element',
|
|
112
|
-
tagName: 'code',
|
|
113
|
-
properties: {
|
|
114
|
-
className: codeClassName.length > 0 ? codeClassName : undefined,
|
|
115
|
-
},
|
|
116
|
-
children: codeChildren,
|
|
117
|
-
};
|
|
118
|
-
// Build the pre element
|
|
119
|
-
const preElement = {
|
|
120
|
-
type: 'element',
|
|
121
|
-
tagName: 'pre',
|
|
122
|
-
properties: {
|
|
123
|
-
className: className.length > 0 ? className : undefined,
|
|
124
|
-
style: style || undefined,
|
|
125
|
-
dataLanguage: dataLanguage || undefined,
|
|
126
|
-
tabIndex: tabindex ? parseInt(tabindex, 10) : undefined,
|
|
127
|
-
},
|
|
128
|
-
children: [codeElement],
|
|
129
|
-
};
|
|
130
|
-
return preElement;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Parse Shiki's span elements into hast nodes.
|
|
134
|
-
*
|
|
135
|
-
* Shiki wraps each line in a `<span class="line">` with nested token spans.
|
|
136
|
-
* This function recursively parses the nested structure.
|
|
137
|
-
*
|
|
138
|
-
* @param html - The inner HTML content with spans
|
|
139
|
-
* @returns Array of hast element/text nodes
|
|
140
|
-
*/
|
|
141
|
-
function parseSpans(html) {
|
|
142
|
-
const children = [];
|
|
143
|
-
let position = 0;
|
|
144
|
-
while (position < html.length) {
|
|
145
|
-
// Check for start of a span tag
|
|
146
|
-
if (html.slice(position, position + 5) === '<span') {
|
|
147
|
-
// Find the end of the opening tag
|
|
148
|
-
const tagEnd = html.indexOf('>', position);
|
|
149
|
-
if (tagEnd === -1)
|
|
150
|
-
break;
|
|
151
|
-
const openingTag = html.slice(position, tagEnd + 1);
|
|
152
|
-
const attrs = openingTag.slice(5, -1); // Remove '<span' and '>'
|
|
153
|
-
// Find the matching closing tag (accounting for nested spans)
|
|
154
|
-
const innerStart = tagEnd + 1;
|
|
155
|
-
let depth = 1;
|
|
156
|
-
let searchPos = innerStart;
|
|
157
|
-
let closingStart = -1;
|
|
158
|
-
while (depth > 0 && searchPos < html.length) {
|
|
159
|
-
const nextOpen = html.indexOf('<span', searchPos);
|
|
160
|
-
const nextClose = html.indexOf('</span>', searchPos);
|
|
161
|
-
if (nextClose === -1)
|
|
162
|
-
break;
|
|
163
|
-
if (nextOpen !== -1 && nextOpen < nextClose) {
|
|
164
|
-
depth++;
|
|
165
|
-
searchPos = nextOpen + 5;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
depth--;
|
|
169
|
-
if (depth === 0) {
|
|
170
|
-
closingStart = nextClose;
|
|
171
|
-
}
|
|
172
|
-
searchPos = nextClose + 7;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (closingStart === -1)
|
|
176
|
-
break;
|
|
177
|
-
const innerHtml = html.slice(innerStart, closingStart);
|
|
178
|
-
// Parse attributes
|
|
179
|
-
const styleMatch = attrs.match(/style="([^"]*)"/);
|
|
180
|
-
const style = styleMatch?.[1];
|
|
181
|
-
const classMatch = attrs.match(/class="([^"]*)"/);
|
|
182
|
-
const className = classMatch?.[1]?.split(/\s+/);
|
|
183
|
-
// Recursively parse inner content (handles nested spans)
|
|
184
|
-
const innerChildren = innerHtml.includes('<span')
|
|
185
|
-
? parseSpans(innerHtml)
|
|
186
|
-
: innerHtml
|
|
187
|
-
? [{ type: 'text', value: decodeHtmlEntities(innerHtml) }]
|
|
188
|
-
: [];
|
|
189
|
-
children.push({
|
|
190
|
-
type: 'element',
|
|
191
|
-
tagName: 'span',
|
|
192
|
-
properties: {
|
|
193
|
-
style: style || undefined,
|
|
194
|
-
className: className,
|
|
195
|
-
},
|
|
196
|
-
children: innerChildren,
|
|
197
|
-
});
|
|
198
|
-
position = closingStart + 7; // Move past '</span>'
|
|
199
|
-
}
|
|
200
|
-
else if (html[position] === '<') {
|
|
201
|
-
// Skip any other tags (shouldn't happen with Shiki output, but be safe)
|
|
202
|
-
const tagEnd = html.indexOf('>', position);
|
|
203
|
-
if (tagEnd === -1)
|
|
204
|
-
break;
|
|
205
|
-
position = tagEnd + 1;
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
// Plain text - collect until next '<' or end
|
|
209
|
-
const nextTag = html.indexOf('<', position);
|
|
210
|
-
const textEnd = nextTag === -1 ? html.length : nextTag;
|
|
211
|
-
const text = html.slice(position, textEnd);
|
|
212
|
-
if (text) {
|
|
213
|
-
children.push({ type: 'text', value: decodeHtmlEntities(text) });
|
|
214
|
-
}
|
|
215
|
-
position = textEnd;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return children;
|
|
219
|
-
}
|
|
220
|
-
const HTML_ENTITY_PATTERN = /&(?:lt|gt|amp|quot|apos|#39|#x27|#x2F|#x3C|#x3E|#x22|#x26);/gi;
|
|
221
|
-
const HTML_ENTITY_MAP = {
|
|
222
|
-
'<': '<',
|
|
223
|
-
'>': '>',
|
|
224
|
-
'&': '&',
|
|
225
|
-
'"': '"',
|
|
226
|
-
''': "'",
|
|
227
|
-
''': "'",
|
|
228
|
-
''': "'",
|
|
229
|
-
'/': '/',
|
|
230
|
-
'<': '<',
|
|
231
|
-
'>': '>',
|
|
232
|
-
'"': '"',
|
|
233
|
-
'&': '&',
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Decode HTML entities in text content using a single-pass replacement.
|
|
237
|
-
*
|
|
238
|
-
* Single-pass prevents cascade: `&amp;` → `&` (not `&`) because
|
|
239
|
-
* the `&` produced by decoding `&` is never re-scanned.
|
|
240
|
-
*
|
|
241
|
-
* @internal exported for unit testing only
|
|
242
|
-
*/
|
|
243
|
-
export function decodeHtmlEntities(text) {
|
|
244
|
-
return text.replace(HTML_ENTITY_PATTERN, (match) => HTML_ENTITY_MAP[match.toLowerCase()] ?? match);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Normalize language identifiers to match Shiki's expectations.
|
|
248
|
-
*
|
|
249
|
-
* @param language - The language identifier from the code block
|
|
250
|
-
* @returns The normalized language, or 'plaintext' if unknown
|
|
251
|
-
*/
|
|
252
|
-
function normalizeLanguage(language) {
|
|
253
|
-
const normalized = language.toLowerCase();
|
|
254
|
-
// Common aliases - map to bundled languages or plaintext
|
|
255
|
-
const aliases = {
|
|
256
|
-
ts: 'typescript',
|
|
257
|
-
js: 'javascript',
|
|
258
|
-
py: 'python',
|
|
259
|
-
sh: 'bash',
|
|
260
|
-
shell: 'bash',
|
|
261
|
-
zsh: 'bash',
|
|
262
|
-
yml: 'yaml',
|
|
263
|
-
md: 'markdown',
|
|
264
|
-
text: PLAINTEXT_LANGUAGE,
|
|
265
|
-
txt: PLAINTEXT_LANGUAGE,
|
|
266
|
-
plain: PLAINTEXT_LANGUAGE,
|
|
267
|
-
plaintext: PLAINTEXT_LANGUAGE,
|
|
268
|
-
};
|
|
269
|
-
if (aliases[normalized]) {
|
|
270
|
-
return aliases[normalized];
|
|
271
|
-
}
|
|
272
|
-
if (isBundledLanguage(normalized)) {
|
|
273
|
-
return normalized;
|
|
274
|
-
}
|
|
275
|
-
return PLAINTEXT_LANGUAGE;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Synchronous rehype plugin for Shiki syntax highlighting.
|
|
279
|
-
*
|
|
280
|
-
* Transforms `pre > code` elements to highlighted code using Shiki.
|
|
281
|
-
* If the highlighter is not initialized, code blocks are left as-is.
|
|
282
|
-
*
|
|
283
|
-
* @param options - Plugin options
|
|
284
|
-
* @returns A rehype transformer function
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```ts
|
|
288
|
-
* import { unified } from 'unified';
|
|
289
|
-
* import { rehypeShikiSync } from './rehype-shiki-sync';
|
|
290
|
-
*
|
|
291
|
-
* const processor = unified()
|
|
292
|
-
* .use(remarkRehype)
|
|
293
|
-
* .use(rehypeShikiSync, { theme: 'depict' })
|
|
294
|
-
* .use(rehypeSanitize, schema)
|
|
295
|
-
* .use(rehypeStringify);
|
|
296
|
-
* ```
|
|
297
|
-
*/
|
|
298
|
-
export function rehypeShikiSync(options = {}) {
|
|
299
|
-
const { theme = 'depict', defaultLanguage = PLAINTEXT_LANGUAGE } = options;
|
|
300
|
-
return (tree) => {
|
|
301
|
-
const highlighter = getHighlighterSync();
|
|
302
|
-
// If highlighter isn't ready, skip highlighting
|
|
303
|
-
// Code blocks will render as plain text
|
|
304
|
-
if (!highlighter) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
visit(tree, 'element', (node, index, parent) => {
|
|
308
|
-
// Only process pre > code patterns
|
|
309
|
-
if (node.tagName !== 'pre')
|
|
310
|
-
return;
|
|
311
|
-
if (!parent || typeof index !== 'number')
|
|
312
|
-
return;
|
|
313
|
-
// Find the code child
|
|
314
|
-
const codeChild = node.children.find((child) => child.type === 'element' && child.tagName === 'code');
|
|
315
|
-
if (!codeChild)
|
|
316
|
-
return;
|
|
317
|
-
// Extract language and code
|
|
318
|
-
const rawLanguage = extractLanguage(codeChild);
|
|
319
|
-
const language = rawLanguage ? normalizeLanguage(rawLanguage) : defaultLanguage;
|
|
320
|
-
const code = extractText(codeChild);
|
|
321
|
-
// Skip empty code blocks
|
|
322
|
-
if (!code.trim())
|
|
323
|
-
return;
|
|
324
|
-
// Skip plaintext - no highlighting needed
|
|
325
|
-
if (language === PLAINTEXT_LANGUAGE) {
|
|
326
|
-
// Just add data-language attribute for styling/accessibility
|
|
327
|
-
if (!node.properties)
|
|
328
|
-
node.properties = {};
|
|
329
|
-
node.properties['dataLanguage'] = language;
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
try {
|
|
333
|
-
// Generate highlighted HTML (only for bundled languages)
|
|
334
|
-
const highlightedHtml = highlighter.codeToHtml(code, {
|
|
335
|
-
lang: language,
|
|
336
|
-
theme: theme,
|
|
337
|
-
});
|
|
338
|
-
// Parse the HTML into hast nodes
|
|
339
|
-
const highlightedElement = parseShikiHtml(highlightedHtml);
|
|
340
|
-
// Preserve the original data-language for accessibility
|
|
341
|
-
if (!highlightedElement.properties['dataLanguage']) {
|
|
342
|
-
highlightedElement.properties['dataLanguage'] = language;
|
|
343
|
-
}
|
|
344
|
-
// Replace the original pre element with the highlighted one
|
|
345
|
-
parent.children[index] = highlightedElement;
|
|
346
|
-
}
|
|
347
|
-
catch {
|
|
348
|
-
// If highlighting fails, leave the code block as-is
|
|
349
|
-
// This ensures graceful degradation for unsupported languages
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
export default rehypeShikiSync;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Async markdown rendering via Web Worker.
|
|
3
|
-
*
|
|
4
|
-
* DEP-687: Move rendering pipeline to a Web Worker to free the main thread
|
|
5
|
-
* during streaming at 30+ tokens/second.
|
|
6
|
-
*
|
|
7
|
-
* Lazily creates a Worker + Comlink proxy on first call. Falls back to
|
|
8
|
-
* synchronous rendering for SSR, worker creation failure, and individual
|
|
9
|
-
* render failure.
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
import * as Comlink from 'comlink';
|
|
14
|
-
import { renderMarkdownWithMath } from './render.js';
|
|
15
|
-
let worker = null;
|
|
16
|
-
let proxy = null;
|
|
17
|
-
let workerFailed = false;
|
|
18
|
-
let highlighterInitialized = false;
|
|
19
|
-
function getProxy() {
|
|
20
|
-
if (workerFailed)
|
|
21
|
-
return null;
|
|
22
|
-
if (proxy)
|
|
23
|
-
return proxy;
|
|
24
|
-
if (typeof Worker === 'undefined' || typeof window === 'undefined') {
|
|
25
|
-
workerFailed = true;
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
worker = new Worker(new URL('./render-worker.js', import.meta.url), { type: 'module' });
|
|
30
|
-
// The Worker declaration above satisfies Comlink.Endpoint structurally
|
|
31
|
-
// (postMessage + addEventListener/removeEventListener), so the cast is safe.
|
|
32
|
-
proxy = Comlink.wrap(worker);
|
|
33
|
-
return proxy;
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
workerFailed = true;
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Render markdown asynchronously via Web Worker.
|
|
42
|
-
*
|
|
43
|
-
* Falls back to synchronous `renderMarkdown()` when:
|
|
44
|
-
* - Running in SSR (no Worker global)
|
|
45
|
-
* - Worker creation failed
|
|
46
|
-
* - Individual render call fails
|
|
47
|
-
*/
|
|
48
|
-
export async function renderMarkdownAsync(markdown, options = {}) {
|
|
49
|
-
const p = getProxy();
|
|
50
|
-
// Worker unavailable (SSR, creation failed, etc.) — fall back to the
|
|
51
|
-
// main-thread async path that handles both math-free and math-bearing
|
|
52
|
-
// content by lazy-loading remark-math/rehype-katex on demand. The sync
|
|
53
|
-
// renderMarkdown deliberately drops math, so falling back to it would
|
|
54
|
-
// silently regress math rendering.
|
|
55
|
-
if (!p)
|
|
56
|
-
return renderMarkdownWithMath(markdown, options);
|
|
57
|
-
try {
|
|
58
|
-
return await p.renderMarkdown(markdown, options);
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
// The worker channel is broken (crash, Comlink failure, etc.). Mark it as
|
|
62
|
-
// failed and terminate so future calls don't keep hitting a dead proxy.
|
|
63
|
-
// Reset highlighterInitialized so initializeWorkerHighlighter() reaches
|
|
64
|
-
// getProxy() on re-mount and returns false instead of short-circuiting.
|
|
65
|
-
worker?.terminate();
|
|
66
|
-
worker = null;
|
|
67
|
-
proxy = null;
|
|
68
|
-
workerFailed = true;
|
|
69
|
-
highlighterInitialized = false;
|
|
70
|
-
return renderMarkdownWithMath(markdown, options);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Initialize the Shiki highlighter inside the Web Worker.
|
|
75
|
-
*
|
|
76
|
-
* The worker maintains its own highlighter instance, separate from
|
|
77
|
-
* the main thread. Call this after the main-thread highlighter is ready.
|
|
78
|
-
*
|
|
79
|
-
* Returns `true` when the worker highlighter initialized successfully, `false`
|
|
80
|
-
* when the worker is unavailable or Shiki initialization failed. Callers must
|
|
81
|
-
* check the return value before treating the worker as highlighted — setting
|
|
82
|
-
* `workerHighlighterReady` unconditionally would cause unhighlighted worker
|
|
83
|
-
* output to become sticky when initialization silently failed.
|
|
84
|
-
*/
|
|
85
|
-
export async function initializeWorkerHighlighter() {
|
|
86
|
-
if (highlighterInitialized)
|
|
87
|
-
return true;
|
|
88
|
-
const p = getProxy();
|
|
89
|
-
if (!p)
|
|
90
|
-
return false;
|
|
91
|
-
try {
|
|
92
|
-
await p.initializeHighlighter();
|
|
93
|
-
highlighterInitialized = true;
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
/* renders proceed without highlighting */
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Terminate the markdown rendering Worker.
|
|
103
|
-
*
|
|
104
|
-
* Cleans up the Worker thread and resets state so a fresh Worker
|
|
105
|
-
* will be created on the next render call. Useful for cleanup
|
|
106
|
-
* in tests or when the component tree unmounts.
|
|
107
|
-
*/
|
|
108
|
-
export function terminateMarkdownWorker() {
|
|
109
|
-
worker?.terminate();
|
|
110
|
-
worker = null;
|
|
111
|
-
proxy = null;
|
|
112
|
-
workerFailed = false;
|
|
113
|
-
highlighterInitialized = false;
|
|
114
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Streaming markdown rendering utilities.
|
|
3
|
-
*
|
|
4
|
-
* During streaming, partial content may contain unclosed code fences,
|
|
5
|
-
* incomplete tables, or broken links. These functions find safe boundaries
|
|
6
|
-
* to split content for rendering: everything before the boundary is valid
|
|
7
|
-
* markdown that can be safely rendered; the tail after the boundary is
|
|
8
|
-
* displayed as raw pre-wrap text with a cursor animation.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Find the last position in `text` where everything before it
|
|
14
|
-
* forms valid, renderable markdown.
|
|
15
|
-
*
|
|
16
|
-
* Strategy (in priority order):
|
|
17
|
-
* 1. If we're inside an unclosed code fence, split before the opening fence.
|
|
18
|
-
* 2. If we're inside an unclosed table, split before the table starts.
|
|
19
|
-
* 3. Otherwise, split at the last paragraph boundary (double newline).
|
|
20
|
-
* 4. Fall back to the last single newline.
|
|
21
|
-
* 5. If no newlines at all, return the full length (render everything).
|
|
22
|
-
*/
|
|
23
|
-
export function findSafeRenderBoundary(text) {
|
|
24
|
-
// Check for unclosed code fence
|
|
25
|
-
const fenceIndex = findUnclosedCodeFence(text);
|
|
26
|
-
if (fenceIndex !== -1)
|
|
27
|
-
return fenceIndex;
|
|
28
|
-
// Check for unclosed table (a line starting with | without a closing row)
|
|
29
|
-
const tableIndex = findUnclosedTable(text);
|
|
30
|
-
if (tableIndex !== -1)
|
|
31
|
-
return tableIndex;
|
|
32
|
-
// Fall back to the last paragraph boundary (double newline)
|
|
33
|
-
const lastDoubleNewline = text.lastIndexOf('\n\n');
|
|
34
|
-
if (lastDoubleNewline !== -1)
|
|
35
|
-
return lastDoubleNewline;
|
|
36
|
-
// Fall back to last single newline
|
|
37
|
-
const lastNewline = text.lastIndexOf('\n');
|
|
38
|
-
if (lastNewline !== -1)
|
|
39
|
-
return lastNewline;
|
|
40
|
-
// No good boundary — render everything
|
|
41
|
-
return text.length;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Find the start of an unclosed code fence.
|
|
45
|
-
*
|
|
46
|
-
* Scans for ``` or ~~~ fences and returns the position of the opening
|
|
47
|
-
* fence if it's unclosed (odd number of fences). Returns -1 if all
|
|
48
|
-
* fences are properly paired.
|
|
49
|
-
*/
|
|
50
|
-
function findUnclosedCodeFence(text) {
|
|
51
|
-
const fencePattern = /^(`{3,}|~{3,})/gm;
|
|
52
|
-
let lastOpenFence = -1;
|
|
53
|
-
let isOpen = false;
|
|
54
|
-
let openChar = '';
|
|
55
|
-
let openLength = 0;
|
|
56
|
-
let match;
|
|
57
|
-
while ((match = fencePattern.exec(text)) !== null) {
|
|
58
|
-
const fence = match[1] ?? '';
|
|
59
|
-
const char = fence[0] ?? '';
|
|
60
|
-
const length = fence.length;
|
|
61
|
-
if (!isOpen) {
|
|
62
|
-
// Opening a new fence
|
|
63
|
-
isOpen = true;
|
|
64
|
-
openChar = char;
|
|
65
|
-
openLength = length;
|
|
66
|
-
lastOpenFence = match.index;
|
|
67
|
-
}
|
|
68
|
-
else if (char === openChar && length >= openLength) {
|
|
69
|
-
// Closing the fence (same or longer fence of same character)
|
|
70
|
-
isOpen = false;
|
|
71
|
-
lastOpenFence = -1;
|
|
72
|
-
}
|
|
73
|
-
// Otherwise: different char or shorter fence inside open block, skip
|
|
74
|
-
}
|
|
75
|
-
return isOpen ? lastOpenFence : -1;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Find the start of an unclosed GFM table.
|
|
79
|
-
*
|
|
80
|
-
* A table requires at least a header row, a separator row (with |---|),
|
|
81
|
-
* and is terminated by a blank line or EOF. If we find a separator row
|
|
82
|
-
* without a subsequent blank line, the table is potentially incomplete.
|
|
83
|
-
*/
|
|
84
|
-
function findUnclosedTable(text) {
|
|
85
|
-
// Find the last table separator row (e.g., |---|---|)
|
|
86
|
-
const separatorPattern = /^\|?[\s-]+\|[\s-|]+$/gm;
|
|
87
|
-
let lastSeparatorIndex = -1;
|
|
88
|
-
let match;
|
|
89
|
-
while ((match = separatorPattern.exec(text)) !== null) {
|
|
90
|
-
lastSeparatorIndex = match.index;
|
|
91
|
-
}
|
|
92
|
-
if (lastSeparatorIndex === -1)
|
|
93
|
-
return -1;
|
|
94
|
-
// Check if there's a blank line after the separator (table might be complete)
|
|
95
|
-
const afterSeparator = text.indexOf('\n\n', lastSeparatorIndex);
|
|
96
|
-
if (afterSeparator !== -1)
|
|
97
|
-
return -1; // Table is followed by blank line, probably complete
|
|
98
|
-
// The table might be incomplete. Find its start by scanning backward
|
|
99
|
-
// for the first non-table line before the separator.
|
|
100
|
-
const beforeSeparator = text.lastIndexOf('\n\n', lastSeparatorIndex);
|
|
101
|
-
if (beforeSeparator !== -1)
|
|
102
|
-
return beforeSeparator;
|
|
103
|
-
// Table starts at beginning of text
|
|
104
|
-
return 0;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Split streaming content into a renderable portion and a raw tail.
|
|
108
|
-
*
|
|
109
|
-
* @returns An object with `rendered` (safe markdown to process through
|
|
110
|
-
* renderMarkdown) and `tail` (raw text to display with pre-wrap styling).
|
|
111
|
-
*/
|
|
112
|
-
export function splitStreamingContent(text) {
|
|
113
|
-
if (!text)
|
|
114
|
-
return { rendered: '', tail: '' };
|
|
115
|
-
const boundary = findSafeRenderBoundary(text);
|
|
116
|
-
if (boundary >= text.length) {
|
|
117
|
-
return { rendered: text, tail: '' };
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
rendered: text.slice(0, boundary),
|
|
121
|
-
tail: text.slice(boundary),
|
|
122
|
-
};
|
|
123
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Worker entry point for off-main-thread markdown rendering.
|
|
3
|
-
*
|
|
4
|
-
* DEP-687: Move rendering pipeline to a Web Worker to free the main thread
|
|
5
|
-
* during streaming. Exposes the same `renderMarkdown` function via Comlink.
|
|
6
|
-
*
|
|
7
|
-
* The worker initializes its own Shiki highlighter instance independently
|
|
8
|
-
* from the main thread.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
// Minimal DOM shim for dependencies that reference `document` at module load
|
|
13
|
-
// time (KaTeX creates DOM nodes via `document.createElement` / `createDocumentFragment`
|
|
14
|
-
// at import time). Workers have no `document` global — this shim provides just enough
|
|
15
|
-
// surface for the module to load. rehype-katex uses `katex.renderToString()` which
|
|
16
|
-
// bypasses real DOM entirely, so these shim nodes are never used at render time.
|
|
17
|
-
// eslint-disable-next-line import/no-unassigned-import -- side-effect import: registers global DOM shims on the worker's `globalThis` before any dependency that touches `document` at module-load time is imported below.
|
|
18
|
-
import './worker-dom-shim.js';
|
|
19
|
-
import * as Comlink from 'comlink';
|
|
20
|
-
import { initializeHighlighter } from './highlighter.js';
|
|
21
|
-
import { renderMarkdownWithMath } from './render.js';
|
|
22
|
-
const workerApi = {
|
|
23
|
-
// Use the math-aware async entry. The sync `renderMarkdown` deliberately
|
|
24
|
-
// drops math support after the lazy-load refactor — wiring the worker to
|
|
25
|
-
// it would silently regress math rendering for any caller using the
|
|
26
|
-
// worker path. `renderMarkdownWithMath` pre-checks for math markers and
|
|
27
|
-
// only loads remark-math/rehype-katex when needed.
|
|
28
|
-
renderMarkdown(markdown, options = {}) {
|
|
29
|
-
return renderMarkdownWithMath(markdown, options);
|
|
30
|
-
},
|
|
31
|
-
async initializeHighlighter() {
|
|
32
|
-
await initializeHighlighter();
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
Comlink.expose(workerApi);
|