pagyra-js 0.0.20 → 0.0.21
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 +55 -0
- package/dist/assets/fonts/licenses/selawik/SIL Open Font License.txt +43 -0
- package/dist/assets/fonts/ttf/arimo/Arimo-Bold.ttf +0 -0
- package/dist/assets/fonts/ttf/arimo/Arimo-BoldItalic.ttf +0 -0
- package/dist/assets/fonts/ttf/arimo/Arimo-Italic.ttf +0 -0
- package/dist/assets/fonts/ttf/arimo/Arimo-Regular.ttf +0 -0
- package/dist/assets/fonts/ttf/cinzeldecorative/CinzelDecorative-Black.ttf +0 -0
- package/dist/assets/fonts/ttf/cinzeldecorative/CinzelDecorative-Bold.ttf +0 -0
- package/dist/assets/fonts/ttf/cinzeldecorative/CinzelDecorative-Regular.ttf +0 -0
- package/dist/assets/fonts/ttf/dejavu/DejaVuSans.ttf +0 -0
- package/dist/assets/fonts/ttf/firecode/FiraCode-Bold.ttf +0 -0
- package/dist/assets/fonts/ttf/firecode/FiraCode-Light.ttf +0 -0
- package/dist/assets/fonts/ttf/firecode/FiraCode-Medium.ttf +0 -0
- package/dist/assets/fonts/ttf/firecode/FiraCode-Regular.ttf +0 -0
- package/dist/assets/fonts/ttf/firecode/FiraCode-SemiBold.ttf +0 -0
- package/dist/assets/fonts/ttf/notoemoji/NotoEmoji-Bold.ttf +0 -0
- package/dist/assets/fonts/ttf/notoemoji/NotoEmoji-Light.ttf +0 -0
- package/dist/assets/fonts/ttf/notoemoji/NotoEmoji-Medium.ttf +0 -0
- package/dist/assets/fonts/ttf/notoemoji/NotoEmoji-Regular.ttf +0 -0
- package/dist/assets/fonts/ttf/notoemoji/NotoEmoji-SemiBold.ttf +0 -0
- package/dist/assets/fonts/ttf/notosans/NotoSans-Regular.ttf +0 -0
- package/dist/assets/fonts/ttf/roboto/Roboto-Bold.ttf +0 -0
- package/dist/assets/fonts/ttf/roboto/Roboto-BoldItalic.ttf +0 -0
- package/dist/assets/fonts/ttf/roboto/Roboto-Italic.ttf +0 -0
- package/dist/assets/fonts/ttf/roboto/Roboto-Regular.ttf +0 -0
- package/dist/assets/fonts/ttf/selawik/selawk.ttf +0 -0
- package/dist/assets/fonts/ttf/selawik/selawkb.ttf +0 -0
- package/dist/assets/fonts/ttf/selawik/selawkl.ttf +0 -0
- package/dist/assets/fonts/ttf/selawik/selawksb.ttf +0 -0
- package/dist/assets/fonts/ttf/selawik/selawksl.ttf +0 -0
- package/dist/assets/fonts/ttf/stixtwomath/STIXTwoMath-Regular.ttf +0 -0
- package/dist/assets/fonts/ttf/tinos/Tinos-Bold.ttf +0 -0
- package/dist/assets/fonts/ttf/tinos/Tinos-BoldItalic.ttf +0 -0
- package/dist/assets/fonts/ttf/tinos/Tinos-Italic.ttf +0 -0
- package/dist/assets/fonts/ttf/tinos/Tinos-Regular.ttf +0 -0
- package/dist/assets/fonts/woff/lato/lato-latin-400-italic.woff +0 -0
- package/dist/assets/fonts/woff/lato/lato-latin-400-normal.woff +0 -0
- package/dist/assets/fonts/woff/lato/lato-latin-700-italic.woff +0 -0
- package/dist/assets/fonts/woff/lato/lato-latin-700-normal.woff +0 -0
- package/dist/assets/fonts/woff2/caveat/Caveat-Bold.woff2 +0 -0
- package/dist/assets/fonts/woff2/caveat/Caveat-Regular.woff2 +0 -0
- package/dist/assets/fonts/woff2/lato/lato-latin-400-italic.woff2 +0 -0
- package/dist/assets/fonts/woff2/lato/lato-latin-400-normal.woff2 +0 -0
- package/dist/assets/fonts/woff2/lato/lato-latin-700-italic.woff2 +0 -0
- package/dist/assets/fonts/woff2/lato/lato-latin-700-normal.woff2 +0 -0
- package/dist/browser/pagyra.min.js +34 -34
- package/dist/browser/pagyra.min.js.map +4 -4
- package/dist/playground/server.js +2 -0
- package/dist/src/css/compute-style/base-options.d.ts +7 -0
- package/dist/src/css/compute-style/base-options.js +24 -0
- package/dist/src/css/compute-style/declarations.d.ts +10 -0
- package/dist/src/css/compute-style/declarations.js +77 -0
- package/dist/src/css/compute-style/decoration.d.ts +8 -0
- package/dist/src/css/compute-style/decoration.js +55 -0
- package/dist/src/css/compute-style/defaults.d.ts +3 -0
- package/dist/src/css/compute-style/defaults.js +34 -0
- package/dist/src/css/compute-style/display.d.ts +3 -0
- package/dist/src/css/compute-style/display.js +85 -0
- package/dist/src/css/compute-style/float.d.ts +2 -0
- package/dist/src/css/compute-style/float.js +13 -0
- package/dist/src/css/compute-style/font.d.ts +12 -0
- package/dist/src/css/compute-style/font.js +57 -0
- package/dist/src/css/compute-style/overrides.d.ts +3 -0
- package/dist/src/css/compute-style/overrides.js +241 -0
- package/dist/src/css/compute-style.d.ts +2 -0
- package/dist/src/css/compute-style.js +34 -487
- package/dist/src/css/enums.d.ts +4 -0
- package/dist/src/css/enums.js +5 -0
- package/dist/src/css/layout-property-resolver.js +30 -18
- package/dist/src/css/length.d.ts +26 -2
- package/dist/src/css/length.js +48 -0
- package/dist/src/css/parsers/background-parser.js +1 -1
- package/dist/src/css/parsers/calc-parser.d.ts +2 -0
- package/dist/src/css/parsers/calc-parser.js +310 -0
- package/dist/src/css/parsers/content-parser.d.ts +2 -1
- package/dist/src/css/parsers/content-parser.js +7 -2
- package/dist/src/css/parsers/dimension-parser.js +37 -18
- package/dist/src/css/parsers/display-flex-parser.d.ts +4 -0
- package/dist/src/css/parsers/display-flex-parser.js +97 -0
- package/dist/src/css/parsers/filter-parser.d.ts +14 -0
- package/dist/src/css/parsers/filter-parser.js +255 -0
- package/dist/src/css/parsers/grid-parser-extended.d.ts +1 -0
- package/dist/src/css/parsers/grid-parser-extended.js +40 -1
- package/dist/src/css/parsers/grid-parser.d.ts +5 -2
- package/dist/src/css/parsers/grid-parser.js +71 -7
- package/dist/src/css/parsers/length-parser.d.ts +8 -3
- package/dist/src/css/parsers/length-parser.js +45 -2
- package/dist/src/css/parsers/margin-block-parser.js +3 -3
- package/dist/src/css/parsers/margin-parser.js +3 -3
- package/dist/src/css/parsers/padding-block-parser.js +3 -3
- package/dist/src/css/parsers/padding-inline-parser.js +3 -3
- package/dist/src/css/parsers/padding-parser.js +6 -6
- package/dist/src/css/parsers/position-parser.js +2 -22
- package/dist/src/css/parsers/register-parsers.js +29 -2
- package/dist/src/css/parsers/word-break-parser.d.ts +2 -0
- package/dist/src/css/parsers/word-break-parser.js +23 -0
- package/dist/src/css/properties/grid.d.ts +16 -2
- package/dist/src/css/properties/layout.d.ts +3 -1
- package/dist/src/css/properties/layout.js +1 -1
- package/dist/src/css/properties/misc.d.ts +5 -0
- package/dist/src/css/properties/typography.d.ts +3 -0
- package/dist/src/css/properties/visual.d.ts +36 -0
- package/dist/src/css/shorthands/box-shorthand.d.ts +2 -2
- package/dist/src/css/style-inheritance.d.ts +2 -1
- package/dist/src/css/style-inheritance.js +1 -0
- package/dist/src/css/style.d.ts +30 -10
- package/dist/src/css/style.js +8 -1
- package/dist/src/css/ua-defaults/base-defaults.d.ts +1 -0
- package/dist/src/css/ua-defaults/base-defaults.js +10 -1
- package/dist/src/css/ua-defaults/element-defaults.js +0 -2
- package/dist/src/html/css/parse-css.d.ts +2 -0
- package/dist/src/html/css/parse-css.js +32 -3
- package/dist/src/html/dom-converter/background-images.d.ts +3 -0
- package/dist/src/html/dom-converter/background-images.js +88 -0
- package/dist/src/html/dom-converter/convert-dom-node.d.ts +5 -0
- package/dist/src/html/dom-converter/convert-dom-node.js +81 -0
- package/dist/src/html/dom-converter/handlers/br-handler.d.ts +2 -0
- package/dist/src/html/dom-converter/handlers/br-handler.js +20 -0
- package/dist/src/html/dom-converter/handlers/form-control-handler.d.ts +2 -0
- package/dist/src/html/dom-converter/handlers/form-control-handler.js +28 -0
- package/dist/src/html/dom-converter/handlers/img-handler.d.ts +2 -0
- package/dist/src/html/dom-converter/handlers/img-handler.js +4 -0
- package/dist/src/html/dom-converter/handlers/index.d.ts +4 -0
- package/dist/src/html/dom-converter/handlers/index.js +19 -0
- package/dist/src/html/dom-converter/handlers/svg-handler.d.ts +2 -0
- package/dist/src/html/dom-converter/handlers/svg-handler.js +32 -0
- package/dist/src/html/dom-converter/handlers/types.d.ts +12 -0
- package/dist/src/html/dom-converter/handlers/types.js +2 -0
- package/dist/src/html/dom-converter/helpers.d.ts +7 -0
- package/dist/src/html/dom-converter/helpers.js +35 -0
- package/dist/src/html/dom-converter/index.d.ts +1 -0
- package/dist/src/html/dom-converter/index.js +1 -0
- package/dist/src/html/dom-converter/pseudo-elements.d.ts +6 -0
- package/dist/src/html/dom-converter/pseudo-elements.js +48 -0
- package/dist/src/html/dom-converter/text.d.ts +15 -0
- package/dist/src/html/dom-converter/text.js +170 -0
- package/dist/src/html/dom-converter.d.ts +1 -5
- package/dist/src/html/dom-converter.js +1 -417
- package/dist/src/html/image-converter.d.ts +5 -0
- package/dist/src/html-to-pdf/document-css.d.ts +14 -0
- package/dist/src/html-to-pdf/document-css.js +45 -0
- package/dist/src/html-to-pdf/fonts.d.ts +16 -0
- package/dist/src/html-to-pdf/fonts.js +74 -0
- package/dist/src/html-to-pdf/header-footer.d.ts +14 -0
- package/dist/src/html-to-pdf/header-footer.js +101 -0
- package/dist/src/html-to-pdf/html-parser.d.ts +6 -0
- package/dist/src/html-to-pdf/html-parser.js +81 -0
- package/dist/src/html-to-pdf/index.d.ts +3 -0
- package/dist/src/html-to-pdf/index.js +2 -0
- package/dist/src/html-to-pdf/layout-build.d.ts +37 -0
- package/dist/src/html-to-pdf/layout-build.js +73 -0
- package/dist/src/html-to-pdf/prepare-html-render.d.ts +2 -0
- package/dist/src/html-to-pdf/prepare-html-render.js +121 -0
- package/dist/src/html-to-pdf/render-finalize.d.ts +15 -0
- package/dist/src/html-to-pdf/render-finalize.js +27 -0
- package/dist/src/html-to-pdf/render-html-to-pdf.d.ts +3 -0
- package/dist/src/html-to-pdf/render-html-to-pdf.js +25 -0
- package/dist/src/html-to-pdf/resource-loader.d.ts +6 -0
- package/dist/src/html-to-pdf/resource-loader.js +120 -0
- package/dist/src/html-to-pdf/types.d.ts +38 -0
- package/dist/src/html-to-pdf/types.js +2 -0
- package/dist/src/html-to-pdf.d.ts +1 -37
- package/dist/src/html-to-pdf.js +1 -537
- package/dist/src/image/js-png-backend.d.ts +7 -0
- package/dist/src/image/js-png-backend.js +9 -0
- package/dist/src/image/png-backend.d.ts +5 -0
- package/dist/src/image/png-backend.js +1 -0
- package/dist/src/image/png-wasm-loader.d.ts +5 -0
- package/dist/src/image/png-wasm-loader.js +59 -0
- package/dist/src/image/wasm/png_decoder_wasm.d.ts +8 -0
- package/dist/src/image/wasm/png_decoder_wasm.js +24 -0
- package/dist/src/image/wasm/png_decoder_wasm_bg.js +16 -0
- package/dist/src/image/wasm-png-backend.d.ts +6 -0
- package/dist/src/image/wasm-png-backend.js +17 -0
- package/dist/src/layout/counter.d.ts +1 -2
- package/dist/src/layout/counter.js +18 -18
- package/dist/src/layout/inline/inline-utils.d.ts +1 -1
- package/dist/src/layout/inline/inline-utils.js +8 -7
- package/dist/src/layout/inline/layout.js +16 -3
- package/dist/src/layout/inline/run-placer.d.ts +1 -0
- package/dist/src/layout/inline/run-placer.js +2 -10
- package/dist/src/layout/pipeline/out-of-flow-manager.js +25 -1
- package/dist/src/layout/strategies/block.js +35 -24
- package/dist/src/layout/strategies/flex.js +305 -61
- package/dist/src/layout/strategies/form.d.ts +2 -0
- package/dist/src/layout/strategies/form.js +38 -13
- package/dist/src/layout/strategies/grid.js +166 -29
- package/dist/src/layout/strategies/image.js +53 -27
- package/dist/src/layout/strategies/inline.js +26 -21
- package/dist/src/layout/strategies/table.js +26 -18
- package/dist/src/layout/utils/content-measurer.d.ts +1 -1
- package/dist/src/layout/utils/content-measurer.js +8 -7
- package/dist/src/layout/utils/floats.d.ts +1 -0
- package/dist/src/layout/utils/floats.js +14 -12
- package/dist/src/layout/utils/margin.d.ts +4 -4
- package/dist/src/layout/utils/margin.js +20 -16
- package/dist/src/layout/utils/node-math.d.ts +12 -6
- package/dist/src/layout/utils/node-math.js +71 -41
- package/dist/src/layout/utils/sizing.js +2 -1
- package/dist/src/pdf/font-subset/font-registry.d.ts +6 -0
- package/dist/src/pdf/font-subset/font-registry.js +30 -2
- package/dist/src/pdf/header-footer-renderer.js +12 -1
- package/dist/src/pdf/layout-tree-builder.js +5 -1
- package/dist/src/pdf/page-painter.js +13 -0
- package/dist/src/pdf/pagination.js +2 -2
- package/dist/src/pdf/renderer/box-painter.js +28 -3
- package/dist/src/pdf/renderer/page-paint.js +11 -3
- package/dist/src/pdf/renderers/radius-utils.js +31 -38
- package/dist/src/pdf/renderers/shape-renderer.js +1 -1
- package/dist/src/pdf/renderers/shape-utils.js +1 -1
- package/dist/src/pdf/renderers/text-renderer.d.ts +9 -1
- package/dist/src/pdf/renderers/text-renderer.js +36 -2
- package/dist/src/pdf/stacking/build-stacking-contexts.js +1 -2
- package/dist/src/pdf/stacking/resolve-paint-order.d.ts +5 -6
- package/dist/src/pdf/stacking/resolve-paint-order.js +29 -9
- package/dist/src/pdf/stacking/types.d.ts +14 -0
- package/dist/src/pdf/svg/shape-renderer.js +47 -20
- package/dist/src/pdf/types.d.ts +7 -1
- package/dist/src/pdf/utils/border-radius-utils.js +31 -38
- package/dist/src/pdf/utils/color-utils.js +17 -2
- package/dist/src/pdf/utils/filter-utils.d.ts +29 -0
- package/dist/src/pdf/utils/filter-utils.js +85 -0
- package/dist/src/pdf/utils/node-text-run-factory.js +1 -1
- package/dist/src/pdf/utils/text-layout-adjuster.d.ts +0 -8
- package/dist/src/pdf/utils/text-layout-adjuster.js +12 -9
- package/dist/src/units/units.d.ts +1 -1
- package/dist/tests/css/box-sizing.spec.d.ts +1 -0
- package/dist/tests/css/box-sizing.spec.js +46 -0
- package/dist/tests/css/calc-parser.spec.d.ts +1 -0
- package/dist/tests/css/calc-parser.spec.js +68 -0
- package/dist/tests/css/container-query-units.spec.d.ts +1 -0
- package/dist/tests/css/container-query-units.spec.js +64 -0
- package/dist/tests/css/content-parser.spec.js +13 -0
- package/dist/tests/css/filter-parser.spec.d.ts +1 -0
- package/dist/tests/css/filter-parser.spec.js +116 -0
- package/dist/tests/css/flex-shorthand.spec.d.ts +1 -0
- package/dist/tests/css/flex-shorthand.spec.js +45 -0
- package/dist/tests/css/grid-clamp.spec.d.ts +1 -0
- package/dist/tests/css/grid-clamp.spec.js +82 -0
- package/dist/tests/css/parse-css-pseudo.spec.d.ts +1 -0
- package/dist/tests/css/parse-css-pseudo.spec.js +26 -0
- package/dist/tests/helpers/render-utils.d.ts +18 -2
- package/dist/tests/helpers/render-utils.js +25 -12
- package/dist/tests/html/dom-converter-pseudo-elements.spec.d.ts +1 -0
- package/dist/tests/html/dom-converter-pseudo-elements.spec.js +33 -0
- package/dist/tests/html/dom-converter-text.spec.d.ts +1 -0
- package/dist/tests/html/dom-converter-text.spec.js +67 -0
- package/dist/tests/image/png-backend.spec.d.ts +1 -0
- package/dist/tests/image/png-backend.spec.js +34 -0
- package/dist/tests/layout/box-sizing.spec.d.ts +1 -0
- package/dist/tests/layout/box-sizing.spec.js +75 -0
- package/dist/tests/layout/calc-padding.spec.d.ts +1 -0
- package/dist/tests/layout/calc-padding.spec.js +19 -0
- package/dist/tests/layout/container-query-units.spec.d.ts +1 -0
- package/dist/tests/layout/container-query-units.spec.js +24 -0
- package/dist/tests/layout/flex-auto-height.spec.d.ts +1 -0
- package/dist/tests/layout/flex-auto-height.spec.js +35 -0
- package/dist/tests/layout/flex-wrap-cards.spec.d.ts +1 -0
- package/dist/tests/layout/flex-wrap-cards.spec.js +16 -0
- package/dist/tests/layout/flex-wrap-grow-align-content.spec.d.ts +1 -0
- package/dist/tests/layout/flex-wrap-grow-align-content.spec.js +20 -0
- package/dist/tests/layout/grid-clamp-gap.spec.d.ts +1 -0
- package/dist/tests/layout/grid-clamp-gap.spec.js +22 -0
- package/dist/tests/layout/inline-fragments.spec.js +38 -0
- package/dist/tests/layout/paged-body-margin.spec.d.ts +1 -0
- package/dist/tests/layout/paged-body-margin.spec.js +92 -0
- package/dist/tests/layout/pseudo-counters-generated-content.spec.d.ts +1 -0
- package/dist/tests/layout/pseudo-counters-generated-content.spec.js +51 -0
- package/dist/tests/layout/responsive-clamp-grid-parity.spec.d.ts +1 -0
- package/dist/tests/layout/responsive-clamp-grid-parity.spec.js +75 -0
- package/dist/tests/layout/run-placer-baseline.spec.js +13 -11
- package/dist/tests/pdf/backdrop-filter-noop.spec.d.ts +1 -0
- package/dist/tests/pdf/backdrop-filter-noop.spec.js +140 -0
- package/dist/tests/pdf/filter-drop-shadow.spec.d.ts +1 -0
- package/dist/tests/pdf/filter-drop-shadow.spec.js +74 -0
- package/dist/tests/pdf/filter-opacity.spec.d.ts +1 -0
- package/dist/tests/pdf/filter-opacity.spec.js +30 -0
- package/dist/tests/pdf/font-subset-registry-key.spec.d.ts +1 -0
- package/dist/tests/pdf/font-subset-registry-key.spec.js +66 -0
- package/dist/tests/pdf/selawik-opt-in.spec.d.ts +1 -0
- package/dist/tests/pdf/selawik-opt-in.spec.js +106 -0
- package/dist/tests/pdf/system-ui-fallback-subset-regression.spec.d.ts +1 -0
- package/dist/tests/pdf/system-ui-fallback-subset-regression.spec.js +39 -0
- package/dist/tests/pdf/text-renderer-fallback.spec.js +55 -0
- package/dist/tests/pdf/text-transform-matrix.spec.js +8 -7
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/css/parsers/register-parsers.ts
|
|
2
2
|
import { registerPropertyParser } from "./registry.js";
|
|
3
3
|
// Display and Flex
|
|
4
|
-
import { parseDisplay, parseJustifyContent, parseAlignItems, parseAlignContent, parseAlignSelf, parseFlexDirection, parseFlexWrap, } from "./display-flex-parser.js";
|
|
4
|
+
import { parseDisplay, parseJustifyContent, parseAlignItems, parseAlignContent, parseAlignSelf, parseFlexDirection, parseFlexWrap, parseFlexGrow, parseFlexShrink, parseFlexBasis, parseFlex, } from "./display-flex-parser.js";
|
|
5
5
|
// Color
|
|
6
6
|
import { parseColor, parseBackgroundColor } from "./color-parser.js";
|
|
7
7
|
// Border
|
|
@@ -25,16 +25,20 @@ import { parsePosition, parseTop, parseRight, parseBottom, parseLeft } from "./p
|
|
|
25
25
|
// Text
|
|
26
26
|
import { parseTextAlign, parseTextDecoration, parseTextDecorationLine, parseTextDecorationColor, parseTextDecorationStyle, parseFloat, parseTextIndent, parseTextTransform, parseLetterSpacing, } from "./text-parser-extended.js";
|
|
27
27
|
import { parseOverflowWrap, parseWordWrap } from "./overflow-wrap-parser.js";
|
|
28
|
+
import { parseWordBreak } from "./word-break-parser.js";
|
|
28
29
|
import { parseTextShadow } from "./text-shadow-parser.js";
|
|
29
30
|
import { parseListStyleType } from "./list-style-parser.js";
|
|
30
31
|
import { parseContent } from "./content-parser.js";
|
|
32
|
+
import { parseCounterIncrement, parseCounterReset } from "../../layout/counter.js";
|
|
31
33
|
// Background
|
|
32
34
|
import { applyBackgroundSizeDecl, applyBackgroundPositionDecl, applyBackgroundOriginDecl, applyBackgroundRepeatDecl, applyBackgroundClipDecl, parseBackgroundImage, parseBackground, parseObjectFit, } from "./background-parser-extended.js";
|
|
33
35
|
import { parseClipPath } from "./clip-path-parser.js";
|
|
34
36
|
// Grid
|
|
35
|
-
import { parseGridTemplateColumns, parseGridTemplateRows, parseGridAutoFlow, parseGap, parseRowGap, parseColumnGap, } from "./grid-parser-extended.js";
|
|
37
|
+
import { parseGridTemplateColumns, parseGridTemplateRows, parseGridAutoFlow, parseGridColumn, parseGap, parseRowGap, parseColumnGap, } from "./grid-parser-extended.js";
|
|
36
38
|
// Opacity
|
|
37
39
|
import { parseOpacity } from "./opacity-parser.js";
|
|
40
|
+
// Filter
|
|
41
|
+
import { parseFilter, parseBackdropFilter } from "./filter-parser.js";
|
|
38
42
|
// Flag to ensure parsers are registered only once
|
|
39
43
|
let parsersRegistered = false;
|
|
40
44
|
export function registerAllPropertyParsers() {
|
|
@@ -43,6 +47,13 @@ export function registerAllPropertyParsers() {
|
|
|
43
47
|
return;
|
|
44
48
|
}
|
|
45
49
|
parsersRegistered = true;
|
|
50
|
+
// Box Sizing
|
|
51
|
+
registerPropertyParser("box-sizing", (value, target) => {
|
|
52
|
+
const lower = value.trim().toLowerCase();
|
|
53
|
+
if (lower === "border-box" || lower === "content-box") {
|
|
54
|
+
target.boxSizing = lower;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
46
57
|
// Display and Flex
|
|
47
58
|
registerPropertyParser("display", parseDisplay);
|
|
48
59
|
registerPropertyParser("justify-content", parseJustifyContent);
|
|
@@ -51,6 +62,10 @@ export function registerAllPropertyParsers() {
|
|
|
51
62
|
registerPropertyParser("align-self", parseAlignSelf);
|
|
52
63
|
registerPropertyParser("flex-direction", parseFlexDirection);
|
|
53
64
|
registerPropertyParser("flex-wrap", parseFlexWrap);
|
|
65
|
+
registerPropertyParser("flex-grow", parseFlexGrow);
|
|
66
|
+
registerPropertyParser("flex-shrink", parseFlexShrink);
|
|
67
|
+
registerPropertyParser("flex-basis", parseFlexBasis);
|
|
68
|
+
registerPropertyParser("flex", parseFlex);
|
|
54
69
|
// Color
|
|
55
70
|
registerPropertyParser("color", parseColor);
|
|
56
71
|
registerPropertyParser("background-color", parseBackgroundColor);
|
|
@@ -140,9 +155,16 @@ export function registerAllPropertyParsers() {
|
|
|
140
155
|
registerPropertyParser("float", parseFloat);
|
|
141
156
|
registerPropertyParser("overflow-wrap", parseOverflowWrap);
|
|
142
157
|
registerPropertyParser("word-wrap", parseWordWrap);
|
|
158
|
+
registerPropertyParser("word-break", parseWordBreak);
|
|
143
159
|
registerPropertyParser("text-shadow", parseTextShadow);
|
|
144
160
|
registerPropertyParser("list-style-type", parseListStyleType);
|
|
145
161
|
registerPropertyParser("content", parseContent);
|
|
162
|
+
registerPropertyParser("counter-reset", (value, target) => {
|
|
163
|
+
target.counterReset = parseCounterReset(value);
|
|
164
|
+
});
|
|
165
|
+
registerPropertyParser("counter-increment", (value, target) => {
|
|
166
|
+
target.counterIncrement = parseCounterIncrement(value);
|
|
167
|
+
});
|
|
146
168
|
// Transform (store as raw string for limited later use)
|
|
147
169
|
registerPropertyParser("transform", (value, target) => {
|
|
148
170
|
// store raw transform string
|
|
@@ -162,9 +184,14 @@ export function registerAllPropertyParsers() {
|
|
|
162
184
|
registerPropertyParser("grid-template-columns", parseGridTemplateColumns);
|
|
163
185
|
registerPropertyParser("grid-template-rows", parseGridTemplateRows);
|
|
164
186
|
registerPropertyParser("grid-auto-flow", parseGridAutoFlow);
|
|
187
|
+
registerPropertyParser("grid-column", parseGridColumn);
|
|
165
188
|
registerPropertyParser("gap", parseGap);
|
|
166
189
|
registerPropertyParser("row-gap", parseRowGap);
|
|
167
190
|
registerPropertyParser("column-gap", parseColumnGap);
|
|
168
191
|
// Opacity
|
|
169
192
|
registerPropertyParser("opacity", parseOpacity);
|
|
193
|
+
// Filter
|
|
194
|
+
registerPropertyParser("filter", parseFilter);
|
|
195
|
+
registerPropertyParser("backdrop-filter", parseBackdropFilter);
|
|
196
|
+
registerPropertyParser("-webkit-backdrop-filter", parseBackdropFilter); // vendor prefix comum
|
|
170
197
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function normalizeWordBreak(value) {
|
|
2
|
+
switch (value) {
|
|
3
|
+
case "normal":
|
|
4
|
+
return "normal";
|
|
5
|
+
case "break-all":
|
|
6
|
+
return "break-all";
|
|
7
|
+
case "keep-all":
|
|
8
|
+
return "keep-all";
|
|
9
|
+
case "break-word":
|
|
10
|
+
return "break-word";
|
|
11
|
+
default:
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function parseWordBreak(value, target) {
|
|
16
|
+
if (!value) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const keyword = normalizeWordBreak(value.trim().toLowerCase());
|
|
20
|
+
if (keyword) {
|
|
21
|
+
target.wordBreak = keyword;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -16,7 +16,13 @@ export interface AutoTrackSize {
|
|
|
16
16
|
min?: number;
|
|
17
17
|
max?: number;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export interface ClampTrackSize {
|
|
20
|
+
kind: "clamp";
|
|
21
|
+
min: number;
|
|
22
|
+
preferred: number;
|
|
23
|
+
max: number;
|
|
24
|
+
}
|
|
25
|
+
export type TrackSize = FixedTrackSize | FlexTrackSize | AutoTrackSize | ClampTrackSize;
|
|
20
26
|
export interface RepeatTrackDefinition {
|
|
21
27
|
kind: "repeat";
|
|
22
28
|
count: number;
|
|
@@ -43,7 +49,13 @@ export interface AutoTrackSizeInput {
|
|
|
43
49
|
min?: NumericLength;
|
|
44
50
|
max?: NumericLength;
|
|
45
51
|
}
|
|
46
|
-
export
|
|
52
|
+
export interface ClampTrackSizeInput {
|
|
53
|
+
kind: "clamp";
|
|
54
|
+
min: NumericLength;
|
|
55
|
+
preferred: NumericLength;
|
|
56
|
+
max: NumericLength;
|
|
57
|
+
}
|
|
58
|
+
export type TrackSizeInput = FixedTrackSizeInput | FlexTrackSizeInput | AutoTrackSizeInput | ClampTrackSizeInput;
|
|
47
59
|
export interface RepeatTrackDefinitionInput {
|
|
48
60
|
kind: "repeat";
|
|
49
61
|
count: number;
|
|
@@ -69,4 +81,6 @@ export interface GridProperties extends GapProperties {
|
|
|
69
81
|
trackListRows: TrackDefinition[];
|
|
70
82
|
/** Auto-placement flow direction */
|
|
71
83
|
autoFlow: GridAutoFlow;
|
|
84
|
+
/** Number of columns a grid item spans */
|
|
85
|
+
gridColumnSpan: number;
|
|
72
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LengthLike } from "../length.js";
|
|
2
|
-
import { Display, Position } from "../enums.js";
|
|
2
|
+
import { BoxSizing, Display, Position } from "../enums.js";
|
|
3
3
|
/**
|
|
4
4
|
* Layout-related CSS properties.
|
|
5
5
|
* Handles positioning, sizing, and display modes.
|
|
@@ -11,6 +11,8 @@ export interface LayoutProperties {
|
|
|
11
11
|
position: Position;
|
|
12
12
|
/** Stacking order */
|
|
13
13
|
zIndex: number | "auto";
|
|
14
|
+
/** Box sizing model (content-box or border-box) */
|
|
15
|
+
boxSizing: BoxSizing;
|
|
14
16
|
/** Element width */
|
|
15
17
|
width: LengthLike;
|
|
16
18
|
/** Element height */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { Display, Position } from "../enums.js";
|
|
1
|
+
import { BoxSizing, Display, Position } from "../enums.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FloatMode, ClearMode, TableLayoutMode, BorderModel } from "../enums.js";
|
|
2
2
|
import { CustomPropertiesMap } from "../custom-properties.js";
|
|
3
|
+
import type { CounterIncrement, CounterReset } from "../../layout/counter.js";
|
|
3
4
|
/**
|
|
4
5
|
* Miscellaneous CSS properties.
|
|
5
6
|
* Handles specialized properties like float, list styling, table layout, and page breaks.
|
|
@@ -29,4 +30,8 @@ export interface MiscProperties {
|
|
|
29
30
|
orphans: number;
|
|
30
31
|
/** CSS Custom Properties (Variables) */
|
|
31
32
|
customProperties?: CustomPropertiesMap;
|
|
33
|
+
/** CSS counters reset declarations */
|
|
34
|
+
counterReset?: CounterReset[];
|
|
35
|
+
/** CSS counters increment declarations */
|
|
36
|
+
counterIncrement?: CounterIncrement[];
|
|
32
37
|
}
|
|
@@ -3,6 +3,7 @@ import type { WhiteSpace, TextWrap, WritingMode } from "../enums.js";
|
|
|
3
3
|
import type { ContentValue } from "../parsers/content-parser.js";
|
|
4
4
|
export type TextTransform = "none" | "uppercase" | "lowercase" | "capitalize";
|
|
5
5
|
export type OverflowWrap = "normal" | "break-word" | "anywhere";
|
|
6
|
+
export type WordBreak = "normal" | "break-all" | "keep-all" | "break-word";
|
|
6
7
|
/**
|
|
7
8
|
* font-variant-numeric values as defined in CSS Fonts Level 3
|
|
8
9
|
*/
|
|
@@ -60,6 +61,8 @@ export interface TypographyProperties {
|
|
|
60
61
|
textWrap: TextWrap;
|
|
61
62
|
/** Overflow wrap behavior */
|
|
62
63
|
overflowWrap: OverflowWrap;
|
|
64
|
+
/** Word break behavior */
|
|
65
|
+
wordBreak: WordBreak;
|
|
63
66
|
/** Writing mode (horizontal-tb, vertical-rl, etc.) */
|
|
64
67
|
writingMode: WritingMode;
|
|
65
68
|
/** Text color */
|
|
@@ -30,6 +30,38 @@ export interface TextShadowInput {
|
|
|
30
30
|
blurRadius?: NumericLength;
|
|
31
31
|
color?: string;
|
|
32
32
|
}
|
|
33
|
+
/** Funções de filtro com argumento numérico (number ou percentage → number) */
|
|
34
|
+
export interface NumericFilterFunction {
|
|
35
|
+
kind: "brightness" | "contrast" | "grayscale" | "sepia" | "saturate" | "invert" | "opacity";
|
|
36
|
+
/** Valor normalizado: percentage já convertido para number (50% → 0.5) */
|
|
37
|
+
value: number;
|
|
38
|
+
}
|
|
39
|
+
/** blur() usa <length>, não número puro */
|
|
40
|
+
export interface BlurFilterFunction {
|
|
41
|
+
kind: "blur";
|
|
42
|
+
/** Raio em px (já resolvido de em/rem via NumericLength) */
|
|
43
|
+
value: NumericLength;
|
|
44
|
+
}
|
|
45
|
+
/** hue-rotate() usa <angle> */
|
|
46
|
+
export interface HueRotateFilterFunction {
|
|
47
|
+
kind: "hue-rotate";
|
|
48
|
+
/** Ângulo normalizado em graus */
|
|
49
|
+
valueDeg: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* drop-shadow() — subconjunto de box-shadow:
|
|
53
|
+
* NÃO suporta `inset` nem `spread-radius`.
|
|
54
|
+
* Reutiliza NumericLength para offset/blur para resolução posterior em overrides.ts.
|
|
55
|
+
*/
|
|
56
|
+
export interface DropShadowFilterFunction {
|
|
57
|
+
kind: "drop-shadow";
|
|
58
|
+
offsetX: NumericLength;
|
|
59
|
+
offsetY: NumericLength;
|
|
60
|
+
blurRadius: NumericLength;
|
|
61
|
+
color?: string;
|
|
62
|
+
}
|
|
63
|
+
/** União de todas as funções de filtro suportadas */
|
|
64
|
+
export type FilterFunction = NumericFilterFunction | BlurFilterFunction | HueRotateFilterFunction | DropShadowFilterFunction;
|
|
33
65
|
/**
|
|
34
66
|
* Visual effects and rendering CSS properties.
|
|
35
67
|
* Handles backgrounds, shadows, opacity, transforms, and overflow.
|
|
@@ -51,4 +83,8 @@ export interface VisualProperties {
|
|
|
51
83
|
overflowY: OverflowMode;
|
|
52
84
|
/** Clipping path applied to the element */
|
|
53
85
|
clipPath?: ClipPath;
|
|
86
|
+
/** CSS filter — lista ordenada de funções (aplicadas da esquerda para direita) */
|
|
87
|
+
filter?: FilterFunction[];
|
|
88
|
+
/** CSS backdrop-filter — mesma estrutura, render diferente */
|
|
89
|
+
backdropFilter?: FilterFunction[];
|
|
54
90
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type BoxLength =
|
|
1
|
+
import type { LengthInput } from "../length.js";
|
|
2
|
+
type BoxLength = LengthInput | undefined;
|
|
3
3
|
export declare function applyBoxShorthand<T extends BoxLength = BoxLength>(value: string, apply: (top: T, right: T, bottom: T, left: T) => void, parser?: (input: string) => T): void;
|
|
4
4
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComputedStyle } from "./style.js";
|
|
2
2
|
import type { LineHeightValue } from "./line-height.js";
|
|
3
|
-
import type { OverflowWrap, TextTransform } from "./properties/typography.js";
|
|
3
|
+
import type { OverflowWrap, WordBreak, TextTransform } from "./properties/typography.js";
|
|
4
4
|
import type { LengthLike } from "./length.js";
|
|
5
5
|
import type { StyleDefaults } from "./ua-defaults/types.js";
|
|
6
6
|
/**
|
|
@@ -19,6 +19,7 @@ export interface InheritedStyleProperties {
|
|
|
19
19
|
textDecorationColor?: string;
|
|
20
20
|
textDecorationStyle?: string;
|
|
21
21
|
overflowWrap?: OverflowWrap;
|
|
22
|
+
wordBreak?: WordBreak;
|
|
22
23
|
textIndent: LengthLike;
|
|
23
24
|
textTransform: TextTransform;
|
|
24
25
|
listStyleType: string;
|
|
@@ -21,6 +21,7 @@ export class StyleInheritanceResolver {
|
|
|
21
21
|
textDecorationColor: parentStyle.textDecorationColor ?? mergedDefaults.textDecorationColor,
|
|
22
22
|
textDecorationStyle: parentStyle.textDecorationStyle ?? mergedDefaults.textDecorationStyle,
|
|
23
23
|
overflowWrap: parentStyle.overflowWrap ?? mergedDefaults.overflowWrap,
|
|
24
|
+
wordBreak: parentStyle.wordBreak ?? mergedDefaults.wordBreak,
|
|
24
25
|
textIndent: parentStyle.textIndent ?? mergedDefaults.textIndent ?? 0,
|
|
25
26
|
textTransform: parentStyle.textTransform ?? mergedDefaults.textTransform ?? "none",
|
|
26
27
|
listStyleType: parentStyle.listStyleType ?? mergedDefaults.listStyleType ?? "disc",
|
package/dist/src/css/style.d.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { AlignContent, AlignItems, BorderModel, ClearMode, Display, FloatMode, JustifyContent, OverflowMode, Position, TableLayoutMode, TextWrap, WhiteSpace, WritingMode } from "./enums.js";
|
|
2
|
-
import type { LengthInput, LengthLike, RelativeLength, NumericLength } from "./length.js";
|
|
1
|
+
import { AlignContent, AlignItems, BorderModel, BoxSizing, ClearMode, Display, FloatMode, JustifyContent, OverflowMode, Position, TableLayoutMode, TextWrap, WhiteSpace, WritingMode } from "./enums.js";
|
|
2
|
+
import type { LengthInput, LengthLike, RelativeLength, NumericLength, ClampNumericLength } from "./length.js";
|
|
3
3
|
import type { BackgroundLayer } from "./background-types.js";
|
|
4
4
|
import { type LineHeightInput, type LineHeightValue } from "./line-height.js";
|
|
5
5
|
import { CustomPropertiesMap } from "./custom-properties.js";
|
|
6
6
|
import type { LayoutProperties } from "./properties/layout.js";
|
|
7
|
-
import type { TypographyProperties, TextTransform, OverflowWrap, FontVariantNumeric } from "./properties/typography.js";
|
|
7
|
+
import type { TypographyProperties, TextTransform, OverflowWrap, WordBreak, FontVariantNumeric } from "./properties/typography.js";
|
|
8
8
|
import type { BoxModelProperties } from "./properties/box-model.js";
|
|
9
9
|
import type { FlexboxProperties, FlexDirection, AlignSelfValue } from "./properties/flexbox.js";
|
|
10
|
-
import type { GridProperties, GridAutoFlow, TrackSize, TrackDefinition, FixedTrackSize, FlexTrackSize, AutoTrackSize, RepeatTrackDefinition, AutoRepeatTrackDefinition, TrackSizeInput, TrackDefinitionInput, FixedTrackSizeInput, FlexTrackSizeInput, AutoTrackSizeInput, RepeatTrackDefinitionInput, AutoRepeatTrackDefinitionInput } from "./properties/grid.js";
|
|
11
|
-
import type { VisualProperties, BoxShadow, BoxShadowInput, TextShadow, TextShadowInput } from "./properties/visual.js";
|
|
10
|
+
import type { GridProperties, GridAutoFlow, TrackSize, TrackDefinition, FixedTrackSize, FlexTrackSize, AutoTrackSize, ClampTrackSize, RepeatTrackDefinition, AutoRepeatTrackDefinition, TrackSizeInput, TrackDefinitionInput, FixedTrackSizeInput, FlexTrackSizeInput, AutoTrackSizeInput, ClampTrackSizeInput, RepeatTrackDefinitionInput, AutoRepeatTrackDefinitionInput } from "./properties/grid.js";
|
|
11
|
+
import type { VisualProperties, BoxShadow, BoxShadowInput, TextShadow, TextShadowInput, FilterFunction } from "./properties/visual.js";
|
|
12
12
|
import type { MiscProperties } from "./properties/misc.js";
|
|
13
13
|
import type { ClipPath } from "./clip-path-types.js";
|
|
14
14
|
import type { ContentValue } from "./parsers/content-parser.js";
|
|
15
|
+
import type { CounterIncrement, CounterReset } from "../layout/counter.js";
|
|
15
16
|
export type { NumericLength } from "./length.js";
|
|
16
17
|
export type { LineHeightInput, LineHeightValue } from "./line-height.js";
|
|
17
|
-
export type { TextTransform, OverflowWrap, FontVariantNumeric };
|
|
18
|
+
export type { TextTransform, OverflowWrap, WordBreak, FontVariantNumeric };
|
|
18
19
|
export type { FlexDirection, AlignSelfValue };
|
|
19
20
|
export type { GridAutoFlow };
|
|
20
|
-
export type { TrackSize, TrackDefinition, FixedTrackSize, FlexTrackSize, AutoTrackSize, RepeatTrackDefinition, AutoRepeatTrackDefinition, TrackSizeInput, TrackDefinitionInput, FixedTrackSizeInput, FlexTrackSizeInput, AutoTrackSizeInput, RepeatTrackDefinitionInput, AutoRepeatTrackDefinitionInput, };
|
|
21
|
+
export type { TrackSize, TrackDefinition, FixedTrackSize, FlexTrackSize, AutoTrackSize, ClampTrackSize, RepeatTrackDefinition, AutoRepeatTrackDefinition, TrackSizeInput, TrackDefinitionInput, FixedTrackSizeInput, FlexTrackSizeInput, AutoTrackSizeInput, ClampTrackSizeInput, RepeatTrackDefinitionInput, AutoRepeatTrackDefinitionInput, };
|
|
21
22
|
export type { BoxShadow, BoxShadowInput, TextShadow, TextShadowInput };
|
|
22
23
|
export interface StyleAccumulator {
|
|
23
24
|
display?: Display;
|
|
@@ -56,18 +57,21 @@ export interface StyleAccumulator {
|
|
|
56
57
|
paddingRight?: LengthInput;
|
|
57
58
|
paddingBottom?: LengthInput;
|
|
58
59
|
paddingLeft?: LengthInput;
|
|
60
|
+
boxSizing?: string;
|
|
59
61
|
width?: LengthInput;
|
|
60
62
|
minWidth?: LengthInput;
|
|
61
63
|
height?: LengthInput;
|
|
62
64
|
minHeight?: LengthInput;
|
|
63
65
|
maxHeight?: LengthInput;
|
|
64
|
-
fontSize?: number | RelativeLength;
|
|
66
|
+
fontSize?: number | RelativeLength | ClampNumericLength;
|
|
65
67
|
lineHeight?: LineHeightInput;
|
|
66
68
|
fontFamily?: string;
|
|
67
69
|
fontStyle?: string;
|
|
68
70
|
fontVariant?: string;
|
|
69
71
|
fontVariantNumeric?: FontVariantNumeric[];
|
|
70
72
|
content?: ContentValue[];
|
|
73
|
+
counterReset?: CounterReset[];
|
|
74
|
+
counterIncrement?: CounterIncrement[];
|
|
71
75
|
fontWeight?: number;
|
|
72
76
|
letterSpacing?: number | RelativeLength;
|
|
73
77
|
borderModel?: BorderModel;
|
|
@@ -85,18 +89,27 @@ export interface StyleAccumulator {
|
|
|
85
89
|
alignSelf?: AlignSelfValue;
|
|
86
90
|
flexDirection?: FlexDirection;
|
|
87
91
|
flexWrap?: boolean;
|
|
92
|
+
flexGrow?: number;
|
|
93
|
+
flexShrink?: number;
|
|
94
|
+
flexBasis?: LengthInput;
|
|
88
95
|
overflowWrap?: OverflowWrap;
|
|
96
|
+
wordBreak?: WordBreak;
|
|
89
97
|
trackListColumns?: TrackDefinitionInput[];
|
|
90
98
|
trackListRows?: TrackDefinitionInput[];
|
|
91
99
|
autoFlow?: GridAutoFlow;
|
|
92
|
-
rowGap?: NumericLength;
|
|
93
|
-
columnGap?: NumericLength;
|
|
100
|
+
rowGap?: NumericLength | ClampNumericLength;
|
|
101
|
+
columnGap?: NumericLength | ClampNumericLength;
|
|
102
|
+
gridColumnSpan?: number;
|
|
94
103
|
zIndex?: number | "auto";
|
|
95
104
|
top?: LengthInput;
|
|
96
105
|
right?: LengthInput;
|
|
97
106
|
bottom?: LengthInput;
|
|
98
107
|
left?: LengthInput;
|
|
99
108
|
opacity?: number;
|
|
109
|
+
/** Parsed filter functions (pre-resolution — blur pode ter RelativeLength) */
|
|
110
|
+
filter?: FilterFunction[];
|
|
111
|
+
/** Parsed backdrop-filter functions */
|
|
112
|
+
backdropFilter?: FilterFunction[];
|
|
100
113
|
}
|
|
101
114
|
/**
|
|
102
115
|
* Complete CSS style properties.
|
|
@@ -122,7 +135,9 @@ export declare class ComputedStyle implements StyleProperties {
|
|
|
122
135
|
whiteSpace: WhiteSpace;
|
|
123
136
|
textWrap: TextWrap;
|
|
124
137
|
overflowWrap: OverflowWrap;
|
|
138
|
+
wordBreak: WordBreak;
|
|
125
139
|
writingMode: WritingMode;
|
|
140
|
+
boxSizing: BoxSizing;
|
|
126
141
|
width: LengthLike;
|
|
127
142
|
height: LengthLike;
|
|
128
143
|
minWidth?: LengthLike;
|
|
@@ -164,6 +179,8 @@ export declare class ComputedStyle implements StyleProperties {
|
|
|
164
179
|
fontVariant?: string;
|
|
165
180
|
fontVariantNumeric?: FontVariantNumeric[];
|
|
166
181
|
content?: ContentValue[];
|
|
182
|
+
counterReset?: CounterReset[];
|
|
183
|
+
counterIncrement?: CounterIncrement[];
|
|
167
184
|
clipPath?: ClipPath;
|
|
168
185
|
objectFit?: "contain" | "cover" | "fill" | "none" | "scale-down";
|
|
169
186
|
left?: LengthLike;
|
|
@@ -193,6 +210,7 @@ export declare class ComputedStyle implements StyleProperties {
|
|
|
193
210
|
autoFlow: GridAutoFlow;
|
|
194
211
|
rowGap: number;
|
|
195
212
|
columnGap: number;
|
|
213
|
+
gridColumnSpan: number;
|
|
196
214
|
tableLayout: TableLayoutMode;
|
|
197
215
|
borderModel: BorderModel;
|
|
198
216
|
breakBefore: string;
|
|
@@ -201,6 +219,8 @@ export declare class ComputedStyle implements StyleProperties {
|
|
|
201
219
|
widows: number;
|
|
202
220
|
orphans: number;
|
|
203
221
|
opacity: number;
|
|
222
|
+
filter?: FilterFunction[];
|
|
223
|
+
backdropFilter?: FilterFunction[];
|
|
204
224
|
customProperties: CustomPropertiesMap;
|
|
205
225
|
constructor(init?: Partial<StyleProperties>);
|
|
206
226
|
get backgroundColor(): string | undefined;
|
package/dist/src/css/style.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignContent, AlignItems, BorderModel, ClearMode, Display, FloatMode, JustifyContent, OverflowMode, Position, TableLayoutMode, TextWrap, WhiteSpace, WritingMode, } from "./enums.js";
|
|
1
|
+
import { AlignContent, AlignItems, BorderModel, BoxSizing, ClearMode, Display, FloatMode, JustifyContent, OverflowMode, Position, TableLayoutMode, TextWrap, WhiteSpace, WritingMode, } from "./enums.js";
|
|
2
2
|
import { BrowserDefaults } from "./browser-defaults.js";
|
|
3
3
|
import { cloneLineHeight, lineHeightToPx, } from "./line-height.js";
|
|
4
4
|
import { CustomPropertiesMap } from "./custom-properties.js";
|
|
@@ -23,8 +23,10 @@ export class ComputedStyle {
|
|
|
23
23
|
this.overflowY = data.overflowY;
|
|
24
24
|
this.whiteSpace = data.whiteSpace;
|
|
25
25
|
this.overflowWrap = data.overflowWrap;
|
|
26
|
+
this.wordBreak = data.wordBreak;
|
|
26
27
|
this.textWrap = data.textWrap;
|
|
27
28
|
this.writingMode = data.writingMode;
|
|
29
|
+
this.boxSizing = data.boxSizing;
|
|
28
30
|
this.width = data.width;
|
|
29
31
|
this.height = data.height;
|
|
30
32
|
this.minWidth = data.minWidth;
|
|
@@ -66,6 +68,8 @@ export class ComputedStyle {
|
|
|
66
68
|
this.fontVariant = data.fontVariant;
|
|
67
69
|
this.fontVariantNumeric = data.fontVariantNumeric;
|
|
68
70
|
this.content = data.content;
|
|
71
|
+
this.counterReset = data.counterReset;
|
|
72
|
+
this.counterIncrement = data.counterIncrement;
|
|
69
73
|
this.clipPath = data.clipPath;
|
|
70
74
|
this.objectFit = data.objectFit;
|
|
71
75
|
this.zIndex = data.zIndex;
|
|
@@ -96,6 +100,7 @@ export class ComputedStyle {
|
|
|
96
100
|
this.autoFlow = data.autoFlow;
|
|
97
101
|
this.rowGap = data.rowGap;
|
|
98
102
|
this.columnGap = data.columnGap;
|
|
103
|
+
this.gridColumnSpan = data.gridColumnSpan;
|
|
99
104
|
this.tableLayout = data.tableLayout;
|
|
100
105
|
this.borderModel = data.borderModel;
|
|
101
106
|
this.breakBefore = data.breakBefore;
|
|
@@ -112,6 +117,8 @@ export class ComputedStyle {
|
|
|
112
117
|
this.textDecorationColor = init?.textDecorationColor ?? defaultStyle.textDecorationColor;
|
|
113
118
|
this.textDecorationStyle = init?.textDecorationStyle ?? defaultStyle.textDecorationStyle;
|
|
114
119
|
this.opacity = data.opacity;
|
|
120
|
+
this.filter = data.filter ? [...data.filter] : undefined;
|
|
121
|
+
this.backdropFilter = data.backdropFilter ? [...data.backdropFilter] : undefined;
|
|
115
122
|
this.customProperties = init?.customProperties ?? new CustomPropertiesMap();
|
|
116
123
|
}
|
|
117
124
|
get backgroundColor() {
|
|
@@ -45,6 +45,7 @@ export declare class LayoutDefaults {
|
|
|
45
45
|
export declare class TextLayoutDefaults {
|
|
46
46
|
static getWhiteSpace(): WhiteSpace;
|
|
47
47
|
static getOverflowWrap(): "normal" | "break-word" | "anywhere";
|
|
48
|
+
static getWordBreak(): "normal" | "break-all" | "keep-all" | "break-word";
|
|
48
49
|
static getTextWrap(): TextWrap;
|
|
49
50
|
static getWritingMode(): WritingMode;
|
|
50
51
|
static getTextAlign(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignContent, AlignItems, BorderModel, ClearMode, Display, FloatMode, JustifyContent, OverflowMode, Position, TableLayoutMode, TextWrap, WhiteSpace, WritingMode, } from "../enums.js";
|
|
1
|
+
import { AlignContent, AlignItems, BorderModel, BoxSizing, ClearMode, Display, FloatMode, JustifyContent, OverflowMode, Position, TableLayoutMode, TextWrap, WhiteSpace, WritingMode, } from "../enums.js";
|
|
2
2
|
import { AUTO_LENGTH } from "../length.js";
|
|
3
3
|
import { createNormalLineHeight, DEFAULT_NORMAL_LINE_HEIGHT } from "../line-height.js";
|
|
4
4
|
import { remToPx, emToPx } from "../unit-conversion.js";
|
|
@@ -97,6 +97,9 @@ export class TextLayoutDefaults {
|
|
|
97
97
|
static getOverflowWrap() {
|
|
98
98
|
return "normal";
|
|
99
99
|
}
|
|
100
|
+
static getWordBreak() {
|
|
101
|
+
return "normal";
|
|
102
|
+
}
|
|
100
103
|
static getTextWrap() {
|
|
101
104
|
return TextWrap.Wrap;
|
|
102
105
|
}
|
|
@@ -166,6 +169,7 @@ export function createBaseDefaultsObject() {
|
|
|
166
169
|
minHeight: BoxModelDefaults.getMinHeight(),
|
|
167
170
|
maxHeight: BoxModelDefaults.getMaxHeight(),
|
|
168
171
|
// Layout
|
|
172
|
+
boxSizing: BoxSizing.ContentBox,
|
|
169
173
|
display: LayoutDefaults.getDisplay(),
|
|
170
174
|
position: LayoutDefaults.getPosition(),
|
|
171
175
|
float: FloatMode.None,
|
|
@@ -175,6 +179,7 @@ export function createBaseDefaultsObject() {
|
|
|
175
179
|
// Text layout
|
|
176
180
|
whiteSpace: TextLayoutDefaults.getWhiteSpace(),
|
|
177
181
|
overflowWrap: TextLayoutDefaults.getOverflowWrap(),
|
|
182
|
+
wordBreak: TextLayoutDefaults.getWordBreak(),
|
|
178
183
|
textWrap: TextLayoutDefaults.getTextWrap(),
|
|
179
184
|
writingMode: TextLayoutDefaults.getWritingMode(),
|
|
180
185
|
textAlign: TextLayoutDefaults.getTextAlign(),
|
|
@@ -195,6 +200,7 @@ export function createBaseDefaultsObject() {
|
|
|
195
200
|
trackListColumns: [],
|
|
196
201
|
trackListRows: [],
|
|
197
202
|
autoFlow: "row",
|
|
203
|
+
gridColumnSpan: 1,
|
|
198
204
|
rowGap: 0,
|
|
199
205
|
columnGap: 0,
|
|
200
206
|
// Table (defaults)
|
|
@@ -208,5 +214,8 @@ export function createBaseDefaultsObject() {
|
|
|
208
214
|
orphans: 2,
|
|
209
215
|
// Opacity
|
|
210
216
|
opacity: 1,
|
|
217
|
+
// Filter (no filter applied by default)
|
|
218
|
+
filter: undefined,
|
|
219
|
+
backdropFilter: undefined,
|
|
211
220
|
};
|
|
212
221
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type DomLikeElement } from "../../css/selectors/matcher.js";
|
|
2
2
|
import type { DomElement } from "../../types/core.js";
|
|
3
3
|
export type DomEl = DomElement;
|
|
4
|
+
export type CssPseudoElement = "::before" | "::after";
|
|
4
5
|
export interface CssRuleEntry {
|
|
5
6
|
selector: string;
|
|
6
7
|
declarations: Record<string, string>;
|
|
7
8
|
match: (el: DomLikeElement) => boolean;
|
|
9
|
+
pseudoElement?: CssPseudoElement;
|
|
8
10
|
}
|
|
9
11
|
export interface FontFaceRule {
|
|
10
12
|
declarations: Record<string, string>;
|
|
@@ -29,12 +29,23 @@ export function buildCssRules(cssText) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
for (const selector of selectors) {
|
|
32
|
-
const
|
|
32
|
+
const trimmedSelector = selector.trim();
|
|
33
|
+
const parsedSelector = splitTerminalPseudoElement(trimmedSelector);
|
|
34
|
+
if (parsedSelector.unsupportedPseudo) {
|
|
35
|
+
console.warn(`Unsupported pseudo-element selector: ${trimmedSelector}`);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const matcher = createSelectorMatcher(parsedSelector.baseSelector);
|
|
33
39
|
if (!matcher) {
|
|
34
|
-
console.warn(`Invalid CSS selector: ${
|
|
40
|
+
console.warn(`Invalid CSS selector: ${trimmedSelector}`);
|
|
35
41
|
continue;
|
|
36
42
|
}
|
|
37
|
-
result.styleRules.push({
|
|
43
|
+
result.styleRules.push({
|
|
44
|
+
selector,
|
|
45
|
+
declarations: { ...declarations },
|
|
46
|
+
match: matcher,
|
|
47
|
+
pseudoElement: parsedSelector.pseudoElement,
|
|
48
|
+
});
|
|
38
49
|
}
|
|
39
50
|
}
|
|
40
51
|
else if (rule.type === "font-face") {
|
|
@@ -61,6 +72,24 @@ export function buildCssRules(cssText) {
|
|
|
61
72
|
}
|
|
62
73
|
return result;
|
|
63
74
|
}
|
|
75
|
+
function splitTerminalPseudoElement(selector) {
|
|
76
|
+
const trimmed = selector.trim();
|
|
77
|
+
const supported = /(.*?)(::?before|::?after)\s*$/i.exec(trimmed);
|
|
78
|
+
if (supported) {
|
|
79
|
+
const pseudoRaw = supported[2].toLowerCase();
|
|
80
|
+
const pseudoElement = pseudoRaw.endsWith("before") ? "::before" : "::after";
|
|
81
|
+
const baseSelector = (supported[1].trim() || "*");
|
|
82
|
+
return { baseSelector, pseudoElement };
|
|
83
|
+
}
|
|
84
|
+
const unsupported = /(.*?)(::[a-z-]+)\s*$/i.exec(trimmed);
|
|
85
|
+
if (unsupported) {
|
|
86
|
+
return {
|
|
87
|
+
baseSelector: unsupported[1].trim() || "*",
|
|
88
|
+
unsupportedPseudo: unsupported[2].toLowerCase(),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { baseSelector: trimmed || "*" };
|
|
92
|
+
}
|
|
64
93
|
export function parseCss(cssText) {
|
|
65
94
|
return buildCssRules(cssText);
|
|
66
95
|
}
|