@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,344 @@
|
|
|
1
|
+
// `calc()`, `min()`, `max()` and `clamp()` (CSS Values 4 10), read down to
|
|
2
|
+
// what a length here can hold: device pixels, or a percentage of what
|
|
3
|
+
// layout knows with pixels added (`Pct.px`) — every `calc()` that adds and
|
|
4
|
+
// scales, which is what documents write: `calc(100% - 2em)`. A comparison
|
|
5
|
+
// with a percentage in it, `min(100%, 600px)`, is a different sum at every
|
|
6
|
+
// width, and is kept as one (`Pct.of`) for layout to resolve; sums and
|
|
7
|
+
// scales distribute into it, so `calc(min(100%, 600px) - 2rem)` is
|
|
8
|
+
// `min(100% - 2rem, 600px - 2rem)`.
|
|
9
|
+
/**
|
|
10
|
+
* A math function's value as a length, or null where it is none — a
|
|
11
|
+
* number, a type that does not add up, a division by zero. `dimension`
|
|
12
|
+
* reads one `10px` or `2em` as this package's lengths do.
|
|
13
|
+
*/
|
|
14
|
+
export function parseMath(value, dimension) {
|
|
15
|
+
const term = parseTerm(value, dimension);
|
|
16
|
+
if (!term || !isLength(term))
|
|
17
|
+
return null;
|
|
18
|
+
return toLen(term);
|
|
19
|
+
}
|
|
20
|
+
/** A math function's value as a number (`calc(1 + 0.5)`), or null. */
|
|
21
|
+
export function parseMathNumber(value) {
|
|
22
|
+
const term = parseTerm(value, () => null);
|
|
23
|
+
if (!term || term.kind !== 'linear' || term.length)
|
|
24
|
+
return null;
|
|
25
|
+
return censor(term.px);
|
|
26
|
+
}
|
|
27
|
+
function parseTerm(value, dimension) {
|
|
28
|
+
const tokens = tokenize(value);
|
|
29
|
+
if (!tokens)
|
|
30
|
+
return null;
|
|
31
|
+
const parser = new Parser(tokens, dimension);
|
|
32
|
+
const term = parser.value();
|
|
33
|
+
return term && parser.pos === tokens.length ? term : null;
|
|
34
|
+
}
|
|
35
|
+
function isLength(term) {
|
|
36
|
+
return term.kind === 'linear' ? term.length : true;
|
|
37
|
+
}
|
|
38
|
+
function toLen(term) {
|
|
39
|
+
if (term.kind === 'compare') {
|
|
40
|
+
const args = [];
|
|
41
|
+
for (const arg of term.args) {
|
|
42
|
+
const len = toLen(arg);
|
|
43
|
+
if (len === null)
|
|
44
|
+
return null;
|
|
45
|
+
args.push(len);
|
|
46
|
+
}
|
|
47
|
+
return { pct: 0, of: { max: term.max, args } };
|
|
48
|
+
}
|
|
49
|
+
if (!term.hasPct)
|
|
50
|
+
return censor(term.px);
|
|
51
|
+
return { pct: censor(term.pct), px: censor(term.px) };
|
|
52
|
+
}
|
|
53
|
+
const NUMBER = /^[+-]?(?:\d*\.\d+|\d+)(?:e[+-]?\d+)?/;
|
|
54
|
+
const CONSTANT = /^(?:-?infinity|nan|pi|e)(?![a-z0-9_(-])/;
|
|
55
|
+
const CONSTANTS = {
|
|
56
|
+
infinity: Infinity,
|
|
57
|
+
'-infinity': -Infinity,
|
|
58
|
+
nan: NaN,
|
|
59
|
+
pi: Math.PI,
|
|
60
|
+
e: Math.E,
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* What a calculation that is no finite number comes to (CSS Values 4,
|
|
64
|
+
* 10.9): NaN is 0, and an infinity the largest length there is — which,
|
|
65
|
+
* as in a browser, is still a length: a radius of it is a pill.
|
|
66
|
+
*/
|
|
67
|
+
function censor(n) {
|
|
68
|
+
if (Number.isNaN(n))
|
|
69
|
+
return 0;
|
|
70
|
+
if (n === Infinity)
|
|
71
|
+
return LARGEST;
|
|
72
|
+
if (n === -Infinity)
|
|
73
|
+
return -LARGEST;
|
|
74
|
+
return n;
|
|
75
|
+
}
|
|
76
|
+
/** The largest length a browser holds, 2^25 pixels less a little: what a
|
|
77
|
+
* calculation's infinity comes to, and what any length is kept within
|
|
78
|
+
* (`parseLength`, `resolve`). */
|
|
79
|
+
export const LARGEST = 33554428;
|
|
80
|
+
function tokenize(text) {
|
|
81
|
+
const out = [];
|
|
82
|
+
let i = 0;
|
|
83
|
+
while (i < text.length) {
|
|
84
|
+
const c = text[i];
|
|
85
|
+
if (c === ' ' || c === '\t' || c === '\n' || c === '\r' || c === '\f') {
|
|
86
|
+
while (i < text.length && /[ \t\n\r\f]/.test(text[i]))
|
|
87
|
+
i += 1;
|
|
88
|
+
if (out.length && out[out.length - 1].t !== 'space') {
|
|
89
|
+
out.push({ t: 'space' });
|
|
90
|
+
}
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (c === '(') {
|
|
94
|
+
out.push({ t: 'open', fn: '' });
|
|
95
|
+
i += 1;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (c === ')' || c === ',') {
|
|
99
|
+
if (out.length && out[out.length - 1].t === 'space')
|
|
100
|
+
out.pop();
|
|
101
|
+
out.push(c === ')' ? { t: 'close' } : { t: 'comma' });
|
|
102
|
+
i += 1;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (c === '*' || c === '/') {
|
|
106
|
+
out.push({ t: 'op', value: c });
|
|
107
|
+
i += 1;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
// a sign belongs to the number after it, as the tokenizer reads it:
|
|
111
|
+
// `1px -2px` is two values, and `1px - 2px` a difference
|
|
112
|
+
const m = NUMBER.exec(text.slice(i));
|
|
113
|
+
if (m) {
|
|
114
|
+
i += m[0].length;
|
|
115
|
+
const unit = /^(?:%|[a-z]+)/.exec(text.slice(i))?.[0] ?? '';
|
|
116
|
+
i += unit.length;
|
|
117
|
+
out.push({ t: 'num', value: Number(m[0]), unit });
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const name = /^-?[a-z][a-z0-9-]*\(/.exec(text.slice(i))?.[0];
|
|
121
|
+
if (name) {
|
|
122
|
+
out.push({ t: 'open', fn: name.slice(0, -1) });
|
|
123
|
+
i += name.length;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
// the numbers CSS Values 4 names (10.7.1): Tailwind 4 writes a pill's
|
|
127
|
+
// radius as `calc(infinity * 1px)`
|
|
128
|
+
const constant = CONSTANT.exec(text.slice(i))?.[0];
|
|
129
|
+
if (constant) {
|
|
130
|
+
out.push({ t: 'num', value: CONSTANTS[constant], unit: '' });
|
|
131
|
+
i += constant.length;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (c === '+' || c === '-') {
|
|
135
|
+
out.push({ t: 'op', value: c });
|
|
136
|
+
i += 1;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
class Parser {
|
|
144
|
+
tokens;
|
|
145
|
+
dimension;
|
|
146
|
+
pos = 0;
|
|
147
|
+
constructor(tokens, dimension) {
|
|
148
|
+
this.tokens = tokens;
|
|
149
|
+
this.dimension = dimension;
|
|
150
|
+
}
|
|
151
|
+
peek() {
|
|
152
|
+
return this.tokens[this.pos];
|
|
153
|
+
}
|
|
154
|
+
skipSpace() {
|
|
155
|
+
if (this.peek()?.t === 'space')
|
|
156
|
+
this.pos += 1;
|
|
157
|
+
}
|
|
158
|
+
/** A whole math function, `calc(…)` and the rest. */
|
|
159
|
+
value() {
|
|
160
|
+
this.skipSpace();
|
|
161
|
+
const open = this.peek();
|
|
162
|
+
if (open?.t !== 'open' || !open.fn)
|
|
163
|
+
return null;
|
|
164
|
+
const term = this.fn();
|
|
165
|
+
this.skipSpace();
|
|
166
|
+
return term;
|
|
167
|
+
}
|
|
168
|
+
fn() {
|
|
169
|
+
const open = this.tokens[this.pos];
|
|
170
|
+
this.pos += 1;
|
|
171
|
+
const fn = open.fn.replace(/^-webkit-/, '');
|
|
172
|
+
const args = [];
|
|
173
|
+
for (;;) {
|
|
174
|
+
const sum = this.sum();
|
|
175
|
+
if (!sum)
|
|
176
|
+
return null;
|
|
177
|
+
args.push(sum);
|
|
178
|
+
const next = this.peek();
|
|
179
|
+
if (next?.t === 'comma') {
|
|
180
|
+
this.pos += 1;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (next?.t !== 'close')
|
|
184
|
+
return null;
|
|
185
|
+
this.pos += 1;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
switch (fn) {
|
|
189
|
+
case '':
|
|
190
|
+
case 'calc':
|
|
191
|
+
return args.length === 1 ? args[0] : null;
|
|
192
|
+
case 'min':
|
|
193
|
+
case 'max':
|
|
194
|
+
return compare(args, fn === 'max');
|
|
195
|
+
case 'clamp': {
|
|
196
|
+
if (args.length !== 3)
|
|
197
|
+
return null;
|
|
198
|
+
const upper = compare([args[1], args[2]], false);
|
|
199
|
+
return upper && compare([args[0], upper], true);
|
|
200
|
+
}
|
|
201
|
+
default:
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
sum() {
|
|
206
|
+
this.skipSpace();
|
|
207
|
+
let left = this.product();
|
|
208
|
+
if (!left)
|
|
209
|
+
return null;
|
|
210
|
+
for (;;) {
|
|
211
|
+
const at = this.pos;
|
|
212
|
+
// `+` and `-` need white space on both sides
|
|
213
|
+
if (this.peek()?.t !== 'space')
|
|
214
|
+
break;
|
|
215
|
+
this.pos += 1;
|
|
216
|
+
const op = this.peek();
|
|
217
|
+
if (op?.t !== 'op' || (op.value !== '+' && op.value !== '-')) {
|
|
218
|
+
this.pos = at;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
this.pos += 1;
|
|
222
|
+
if (this.peek()?.t !== 'space')
|
|
223
|
+
return null;
|
|
224
|
+
this.pos += 1;
|
|
225
|
+
const right = this.product();
|
|
226
|
+
if (!right)
|
|
227
|
+
return null;
|
|
228
|
+
left = add(left, right, op.value === '+' ? 1 : -1);
|
|
229
|
+
if (!left)
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
this.skipSpace();
|
|
233
|
+
return left;
|
|
234
|
+
}
|
|
235
|
+
product() {
|
|
236
|
+
let left = this.unit();
|
|
237
|
+
if (!left)
|
|
238
|
+
return null;
|
|
239
|
+
for (;;) {
|
|
240
|
+
const at = this.pos;
|
|
241
|
+
this.skipSpace();
|
|
242
|
+
const op = this.peek();
|
|
243
|
+
if (op?.t !== 'op' || (op.value !== '*' && op.value !== '/')) {
|
|
244
|
+
this.pos = at;
|
|
245
|
+
return left;
|
|
246
|
+
}
|
|
247
|
+
this.pos += 1;
|
|
248
|
+
this.skipSpace();
|
|
249
|
+
const right = this.unit();
|
|
250
|
+
if (!right)
|
|
251
|
+
return null;
|
|
252
|
+
if (op.value === '*') {
|
|
253
|
+
// one side a number, which scales the other
|
|
254
|
+
if (isNumber(left))
|
|
255
|
+
left = scale(right, left.px);
|
|
256
|
+
else if (isNumber(right))
|
|
257
|
+
left = scale(left, right.px);
|
|
258
|
+
else
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
if (!isNumber(right) || right.px === 0)
|
|
263
|
+
return null;
|
|
264
|
+
left = scale(left, 1 / right.px);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
unit() {
|
|
269
|
+
const token = this.peek();
|
|
270
|
+
if (!token)
|
|
271
|
+
return null;
|
|
272
|
+
if (token.t === 'open')
|
|
273
|
+
return this.fn();
|
|
274
|
+
if (token.t !== 'num')
|
|
275
|
+
return null;
|
|
276
|
+
this.pos += 1;
|
|
277
|
+
if (token.unit === '')
|
|
278
|
+
return linear(false, token.value, 0, false);
|
|
279
|
+
if (token.unit === '%')
|
|
280
|
+
return linear(true, 0, token.value, true);
|
|
281
|
+
const px = this.dimension(`${token.value}${token.unit}`);
|
|
282
|
+
return px === null ? null : linear(true, px, 0, false);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function linear(length, px, pct, hasPct) {
|
|
286
|
+
return { kind: 'linear', length, px, pct, hasPct };
|
|
287
|
+
}
|
|
288
|
+
function isNumber(term) {
|
|
289
|
+
return term.kind === 'linear' && !term.length;
|
|
290
|
+
}
|
|
291
|
+
/** `a + b`, or `a - b` for a sign of -1, distributed into a comparison. */
|
|
292
|
+
function add(a, b, sign) {
|
|
293
|
+
if (isLength(a) !== isLength(b))
|
|
294
|
+
return null;
|
|
295
|
+
if (a.kind === 'compare') {
|
|
296
|
+
const args = [];
|
|
297
|
+
for (const arg of a.args) {
|
|
298
|
+
const sum = add(arg, b, sign);
|
|
299
|
+
if (!sum)
|
|
300
|
+
return null;
|
|
301
|
+
args.push(sum);
|
|
302
|
+
}
|
|
303
|
+
return { kind: 'compare', max: a.max, args };
|
|
304
|
+
}
|
|
305
|
+
if (b.kind === 'compare') {
|
|
306
|
+
// `a - min(x, y)` is `max(a - x, a - y)`
|
|
307
|
+
const args = [];
|
|
308
|
+
for (const arg of b.args) {
|
|
309
|
+
const sum = add(a, arg, sign);
|
|
310
|
+
if (!sum)
|
|
311
|
+
return null;
|
|
312
|
+
args.push(sum);
|
|
313
|
+
}
|
|
314
|
+
return { kind: 'compare', max: sign === 1 ? b.max : !b.max, args };
|
|
315
|
+
}
|
|
316
|
+
return linear(a.length, a.px + sign * b.px, a.pct + sign * b.pct, a.hasPct || b.hasPct);
|
|
317
|
+
}
|
|
318
|
+
/** `term * k`, distributed into a comparison, which a negative `k` turns
|
|
319
|
+
* over. */
|
|
320
|
+
function scale(term, k) {
|
|
321
|
+
if (term.kind === 'compare') {
|
|
322
|
+
return {
|
|
323
|
+
kind: 'compare',
|
|
324
|
+
max: k < 0 ? !term.max : term.max,
|
|
325
|
+
args: term.args.map((arg) => scale(arg, k)),
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
// nought stays nought, so that an infinity scaling a length is not also
|
|
329
|
+
// a NaN of the percentage it has none of
|
|
330
|
+
return linear(term.length, term.px === 0 ? 0 : term.px * k, term.pct === 0 ? 0 : term.pct * k, term.hasPct);
|
|
331
|
+
}
|
|
332
|
+
/** `min()` or `max()` of terms of one type: a number where no percentage
|
|
333
|
+
* is among them, and a comparison for layout where one is. */
|
|
334
|
+
function compare(args, max) {
|
|
335
|
+
const length = isLength(args[0]);
|
|
336
|
+
if (args.some((a) => isLength(a) !== length))
|
|
337
|
+
return null;
|
|
338
|
+
if (args.every((a) => a.kind === 'linear' && !a.hasPct)) {
|
|
339
|
+
const values = args.map((a) => a.px);
|
|
340
|
+
return linear(length, max ? Math.max(...values) : Math.min(...values), 0, false);
|
|
341
|
+
}
|
|
342
|
+
return { kind: 'compare', max, args };
|
|
343
|
+
}
|
|
344
|
+
//# sourceMappingURL=calc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calc.js","sourceRoot":"","sources":["../../../src/html/css/calc.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,mEAAmE;AACnE,oCAAoC;AAgCpC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,KAAa,EACb,SAA2C;IAE3C,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAChE,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,SAAS,CAChB,KAAa,EACb,SAA2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 +1,46 @@
|
|
|
1
1
|
import type { Element } from 'domhandler';
|
|
2
2
|
import type { Stylesheet } from './parse.js';
|
|
3
3
|
import type { ComputedStyle, RootLook } from './style.js';
|
|
4
|
+
import type { FontFamilies } from '../fonts.js';
|
|
5
|
+
import { CounterStyles } from './counter-styles.js';
|
|
6
|
+
/** A style handed to every element with the same sharing key, and the key
|
|
7
|
+
* that element's children share under (`Cascade.sharedStyleFor`). */
|
|
8
|
+
export interface SharedStyle {
|
|
9
|
+
style: ComputedStyle;
|
|
10
|
+
key: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The compounds of a selector that test `:hover`, each without it (and
|
|
14
|
+
* without an `:active` beside it), and whether one is followed by a sibling
|
|
15
|
+
* combinator, which reaches the element's later siblings. `nested` where a
|
|
16
|
+
* `:hover` sits inside a functional pseudo-class — `:not(:hover)`,
|
|
17
|
+
* `:is(:hover)` — and reaches elements no compound names.
|
|
18
|
+
*
|
|
19
|
+
* A `:hover` in a compound's `:has()` is the one exception, since what it
|
|
20
|
+
* reaches is known: the compound, without its `:has()`, is an ancestor of
|
|
21
|
+
* the element the pointer is over — or an earlier sibling of it or of an
|
|
22
|
+
* ancestor, where the argument starts at a sibling (Selectors 4, 4.5). So
|
|
23
|
+
* it is given as an anchor (`has`) rather than making the rule `nested`.
|
|
24
|
+
*
|
|
25
|
+
* `:active` is not the pointer's here: nothing sets it (`setPointer` is
|
|
26
|
+
* handed none), so a selector that tests only it never changes as the
|
|
27
|
+
* pointer moves — Wikipedia's buttons' `:focus:not(:active)` among them.
|
|
28
|
+
* A press that sets it would have to be counted here too.
|
|
29
|
+
*/
|
|
30
|
+
export declare function pointerCompounds(selector: string): {
|
|
31
|
+
compounds: string[];
|
|
32
|
+
siblings: boolean;
|
|
33
|
+
nested: boolean;
|
|
34
|
+
has: {
|
|
35
|
+
anchor: string;
|
|
36
|
+
siblings: boolean;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
/** What `Cascade.firstLetterRules` found for an element. */
|
|
40
|
+
export interface FirstLetterRules {
|
|
41
|
+
readonly el: Element;
|
|
42
|
+
readonly candidates: readonly unknown[];
|
|
43
|
+
}
|
|
4
44
|
/** What the pointer is over, for `:hover`. A chain rather than one element,
|
|
5
45
|
* because `li:hover a` has to light up while the pointer is on the `li`. */
|
|
6
46
|
export interface PointerState {
|
|
@@ -13,7 +53,27 @@ export interface PointerState {
|
|
|
13
53
|
*/
|
|
14
54
|
export declare class Cascade {
|
|
15
55
|
private _index;
|
|
56
|
+
/** The rules for pseudo-elements, kept apart: they never style the
|
|
57
|
+
* element itself, and a document with none of them asks nothing. */
|
|
58
|
+
private _pseudo;
|
|
16
59
|
private _adapter;
|
|
60
|
+
/** The compounds of the selectors that test the pointer, each without
|
|
61
|
+
* its `:hover` or `:active` (`pointerCompounds`), and their matchers,
|
|
62
|
+
* compiled when a pointer move first asks (`hoverTouches`). */
|
|
63
|
+
private _hoverCompounds;
|
|
64
|
+
private _hoverMatchers;
|
|
65
|
+
/** Whether a pointer move can be restyled where it happened
|
|
66
|
+
* (`HtmlViewNode._hoverInPlace`): false where a selector tests the
|
|
67
|
+
* pointer inside a functional pseudo-class, which reaches elements no
|
|
68
|
+
* compound names. */
|
|
69
|
+
hoverLocal: boolean;
|
|
70
|
+
/** Whether a compound that tests the pointer is followed by a sibling
|
|
71
|
+
* combinator, so an element's later siblings restyle with it. */
|
|
72
|
+
hoverSiblings: boolean;
|
|
73
|
+
/** The compounds whose `:has()` tests the pointer, each without it, and
|
|
74
|
+
* whether its argument starts at a sibling (`hoverAnchors`). */
|
|
75
|
+
private _hoverAnchors;
|
|
76
|
+
private _anchorMatchers;
|
|
17
77
|
private _pointer;
|
|
18
78
|
readonly initial: ComputedStyle;
|
|
19
79
|
readonly look: RootLook;
|
|
@@ -27,20 +87,180 @@ export declare class Cascade {
|
|
|
27
87
|
/** Every width at which some `@media` rule changes its mind, in CSS
|
|
28
88
|
* pixels — the unit the author wrote them in. */
|
|
29
89
|
readonly breakpoints: number[];
|
|
30
|
-
|
|
90
|
+
/** The counter styles the sheets define, over the predefined ones. */
|
|
91
|
+
readonly counterStyles: CounterStyles;
|
|
92
|
+
/** A font's x-height at a size, for `ex`, where the fonts can say. */
|
|
93
|
+
private _xHeightOf;
|
|
94
|
+
private _xHeights;
|
|
95
|
+
/** The advance of a font's "0" at a size, for `ch`, likewise. */
|
|
96
|
+
private _zeroWidthOf;
|
|
97
|
+
private _zeroWidths;
|
|
98
|
+
/** A font's own line height at a size, for `lh` where `line-height` is
|
|
99
|
+
* `normal`, likewise. */
|
|
100
|
+
private _normalLineOf;
|
|
101
|
+
private _normalLines;
|
|
102
|
+
/** Whether any declaration sets a custom property or reads one: without
|
|
103
|
+
* one, no element's style asks about them. */
|
|
104
|
+
private _vars;
|
|
105
|
+
/** Whether any declaration is in a unit of the viewport's width — `vw`,
|
|
106
|
+
* `vmin`, `vmax` — or of its height, `vh` and the same two: a style
|
|
107
|
+
* holds such a length as a number, so it is computed again when that
|
|
108
|
+
* side of the viewport moves (`HtmlViewNode._update`). */
|
|
109
|
+
readsViewportWidth: boolean;
|
|
110
|
+
readsViewportHeight: boolean;
|
|
111
|
+
/** The families the document loads itself (`fonts.ts`), or null for a
|
|
112
|
+
* document with no `@font-face`. */
|
|
113
|
+
private _families;
|
|
114
|
+
private _mapFamilies;
|
|
115
|
+
/** Whether any declaration has a length in `lh` or `rlh`: only then is
|
|
116
|
+
* the line height settled ahead of the declarations that read it. */
|
|
117
|
+
private _lh;
|
|
118
|
+
constructor(sheets: Stylesheet[], look: RootLook, viewportWidth: number, viewportHeight: number, scale?: number, xHeight?: ((family: string, size: number) => number | null) | null, zeroWidth?: ((family: string, size: number) => number | null) | null, normalLine?: ((family: string, size: number) => number | null) | null, families?: FontFamilies | null);
|
|
119
|
+
/** Whether declarations read the viewport's width or height (`vw`,
|
|
120
|
+
* `vh`, `vmin`, `vmax`), noted on the cascade. */
|
|
121
|
+
private _noteViewportUnits;
|
|
31
122
|
/** Whether a pointer move can change what this cascade produces. */
|
|
32
123
|
get hoverSensitive(): boolean;
|
|
33
124
|
setPointer(pointer: PointerState): void;
|
|
125
|
+
/**
|
|
126
|
+
* Whether the pointer entering or leaving `el` can change a style: one of
|
|
127
|
+
* the compounds a selector tests the pointer in matches it, the pointer
|
|
128
|
+
* aside. A move between two paragraphs of a page whose only such rule is
|
|
129
|
+
* `a:hover` touches nothing, and restyles nothing.
|
|
130
|
+
*/
|
|
131
|
+
hoverTouches(el: Element): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The elements whose `:has()` may have changed its answer as `el` was
|
|
134
|
+
* hovered or left: the ancestors of it a compound whose `:has()` tests
|
|
135
|
+
* the pointer names, and their earlier siblings and its own where the
|
|
136
|
+
* argument starts at a sibling — a superset, which is restyled and found
|
|
137
|
+
* the same where it did not. Into `into`.
|
|
138
|
+
*/
|
|
139
|
+
hoverAnchors(el: Element, into: Element[]): void;
|
|
140
|
+
private _noteHover;
|
|
141
|
+
/** A selector compiled as a rule's is, or null where css-select refuses
|
|
142
|
+
* it, as a rule it refuses drops out of the cascade. */
|
|
143
|
+
private _compile;
|
|
34
144
|
/** Which media band a device-pixel width falls in. Two widths in the same
|
|
35
145
|
* band produce identical styles, which is what lets a resize skip
|
|
36
146
|
* restyling. */
|
|
37
147
|
mediaBand(width: number): number;
|
|
148
|
+
/** Computed styles by sharing key, for one build (`sharedStyleFor`): one
|
|
149
|
+
* map for the elements shared without matching, one for the elements
|
|
150
|
+
* shared by what they matched. */
|
|
151
|
+
private _shared;
|
|
152
|
+
private _sharedByMatch;
|
|
153
|
+
private _nextShareKey;
|
|
154
|
+
/** Custom property sets by what made them, for one build (`_customFor`). */
|
|
155
|
+
private _customs;
|
|
156
|
+
private _ids;
|
|
157
|
+
private _nextId;
|
|
158
|
+
/** A box tree is about to be built: the styles shared in the last build
|
|
159
|
+
* were computed against a pointer and a viewport that may have moved. */
|
|
160
|
+
beginSharing(): void;
|
|
161
|
+
/**
|
|
162
|
+
* An element's custom properties: its parent's, or its own over them —
|
|
163
|
+
* shared by every element whose parent has the same ones and whose own
|
|
164
|
+
* come from the same declarations. Tailwind 4 sets thirty-five of them on
|
|
165
|
+
* every element (`*, ::before, ::after { --tw-shadow: 0 0 #0000; … }`),
|
|
166
|
+
* and a set per element was a fifth of building the boxes; it also kept
|
|
167
|
+
* each element's `var()`s from being replaced once for its siblings,
|
|
168
|
+
* which `substituteIn` remembers by the set they were read against.
|
|
169
|
+
*/
|
|
170
|
+
private _customFor;
|
|
171
|
+
/** Whether a candidate sets a custom property. */
|
|
172
|
+
private _hasCustom;
|
|
173
|
+
/** A number for an object, to key a string by. */
|
|
174
|
+
private _idOf;
|
|
175
|
+
/**
|
|
176
|
+
* `styleFor`, shared between the elements that must compute the same
|
|
177
|
+
* style, with the key this element's children share under.
|
|
178
|
+
*
|
|
179
|
+
* A style is a function of the parent's style, the rules that match, the
|
|
180
|
+
* presentational attributes, the inline style and whether the parent is a
|
|
181
|
+
* flex container. Outside the rules `UNSHAREABLE` names, what matches
|
|
182
|
+
* depends only on the element's tag and attributes and its ancestors', and
|
|
183
|
+
* the hints read nothing else either. So the key is the parent's key, the
|
|
184
|
+
* flex flag, the tag and every attribute — plus the pointer state where a
|
|
185
|
+
* rule asks for it — and an element whose key has been computed in this
|
|
186
|
+
* build takes that style object, matching nothing. A long document is a
|
|
187
|
+
* few kinds of element many times over: the benchmark's 600 KB report is
|
|
188
|
+
* 9,039 elements and 110 keys, and computing every style again was a third
|
|
189
|
+
* of an edit.
|
|
190
|
+
*
|
|
191
|
+
* An element a rule `UNSHAREABLE` could reach is matched, since where it
|
|
192
|
+
* sits decides what matches — and then shared by what matched: the same
|
|
193
|
+
* parent, attributes and rules make the same style. That is what keeps a
|
|
194
|
+
* striped table from being a style per row, and it keeps the key its
|
|
195
|
+
* children share under, which an element-per-key would have taken from the
|
|
196
|
+
* whole subtree.
|
|
197
|
+
*
|
|
198
|
+
* The style is handed out shared, so nothing may write to it — nothing
|
|
199
|
+
* does after the cascade, and `rootStyle` does not go through here.
|
|
200
|
+
*/
|
|
201
|
+
sharedStyleFor(el: Element, parentStyle: ComputedStyle, parentKey: number, inFlexContainer: boolean): SharedStyle;
|
|
202
|
+
/** Whether no rule `UNSHAREABLE` names could reach this element: the same
|
|
203
|
+
* buckets `_candidates` looks in. */
|
|
204
|
+
private _shareable;
|
|
38
205
|
/**
|
|
39
|
-
* The computed style for one element, given its parent's.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
206
|
+
* The computed style for one element, given its parent's. The box builder
|
|
207
|
+
* asks for every element in document order, through `sharedStyleFor`, so
|
|
208
|
+
* a style is computed only for the elements with none to share.
|
|
42
209
|
*/
|
|
43
210
|
styleFor(el: Element, parentStyle: ComputedStyle, inFlexContainer: boolean): ComputedStyle;
|
|
211
|
+
/**
|
|
212
|
+
* The style of an element's `::before` or `::after`, or null when it has
|
|
213
|
+
* none: no rule reaches it, or the rules that do leave `content` at
|
|
214
|
+
* `normal` or `none`, which make no box (CSS 2.1 12.2). It inherits from
|
|
215
|
+
* the element's own style, as a pseudo-element does, and a flex
|
|
216
|
+
* container's are flex items. Not shared: few elements have one, and where
|
|
217
|
+
* a rule gives every element one — a clearfix — the style is the cost of
|
|
218
|
+
* the box it makes.
|
|
219
|
+
*/
|
|
220
|
+
pseudoStyleFor(el: Element, which: 'before' | 'after', elementStyle: ComputedStyle): ComputedStyle | null;
|
|
221
|
+
/**
|
|
222
|
+
* The rules for an element's `::first-letter`, or null when none reaches
|
|
223
|
+
* it. They are matched against the element here, and its style computed
|
|
224
|
+
* later by `firstLetterStyle`, because the pseudo-element inherits from
|
|
225
|
+
* the box its letter turns out to be in — a `<span>` the block opens with,
|
|
226
|
+
* a `::before` — which the builder has not reached yet.
|
|
227
|
+
*/
|
|
228
|
+
firstLetterRules(el: Element): FirstLetterRules | null;
|
|
229
|
+
/** Whether any rule styles a `::first-line`: a document with none asks
|
|
230
|
+
* nothing more of its blocks. */
|
|
231
|
+
get hasFirstLine(): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* A list item's `::marker` style, inheriting from its own, or null when no
|
|
234
|
+
* rule reaches it (CSS Lists 3, 3.1): the colour and the font a bullet or
|
|
235
|
+
* a number is set in, and a `content` it is set as instead.
|
|
236
|
+
*/
|
|
237
|
+
markerStyle(el: Element, style: ComputedStyle): ComputedStyle | null;
|
|
238
|
+
/**
|
|
239
|
+
* An element's `::first-line` style, inheriting from its own, or null
|
|
240
|
+
* when no rule reaches it (CSS 2.1 5.12.1).
|
|
241
|
+
*/
|
|
242
|
+
firstLineStyle(el: Element, style: ComputedStyle): ComputedStyle | null;
|
|
243
|
+
/**
|
|
244
|
+
* The style of a `::first-letter` inside a box of `parentStyle`. It is an
|
|
245
|
+
* inline box, or a float where it floats, whatever the rules say of its
|
|
246
|
+
* `display` or its `position` (CSS 2.1 5.12.2).
|
|
247
|
+
*/
|
|
248
|
+
firstLetterStyle(rules: FirstLetterRules, parentStyle: ComputedStyle): ComputedStyle;
|
|
249
|
+
/** The x-height of a style's font: the font's own, asked once per face
|
|
250
|
+
* and size, or half an em. */
|
|
251
|
+
private _exOf;
|
|
252
|
+
/** The advance of a style's font's "0": the font's own, asked once per
|
|
253
|
+
* face and size, or half an em. */
|
|
254
|
+
private _chOf;
|
|
255
|
+
/** A style's computed line height as a length, for `lh`: `normal` as
|
|
256
|
+
* its font's own, asked once per face and size, or 1.2em. */
|
|
257
|
+
private _lineHeightOf;
|
|
258
|
+
/** `styleFor`, from the rules and hints already gathered for `el`. */
|
|
259
|
+
private _computeStyle;
|
|
260
|
+
/** One declaration, its `var()`s replaced first. One that names a
|
|
261
|
+
* custom property with no value, and has no fallback, is invalid at
|
|
262
|
+
* computed-value time, and the property is as though `unset`. */
|
|
263
|
+
private _apply;
|
|
44
264
|
/**
|
|
45
265
|
* The root's style — nothing above it to inherit from.
|
|
46
266
|
*
|
|
@@ -49,9 +269,23 @@ export declare class Cascade {
|
|
|
49
269
|
* a `<body>` would have had: the UA sheet's margin and font, and any
|
|
50
270
|
* author `body { … }` rule. Without it a fragment renders hard against the
|
|
51
271
|
* left edge while the same markup inside `<html><body>` does not, which
|
|
52
|
-
* reads as a bug in the renderer rather than as a missing element.
|
|
272
|
+
* reads as a bug in the renderer rather than as a missing element. With
|
|
273
|
+
* no `<html>` either, the body inherits from an `<html>` that author
|
|
274
|
+
* `html { … }` rules have styled, as the one a browser implies would be.
|
|
275
|
+
*
|
|
276
|
+
* A document with a `<body>` and no `<html>` — the usual shape of a page
|
|
277
|
+
* that starts `<!DOCTYPE html><title>` — has the root box standing in for
|
|
278
|
+
* that implied `<html>` instead, so an `html { font-size }` still reaches
|
|
279
|
+
* the body. Taken as the initial style, the rule matched nothing and the
|
|
280
|
+
* whole page came out at the theme's size.
|
|
53
281
|
*/
|
|
54
|
-
rootStyle(hasBody: boolean): ComputedStyle;
|
|
282
|
+
rootStyle(hasBody: boolean, hasHtml?: boolean): ComputedStyle;
|
|
283
|
+
/** The rules of `index` that match `el`, pushed onto `out` as candidates,
|
|
284
|
+
* and their ids onto `matched` in the order they were tried. */
|
|
285
|
+
private _matchInto;
|
|
286
|
+
/** Every rule and hint that applies to `el`, in cascade order — and, into
|
|
287
|
+
* `matched` when it is passed, the ids of the rules, in the order they
|
|
288
|
+
* were tried. */
|
|
55
289
|
private _candidates;
|
|
56
290
|
}
|
|
57
291
|
//# sourceMappingURL=cascade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cascade.d.ts","sourceRoot":"","sources":["../../../src/html/css/cascade.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"cascade.d.ts","sourceRoot":"","sources":["../../../src/html/css/cascade.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAW1C,OAAO,KAAK,EAA0B,UAAU,EAAE,MAAM,YAAY,CAAC;AAcrE,OAA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