@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
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
// A `FlowScene` packed for the GPU: three instance streams and the order to
|
|
2
|
+
// draw them in.
|
|
3
|
+
//
|
|
4
|
+
// This is `../paint.ts`'s counterpart, and the two differ in exactly the way
|
|
5
|
+
// the renderers do. The 2D painter's job is to issue as few *requests* as it
|
|
6
|
+
// can, so it buckets by pen and batches past a threshold. This one's job is
|
|
7
|
+
// to issue as few *draw calls* as it can while keeping the 2D painter's
|
|
8
|
+
// **z-order to the element** — so rather than bucketing, it appends every
|
|
9
|
+
// shape to one of three streams in scene order and records where each run
|
|
10
|
+
// of one kind begins and ends. A frame is a handful of ranged instanced draws
|
|
11
|
+
// walked in that order.
|
|
12
|
+
//
|
|
13
|
+
// The one program that makes that cheap is the rounded box
|
|
14
|
+
// (`./shaders.ts`): a disc is a box of side 2r with a corner radius of r, so
|
|
15
|
+
// a card, its accent, a handle, a grip, a label chip, the selection and the
|
|
16
|
+
// whole minimap are *one* stream, and a node's handles land above its card
|
|
17
|
+
// and below the next node's with no extra draw between them.
|
|
18
|
+
//
|
|
19
|
+
// Pure, and in the scene's own units — logical window pixels. The renderer
|
|
20
|
+
// moves to device pixels in the vertex shader, once, which is `../draw.ts`'s
|
|
21
|
+
// single multiply on the way to the context, done on the GPU.
|
|
22
|
+
import type { FlowRect, XYPosition } from '../types.js';
|
|
23
|
+
import type {
|
|
24
|
+
FlowScene,
|
|
25
|
+
SceneHandle,
|
|
26
|
+
SceneRect,
|
|
27
|
+
SceneRule,
|
|
28
|
+
SceneText,
|
|
29
|
+
} from '../scene.js';
|
|
30
|
+
import { ColorCache } from './color.js';
|
|
31
|
+
import type { Rgba } from './color.js';
|
|
32
|
+
import type { GlyphQuad } from './text.js';
|
|
33
|
+
|
|
34
|
+
/** Turns a string into the quad that draws it — `./text.ts`'s atlas, or
|
|
35
|
+
* nothing, in which case the string is counted as a gap. */
|
|
36
|
+
export type TextResolver = (text: SceneText) => GlyphQuad | null;
|
|
37
|
+
|
|
38
|
+
/** Floats per line segment: the ends; then half-width, the distance along
|
|
39
|
+
* the line at the first end, and the dash; then the dash's offset and
|
|
40
|
+
* whether it marches; then the colour. */
|
|
41
|
+
export const LINE_STRIDE = 16;
|
|
42
|
+
/** Floats per box: the rect, the corner radius and border width, the fill,
|
|
43
|
+
* the border colour. A *label* is a box too — the text's corner and the
|
|
44
|
+
* quad's size where the rect is, its margin, a flag and the size of a
|
|
45
|
+
* field texel where the corner radius and border are, its ink in the fill
|
|
46
|
+
* and its place in the atlas where a border colour would be — so labels
|
|
47
|
+
* share the box stream and land in it exactly where the 2D painter draws
|
|
48
|
+
* them. */
|
|
49
|
+
export const BOX_STRIDE = 16;
|
|
50
|
+
/** Floats per triangle *vertex*: position and colour. */
|
|
51
|
+
export const TRI_STRIDE = 6;
|
|
52
|
+
|
|
53
|
+
/** One run of one kind of instance, drawn in turn. `scissor` limits it to a
|
|
54
|
+
* rect — the minimap's viewport box is allowed to spill past the panel in
|
|
55
|
+
* the scene and has to be cut, as the 2D painter's `clipRect` cuts it. */
|
|
56
|
+
export interface DrawRange {
|
|
57
|
+
kind: 'grid' | 'line' | 'box' | 'tri';
|
|
58
|
+
first: number;
|
|
59
|
+
count: number;
|
|
60
|
+
scissor?: FlowRect;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** What {@link packScene} could not put on the GPU, counted rather than
|
|
64
|
+
* dropped silently — the renderer reports it, and a caller deciding
|
|
65
|
+
* whether GL is good enough for a graph reads it. */
|
|
66
|
+
export interface PackGaps {
|
|
67
|
+
/** Strings: node labels, descriptions, edge labels, handle labels. The
|
|
68
|
+
* label atlas is the next piece of work (`docs/prd-flow-gl.md`). */
|
|
69
|
+
text: number;
|
|
70
|
+
/** Nodes whose type draws itself through `paint`, which is a 2D API. */
|
|
71
|
+
custom: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Which part of a scene to pack.
|
|
76
|
+
*
|
|
77
|
+
* The GL renderer keeps the graph — edges, heads, chips, nodes, the line a
|
|
78
|
+
* connection gesture draws — as a **world** it packs only when it changes,
|
|
79
|
+
* built at a pinned origin so that a pan moves a uniform and repacks
|
|
80
|
+
* nothing. What is pinned to the *pane* rather than to the graph is the
|
|
81
|
+
* **overlay**, packed every frame because it is a handful of boxes: the
|
|
82
|
+
* background and the grid under the world, the selection rectangle, the
|
|
83
|
+
* minimap and the controls over it. `'all'` is both, in one pass, in the 2D
|
|
84
|
+
* painter's order.
|
|
85
|
+
*/
|
|
86
|
+
export type PackLayer = 'all' | 'world' | 'overlay';
|
|
87
|
+
|
|
88
|
+
/** A label packed before its field landed: which box it is, the field or
|
|
89
|
+
* request it waits for, and the label itself (`LabelAtlas.landing`). */
|
|
90
|
+
export interface WaitingLabel {
|
|
91
|
+
index: number;
|
|
92
|
+
key: string;
|
|
93
|
+
text: SceneText;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A label packed drawn from a field, and the placement of the field it
|
|
97
|
+
* was drawn from (`LabelAtlas.slotOf`): a box whose field was dropped or
|
|
98
|
+
* moved is found by comparing the two. */
|
|
99
|
+
export interface DrawnLabel extends WaitingLabel {
|
|
100
|
+
slot: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface PackedScene {
|
|
104
|
+
lines: Float32Array;
|
|
105
|
+
lineCount: number;
|
|
106
|
+
boxes: Float32Array;
|
|
107
|
+
boxCount: number;
|
|
108
|
+
tris: Float32Array;
|
|
109
|
+
triCount: number;
|
|
110
|
+
ranges: DrawRange[];
|
|
111
|
+
/** For an overlay: the ranges before this index go under the world and
|
|
112
|
+
* the rest over it. */
|
|
113
|
+
split: number;
|
|
114
|
+
/** For a world: the ranges before this index are the edges, and the rest
|
|
115
|
+
* the cards — where a layer of lifted nodes goes in two halves, its
|
|
116
|
+
* edges under every card and its cards over them. */
|
|
117
|
+
nodesAt: number;
|
|
118
|
+
gaps: PackGaps;
|
|
119
|
+
/** Labels in `boxes` drawn as nothing until their fields land — the
|
|
120
|
+
* renderer writes each in when it does. */
|
|
121
|
+
waiting: WaitingLabel[];
|
|
122
|
+
/** Labels in `boxes` drawn from their fields. */
|
|
123
|
+
drawn: DrawnLabel[];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A growable Float32Array, reused frame to frame: a scene is repacked every
|
|
128
|
+
* frame the graph changes, and allocating its buffers each time is exactly
|
|
129
|
+
* the garbage `../scene.ts`'s route cache exists to avoid.
|
|
130
|
+
*/
|
|
131
|
+
class Stream {
|
|
132
|
+
data: Float32Array;
|
|
133
|
+
length = 0;
|
|
134
|
+
|
|
135
|
+
constructor(
|
|
136
|
+
private readonly stride: number,
|
|
137
|
+
capacity: number,
|
|
138
|
+
) {
|
|
139
|
+
this.data = new Float32Array(stride * capacity);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
reset(): void {
|
|
143
|
+
this.length = 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Room for one more record; answers its offset. */
|
|
147
|
+
next(): number {
|
|
148
|
+
const at = this.length * this.stride;
|
|
149
|
+
if (at + this.stride > this.data.length) {
|
|
150
|
+
const grown = new Float32Array(this.data.length * 2);
|
|
151
|
+
grown.set(this.data);
|
|
152
|
+
this.data = grown;
|
|
153
|
+
}
|
|
154
|
+
this.length++;
|
|
155
|
+
return at;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Packs scenes into streams it owns and reuses. One per renderer. */
|
|
160
|
+
export class ScenePacker {
|
|
161
|
+
private readonly colors = new ColorCache();
|
|
162
|
+
private readonly lineStream = new Stream(LINE_STRIDE, 1024);
|
|
163
|
+
private readonly boxStream = new Stream(BOX_STRIDE, 256);
|
|
164
|
+
private readonly triStream = new Stream(TRI_STRIDE, 256);
|
|
165
|
+
private ranges: DrawRange[] = [];
|
|
166
|
+
private gaps: PackGaps = { text: 0, custom: 0 };
|
|
167
|
+
private waiting: WaitingLabel[] = [];
|
|
168
|
+
private drawn: DrawnLabel[] = [];
|
|
169
|
+
/** The scissor for whatever is appended until it is changed. */
|
|
170
|
+
private scissor: FlowRect | undefined;
|
|
171
|
+
|
|
172
|
+
private text: TextResolver | undefined;
|
|
173
|
+
/** The next range recorded is a new one, whatever the last was. */
|
|
174
|
+
private cut = false;
|
|
175
|
+
private nodesAt = 0;
|
|
176
|
+
|
|
177
|
+
pack(
|
|
178
|
+
scene: FlowScene,
|
|
179
|
+
layer: PackLayer = 'all',
|
|
180
|
+
text?: TextResolver,
|
|
181
|
+
): PackedScene {
|
|
182
|
+
this.text = text;
|
|
183
|
+
const world = layer !== 'overlay';
|
|
184
|
+
const overlay = layer !== 'world';
|
|
185
|
+
this.lineStream.reset();
|
|
186
|
+
this.boxStream.reset();
|
|
187
|
+
this.triStream.reset();
|
|
188
|
+
this.ranges = [];
|
|
189
|
+
this.gaps = { text: 0, custom: 0 };
|
|
190
|
+
this.waiting = [];
|
|
191
|
+
this.drawn = [];
|
|
192
|
+
this.cut = false;
|
|
193
|
+
this.nodesAt = 0;
|
|
194
|
+
this.scissor = undefined;
|
|
195
|
+
|
|
196
|
+
let split = 0;
|
|
197
|
+
if (scene.region) {
|
|
198
|
+
if (overlay) {
|
|
199
|
+
if (scene.background) this.box(scene.background);
|
|
200
|
+
if (scene.grid) this.ranges.push({ kind: 'grid', first: 0, count: 1 });
|
|
201
|
+
}
|
|
202
|
+
split = this.ranges.length;
|
|
203
|
+
}
|
|
204
|
+
if (scene.region && world) {
|
|
205
|
+
// Every stroke, then every head, then every chip, then every label:
|
|
206
|
+
// the painter's order, and the reason a label sits above the edge
|
|
207
|
+
// that crosses the one it names.
|
|
208
|
+
for (const edge of scene.edges) {
|
|
209
|
+
const dash = dashPair(edge.dash);
|
|
210
|
+
// A marching dash is packed with no phase and a flag: the renderer
|
|
211
|
+
// adds the phase as a uniform, so the timer's tick is a frame, not a
|
|
212
|
+
// world rebuilt (`./renderer.ts`, `u_phase`).
|
|
213
|
+
this.polyline(
|
|
214
|
+
edge.points,
|
|
215
|
+
edge.lineWidth,
|
|
216
|
+
this.colors.get(edge.stroke),
|
|
217
|
+
dash[0],
|
|
218
|
+
dash[1],
|
|
219
|
+
edge.animated ? 0 : edge.dashOffset,
|
|
220
|
+
edge.animated,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
// The heads in two passes — every fill, then every outline and open
|
|
224
|
+
// head — as the 2D painter draws its filled bucket before its stroked
|
|
225
|
+
// one. One pass per head alternated triangle and line and opened two
|
|
226
|
+
// draw ranges an arrowhead: 807 draw calls for 200 nodes, where two
|
|
227
|
+
// are enough. Heads almost never overlap one another, so the order
|
|
228
|
+
// within the layer is not something anyone can see.
|
|
229
|
+
for (const edge of scene.edges) {
|
|
230
|
+
for (const marker of edge.markers) {
|
|
231
|
+
if (marker.filled) {
|
|
232
|
+
this.polygon(marker.points, this.colors.get(marker.color));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
for (const edge of scene.edges) {
|
|
237
|
+
for (const marker of edge.markers) {
|
|
238
|
+
const color = this.colors.get(marker.color);
|
|
239
|
+
if (marker.filled) {
|
|
240
|
+
// Flat triangles are not antialiased; a hairline round the same
|
|
241
|
+
// outline in the same colour is, and it is what the 2D fill's
|
|
242
|
+
// own coverage looks like at its edge.
|
|
243
|
+
this.polyline(closed(marker.points), 1, color, 0, 0, 0);
|
|
244
|
+
} else {
|
|
245
|
+
this.polyline(marker.points, marker.lineWidth, color, 0, 0, 0);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
for (const edge of scene.edges) if (edge.chip) this.box(edge.chip);
|
|
250
|
+
for (const edge of scene.edges) if (edge.label) this.label(edge.label);
|
|
251
|
+
|
|
252
|
+
this.nodesAt = this.ranges.length;
|
|
253
|
+
this.cut = true;
|
|
254
|
+
for (const node of scene.nodes) {
|
|
255
|
+
if (node.custom) {
|
|
256
|
+
this.gaps.custom++;
|
|
257
|
+
} else if (node.card) {
|
|
258
|
+
this.box(node.card.shape);
|
|
259
|
+
if (node.card.accent) this.box(node.card.accent);
|
|
260
|
+
for (const ink of node.ink) this.ink(ink);
|
|
261
|
+
}
|
|
262
|
+
for (const handle of node.handles) this.handle(handle);
|
|
263
|
+
for (const grip of node.grips) this.box(grip);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (scene.connection) {
|
|
267
|
+
const c = scene.connection;
|
|
268
|
+
const dash = dashPair(c.dash);
|
|
269
|
+
this.polyline(
|
|
270
|
+
c.points,
|
|
271
|
+
c.lineWidth,
|
|
272
|
+
this.colors.get(c.stroke),
|
|
273
|
+
dash[0],
|
|
274
|
+
dash[1],
|
|
275
|
+
0,
|
|
276
|
+
);
|
|
277
|
+
this.handle(c.tip);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (scene.region && overlay) {
|
|
281
|
+
split = layer === 'overlay' ? split : this.ranges.length;
|
|
282
|
+
if (scene.selection) this.box(scene.selection);
|
|
283
|
+
|
|
284
|
+
if (scene.miniMap) {
|
|
285
|
+
const map = scene.miniMap;
|
|
286
|
+
this.box(map.panel);
|
|
287
|
+
this.scissor = map.panel.rect;
|
|
288
|
+
for (const n of map.nodes) this.box(n);
|
|
289
|
+
this.box(map.view);
|
|
290
|
+
this.scissor = undefined;
|
|
291
|
+
}
|
|
292
|
+
if (scene.controls) {
|
|
293
|
+
this.box(scene.controls.panel);
|
|
294
|
+
for (const rule of scene.controls.rules) this.rule(rule);
|
|
295
|
+
for (const glyph of scene.controls.glyphs) {
|
|
296
|
+
const color = this.colors.get(glyph.color);
|
|
297
|
+
for (const run of glyph.runs) {
|
|
298
|
+
this.polyline(run, glyph.lineWidth, color, 0, 0, 0);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return {
|
|
305
|
+
lines: this.lineStream.data,
|
|
306
|
+
lineCount: this.lineStream.length,
|
|
307
|
+
boxes: this.boxStream.data,
|
|
308
|
+
boxCount: this.boxStream.length,
|
|
309
|
+
tris: this.triStream.data,
|
|
310
|
+
triCount: this.triStream.length,
|
|
311
|
+
ranges: this.ranges,
|
|
312
|
+
nodesAt: this.nodesAt,
|
|
313
|
+
split,
|
|
314
|
+
gaps: this.gaps,
|
|
315
|
+
waiting: this.waiting,
|
|
316
|
+
drawn: this.drawn,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** Extend the last range when it is the same kind under the same scissor,
|
|
321
|
+
* or open a new one — which is what keeps a frame to a handful of draws
|
|
322
|
+
* however the kinds interleave. */
|
|
323
|
+
private record(kind: 'line' | 'box' | 'tri', first: number): void {
|
|
324
|
+
const last = this.ranges[this.ranges.length - 1];
|
|
325
|
+
if (
|
|
326
|
+
last &&
|
|
327
|
+
!this.cut &&
|
|
328
|
+
last.kind === kind &&
|
|
329
|
+
last.scissor === this.scissor
|
|
330
|
+
) {
|
|
331
|
+
last.count++;
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
this.cut = false;
|
|
335
|
+
this.ranges.push({ kind, first, count: 1, scissor: this.scissor });
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
private box(item: SceneRect): void {
|
|
339
|
+
const { rect } = item;
|
|
340
|
+
if (!(rect.width > 0) || !(rect.height > 0)) return;
|
|
341
|
+
const fill = this.colors.get(item.fill);
|
|
342
|
+
const border = item.stroke ? this.colors.get(item.stroke) : null;
|
|
343
|
+
this.boxRaw(
|
|
344
|
+
rect.x,
|
|
345
|
+
rect.y,
|
|
346
|
+
rect.width,
|
|
347
|
+
rect.height,
|
|
348
|
+
item.radius,
|
|
349
|
+
border ? (item.lineWidth ?? 1) : 0,
|
|
350
|
+
fill,
|
|
351
|
+
border ?? fill,
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
private boxRaw(
|
|
356
|
+
x: number,
|
|
357
|
+
y: number,
|
|
358
|
+
w: number,
|
|
359
|
+
h: number,
|
|
360
|
+
radius: number,
|
|
361
|
+
border: number,
|
|
362
|
+
fill: Rgba,
|
|
363
|
+
ring: Rgba,
|
|
364
|
+
): void {
|
|
365
|
+
const s = this.boxStream;
|
|
366
|
+
const index = s.length;
|
|
367
|
+
const at = s.next();
|
|
368
|
+
const d = s.data;
|
|
369
|
+
d[at] = x;
|
|
370
|
+
d[at + 1] = y;
|
|
371
|
+
d[at + 2] = w;
|
|
372
|
+
d[at + 3] = h;
|
|
373
|
+
d[at + 4] = radius;
|
|
374
|
+
d[at + 5] = border;
|
|
375
|
+
d[at + 6] = 0;
|
|
376
|
+
d[at + 7] = 0;
|
|
377
|
+
d[at + 8] = fill[0];
|
|
378
|
+
d[at + 9] = fill[1];
|
|
379
|
+
d[at + 10] = fill[2];
|
|
380
|
+
d[at + 11] = fill[3];
|
|
381
|
+
d[at + 12] = ring[0];
|
|
382
|
+
d[at + 13] = ring[1];
|
|
383
|
+
d[at + 14] = ring[2];
|
|
384
|
+
d[at + 15] = ring[3];
|
|
385
|
+
this.record('box', index);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* A handle as a box whose corners meet. The 2D painter strokes a circle's
|
|
390
|
+
* outline *centred* on its edge — half the pen outside the radius — where
|
|
391
|
+
* a box's border is inset, so the disc is grown by half the pen to put the
|
|
392
|
+
* ring where the circle's was.
|
|
393
|
+
*/
|
|
394
|
+
private handle(h: SceneHandle): void {
|
|
395
|
+
const pen = h.stroke ? (h.lineWidth ?? 1) : 0;
|
|
396
|
+
const r = h.radius + pen / 2;
|
|
397
|
+
const fill = this.colors.get(h.fill);
|
|
398
|
+
const ring = h.stroke ? this.colors.get(h.stroke) : fill;
|
|
399
|
+
this.boxRaw(h.at.x - r, h.at.y - r, r * 2, r * 2, r, pen, fill, ring);
|
|
400
|
+
if (h.label) this.label(h.label);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** A string as a box that samples its field in the atlas; counted as a
|
|
404
|
+
* gap when the atlas has nothing to draw it from yet — and packed all
|
|
405
|
+
* the same when its field is being set, drawn as nothing until it lands
|
|
406
|
+
* (`waiting`). */
|
|
407
|
+
private label(t: SceneText): void {
|
|
408
|
+
const q = this.text?.(t);
|
|
409
|
+
if (!q) {
|
|
410
|
+
this.gaps.text++;
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const color = this.colors.get(t.color);
|
|
414
|
+
if (color[3] <= 0) return;
|
|
415
|
+
const s = this.boxStream;
|
|
416
|
+
const index = s.length;
|
|
417
|
+
const at = s.next();
|
|
418
|
+
const d = s.data;
|
|
419
|
+
d[at] = q.x;
|
|
420
|
+
d[at + 1] = q.y;
|
|
421
|
+
d[at + 2] = q.w;
|
|
422
|
+
d[at + 3] = q.h;
|
|
423
|
+
d[at + 4] = q.margin;
|
|
424
|
+
// the page its field is on: which channel the shader reads
|
|
425
|
+
d[at + 5] = q.page;
|
|
426
|
+
// a label, not a box — and 2 for one whose field is still being set
|
|
427
|
+
d[at + 6] = q.ready ? 1 : 2;
|
|
428
|
+
d[at + 7] = q.texel;
|
|
429
|
+
d[at + 8] = color[0];
|
|
430
|
+
d[at + 9] = color[1];
|
|
431
|
+
d[at + 10] = color[2];
|
|
432
|
+
d[at + 11] = color[3];
|
|
433
|
+
d[at + 12] = q.u0;
|
|
434
|
+
d[at + 13] = q.v0;
|
|
435
|
+
d[at + 14] = q.u1;
|
|
436
|
+
d[at + 15] = q.v1;
|
|
437
|
+
if (!q.ready) {
|
|
438
|
+
this.gaps.text++;
|
|
439
|
+
this.waiting.push({ index, key: q.key, text: t });
|
|
440
|
+
} else {
|
|
441
|
+
this.drawn.push({ index, key: q.key, text: t, slot: q.slot });
|
|
442
|
+
}
|
|
443
|
+
this.record('box', index);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
private ink(item: SceneText | SceneRule): void {
|
|
447
|
+
if (item.kind === 'text') this.label(item);
|
|
448
|
+
else this.rule(item);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
private rule(item: SceneRule): void {
|
|
452
|
+
// A hairline across or down — every rule a scene draws, the one under a
|
|
453
|
+
// title bar and the one between two control buttons — is a box: the
|
|
454
|
+
// pixels of the butt-capped stroke the 2D painter lays. As a line it put
|
|
455
|
+
// the line program between a card's boxes, and a range is one program:
|
|
456
|
+
// every card with a title bar opened three draw ranges where the rest
|
|
457
|
+
// of the world's nodes shared one — 566 draws a frame on a board of
|
|
458
|
+
// widget cards, each two dozen calls into the GL bridge.
|
|
459
|
+
const [a, b] = item.points;
|
|
460
|
+
if (item.points.length === 2 && (a.y === b.y || a.x === b.x)) {
|
|
461
|
+
const color = this.colors.get(item.color);
|
|
462
|
+
if (color[3] <= 0) return;
|
|
463
|
+
const half = item.lineWidth / 2;
|
|
464
|
+
if (a.y === b.y) {
|
|
465
|
+
const w = Math.abs(b.x - a.x);
|
|
466
|
+
if (w > 0) {
|
|
467
|
+
this.boxRaw(
|
|
468
|
+
Math.min(a.x, b.x),
|
|
469
|
+
a.y - half,
|
|
470
|
+
w,
|
|
471
|
+
item.lineWidth,
|
|
472
|
+
0,
|
|
473
|
+
0,
|
|
474
|
+
color,
|
|
475
|
+
color,
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
} else {
|
|
479
|
+
const h = Math.abs(b.y - a.y);
|
|
480
|
+
if (h > 0) {
|
|
481
|
+
this.boxRaw(
|
|
482
|
+
a.x - half,
|
|
483
|
+
Math.min(a.y, b.y),
|
|
484
|
+
item.lineWidth,
|
|
485
|
+
h,
|
|
486
|
+
0,
|
|
487
|
+
0,
|
|
488
|
+
color,
|
|
489
|
+
color,
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
this.polyline(
|
|
496
|
+
item.points,
|
|
497
|
+
item.lineWidth,
|
|
498
|
+
this.colors.get(item.color),
|
|
499
|
+
0,
|
|
500
|
+
0,
|
|
501
|
+
0,
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** A polyline as capsule segments, carrying the distance along it so a
|
|
506
|
+
* dash runs continuously round every vertex. */
|
|
507
|
+
private polyline(
|
|
508
|
+
points: readonly XYPosition[],
|
|
509
|
+
lineWidth: number,
|
|
510
|
+
color: Rgba,
|
|
511
|
+
dashOn: number,
|
|
512
|
+
dashOff: number,
|
|
513
|
+
dashOffset: number,
|
|
514
|
+
marching = false,
|
|
515
|
+
): void {
|
|
516
|
+
if (points.length < 2 || color[3] <= 0) return;
|
|
517
|
+
const s = this.lineStream;
|
|
518
|
+
const half = lineWidth / 2;
|
|
519
|
+
let along = 0;
|
|
520
|
+
for (let i = 0; i + 1 < points.length; i++) {
|
|
521
|
+
const a = points[i];
|
|
522
|
+
const b = points[i + 1];
|
|
523
|
+
const index = s.length;
|
|
524
|
+
const at = s.next();
|
|
525
|
+
const d = s.data;
|
|
526
|
+
d[at] = a.x;
|
|
527
|
+
d[at + 1] = a.y;
|
|
528
|
+
d[at + 2] = b.x;
|
|
529
|
+
d[at + 3] = b.y;
|
|
530
|
+
d[at + 4] = half;
|
|
531
|
+
d[at + 5] = along;
|
|
532
|
+
d[at + 6] = dashOn;
|
|
533
|
+
d[at + 7] = dashOff;
|
|
534
|
+
d[at + 8] = dashOffset;
|
|
535
|
+
d[at + 9] = marching ? 1 : 0;
|
|
536
|
+
d[at + 10] = 0;
|
|
537
|
+
d[at + 11] = 0;
|
|
538
|
+
d[at + 12] = color[0];
|
|
539
|
+
d[at + 13] = color[1];
|
|
540
|
+
d[at + 14] = color[2];
|
|
541
|
+
d[at + 15] = color[3];
|
|
542
|
+
this.record('line', index);
|
|
543
|
+
along += Math.hypot(b.x - a.x, b.y - a.y);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** A convex polygon as a triangle fan off its first vertex. Arrowheads
|
|
548
|
+
* are the only filled polygons a graph draws, and both kinds are
|
|
549
|
+
* convex. */
|
|
550
|
+
private polygon(points: readonly XYPosition[], color: Rgba): void {
|
|
551
|
+
if (points.length < 3 || color[3] <= 0) return;
|
|
552
|
+
const s = this.triStream;
|
|
553
|
+
for (let i = 1; i + 1 < points.length; i++) {
|
|
554
|
+
for (const p of [points[0], points[i], points[i + 1]]) {
|
|
555
|
+
const index = s.length;
|
|
556
|
+
const at = s.next();
|
|
557
|
+
const d = s.data;
|
|
558
|
+
d[at] = p.x;
|
|
559
|
+
d[at + 1] = p.y;
|
|
560
|
+
d[at + 2] = color[0];
|
|
561
|
+
d[at + 3] = color[1];
|
|
562
|
+
d[at + 4] = color[2];
|
|
563
|
+
d[at + 5] = color[3];
|
|
564
|
+
this.record('tri', index);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* A canvas dash pattern as the one on/off pair the line program draws.
|
|
572
|
+
* `[a]` means `[a, a]`, as `setLineDash` repeats an odd-length list; a
|
|
573
|
+
* longer pattern keeps its first pair. Every pattern a graph draws by
|
|
574
|
+
* default is a pair, and a user `style.dash` of more is rare enough to say
|
|
575
|
+
* so rather than to pay a second uniform block for.
|
|
576
|
+
*/
|
|
577
|
+
function dashPair(dash: readonly number[] | undefined): [number, number] {
|
|
578
|
+
if (!dash || dash.length === 0) return [0, 0];
|
|
579
|
+
if (dash.length === 1) return [dash[0], dash[0]];
|
|
580
|
+
return [dash[0], dash[1]];
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function closed(points: readonly XYPosition[]): XYPosition[] {
|
|
584
|
+
return points.length > 0 ? [...points, points[0]] : [];
|
|
585
|
+
}
|