@react-x11/components 0.9.0 → 0.11.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/README.md +10 -4
- package/dist/charts/node.d.ts +11 -1
- package/dist/charts/node.d.ts.map +1 -1
- package/dist/charts/node.js +44 -14
- package/dist/charts/node.js.map +1 -1
- package/dist/charts/render.d.ts +12 -3
- package/dist/charts/render.d.ts.map +1 -1
- package/dist/charts/render.js +94 -25
- package/dist/charts/render.js.map +1 -1
- package/dist/code/index.d.ts.map +1 -1
- package/dist/code/index.js +27 -24
- package/dist/code/index.js.map +1 -1
- package/dist/code-editor/completion.d.ts.map +1 -1
- package/dist/code-editor/completion.js +3 -2
- package/dist/code-editor/completion.js.map +1 -1
- package/dist/code-editor/index.d.ts.map +1 -1
- package/dist/code-editor/index.js +19 -0
- package/dist/code-editor/index.js.map +1 -1
- package/dist/code-editor/node.d.ts +177 -7
- package/dist/code-editor/node.d.ts.map +1 -1
- package/dist/code-editor/node.js +1329 -164
- package/dist/code-editor/node.js.map +1 -1
- package/dist/code-language/index.d.ts +1 -1
- package/dist/code-language/index.d.ts.map +1 -1
- package/dist/code-language/index.js +1 -1
- package/dist/code-language/index.js.map +1 -1
- package/dist/code-language/languages/glsl.d.ts.map +1 -1
- package/dist/code-language/languages/glsl.js +10 -2
- package/dist/code-language/languages/glsl.js.map +1 -1
- package/dist/code-language/languages/javascript.d.ts.map +1 -1
- package/dist/code-language/languages/javascript.js +18 -3
- package/dist/code-language/languages/javascript.js.map +1 -1
- package/dist/code-language/languages/json.d.ts.map +1 -1
- package/dist/code-language/languages/json.js +10 -2
- package/dist/code-language/languages/json.js.map +1 -1
- package/dist/code-language/languages/shell.d.ts.map +1 -1
- package/dist/code-language/languages/shell.js +10 -2
- package/dist/code-language/languages/shell.js.map +1 -1
- package/dist/code-language/languages/sql.d.ts.map +1 -1
- package/dist/code-language/languages/sql.js +20 -2
- package/dist/code-language/languages/sql.js.map +1 -1
- package/dist/code-language/runs.d.ts +31 -0
- package/dist/code-language/runs.d.ts.map +1 -1
- package/dist/code-language/runs.js +105 -0
- package/dist/code-language/runs.js.map +1 -1
- package/dist/code-language/stream.d.ts +22 -0
- package/dist/code-language/stream.d.ts.map +1 -1
- package/dist/code-language/stream.js +259 -9
- package/dist/code-language/stream.js.map +1 -1
- package/dist/code-language/types.d.ts +5 -4
- package/dist/code-language/types.d.ts.map +1 -1
- package/dist/codeblock/index.d.ts +26 -2
- package/dist/codeblock/index.d.ts.map +1 -1
- package/dist/codeblock/index.js +57 -4
- package/dist/codeblock/index.js.map +1 -1
- package/dist/flow/draw.d.ts +50 -0
- package/dist/flow/draw.d.ts.map +1 -1
- package/dist/flow/draw.js +132 -33
- package/dist/flow/draw.js.map +1 -1
- package/dist/flow/gl/color.d.ts +13 -0
- package/dist/flow/gl/color.d.ts.map +1 -0
- package/dist/flow/gl/color.js +82 -0
- package/dist/flow/gl/color.js.map +1 -0
- package/dist/flow/gl/index.d.ts +60 -0
- package/dist/flow/gl/index.d.ts.map +1 -0
- package/dist/flow/gl/index.js +283 -0
- package/dist/flow/gl/index.js.map +1 -0
- package/dist/flow/gl/pack.d.ts +133 -0
- package/dist/flow/gl/pack.d.ts.map +1 -0
- package/dist/flow/gl/pack.js +408 -0
- package/dist/flow/gl/pack.js.map +1 -0
- package/dist/flow/gl/renderer.d.ts +95 -0
- package/dist/flow/gl/renderer.d.ts.map +1 -0
- package/dist/flow/gl/renderer.js +459 -0
- package/dist/flow/gl/renderer.js.map +1 -0
- package/dist/flow/gl/shaders.d.ts +79 -0
- package/dist/flow/gl/shaders.d.ts.map +1 -0
- package/dist/flow/gl/shaders.js +346 -0
- package/dist/flow/gl/shaders.js.map +1 -0
- package/dist/flow/gl/text.d.ts +318 -0
- package/dist/flow/gl/text.d.ts.map +1 -0
- package/dist/flow/gl/text.js +1103 -0
- package/dist/flow/gl/text.js.map +1 -0
- package/dist/flow/index.d.ts +1 -1
- package/dist/flow/index.d.ts.map +1 -1
- package/dist/flow/index.js +619 -64
- package/dist/flow/index.js.map +1 -1
- package/dist/flow/node.d.ts +621 -72
- package/dist/flow/node.d.ts.map +1 -1
- package/dist/flow/node.js +2253 -1018
- package/dist/flow/node.js.map +1 -1
- package/dist/flow/paint.d.ts +35 -0
- package/dist/flow/paint.d.ts.map +1 -0
- package/dist/flow/paint.js +393 -0
- package/dist/flow/paint.js.map +1 -0
- package/dist/flow/paths.d.ts +14 -0
- package/dist/flow/paths.d.ts.map +1 -1
- package/dist/flow/paths.js +45 -19
- package/dist/flow/paths.js.map +1 -1
- package/dist/flow/scene.d.ts +584 -0
- package/dist/flow/scene.d.ts.map +1 -0
- package/dist/flow/scene.js +1453 -0
- package/dist/flow/scene.js.map +1 -0
- package/dist/flow/types.d.ts +111 -1
- package/dist/flow/types.d.ts.map +1 -1
- package/dist/html/controls.d.ts +28 -0
- package/dist/html/controls.d.ts.map +1 -1
- package/dist/html/controls.js +52 -2
- package/dist/html/controls.js.map +1 -1
- package/dist/html/css/calc.d.ts +14 -0
- package/dist/html/css/calc.d.ts.map +1 -0
- package/dist/html/css/calc.js +344 -0
- package/dist/html/css/calc.js.map +1 -0
- package/dist/html/css/cascade.d.ts +262 -6
- package/dist/html/css/cascade.d.ts.map +1 -1
- package/dist/html/css/cascade.js +1373 -67
- package/dist/html/css/cascade.js.map +1 -1
- package/dist/html/css/color.d.ts +23 -0
- package/dist/html/css/color.d.ts.map +1 -0
- package/dist/html/css/color.js +740 -0
- package/dist/html/css/color.js.map +1 -0
- package/dist/html/css/content.d.ts +92 -0
- package/dist/html/css/content.d.ts.map +1 -0
- package/dist/html/css/content.js +388 -0
- package/dist/html/css/content.js.map +1 -0
- package/dist/html/css/counter-styles.d.ts +76 -0
- package/dist/html/css/counter-styles.d.ts.map +1 -0
- package/dist/html/css/counter-styles.js +893 -0
- package/dist/html/css/counter-styles.js.map +1 -0
- package/dist/html/css/decode.d.ts +12 -0
- package/dist/html/css/decode.d.ts.map +1 -0
- package/dist/html/css/decode.js +116 -0
- package/dist/html/css/decode.js.map +1 -0
- package/dist/html/css/parse.d.ts +110 -10
- package/dist/html/css/parse.d.ts.map +1 -1
- package/dist/html/css/parse.js +1473 -180
- package/dist/html/css/parse.js.map +1 -1
- package/dist/html/css/style.d.ts +501 -15
- package/dist/html/css/style.d.ts.map +1 -1
- package/dist/html/css/style.js +3729 -206
- package/dist/html/css/style.js.map +1 -1
- package/dist/html/css/ua.d.ts.map +1 -1
- package/dist/html/css/ua.js +65 -16
- package/dist/html/css/ua.js.map +1 -1
- package/dist/html/css/values.d.ts +37 -3
- package/dist/html/css/values.d.ts.map +1 -1
- package/dist/html/css/values.js +122 -48
- package/dist/html/css/values.js.map +1 -1
- package/dist/html/css/vars.d.ts +52 -0
- package/dist/html/css/vars.d.ts.map +1 -0
- package/dist/html/css/vars.js +358 -0
- package/dist/html/css/vars.js.map +1 -0
- package/dist/html/dom.d.ts +30 -4
- package/dist/html/dom.d.ts.map +1 -1
- package/dist/html/dom.js +278 -17
- package/dist/html/dom.js.map +1 -1
- package/dist/html/fonts.d.ts +106 -0
- package/dist/html/fonts.d.ts.map +1 -0
- package/dist/html/fonts.js +565 -0
- package/dist/html/fonts.js.map +1 -0
- package/dist/html/gif.d.ts +15 -0
- package/dist/html/gif.d.ts.map +1 -0
- package/dist/html/gif.js +229 -0
- package/dist/html/gif.js.map +1 -0
- package/dist/html/index.d.ts +50 -11
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +115 -9
- package/dist/html/index.js.map +1 -1
- package/dist/html/layout/block.d.ts +226 -3
- package/dist/html/layout/block.d.ts.map +1 -1
- package/dist/html/layout/block.js +3077 -219
- package/dist/html/layout/block.js.map +1 -1
- package/dist/html/layout/boxes.d.ts +367 -17
- package/dist/html/layout/boxes.d.ts.map +1 -1
- package/dist/html/layout/boxes.js +1742 -182
- package/dist/html/layout/boxes.js.map +1 -1
- package/dist/html/layout/cache.d.ts +58 -0
- package/dist/html/layout/cache.d.ts.map +1 -0
- package/dist/html/layout/cache.js +224 -0
- package/dist/html/layout/cache.js.map +1 -0
- package/dist/html/layout/collapse.d.ts +45 -0
- package/dist/html/layout/collapse.d.ts.map +1 -0
- package/dist/html/layout/collapse.js +246 -0
- package/dist/html/layout/collapse.js.map +1 -0
- package/dist/html/layout/css-grid.d.ts +7 -0
- package/dist/html/layout/css-grid.d.ts.map +1 -0
- package/dist/html/layout/css-grid.js +900 -0
- package/dist/html/layout/css-grid.js.map +1 -0
- package/dist/html/layout/flex.d.ts.map +1 -1
- package/dist/html/layout/flex.js +1025 -89
- package/dist/html/layout/flex.js.map +1 -1
- package/dist/html/layout/floats.d.ts +45 -6
- package/dist/html/layout/floats.d.ts.map +1 -1
- package/dist/html/layout/floats.js +113 -14
- package/dist/html/layout/floats.js.map +1 -1
- package/dist/html/layout/grid-lines.d.ts +39 -0
- package/dist/html/layout/grid-lines.d.ts.map +1 -0
- package/dist/html/layout/grid-lines.js +119 -0
- package/dist/html/layout/grid-lines.js.map +1 -0
- package/dist/html/layout/grid.d.ts +53 -0
- package/dist/html/layout/grid.d.ts.map +1 -0
- package/dist/html/layout/grid.js +153 -0
- package/dist/html/layout/grid.js.map +1 -0
- package/dist/html/layout/inline.d.ts +154 -1
- package/dist/html/layout/inline.d.ts.map +1 -1
- package/dist/html/layout/inline.js +3598 -175
- package/dist/html/layout/inline.js.map +1 -1
- package/dist/html/layout/shaping.d.ts +6 -0
- package/dist/html/layout/shaping.d.ts.map +1 -0
- package/dist/html/layout/shaping.js +100 -0
- package/dist/html/layout/shaping.js.map +1 -0
- package/dist/html/layout/table.d.ts +3 -0
- package/dist/html/layout/table.d.ts.map +1 -1
- package/dist/html/layout/table.js +681 -175
- package/dist/html/layout/table.js.map +1 -1
- package/dist/html/layout/tracks.d.ts +44 -0
- package/dist/html/layout/tracks.d.ts.map +1 -0
- package/dist/html/layout/tracks.js +349 -0
- package/dist/html/layout/tracks.js.map +1 -0
- package/dist/html/node.d.ts +169 -4
- package/dist/html/node.d.ts.map +1 -1
- package/dist/html/node.js +1429 -137
- package/dist/html/node.js.map +1 -1
- package/dist/html/paint.d.ts +92 -3
- package/dist/html/paint.d.ts.map +1 -1
- package/dist/html/paint.js +3635 -107
- package/dist/html/paint.js.map +1 -1
- package/dist/html/resources.d.ts +60 -14
- package/dist/html/resources.d.ts.map +1 -1
- package/dist/html/resources.js +122 -36
- package/dist/html/resources.js.map +1 -1
- package/dist/html/surfaces.d.ts +23 -0
- package/dist/html/surfaces.d.ts.map +1 -0
- package/dist/html/surfaces.js +68 -0
- package/dist/html/surfaces.js.map +1 -0
- package/dist/html/svg.d.ts +80 -0
- package/dist/html/svg.d.ts.map +1 -0
- package/dist/html/svg.js +442 -0
- package/dist/html/svg.js.map +1 -0
- package/dist/html/url.d.ts +23 -0
- package/dist/html/url.d.ts.map +1 -0
- package/dist/html/url.js +80 -0
- package/dist/html/url.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/codelines.d.ts +42 -0
- package/dist/internal/codelines.d.ts.map +1 -0
- package/dist/internal/codelines.js +170 -0
- package/dist/internal/codelines.js.map +1 -0
- package/dist/internal/collate.d.ts +3 -0
- package/dist/internal/collate.d.ts.map +1 -0
- package/dist/internal/collate.js +11 -0
- package/dist/internal/collate.js.map +1 -0
- package/dist/internal/markdown/ast.d.ts +11 -0
- package/dist/internal/markdown/ast.d.ts.map +1 -1
- package/dist/internal/markdown/parse.d.ts.map +1 -1
- package/dist/internal/markdown/parse.js +109 -8
- package/dist/internal/markdown/parse.js.map +1 -1
- package/dist/internal/prewarm.d.ts +18 -0
- package/dist/internal/prewarm.d.ts.map +1 -0
- package/dist/internal/prewarm.js +42 -0
- package/dist/internal/prewarm.js.map +1 -0
- package/dist/internal/sdf.d.ts +20 -0
- package/dist/internal/sdf.d.ts.map +1 -0
- package/dist/internal/sdf.js +216 -0
- package/dist/internal/sdf.js.map +1 -0
- package/dist/internal/splice.d.ts +12 -0
- package/dist/internal/splice.d.ts.map +1 -0
- package/dist/internal/splice.js +23 -0
- package/dist/internal/splice.js.map +1 -0
- package/dist/internal/window.d.ts +12 -0
- package/dist/internal/window.d.ts.map +1 -1
- package/dist/internal/window.js +23 -6
- package/dist/internal/window.js.map +1 -1
- package/dist/maps/anchors.d.ts +6 -1
- package/dist/maps/anchors.d.ts.map +1 -1
- package/dist/maps/anchors.js +260 -1
- package/dist/maps/anchors.js.map +1 -1
- package/dist/maps/controller.d.ts +57 -0
- package/dist/maps/controller.d.ts.map +1 -1
- package/dist/maps/controller.js +97 -18
- package/dist/maps/controller.js.map +1 -1
- package/dist/maps/gl/buckets.d.ts +5 -1
- package/dist/maps/gl/buckets.d.ts.map +1 -1
- package/dist/maps/gl/buckets.js +5 -2
- package/dist/maps/gl/buckets.js.map +1 -1
- package/dist/maps/gl/build-worker.d.ts +2 -0
- package/dist/maps/gl/build-worker.d.ts.map +1 -1
- package/dist/maps/gl/build-worker.js +1 -1
- package/dist/maps/gl/build-worker.js.map +1 -1
- package/dist/maps/gl/cover.d.ts +23 -4
- package/dist/maps/gl/cover.d.ts.map +1 -1
- package/dist/maps/gl/cover.js +61 -48
- package/dist/maps/gl/cover.js.map +1 -1
- package/dist/maps/gl/placement.d.ts +21 -8
- package/dist/maps/gl/placement.d.ts.map +1 -1
- package/dist/maps/gl/placement.js +133 -58
- package/dist/maps/gl/placement.js.map +1 -1
- package/dist/maps/gl/renderer.d.ts +36 -4
- package/dist/maps/gl/renderer.d.ts.map +1 -1
- package/dist/maps/gl/renderer.js +81 -24
- package/dist/maps/gl/renderer.js.map +1 -1
- package/dist/maps/gl/shaders.d.ts +18 -17
- package/dist/maps/gl/shaders.d.ts.map +1 -1
- package/dist/maps/gl/shaders.js +34 -32
- package/dist/maps/gl/shaders.js.map +1 -1
- package/dist/maps/gl/store.d.ts +10 -0
- package/dist/maps/gl/store.d.ts.map +1 -1
- package/dist/maps/gl/store.js +47 -4
- package/dist/maps/gl/store.js.map +1 -1
- package/dist/maps/gl/text.d.ts +153 -24
- package/dist/maps/gl/text.d.ts.map +1 -1
- package/dist/maps/gl/text.js +379 -63
- package/dist/maps/gl/text.js.map +1 -1
- package/dist/maps/gl/view.d.ts +293 -2
- package/dist/maps/gl/view.d.ts.map +1 -1
- package/dist/maps/gl/view.js +317 -82
- package/dist/maps/gl/view.js.map +1 -1
- package/dist/maps/icons.d.ts +32 -0
- package/dist/maps/icons.d.ts.map +1 -0
- package/dist/maps/icons.js +151 -0
- package/dist/maps/icons.js.map +1 -0
- package/dist/maps/index.d.ts +2 -0
- package/dist/maps/index.d.ts.map +1 -1
- package/dist/maps/index.js +2 -0
- package/dist/maps/index.js.map +1 -1
- package/dist/maps/labels.d.ts +56 -4
- package/dist/maps/labels.d.ts.map +1 -1
- package/dist/maps/labels.js +213 -46
- package/dist/maps/labels.js.map +1 -1
- package/dist/maps/node.d.ts +17 -0
- package/dist/maps/node.d.ts.map +1 -1
- package/dist/maps/node.js +64 -30
- package/dist/maps/node.js.map +1 -1
- package/dist/maps/proj.d.ts +48 -0
- package/dist/maps/proj.d.ts.map +1 -1
- package/dist/maps/proj.js +73 -0
- package/dist/maps/proj.js.map +1 -1
- package/dist/maps/sources.d.ts +5 -3
- package/dist/maps/sources.d.ts.map +1 -1
- package/dist/maps/sources.js +5 -3
- package/dist/maps/sources.js.map +1 -1
- package/dist/maps/style.d.ts +35 -0
- package/dist/maps/style.d.ts.map +1 -1
- package/dist/maps/style.js.map +1 -1
- package/dist/maps/styles.d.ts +12 -0
- package/dist/maps/styles.d.ts.map +1 -1
- package/dist/maps/styles.js +120 -6
- package/dist/maps/styles.js.map +1 -1
- package/dist/maps/tiles.d.ts +31 -11
- package/dist/maps/tiles.d.ts.map +1 -1
- package/dist/maps/tiles.js +61 -27
- package/dist/maps/tiles.js.map +1 -1
- package/dist/maps/types.d.ts +28 -4
- package/dist/maps/types.d.ts.map +1 -1
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +209 -68
- package/dist/markdown/index.js.map +1 -1
- package/dist/markdown/spans.d.ts.map +1 -1
- package/dist/markdown/spans.js +6 -0
- package/dist/markdown/spans.js.map +1 -1
- package/dist/qml/containers.d.ts.map +1 -1
- package/dist/qml/containers.js +6 -1
- package/dist/qml/containers.js.map +1 -1
- package/dist/qml/interaction.d.ts.map +1 -1
- package/dist/qml/interaction.js +38 -5
- package/dist/qml/interaction.js.map +1 -1
- package/dist/qml/layouts.d.ts.map +1 -1
- package/dist/qml/layouts.js +21 -6
- package/dist/qml/layouts.js.map +1 -1
- package/dist/qml/qtquick.d.ts.map +1 -1
- package/dist/qml/qtquick.js +9 -2
- package/dist/qml/qtquick.js.map +1 -1
- package/dist/qml/react.d.ts.map +1 -1
- package/dist/qml/react.js +9 -7
- package/dist/qml/react.js.map +1 -1
- package/dist/reorder/clock.d.ts +7 -0
- package/dist/reorder/clock.d.ts.map +1 -0
- package/dist/reorder/clock.js +26 -0
- package/dist/reorder/clock.js.map +1 -0
- package/dist/reorder/index.d.ts +25 -3
- package/dist/reorder/index.d.ts.map +1 -1
- package/dist/reorder/index.js +64 -19
- package/dist/reorder/index.js.map +1 -1
- package/dist/rich-text-editor/index.d.ts +0 -11
- package/dist/rich-text-editor/index.d.ts.map +1 -1
- package/dist/rich-text-editor/index.js +38 -9
- package/dist/rich-text-editor/index.js.map +1 -1
- package/dist/rich-text-editor/keymap.d.ts.map +1 -1
- package/dist/rich-text-editor/keymap.js +2 -1
- package/dist/rich-text-editor/keymap.js.map +1 -1
- package/dist/rich-text-editor/keys.d.ts +17 -6
- package/dist/rich-text-editor/keys.d.ts.map +1 -1
- package/dist/rich-text-editor/keys.js +135 -26
- package/dist/rich-text-editor/keys.js.map +1 -1
- package/dist/rich-text-editor/markdown.d.ts.map +1 -1
- package/dist/rich-text-editor/markdown.js +30 -1
- package/dist/rich-text-editor/markdown.js.map +1 -1
- package/dist/rich-text-editor/marks.d.ts +9 -0
- package/dist/rich-text-editor/marks.d.ts.map +1 -0
- package/dist/rich-text-editor/marks.js +83 -0
- package/dist/rich-text-editor/marks.js.map +1 -0
- package/dist/rich-text-editor/render.d.ts.map +1 -1
- package/dist/rich-text-editor/render.js +28 -10
- package/dist/rich-text-editor/render.js.map +1 -1
- package/dist/rich-text-editor/replace.d.ts +13 -0
- package/dist/rich-text-editor/replace.d.ts.map +1 -0
- package/dist/rich-text-editor/replace.js +64 -0
- package/dist/rich-text-editor/replace.js.map +1 -0
- package/dist/rich-text-editor/toolbar.d.ts.map +1 -1
- package/dist/rich-text-editor/toolbar.js +1 -1
- package/dist/rich-text-editor/toolbar.js.map +1 -1
- package/dist/rich-text-editor/virtual.d.ts.map +1 -1
- package/dist/rich-text-editor/virtual.js +17 -0
- package/dist/rich-text-editor/virtual.js.map +1 -1
- package/dist/richtext/node.d.ts +46 -2
- package/dist/richtext/node.d.ts.map +1 -1
- package/dist/richtext/node.js +187 -4
- package/dist/richtext/node.js.map +1 -1
- package/dist/richtext/runs.d.ts +13 -8
- package/dist/richtext/runs.d.ts.map +1 -1
- package/dist/richtext/runs.js +18 -8
- package/dist/richtext/runs.js.map +1 -1
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +23 -0
- package/dist/table/index.js.map +1 -1
- package/dist/table/rows.d.ts +3 -2
- package/dist/table/rows.d.ts.map +1 -1
- package/dist/table/rows.js +20 -6
- package/dist/table/rows.js.map +1 -1
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +4 -0
- package/dist/terminal/index.js.map +1 -1
- package/dist/terminal/vt/pty.d.ts +13 -2
- package/dist/terminal/vt/pty.d.ts.map +1 -1
- package/dist/terminal/vt/pty.js +18 -3
- package/dist/terminal/vt/pty.js.map +1 -1
- package/dist/terminal-output/index.d.ts.map +1 -1
- package/dist/terminal-output/index.js +103 -23
- package/dist/terminal-output/index.js.map +1 -1
- package/dist/terminal-output/runs.d.ts +4 -1
- package/dist/terminal-output/runs.d.ts.map +1 -1
- package/dist/terminal-output/runs.js +5 -1
- package/dist/terminal-output/runs.js.map +1 -1
- package/dist/three/canvas.d.ts.map +1 -1
- package/dist/three/canvas.js +85 -7
- package/dist/three/canvas.js.map +1 -1
- package/dist/three/events.d.ts +22 -4
- package/dist/three/events.d.ts.map +1 -1
- package/dist/three/events.js +34 -4
- package/dist/three/events.js.map +1 -1
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +17 -0
- package/dist/tree/index.js.map +1 -1
- package/package.json +42 -33
- package/src/charts/node.ts +62 -26
- package/src/charts/render.ts +120 -30
- package/src/code/index.ts +36 -32
- package/src/code-editor/completion.ts +3 -2
- package/src/code-editor/index.ts +19 -0
- package/src/code-editor/node.ts +1574 -184
- package/src/code-language/index.ts +1 -1
- package/src/code-language/languages/glsl.ts +12 -2
- package/src/code-language/languages/javascript.ts +21 -4
- package/src/code-language/languages/json.ts +12 -2
- package/src/code-language/languages/shell.ts +12 -2
- package/src/code-language/languages/sql.ts +22 -2
- package/src/code-language/runs.ts +111 -1
- package/src/code-language/stream.ts +257 -17
- package/src/code-language/types.ts +5 -4
- package/src/codeblock/index.ts +68 -4
- package/src/flow/draw.ts +167 -41
- package/src/flow/gl/color.ts +85 -0
- package/src/flow/gl/index.ts +342 -0
- package/src/flow/gl/pack.ts +585 -0
- package/src/flow/gl/renderer.ts +679 -0
- package/src/flow/gl/shaders.ts +371 -0
- package/src/flow/gl/text.ts +1295 -0
- package/src/flow/index.ts +794 -67
- package/src/flow/node.ts +2496 -1256
- package/src/flow/paint.ts +511 -0
- package/src/flow/paths.ts +80 -15
- package/src/flow/scene.ts +2199 -0
- package/src/flow/types.ts +113 -1
- package/src/html/controls.ts +73 -2
- package/src/html/css/calc.ts +385 -0
- package/src/html/css/cascade.ts +1481 -62
- package/src/html/css/color.ts +755 -0
- package/src/html/css/content.ts +417 -0
- package/src/html/css/counter-styles.ts +973 -0
- package/src/html/css/decode.ts +130 -0
- package/src/html/css/parse.ts +1514 -160
- package/src/html/css/style.ts +4131 -223
- package/src/html/css/ua.ts +66 -17
- package/src/html/css/values.ts +150 -50
- package/src/html/css/vars.ts +348 -0
- package/src/html/dom.ts +284 -17
- package/src/html/fonts.ts +641 -0
- package/src/html/gif.ts +233 -0
- package/src/html/index.ts +180 -20
- package/src/html/layout/block.ts +3560 -208
- package/src/html/layout/boxes.ts +2141 -190
- package/src/html/layout/cache.ts +289 -0
- package/src/html/layout/collapse.ts +317 -0
- package/src/html/layout/css-grid.ts +1063 -0
- package/src/html/layout/flex.ts +1115 -106
- package/src/html/layout/floats.ts +128 -14
- package/src/html/layout/grid-lines.ts +141 -0
- package/src/html/layout/grid.ts +181 -0
- package/src/html/layout/inline.ts +4187 -192
- package/src/html/layout/shaping.ts +140 -0
- package/src/html/layout/table.ts +696 -186
- package/src/html/layout/tracks.ts +437 -0
- package/src/html/node.ts +1585 -156
- package/src/html/paint.ts +4582 -267
- package/src/html/resources.ts +161 -50
- package/src/html/surfaces.ts +81 -0
- package/src/html/svg.ts +504 -0
- package/src/html/url.ts +86 -0
- package/src/index.ts +2 -0
- package/src/internal/codelines.ts +200 -0
- package/src/internal/collate.ts +12 -0
- package/src/internal/markdown/ast.ts +11 -0
- package/src/internal/markdown/parse.ts +154 -11
- package/src/internal/prewarm.ts +45 -0
- package/src/internal/sdf.ts +227 -0
- package/src/internal/splice.ts +25 -0
- package/src/internal/window.ts +36 -5
- package/src/maps/anchors.ts +307 -1
- package/src/maps/controller.ts +116 -31
- package/src/maps/gl/buckets.ts +5 -1
- package/src/maps/gl/build-worker.ts +13 -2
- package/src/maps/gl/cover.ts +79 -44
- package/src/maps/gl/placement.ts +221 -69
- package/src/maps/gl/renderer.ts +104 -20
- package/src/maps/gl/shaders.ts +35 -32
- package/src/maps/gl/store.ts +66 -17
- package/src/maps/gl/text.ts +444 -71
- package/src/maps/gl/view.ts +361 -96
- package/src/maps/icons.ts +183 -0
- package/src/maps/index.ts +4 -0
- package/src/maps/labels.ts +269 -49
- package/src/maps/node.ts +82 -49
- package/src/maps/proj.ts +87 -0
- package/src/maps/sources.ts +5 -3
- package/src/maps/style.ts +32 -0
- package/src/maps/styles.ts +215 -4
- package/src/maps/tiles.ts +64 -31
- package/src/maps/types.ts +28 -4
- package/src/markdown/index.ts +293 -92
- package/src/markdown/spans.ts +5 -0
- package/src/qml/containers.tsx +6 -1
- package/src/qml/interaction.tsx +42 -5
- package/src/qml/layouts.tsx +21 -6
- package/src/qml/qtquick.tsx +9 -2
- package/src/qml/react.tsx +7 -5
- package/src/reorder/clock.ts +27 -0
- package/src/reorder/index.ts +100 -27
- package/src/rich-text-editor/index.ts +37 -12
- package/src/rich-text-editor/keymap.ts +1 -1
- package/src/rich-text-editor/keys.ts +135 -26
- package/src/rich-text-editor/markdown.ts +36 -1
- package/src/rich-text-editor/marks.ts +101 -0
- package/src/rich-text-editor/render.ts +49 -12
- package/src/rich-text-editor/replace.ts +85 -0
- package/src/rich-text-editor/toolbar.ts +1 -1
- package/src/rich-text-editor/virtual.ts +25 -0
- package/src/richtext/node.ts +235 -14
- package/src/richtext/runs.ts +23 -12
- package/src/table/index.ts +29 -0
- package/src/table/rows.ts +18 -8
- package/src/terminal/index.ts +4 -0
- package/src/terminal/vt/pty.ts +16 -2
- package/src/terminal-output/index.ts +129 -31
- package/src/terminal-output/runs.ts +16 -2
- package/src/three/canvas.ts +102 -8
- package/src/three/events.ts +49 -9
- package/src/tree/index.ts +19 -0
|
@@ -24,14 +24,25 @@
|
|
|
24
24
|
// key at a position, the position of a key, the node under a key — and
|
|
25
25
|
// `test/rich-text-editor-model.test.ts` asks it the rest.
|
|
26
26
|
import type { Node as PMNode } from 'prosemirror-model';
|
|
27
|
+
import { Mapping } from 'prosemirror-transform';
|
|
27
28
|
import type { Mappable } from 'prosemirror-transform';
|
|
29
|
+
import { spliceAll } from '../internal/splice.js';
|
|
30
|
+
|
|
31
|
+
/** A block: its key, where it starts, and the node it is. */
|
|
32
|
+
interface Entry {
|
|
33
|
+
key: string;
|
|
34
|
+
pos: number;
|
|
35
|
+
node: PMNode;
|
|
36
|
+
}
|
|
28
37
|
|
|
29
38
|
export class BlockKeys {
|
|
30
39
|
private counter = 0;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
private
|
|
40
|
+
/** Every block, in document order — which is the order of their starts,
|
|
41
|
+
* so a position is found by bisection. */
|
|
42
|
+
private entries: Entry[] = [];
|
|
43
|
+
private byKey = new Map<string, Entry>();
|
|
44
|
+
/** The document the entries describe. */
|
|
45
|
+
private doc: PMNode | null = null;
|
|
35
46
|
|
|
36
47
|
constructor(doc: PMNode) {
|
|
37
48
|
this.update(doc, null);
|
|
@@ -40,22 +51,32 @@ export class BlockKeys {
|
|
|
40
51
|
/** How many blocks the document has — every non-inline node but the
|
|
41
52
|
* document itself. */
|
|
42
53
|
get size(): number {
|
|
43
|
-
return this.
|
|
54
|
+
return this.entries.length;
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
/** The key of the block that starts at `pos`, if one does. */
|
|
47
58
|
keyAt(pos: number): string | undefined {
|
|
48
|
-
|
|
59
|
+
const entries = this.entries;
|
|
60
|
+
let lo = 0;
|
|
61
|
+
let hi = entries.length - 1;
|
|
62
|
+
while (lo <= hi) {
|
|
63
|
+
const mid = (lo + hi) >> 1;
|
|
64
|
+
const at = entries[mid].pos;
|
|
65
|
+
if (at === pos) return entries[mid].key;
|
|
66
|
+
if (at < pos) lo = mid + 1;
|
|
67
|
+
else hi = mid - 1;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
49
70
|
}
|
|
50
71
|
|
|
51
72
|
/** Where the block under `key` starts now. */
|
|
52
73
|
posOf(key: string): number | undefined {
|
|
53
|
-
return this.
|
|
74
|
+
return this.byKey.get(key)?.pos;
|
|
54
75
|
}
|
|
55
76
|
|
|
56
77
|
/** The node the block under `key` is now. */
|
|
57
78
|
nodeOf(key: string): PMNode | undefined {
|
|
58
|
-
return this.
|
|
79
|
+
return this.byKey.get(key)?.node;
|
|
59
80
|
}
|
|
60
81
|
|
|
61
82
|
/**
|
|
@@ -63,57 +84,145 @@ export class BlockKeys {
|
|
|
63
84
|
* transactions) that produced it from the one the keys were last built
|
|
64
85
|
* for; null when nothing knows how the two relate.
|
|
65
86
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
87
|
+
* The top-level blocks the two documents share at either end — the same
|
|
88
|
+
* node objects, which is what ProseMirror's structural sharing leaves
|
|
89
|
+
* everywhere an edit did not reach — keep their keys, and the blocks
|
|
90
|
+
* after the edit only move. What lies between is keyed as the whole
|
|
91
|
+
* document used to be, on every keystroke: a mapped start first, then a
|
|
92
|
+
* surviving node, then a fresh key. So a keystroke costs the block it
|
|
93
|
+
* lands in plus a pass that adds a number to each block after it, where
|
|
94
|
+
* it cost a walk of the document and three maps built from scratch —
|
|
95
|
+
* six milliseconds a key in a 2 MB document.
|
|
68
96
|
*/
|
|
69
97
|
update(doc: PMNode, mapping: Mappable | null): void {
|
|
70
|
-
|
|
98
|
+
const was = this.doc;
|
|
99
|
+
this.doc = doc;
|
|
100
|
+
// the top-level children the two documents share at either end
|
|
101
|
+
let head = 0;
|
|
102
|
+
let tail = 0;
|
|
103
|
+
if (was) {
|
|
104
|
+
const shared = Math.min(was.childCount, doc.childCount);
|
|
105
|
+
while (head < shared && was.child(head) === doc.child(head)) head++;
|
|
106
|
+
while (
|
|
107
|
+
tail < shared - head &&
|
|
108
|
+
was.child(was.childCount - 1 - tail) ===
|
|
109
|
+
doc.child(doc.childCount - 1 - tail)
|
|
110
|
+
) {
|
|
111
|
+
tail++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
let from = 0; // where the changed children start, in both documents
|
|
115
|
+
for (let i = 0; i < head; i++) from += doc.child(i).nodeSize;
|
|
116
|
+
let wasTo = from;
|
|
117
|
+
if (was) {
|
|
118
|
+
for (let i = head; i < was.childCount - tail; i++) {
|
|
119
|
+
wasTo += was.child(i).nodeSize;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
let to = from;
|
|
123
|
+
for (let i = head; i < doc.childCount - tail; i++) {
|
|
124
|
+
to += doc.child(i).nodeSize;
|
|
125
|
+
}
|
|
126
|
+
const entries = this.entries;
|
|
127
|
+
const first = this._firstAtOrAfter(from);
|
|
128
|
+
const end = this._firstAtOrAfter(wasTo);
|
|
129
|
+
const old = entries.slice(first, end);
|
|
130
|
+
|
|
131
|
+
// 1. Where each old block's start went — nowhere, when nothing in the
|
|
132
|
+
// mapping moves a position: a mark added or taken off, an attribute set.
|
|
133
|
+
// Bold over a whole document is one step a paragraph, and mapping every
|
|
134
|
+
// block through every one of them was a third of the command.
|
|
71
135
|
const carried = new Map<number, string>();
|
|
72
|
-
if (mapping) {
|
|
73
|
-
for (const
|
|
136
|
+
if (mapping && !movesNothing(mapping)) {
|
|
137
|
+
for (const { pos, key } of old) {
|
|
74
138
|
const result = mapping.mapResult(pos, 1);
|
|
75
139
|
// the token after the start is the block's own opening — gone means
|
|
76
140
|
// the block is gone, merged into whatever preceded it
|
|
77
141
|
if (result.deletedAfter) continue;
|
|
78
142
|
if (!carried.has(result.pos)) carried.set(result.pos, key);
|
|
79
143
|
}
|
|
144
|
+
} else if (mapping) {
|
|
145
|
+
for (const { pos, key } of old) {
|
|
146
|
+
if (!carried.has(pos)) carried.set(pos, key);
|
|
147
|
+
}
|
|
80
148
|
}
|
|
81
149
|
// 2. Which old node objects are still here, for when nothing mapped.
|
|
82
150
|
const byNode = new Map<PMNode, string[]>();
|
|
83
151
|
const carriedKeys = new Set(carried.values());
|
|
84
|
-
for (const
|
|
152
|
+
for (const { key, node } of old) {
|
|
85
153
|
if (carriedKeys.has(key)) continue;
|
|
86
154
|
const list = byNode.get(node);
|
|
87
155
|
if (list) list.push(key);
|
|
88
156
|
else byNode.set(node, [key]);
|
|
89
157
|
}
|
|
158
|
+
for (const { key } of old) this.byKey.delete(key);
|
|
90
159
|
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
160
|
+
// 3. The changed children, keyed.
|
|
161
|
+
const fresh: Entry[] = [];
|
|
162
|
+
const used = new Set<string>();
|
|
163
|
+
const visit = (node: PMNode, pos: number): boolean => {
|
|
95
164
|
if (node.isInline) return false;
|
|
96
165
|
let key = carried.get(pos);
|
|
97
|
-
if (key !== undefined &&
|
|
166
|
+
if (key !== undefined && used.has(key)) key = undefined;
|
|
98
167
|
if (key === undefined) {
|
|
99
168
|
const list = byNode.get(node);
|
|
100
169
|
while (list && list.length > 0) {
|
|
101
170
|
const candidate = list.shift()!;
|
|
102
|
-
if (!
|
|
171
|
+
if (!used.has(candidate)) {
|
|
103
172
|
key = candidate;
|
|
104
173
|
break;
|
|
105
174
|
}
|
|
106
175
|
}
|
|
107
176
|
}
|
|
108
177
|
if (key === undefined) key = `b${(this.counter++).toString(36)}`;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
178
|
+
used.add(key);
|
|
179
|
+
const entry = { key, pos, node };
|
|
180
|
+
fresh.push(entry);
|
|
181
|
+
this.byKey.set(key, entry);
|
|
112
182
|
// a textblock's children are inline: nothing below it has a key
|
|
113
183
|
return !node.isTextblock;
|
|
184
|
+
};
|
|
185
|
+
let at = from;
|
|
186
|
+
for (let i = head; i < doc.childCount - tail; i++) {
|
|
187
|
+
const child = doc.child(i);
|
|
188
|
+
if (visit(child, at)) {
|
|
189
|
+
const base = at + 1;
|
|
190
|
+
child.descendants((node, pos) => visit(node, base + pos));
|
|
191
|
+
}
|
|
192
|
+
at += child.nodeSize;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// 4. The blocks after them moved, and are otherwise as they were.
|
|
196
|
+
const shift = to - wasTo;
|
|
197
|
+
if (shift !== 0) {
|
|
198
|
+
for (let i = end; i < entries.length; i++) entries[i].pos += shift;
|
|
199
|
+
}
|
|
200
|
+
spliceAll(entries, first, end - first, fresh);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** The index of the first block starting at or after `pos`. */
|
|
204
|
+
private _firstAtOrAfter(pos: number): number {
|
|
205
|
+
const entries = this.entries;
|
|
206
|
+
let lo = 0;
|
|
207
|
+
let hi = entries.length;
|
|
208
|
+
while (lo < hi) {
|
|
209
|
+
const mid = (lo + hi) >> 1;
|
|
210
|
+
if (entries[mid].pos < pos) lo = mid + 1;
|
|
211
|
+
else hi = mid;
|
|
212
|
+
}
|
|
213
|
+
return lo;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Whether a mapping is made only of steps that move no position. */
|
|
218
|
+
function movesNothing(mapping: Mappable): boolean {
|
|
219
|
+
if (!(mapping instanceof Mapping)) return false;
|
|
220
|
+
for (const map of mapping.maps) {
|
|
221
|
+
let moved = false;
|
|
222
|
+
map.forEach(() => {
|
|
223
|
+
moved = true;
|
|
114
224
|
});
|
|
115
|
-
|
|
116
|
-
this.posByKey = posByKey;
|
|
117
|
-
this.nodeByKey = nodeByKey;
|
|
225
|
+
if (moved) return false;
|
|
118
226
|
}
|
|
227
|
+
return true;
|
|
119
228
|
}
|
|
@@ -27,6 +27,7 @@ import { parse } from '../internal/markdown/parse.js';
|
|
|
27
27
|
import { stringify } from '../internal/markdown/stringify.js';
|
|
28
28
|
import type {
|
|
29
29
|
BlockNode,
|
|
30
|
+
Document,
|
|
30
31
|
InlineNode,
|
|
31
32
|
LinkInline,
|
|
32
33
|
ListItem,
|
|
@@ -43,11 +44,45 @@ export interface MarkdownCodec {
|
|
|
43
44
|
/** The codec for `schema`: the reference names, TipTap's, or both. */
|
|
44
45
|
export function markdownCodec(schema: Schema): MarkdownCodec {
|
|
45
46
|
return {
|
|
46
|
-
parse: (
|
|
47
|
+
parse: markdownReader(schema),
|
|
47
48
|
serialize: (doc) => markdownFromDoc(doc),
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* `docFromMarkdown` for a document read again and again: a value that
|
|
54
|
+
* streams in, or a controlled value an app keeps handing over. Each parse
|
|
55
|
+
* resumes from the last one (`ParseOptions.previous`), which hands back
|
|
56
|
+
* the blocks it did not have to read again as the same objects, and a
|
|
57
|
+
* block seen before becomes the nodes it became then. So a word streamed
|
|
58
|
+
* into a long document converts the paragraph it lands in, and the
|
|
59
|
+
* document's other blocks are the nodes the editor already holds.
|
|
60
|
+
*/
|
|
61
|
+
function markdownReader(schema: Schema): (source: string) => PMNode {
|
|
62
|
+
let last: Document | null = null;
|
|
63
|
+
const converted = new WeakMap<BlockNode, PMNode[]>();
|
|
64
|
+
return (source) => {
|
|
65
|
+
const ast = parse(
|
|
66
|
+
source,
|
|
67
|
+
last ? { partial: false, previous: last } : { partial: false },
|
|
68
|
+
);
|
|
69
|
+
last = ast;
|
|
70
|
+
const blocks: PMNode[] = [];
|
|
71
|
+
for (const block of ast.blocks) {
|
|
72
|
+
let nodes = converted.get(block);
|
|
73
|
+
if (!nodes) {
|
|
74
|
+
nodes = blockToNodes(schema, block);
|
|
75
|
+
converted.set(block, nodes);
|
|
76
|
+
}
|
|
77
|
+
for (const node of nodes) blocks.push(node);
|
|
78
|
+
}
|
|
79
|
+
return (
|
|
80
|
+
schema.topNodeType.createAndFill(null, blocks) ??
|
|
81
|
+
schema.topNodeType.createAndFill()!
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
51
86
|
// --- names -------------------------------------------------------------------
|
|
52
87
|
|
|
53
88
|
/** The spellings each thing goes by: ProseMirror's reference schemas first,
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// `toggleMark` from prosemirror-commands, with one difference: a mark is
|
|
2
|
+
// added the way prosemirror-transform already removes one.
|
|
3
|
+
//
|
|
4
|
+
// Its `addMark` makes a step for each run of text that lacks the mark, and a
|
|
5
|
+
// run ends where its textblock does. Bold over a document of 1,700 paragraphs
|
|
6
|
+
// is 1,700 steps, and each step copies the document's top-level children:
|
|
7
|
+
// quadratic in blocks, 425 ms a toggle over the sweep's 600 KB report.
|
|
8
|
+
// `removeMark` joins its runs across blocks already.
|
|
9
|
+
//
|
|
10
|
+
// `addMarkAcross` joins consecutive inline nodes that lack the mark whatever
|
|
11
|
+
// lies between them, which can only be block structure. An `AddMarkStep`
|
|
12
|
+
// marks the inline nodes of its range whose parent allows the mark and leaves
|
|
13
|
+
// everything else alone, and its inverse removes the mark from those same
|
|
14
|
+
// nodes, every one of which lacked it. So the document, the undo, and a
|
|
15
|
+
// position mapped through the transaction (a mark step maps nothing) are
|
|
16
|
+
// what they were. A node that already has the mark, or cannot take it, ends
|
|
17
|
+
// the run, as it did.
|
|
18
|
+
|
|
19
|
+
import { toggleMark as pmToggleMark } from 'prosemirror-commands';
|
|
20
|
+
import type { Attrs, Mark, MarkType } from 'prosemirror-model';
|
|
21
|
+
import type { Command, EditorState } from 'prosemirror-state';
|
|
22
|
+
import {
|
|
23
|
+
AddMarkStep,
|
|
24
|
+
RemoveMarkStep,
|
|
25
|
+
type Transform,
|
|
26
|
+
} from 'prosemirror-transform';
|
|
27
|
+
|
|
28
|
+
interface Run {
|
|
29
|
+
from: number;
|
|
30
|
+
to: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** `tr.addMark(from, to, mark)`, one step for a run however many blocks it crosses. */
|
|
34
|
+
export function addMarkAcross(
|
|
35
|
+
tr: Transform,
|
|
36
|
+
from: number,
|
|
37
|
+
to: number,
|
|
38
|
+
mark: Mark,
|
|
39
|
+
): Transform {
|
|
40
|
+
const removed: Array<Run & { mark: Mark }> = [];
|
|
41
|
+
const added: Run[] = [];
|
|
42
|
+
let removing: (Run & { mark: Mark }) | null = null;
|
|
43
|
+
let adding: Run | null = null;
|
|
44
|
+
tr.doc.nodesBetween(from, to, (node, pos, parent) => {
|
|
45
|
+
if (!node.isInline) return;
|
|
46
|
+
const marks = node.marks;
|
|
47
|
+
if (
|
|
48
|
+
mark.isInSet(marks) ||
|
|
49
|
+
!parent ||
|
|
50
|
+
!parent.type.allowsMarkType(mark.type)
|
|
51
|
+
) {
|
|
52
|
+
adding = null;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const start = Math.max(pos, from);
|
|
56
|
+
const end = Math.min(pos + node.nodeSize, to);
|
|
57
|
+
// the marks this one excludes come off first, run for run as addMark does
|
|
58
|
+
const newSet = mark.addToSet(marks);
|
|
59
|
+
for (const other of marks) {
|
|
60
|
+
if (other.isInSet(newSet)) continue;
|
|
61
|
+
if (removing && removing.to === start && removing.mark.eq(other))
|
|
62
|
+
removing.to = end;
|
|
63
|
+
else removed.push((removing = { from: start, to: end, mark: other }));
|
|
64
|
+
}
|
|
65
|
+
if (adding) adding.to = end;
|
|
66
|
+
else added.push((adding = { from: start, to: end }));
|
|
67
|
+
});
|
|
68
|
+
for (const r of removed) tr.step(new RemoveMarkStep(r.from, r.to, r.mark));
|
|
69
|
+
for (const a of added) tr.step(new AddMarkStep(a.from, a.to, mark));
|
|
70
|
+
return tr;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** prosemirror-commands' `toggleMark`, adding through `addMarkAcross`. */
|
|
74
|
+
export function toggleMark(
|
|
75
|
+
markType: MarkType,
|
|
76
|
+
attrs: Attrs | null = null,
|
|
77
|
+
options?: Parameters<typeof pmToggleMark>[2],
|
|
78
|
+
): Command {
|
|
79
|
+
const command = pmToggleMark(markType, attrs, options);
|
|
80
|
+
return (state, dispatch, view) =>
|
|
81
|
+
command(dispatch ? addingAcross(state) : state, dispatch, view);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The state as the command sees it: every transaction it starts adds marks
|
|
86
|
+
* through `addMarkAcross`. Only that transaction's own `addMark` is replaced,
|
|
87
|
+
* so nothing else in the process changes.
|
|
88
|
+
*/
|
|
89
|
+
function addingAcross(state: EditorState): EditorState {
|
|
90
|
+
return new Proxy(state, {
|
|
91
|
+
get(target, prop) {
|
|
92
|
+
if (prop !== 'tr') return Reflect.get(target, prop, target);
|
|
93
|
+
const tr = target.tr;
|
|
94
|
+
tr.addMark = (from: number, to: number, mark: Mark) => {
|
|
95
|
+
addMarkAcross(tr, from, to, mark);
|
|
96
|
+
return tr;
|
|
97
|
+
};
|
|
98
|
+
return tr;
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -147,6 +147,53 @@ function isOrdered(list: PMNode): boolean {
|
|
|
147
147
|
return domTagOf(list.type.spec, list)?.tag === 'ol';
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* The element last made for a block, by its node. A block whose node, key
|
|
152
|
+
* and surroundings are what they were gets that element back, and React
|
|
153
|
+
* bails out of an element it has rendered before without so much as
|
|
154
|
+
* comparing its props — so a keystroke reconciles the block it changed,
|
|
155
|
+
* where it made and compared an element for every block in view: a hundred
|
|
156
|
+
* of them in a long document's window. Weak, so a node nobody draws any
|
|
157
|
+
* more takes its element with it.
|
|
158
|
+
*/
|
|
159
|
+
const madeFor = new WeakMap<
|
|
160
|
+
PMNode,
|
|
161
|
+
{
|
|
162
|
+
key: string;
|
|
163
|
+
ctx: RenderContext;
|
|
164
|
+
bctx: BlockContext;
|
|
165
|
+
at: number;
|
|
166
|
+
register: RowProps['register'] | null;
|
|
167
|
+
element: ReactElement;
|
|
168
|
+
}
|
|
169
|
+
>();
|
|
170
|
+
|
|
171
|
+
function blockElement(
|
|
172
|
+
node: PMNode,
|
|
173
|
+
key: string,
|
|
174
|
+
ctx: RenderContext,
|
|
175
|
+
bctx: BlockContext,
|
|
176
|
+
at: number,
|
|
177
|
+
register: RowProps['register'] | null,
|
|
178
|
+
): ReactElement {
|
|
179
|
+
const made = madeFor.get(node);
|
|
180
|
+
if (
|
|
181
|
+
made &&
|
|
182
|
+
made.key === key &&
|
|
183
|
+
made.ctx === ctx &&
|
|
184
|
+
made.bctx === bctx &&
|
|
185
|
+
made.at === at &&
|
|
186
|
+
made.register === register
|
|
187
|
+
) {
|
|
188
|
+
return made.element;
|
|
189
|
+
}
|
|
190
|
+
const element = register
|
|
191
|
+
? h(BlockRow, { key, blockKey: key, node, ctx, bctx, at, register })
|
|
192
|
+
: h(BlockView, { key, blockKey: key, node, ctx, bctx });
|
|
193
|
+
madeFor.set(node, { key, ctx, bctx, at, register, element });
|
|
194
|
+
return element;
|
|
195
|
+
}
|
|
196
|
+
|
|
150
197
|
/** The blocks inside `parent`, whose content starts at `contentStart`. */
|
|
151
198
|
export function renderBlocks(
|
|
152
199
|
parent: PMNode,
|
|
@@ -158,7 +205,7 @@ export function renderBlocks(
|
|
|
158
205
|
parent.forEach((child, offset) => {
|
|
159
206
|
const pos = contentStart + offset;
|
|
160
207
|
const key = ctx.view.keys.keyAt(pos) ?? `p${pos}`;
|
|
161
|
-
out.push(
|
|
208
|
+
out.push(blockElement(child, key, ctx, bctx, -1, null));
|
|
162
209
|
});
|
|
163
210
|
return out;
|
|
164
211
|
}
|
|
@@ -288,17 +335,7 @@ export function renderBlockRange(
|
|
|
288
335
|
doc.forEach((child, offset, index) => {
|
|
289
336
|
if (index < first || index >= last) return;
|
|
290
337
|
const key = ctx.view.keys.keyAt(offset) ?? `p${offset}`;
|
|
291
|
-
out.push(
|
|
292
|
-
h(BlockRow, {
|
|
293
|
-
key,
|
|
294
|
-
blockKey: key,
|
|
295
|
-
node: child,
|
|
296
|
-
ctx,
|
|
297
|
-
bctx: PLAIN,
|
|
298
|
-
at: index,
|
|
299
|
-
register,
|
|
300
|
-
}),
|
|
301
|
-
);
|
|
338
|
+
out.push(blockElement(child, key, ctx, PLAIN, index, register));
|
|
302
339
|
});
|
|
303
340
|
return out;
|
|
304
341
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// A document handed in from outside — a controlled `value`, the handle's
|
|
2
|
+
// `setValue` — put into the editor.
|
|
3
|
+
//
|
|
4
|
+
// Replacing the whole document with it made every block a new node: each
|
|
5
|
+
// one was keyed again and drawn again, and a plugin that walks what a
|
|
6
|
+
// transaction changed (prosemirror-tables' `fixTables`) walked all of it. A
|
|
7
|
+
// value that streams in — a model writing into the editor — did that for
|
|
8
|
+
// every word it gained: 75 ms a word at 3,200 paragraphs. Pure: no React,
|
|
9
|
+
// and `test/rich-text-editor-model.test.ts` asks it the rest.
|
|
10
|
+
import type { Node as PMNode } from 'prosemirror-model';
|
|
11
|
+
import { Selection } from 'prosemirror-state';
|
|
12
|
+
import type { EditorState, Transaction } from 'prosemirror-state';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The transaction that makes `state`'s document `doc`: a reset, as it
|
|
16
|
+
* always was. To the history, the selection and every plugin that maps a
|
|
17
|
+
* position through it, the whole document is replaced — so an undo reaches
|
|
18
|
+
* nothing from before, the draft an app just cleared included. What changes
|
|
19
|
+
* is which nodes the new document is made of: where it is the same as the
|
|
20
|
+
* old one, it is the old one's nodes, so the blocks the value left alone
|
|
21
|
+
* keep their keys and their drawn elements.
|
|
22
|
+
*/
|
|
23
|
+
export function replaceDocumentTr(
|
|
24
|
+
state: EditorState,
|
|
25
|
+
doc: PMNode,
|
|
26
|
+
addToHistory: boolean,
|
|
27
|
+
): Transaction {
|
|
28
|
+
// First the document as itself, over the whole of it: the step the
|
|
29
|
+
// history and the mapping see, the one they always saw — every position
|
|
30
|
+
// inside the document replaced. It puts back the node objects that were
|
|
31
|
+
// there, so nothing is drawn again for it.
|
|
32
|
+
const tr = state.tr.replaceWith(0, state.doc.content.size, state.doc.content);
|
|
33
|
+
// Then the change, in steps made against the same document.
|
|
34
|
+
for (const step of changedPart(state, doc)?.steps ?? []) tr.step(step);
|
|
35
|
+
// keep the caret about where it was, inside what is there now
|
|
36
|
+
tr.setSelection(
|
|
37
|
+
Selection.near(
|
|
38
|
+
tr.doc.resolve(Math.min(state.selection.head, tr.doc.content.size)),
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
if (!addToHistory) tr.setMeta('addToHistory', false);
|
|
42
|
+
return tr;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A transaction replacing only where `doc` differs from `state`'s
|
|
46
|
+
* document; null when it does not. */
|
|
47
|
+
function changedPart(state: EditorState, doc: PMNode): Transaction | null {
|
|
48
|
+
const before = state.doc.content;
|
|
49
|
+
const start = before.findDiffStart(doc.content);
|
|
50
|
+
if (start === null) return null;
|
|
51
|
+
let { a: endA, b: endB } = before.findDiffEnd(doc.content)!;
|
|
52
|
+
// Where the change repeats what is beside it ("aa" to "aaa"), the ends
|
|
53
|
+
// found from the back reach past the start found from the front: move
|
|
54
|
+
// both ends on by the overlap, over content the two documents share.
|
|
55
|
+
const overlap = start - Math.min(endA, endB);
|
|
56
|
+
if (overlap > 0) {
|
|
57
|
+
endA += overlap;
|
|
58
|
+
endB += overlap;
|
|
59
|
+
}
|
|
60
|
+
let tr = state.tr.replace(start, endA, doc.slice(start, endB));
|
|
61
|
+
if (tr.doc.eq(doc)) return tr;
|
|
62
|
+
// A slice that opens inside a table can be fitted into another shape than
|
|
63
|
+
// the value's. Whole blocks always fit between the ones the two documents
|
|
64
|
+
// share: the top-level blocks the change reaches, then.
|
|
65
|
+
const from = blockStart(state.doc, start);
|
|
66
|
+
tr = state.tr.replaceWith(
|
|
67
|
+
from,
|
|
68
|
+
blockEnd(state.doc, endA),
|
|
69
|
+
doc.content.cut(from, blockEnd(doc, endB)),
|
|
70
|
+
);
|
|
71
|
+
if (tr.doc.eq(doc)) return tr;
|
|
72
|
+
return state.tr.replaceWith(0, state.doc.content.size, doc.content);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Where the top-level block `pos` is in starts; `pos` itself between two. */
|
|
76
|
+
function blockStart(doc: PMNode, pos: number): number {
|
|
77
|
+
const $pos = doc.resolve(pos);
|
|
78
|
+
return $pos.depth === 0 ? pos : $pos.before(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Where the top-level block `pos` is in ends; `pos` itself between two. */
|
|
82
|
+
function blockEnd(doc: PMNode, pos: number): number {
|
|
83
|
+
const $pos = doc.resolve(pos);
|
|
84
|
+
return $pos.depth === 0 ? pos : $pos.after(1);
|
|
85
|
+
}
|
|
@@ -30,7 +30,6 @@ import type { ReactElement, ReactNode } from 'react';
|
|
|
30
30
|
import type { MouseEvent as X11MouseEvent } from 'react-x11';
|
|
31
31
|
import { tint } from 'react-x11/style';
|
|
32
32
|
import type { Style } from 'react-x11/style';
|
|
33
|
-
import { toggleMark } from 'prosemirror-commands';
|
|
34
33
|
import { redo, redoDepth, undo, undoDepth } from 'prosemirror-history';
|
|
35
34
|
import type { Schema } from 'prosemirror-model';
|
|
36
35
|
import type { Command, EditorState } from 'prosemirror-state';
|
|
@@ -48,6 +47,7 @@ import {
|
|
|
48
47
|
toggleWrap,
|
|
49
48
|
} from './commands.js';
|
|
50
49
|
import type { EditorLook } from './look.js';
|
|
50
|
+
import { toggleMark } from './marks.js';
|
|
51
51
|
import {
|
|
52
52
|
addColumnAfter,
|
|
53
53
|
addColumnBefore,
|
|
@@ -131,11 +131,36 @@ export function useBlockWindow(inputs: BlockWindowInputs): BlockWindowState {
|
|
|
131
131
|
}
|
|
132
132
|
heights.sync(rows, estimate);
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* One drawn block into the index, for the window's trim: it drops a block
|
|
136
|
+
* only once the index knows the height it is laid out at, and a scroll
|
|
137
|
+
* reaches the blocks behind it long before `measure` below has run — so
|
|
138
|
+
* it dropped none, and a scroll through a long document kept every block
|
|
139
|
+
* it passed mounted (the flick `<Table>` and `<Tree>` had, and the same
|
|
140
|
+
* hook: `measure` on the window's inputs).
|
|
141
|
+
*/
|
|
142
|
+
const measureDrawn = useCallback(
|
|
143
|
+
(id: RowKey, at: number): boolean => {
|
|
144
|
+
const drawn = nodes.current.get(id);
|
|
145
|
+
if (!drawn || drawn.at !== at || !(drawn.node.abs.height > 0)) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
heights.measure(
|
|
149
|
+
id,
|
|
150
|
+
at,
|
|
151
|
+
drawn.node.abs.height / scaleOf(drawn.node) + gapRef.current,
|
|
152
|
+
);
|
|
153
|
+
return heights.isMeasured(at);
|
|
154
|
+
},
|
|
155
|
+
[heights],
|
|
156
|
+
);
|
|
157
|
+
|
|
134
158
|
const win = useVirtualWindow({
|
|
135
159
|
box,
|
|
136
160
|
heights,
|
|
137
161
|
rows,
|
|
138
162
|
exact: false,
|
|
163
|
+
measure: measureDrawn,
|
|
139
164
|
virtualizing,
|
|
140
165
|
overscan: DEFAULT_OVERSCAN,
|
|
141
166
|
prefetch: DEFAULT_PREFETCH,
|