@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
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
import { resolveZoomed } from '../style.js';
|
|
2
|
+
import { TILE_EXTENT } from './buckets.js';
|
|
3
|
+
import { parseColor, premultiplied } from './color.js';
|
|
4
|
+
import { LABEL_STRIDE, LEVEL_SNAP, LINE_MARGIN, LabelField, STRAIGHT_FRACTION, estimateWidth, } from '../anchors.js';
|
|
5
|
+
import { fieldReach } from './text.js';
|
|
6
|
+
import { DEFAULT_ICON_COLOR, DEFAULT_ICON_GLYPH_COLOR, DEFAULT_ICON_SIZE, ICON_GAP, isMapIcon, } from '../icons.js';
|
|
7
|
+
/** Floats per label instance; the layout `renderer.ts` binds. */
|
|
8
|
+
export const LABEL_INSTANCE = 19;
|
|
9
|
+
/** Logical pixels between two labels, and the extra a newcomer needs. The
|
|
10
|
+
* extra is the hysteresis: the label already shown wins a tie by it. */
|
|
11
|
+
const PADDING = 4;
|
|
12
|
+
const NEW_PADDING = 3;
|
|
13
|
+
/** Logical pixels a label keeps from the view's edge. */
|
|
14
|
+
const EDGE = 6;
|
|
15
|
+
/** How long a label takes to appear or leave. */
|
|
16
|
+
export const FADE_MS = 220;
|
|
17
|
+
/** How near a new anchor must be, in label heights, to a shown label of
|
|
18
|
+
* the same name to be that label — across a level change, say. */
|
|
19
|
+
const MATCH = 2;
|
|
20
|
+
/** The collision grid's cell, device pixels. */
|
|
21
|
+
const CELL = 64;
|
|
22
|
+
/**
|
|
23
|
+
* The frame's label state: what is shown, how visibly, and the collision
|
|
24
|
+
* index a pass builds.
|
|
25
|
+
*/
|
|
26
|
+
export class LabelPlacer {
|
|
27
|
+
_shown = new Set();
|
|
28
|
+
_style = null;
|
|
29
|
+
/** The last batch's time; null before the first, which advances no fade. */
|
|
30
|
+
_last = null;
|
|
31
|
+
_grid = new CollisionGrid();
|
|
32
|
+
_colors = new Map();
|
|
33
|
+
/** Estimated widths in ems, by text — a street name is asked about
|
|
34
|
+
* once per anchor per frame. */
|
|
35
|
+
_ems = new Map();
|
|
36
|
+
_instances = new Float32Array(LABEL_INSTANCE * 64);
|
|
37
|
+
stats = { candidates: 0, placed: 0, drawn: 0, ms: 0 };
|
|
38
|
+
/** Labels still changing visibility: another frame is worth drawing. */
|
|
39
|
+
get animating() {
|
|
40
|
+
for (const shown of this._shown) {
|
|
41
|
+
if (shown.placed ? shown.opacity < 1 : shown.opacity > 0)
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
/** Forget everything shown — the style's layers are not the same ones. */
|
|
47
|
+
reset() {
|
|
48
|
+
this._shown.clear();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Choose the frame's labels. Asks `atlas` for each contender's box, as
|
|
52
|
+
* the frame's budget allows, and for each winner's field.
|
|
53
|
+
*/
|
|
54
|
+
place(frame, atlas) {
|
|
55
|
+
const started = now();
|
|
56
|
+
const { width, height, scale, zoom, style } = frame;
|
|
57
|
+
if (style !== this._style) {
|
|
58
|
+
this._shown.clear();
|
|
59
|
+
this._style = style;
|
|
60
|
+
}
|
|
61
|
+
const layers = this._layersAt(style, zoom, scale);
|
|
62
|
+
const candidates = [];
|
|
63
|
+
const halfW = width / 2;
|
|
64
|
+
const halfH = height / 2;
|
|
65
|
+
// What is shown, first — at the ground it was placed on, for as long as
|
|
66
|
+
// the map still names it there: the tile under it must carry the name.
|
|
67
|
+
// A label is not its tile's (a level change keeps it), but it is the
|
|
68
|
+
// data's — a new source, a filter, a text field takes it off the map.
|
|
69
|
+
const named = (text, sx, sy) => {
|
|
70
|
+
let covered = false;
|
|
71
|
+
for (const tile of frame.tiles) {
|
|
72
|
+
const clip = tile.clip;
|
|
73
|
+
if (sx < clip.x ||
|
|
74
|
+
sy < clip.y ||
|
|
75
|
+
sx >= clip.x + clip.width ||
|
|
76
|
+
sy >= clip.y + clip.height) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
covered = true;
|
|
80
|
+
const data = tile.data.labels;
|
|
81
|
+
if (data && textsOf(data).has(text))
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
// Nothing drawn there yet: no tile has said otherwise.
|
|
85
|
+
return !covered;
|
|
86
|
+
};
|
|
87
|
+
const byKey = new Map();
|
|
88
|
+
for (const shown of this._shown) {
|
|
89
|
+
const layer = layers[shown.layer];
|
|
90
|
+
if (!layer)
|
|
91
|
+
continue;
|
|
92
|
+
const list = byKey.get(shown.key);
|
|
93
|
+
if (list)
|
|
94
|
+
list.push(shown);
|
|
95
|
+
else
|
|
96
|
+
byKey.set(shown.key, [shown]);
|
|
97
|
+
if (!shown.placed)
|
|
98
|
+
continue;
|
|
99
|
+
let dx = shown.mx - frame.centerX;
|
|
100
|
+
dx -= Math.round(dx);
|
|
101
|
+
const sx = halfW + dx * frame.world;
|
|
102
|
+
const sy = halfH + (shown.my - frame.centerY) * frame.world;
|
|
103
|
+
if (!named(shown.text, sx, sy))
|
|
104
|
+
continue;
|
|
105
|
+
const c = this._candidate(shown.key, shown.text, shown.layer, layer, shown.priority, shown.point, sx, sy, shown.angle, shown.avail, shown.clear, shown.length, shown.dev, frame.world, frame);
|
|
106
|
+
if (c) {
|
|
107
|
+
c.shown = shown;
|
|
108
|
+
candidates.push(c);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Every anchor the view's tiles offer — unless nothing new is admitted.
|
|
112
|
+
const offered = frame.admit === false ? [] : frame.tiles;
|
|
113
|
+
for (const tile of offered) {
|
|
114
|
+
const data = tile.data.labels;
|
|
115
|
+
if (!data || data.count === 0)
|
|
116
|
+
continue;
|
|
117
|
+
const ppu = tile.size / TILE_EXTENT;
|
|
118
|
+
const clip = tile.clip;
|
|
119
|
+
const a = data.anchors;
|
|
120
|
+
for (let i = 0; i < data.count; i++) {
|
|
121
|
+
const at = i * LABEL_STRIDE;
|
|
122
|
+
const index = a[at + LabelField.layer];
|
|
123
|
+
const layer = layers[index];
|
|
124
|
+
if (!layer)
|
|
125
|
+
continue;
|
|
126
|
+
const sx = tile.x + a[at + LabelField.x] * ppu;
|
|
127
|
+
const sy = tile.y + a[at + LabelField.y] * ppu;
|
|
128
|
+
if (sx < clip.x ||
|
|
129
|
+
sy < clip.y ||
|
|
130
|
+
sx >= clip.x + clip.width ||
|
|
131
|
+
sy >= clip.y + clip.height) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const text = data.texts[a[at + LabelField.text]];
|
|
135
|
+
const avail = a[at + LabelField.avail];
|
|
136
|
+
const c = this._candidate(`${layer.id}|${text}`, text, index, layer, a[at + LabelField.priority], avail < 0, sx, sy, a[at + LabelField.angle], avail, a[at + LabelField.clear], a[at + LabelField.length], a[at + LabelField.dev], ppu, frame);
|
|
137
|
+
if (c)
|
|
138
|
+
candidates.push(c);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
candidates.sort(compare);
|
|
142
|
+
// Greedy, in that order: a label is placed if it fits its street, is
|
|
143
|
+
// whole inside the view, is not a repeat of one just placed, and
|
|
144
|
+
// overlaps nothing placed before it.
|
|
145
|
+
const grid = this._grid;
|
|
146
|
+
grid.reset();
|
|
147
|
+
const placedAt = new Map();
|
|
148
|
+
const winners = [];
|
|
149
|
+
const inset = EDGE * scale;
|
|
150
|
+
for (const c of candidates) {
|
|
151
|
+
const repeatAt = placedAt.get(c.key);
|
|
152
|
+
if (repeatAt) {
|
|
153
|
+
const limit = c.repeat * c.repeat;
|
|
154
|
+
let near = false;
|
|
155
|
+
for (let r = 0; r < repeatAt.length; r += 2) {
|
|
156
|
+
const dx = repeatAt[r] - c.sx;
|
|
157
|
+
const dy = repeatAt[r + 1] - c.sy;
|
|
158
|
+
if (dx * dx + dy * dy < limit) {
|
|
159
|
+
near = true;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (near)
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const box = atlas.measure(c.text, c.size);
|
|
167
|
+
if (!box || box.width === 0)
|
|
168
|
+
continue;
|
|
169
|
+
let w = box.width;
|
|
170
|
+
let h = box.height;
|
|
171
|
+
if (!c.point) {
|
|
172
|
+
const need = w / 2 + h * LINE_MARGIN;
|
|
173
|
+
if (c.avail < (c.shown ? need * 0.9 : need))
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
// An icon on the point and the name beside it are one box, placed
|
|
177
|
+
// and given way as one.
|
|
178
|
+
const icon = this._icon(layers[c.layer], c.point, atlas);
|
|
179
|
+
if (icon) {
|
|
180
|
+
const full = icon.size + icon.gap + w;
|
|
181
|
+
c.ox = (full - icon.size) / 2;
|
|
182
|
+
w = full;
|
|
183
|
+
h = Math.max(h, icon.size);
|
|
184
|
+
}
|
|
185
|
+
const bx = c.sx + c.ox;
|
|
186
|
+
const hw = (Math.abs(c.cos) * w + Math.abs(c.sin) * h) / 2;
|
|
187
|
+
const hh = (Math.abs(c.sin) * w + Math.abs(c.cos) * h) / 2;
|
|
188
|
+
if (bx - hw < inset ||
|
|
189
|
+
c.sy - hh < inset ||
|
|
190
|
+
bx + hw > width - inset ||
|
|
191
|
+
c.sy + hh > height - inset) {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const testPad = (PADDING / 2 + (c.shown ? 0 : NEW_PADDING)) * scale;
|
|
195
|
+
if (grid.hits(c, w, h, testPad))
|
|
196
|
+
continue;
|
|
197
|
+
grid.insert(c, w, h, (PADDING / 2) * scale);
|
|
198
|
+
winners.push({ c, width: w, height: h });
|
|
199
|
+
if (repeatAt)
|
|
200
|
+
repeatAt.push(c.sx, c.sy);
|
|
201
|
+
else
|
|
202
|
+
placedAt.set(c.key, [c.sx, c.sy]);
|
|
203
|
+
}
|
|
204
|
+
// What won becomes what is shown: the label it already was, one of the
|
|
205
|
+
// same name close by that is fading out, or a new one.
|
|
206
|
+
for (const shown of this._shown)
|
|
207
|
+
shown.placed = false;
|
|
208
|
+
for (const { c, height } of winners) {
|
|
209
|
+
let shown = c.shown;
|
|
210
|
+
if (!shown) {
|
|
211
|
+
const reach = MATCH * height;
|
|
212
|
+
for (const other of byKey.get(c.key) ?? []) {
|
|
213
|
+
if (other.placed)
|
|
214
|
+
continue;
|
|
215
|
+
let dx = other.mx - c.mx;
|
|
216
|
+
dx -= Math.round(dx);
|
|
217
|
+
const dist = Math.hypot(dx, other.my - c.my) * frame.world;
|
|
218
|
+
if (dist <= reach) {
|
|
219
|
+
shown = other;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!shown || shown.opacity <= 0) {
|
|
224
|
+
// A label nobody can see moves to the anchor that won; one that
|
|
225
|
+
// can be seen keeps its ground and is judged there next pass.
|
|
226
|
+
const fresh = shown ??
|
|
227
|
+
{
|
|
228
|
+
key: c.key,
|
|
229
|
+
text: c.text,
|
|
230
|
+
layer: c.layer,
|
|
231
|
+
size: c.size,
|
|
232
|
+
opacity: 0,
|
|
233
|
+
placed: false,
|
|
234
|
+
};
|
|
235
|
+
fresh.mx = c.mx;
|
|
236
|
+
fresh.my = c.my;
|
|
237
|
+
fresh.angle = c.angle;
|
|
238
|
+
fresh.point = c.point;
|
|
239
|
+
fresh.avail = c.rawAvail * c.toMercator;
|
|
240
|
+
fresh.clear = c.rawClear * c.toMercator;
|
|
241
|
+
fresh.length = c.rawLength * c.toMercator;
|
|
242
|
+
fresh.dev = c.rawDev * c.toMercator;
|
|
243
|
+
fresh.priority = c.priority;
|
|
244
|
+
shown = fresh;
|
|
245
|
+
this._shown.add(shown);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
shown.placed = true;
|
|
249
|
+
shown.size = c.size;
|
|
250
|
+
atlas.entry(shown.text);
|
|
251
|
+
const icon = this._icon(layers[shown.layer], shown.point, atlas);
|
|
252
|
+
if (icon) {
|
|
253
|
+
atlas.icon(icon.name, 'plate');
|
|
254
|
+
atlas.icon(icon.name, 'glyph');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
this.stats = {
|
|
258
|
+
candidates: candidates.length,
|
|
259
|
+
placed: winners.length,
|
|
260
|
+
drawn: this.stats.drawn,
|
|
261
|
+
ms: now() - started,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The frame's instances: every shown label at its ground's place on
|
|
266
|
+
* screen, faded by where it is in its fade. Advances the fades, and lets
|
|
267
|
+
* go of labels that have faded out.
|
|
268
|
+
*/
|
|
269
|
+
batch(frame, atlas) {
|
|
270
|
+
const dt = this._last === null ? 0 : Math.max(0, frame.now - this._last);
|
|
271
|
+
this._last = frame.now;
|
|
272
|
+
const step = dt / FADE_MS;
|
|
273
|
+
const layers = this._layersAt(frame.style, frame.zoom, frame.scale);
|
|
274
|
+
// How far past its glyphs a field sees, in its own texels: the widest
|
|
275
|
+
// halo it can draw, times the label's scale.
|
|
276
|
+
const reach = fieldReach(atlas.pad);
|
|
277
|
+
const halfW = frame.width / 2;
|
|
278
|
+
const halfH = frame.height / 2;
|
|
279
|
+
let count = 0;
|
|
280
|
+
let labels = 0;
|
|
281
|
+
for (const shown of [...this._shown]) {
|
|
282
|
+
const layer = layers[shown.layer];
|
|
283
|
+
// One field for every size: a zoom ramp that grows the type draws the
|
|
284
|
+
// same raster larger, the frame it changes.
|
|
285
|
+
const entry = atlas.entry(shown.text);
|
|
286
|
+
// A name set beside an icon waits for the icon as well: the name
|
|
287
|
+
// alone is what the icon is there to explain.
|
|
288
|
+
const icon = this._icon(layer, shown.point, atlas);
|
|
289
|
+
const plate = icon ? atlas.icon(icon.name, 'plate') : null;
|
|
290
|
+
const glyph = icon ? atlas.icon(icon.name, 'glyph') : null;
|
|
291
|
+
const ready = entry !== null && (!icon || (plate !== null && glyph !== null));
|
|
292
|
+
// Nothing to show yet: wait at zero rather than fade in unseen.
|
|
293
|
+
if (ready && layer) {
|
|
294
|
+
shown.opacity = shown.placed
|
|
295
|
+
? Math.min(1, shown.opacity + step)
|
|
296
|
+
: Math.max(0, shown.opacity - step);
|
|
297
|
+
}
|
|
298
|
+
else if (!shown.placed || !layer) {
|
|
299
|
+
shown.opacity = 0;
|
|
300
|
+
}
|
|
301
|
+
if (!shown.placed && shown.opacity <= 0) {
|
|
302
|
+
this._shown.delete(shown);
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
if (!ready || !entry || !layer || shown.opacity <= 0)
|
|
306
|
+
continue;
|
|
307
|
+
let dx = shown.mx - frame.centerX;
|
|
308
|
+
dx -= Math.round(dx);
|
|
309
|
+
const sx = halfW + dx * frame.world;
|
|
310
|
+
const sy = halfH + (shown.my - frame.centerY) * frame.world;
|
|
311
|
+
const eased = shown.opacity * shown.opacity * (3 - 2 * shown.opacity);
|
|
312
|
+
const ink = premultiplied(layer.ink, eased);
|
|
313
|
+
const halo = layer.halo ? premultiplied(layer.halo, eased) : ZERO;
|
|
314
|
+
const k = shown.size / atlas.base;
|
|
315
|
+
const haloPx = layer.halo ? Math.min(layer.haloPx, reach * k) : 0;
|
|
316
|
+
if (icon && plate && glyph) {
|
|
317
|
+
// The plate under its halo, the glyph on it, and the name level
|
|
318
|
+
// beside it: the string is its field less the margin, and its
|
|
319
|
+
// left edge goes the gap past the plate's right.
|
|
320
|
+
const ki = icon.size / atlas.base;
|
|
321
|
+
const plateHalo = layer.halo ? Math.min(layer.haloPx, reach * ki) : 0;
|
|
322
|
+
count = this._put(count, sx, sy, 0, plate, premultiplied(icon.plate, eased), halo, plateHalo, ki);
|
|
323
|
+
count = this._put(count, sx, sy, 0, glyph, premultiplied(icon.glyph, eased), ZERO, 0, ki);
|
|
324
|
+
const tx = sx +
|
|
325
|
+
icon.size / 2 +
|
|
326
|
+
icon.gap +
|
|
327
|
+
((entry.width - 2 * atlas.pad) * k) / 2;
|
|
328
|
+
count = this._put(count, tx, sy, 0, entry, ink, halo, haloPx, k);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
count = this._put(count, sx, sy, shown.angle, entry, ink, halo, haloPx, k);
|
|
332
|
+
}
|
|
333
|
+
labels++;
|
|
334
|
+
}
|
|
335
|
+
this.stats.drawn = labels;
|
|
336
|
+
return { atlas, instances: this._instances, count, labels };
|
|
337
|
+
}
|
|
338
|
+
/** One instance — a label's string, or a piece of its icon — written at
|
|
339
|
+
* `count`: answers the count after it. Level (`angle` 0) is set on
|
|
340
|
+
* whole pixels. */
|
|
341
|
+
_put(count, x, y, angle, entry, ink, halo, haloPx, scale) {
|
|
342
|
+
if (this._instances.length < (count + 1) * LABEL_INSTANCE) {
|
|
343
|
+
const grown = new Float32Array(this._instances.length * 2);
|
|
344
|
+
grown.set(this._instances);
|
|
345
|
+
this._instances = grown;
|
|
346
|
+
}
|
|
347
|
+
const d = this._instances;
|
|
348
|
+
const at = count * LABEL_INSTANCE;
|
|
349
|
+
const level = angle === 0;
|
|
350
|
+
d[at] = x;
|
|
351
|
+
d[at + 1] = y;
|
|
352
|
+
d[at + 2] = level ? 1 : Math.cos(angle);
|
|
353
|
+
d[at + 3] = level ? 0 : Math.sin(angle);
|
|
354
|
+
d[at + 4] = entry.x;
|
|
355
|
+
d[at + 5] = entry.y;
|
|
356
|
+
d[at + 6] = entry.width;
|
|
357
|
+
d[at + 7] = entry.height;
|
|
358
|
+
d[at + 8] = ink[0];
|
|
359
|
+
d[at + 9] = ink[1];
|
|
360
|
+
d[at + 10] = ink[2];
|
|
361
|
+
d[at + 11] = ink[3];
|
|
362
|
+
d[at + 12] = halo[0];
|
|
363
|
+
d[at + 13] = halo[1];
|
|
364
|
+
d[at + 14] = halo[2];
|
|
365
|
+
d[at + 15] = halo[3];
|
|
366
|
+
d[at + 16] = haloPx;
|
|
367
|
+
d[at + 17] = level ? 1 : 0;
|
|
368
|
+
d[at + 18] = scale;
|
|
369
|
+
return count + 1;
|
|
370
|
+
}
|
|
371
|
+
// --- internals -------------------------------------------------------------
|
|
372
|
+
/** One anchor as a contender, or null when it cannot be one at all at
|
|
373
|
+
* this zoom — off the view, or on a run too bent or too short for even
|
|
374
|
+
* a short name. `unit` is device pixels per unit of the lengths given. */
|
|
375
|
+
_candidate(key, text, index, layer, priority, point, sx, sy, angle, avail, clear, length, dev, unit, frame) {
|
|
376
|
+
if (sx < 0 || sy < 0 || sx >= frame.width || sy >= frame.height)
|
|
377
|
+
return null;
|
|
378
|
+
const size = layer.size;
|
|
379
|
+
let ems = this._ems.get(text);
|
|
380
|
+
if (ems === undefined) {
|
|
381
|
+
if (this._ems.size > 20000)
|
|
382
|
+
this._ems.clear();
|
|
383
|
+
ems = estimateWidth(text, 1);
|
|
384
|
+
this._ems.set(text, ems);
|
|
385
|
+
}
|
|
386
|
+
const estimate = ems * size;
|
|
387
|
+
if (!point) {
|
|
388
|
+
if (dev * unit > size * STRAIGHT_FRACTION)
|
|
389
|
+
return null;
|
|
390
|
+
// Well short of even an under-estimate of the name: no need to
|
|
391
|
+
// measure it to know.
|
|
392
|
+
if (avail * unit < estimate * 0.35)
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
const level = point || Math.abs(angle) < LEVEL_SNAP;
|
|
396
|
+
const a = level ? 0 : angle;
|
|
397
|
+
const clearPx = clear * unit;
|
|
398
|
+
const mx = frame.centerX + (sx - frame.width / 2) / frame.world;
|
|
399
|
+
const my = frame.centerY + (sy - frame.height / 2) / frame.world;
|
|
400
|
+
const cx = sx - frame.width / 2;
|
|
401
|
+
const cy = sy - frame.height / 2;
|
|
402
|
+
return {
|
|
403
|
+
key,
|
|
404
|
+
text,
|
|
405
|
+
layer: index,
|
|
406
|
+
rank: layer.rank,
|
|
407
|
+
priority,
|
|
408
|
+
size,
|
|
409
|
+
point,
|
|
410
|
+
sx,
|
|
411
|
+
sy,
|
|
412
|
+
ox: 0,
|
|
413
|
+
angle: a,
|
|
414
|
+
cos: Math.cos(a),
|
|
415
|
+
sin: Math.sin(a),
|
|
416
|
+
avail: point ? Infinity : avail * unit,
|
|
417
|
+
clear: clearPx,
|
|
418
|
+
length: length * unit,
|
|
419
|
+
toMercator: unit / frame.world,
|
|
420
|
+
rawAvail: avail,
|
|
421
|
+
rawClear: clear,
|
|
422
|
+
rawLength: length,
|
|
423
|
+
rawDev: dev,
|
|
424
|
+
mx,
|
|
425
|
+
my,
|
|
426
|
+
shown: null,
|
|
427
|
+
clean: point || clearPx >= estimate / 2 ? 1 : 0,
|
|
428
|
+
centre: cx * cx + cy * cy,
|
|
429
|
+
repeat: layer.repeat,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/** The icon a label of `layer` is set with: none for a name along a
|
|
433
|
+
* street, and none where the atlas cannot draw it — the name is then set
|
|
434
|
+
* alone rather than not at all. */
|
|
435
|
+
_icon(layer, point, atlas) {
|
|
436
|
+
const icon = point ? (layer?.icon ?? null) : null;
|
|
437
|
+
return icon && !atlas.iconFailed(icon.name) ? icon : null;
|
|
438
|
+
}
|
|
439
|
+
/** Each symbol layer's labelling at this zoom, by layer index — null
|
|
440
|
+
* where it does not label. */
|
|
441
|
+
_layersAt(style, zoom, scale) {
|
|
442
|
+
return style.layers.map(({ layer }) => {
|
|
443
|
+
if (layer.type !== 'symbol' || layer.visible === false)
|
|
444
|
+
return null;
|
|
445
|
+
if (layer.minZoom !== undefined && zoom < layer.minZoom)
|
|
446
|
+
return null;
|
|
447
|
+
if (layer.maxZoom !== undefined && zoom >= layer.maxZoom)
|
|
448
|
+
return null;
|
|
449
|
+
const symbol = layer;
|
|
450
|
+
const ink = this._color(symbol.textColor ? resolveZoomed(symbol.textColor, zoom) : '#000000');
|
|
451
|
+
if (!ink)
|
|
452
|
+
return null;
|
|
453
|
+
const halo = symbol.textHaloColor
|
|
454
|
+
? this._color(resolveZoomed(symbol.textHaloColor, zoom))
|
|
455
|
+
: null;
|
|
456
|
+
const haloWidth = symbol.textHaloWidth === undefined
|
|
457
|
+
? 1
|
|
458
|
+
: resolveZoomed(symbol.textHaloWidth, zoom);
|
|
459
|
+
// Not rounded: a field draws any size, so a ramp grows the type
|
|
460
|
+
// continuously rather than a whole pixel at a time.
|
|
461
|
+
const size = Math.max(1, (symbol.textSize === undefined
|
|
462
|
+
? 12
|
|
463
|
+
: resolveZoomed(symbol.textSize, zoom)) * scale);
|
|
464
|
+
return {
|
|
465
|
+
id: layer.id,
|
|
466
|
+
rank: symbol.rank ?? 0,
|
|
467
|
+
size,
|
|
468
|
+
repeat: (symbol.repeatDistance ?? 250) * scale,
|
|
469
|
+
ink,
|
|
470
|
+
halo: halo && haloWidth > 0 ? halo : null,
|
|
471
|
+
haloPx: haloWidth * scale,
|
|
472
|
+
icon: this._iconOf(symbol, zoom, scale),
|
|
473
|
+
};
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
/** A layer's icon at this zoom, or null where it sets none — or names
|
|
477
|
+
* one this version does not draw, or a colour that does not parse. */
|
|
478
|
+
_iconOf(symbol, zoom, scale) {
|
|
479
|
+
if (!isMapIcon(symbol.icon))
|
|
480
|
+
return null;
|
|
481
|
+
const plate = this._color(symbol.iconColor
|
|
482
|
+
? resolveZoomed(symbol.iconColor, zoom)
|
|
483
|
+
: DEFAULT_ICON_COLOR);
|
|
484
|
+
const glyph = this._color(symbol.iconGlyphColor
|
|
485
|
+
? resolveZoomed(symbol.iconGlyphColor, zoom)
|
|
486
|
+
: DEFAULT_ICON_GLYPH_COLOR);
|
|
487
|
+
if (!plate || !glyph)
|
|
488
|
+
return null;
|
|
489
|
+
const size = symbol.iconSize === undefined
|
|
490
|
+
? DEFAULT_ICON_SIZE
|
|
491
|
+
: resolveZoomed(symbol.iconSize, zoom);
|
|
492
|
+
return {
|
|
493
|
+
name: symbol.icon,
|
|
494
|
+
size: Math.max(1, Math.round(size * scale)),
|
|
495
|
+
gap: ICON_GAP * scale,
|
|
496
|
+
plate,
|
|
497
|
+
glyph,
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
_color(value) {
|
|
501
|
+
let color = this._colors.get(value);
|
|
502
|
+
if (color === undefined) {
|
|
503
|
+
color = parseColor(value);
|
|
504
|
+
this._colors.set(value, color);
|
|
505
|
+
}
|
|
506
|
+
return color;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
const ZERO = [0, 0, 0, 0];
|
|
510
|
+
/** Every name a tile's label layers carry, made once per tile. */
|
|
511
|
+
const texts = new WeakMap();
|
|
512
|
+
function textsOf(data) {
|
|
513
|
+
let set = texts.get(data);
|
|
514
|
+
if (!set) {
|
|
515
|
+
set = new Set(data.texts);
|
|
516
|
+
texts.set(data, set);
|
|
517
|
+
}
|
|
518
|
+
return set;
|
|
519
|
+
}
|
|
520
|
+
function compare(a, b) {
|
|
521
|
+
return (b.rank - a.rank ||
|
|
522
|
+
b.priority - a.priority ||
|
|
523
|
+
(b.shown ? 1 : 0) - (a.shown ? 1 : 0) ||
|
|
524
|
+
b.clean - a.clean ||
|
|
525
|
+
b.length - a.length ||
|
|
526
|
+
a.centre - b.centre ||
|
|
527
|
+
(a.key < b.key ? -1 : a.key > b.key ? 1 : 0) ||
|
|
528
|
+
a.sx - b.sx ||
|
|
529
|
+
a.sy - b.sy);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Collision shapes over a grid of cells. A level label is its box; a
|
|
533
|
+
* rotated one is a chain of circles along its baseline, each as tall as
|
|
534
|
+
* the text — which follows a slanted name closely where its box would
|
|
535
|
+
* claim the whole corner-to-corner rectangle around it.
|
|
536
|
+
*/
|
|
537
|
+
class CollisionGrid {
|
|
538
|
+
/** Five numbers per shape: kind (0 box, 1 circle), then x0, y0, x1, y1
|
|
539
|
+
* or cx, cy, r, 0. */
|
|
540
|
+
_shapes = [];
|
|
541
|
+
_cells = new Map();
|
|
542
|
+
_scratch = [];
|
|
543
|
+
reset() {
|
|
544
|
+
this._shapes.length = 0;
|
|
545
|
+
this._cells.clear();
|
|
546
|
+
}
|
|
547
|
+
hits(c, w, h, pad) {
|
|
548
|
+
const shapes = this._shapesOf(c, w, h, pad);
|
|
549
|
+
for (let s = 0; s < shapes.length; s += 5) {
|
|
550
|
+
const [x0, y0, x1, y1] = bounds(shapes, s);
|
|
551
|
+
for (let gx = cell(x0); gx <= cell(x1); gx++) {
|
|
552
|
+
for (let gy = cell(y0); gy <= cell(y1); gy++) {
|
|
553
|
+
const list = this._cells.get(cellKey(gx, gy));
|
|
554
|
+
if (!list)
|
|
555
|
+
continue;
|
|
556
|
+
for (const other of list) {
|
|
557
|
+
if (overlaps(shapes, s, this._shapes, other))
|
|
558
|
+
return true;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
insert(c, w, h, pad) {
|
|
566
|
+
const shapes = this._shapesOf(c, w, h, pad);
|
|
567
|
+
for (let s = 0; s < shapes.length; s += 5) {
|
|
568
|
+
const index = this._shapes.length;
|
|
569
|
+
for (let k = 0; k < 5; k++)
|
|
570
|
+
this._shapes.push(shapes[s + k]);
|
|
571
|
+
const [x0, y0, x1, y1] = bounds(shapes, s);
|
|
572
|
+
for (let gx = cell(x0); gx <= cell(x1); gx++) {
|
|
573
|
+
for (let gy = cell(y0); gy <= cell(y1); gy++) {
|
|
574
|
+
const key = cellKey(gx, gy);
|
|
575
|
+
const list = this._cells.get(key);
|
|
576
|
+
if (list)
|
|
577
|
+
list.push(index);
|
|
578
|
+
else
|
|
579
|
+
this._cells.set(key, [index]);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
_shapesOf(c, w, h, pad) {
|
|
585
|
+
const out = this._scratch;
|
|
586
|
+
out.length = 0;
|
|
587
|
+
if (c.angle === 0) {
|
|
588
|
+
const x = c.sx + c.ox;
|
|
589
|
+
out.push(0, x - w / 2 - pad, c.sy - h / 2 - pad, x + w / 2 + pad, c.sy + h / 2 + pad);
|
|
590
|
+
return out;
|
|
591
|
+
}
|
|
592
|
+
const r = h / 2 + pad;
|
|
593
|
+
const span = Math.max(0, w - h);
|
|
594
|
+
const n = span > 0 ? Math.ceil(span / r) + 1 : 1;
|
|
595
|
+
for (let i = 0; i < n; i++) {
|
|
596
|
+
const t = n === 1 ? 0 : -span / 2 + (span * i) / (n - 1);
|
|
597
|
+
out.push(1, c.sx + c.cos * t, c.sy + c.sin * t, r, 0);
|
|
598
|
+
}
|
|
599
|
+
return out;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
function bounds(shapes, s) {
|
|
603
|
+
if (shapes[s] === 0)
|
|
604
|
+
return [shapes[s + 1], shapes[s + 2], shapes[s + 3], shapes[s + 4]];
|
|
605
|
+
const r = shapes[s + 3];
|
|
606
|
+
return [
|
|
607
|
+
shapes[s + 1] - r,
|
|
608
|
+
shapes[s + 2] - r,
|
|
609
|
+
shapes[s + 1] + r,
|
|
610
|
+
shapes[s + 2] + r,
|
|
611
|
+
];
|
|
612
|
+
}
|
|
613
|
+
function overlaps(a, i, b, j) {
|
|
614
|
+
const ka = a[i];
|
|
615
|
+
const kb = b[j];
|
|
616
|
+
if (ka === 0 && kb === 0) {
|
|
617
|
+
return (a[i + 1] < b[j + 3] &&
|
|
618
|
+
a[i + 3] > b[j + 1] &&
|
|
619
|
+
a[i + 2] < b[j + 4] &&
|
|
620
|
+
a[i + 4] > b[j + 2]);
|
|
621
|
+
}
|
|
622
|
+
if (ka === 1 && kb === 1) {
|
|
623
|
+
const dx = a[i + 1] - b[j + 1];
|
|
624
|
+
const dy = a[i + 2] - b[j + 2];
|
|
625
|
+
const r = a[i + 3] + b[j + 3];
|
|
626
|
+
return dx * dx + dy * dy < r * r;
|
|
627
|
+
}
|
|
628
|
+
const [box, bi, circle, ci] = ka === 0 ? [a, i, b, j] : [b, j, a, i];
|
|
629
|
+
const cx = circle[ci + 1];
|
|
630
|
+
const cy = circle[ci + 2];
|
|
631
|
+
const r = circle[ci + 3];
|
|
632
|
+
const nx = Math.max(box[bi + 1], Math.min(cx, box[bi + 3]));
|
|
633
|
+
const ny = Math.max(box[bi + 2], Math.min(cy, box[bi + 4]));
|
|
634
|
+
const dx = cx - nx;
|
|
635
|
+
const dy = cy - ny;
|
|
636
|
+
return dx * dx + dy * dy < r * r;
|
|
637
|
+
}
|
|
638
|
+
const cell = (v) => Math.floor(v / CELL);
|
|
639
|
+
const cellKey = (gx, gy) => (gx + 4096) * 16384 + (gy + 4096);
|
|
640
|
+
const globals = globalThis;
|
|
641
|
+
const now = () => globals.performance?.now() ?? Date.now();
|
|
642
|
+
//# sourceMappingURL=placement.js.map
|