@react-x11/components 0.8.0 → 0.10.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 +105 -38
- package/dist/charts/node.d.ts +12 -2
- package/dist/charts/node.d.ts.map +1 -1
- package/dist/charts/node.js +50 -16
- 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 +3 -1
- 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/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/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 +13 -2
- package/dist/codeblock/index.d.ts.map +1 -1
- package/dist/codeblock/index.js +20 -3
- package/dist/codeblock/index.js.map +1 -1
- package/dist/embed/client.d.ts +48 -3
- package/dist/embed/client.d.ts.map +1 -1
- package/dist/embed/client.js +79 -5
- package/dist/embed/client.js.map +1 -1
- package/dist/embed/index.d.ts +1 -1
- package/dist/embed/index.d.ts.map +1 -1
- package/dist/embed/index.js +1 -1
- package/dist/embed/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 +240 -6
- package/dist/html/css/cascade.d.ts.map +1 -1
- package/dist/html/css/cascade.js +1327 -66
- 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 +498 -15
- package/dist/html/css/style.d.ts.map +1 -1
- package/dist/html/css/style.js +3698 -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 +57 -11
- 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 +2937 -197
- package/dist/html/layout/block.js.map +1 -1
- package/dist/html/layout/boxes.d.ts +340 -17
- package/dist/html/layout/boxes.d.ts.map +1 -1
- package/dist/html/layout/boxes.js +1714 -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 +151 -1
- package/dist/html/layout/inline.d.ts.map +1 -1
- package/dist/html/layout/inline.js +3375 -174
- 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 +172 -5
- package/dist/html/node.d.ts.map +1 -1
- package/dist/html/node.js +1336 -103
- 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 +3503 -141
- 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 +435 -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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- 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/{markdown → internal/markdown}/ast.d.ts +23 -0
- package/dist/internal/markdown/ast.d.ts.map +1 -0
- package/dist/internal/markdown/ast.js +22 -0
- package/dist/internal/markdown/ast.js.map +1 -0
- package/dist/internal/markdown/parse.d.ts.map +1 -0
- package/dist/{markdown → internal/markdown}/parse.js +221 -30
- package/dist/internal/markdown/parse.js.map +1 -0
- package/dist/internal/markdown/stringify.d.ts +4 -0
- package/dist/internal/markdown/stringify.d.ts.map +1 -0
- package/dist/internal/markdown/stringify.js +684 -0
- package/dist/internal/markdown/stringify.js.map +1 -0
- package/dist/internal/markdown/tags.d.ts.map +1 -0
- package/dist/internal/markdown/tags.js.map +1 -0
- 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/scroll.d.ts +3 -2
- package/dist/internal/scroll.d.ts.map +1 -1
- package/dist/internal/scroll.js +1 -0
- package/dist/internal/scroll.js.map +1 -1
- 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 +103 -0
- package/dist/maps/anchors.d.ts.map +1 -0
- package/dist/maps/anchors.js +790 -0
- package/dist/maps/anchors.js.map +1 -0
- package/dist/maps/controller.d.ts +340 -0
- package/dist/maps/controller.d.ts.map +1 -0
- package/dist/maps/controller.js +822 -0
- package/dist/maps/controller.js.map +1 -0
- package/dist/maps/gl/buckets.d.ts +99 -0
- package/dist/maps/gl/buckets.d.ts.map +1 -0
- package/dist/maps/gl/buckets.js +365 -0
- package/dist/maps/gl/buckets.js.map +1 -0
- package/dist/maps/gl/build-worker.d.ts +15 -0
- package/dist/maps/gl/build-worker.d.ts.map +1 -0
- package/dist/maps/gl/build-worker.js +44 -0
- package/dist/maps/gl/build-worker.js.map +1 -0
- package/dist/maps/gl/color.d.ts +8 -0
- package/dist/maps/gl/color.d.ts.map +1 -0
- package/dist/maps/gl/color.js +57 -0
- package/dist/maps/gl/color.js.map +1 -0
- package/dist/maps/gl/cover.d.ts +70 -0
- package/dist/maps/gl/cover.d.ts.map +1 -0
- package/dist/maps/gl/cover.js +137 -0
- package/dist/maps/gl/cover.js.map +1 -0
- package/dist/maps/gl/index.d.ts +3 -0
- package/dist/maps/gl/index.d.ts.map +1 -0
- package/dist/maps/gl/index.js +20 -0
- package/dist/maps/gl/index.js.map +1 -0
- package/dist/maps/gl/markers.d.ts +28 -0
- package/dist/maps/gl/markers.d.ts.map +1 -0
- package/dist/maps/gl/markers.js +60 -0
- package/dist/maps/gl/markers.js.map +1 -0
- package/dist/maps/gl/overlays.d.ts +68 -0
- package/dist/maps/gl/overlays.d.ts.map +1 -0
- package/dist/maps/gl/overlays.js +300 -0
- package/dist/maps/gl/overlays.js.map +1 -0
- package/dist/maps/gl/pane.d.ts +12 -0
- package/dist/maps/gl/pane.d.ts.map +1 -0
- package/dist/maps/gl/pane.js +37 -0
- package/dist/maps/gl/pane.js.map +1 -0
- package/dist/maps/gl/placement.d.ts +124 -0
- package/dist/maps/gl/placement.d.ts.map +1 -0
- package/dist/maps/gl/placement.js +642 -0
- package/dist/maps/gl/placement.js.map +1 -0
- package/dist/maps/gl/renderer.d.ts +384 -0
- package/dist/maps/gl/renderer.d.ts.map +1 -0
- package/dist/maps/gl/renderer.js +1184 -0
- package/dist/maps/gl/renderer.js.map +1 -0
- package/dist/maps/gl/shaders.d.ts +121 -0
- package/dist/maps/gl/shaders.d.ts.map +1 -0
- package/dist/maps/gl/shaders.js +453 -0
- package/dist/maps/gl/shaders.js.map +1 -0
- package/dist/maps/gl/store.d.ts +125 -0
- package/dist/maps/gl/store.d.ts.map +1 -0
- package/dist/maps/gl/store.js +512 -0
- package/dist/maps/gl/store.js.map +1 -0
- package/dist/maps/gl/text.d.ts +283 -0
- package/dist/maps/gl/text.d.ts.map +1 -0
- package/dist/maps/gl/text.js +698 -0
- package/dist/maps/gl/text.js.map +1 -0
- package/dist/maps/gl/view.d.ts +345 -0
- package/dist/maps/gl/view.d.ts.map +1 -0
- package/dist/maps/gl/view.js +1209 -0
- package/dist/maps/gl/view.js.map +1 -0
- 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 +3 -1
- package/dist/maps/index.d.ts.map +1 -1
- package/dist/maps/index.js +218 -52
- package/dist/maps/index.js.map +1 -1
- package/dist/maps/labels.d.ts +91 -18
- package/dist/maps/labels.d.ts.map +1 -1
- package/dist/maps/labels.js +376 -140
- package/dist/maps/labels.js.map +1 -1
- package/dist/maps/node.d.ts +179 -56
- package/dist/maps/node.d.ts.map +1 -1
- package/dist/maps/node.js +663 -537
- package/dist/maps/node.js.map +1 -1
- package/dist/maps/overlay.d.ts +72 -9
- package/dist/maps/overlay.d.ts.map +1 -1
- package/dist/maps/overlay.js +108 -28
- package/dist/maps/overlay.js.map +1 -1
- package/dist/maps/paint.d.ts +3 -0
- package/dist/maps/paint.d.ts.map +1 -1
- package/dist/maps/paint.js.map +1 -1
- package/dist/maps/proj.d.ts +62 -0
- package/dist/maps/proj.d.ts.map +1 -1
- package/dist/maps/proj.js +101 -0
- package/dist/maps/proj.js.map +1 -1
- package/dist/maps/renderer.d.ts +69 -0
- package/dist/maps/renderer.d.ts.map +1 -0
- package/dist/maps/renderer.js +66 -0
- package/dist/maps/renderer.js.map +1 -0
- package/dist/maps/sources.d.ts +30 -6
- package/dist/maps/sources.d.ts.map +1 -1
- package/dist/maps/sources.js +22 -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/theme.d.ts +19 -0
- package/dist/maps/theme.d.ts.map +1 -0
- package/dist/maps/theme.js +44 -0
- package/dist/maps/theme.js.map +1 -0
- package/dist/maps/tiles.d.ts +147 -27
- package/dist/maps/tiles.d.ts.map +1 -1
- package/dist/maps/tiles.js +221 -54
- package/dist/maps/tiles.js.map +1 -1
- package/dist/maps/types.d.ts +213 -21
- package/dist/maps/types.d.ts.map +1 -1
- package/dist/markdown/expressions.d.ts +1 -1
- package/dist/markdown/expressions.d.ts.map +1 -1
- package/dist/markdown/expressions.js.map +1 -1
- package/dist/markdown/index.d.ts +7 -6
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +121 -50
- package/dist/markdown/index.js.map +1 -1
- package/dist/markdown/spans.d.ts +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/media-player/index.d.ts +11 -3
- package/dist/media-player/index.d.ts.map +1 -1
- package/dist/media-player/index.js +13 -2
- package/dist/media-player/index.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/clipboard.d.ts +23 -0
- package/dist/rich-text-editor/clipboard.d.ts.map +1 -0
- package/dist/rich-text-editor/clipboard.js +307 -0
- package/dist/rich-text-editor/clipboard.js.map +1 -0
- package/dist/rich-text-editor/collab.d.ts +32 -0
- package/dist/rich-text-editor/collab.d.ts.map +1 -0
- package/dist/rich-text-editor/collab.js +55 -0
- package/dist/rich-text-editor/collab.js.map +1 -0
- package/dist/rich-text-editor/commands.d.ts +50 -0
- package/dist/rich-text-editor/commands.d.ts.map +1 -0
- package/dist/rich-text-editor/commands.js +376 -0
- package/dist/rich-text-editor/commands.js.map +1 -0
- package/dist/rich-text-editor/drag.d.ts +68 -0
- package/dist/rich-text-editor/drag.d.ts.map +1 -0
- package/dist/rich-text-editor/drag.js +148 -0
- package/dist/rich-text-editor/drag.js.map +1 -0
- package/dist/rich-text-editor/html.d.ts +145 -0
- package/dist/rich-text-editor/html.d.ts.map +1 -0
- package/dist/rich-text-editor/html.js +516 -0
- package/dist/rich-text-editor/html.js.map +1 -0
- package/dist/rich-text-editor/index.d.ts +252 -0
- package/dist/rich-text-editor/index.d.ts.map +1 -0
- package/dist/rich-text-editor/index.js +856 -0
- package/dist/rich-text-editor/index.js.map +1 -0
- package/dist/rich-text-editor/inline.d.ts +94 -0
- package/dist/rich-text-editor/inline.d.ts.map +1 -0
- package/dist/rich-text-editor/inline.js +252 -0
- package/dist/rich-text-editor/inline.js.map +1 -0
- package/dist/rich-text-editor/keymap.d.ts +71 -0
- package/dist/rich-text-editor/keymap.d.ts.map +1 -0
- package/dist/rich-text-editor/keymap.js +394 -0
- package/dist/rich-text-editor/keymap.js.map +1 -0
- package/dist/rich-text-editor/keys.d.ts +40 -0
- package/dist/rich-text-editor/keys.d.ts.map +1 -0
- package/dist/rich-text-editor/keys.js +202 -0
- package/dist/rich-text-editor/keys.js.map +1 -0
- package/dist/rich-text-editor/look.d.ts +71 -0
- package/dist/rich-text-editor/look.d.ts.map +1 -0
- package/dist/rich-text-editor/look.js +342 -0
- package/dist/rich-text-editor/look.js.map +1 -0
- package/dist/rich-text-editor/markdown.d.ts +18 -0
- package/dist/rich-text-editor/markdown.d.ts.map +1 -0
- package/dist/rich-text-editor/markdown.js +496 -0
- package/dist/rich-text-editor/markdown.js.map +1 -0
- 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/nodes.d.ts +135 -0
- package/dist/rich-text-editor/nodes.d.ts.map +1 -0
- package/dist/rich-text-editor/nodes.js +397 -0
- package/dist/rich-text-editor/nodes.js.map +1 -0
- package/dist/rich-text-editor/render.d.ts +68 -0
- package/dist/rich-text-editor/render.d.ts.map +1 -0
- package/dist/rich-text-editor/render.js +518 -0
- package/dist/rich-text-editor/render.js.map +1 -0
- package/dist/rich-text-editor/schema.d.ts +16 -0
- package/dist/rich-text-editor/schema.d.ts.map +1 -0
- package/dist/rich-text-editor/schema.js +386 -0
- package/dist/rich-text-editor/schema.js.map +1 -0
- package/dist/rich-text-editor/store.d.ts +11 -0
- package/dist/rich-text-editor/store.d.ts.map +1 -0
- package/dist/rich-text-editor/store.js +43 -0
- package/dist/rich-text-editor/store.js.map +1 -0
- package/dist/rich-text-editor/suggest.d.ts +127 -0
- package/dist/rich-text-editor/suggest.d.ts.map +1 -0
- package/dist/rich-text-editor/suggest.js +0 -0
- package/dist/rich-text-editor/suggest.js.map +1 -0
- package/dist/rich-text-editor/tables.d.ts +41 -0
- package/dist/rich-text-editor/tables.d.ts.map +1 -0
- package/dist/rich-text-editor/tables.js +204 -0
- package/dist/rich-text-editor/tables.js.map +1 -0
- package/dist/rich-text-editor/toolbar.d.ts +58 -0
- package/dist/rich-text-editor/toolbar.d.ts.map +1 -0
- package/dist/rich-text-editor/toolbar.js +548 -0
- package/dist/rich-text-editor/toolbar.js.map +1 -0
- package/dist/rich-text-editor/view.d.ts +368 -0
- package/dist/rich-text-editor/view.d.ts.map +1 -0
- package/dist/rich-text-editor/view.js +1968 -0
- package/dist/rich-text-editor/view.js.map +1 -0
- package/dist/rich-text-editor/virtual.d.ts +54 -0
- package/dist/rich-text-editor/virtual.d.ts.map +1 -0
- package/dist/rich-text-editor/virtual.js +279 -0
- package/dist/rich-text-editor/virtual.js.map +1 -0
- package/dist/richtext/node.d.ts +71 -4
- package/dist/richtext/node.d.ts.map +1 -1
- package/dist/richtext/node.js +233 -28
- 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/backends.d.ts +4 -1
- package/dist/terminal/backends.d.ts.map +1 -1
- package/dist/terminal/backends.js.map +1 -1
- package/dist/terminal/index.d.ts +18 -7
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +32 -11
- 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 +6 -1
- package/dist/terminal-output/index.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 +59 -31
- package/src/charts/node.ts +68 -28
- package/src/charts/render.ts +120 -30
- package/src/code/index.ts +3 -1
- 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/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/stream.ts +257 -17
- package/src/code-language/types.ts +5 -4
- package/src/codeblock/index.ts +20 -3
- package/src/embed/client.ts +102 -8
- package/src/embed/index.ts +2 -0
- 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 +1403 -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 +4102 -222
- package/src/html/css/ua.ts +58 -12
- 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 +3456 -230
- package/src/html/layout/boxes.ts +2100 -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 +3943 -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 +1486 -121
- package/src/html/paint.ts +4293 -169
- package/src/html/resources.ts +161 -50
- package/src/html/surfaces.ts +81 -0
- package/src/html/svg.ts +493 -0
- package/src/html/url.ts +86 -0
- package/src/index.ts +4 -0
- package/src/internal/collate.ts +12 -0
- package/src/{markdown → internal/markdown}/ast.ts +35 -7
- package/src/{markdown → internal/markdown}/parse.ts +288 -35
- package/src/internal/markdown/stringify.ts +772 -0
- package/src/internal/prewarm.ts +45 -0
- package/src/internal/scroll.ts +5 -3
- 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 +913 -0
- package/src/maps/controller.ts +1084 -0
- package/src/maps/gl/buckets.ts +461 -0
- package/src/maps/gl/build-worker.ts +66 -0
- package/src/maps/gl/color.ts +62 -0
- package/src/maps/gl/cover.ts +205 -0
- package/src/maps/gl/index.ts +23 -0
- package/src/maps/gl/markers.ts +83 -0
- package/src/maps/gl/overlays.ts +379 -0
- package/src/maps/gl/pane.ts +42 -0
- package/src/maps/gl/placement.ts +968 -0
- package/src/maps/gl/renderer.ts +1660 -0
- package/src/maps/gl/shaders.ts +489 -0
- package/src/maps/gl/store.ts +615 -0
- package/src/maps/gl/text.ts +868 -0
- package/src/maps/gl/view.ts +1489 -0
- package/src/maps/icons.ts +183 -0
- package/src/maps/index.ts +274 -81
- package/src/maps/labels.ts +457 -144
- package/src/maps/node.ts +832 -665
- package/src/maps/overlay.ts +148 -43
- package/src/maps/paint.ts +3 -0
- package/src/maps/proj.ts +118 -0
- package/src/maps/renderer.ts +155 -0
- package/src/maps/sources.ts +43 -6
- package/src/maps/style.ts +32 -0
- package/src/maps/styles.ts +215 -4
- package/src/maps/theme.ts +51 -0
- package/src/maps/tiles.ts +253 -62
- package/src/maps/types.ts +213 -21
- package/src/markdown/expressions.ts +5 -1
- package/src/markdown/index.ts +163 -78
- package/src/markdown/spans.ts +6 -1
- package/src/media-player/index.ts +18 -4
- 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/clipboard.ts +439 -0
- package/src/rich-text-editor/collab.ts +91 -0
- package/src/rich-text-editor/commands.ts +448 -0
- package/src/rich-text-editor/dom-globals.d.ts +23 -0
- package/src/rich-text-editor/drag.ts +211 -0
- package/src/rich-text-editor/html.ts +619 -0
- package/src/rich-text-editor/index.ts +1364 -0
- package/src/rich-text-editor/inline.ts +345 -0
- package/src/rich-text-editor/keymap.ts +510 -0
- package/src/rich-text-editor/keys.ts +228 -0
- package/src/rich-text-editor/look.ts +427 -0
- package/src/rich-text-editor/markdown.ts +653 -0
- package/src/rich-text-editor/marks.ts +101 -0
- package/src/rich-text-editor/nodes.ts +497 -0
- package/src/rich-text-editor/render.ts +837 -0
- package/src/rich-text-editor/schema.ts +431 -0
- package/src/rich-text-editor/store.ts +39 -0
- package/src/rich-text-editor/suggest.ts +597 -0
- package/src/rich-text-editor/tables.ts +272 -0
- package/src/rich-text-editor/toolbar.ts +724 -0
- package/src/rich-text-editor/view.ts +2287 -0
- package/src/rich-text-editor/virtual.ts +372 -0
- package/src/richtext/node.ts +294 -44
- package/src/richtext/runs.ts +23 -12
- package/src/table/index.ts +29 -0
- package/src/table/rows.ts +18 -8
- package/src/terminal/backends.ts +4 -1
- package/src/terminal/index.ts +47 -15
- package/src/terminal/vt/pty.ts +16 -2
- package/src/terminal-output/index.ts +6 -1
- package/src/three/canvas.ts +102 -8
- package/src/three/events.ts +49 -9
- package/src/tree/index.ts +19 -0
- package/dist/markdown/ast.d.ts.map +0 -1
- package/dist/markdown/ast.js +0 -17
- package/dist/markdown/ast.js.map +0 -1
- package/dist/markdown/parse.d.ts.map +0 -1
- package/dist/markdown/parse.js.map +0 -1
- package/dist/markdown/tags.d.ts.map +0 -1
- package/dist/markdown/tags.js.map +0 -1
- /package/dist/{markdown → internal/markdown}/parse.d.ts +0 -0
- /package/dist/{markdown → internal/markdown}/tags.d.ts +0 -0
- /package/dist/{markdown → internal/markdown}/tags.js +0 -0
- /package/src/{markdown → internal/markdown}/tags.ts +0 -0
|
@@ -105,8 +105,7 @@ function token(stream: StringStream, state: GlslState): string | null {
|
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
export function glsl(): Language {
|
|
108
|
+
function build(): Language {
|
|
110
109
|
return streamLanguage<GlslState>({
|
|
111
110
|
name: 'glsl',
|
|
112
111
|
languageData: {
|
|
@@ -118,3 +117,14 @@ export function glsl(): Language {
|
|
|
118
117
|
token,
|
|
119
118
|
});
|
|
120
119
|
}
|
|
120
|
+
|
|
121
|
+
// One Language per set of options, made the first time it is asked for: a
|
|
122
|
+
// render that writes `language={glsl()}` inline hands the editor the same
|
|
123
|
+
// object each time, where a new one meant a new tokenizer and every line in
|
|
124
|
+
// view laid out again, on every keystroke of a controlled editor.
|
|
125
|
+
let made: Language | undefined;
|
|
126
|
+
|
|
127
|
+
/** GLSL. */
|
|
128
|
+
export function glsl(): Language {
|
|
129
|
+
return (made ??= build());
|
|
130
|
+
}
|
|
@@ -51,7 +51,7 @@ const SELF = new Set(['this', 'super', 'globalThis']);
|
|
|
51
51
|
* one; and, with JSX on: `N` an opening tag before its name, `A` its
|
|
52
52
|
* attribute zone, `M` a closing tag before its name, `K` a closing tag
|
|
53
53
|
* awaiting `>`, `E` element children, `J` a `{…}` expression container.
|
|
54
|
-
* - `str` is `'`/`"` while a string continues across a
|
|
54
|
+
* - `str` is `'`/`"` while a string continues across a `` line break.
|
|
55
55
|
* - `value` is true when the previous significant token produced a value —
|
|
56
56
|
* which is exactly the bit that disambiguates `/` (divide after a value,
|
|
57
57
|
* regex otherwise) and `<` (compare after a value, JSX otherwise).
|
|
@@ -167,7 +167,7 @@ function eatEscape(stream: StringStream): boolean {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/** Consume string content up to the closing quote / EOL. Returns the type,
|
|
170
|
-
* updating `state.str` when a trailing
|
|
170
|
+
* updating `state.str` when a trailing `` continues the string. */
|
|
171
171
|
function stringToken(
|
|
172
172
|
stream: StringStream,
|
|
173
173
|
state: JsState,
|
|
@@ -391,8 +391,7 @@ export interface JavascriptOptions {
|
|
|
391
391
|
jsx?: boolean;
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
|
|
395
|
-
export function javascript(options: JavascriptOptions = {}): Language {
|
|
394
|
+
function build(options: JavascriptOptions = {}): Language {
|
|
396
395
|
const typescript = options.typescript ?? false;
|
|
397
396
|
const jsx = options.jsx ?? false;
|
|
398
397
|
return streamLanguage<JsState>({
|
|
@@ -417,3 +416,21 @@ export function javascript(options: JavascriptOptions = {}): Language {
|
|
|
417
416
|
token: makeToken(typescript, jsx),
|
|
418
417
|
});
|
|
419
418
|
}
|
|
419
|
+
|
|
420
|
+
// One Language per set of options, made the first time it is asked for: a
|
|
421
|
+
// render that writes `language={javascript()}` inline hands the editor the same
|
|
422
|
+
// object each time, where a new one meant a new tokenizer and every line in
|
|
423
|
+
// view laid out again, on every keystroke of a controlled editor.
|
|
424
|
+
let made: Map<string, Language> | undefined;
|
|
425
|
+
|
|
426
|
+
/** JavaScript — or TypeScript, JSX and TSX, by options. */
|
|
427
|
+
export function javascript(options: JavascriptOptions = {}): Language {
|
|
428
|
+
const key = `${options.typescript ?? false}|${options.jsx ?? false}`;
|
|
429
|
+
made ??= new Map();
|
|
430
|
+
let language = made.get(key);
|
|
431
|
+
if (!language) {
|
|
432
|
+
language = build(options);
|
|
433
|
+
made.set(key, language);
|
|
434
|
+
}
|
|
435
|
+
return language;
|
|
436
|
+
}
|
|
@@ -61,8 +61,7 @@ function token(stream: StringStream, state: JsonState): string | null {
|
|
|
61
61
|
return 'invalid';
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
export function json(): Language {
|
|
64
|
+
function build(): Language {
|
|
66
65
|
return streamLanguage<JsonState>({
|
|
67
66
|
name: 'json',
|
|
68
67
|
languageData: { indentAfter: /[[{]\s*$/ },
|
|
@@ -70,3 +69,14 @@ export function json(): Language {
|
|
|
70
69
|
token,
|
|
71
70
|
});
|
|
72
71
|
}
|
|
72
|
+
|
|
73
|
+
// One Language per set of options, made the first time it is asked for: a
|
|
74
|
+
// render that writes `language={json()}` inline hands the editor the same
|
|
75
|
+
// object each time, where a new one meant a new tokenizer and every line in
|
|
76
|
+
// view laid out again, on every keystroke of a controlled editor.
|
|
77
|
+
let made: Language | undefined;
|
|
78
|
+
|
|
79
|
+
/** JSON. */
|
|
80
|
+
export function json(): Language {
|
|
81
|
+
return (made ??= build());
|
|
82
|
+
}
|
|
@@ -198,8 +198,7 @@ function dquoteToken(stream: StringStream, state: ShellState): string | null {
|
|
|
198
198
|
return 'string';
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
export function shell(): Language {
|
|
201
|
+
function build(): Language {
|
|
203
202
|
return streamLanguage<ShellState>({
|
|
204
203
|
name: 'shell',
|
|
205
204
|
languageData: {
|
|
@@ -219,3 +218,14 @@ export function shell(): Language {
|
|
|
219
218
|
token,
|
|
220
219
|
});
|
|
221
220
|
}
|
|
221
|
+
|
|
222
|
+
// One Language per set of options, made the first time it is asked for: a
|
|
223
|
+
// render that writes `language={shell()}` inline hands the editor the same
|
|
224
|
+
// object each time, where a new one meant a new tokenizer and every line in
|
|
225
|
+
// view laid out again, on every keystroke of a controlled editor.
|
|
226
|
+
let made: Language | undefined;
|
|
227
|
+
|
|
228
|
+
/** POSIX shell / bash. */
|
|
229
|
+
export function shell(): Language {
|
|
230
|
+
return (made ??= build());
|
|
231
|
+
}
|
|
@@ -77,8 +77,7 @@ export interface SqlOptions {
|
|
|
77
77
|
hashComments?: boolean;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
export function sql(options: SqlOptions = {}): Language {
|
|
80
|
+
function build(options: SqlOptions = {}): Language {
|
|
82
81
|
const extra = new Set(
|
|
83
82
|
(options.keywords ?? []).map((word) => word.toLowerCase()),
|
|
84
83
|
);
|
|
@@ -163,3 +162,24 @@ export function sql(options: SqlOptions = {}): Language {
|
|
|
163
162
|
token,
|
|
164
163
|
});
|
|
165
164
|
}
|
|
165
|
+
|
|
166
|
+
// One Language per set of options, made the first time it is asked for: a
|
|
167
|
+
// render that writes `language={sql()}` inline hands the editor the same
|
|
168
|
+
// object each time, where a new one meant a new tokenizer and every line in
|
|
169
|
+
// view laid out again, on every keystroke of a controlled editor.
|
|
170
|
+
let made: Map<string, Language> | undefined;
|
|
171
|
+
|
|
172
|
+
/** SQL. `sql()` for the generic dialect, options for the house one. */
|
|
173
|
+
export function sql(options: SqlOptions = {}): Language {
|
|
174
|
+
const key = JSON.stringify([
|
|
175
|
+
options.keywords ?? [],
|
|
176
|
+
options.hashComments ?? false,
|
|
177
|
+
]);
|
|
178
|
+
made ??= new Map();
|
|
179
|
+
let language = made.get(key);
|
|
180
|
+
if (!language) {
|
|
181
|
+
language = build(options);
|
|
182
|
+
made.set(key, language);
|
|
183
|
+
}
|
|
184
|
+
return language;
|
|
185
|
+
}
|
|
@@ -16,7 +16,10 @@ import type {
|
|
|
16
16
|
LineEdit,
|
|
17
17
|
Token,
|
|
18
18
|
Tokenizer,
|
|
19
|
+
TokenizerHost,
|
|
19
20
|
} from './types.js';
|
|
21
|
+
import { spliceAll } from '../internal/splice.js';
|
|
22
|
+
import { startTimeout, stopTimeout, type TimerId } from './timers.js';
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
* One line of text with a cursor, the surface a mode's `token()` reads
|
|
@@ -133,6 +136,56 @@ export interface LineMode<S> {
|
|
|
133
136
|
stateEquals?(a: S, b: S): boolean;
|
|
134
137
|
}
|
|
135
138
|
|
|
139
|
+
/**
|
|
140
|
+
* How much of one line is tokenized; the rest of a longer one is drawn
|
|
141
|
+
* unstyled, and the next line starts from the state where this one was cut.
|
|
142
|
+
* CodeMirror's `maxHighlightLength`, and for the same reason: a line is
|
|
143
|
+
* tokenized again whole on every edit to it, and a minified file is one
|
|
144
|
+
* line — a keystroke at the end of a million characters ran the language
|
|
145
|
+
* over all of them. A construct that opens past the cut and closes on a
|
|
146
|
+
* later line is the price, on lines no one reads by their colours.
|
|
147
|
+
*/
|
|
148
|
+
export const TOKENIZE_LIMIT = 10_000;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* How far past the frontier a request walks it on the spot. Further than
|
|
152
|
+
* that — the end of a file opened a moment ago, a line a search jumped to —
|
|
153
|
+
* the line is tokenized from a guessed state, and the frontier is walked
|
|
154
|
+
* there in the background, `SLICE_LINES` a turn, with the host told where a
|
|
155
|
+
* guess was wrong. CodeMirror 5's answer to the same jump, for the same
|
|
156
|
+
* reason: tokenizing a 50,000-line file is a fifth of a second, spent on
|
|
157
|
+
* lines no one is looking at. Decided by the distance rather than by trying:
|
|
158
|
+
* the lines a guess would take from the cache are the ones the walk would
|
|
159
|
+
* have found converged, and trying first is the cost this exists to avoid.
|
|
160
|
+
*/
|
|
161
|
+
export const SYNC_LINES = 1_000;
|
|
162
|
+
const SLICE_LINES = 500;
|
|
163
|
+
|
|
164
|
+
/** How far above a guessed line to look for a state to start from: one a
|
|
165
|
+
* guess left, or else the least indented line, taken to be at the top
|
|
166
|
+
* level (CodeMirror's `findStartLine`). */
|
|
167
|
+
const GUESS_LOOKBACK = 100;
|
|
168
|
+
|
|
169
|
+
function cut(text: string): string {
|
|
170
|
+
return text.length > TOKENIZE_LIMIT ? text.slice(0, TOKENIZE_LIMIT) : text;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function indentOf(text: string): number {
|
|
174
|
+
let n = 0;
|
|
175
|
+
while (n < text.length && (text[n] === ' ' || text[n] === '\t')) n++;
|
|
176
|
+
return n;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function sameTokens(a: readonly Token[], b: readonly Token[]): boolean {
|
|
180
|
+
if (a.length !== b.length) return false;
|
|
181
|
+
for (let i = 0; i < a.length; i++) {
|
|
182
|
+
const x = a[i];
|
|
183
|
+
const y = b[i];
|
|
184
|
+
if (x.from !== y.from || x.to !== y.to || x.type !== y.type) return false;
|
|
185
|
+
}
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
|
|
136
189
|
function defaultCopy<S>(state: S): S {
|
|
137
190
|
if (state === null || typeof state !== 'object') return state;
|
|
138
191
|
return { ...(state as object) } as S;
|
|
@@ -173,18 +226,43 @@ function defaultEquals(a: unknown, b: unknown): boolean {
|
|
|
173
226
|
* lines. The `undefined` holes are also what makes convergence sound across
|
|
174
227
|
* multiple pending edits: the fast-forward below can never skip over a line
|
|
175
228
|
* whose text changed, because that line's cache is a hole.
|
|
229
|
+
*
|
|
230
|
+
* A guess (`guess`) is one more such pair past the frontier: tokens run
|
|
231
|
+
* from a state that was not reached from line 0. Convergence is what makes
|
|
232
|
+
* that safe as well — the frontier's walk takes the rest of a guessed run
|
|
233
|
+
* as it is where it arrives with the same state, and tokenizes it again
|
|
234
|
+
* where it does not.
|
|
176
235
|
*/
|
|
177
236
|
class StreamTokenizer<S> implements Tokenizer {
|
|
178
237
|
private lines: readonly string[] = [''];
|
|
179
238
|
/** states[i] = state entering line i. Trusted for i <= frontier; a
|
|
180
|
-
* defined entry beyond that is a pre-edit value, used only as
|
|
181
|
-
* convergence candidate.
|
|
239
|
+
* defined entry beyond that is a pre-edit value or a guess, used only as
|
|
240
|
+
* a convergence candidate. Past the frontier every defined `tokens[i]` was
|
|
241
|
+
* run from the `states[i]` beside it. */
|
|
182
242
|
private states: (S | undefined)[] = [];
|
|
183
243
|
private tokens: (Token[] | undefined)[] = [];
|
|
184
244
|
/** Lines `[0, frontier)` have trusted tokens. */
|
|
185
245
|
private frontier = 0;
|
|
246
|
+
/** The furthest line answered from a guess that the frontier has not
|
|
247
|
+
* reached; -1 when there is none. While there is one, every line past
|
|
248
|
+
* the frontier is answered the same way. */
|
|
249
|
+
private guessedTo = -1;
|
|
250
|
+
private worker: TimerId = null;
|
|
251
|
+
/** The first line whose trusted tokens differed from the ones it had —
|
|
252
|
+
* what the host is told after a turn of the walk. */
|
|
253
|
+
private changedFrom = -1;
|
|
254
|
+
/**
|
|
255
|
+
* Tokens taken out of `tokens` because the state entering their line was
|
|
256
|
+
* replaced — kept, by line, for the comparison `run` makes when the line
|
|
257
|
+
* is run again, and out of the array so that nothing takes them as the
|
|
258
|
+
* line's meanwhile. See `edit` for how a line gets here.
|
|
259
|
+
*/
|
|
260
|
+
private stale = new Map<number, Token[]>();
|
|
186
261
|
|
|
187
|
-
constructor(
|
|
262
|
+
constructor(
|
|
263
|
+
private readonly mode: LineMode<S>,
|
|
264
|
+
private readonly host: TokenizerHost | null = null,
|
|
265
|
+
) {}
|
|
188
266
|
|
|
189
267
|
setLines(lines: readonly string[]): void {
|
|
190
268
|
this.lines = lines;
|
|
@@ -192,41 +270,86 @@ class StreamTokenizer<S> implements Tokenizer {
|
|
|
192
270
|
this.tokens = new Array(lines.length);
|
|
193
271
|
this.states[0] = this.mode.startState();
|
|
194
272
|
this.frontier = 0;
|
|
273
|
+
this.guessedTo = -1;
|
|
274
|
+
this.stale.clear();
|
|
275
|
+
this.stopWorker();
|
|
195
276
|
}
|
|
196
277
|
|
|
197
278
|
edit({ fromLine, removed, inserted }: LineEdit): void {
|
|
198
279
|
// Align the caches below the edit with the new line numbering (their
|
|
199
280
|
// contents may still be right — convergence will decide), and punch
|
|
200
281
|
// `undefined` holes for the lines whose text actually changed.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
);
|
|
282
|
+
//
|
|
283
|
+
// …all but one: the state entering the first line after the edit is
|
|
284
|
+
// put back at that line's new number. It is what convergence compares
|
|
285
|
+
// the edit's outgoing state with, paired with the tokens that line
|
|
286
|
+
// still has — punched out with the rest, every edit re-tokenized the
|
|
287
|
+
// line after it too, and handed back a new token array for text that
|
|
288
|
+
// had not changed.
|
|
289
|
+
const after = this.states[fromLine + removed];
|
|
290
|
+
spliceAll(this.states, fromLine + 1, removed, new Array(inserted));
|
|
291
|
+
if (inserted > 0) this.states[fromLine + inserted] = after;
|
|
292
|
+
spliceAll(this.tokens, fromLine, removed, new Array(inserted));
|
|
293
|
+
const shift = inserted - removed;
|
|
294
|
+
if (this.stale.size > 0) {
|
|
295
|
+
const moved = new Map<number, Token[]>();
|
|
296
|
+
for (const [line, held] of this.stale) {
|
|
297
|
+
if (line < fromLine) moved.set(line, held);
|
|
298
|
+
else if (line >= fromLine + removed) moved.set(line + shift, held);
|
|
299
|
+
}
|
|
300
|
+
this.stale = moved;
|
|
301
|
+
}
|
|
302
|
+
// A walk that stops leaves the frontier's line with the state it gave
|
|
303
|
+
// it and the tokens it had before, from another: harmless while the
|
|
304
|
+
// frontier is there, since that line is the first one run. An edit
|
|
305
|
+
// above it moves the frontier back past it, and convergence would then
|
|
306
|
+
// take its tokens as the line's — the line under the view, once a
|
|
307
|
+
// comment opened in it, kept its colours from before and showed them
|
|
308
|
+
// the moment it was scrolled to. They are set aside instead.
|
|
309
|
+
const frontier = this.frontier;
|
|
310
|
+
if (fromLine < frontier && frontier >= fromLine + removed) {
|
|
311
|
+
this.setAside(frontier + shift);
|
|
312
|
+
}
|
|
211
313
|
this.frontier = Math.min(this.frontier, fromLine);
|
|
314
|
+
if (this.guessedTo >= fromLine) {
|
|
315
|
+
this.guessedTo = Math.max(fromLine, this.guessedTo + inserted - removed);
|
|
316
|
+
}
|
|
212
317
|
}
|
|
213
318
|
|
|
214
319
|
lineTokens(line: number): readonly Token[] {
|
|
215
320
|
if (line < 0 || line >= this.lines.length) return [];
|
|
216
|
-
this.
|
|
321
|
+
if (line >= this.frontier) {
|
|
322
|
+
if (this.guessedTo >= 0 || line - this.frontier > SYNC_LINES) {
|
|
323
|
+
return this.guess(line);
|
|
324
|
+
}
|
|
325
|
+
this.ensure(line);
|
|
326
|
+
// the caller has the tokens: nobody else was holding the old ones
|
|
327
|
+
this.changedFrom = -1;
|
|
328
|
+
}
|
|
217
329
|
return this.tokens[line] ?? [];
|
|
218
330
|
}
|
|
219
331
|
|
|
220
|
-
|
|
332
|
+
dispose(): void {
|
|
333
|
+
this.stopWorker();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Walk the frontier to `line`, tokenizing at most `budget` lines on the
|
|
338
|
+
* way (a converged run skipped is free). False when the budget ran out
|
|
339
|
+
* first.
|
|
340
|
+
*/
|
|
341
|
+
private ensure(line: number, budget = Infinity): boolean {
|
|
221
342
|
const copy = this.mode.copyState ?? defaultCopy;
|
|
222
343
|
const equals = this.mode.stateEquals ?? defaultEquals;
|
|
344
|
+
let spent = 0;
|
|
223
345
|
while (this.frontier <= line) {
|
|
346
|
+
if (spent++ >= budget) return false;
|
|
224
347
|
const i = this.frontier;
|
|
225
348
|
// `states[i]` is trusted here: it is either below the old frontier or
|
|
226
349
|
// was written by the previous iteration. Copy before running — the
|
|
227
350
|
// mode mutates in place, and the cached entry must stay pristine.
|
|
228
351
|
const state = copy(this.states[i] as S);
|
|
229
|
-
this.tokens[i] = this.
|
|
352
|
+
this.tokens[i] = this.run(i, state);
|
|
230
353
|
const cached = this.states[i + 1];
|
|
231
354
|
if (
|
|
232
355
|
cached !== undefined &&
|
|
@@ -251,6 +374,123 @@ class StreamTokenizer<S> implements Tokenizer {
|
|
|
251
374
|
this.states[i + 1] = state;
|
|
252
375
|
this.frontier = i + 1;
|
|
253
376
|
}
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Tokens for a line past the frontier, where the frontier is too far to
|
|
382
|
+
* walk to now: walked from the furthest state up the `GUESS_LOOKBACK`
|
|
383
|
+
* lines above it — the frontier's, when it is that close, or one a guess
|
|
384
|
+
* or an edit left — or, when there is none, from the language's start
|
|
385
|
+
* state at the least indented of those lines. The walk runs what has no
|
|
386
|
+
* tokens and passes over what has, so an edit's line is run again and the
|
|
387
|
+
* lines under it follow, the way the frontier walks after an edit; a line
|
|
388
|
+
* whose entering state it changes loses its tokens, since they ran from
|
|
389
|
+
* the state it replaced. What it writes are pairs like any other past the
|
|
390
|
+
* frontier, which the frontier's walk, started here, takes or tokenizes
|
|
391
|
+
* again when it arrives.
|
|
392
|
+
*/
|
|
393
|
+
private guess(line: number): readonly Token[] {
|
|
394
|
+
this.guessedTo = Math.max(this.guessedTo, line);
|
|
395
|
+
this.schedule();
|
|
396
|
+
const floor = Math.max(this.frontier, line - GUESS_LOOKBACK);
|
|
397
|
+
let from = floor;
|
|
398
|
+
while (from < line && this.states[from] === undefined) from++;
|
|
399
|
+
if (this.states[from] === undefined) {
|
|
400
|
+
let least = Infinity;
|
|
401
|
+
for (let i = line; i >= floor; i--) {
|
|
402
|
+
const text = this.lines[i];
|
|
403
|
+
const indent = indentOf(text);
|
|
404
|
+
if (indent === text.length) continue; // blank says nothing
|
|
405
|
+
if (indent < least) {
|
|
406
|
+
least = indent;
|
|
407
|
+
from = i;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
this.states[from] = this.mode.startState();
|
|
411
|
+
this.tokens[from] = undefined;
|
|
412
|
+
}
|
|
413
|
+
const copy = this.mode.copyState ?? defaultCopy;
|
|
414
|
+
const equals = this.mode.stateEquals ?? defaultEquals;
|
|
415
|
+
// whether the state entering line `i` was just replaced, so its tokens
|
|
416
|
+
// ran from another and it is run again, beside what it had
|
|
417
|
+
let moved = false;
|
|
418
|
+
for (let i = from; i <= line; i++) {
|
|
419
|
+
// a pair past the frontier ran from the state beside it; the
|
|
420
|
+
// frontier's may be from before the walk replaced its state
|
|
421
|
+
if (
|
|
422
|
+
!moved &&
|
|
423
|
+
i > this.frontier &&
|
|
424
|
+
this.tokens[i] !== undefined &&
|
|
425
|
+
this.states[i + 1] !== undefined
|
|
426
|
+
) {
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
const state = copy(this.states[i] as S);
|
|
430
|
+
this.tokens[i] = this.run(i, state);
|
|
431
|
+
const next = this.states[i + 1];
|
|
432
|
+
moved = next === undefined || !equals(state, next);
|
|
433
|
+
if (moved) this.states[i + 1] = state;
|
|
434
|
+
}
|
|
435
|
+
// past the line asked about, what ran from a replaced state is set
|
|
436
|
+
// aside: run again when asked for, and compared with what it had then
|
|
437
|
+
if (moved) this.setAside(line + 1);
|
|
438
|
+
return this.tokens[line] ?? [];
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Run line `i` from `state`, which it leaves as the line leaves it. The
|
|
443
|
+
* tokens it had, when they come out the same, are kept rather than
|
|
444
|
+
* replaced — an editor holds a line's layout by them — and where they do
|
|
445
|
+
* not, the line is noted for the host.
|
|
446
|
+
*/
|
|
447
|
+
private run(i: number, state: S): Token[] {
|
|
448
|
+
let had = this.tokens[i];
|
|
449
|
+
if (had === undefined && this.stale.size > 0) {
|
|
450
|
+
had = this.stale.get(i);
|
|
451
|
+
this.stale.delete(i);
|
|
452
|
+
}
|
|
453
|
+
const tokens = this.mode.runLine(cut(this.lines[i]), state);
|
|
454
|
+
if (had === undefined) return tokens;
|
|
455
|
+
if (sameTokens(had, tokens)) return had;
|
|
456
|
+
this.noteChange(i);
|
|
457
|
+
return tokens;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/** Take line `i`'s tokens out: the state entering it was replaced. */
|
|
461
|
+
private setAside(i: number): void {
|
|
462
|
+
const held = this.tokens[i];
|
|
463
|
+
if (held === undefined) return;
|
|
464
|
+
this.tokens[i] = undefined;
|
|
465
|
+
this.stale.set(i, held);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
private noteChange(i: number): void {
|
|
469
|
+
if (this.changedFrom < 0 || i < this.changedFrom) this.changedFrom = i;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
private schedule(): void {
|
|
473
|
+
if (this.worker != null) return;
|
|
474
|
+
this.worker = startTimeout(() => this.work(), 0);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/** One turn of the walk to the furthest guess, and the host told of the
|
|
478
|
+
* first line it found a guess wrong on. */
|
|
479
|
+
private work(): void {
|
|
480
|
+
this.worker = null;
|
|
481
|
+
if (this.guessedTo < 0) return;
|
|
482
|
+
const to = Math.min(this.guessedTo, this.lines.length - 1);
|
|
483
|
+
const done = this.ensure(to, SLICE_LINES);
|
|
484
|
+
const changed = this.changedFrom;
|
|
485
|
+
this.changedFrom = -1;
|
|
486
|
+
if (done) this.guessedTo = -1;
|
|
487
|
+
else this.schedule();
|
|
488
|
+
if (changed >= 0) this.host?.invalidate(changed);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
private stopWorker(): void {
|
|
492
|
+
stopTimeout(this.worker);
|
|
493
|
+
this.worker = null;
|
|
254
494
|
}
|
|
255
495
|
}
|
|
256
496
|
|
|
@@ -289,7 +529,7 @@ export function lineModeLanguage<S>(mode: LineMode<S>): Language {
|
|
|
289
529
|
return {
|
|
290
530
|
name: mode.name,
|
|
291
531
|
data: mode.languageData,
|
|
292
|
-
createTokenizer: () => new StreamTokenizer(mode),
|
|
532
|
+
createTokenizer: (host) => new StreamTokenizer(mode, host),
|
|
293
533
|
};
|
|
294
534
|
}
|
|
295
535
|
|
|
@@ -117,10 +117,11 @@ export interface LineEdit {
|
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* What the editor hands an engine at creation time. `invalidate(fromLine)`
|
|
120
|
-
* is for
|
|
121
|
-
* an LSP answering semantic tokens
|
|
122
|
-
*
|
|
123
|
-
*
|
|
120
|
+
* is for tokens that change after they were asked for (Lezer reparsing on a
|
|
121
|
+
* debounce, an LSP answering semantic tokens, the stream engine correcting a
|
|
122
|
+
* line it answered from a guess): call it when lines at or below `fromLine`
|
|
123
|
+
* have new tokens, and the editor repaints and pulls again. An engine that
|
|
124
|
+
* only ever answers exactly never needs it.
|
|
124
125
|
*/
|
|
125
126
|
export interface TokenizerHost {
|
|
126
127
|
invalidate(fromLine: number): void;
|
package/src/codeblock/index.ts
CHANGED
|
@@ -140,7 +140,24 @@ export function codeBlockStyle(look: CodeBlockLook): Style {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
/**
|
|
144
|
+
* The style the runs are laid out with, in both components — `wrap` as the
|
|
145
|
+
* `<richtext>` is given it.
|
|
146
|
+
*
|
|
147
|
+
* Unwrapped, the text is as wide as its longest line, and at least as wide
|
|
148
|
+
* as its viewport. Stretched to the viewport, as a column stretches what it
|
|
149
|
+
* holds, its box held none of a line past the viewport's edge: the viewport
|
|
150
|
+
* had nothing to scroll to, and core, asked whether the text reached past
|
|
151
|
+
* the viewport, heard that it did not and left it unclipped — so a fence,
|
|
152
|
+
* with nothing round it to clip it either, drew the rest of a long line
|
|
153
|
+
* across whatever stood beside the document.
|
|
154
|
+
*/
|
|
155
|
+
export function codeTextStyle(look: CodeBlockLook, wrap = true): Style {
|
|
156
|
+
return wrap
|
|
157
|
+
? { lineHeight: look.lineHeight }
|
|
158
|
+
: {
|
|
159
|
+
lineHeight: look.lineHeight,
|
|
160
|
+
alignSelf: 'flex-start',
|
|
161
|
+
minWidth: '100%',
|
|
162
|
+
};
|
|
146
163
|
}
|