@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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.content = void 0;
|
|
4
|
+
exports.content = {
|
|
5
|
+
name: 'content',
|
|
6
|
+
initialValue: 'none',
|
|
7
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
8
|
+
prefix: false,
|
|
9
|
+
parse: (_context, tokens) => {
|
|
10
|
+
if (tokens.length === 0) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const first = tokens[0];
|
|
14
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return tokens;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.counterIncrement = exports.parseCounterValue = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
/** Shared counter-ID parsing: returns next number or a fallback default. */
|
|
6
|
+
const parseCounterValue = (tokens, defaultNumber) => {
|
|
7
|
+
const entries = [];
|
|
8
|
+
const filtered = tokens.filter(parser_1.nonWhiteSpace);
|
|
9
|
+
for (let i = 0; i < filtered.length; i++) {
|
|
10
|
+
const counter = filtered[i];
|
|
11
|
+
const next = filtered[i + 1];
|
|
12
|
+
if (counter.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
13
|
+
const num = next && (0, parser_1.isNumberToken)(next) ? next.number : defaultNumber;
|
|
14
|
+
entries.push([counter.value, num]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return entries;
|
|
18
|
+
};
|
|
19
|
+
exports.parseCounterValue = parseCounterValue;
|
|
20
|
+
exports.counterIncrement = {
|
|
21
|
+
name: 'counter-increment',
|
|
22
|
+
initialValue: 'none',
|
|
23
|
+
prefix: true,
|
|
24
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
25
|
+
parse: (_context, tokens) => {
|
|
26
|
+
if (tokens.length === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const first = tokens[0];
|
|
30
|
+
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return (0, exports.parseCounterValue)(tokens, 1).map(([counter, increment]) => ({ counter, increment }));
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.counterReset = void 0;
|
|
4
|
+
const counter_increment_1 = require("./counter-increment");
|
|
5
|
+
exports.counterReset = {
|
|
6
|
+
name: 'counter-reset',
|
|
7
|
+
initialValue: 'none',
|
|
8
|
+
prefix: true,
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
parse: (_context, tokens) => {
|
|
11
|
+
if (tokens.length === 0) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
return (0, counter_increment_1.parseCounterValue)(tokens, 0)
|
|
15
|
+
.filter(([counter]) => counter !== 'none')
|
|
16
|
+
.map(([counter, reset]) => ({ counter, reset }));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.direction = void 0;
|
|
4
|
+
exports.direction = {
|
|
5
|
+
name: 'direction',
|
|
6
|
+
initialValue: 'ltr',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
+
parse: (_context, direction) => {
|
|
10
|
+
switch (direction) {
|
|
11
|
+
case 'rtl':
|
|
12
|
+
return 1 /* DIRECTION.RTL */;
|
|
13
|
+
case 'ltr':
|
|
14
|
+
default:
|
|
15
|
+
return 0 /* DIRECTION.LTR */;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.display = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
exports.display = {
|
|
6
|
+
name: 'display',
|
|
7
|
+
initialValue: 'inline-block',
|
|
8
|
+
prefix: false,
|
|
9
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
+
parse: (_context, tokens) => {
|
|
11
|
+
return tokens.filter(parser_1.isIdentToken).reduce((bit, token) => {
|
|
12
|
+
return bit | parseDisplayValue(token.value);
|
|
13
|
+
}, 0 /* DISPLAY.NONE */);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const parseDisplayValue = (display) => {
|
|
17
|
+
switch (display) {
|
|
18
|
+
case 'block':
|
|
19
|
+
case '-webkit-box':
|
|
20
|
+
return 2 /* DISPLAY.BLOCK */;
|
|
21
|
+
case 'inline':
|
|
22
|
+
return 4 /* DISPLAY.INLINE */;
|
|
23
|
+
case 'run-in':
|
|
24
|
+
return 8 /* DISPLAY.RUN_IN */;
|
|
25
|
+
case 'flow':
|
|
26
|
+
return 16 /* DISPLAY.FLOW */;
|
|
27
|
+
case 'flow-root':
|
|
28
|
+
return 32 /* DISPLAY.FLOW_ROOT */;
|
|
29
|
+
case 'table':
|
|
30
|
+
return 64 /* DISPLAY.TABLE */;
|
|
31
|
+
case 'flex':
|
|
32
|
+
case '-webkit-flex':
|
|
33
|
+
return 128 /* DISPLAY.FLEX */;
|
|
34
|
+
case 'grid':
|
|
35
|
+
case '-ms-grid':
|
|
36
|
+
return 256 /* DISPLAY.GRID */;
|
|
37
|
+
case 'ruby':
|
|
38
|
+
return 512 /* DISPLAY.RUBY */;
|
|
39
|
+
case 'subgrid':
|
|
40
|
+
return 1024 /* DISPLAY.SUBGRID */;
|
|
41
|
+
case 'list-item':
|
|
42
|
+
return 2048 /* DISPLAY.LIST_ITEM */;
|
|
43
|
+
case 'table-row-group':
|
|
44
|
+
return 4096 /* DISPLAY.TABLE_ROW_GROUP */;
|
|
45
|
+
case 'table-header-group':
|
|
46
|
+
return 8192 /* DISPLAY.TABLE_HEADER_GROUP */;
|
|
47
|
+
case 'table-footer-group':
|
|
48
|
+
return 16384 /* DISPLAY.TABLE_FOOTER_GROUP */;
|
|
49
|
+
case 'table-row':
|
|
50
|
+
return 32768 /* DISPLAY.TABLE_ROW */;
|
|
51
|
+
case 'table-cell':
|
|
52
|
+
return 65536 /* DISPLAY.TABLE_CELL */;
|
|
53
|
+
case 'table-column-group':
|
|
54
|
+
return 131072 /* DISPLAY.TABLE_COLUMN_GROUP */;
|
|
55
|
+
case 'table-column':
|
|
56
|
+
return 262144 /* DISPLAY.TABLE_COLUMN */;
|
|
57
|
+
case 'table-caption':
|
|
58
|
+
return 524288 /* DISPLAY.TABLE_CAPTION */;
|
|
59
|
+
case 'ruby-base':
|
|
60
|
+
return 1048576 /* DISPLAY.RUBY_BASE */;
|
|
61
|
+
case 'ruby-text':
|
|
62
|
+
return 2097152 /* DISPLAY.RUBY_TEXT */;
|
|
63
|
+
case 'ruby-base-container':
|
|
64
|
+
return 4194304 /* DISPLAY.RUBY_BASE_CONTAINER */;
|
|
65
|
+
case 'ruby-text-container':
|
|
66
|
+
return 8388608 /* DISPLAY.RUBY_TEXT_CONTAINER */;
|
|
67
|
+
case 'contents':
|
|
68
|
+
return 16777216 /* DISPLAY.CONTENTS */;
|
|
69
|
+
case 'inline-block':
|
|
70
|
+
return 33554432 /* DISPLAY.INLINE_BLOCK */;
|
|
71
|
+
case 'inline-list-item':
|
|
72
|
+
return 67108864 /* DISPLAY.INLINE_LIST_ITEM */;
|
|
73
|
+
case 'inline-table':
|
|
74
|
+
return 134217728 /* DISPLAY.INLINE_TABLE */;
|
|
75
|
+
case 'inline-flex':
|
|
76
|
+
return 268435456 /* DISPLAY.INLINE_FLEX */;
|
|
77
|
+
case 'inline-grid':
|
|
78
|
+
return 536870912 /* DISPLAY.INLINE_GRID */;
|
|
79
|
+
}
|
|
80
|
+
return 0 /* DISPLAY.NONE */;
|
|
81
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.duration = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const time_1 = require("../types/time");
|
|
6
|
+
exports.duration = {
|
|
7
|
+
name: 'duration',
|
|
8
|
+
initialValue: '0s',
|
|
9
|
+
prefix: false,
|
|
10
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
11
|
+
parse: (context, tokens) => {
|
|
12
|
+
return tokens.filter(parser_1.isDimensionToken).map((token) => time_1.time.parse(context, token));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filter = void 0;
|
|
4
|
+
exports.filter = {
|
|
5
|
+
name: 'filter',
|
|
6
|
+
initialValue: 'none',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
9
|
+
parse: (_context, tokens) => {
|
|
10
|
+
if (tokens.length === 1 && tokens[0].type === 20 /* TokenType.IDENT_TOKEN */ && tokens[0].value === 'none') {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const parts = [];
|
|
14
|
+
for (const token of tokens) {
|
|
15
|
+
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
16
|
+
const fn = token;
|
|
17
|
+
// Reconstruct the function string from its name + values
|
|
18
|
+
const renderedArgs = renderFilterArgs(fn.values);
|
|
19
|
+
// Canvas API supports the same CSS filter string format
|
|
20
|
+
switch (fn.name) {
|
|
21
|
+
case 'blur':
|
|
22
|
+
parts.push(`blur(${renderedArgs}px)`);
|
|
23
|
+
break;
|
|
24
|
+
case 'brightness':
|
|
25
|
+
case 'contrast':
|
|
26
|
+
case 'invert':
|
|
27
|
+
case 'opacity':
|
|
28
|
+
case 'saturate':
|
|
29
|
+
case 'sepia':
|
|
30
|
+
parts.push(`${fn.name}(${renderedArgs})`);
|
|
31
|
+
break;
|
|
32
|
+
case 'grayscale':
|
|
33
|
+
parts.push(`grayscale(${renderedArgs})`);
|
|
34
|
+
break;
|
|
35
|
+
case 'hue-rotate':
|
|
36
|
+
parts.push(`hue-rotate(${renderedArgs}deg)`);
|
|
37
|
+
break;
|
|
38
|
+
case 'drop-shadow':
|
|
39
|
+
parts.push(`drop-shadow(${renderedArgs})`);
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return parts.length > 0 ? parts.join(' ') : null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Render filter function arguments back into a CSS string suitable for Canvas API.
|
|
51
|
+
* Canvas 2D `ctx.filter` accepts the same CSS filter function strings.
|
|
52
|
+
*/
|
|
53
|
+
const renderFilterArgs = (values) => {
|
|
54
|
+
const parts = [];
|
|
55
|
+
for (const v of values) {
|
|
56
|
+
if (v.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (v.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
60
|
+
parts.push(`${v.number}${v.unit}`);
|
|
61
|
+
}
|
|
62
|
+
else if (v.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
63
|
+
parts.push(`${v.number}`);
|
|
64
|
+
}
|
|
65
|
+
else if (v.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
66
|
+
parts.push(`${v.number}%`);
|
|
67
|
+
}
|
|
68
|
+
else if (v.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
69
|
+
parts.push(v.value);
|
|
70
|
+
}
|
|
71
|
+
else if (v.type === 5 /* TokenType.HASH_TOKEN */) {
|
|
72
|
+
parts.push(`#${v.value}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return parts.join(' ');
|
|
76
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.float = void 0;
|
|
4
|
+
exports.float = {
|
|
5
|
+
name: 'float',
|
|
6
|
+
initialValue: 'none',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
+
parse: (_context, float) => {
|
|
10
|
+
switch (float) {
|
|
11
|
+
case 'left':
|
|
12
|
+
return 1 /* FLOAT.LEFT */;
|
|
13
|
+
case 'right':
|
|
14
|
+
return 2 /* FLOAT.RIGHT */;
|
|
15
|
+
case 'inline-start':
|
|
16
|
+
return 3 /* FLOAT.INLINE_START */;
|
|
17
|
+
case 'inline-end':
|
|
18
|
+
return 4 /* FLOAT.INLINE_END */;
|
|
19
|
+
}
|
|
20
|
+
return 0 /* FLOAT.NONE */;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fontFamily = void 0;
|
|
4
|
+
exports.fontFamily = {
|
|
5
|
+
name: `font-family`,
|
|
6
|
+
initialValue: '',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
9
|
+
parse: (_context, tokens) => {
|
|
10
|
+
const accumulator = [];
|
|
11
|
+
const results = [];
|
|
12
|
+
tokens.forEach((token) => {
|
|
13
|
+
switch (token.type) {
|
|
14
|
+
case 20 /* TokenType.IDENT_TOKEN */:
|
|
15
|
+
case 0 /* TokenType.STRING_TOKEN */:
|
|
16
|
+
accumulator.push(token.value);
|
|
17
|
+
break;
|
|
18
|
+
case 17 /* TokenType.NUMBER_TOKEN */:
|
|
19
|
+
accumulator.push(token.number.toString());
|
|
20
|
+
break;
|
|
21
|
+
case 4 /* TokenType.COMMA_TOKEN */:
|
|
22
|
+
results.push(accumulator.join(' '));
|
|
23
|
+
accumulator.length = 0;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (accumulator.length) {
|
|
28
|
+
results.push(accumulator.join(' '));
|
|
29
|
+
}
|
|
30
|
+
return results.map((result) => (result.indexOf(' ') === -1 ? result : `'${result}'`));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fontSize = void 0;
|
|
4
|
+
exports.fontSize = {
|
|
5
|
+
name: `font-size`,
|
|
6
|
+
initialValue: '0',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
9
|
+
format: 'length'
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fontStyle = void 0;
|
|
4
|
+
exports.fontStyle = {
|
|
5
|
+
name: 'font-style',
|
|
6
|
+
initialValue: 'normal',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
+
parse: (_context, overflow) => {
|
|
10
|
+
switch (overflow) {
|
|
11
|
+
case 'oblique':
|
|
12
|
+
return "oblique" /* FONT_STYLE.OBLIQUE */;
|
|
13
|
+
case 'italic':
|
|
14
|
+
return "italic" /* FONT_STYLE.ITALIC */;
|
|
15
|
+
case 'normal':
|
|
16
|
+
default:
|
|
17
|
+
return "normal" /* FONT_STYLE.NORMAL */;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fontVariantLigatures = void 0;
|
|
4
|
+
exports.fontVariantLigatures = {
|
|
5
|
+
name: 'font-variant-ligatures',
|
|
6
|
+
initialValue: 'normal',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
+
parse: (_context, value) => {
|
|
10
|
+
switch (value) {
|
|
11
|
+
case 'none':
|
|
12
|
+
return 1 /* FONT_VARIANT_LIGATURES.NONE */;
|
|
13
|
+
case 'common-ligatures':
|
|
14
|
+
return 2 /* FONT_VARIANT_LIGATURES.COMMON_LIGATURES */;
|
|
15
|
+
case 'no-common-ligatures':
|
|
16
|
+
return 3 /* FONT_VARIANT_LIGATURES.NO_COMMON_LIGATURES */;
|
|
17
|
+
case 'discretionary-ligatures':
|
|
18
|
+
return 4 /* FONT_VARIANT_LIGATURES.DISCRETIONARY_LIGATURES */;
|
|
19
|
+
case 'no-discretionary-ligatures':
|
|
20
|
+
return 5 /* FONT_VARIANT_LIGATURES.NO_DISCRETIONARY_LIGATURES */;
|
|
21
|
+
case 'historical-ligatures':
|
|
22
|
+
return 6 /* FONT_VARIANT_LIGATURES.HISTORICAL_LIGATURES */;
|
|
23
|
+
case 'no-historical-ligatures':
|
|
24
|
+
return 7 /* FONT_VARIANT_LIGATURES.NO_HISTORICAL_LIGATURES */;
|
|
25
|
+
case 'contextual':
|
|
26
|
+
return 8 /* FONT_VARIANT_LIGATURES.CONTEXTUAL */;
|
|
27
|
+
case 'no-contextual':
|
|
28
|
+
return 9 /* FONT_VARIANT_LIGATURES.NO_CONTEXTUAL */;
|
|
29
|
+
case 'normal':
|
|
30
|
+
default:
|
|
31
|
+
return 0 /* FONT_VARIANT_LIGATURES.NORMAL */;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fontVariant = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
exports.fontVariant = {
|
|
6
|
+
name: 'font-variant',
|
|
7
|
+
initialValue: 'none',
|
|
8
|
+
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
9
|
+
prefix: false,
|
|
10
|
+
parse: (_context, tokens) => {
|
|
11
|
+
return tokens.filter(parser_1.isIdentToken).map((token) => token.value);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fontWeight = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
exports.fontWeight = {
|
|
6
|
+
name: 'font-weight',
|
|
7
|
+
initialValue: 'normal',
|
|
8
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
9
|
+
prefix: false,
|
|
10
|
+
parse: (_context, token) => {
|
|
11
|
+
if ((0, parser_1.isNumberToken)(token)) {
|
|
12
|
+
return token.number;
|
|
13
|
+
}
|
|
14
|
+
if ((0, parser_1.isIdentToken)(token)) {
|
|
15
|
+
switch (token.value) {
|
|
16
|
+
case 'bold':
|
|
17
|
+
return 700;
|
|
18
|
+
case 'normal':
|
|
19
|
+
default:
|
|
20
|
+
return 400;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return 400;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.imageRendering = exports.IMAGE_RENDERING = void 0;
|
|
4
|
+
var IMAGE_RENDERING;
|
|
5
|
+
(function (IMAGE_RENDERING) {
|
|
6
|
+
IMAGE_RENDERING[IMAGE_RENDERING["AUTO"] = 0] = "AUTO";
|
|
7
|
+
IMAGE_RENDERING[IMAGE_RENDERING["CRISP_EDGES"] = 1] = "CRISP_EDGES";
|
|
8
|
+
IMAGE_RENDERING[IMAGE_RENDERING["PIXELATED"] = 2] = "PIXELATED";
|
|
9
|
+
IMAGE_RENDERING[IMAGE_RENDERING["SMOOTH"] = 3] = "SMOOTH";
|
|
10
|
+
})(IMAGE_RENDERING || (exports.IMAGE_RENDERING = IMAGE_RENDERING = {}));
|
|
11
|
+
exports.imageRendering = {
|
|
12
|
+
name: 'image-rendering',
|
|
13
|
+
initialValue: 'auto',
|
|
14
|
+
prefix: false,
|
|
15
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
16
|
+
parse: (_context, value) => {
|
|
17
|
+
switch (value.toLowerCase()) {
|
|
18
|
+
case 'crisp-edges':
|
|
19
|
+
case '-webkit-crisp-edges':
|
|
20
|
+
case '-moz-crisp-edges':
|
|
21
|
+
return IMAGE_RENDERING.CRISP_EDGES;
|
|
22
|
+
case 'pixelated':
|
|
23
|
+
case '-webkit-optimize-contrast':
|
|
24
|
+
return IMAGE_RENDERING.PIXELATED;
|
|
25
|
+
case 'smooth':
|
|
26
|
+
case 'high-quality':
|
|
27
|
+
return IMAGE_RENDERING.SMOOTH;
|
|
28
|
+
case 'auto':
|
|
29
|
+
default:
|
|
30
|
+
return IMAGE_RENDERING.AUTO;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.letterSpacing = void 0;
|
|
4
|
+
exports.letterSpacing = {
|
|
5
|
+
name: 'letter-spacing',
|
|
6
|
+
initialValue: '0',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
9
|
+
parse: (_context, token) => {
|
|
10
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'normal') {
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
14
|
+
return token.number;
|
|
15
|
+
}
|
|
16
|
+
if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
17
|
+
return token.number;
|
|
18
|
+
}
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lineBreak = exports.LINE_BREAK = void 0;
|
|
4
|
+
var LINE_BREAK;
|
|
5
|
+
(function (LINE_BREAK) {
|
|
6
|
+
LINE_BREAK["NORMAL"] = "normal";
|
|
7
|
+
LINE_BREAK["STRICT"] = "strict";
|
|
8
|
+
})(LINE_BREAK || (exports.LINE_BREAK = LINE_BREAK = {}));
|
|
9
|
+
exports.lineBreak = {
|
|
10
|
+
name: 'line-break',
|
|
11
|
+
initialValue: 'normal',
|
|
12
|
+
prefix: false,
|
|
13
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
14
|
+
parse: (_context, lineBreak) => {
|
|
15
|
+
switch (lineBreak) {
|
|
16
|
+
case 'strict':
|
|
17
|
+
return LINE_BREAK.STRICT;
|
|
18
|
+
case 'normal':
|
|
19
|
+
default:
|
|
20
|
+
return LINE_BREAK.NORMAL;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeLineHeight = exports.lineHeight = void 0;
|
|
4
|
+
const parser_1 = require("../syntax/parser");
|
|
5
|
+
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
+
exports.lineHeight = {
|
|
7
|
+
name: 'line-height',
|
|
8
|
+
initialValue: 'normal',
|
|
9
|
+
prefix: false,
|
|
10
|
+
type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
|
|
11
|
+
};
|
|
12
|
+
const computeLineHeight = (token, fontSize) => {
|
|
13
|
+
if ((0, parser_1.isIdentToken)(token) && token.value === 'normal') {
|
|
14
|
+
return 1.2 * fontSize;
|
|
15
|
+
}
|
|
16
|
+
else if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
17
|
+
return fontSize * token.number;
|
|
18
|
+
}
|
|
19
|
+
else if ((0, length_percentage_1.isLengthPercentage)(token)) {
|
|
20
|
+
return (0, length_percentage_1.getAbsoluteValue)(token, fontSize);
|
|
21
|
+
}
|
|
22
|
+
return fontSize;
|
|
23
|
+
};
|
|
24
|
+
exports.computeLineHeight = computeLineHeight;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listStyleImage = void 0;
|
|
4
|
+
const image_1 = require("../types/image");
|
|
5
|
+
exports.listStyleImage = {
|
|
6
|
+
name: 'list-style-image',
|
|
7
|
+
initialValue: 'none',
|
|
8
|
+
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
9
|
+
prefix: false,
|
|
10
|
+
skipCache: true,
|
|
11
|
+
parse: (context, token) => {
|
|
12
|
+
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return image_1.image.parse(context, token);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listStylePosition = void 0;
|
|
4
|
+
exports.listStylePosition = {
|
|
5
|
+
name: 'list-style-position',
|
|
6
|
+
initialValue: 'outside',
|
|
7
|
+
prefix: false,
|
|
8
|
+
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
+
parse: (_context, position) => {
|
|
10
|
+
switch (position) {
|
|
11
|
+
case 'inside':
|
|
12
|
+
return 0 /* LIST_STYLE_POSITION.INSIDE */;
|
|
13
|
+
case 'outside':
|
|
14
|
+
default:
|
|
15
|
+
return 1 /* LIST_STYLE_POSITION.OUTSIDE */;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|