@ohos-ports/html2canvas-pro 0.0.0-stage → 2.3.2-beta.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/LICENSE +21 -0
- package/README.md +86 -2
- package/dist/html2canvas-pro.cjs +11191 -0
- package/dist/html2canvas-pro.cjs.map +1 -0
- package/dist/html2canvas-pro.esm.js +11182 -0
- package/dist/html2canvas-pro.esm.js.map +1 -0
- package/dist/html2canvas-pro.js +11196 -0
- package/dist/html2canvas-pro.js.map +1 -0
- package/dist/html2canvas-pro.min.js +10 -0
- package/dist/lib/config.js +49 -0
- package/dist/lib/core/abort-helper.js +20 -0
- package/dist/lib/core/background-parser.js +41 -0
- package/dist/lib/core/bitwise.js +5 -0
- package/dist/lib/core/cache-storage.js +268 -0
- package/dist/lib/core/config-assembler.js +88 -0
- package/dist/lib/core/constants.js +25 -0
- package/dist/lib/core/context.js +19 -0
- package/dist/lib/core/debugger.js +27 -0
- package/dist/lib/core/features.js +190 -0
- package/dist/lib/core/logger.js +56 -0
- package/dist/lib/core/lru-map.js +66 -0
- package/dist/lib/core/origin-checker.js +53 -0
- package/dist/lib/core/performance-monitor.js +185 -0
- package/dist/lib/core/render-element.js +132 -0
- package/dist/lib/core/util.js +4 -0
- package/dist/lib/core/validator.js +500 -0
- package/dist/lib/css/grouped/background-styles.js +36 -0
- package/dist/lib/css/grouped/border-styles.js +75 -0
- package/dist/lib/css/grouped/font-styles.js +93 -0
- package/dist/lib/css/grouped/layout-styles.js +127 -0
- package/dist/lib/css/index.js +330 -0
- package/dist/lib/css/layout/bounds.js +52 -0
- package/dist/lib/css/layout/text.js +133 -0
- package/dist/lib/css/property-descriptor.js +2 -0
- package/dist/lib/css/property-descriptors/background-blend-mode.js +41 -0
- package/dist/lib/css/property-descriptors/background-clip.js +23 -0
- package/dist/lib/css/property-descriptors/background-color.js +10 -0
- package/dist/lib/css/property-descriptors/background-image.js +24 -0
- package/dist/lib/css/property-descriptors/background-origin.js +23 -0
- package/dist/lib/css/property-descriptors/background-position.js +19 -0
- package/dist/lib/css/property-descriptors/background-repeat.js +33 -0
- package/dist/lib/css/property-descriptors/background-size.js +23 -0
- package/dist/lib/css/property-descriptors/border-color.js +14 -0
- package/dist/lib/css/property-descriptors/border-image-repeat.js +42 -0
- package/dist/lib/css/property-descriptors/border-image-slice.js +45 -0
- package/dist/lib/css/property-descriptors/border-image-source.js +22 -0
- package/dist/lib/css/property-descriptors/border-radius.js +15 -0
- package/dist/lib/css/property-descriptors/border-style.js +26 -0
- package/dist/lib/css/property-descriptors/border-width.js +20 -0
- package/dist/lib/css/property-descriptors/box-decoration-break.js +18 -0
- package/dist/lib/css/property-descriptors/box-shadow.js +54 -0
- package/dist/lib/css/property-descriptors/clip-path.js +189 -0
- package/dist/lib/css/property-descriptors/color.js +10 -0
- package/dist/lib/css/property-descriptors/content.js +19 -0
- package/dist/lib/css/property-descriptors/counter-increment.js +35 -0
- package/dist/lib/css/property-descriptors/counter-reset.js +18 -0
- package/dist/lib/css/property-descriptors/direction.js +18 -0
- package/dist/lib/css/property-descriptors/display.js +81 -0
- package/dist/lib/css/property-descriptors/duration.js +14 -0
- package/dist/lib/css/property-descriptors/filter.js +76 -0
- package/dist/lib/css/property-descriptors/float.js +22 -0
- package/dist/lib/css/property-descriptors/font-family.js +32 -0
- package/dist/lib/css/property-descriptors/font-size.js +10 -0
- package/dist/lib/css/property-descriptors/font-style.js +20 -0
- package/dist/lib/css/property-descriptors/font-variant-ligatures.js +34 -0
- package/dist/lib/css/property-descriptors/font-variant.js +13 -0
- package/dist/lib/css/property-descriptors/font-weight.js +25 -0
- package/dist/lib/css/property-descriptors/image-rendering.js +33 -0
- package/dist/lib/css/property-descriptors/letter-spacing.js +21 -0
- package/dist/lib/css/property-descriptors/line-break.js +23 -0
- package/dist/lib/css/property-descriptors/line-height.js +24 -0
- package/dist/lib/css/property-descriptors/list-style-image.js +17 -0
- package/dist/lib/css/property-descriptors/list-style-position.js +18 -0
- package/dist/lib/css/property-descriptors/list-style-type.js +122 -0
- package/dist/lib/css/property-descriptors/margin.js +13 -0
- package/dist/lib/css/property-descriptors/mix-blend-mode.js +31 -0
- package/dist/lib/css/property-descriptors/object-fit.js +28 -0
- package/dist/lib/css/property-descriptors/object-position.js +42 -0
- package/dist/lib/css/property-descriptors/opacity.js +16 -0
- package/dist/lib/css/property-descriptors/overflow-wrap.js +18 -0
- package/dist/lib/css/property-descriptors/overflow.js +27 -0
- package/dist/lib/css/property-descriptors/padding.js +14 -0
- package/dist/lib/css/property-descriptors/paint-order.js +33 -0
- package/dist/lib/css/property-descriptors/position.js +22 -0
- package/dist/lib/css/property-descriptors/quotes.js +41 -0
- package/dist/lib/css/property-descriptors/rotate.js +27 -0
- package/dist/lib/css/property-descriptors/text-align.js +21 -0
- package/dist/lib/css/property-descriptors/text-decoration-color.js +10 -0
- package/dist/lib/css/property-descriptors/text-decoration-line.js +28 -0
- package/dist/lib/css/property-descriptors/text-decoration-style.js +24 -0
- package/dist/lib/css/property-descriptors/text-decoration-thickness.js +26 -0
- package/dist/lib/css/property-descriptors/text-overflow.js +18 -0
- package/dist/lib/css/property-descriptors/text-shadow.js +46 -0
- package/dist/lib/css/property-descriptors/text-transform.js +20 -0
- package/dist/lib/css/property-descriptors/text-underline-offset.js +23 -0
- package/dist/lib/css/property-descriptors/transform-origin.js +24 -0
- package/dist/lib/css/property-descriptors/transform.js +57 -0
- package/dist/lib/css/property-descriptors/visibility.js +20 -0
- package/dist/lib/css/property-descriptors/webkit-line-clamp.js +26 -0
- package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +10 -0
- package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +16 -0
- package/dist/lib/css/property-descriptors/word-break.js +26 -0
- package/dist/lib/css/property-descriptors/writing-mode.js +28 -0
- package/dist/lib/css/property-descriptors/z-index.js +19 -0
- package/dist/lib/css/property-descriptors/zoom.js +18 -0
- package/dist/lib/css/syntax/parser.js +140 -0
- package/dist/lib/css/syntax/token-constants.js +214 -0
- package/dist/lib/css/syntax/token-singletons.js +36 -0
- package/dist/lib/css/syntax/token-types.js +10 -0
- package/dist/lib/css/syntax/tokenizer.js +502 -0
- package/dist/lib/css/type-descriptor.js +2 -0
- package/dist/lib/css/types/angle.js +80 -0
- package/dist/lib/css/types/color-math.js +25 -0
- package/dist/lib/css/types/color-spaces/a98.js +78 -0
- package/dist/lib/css/types/color-spaces/p3.js +86 -0
- package/dist/lib/css/types/color-spaces/pro-photo.js +83 -0
- package/dist/lib/css/types/color-spaces/rec2020.js +85 -0
- package/dist/lib/css/types/color-spaces/srgb.js +79 -0
- package/dist/lib/css/types/color-utilities.js +342 -0
- package/dist/lib/css/types/color.js +400 -0
- package/dist/lib/css/types/functions/-prefix-linear-gradient.js +32 -0
- package/dist/lib/css/types/functions/-prefix-radial-gradient.js +83 -0
- package/dist/lib/css/types/functions/-webkit-gradient.js +59 -0
- package/dist/lib/css/types/functions/counter.js +367 -0
- package/dist/lib/css/types/functions/gradient.js +163 -0
- package/dist/lib/css/types/functions/linear-gradient.js +27 -0
- package/dist/lib/css/types/functions/radial-gradient.js +90 -0
- package/dist/lib/css/types/functions/repeating-linear-gradient.js +9 -0
- package/dist/lib/css/types/image.js +62 -0
- package/dist/lib/css/types/index.js +2 -0
- package/dist/lib/css/types/length-percentage.js +197 -0
- package/dist/lib/css/types/length.js +5 -0
- package/dist/lib/css/types/safe-eval.js +80 -0
- package/dist/lib/css/types/time.js +17 -0
- package/dist/lib/dom/document-cloner.js +597 -0
- package/dist/lib/dom/dom-normalizer.js +115 -0
- package/dist/lib/dom/element-container.js +56 -0
- package/dist/lib/dom/elements/li-element-container.js +11 -0
- package/dist/lib/dom/elements/ol-element-container.js +12 -0
- package/dist/lib/dom/elements/select-element-container.js +12 -0
- package/dist/lib/dom/elements/textarea-element-container.js +11 -0
- package/dist/lib/dom/node-parser.js +112 -0
- package/dist/lib/dom/node-type-guards.js +81 -0
- package/dist/lib/dom/replaced-elements/canvas-element-container.js +13 -0
- package/dist/lib/dom/replaced-elements/iframe-element-container.js +38 -0
- package/dist/lib/dom/replaced-elements/image-element-container.js +14 -0
- package/dist/lib/dom/replaced-elements/index.js +2 -0
- package/dist/lib/dom/replaced-elements/input-element-container.js +89 -0
- package/dist/lib/dom/replaced-elements/svg-element-container.js +19 -0
- package/dist/lib/dom/slot-cloner.js +176 -0
- package/dist/lib/dom/text-container.js +35 -0
- package/dist/lib/index.js +49 -0
- package/dist/lib/options.js +2 -0
- package/dist/lib/render/background.js +188 -0
- package/dist/lib/render/bezier-curve.js +34 -0
- package/dist/lib/render/border.js +104 -0
- package/dist/lib/render/bound-curves.js +188 -0
- package/dist/lib/render/box-sizing.js +20 -0
- package/dist/lib/render/canvas/background-renderer.js +327 -0
- package/dist/lib/render/canvas/border-image-renderer.js +153 -0
- package/dist/lib/render/canvas/border-renderer.js +184 -0
- package/dist/lib/render/canvas/canvas-path.js +25 -0
- package/dist/lib/render/canvas/canvas-renderer.js +312 -0
- package/dist/lib/render/canvas/content-renderer.js +204 -0
- package/dist/lib/render/canvas/effects-renderer.js +171 -0
- package/dist/lib/render/canvas/font-utils.js +29 -0
- package/dist/lib/render/canvas/foreignobject-renderer.js +38 -0
- package/dist/lib/render/canvas/text/text-decoration-renderer.js +99 -0
- package/dist/lib/render/canvas/text-renderer.js +485 -0
- package/dist/lib/render/effects.js +231 -0
- package/dist/lib/render/font-metrics.js +53 -0
- package/dist/lib/render/object-fit.js +91 -0
- package/dist/lib/render/path.js +26 -0
- package/dist/lib/render/renderer-interface.js +2 -0
- package/dist/lib/render/stacking-context.js +340 -0
- package/dist/lib/render/vector.js +16 -0
- package/dist/types/config.d.ts +44 -0
- package/dist/types/core/abort-helper.d.ts +12 -0
- package/dist/types/core/background-parser.d.ts +16 -0
- package/dist/types/core/bitwise.d.ts +1 -0
- package/dist/types/core/cache-storage.d.ts +68 -0
- package/dist/types/core/config-assembler.d.ts +28 -0
- package/dist/types/core/constants.d.ts +22 -0
- package/dist/types/core/context.d.ts +22 -0
- package/dist/types/core/debugger.d.ts +8 -0
- package/dist/types/core/features.d.ts +12 -0
- package/dist/types/core/logger.d.ts +18 -0
- package/dist/types/core/lru-map.d.ts +37 -0
- package/dist/types/core/origin-checker.d.ts +33 -0
- package/dist/types/core/performance-monitor.d.ts +120 -0
- package/dist/types/core/render-element.d.ts +3 -0
- package/dist/types/core/util.d.ts +1 -0
- package/dist/types/core/validator.d.ts +130 -0
- package/dist/types/css/grouped/background-styles.d.ts +16 -0
- package/dist/types/css/grouped/border-styles.d.ts +31 -0
- package/dist/types/css/grouped/font-styles.d.ts +35 -0
- package/dist/types/css/grouped/layout-styles.d.ts +46 -0
- package/dist/types/css/index.d.ts +185 -0
- package/dist/types/css/layout/bounds.d.ts +14 -0
- package/dist/types/css/layout/text.d.ts +10 -0
- package/dist/types/css/property-descriptor.d.ts +40 -0
- package/dist/types/css/property-descriptors/background-blend-mode.d.ts +23 -0
- package/dist/types/css/property-descriptors/background-clip.d.ts +8 -0
- package/dist/types/css/property-descriptors/background-color.d.ts +2 -0
- package/dist/types/css/property-descriptors/background-image.d.ts +3 -0
- package/dist/types/css/property-descriptors/background-origin.d.ts +8 -0
- package/dist/types/css/property-descriptors/background-position.d.ts +5 -0
- package/dist/types/css/property-descriptors/background-repeat.d.ts +9 -0
- package/dist/types/css/property-descriptors/background-size.d.ts +11 -0
- package/dist/types/css/property-descriptors/border-color.d.ts +5 -0
- package/dist/types/css/property-descriptors/border-image-repeat.d.ts +12 -0
- package/dist/types/css/property-descriptors/border-image-slice.d.ts +10 -0
- package/dist/types/css/property-descriptors/border-image-source.d.ts +4 -0
- package/dist/types/css/property-descriptors/border-radius.d.ts +7 -0
- package/dist/types/css/property-descriptors/border-style.d.ts +12 -0
- package/dist/types/css/property-descriptors/border-width.d.ts +5 -0
- package/dist/types/css/property-descriptors/box-decoration-break.d.ts +6 -0
- package/dist/types/css/property-descriptors/box-shadow.d.ts +14 -0
- package/dist/types/css/property-descriptors/clip-path.d.ts +62 -0
- package/dist/types/css/property-descriptors/color.d.ts +2 -0
- package/dist/types/css/property-descriptors/content.d.ts +4 -0
- package/dist/types/css/property-descriptors/counter-increment.d.ts +10 -0
- package/dist/types/css/property-descriptors/counter-reset.d.ts +7 -0
- package/dist/types/css/property-descriptors/direction.d.ts +6 -0
- package/dist/types/css/property-descriptors/display.d.ts +35 -0
- package/dist/types/css/property-descriptors/duration.d.ts +2 -0
- package/dist/types/css/property-descriptors/filter.d.ts +3 -0
- package/dist/types/css/property-descriptors/float.d.ts +9 -0
- package/dist/types/css/property-descriptors/font-family.d.ts +4 -0
- package/dist/types/css/property-descriptors/font-size.d.ts +2 -0
- package/dist/types/css/property-descriptors/font-style.d.ts +7 -0
- package/dist/types/css/property-descriptors/font-variant-ligatures.d.ts +14 -0
- package/dist/types/css/property-descriptors/font-variant.d.ts +2 -0
- package/dist/types/css/property-descriptors/font-weight.d.ts +2 -0
- package/dist/types/css/property-descriptors/image-rendering.d.ts +8 -0
- package/dist/types/css/property-descriptors/letter-spacing.d.ts +2 -0
- package/dist/types/css/property-descriptors/line-break.d.ts +6 -0
- package/dist/types/css/property-descriptors/line-height.d.ts +4 -0
- package/dist/types/css/property-descriptors/list-style-image.d.ts +3 -0
- package/dist/types/css/property-descriptors/list-style-position.d.ts +6 -0
- package/dist/types/css/property-descriptors/list-style-type.d.ts +58 -0
- package/dist/types/css/property-descriptors/margin.d.ts +5 -0
- package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +21 -0
- package/dist/types/css/property-descriptors/object-fit.d.ts +10 -0
- package/dist/types/css/property-descriptors/object-position.d.ts +4 -0
- package/dist/types/css/property-descriptors/opacity.d.ts +2 -0
- package/dist/types/css/property-descriptors/overflow-wrap.d.ts +6 -0
- package/dist/types/css/property-descriptors/overflow.d.ts +9 -0
- package/dist/types/css/property-descriptors/padding.d.ts +5 -0
- package/dist/types/css/property-descriptors/paint-order.d.ts +8 -0
- package/dist/types/css/property-descriptors/position.d.ts +9 -0
- package/dist/types/css/property-descriptors/quotes.d.ts +8 -0
- package/dist/types/css/property-descriptors/rotate.d.ts +3 -0
- package/dist/types/css/property-descriptors/text-align.d.ts +7 -0
- package/dist/types/css/property-descriptors/text-decoration-color.d.ts +2 -0
- package/dist/types/css/property-descriptors/text-decoration-line.d.ts +10 -0
- package/dist/types/css/property-descriptors/text-decoration-style.d.ts +9 -0
- package/dist/types/css/property-descriptors/text-decoration-thickness.d.ts +3 -0
- package/dist/types/css/property-descriptors/text-overflow.d.ts +6 -0
- package/dist/types/css/property-descriptors/text-shadow.d.ts +12 -0
- package/dist/types/css/property-descriptors/text-transform.d.ts +8 -0
- package/dist/types/css/property-descriptors/text-underline-offset.d.ts +3 -0
- package/dist/types/css/property-descriptors/transform-origin.d.ts +4 -0
- package/dist/types/css/property-descriptors/transform.d.ts +4 -0
- package/dist/types/css/property-descriptors/visibility.d.ts +7 -0
- package/dist/types/css/property-descriptors/webkit-line-clamp.d.ts +7 -0
- package/dist/types/css/property-descriptors/webkit-text-stroke-color.d.ts +2 -0
- package/dist/types/css/property-descriptors/webkit-text-stroke-width.d.ts +2 -0
- package/dist/types/css/property-descriptors/word-break.d.ts +7 -0
- package/dist/types/css/property-descriptors/writing-mode.d.ts +11 -0
- package/dist/types/css/property-descriptors/z-index.d.ts +7 -0
- package/dist/types/css/property-descriptors/zoom.d.ts +3 -0
- package/dist/types/css/syntax/parser.d.ts +34 -0
- package/dist/types/css/syntax/token-constants.d.ts +74 -0
- package/dist/types/css/syntax/token-singletons.d.ts +22 -0
- package/dist/types/css/syntax/token-types.d.ts +72 -0
- package/dist/types/css/syntax/tokenizer.d.ts +32 -0
- package/dist/types/css/type-descriptor.d.ts +6 -0
- package/dist/types/css/types/angle.d.ts +7 -0
- package/dist/types/css/types/color-math.d.ts +12 -0
- package/dist/types/css/types/color-spaces/a98.d.ts +39 -0
- package/dist/types/css/types/color-spaces/p3.d.ts +45 -0
- package/dist/types/css/types/color-spaces/pro-photo.d.ts +45 -0
- package/dist/types/css/types/color-spaces/rec2020.d.ts +45 -0
- package/dist/types/css/types/color-spaces/srgb.d.ts +38 -0
- package/dist/types/css/types/color-utilities.d.ts +107 -0
- package/dist/types/css/types/color.d.ts +8 -0
- package/dist/types/css/types/functions/-prefix-linear-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/-prefix-radial-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/-webkit-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/counter.d.ts +10 -0
- package/dist/types/css/types/functions/gradient.d.ts +7 -0
- package/dist/types/css/types/functions/linear-gradient.d.ts +4 -0
- package/dist/types/css/types/functions/radial-gradient.d.ts +12 -0
- package/dist/types/css/types/functions/repeating-linear-gradient.d.ts +4 -0
- package/dist/types/css/types/image.d.ts +56 -0
- package/dist/types/css/types/index.d.ts +1 -0
- package/dist/types/css/types/length-percentage.d.ts +62 -0
- package/dist/types/css/types/length.d.ts +4 -0
- package/dist/types/css/types/safe-eval.d.ts +8 -0
- package/dist/types/css/types/time.d.ts +2 -0
- package/dist/types/dom/document-cloner.d.ts +57 -0
- package/dist/types/dom/dom-normalizer.d.ts +62 -0
- package/dist/types/dom/element-container.d.ts +31 -0
- package/dist/types/dom/elements/li-element-container.d.ts +6 -0
- package/dist/types/dom/elements/ol-element-container.d.ts +7 -0
- package/dist/types/dom/elements/select-element-container.d.ts +6 -0
- package/dist/types/dom/elements/textarea-element-container.d.ts +6 -0
- package/dist/types/dom/node-parser.d.ts +3 -0
- package/dist/types/dom/node-type-guards.d.ts +32 -0
- package/dist/types/dom/replaced-elements/canvas-element-container.d.ts +8 -0
- package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +14 -0
- package/dist/types/dom/replaced-elements/image-element-container.d.ts +8 -0
- package/dist/types/dom/replaced-elements/index.d.ts +4 -0
- package/dist/types/dom/replaced-elements/input-element-container.d.ts +14 -0
- package/dist/types/dom/replaced-elements/svg-element-container.d.ts +8 -0
- package/dist/types/dom/slot-cloner.d.ts +66 -0
- package/dist/types/dom/text-container.d.ts +8 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/options.d.ts +62 -0
- package/dist/types/render/background.d.ts +16 -0
- package/dist/types/render/bezier-curve.d.ts +14 -0
- package/dist/types/render/border.d.ts +6 -0
- package/dist/types/render/bound-curves.d.ts +32 -0
- package/dist/types/render/box-sizing.d.ts +4 -0
- package/dist/types/render/canvas/background-renderer.d.ts +94 -0
- package/dist/types/render/canvas/border-image-renderer.d.ts +18 -0
- package/dist/types/render/canvas/border-renderer.d.ts +67 -0
- package/dist/types/render/canvas/canvas-path.d.ts +3 -0
- package/dist/types/render/canvas/canvas-renderer.d.ts +60 -0
- package/dist/types/render/canvas/content-renderer.d.ts +43 -0
- package/dist/types/render/canvas/effects-renderer.d.ts +90 -0
- package/dist/types/render/canvas/font-utils.d.ts +19 -0
- package/dist/types/render/canvas/foreignobject-renderer.d.ts +10 -0
- package/dist/types/render/canvas/text/text-decoration-renderer.d.ts +18 -0
- package/dist/types/render/canvas/text-renderer.d.ts +103 -0
- package/dist/types/render/effects.d.ts +112 -0
- package/dist/types/render/font-metrics.d.ts +11 -0
- package/dist/types/render/object-fit.d.ts +19 -0
- package/dist/types/render/path.d.ts +13 -0
- package/dist/types/render/renderer-interface.d.ts +28 -0
- package/dist/types/render/stacking-context.d.ts +49 -0
- package/dist/types/render/vector.d.ts +9 -0
- package/package.json +139 -4
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundBlendMode = exports.MIX_BLEND_MODE = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
exports.MIX_BLEND_MODE = {
|
|
6
|
+
NORMAL: 'normal',
|
|
7
|
+
MULTIPLY: 'multiply',
|
|
8
|
+
SCREEN: 'screen',
|
|
9
|
+
OVERLAY: 'overlay',
|
|
10
|
+
DARKEN: 'darken',
|
|
11
|
+
LIGHTEN: 'lighten',
|
|
12
|
+
COLOR_DODGE: 'color-dodge',
|
|
13
|
+
COLOR_BURN: 'color-burn',
|
|
14
|
+
HARD_LIGHT: 'hard-light',
|
|
15
|
+
SOFT_LIGHT: 'soft-light',
|
|
16
|
+
DIFFERENCE: 'difference',
|
|
17
|
+
EXCLUSION: 'exclusion',
|
|
18
|
+
HUE: 'hue',
|
|
19
|
+
SATURATION: 'saturation',
|
|
20
|
+
COLOR: 'color',
|
|
21
|
+
LUMINOSITY: 'luminosity'
|
|
22
|
+
};
|
|
23
|
+
const VALID_VALUES = new Set(Object.values(exports.MIX_BLEND_MODE));
|
|
24
|
+
exports.backgroundBlendMode = {
|
|
25
|
+
name: 'background-blend-mode',
|
|
26
|
+
initialValue: 'normal',
|
|
27
|
+
prefix: false,
|
|
28
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
29
|
+
parse: (_context, tokens) => {
|
|
30
|
+
const modes = [];
|
|
31
|
+
const filtered = tokens.filter(parser_1.nonFunctionArgSeparator);
|
|
32
|
+
for (const token of filtered) {
|
|
33
|
+
if ((0, parser_1.isIdentToken)(token)) {
|
|
34
|
+
if (VALID_VALUES.has(token.value)) {
|
|
35
|
+
modes.push(token.value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return modes.length > 0 ? modes : ['normal'];
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundClip = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
exports.backgroundClip = {
|
|
6
|
+
name: 'background-clip',
|
|
7
|
+
initialValue: 'border-box',
|
|
8
|
+
prefix: false,
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
parse: (_context, tokens) => {
|
|
11
|
+
return tokens.map((token) => {
|
|
12
|
+
if ((0, parser_1.isIdentToken)(token)) {
|
|
13
|
+
switch (token.value) {
|
|
14
|
+
case 'padding-box':
|
|
15
|
+
return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
|
|
16
|
+
case 'content-box':
|
|
17
|
+
return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundColor = void 0;
|
|
4
|
+
exports.backgroundColor = {
|
|
5
|
+
name: `background-color`,
|
|
6
|
+
initialValue: 'transparent',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
9
|
+
format: 'color'
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundImage = void 0;
|
|
4
|
+
const image_1 = require("../types/image");
|
|
5
|
+
const parser_1 = require("../syntax/parser");
|
|
6
|
+
exports.backgroundImage = {
|
|
7
|
+
name: 'background-image',
|
|
8
|
+
initialValue: 'none',
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
prefix: false,
|
|
11
|
+
skipCache: true,
|
|
12
|
+
parse: (context, tokens) => {
|
|
13
|
+
if (tokens.length === 0) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const first = tokens[0];
|
|
17
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
return tokens
|
|
21
|
+
.filter((value) => (0, parser_1.nonFunctionArgSeparator)(value) && (0, image_1.isSupportedImage)(value))
|
|
22
|
+
.map((value) => image_1.image.parse(context, value));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundOrigin = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
exports.backgroundOrigin = {
|
|
6
|
+
name: 'background-origin',
|
|
7
|
+
initialValue: 'border-box',
|
|
8
|
+
prefix: false,
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
parse: (_context, tokens) => {
|
|
11
|
+
return tokens.map((token) => {
|
|
12
|
+
if ((0, parser_1.isIdentToken)(token)) {
|
|
13
|
+
switch (token.value) {
|
|
14
|
+
case 'padding-box':
|
|
15
|
+
return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
|
|
16
|
+
case 'content-box':
|
|
17
|
+
return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundPosition = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
+
exports.backgroundPosition = {
|
|
7
|
+
name: 'background-position',
|
|
8
|
+
initialValue: '0% 0%',
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
prefix: false,
|
|
11
|
+
parse: (_context, tokens) => {
|
|
12
|
+
return (0, parser_1.parseFunctionArgs)(tokens)
|
|
13
|
+
.map((values) => {
|
|
14
|
+
// Convert calc() to length-percentage tokens, keep other length-percentage as is
|
|
15
|
+
return values.map(length_percentage_1.parseOptionalCalcOrLength).filter((v) => v !== null);
|
|
16
|
+
})
|
|
17
|
+
.map(length_percentage_1.parseLengthPercentageTuple);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundRepeat = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
exports.backgroundRepeat = {
|
|
6
|
+
name: 'background-repeat',
|
|
7
|
+
initialValue: 'repeat',
|
|
8
|
+
prefix: false,
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
parse: (_context, tokens) => {
|
|
11
|
+
return (0, parser_1.parseFunctionArgs)(tokens)
|
|
12
|
+
.map((values) => values
|
|
13
|
+
.filter(parser_1.isIdentToken)
|
|
14
|
+
.map((token) => token.value)
|
|
15
|
+
.join(' '))
|
|
16
|
+
.map(parseBackgroundRepeat);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const parseBackgroundRepeat = (value) => {
|
|
20
|
+
switch (value) {
|
|
21
|
+
case 'no-repeat':
|
|
22
|
+
return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
|
|
23
|
+
case 'repeat-x':
|
|
24
|
+
case 'repeat no-repeat':
|
|
25
|
+
return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
|
|
26
|
+
case 'repeat-y':
|
|
27
|
+
case 'no-repeat repeat':
|
|
28
|
+
return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
|
|
29
|
+
case 'repeat':
|
|
30
|
+
default:
|
|
31
|
+
return 0 /* BACKGROUND_REPEAT.REPEAT */;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.backgroundSize = exports.BACKGROUND_SIZE = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
+
var BACKGROUND_SIZE;
|
|
7
|
+
(function (BACKGROUND_SIZE) {
|
|
8
|
+
BACKGROUND_SIZE["AUTO"] = "auto";
|
|
9
|
+
BACKGROUND_SIZE["CONTAIN"] = "contain";
|
|
10
|
+
BACKGROUND_SIZE["COVER"] = "cover";
|
|
11
|
+
})(BACKGROUND_SIZE || (exports.BACKGROUND_SIZE = BACKGROUND_SIZE = {}));
|
|
12
|
+
exports.backgroundSize = {
|
|
13
|
+
name: 'background-size',
|
|
14
|
+
initialValue: '0',
|
|
15
|
+
prefix: false,
|
|
16
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
17
|
+
parse: (_context, tokens) => {
|
|
18
|
+
return (0, parser_1.parseFunctionArgs)(tokens).map((values) => values
|
|
19
|
+
.map((value) => (isBackgroundSizeInfoToken(value) ? value : (0, length_percentage_1.parseOptionalCalcOrLength)(value)))
|
|
20
|
+
.filter((v) => v !== null));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const isBackgroundSizeInfoToken = (value) => (0, parser_1.isIdentToken)(value) || (0, length_percentage_1.isLengthPercentage)(value);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderLeftColor = exports.borderBottomColor = exports.borderRightColor = exports.borderTopColor = void 0;
|
|
4
|
+
const borderColorForSide = (side) => ({
|
|
5
|
+
name: `border-${side}-color`,
|
|
6
|
+
initialValue: 'transparent',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
9
|
+
format: 'color'
|
|
10
|
+
});
|
|
11
|
+
exports.borderTopColor = borderColorForSide('top');
|
|
12
|
+
exports.borderRightColor = borderColorForSide('right');
|
|
13
|
+
exports.borderBottomColor = borderColorForSide('bottom');
|
|
14
|
+
exports.borderLeftColor = borderColorForSide('left');
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderImageRepeat = exports.BORDER_IMAGE_REPEAT = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
var BORDER_IMAGE_REPEAT;
|
|
6
|
+
(function (BORDER_IMAGE_REPEAT) {
|
|
7
|
+
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["STRETCH"] = 0] = "STRETCH";
|
|
8
|
+
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["REPEAT"] = 1] = "REPEAT";
|
|
9
|
+
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["ROUND"] = 2] = "ROUND";
|
|
10
|
+
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["SPACE"] = 3] = "SPACE";
|
|
11
|
+
})(BORDER_IMAGE_REPEAT || (exports.BORDER_IMAGE_REPEAT = BORDER_IMAGE_REPEAT = {}));
|
|
12
|
+
const parseRepeatValue = (value) => {
|
|
13
|
+
switch (value) {
|
|
14
|
+
case 'repeat':
|
|
15
|
+
return BORDER_IMAGE_REPEAT.REPEAT;
|
|
16
|
+
case 'round':
|
|
17
|
+
return BORDER_IMAGE_REPEAT.ROUND;
|
|
18
|
+
case 'space':
|
|
19
|
+
return BORDER_IMAGE_REPEAT.SPACE;
|
|
20
|
+
case 'stretch':
|
|
21
|
+
default:
|
|
22
|
+
return BORDER_IMAGE_REPEAT.STRETCH;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.borderImageRepeat = {
|
|
26
|
+
name: 'border-image-repeat',
|
|
27
|
+
initialValue: 'stretch',
|
|
28
|
+
prefix: false,
|
|
29
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
30
|
+
parse: (_context, tokens) => {
|
|
31
|
+
const filtered = tokens.filter(parser_1.nonWhiteSpace);
|
|
32
|
+
const values = [];
|
|
33
|
+
for (const token of filtered) {
|
|
34
|
+
if ((0, parser_1.isIdentToken)(token)) {
|
|
35
|
+
values.push(parseRepeatValue(token.value));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const horizontal = values[0] ?? BORDER_IMAGE_REPEAT.STRETCH;
|
|
39
|
+
const vertical = values[1] ?? horizontal;
|
|
40
|
+
return { horizontal, vertical };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderImageSlice = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const fillSides = (sides) => {
|
|
6
|
+
const result = [...sides];
|
|
7
|
+
if (result.length === 1) {
|
|
8
|
+
result.push(result[0], result[0], result[0]);
|
|
9
|
+
}
|
|
10
|
+
else if (result.length === 2) {
|
|
11
|
+
result.push(result[0], result[1]);
|
|
12
|
+
}
|
|
13
|
+
else if (result.length === 3) {
|
|
14
|
+
result.push(result[1]);
|
|
15
|
+
}
|
|
16
|
+
return result.slice(0, 4);
|
|
17
|
+
};
|
|
18
|
+
exports.borderImageSlice = {
|
|
19
|
+
name: 'border-image-slice',
|
|
20
|
+
initialValue: '100%',
|
|
21
|
+
prefix: false,
|
|
22
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
23
|
+
parse: (_context, tokens) => {
|
|
24
|
+
const filtered = tokens.filter(parser_1.nonWhiteSpace);
|
|
25
|
+
const values = [];
|
|
26
|
+
let fill = false;
|
|
27
|
+
let unit = 'percent';
|
|
28
|
+
for (const token of filtered) {
|
|
29
|
+
if ((0, parser_1.isIdentToken)(token) && token.value === 'fill') {
|
|
30
|
+
fill = true;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
34
|
+
values.push(token.number);
|
|
35
|
+
unit = 'number';
|
|
36
|
+
}
|
|
37
|
+
else if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
38
|
+
values.push(token.number);
|
|
39
|
+
unit = 'percent';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const [top, right, bottom, left] = fillSides(values.length > 0 ? values : [100]);
|
|
43
|
+
return { top, right, bottom, left, fill, unit };
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderImageSource = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const image_1 = require("../types/image");
|
|
6
|
+
exports.borderImageSource = {
|
|
7
|
+
name: 'border-image-source',
|
|
8
|
+
initialValue: 'none',
|
|
9
|
+
prefix: false,
|
|
10
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
11
|
+
skipCache: true,
|
|
12
|
+
parse: (context, tokens) => {
|
|
13
|
+
if (tokens.length === 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const filtered = tokens.filter((t) => (0, parser_1.nonFunctionArgSeparator)(t) && (0, image_1.isSupportedImage)(t));
|
|
17
|
+
if (filtered.length === 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return image_1.image.parse(context, filtered[0]);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderBottomLeftRadius = exports.borderBottomRightRadius = exports.borderTopRightRadius = exports.borderTopLeftRadius = void 0;
|
|
4
|
+
const length_percentage_1 = require("../types/length-percentage");
|
|
5
|
+
const borderRadiusForSide = (side) => ({
|
|
6
|
+
name: `border-${side}-radius`,
|
|
7
|
+
initialValue: '0 0',
|
|
8
|
+
prefix: false,
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
parse: (_context, tokens) => (0, length_percentage_1.parseLengthPercentageTuple)(tokens.filter(length_percentage_1.isLengthPercentage))
|
|
11
|
+
});
|
|
12
|
+
exports.borderTopLeftRadius = borderRadiusForSide('top-left');
|
|
13
|
+
exports.borderTopRightRadius = borderRadiusForSide('top-right');
|
|
14
|
+
exports.borderBottomRightRadius = borderRadiusForSide('bottom-right');
|
|
15
|
+
exports.borderBottomLeftRadius = borderRadiusForSide('bottom-left');
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderLeftStyle = exports.borderBottomStyle = exports.borderRightStyle = exports.borderTopStyle = void 0;
|
|
4
|
+
const borderStyleForSide = (side) => ({
|
|
5
|
+
name: `border-${side}-style`,
|
|
6
|
+
initialValue: 'solid',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
+
parse: (_context, style) => {
|
|
10
|
+
switch (style) {
|
|
11
|
+
case 'none':
|
|
12
|
+
return 0 /* BORDER_STYLE.NONE */;
|
|
13
|
+
case 'dashed':
|
|
14
|
+
return 2 /* BORDER_STYLE.DASHED */;
|
|
15
|
+
case 'dotted':
|
|
16
|
+
return 3 /* BORDER_STYLE.DOTTED */;
|
|
17
|
+
case 'double':
|
|
18
|
+
return 4 /* BORDER_STYLE.DOUBLE */;
|
|
19
|
+
}
|
|
20
|
+
return 1 /* BORDER_STYLE.SOLID */;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
exports.borderTopStyle = borderStyleForSide('top');
|
|
24
|
+
exports.borderRightStyle = borderStyleForSide('right');
|
|
25
|
+
exports.borderBottomStyle = borderStyleForSide('bottom');
|
|
26
|
+
exports.borderLeftStyle = borderStyleForSide('left');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.borderLeftWidth = exports.borderBottomWidth = exports.borderRightWidth = exports.borderTopWidth = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const borderWidthForSide = (side) => ({
|
|
6
|
+
name: `border-${side}-width`,
|
|
7
|
+
initialValue: '0',
|
|
8
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
9
|
+
prefix: false,
|
|
10
|
+
parse: (_context, token) => {
|
|
11
|
+
if ((0, parser_1.isDimensionToken)(token)) {
|
|
12
|
+
return token.number;
|
|
13
|
+
}
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
exports.borderTopWidth = borderWidthForSide('top');
|
|
18
|
+
exports.borderRightWidth = borderWidthForSide('right');
|
|
19
|
+
exports.borderBottomWidth = borderWidthForSide('bottom');
|
|
20
|
+
exports.borderLeftWidth = borderWidthForSide('left');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.boxDecorationBreak = void 0;
|
|
4
|
+
exports.boxDecorationBreak = {
|
|
5
|
+
name: 'box-decoration-break',
|
|
6
|
+
initialValue: 'slice',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
+
parse: (_context, token) => {
|
|
10
|
+
switch (token) {
|
|
11
|
+
case 'clone':
|
|
12
|
+
return 1 /* BOX_DECORATION_BREAK.CLONE */;
|
|
13
|
+
case 'slice':
|
|
14
|
+
default:
|
|
15
|
+
return 0 /* BOX_DECORATION_BREAK.SLICE */;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.boxShadow = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
+
const color_1 = require("../types/color");
|
|
7
|
+
const length_1 = require("../types/length");
|
|
8
|
+
exports.boxShadow = {
|
|
9
|
+
name: 'box-shadow',
|
|
10
|
+
initialValue: 'none',
|
|
11
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
12
|
+
prefix: false,
|
|
13
|
+
parse: (context, tokens) => {
|
|
14
|
+
if (tokens.length === 1 && (0, parser_1.isIdentWithValue)(tokens[0], 'none')) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return (0, parser_1.parseFunctionArgs)(tokens).map((values) => {
|
|
18
|
+
const shadow = {
|
|
19
|
+
color: 0x000000ff,
|
|
20
|
+
offsetX: length_percentage_1.ZERO_LENGTH,
|
|
21
|
+
offsetY: length_percentage_1.ZERO_LENGTH,
|
|
22
|
+
blur: length_percentage_1.ZERO_LENGTH,
|
|
23
|
+
spread: length_percentage_1.ZERO_LENGTH,
|
|
24
|
+
inset: false
|
|
25
|
+
};
|
|
26
|
+
let c = 0;
|
|
27
|
+
for (let i = 0; i < values.length; i++) {
|
|
28
|
+
const token = values[i];
|
|
29
|
+
if ((0, parser_1.isIdentWithValue)(token, 'inset')) {
|
|
30
|
+
shadow.inset = true;
|
|
31
|
+
}
|
|
32
|
+
else if ((0, length_1.isLength)(token)) {
|
|
33
|
+
if (c === 0) {
|
|
34
|
+
shadow.offsetX = token;
|
|
35
|
+
}
|
|
36
|
+
else if (c === 1) {
|
|
37
|
+
shadow.offsetY = token;
|
|
38
|
+
}
|
|
39
|
+
else if (c === 2) {
|
|
40
|
+
shadow.blur = token;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
shadow.spread = token;
|
|
44
|
+
}
|
|
45
|
+
c++;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
shadow.color = color_1.color.parse(context, token);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return shadow;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clipPath = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
+
const NONE = { type: 0 /* CLIP_PATH_TYPE.NONE */ };
|
|
7
|
+
/**
|
|
8
|
+
* Parse a shape-radius token: <length-percentage> | closest-side | farthest-side.
|
|
9
|
+
* Defaults to 'closest-side' when no tokens are provided.
|
|
10
|
+
*/
|
|
11
|
+
const parseShapeRadius = (tokens) => {
|
|
12
|
+
const [first] = tokens;
|
|
13
|
+
if (!first)
|
|
14
|
+
return 'closest-side';
|
|
15
|
+
if ((0, parser_1.isIdentToken)(first)) {
|
|
16
|
+
// Any unrecognised keyword (e.g. 'closest-corner') intentionally falls back to
|
|
17
|
+
// 'closest-side' as the CSS spec requires unknown values to be treated as invalid
|
|
18
|
+
// and the initial value of <shape-radius> is 'closest-side'.
|
|
19
|
+
return first.value === 'farthest-side' ? 'farthest-side' : 'closest-side';
|
|
20
|
+
}
|
|
21
|
+
return (0, length_percentage_1.isLengthPercentage)(first) ? first : 'closest-side';
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Parse a CSS <position> as (cx, cy), each as a LengthPercentage.
|
|
25
|
+
*
|
|
26
|
+
* Supports the **1–2 value** subset of the CSS `<position>` syntax.
|
|
27
|
+
* The 4-value form (`at left 10px top 20px`) is not supported and will be
|
|
28
|
+
* parsed on a best-effort basis.
|
|
29
|
+
*
|
|
30
|
+
* Axis assignment rules:
|
|
31
|
+
* - `left` / `right` → x-axis (cx)
|
|
32
|
+
* - `top` / `bottom` → y-axis (cy)
|
|
33
|
+
* - `center` or a <length-percentage> → fills the first unset axis, in order
|
|
34
|
+
*
|
|
35
|
+
* Examples:
|
|
36
|
+
* "at left" → cx=0, cy=50% (left is x; y defaults to center)
|
|
37
|
+
* "at top" → cx=50%, cy=0 (top is y; x defaults to center)
|
|
38
|
+
* "at center 30%" → cx=50%, cy=30%
|
|
39
|
+
* "at 30% center" → cx=30%, cy=50%
|
|
40
|
+
* "at left top" → cx=0, cy=0
|
|
41
|
+
* "at top left" → cx=0, cy=0 (keyword order is irrelevant)
|
|
42
|
+
*
|
|
43
|
+
* Unset axes fall back to 50%.
|
|
44
|
+
*/
|
|
45
|
+
const parsePosition = (tokens) => {
|
|
46
|
+
let cx = null;
|
|
47
|
+
let cy = null;
|
|
48
|
+
for (const token of tokens) {
|
|
49
|
+
if ((0, parser_1.isIdentToken)(token)) {
|
|
50
|
+
switch (token.value) {
|
|
51
|
+
case 'left':
|
|
52
|
+
cx = length_percentage_1.ZERO_LENGTH;
|
|
53
|
+
break;
|
|
54
|
+
case 'right':
|
|
55
|
+
cx = length_percentage_1.HUNDRED_PERCENT;
|
|
56
|
+
break;
|
|
57
|
+
case 'top':
|
|
58
|
+
cy = length_percentage_1.ZERO_LENGTH;
|
|
59
|
+
break;
|
|
60
|
+
case 'bottom':
|
|
61
|
+
cy = length_percentage_1.HUNDRED_PERCENT;
|
|
62
|
+
break;
|
|
63
|
+
case 'center':
|
|
64
|
+
// `center` fills whichever axis has not yet been claimed.
|
|
65
|
+
if (cx === null)
|
|
66
|
+
cx = length_percentage_1.FIFTY_PERCENT;
|
|
67
|
+
else if (cy === null)
|
|
68
|
+
cy = length_percentage_1.FIFTY_PERCENT;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if ((0, length_percentage_1.isLengthPercentage)(token)) {
|
|
73
|
+
// Length-percentages are assigned in source order.
|
|
74
|
+
if (cx === null)
|
|
75
|
+
cx = token;
|
|
76
|
+
else if (cy === null)
|
|
77
|
+
cy = token;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { cx: cx ?? length_percentage_1.FIFTY_PERCENT, cy: cy ?? length_percentage_1.FIFTY_PERCENT };
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )
|
|
84
|
+
* The 1-4 shorthand follows the same expansion as margin/padding:
|
|
85
|
+
* 1 value → all four sides
|
|
86
|
+
* 2 values → top/bottom | left/right
|
|
87
|
+
* 3 values → top | left/right | bottom
|
|
88
|
+
* 4 values → top | right | bottom | left
|
|
89
|
+
* The optional `round` clause (border-radius) is parsed but ignored.
|
|
90
|
+
*/
|
|
91
|
+
const parseInset = (values) => {
|
|
92
|
+
const lengths = [];
|
|
93
|
+
for (const token of values) {
|
|
94
|
+
if (token.type === 31 /* TokenType.WHITESPACE_TOKEN */)
|
|
95
|
+
continue;
|
|
96
|
+
if ((0, parser_1.isIdentToken)(token) && token.value === 'round')
|
|
97
|
+
break;
|
|
98
|
+
if ((0, length_percentage_1.isLengthPercentage)(token))
|
|
99
|
+
lengths.push(token);
|
|
100
|
+
}
|
|
101
|
+
const v0 = lengths[0] ?? length_percentage_1.ZERO_LENGTH;
|
|
102
|
+
const v1 = lengths[1] ?? v0;
|
|
103
|
+
const v2 = lengths[2] ?? v0;
|
|
104
|
+
const v3 = lengths[3] ?? v1;
|
|
105
|
+
return { type: 1 /* CLIP_PATH_TYPE.INSET */, top: v0, right: v1, bottom: v2, left: v3 };
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* circle( [ <shape-radius> ]? [ at <position> ]? )
|
|
109
|
+
*/
|
|
110
|
+
const parseCircle = (values) => {
|
|
111
|
+
const nonWs = values.filter(parser_1.nonWhiteSpace);
|
|
112
|
+
const atIdx = nonWs.findIndex((t) => (0, parser_1.isIdentWithValue)(t, 'at'));
|
|
113
|
+
const radiusTokens = atIdx === -1 ? nonWs : nonWs.slice(0, atIdx);
|
|
114
|
+
const posTokens = atIdx === -1 ? [] : nonWs.slice(atIdx + 1);
|
|
115
|
+
return {
|
|
116
|
+
type: 2 /* CLIP_PATH_TYPE.CIRCLE */,
|
|
117
|
+
radius: parseShapeRadius(radiusTokens),
|
|
118
|
+
...parsePosition(posTokens)
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )
|
|
123
|
+
*/
|
|
124
|
+
const parseEllipse = (values) => {
|
|
125
|
+
const nonWs = values.filter(parser_1.nonWhiteSpace);
|
|
126
|
+
const atIdx = nonWs.findIndex((t) => (0, parser_1.isIdentWithValue)(t, 'at'));
|
|
127
|
+
const radiusTokens = atIdx === -1 ? nonWs : nonWs.slice(0, atIdx);
|
|
128
|
+
const posTokens = atIdx === -1 ? [] : nonWs.slice(atIdx + 1);
|
|
129
|
+
return {
|
|
130
|
+
type: 3 /* CLIP_PATH_TYPE.ELLIPSE */,
|
|
131
|
+
rx: parseShapeRadius(radiusTokens.slice(0, 1)),
|
|
132
|
+
ry: parseShapeRadius(radiusTokens.slice(1, 2)),
|
|
133
|
+
...parsePosition(posTokens)
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* polygon( [ <fill-rule>, ]? [ <length-percentage> <length-percentage> ]# )
|
|
138
|
+
* Each comma-separated group defines one vertex (x y).
|
|
139
|
+
* A leading fill-rule keyword (nonzero/evenodd) is skipped.
|
|
140
|
+
*/
|
|
141
|
+
const parsePolygon = (values) => {
|
|
142
|
+
const args = (0, parser_1.parseFunctionArgs)(values);
|
|
143
|
+
const points = [];
|
|
144
|
+
for (const arg of args) {
|
|
145
|
+
if (arg.length === 1 && (0, parser_1.isIdentToken)(arg[0]))
|
|
146
|
+
continue; // skip fill-rule
|
|
147
|
+
const lengths = arg.filter(length_percentage_1.isLengthPercentage);
|
|
148
|
+
if (lengths.length >= 2) {
|
|
149
|
+
points.push([lengths[0], lengths[1]]);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return { type: 4 /* CLIP_PATH_TYPE.POLYGON */, points };
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* path( [ <fill-rule>, ]? <string> )
|
|
156
|
+
* The string value is the SVG path data (coordinates in the element's local space).
|
|
157
|
+
*/
|
|
158
|
+
const parsePath = (values) => {
|
|
159
|
+
const stringToken = values.find((t) => t.type === 0 /* TokenType.STRING_TOKEN */);
|
|
160
|
+
if (!stringToken)
|
|
161
|
+
return NONE;
|
|
162
|
+
return { type: 5 /* CLIP_PATH_TYPE.PATH */, d: stringToken.value };
|
|
163
|
+
};
|
|
164
|
+
exports.clipPath = {
|
|
165
|
+
name: 'clip-path',
|
|
166
|
+
initialValue: 'none',
|
|
167
|
+
prefix: false,
|
|
168
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
169
|
+
parse: (_context, token) => {
|
|
170
|
+
if ((0, parser_1.isIdentToken)(token) && token.value === 'none') {
|
|
171
|
+
return NONE;
|
|
172
|
+
}
|
|
173
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
174
|
+
switch (token.name) {
|
|
175
|
+
case 'inset':
|
|
176
|
+
return parseInset(token.values);
|
|
177
|
+
case 'circle':
|
|
178
|
+
return parseCircle(token.values);
|
|
179
|
+
case 'ellipse':
|
|
180
|
+
return parseEllipse(token.values);
|
|
181
|
+
case 'polygon':
|
|
182
|
+
return parsePolygon(token.values);
|
|
183
|
+
case 'path':
|
|
184
|
+
return parsePath(token.values);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return NONE;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.color = void 0;
|
|
4
|
+
exports.color = {
|
|
5
|
+
name: `color`,
|
|
6
|
+
initialValue: 'transparent',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
9
|
+
format: 'color'
|
|
10
|
+
};
|