html2canvas-pro 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/html2canvas-pro.esm.js +6754 -6599
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +6753 -6599
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +5 -5
- package/dist/lib/config.js +3 -4
- package/dist/lib/core/bitwise.js +0 -1
- package/dist/lib/core/cache-storage.js +34 -48
- package/dist/lib/core/context.js +0 -1
- package/dist/lib/core/debugger.js +0 -1
- package/dist/lib/core/features.js +0 -1
- package/dist/lib/core/logger.js +0 -1
- package/dist/lib/core/origin-checker.js +0 -1
- package/dist/lib/core/performance-monitor.js +1 -24
- package/dist/lib/core/render-element.js +210 -0
- package/dist/lib/core/util.js +0 -1
- package/dist/lib/core/validator.js +0 -1
- package/dist/lib/css/index.js +150 -89
- package/dist/lib/css/layout/bounds.js +0 -1
- package/dist/lib/css/layout/text.js +4 -1
- package/dist/lib/css/{ITypeDescriptor.js → property-descriptor.js} +0 -1
- package/dist/lib/css/property-descriptors/background-clip.js +0 -1
- package/dist/lib/css/property-descriptors/background-color.js +0 -1
- package/dist/lib/css/property-descriptors/background-image.js +0 -1
- package/dist/lib/css/property-descriptors/background-origin.js +0 -1
- package/dist/lib/css/property-descriptors/background-position.js +0 -1
- package/dist/lib/css/property-descriptors/background-repeat.js +0 -1
- package/dist/lib/css/property-descriptors/background-size.js +0 -1
- package/dist/lib/css/property-descriptors/border-color.js +0 -1
- package/dist/lib/css/property-descriptors/border-radius.js +0 -1
- package/dist/lib/css/property-descriptors/border-style.js +0 -1
- package/dist/lib/css/property-descriptors/border-width.js +0 -1
- package/dist/lib/css/property-descriptors/box-shadow.js +0 -1
- package/dist/lib/css/property-descriptors/clip-path.js +0 -1
- package/dist/lib/css/property-descriptors/color.js +0 -1
- package/dist/lib/css/property-descriptors/content.js +0 -1
- package/dist/lib/css/property-descriptors/counter-increment.js +0 -1
- package/dist/lib/css/property-descriptors/counter-reset.js +0 -1
- package/dist/lib/css/property-descriptors/direction.js +0 -1
- package/dist/lib/css/property-descriptors/display.js +0 -1
- package/dist/lib/css/property-descriptors/duration.js +0 -1
- package/dist/lib/css/property-descriptors/float.js +0 -1
- package/dist/lib/css/property-descriptors/font-family.js +0 -1
- package/dist/lib/css/property-descriptors/font-size.js +0 -1
- package/dist/lib/css/property-descriptors/font-style.js +0 -1
- package/dist/lib/css/property-descriptors/font-variant.js +0 -1
- package/dist/lib/css/property-descriptors/font-weight.js +0 -1
- package/dist/lib/css/property-descriptors/image-rendering.js +0 -1
- package/dist/lib/css/property-descriptors/letter-spacing.js +0 -1
- package/dist/lib/css/property-descriptors/line-break.js +0 -1
- package/dist/lib/css/property-descriptors/line-height.js +0 -1
- package/dist/lib/css/property-descriptors/list-style-image.js +0 -1
- package/dist/lib/css/property-descriptors/list-style-position.js +0 -1
- package/dist/lib/css/property-descriptors/list-style-type.js +0 -1
- package/dist/lib/css/property-descriptors/margin.js +0 -1
- package/dist/lib/css/property-descriptors/mix-blend-mode.js +31 -0
- package/dist/lib/css/property-descriptors/object-fit.js +0 -1
- package/dist/lib/css/property-descriptors/opacity.js +0 -1
- package/dist/lib/css/property-descriptors/overflow-wrap.js +0 -1
- package/dist/lib/css/property-descriptors/overflow.js +0 -1
- package/dist/lib/css/property-descriptors/padding.js +0 -1
- package/dist/lib/css/property-descriptors/paint-order.js +0 -1
- package/dist/lib/css/property-descriptors/position.js +0 -1
- package/dist/lib/css/property-descriptors/quotes.js +0 -1
- package/dist/lib/css/property-descriptors/rotate.js +0 -1
- package/dist/lib/css/property-descriptors/text-align.js +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-color.js +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-line.js +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-style.js +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-thickness.js +0 -1
- package/dist/lib/css/property-descriptors/text-overflow.js +0 -1
- package/dist/lib/css/property-descriptors/text-shadow.js +0 -1
- package/dist/lib/css/property-descriptors/text-transform.js +0 -1
- package/dist/lib/css/property-descriptors/text-underline-offset.js +0 -1
- package/dist/lib/css/property-descriptors/transform-origin.js +0 -1
- package/dist/lib/css/property-descriptors/transform.js +0 -1
- package/dist/lib/css/property-descriptors/visibility.js +0 -1
- package/dist/lib/css/property-descriptors/webkit-line-clamp.js +0 -1
- package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +0 -1
- package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +0 -1
- package/dist/lib/css/property-descriptors/word-break.js +0 -1
- package/dist/lib/css/property-descriptors/writing-mode.js +28 -0
- package/dist/lib/css/property-descriptors/z-index.js +0 -1
- package/dist/lib/css/syntax/parser.js +0 -1
- package/dist/lib/css/syntax/tokenizer.js +14 -1
- package/dist/lib/css/{IPropertyDescriptor.js → type-descriptor.js} +0 -1
- package/dist/lib/css/types/angle.js +0 -1
- package/dist/lib/css/types/color-math.js +0 -1
- package/dist/lib/css/types/color-spaces/a98.js +0 -1
- package/dist/lib/css/types/color-spaces/p3.js +0 -1
- package/dist/lib/css/types/color-spaces/pro-photo.js +0 -1
- package/dist/lib/css/types/color-spaces/rec2020.js +0 -1
- package/dist/lib/css/types/color-spaces/srgb.js +0 -1
- package/dist/lib/css/types/color-utilities.js +0 -1
- package/dist/lib/css/types/color.js +0 -1
- package/dist/lib/css/types/functions/-prefix-linear-gradient.js +0 -1
- package/dist/lib/css/types/functions/-prefix-radial-gradient.js +0 -1
- package/dist/lib/css/types/functions/-webkit-gradient.js +0 -1
- package/dist/lib/css/types/functions/counter.js +0 -1
- package/dist/lib/css/types/functions/gradient.js +0 -1
- package/dist/lib/css/types/functions/linear-gradient.js +0 -1
- package/dist/lib/css/types/functions/radial-gradient.js +0 -1
- package/dist/lib/css/types/image.js +0 -1
- package/dist/lib/css/types/index.js +0 -1
- package/dist/lib/css/types/length-percentage.js +0 -1
- package/dist/lib/css/types/length.js +0 -1
- package/dist/lib/css/types/time.js +0 -1
- package/dist/lib/dom/document-cloner.js +27 -22
- package/dist/lib/dom/dom-normalizer.js +0 -1
- package/dist/lib/dom/element-container.js +7 -6
- package/dist/lib/dom/elements/li-element-container.js +0 -1
- package/dist/lib/dom/elements/ol-element-container.js +0 -1
- package/dist/lib/dom/elements/select-element-container.js +0 -1
- package/dist/lib/dom/elements/textarea-element-container.js +0 -1
- package/dist/lib/dom/node-parser.js +37 -53
- package/dist/lib/dom/node-type-guards.js +62 -25
- package/dist/lib/dom/replaced-elements/canvas-element-container.js +0 -1
- package/dist/lib/dom/replaced-elements/iframe-element-container.js +0 -1
- package/dist/lib/dom/replaced-elements/image-element-container.js +0 -1
- package/dist/lib/dom/replaced-elements/index.js +0 -1
- package/dist/lib/dom/replaced-elements/input-element-container.js +0 -1
- package/dist/lib/dom/replaced-elements/pseudo-elements.js +0 -1
- package/dist/lib/dom/replaced-elements/svg-element-container.js +0 -1
- package/dist/lib/dom/text-container.js +5 -1
- package/dist/lib/index.js +32 -210
- package/dist/lib/invariant.js +0 -1
- package/dist/lib/options.js +2 -0
- package/dist/lib/render/background.js +0 -1
- package/dist/lib/render/bezier-curve.js +0 -1
- package/dist/lib/render/border.js +0 -1
- package/dist/lib/render/bound-curves.js +0 -1
- package/dist/lib/render/box-sizing.js +0 -1
- package/dist/lib/render/canvas/background-renderer.js +2 -24
- package/dist/lib/render/canvas/border-renderer.js +0 -1
- package/dist/lib/render/canvas/canvas-path.js +25 -0
- package/dist/lib/render/canvas/canvas-renderer.js +25 -98
- package/dist/lib/render/canvas/effects-renderer.js +3 -1
- package/dist/lib/render/canvas/foreignobject-renderer.js +8 -16
- package/dist/lib/render/canvas/text-renderer.js +92 -121
- package/dist/lib/render/effects.js +11 -2
- package/dist/lib/render/font-metrics.js +0 -1
- package/dist/lib/render/object-fit.js +87 -0
- package/dist/lib/render/path.js +0 -1
- package/dist/lib/render/renderer-interface.js +0 -1
- package/dist/lib/render/stacking-context.js +16 -8
- package/dist/lib/render/vector.js +0 -1
- package/dist/types/core/cache-storage.d.ts +5 -6
- package/dist/types/core/performance-monitor.d.ts +0 -11
- package/dist/types/core/render-element.d.ts +3 -0
- package/dist/types/css/index.d.ts +5 -0
- package/dist/types/css/property-descriptors/background-clip.d.ts +1 -1
- package/dist/types/css/property-descriptors/background-color.d.ts +1 -1
- package/dist/types/css/property-descriptors/background-image.d.ts +1 -1
- package/dist/types/css/property-descriptors/background-origin.d.ts +1 -1
- package/dist/types/css/property-descriptors/background-position.d.ts +1 -1
- package/dist/types/css/property-descriptors/background-repeat.d.ts +1 -1
- package/dist/types/css/property-descriptors/background-size.d.ts +1 -1
- package/dist/types/css/property-descriptors/border-color.d.ts +1 -1
- package/dist/types/css/property-descriptors/border-radius.d.ts +1 -1
- package/dist/types/css/property-descriptors/border-style.d.ts +1 -1
- package/dist/types/css/property-descriptors/border-width.d.ts +1 -1
- package/dist/types/css/property-descriptors/box-shadow.d.ts +1 -1
- package/dist/types/css/property-descriptors/clip-path.d.ts +1 -1
- package/dist/types/css/property-descriptors/color.d.ts +1 -1
- package/dist/types/css/property-descriptors/content.d.ts +1 -1
- package/dist/types/css/property-descriptors/counter-increment.d.ts +1 -1
- package/dist/types/css/property-descriptors/counter-reset.d.ts +1 -1
- package/dist/types/css/property-descriptors/direction.d.ts +1 -1
- package/dist/types/css/property-descriptors/display.d.ts +1 -1
- package/dist/types/css/property-descriptors/duration.d.ts +1 -1
- package/dist/types/css/property-descriptors/float.d.ts +1 -1
- package/dist/types/css/property-descriptors/font-family.d.ts +1 -1
- package/dist/types/css/property-descriptors/font-size.d.ts +1 -1
- package/dist/types/css/property-descriptors/font-style.d.ts +1 -1
- package/dist/types/css/property-descriptors/font-variant.d.ts +1 -1
- package/dist/types/css/property-descriptors/font-weight.d.ts +1 -1
- package/dist/types/css/property-descriptors/image-rendering.d.ts +1 -1
- package/dist/types/css/property-descriptors/letter-spacing.d.ts +1 -1
- package/dist/types/css/property-descriptors/line-break.d.ts +1 -1
- package/dist/types/css/property-descriptors/line-height.d.ts +1 -1
- package/dist/types/css/property-descriptors/list-style-image.d.ts +1 -1
- package/dist/types/css/property-descriptors/list-style-position.d.ts +1 -1
- package/dist/types/css/property-descriptors/list-style-type.d.ts +1 -1
- package/dist/types/css/property-descriptors/margin.d.ts +1 -1
- package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +21 -0
- package/dist/types/css/property-descriptors/object-fit.d.ts +1 -1
- package/dist/types/css/property-descriptors/opacity.d.ts +1 -1
- package/dist/types/css/property-descriptors/overflow-wrap.d.ts +1 -1
- package/dist/types/css/property-descriptors/overflow.d.ts +1 -1
- package/dist/types/css/property-descriptors/padding.d.ts +1 -1
- package/dist/types/css/property-descriptors/paint-order.d.ts +1 -1
- package/dist/types/css/property-descriptors/position.d.ts +1 -1
- package/dist/types/css/property-descriptors/quotes.d.ts +1 -1
- package/dist/types/css/property-descriptors/rotate.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-align.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-decoration-color.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-decoration-line.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-decoration-style.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-decoration-thickness.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-overflow.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-shadow.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-transform.d.ts +1 -1
- package/dist/types/css/property-descriptors/text-underline-offset.d.ts +1 -1
- package/dist/types/css/property-descriptors/transform-origin.d.ts +1 -1
- package/dist/types/css/property-descriptors/transform.d.ts +1 -1
- package/dist/types/css/property-descriptors/visibility.d.ts +1 -1
- package/dist/types/css/property-descriptors/webkit-line-clamp.d.ts +1 -1
- package/dist/types/css/property-descriptors/webkit-text-stroke-color.d.ts +1 -1
- package/dist/types/css/property-descriptors/webkit-text-stroke-width.d.ts +1 -1
- package/dist/types/css/property-descriptors/word-break.d.ts +1 -1
- package/dist/types/css/property-descriptors/writing-mode.d.ts +11 -0
- package/dist/types/css/property-descriptors/z-index.d.ts +1 -1
- package/dist/types/css/syntax/tokenizer.d.ts +5 -0
- package/dist/types/css/types/angle.d.ts +1 -1
- package/dist/types/css/types/color.d.ts +1 -1
- package/dist/types/css/types/image.d.ts +1 -1
- package/dist/types/css/types/time.d.ts +1 -1
- package/dist/types/dom/element-container.d.ts +4 -11
- package/dist/types/dom/node-parser.d.ts +2 -15
- package/dist/types/dom/node-type-guards.d.ts +21 -22
- package/dist/types/index.d.ts +28 -48
- package/dist/types/options.d.ts +51 -0
- package/dist/types/render/canvas/background-renderer.d.ts +0 -6
- package/dist/types/render/canvas/canvas-path.d.ts +3 -0
- package/dist/types/render/canvas/canvas-renderer.d.ts +4 -2
- package/dist/types/render/canvas/foreignobject-renderer.d.ts +2 -3
- package/dist/types/render/canvas/text-renderer.d.ts +8 -1
- package/dist/types/render/effects.d.ts +9 -1
- package/dist/types/render/object-fit.d.ts +18 -0
- package/package.json +43 -35
- package/src/__tests__/index.ts +99 -0
- package/src/config.ts +107 -0
- package/src/core/__mocks__/cache-storage.ts +1 -0
- package/src/core/__mocks__/context.ts +19 -0
- package/{dist/lib/core/__mocks__/features.js → src/core/__mocks__/features.ts} +1 -5
- package/src/core/__mocks__/logger.ts +17 -0
- package/{dist/lib/core/__tests__/cache-storage.test.js → src/core/__tests__/cache-storage.test.ts} +95 -48
- package/{dist/lib/core/__tests__/cache-storage.js → src/core/__tests__/cache-storage.ts} +117 -64
- package/{dist/lib/core/__tests__/logger.js → src/core/__tests__/logger.ts} +10 -8
- package/{dist/lib/core/__tests__/validator.js → src/core/__tests__/validator.ts} +161 -98
- package/src/core/bitwise.ts +1 -0
- package/src/core/cache-storage.ts +315 -0
- package/src/core/context.ts +31 -0
- package/src/core/debugger.ts +32 -0
- package/src/core/features.ts +222 -0
- package/src/core/logger.ts +64 -0
- package/src/core/origin-checker.ts +57 -0
- package/src/core/performance-monitor.ts +241 -0
- package/src/core/render-element.ts +272 -0
- package/src/core/util.ts +1 -0
- package/src/core/validator.ts +593 -0
- package/src/css/index.ts +427 -0
- package/src/css/layout/__mocks__/bounds.ts +6 -0
- package/src/css/layout/bounds.ts +79 -0
- package/src/css/layout/text.ts +161 -0
- package/src/css/property-descriptor.ts +49 -0
- package/src/css/property-descriptors/__tests__/background-tests.ts +65 -0
- package/src/css/property-descriptors/__tests__/clip-path.test.ts +280 -0
- package/src/css/property-descriptors/__tests__/font-family.ts +25 -0
- package/src/css/property-descriptors/__tests__/image-rendering-integration.test.ts +153 -0
- package/{dist/lib/css/property-descriptors/__tests__/image-rendering-performance.test.js → src/css/property-descriptors/__tests__/image-rendering-performance.test.ts} +74 -66
- package/src/css/property-descriptors/__tests__/image-rendering.test.ts +72 -0
- package/src/css/property-descriptors/__tests__/paint-order.ts +87 -0
- package/src/css/property-descriptors/__tests__/text-shadow.ts +94 -0
- package/src/css/property-descriptors/__tests__/transform-tests.ts +18 -0
- package/src/css/property-descriptors/background-clip.ts +30 -0
- package/src/css/property-descriptors/background-color.ts +9 -0
- package/src/css/property-descriptors/background-image.ts +27 -0
- package/src/css/property-descriptors/background-origin.ts +31 -0
- package/src/css/property-descriptors/background-position.ts +38 -0
- package/src/css/property-descriptors/background-repeat.ts +44 -0
- package/src/css/property-descriptors/background-size.ts +27 -0
- package/src/css/property-descriptors/border-color.ts +13 -0
- package/src/css/property-descriptors/border-radius.ts +19 -0
- package/src/css/property-descriptors/border-style.ts +34 -0
- package/src/css/property-descriptors/border-width.ts +20 -0
- package/src/css/property-descriptors/box-shadow.ts +60 -0
- package/src/css/property-descriptors/clip-path.ts +271 -0
- package/src/css/property-descriptors/color.ts +9 -0
- package/src/css/property-descriptors/content.ts +26 -0
- package/src/css/property-descriptors/counter-increment.ts +43 -0
- package/src/css/property-descriptors/counter-reset.ts +36 -0
- package/src/css/property-descriptors/direction.ts +23 -0
- package/src/css/property-descriptors/display.ts +117 -0
- package/src/css/property-descriptors/duration.ts +14 -0
- package/src/css/property-descriptors/float.ts +29 -0
- package/src/css/property-descriptors/font-family.ts +38 -0
- package/src/css/property-descriptors/font-size.ts +9 -0
- package/src/css/property-descriptors/font-style.ts +25 -0
- package/src/css/property-descriptors/font-variant.ts +12 -0
- package/src/css/property-descriptors/font-weight.ts +26 -0
- package/src/css/property-descriptors/image-rendering.ts +33 -0
- package/src/css/property-descriptors/letter-spacing.ts +25 -0
- package/src/css/property-descriptors/line-break.ts +22 -0
- package/src/css/property-descriptors/line-height.ts +22 -0
- package/src/css/property-descriptors/list-style-image.ts +19 -0
- package/src/css/property-descriptors/list-style-position.ts +22 -0
- package/src/css/property-descriptors/list-style-type.ts +179 -0
- package/src/css/property-descriptors/margin.ts +13 -0
- package/src/css/property-descriptors/mix-blend-mode.ts +35 -0
- package/src/css/property-descriptors/object-fit.ts +39 -0
- package/src/css/property-descriptors/opacity.ts +15 -0
- package/src/css/property-descriptors/overflow-wrap.ts +22 -0
- package/src/css/property-descriptors/overflow.ts +34 -0
- package/src/css/property-descriptors/padding.ts +14 -0
- package/src/css/property-descriptors/paint-order.ts +42 -0
- package/src/css/property-descriptors/position.ts +30 -0
- package/src/css/property-descriptors/quotes.ts +57 -0
- package/src/css/property-descriptors/rotate.ts +34 -0
- package/src/css/property-descriptors/text-align.ts +26 -0
- package/src/css/property-descriptors/text-decoration-color.ts +9 -0
- package/src/css/property-descriptors/text-decoration-line.ts +38 -0
- package/src/css/property-descriptors/text-decoration-style.ts +32 -0
- package/src/css/property-descriptors/text-decoration-thickness.ts +30 -0
- package/src/css/property-descriptors/text-overflow.ts +23 -0
- package/src/css/property-descriptors/text-shadow.ts +52 -0
- package/src/css/property-descriptors/text-transform.ts +27 -0
- package/src/css/property-descriptors/text-underline-offset.ts +27 -0
- package/src/css/property-descriptors/transform-origin.ts +29 -0
- package/src/css/property-descriptors/transform.ts +74 -0
- package/src/css/property-descriptors/visibility.ts +25 -0
- package/src/css/property-descriptors/webkit-line-clamp.ts +30 -0
- package/src/css/property-descriptors/webkit-text-stroke-color.ts +8 -0
- package/src/css/property-descriptors/webkit-text-stroke-width.ts +15 -0
- package/src/css/property-descriptors/word-break.ts +25 -0
- package/src/css/property-descriptors/writing-mode.ts +37 -0
- package/src/css/property-descriptors/z-index.ts +27 -0
- package/src/css/syntax/__tests__/tokernizer-tests.ts +29 -0
- package/src/css/syntax/parser.ts +188 -0
- package/src/css/syntax/tokenizer.ts +822 -0
- package/src/css/type-descriptor.ts +7 -0
- package/src/css/types/__tests__/color-tests.ts +147 -0
- package/src/css/types/__tests__/image-tests.ts +239 -0
- package/src/css/types/angle.ts +86 -0
- package/src/css/types/color-math.ts +22 -0
- package/src/css/types/color-spaces/a98.ts +86 -0
- package/src/css/types/color-spaces/p3.ts +92 -0
- package/src/css/types/color-spaces/pro-photo.ts +87 -0
- package/src/css/types/color-spaces/rec2020.ts +90 -0
- package/src/css/types/color-spaces/srgb.ts +87 -0
- package/src/css/types/color-utilities.ts +452 -0
- package/src/css/types/color.ts +485 -0
- package/src/css/types/functions/-prefix-linear-gradient.ts +35 -0
- package/src/css/types/functions/-prefix-radial-gradient.ts +106 -0
- package/src/css/types/functions/-webkit-gradient.ts +69 -0
- package/src/css/types/functions/__tests__/radial-gradient.ts +69 -0
- package/src/css/types/functions/counter.ts +511 -0
- package/src/css/types/functions/gradient.ts +206 -0
- package/src/css/types/functions/linear-gradient.ts +28 -0
- package/src/css/types/functions/radial-gradient.ts +101 -0
- package/src/css/types/image.ts +120 -0
- package/src/css/types/index.ts +1 -0
- package/src/css/types/length-percentage.ts +137 -0
- package/src/css/types/length.ts +7 -0
- package/src/css/types/time.ts +20 -0
- package/src/dom/__mocks__/document-cloner.ts +22 -0
- package/{dist/lib/dom/__tests__/dom-normalizer.test.js → src/dom/__tests__/dom-normalizer.test.ts} +64 -44
- package/src/dom/__tests__/element-container.test.ts +129 -0
- package/src/dom/document-cloner.ts +929 -0
- package/src/dom/dom-normalizer.ts +133 -0
- package/src/dom/element-container.ts +75 -0
- package/src/dom/elements/li-element-container.ts +10 -0
- package/src/dom/elements/ol-element-container.ts +12 -0
- package/src/dom/elements/select-element-container.ts +10 -0
- package/src/dom/elements/textarea-element-container.ts +9 -0
- package/src/dom/node-parser.ts +177 -0
- package/src/dom/node-type-guards.ts +70 -0
- package/src/dom/replaced-elements/canvas-element-container.ts +15 -0
- package/src/dom/replaced-elements/iframe-element-container.ts +55 -0
- package/src/dom/replaced-elements/image-element-container.ts +16 -0
- package/src/dom/replaced-elements/index.ts +5 -0
- package/src/dom/replaced-elements/input-element-container.ts +105 -0
- package/src/dom/replaced-elements/pseudo-elements.ts +0 -0
- package/src/dom/replaced-elements/svg-element-container.ts +23 -0
- package/src/dom/text-container.ts +42 -0
- package/src/global.d.ts +19 -0
- package/src/index.ts +82 -0
- package/src/invariant.ts +5 -0
- package/src/options.ts +55 -0
- package/src/render/__tests__/object-fit.test.ts +85 -0
- package/src/render/background.ts +298 -0
- package/src/render/bezier-curve.ts +47 -0
- package/src/render/border.ts +165 -0
- package/src/render/bound-curves.ts +388 -0
- package/src/render/box-sizing.ts +31 -0
- package/{dist/lib/render/canvas/__tests__/background-renderer.test.js → src/render/canvas/__tests__/background-renderer.test.ts} +32 -25
- package/src/render/canvas/__tests__/border-renderer.test.ts +24 -0
- package/src/render/canvas/__tests__/effects-renderer.test.ts +32 -0
- package/src/render/canvas/__tests__/text-renderer.test.ts +471 -0
- package/src/render/canvas/background-renderer.ts +271 -0
- package/src/render/canvas/border-renderer.ts +224 -0
- package/src/render/canvas/canvas-path.ts +31 -0
- package/src/render/canvas/canvas-renderer.ts +641 -0
- package/src/render/canvas/effects-renderer.ts +130 -0
- package/src/render/canvas/foreignobject-renderer.ts +53 -0
- package/src/render/canvas/text-renderer.ts +700 -0
- package/src/render/effects.ts +75 -0
- package/src/render/font-metrics.ts +72 -0
- package/src/render/object-fit.ts +100 -0
- package/src/render/path.ts +37 -0
- package/src/render/renderer-interface.ts +28 -0
- package/src/render/stacking-context.ts +386 -0
- package/src/render/vector.ts +19 -0
- package/demo/image-smoothing-demo.html +0 -256
- package/demo/refactoring-test.html +0 -602
- package/dist/lib/__tests__/index.js +0 -85
- package/dist/lib/__tests__/index.js.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/core/__mocks__/cache-storage.js +0 -7
- package/dist/lib/core/__mocks__/cache-storage.js.map +0 -1
- package/dist/lib/core/__mocks__/context.js +0 -19
- package/dist/lib/core/__mocks__/context.js.map +0 -1
- package/dist/lib/core/__mocks__/features.js.map +0 -1
- package/dist/lib/core/__mocks__/logger.js +0 -16
- package/dist/lib/core/__mocks__/logger.js.map +0 -1
- package/dist/lib/core/__tests__/cache-storage.js.map +0 -1
- package/dist/lib/core/__tests__/cache-storage.test.js.map +0 -1
- package/dist/lib/core/__tests__/logger.js.map +0 -1
- package/dist/lib/core/__tests__/validator.js.map +0 -1
- package/dist/lib/core/bitwise.js.map +0 -1
- package/dist/lib/core/cache-storage.js.map +0 -1
- package/dist/lib/core/context.js.map +0 -1
- package/dist/lib/core/debugger.js.map +0 -1
- package/dist/lib/core/features.js.map +0 -1
- package/dist/lib/core/logger.js.map +0 -1
- package/dist/lib/core/origin-checker.js.map +0 -1
- package/dist/lib/core/performance-monitor.js.map +0 -1
- package/dist/lib/core/util.js.map +0 -1
- package/dist/lib/core/validator.js.map +0 -1
- package/dist/lib/css/IPropertyDescriptor.js.map +0 -1
- package/dist/lib/css/ITypeDescriptor.js.map +0 -1
- package/dist/lib/css/index.js.map +0 -1
- package/dist/lib/css/layout/__mocks__/bounds.js +0 -9
- package/dist/lib/css/layout/__mocks__/bounds.js.map +0 -1
- package/dist/lib/css/layout/bounds.js.map +0 -1
- package/dist/lib/css/layout/text.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/background-tests.js +0 -49
- package/dist/lib/css/property-descriptors/__tests__/background-tests.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/clip-path.test.js +0 -273
- package/dist/lib/css/property-descriptors/__tests__/clip-path.test.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/font-family.js +0 -19
- package/dist/lib/css/property-descriptors/__tests__/font-family.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/image-rendering-integration.test.js +0 -143
- package/dist/lib/css/property-descriptors/__tests__/image-rendering-integration.test.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/image-rendering-performance.test.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/image-rendering.test.js +0 -61
- package/dist/lib/css/property-descriptors/__tests__/image-rendering.test.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/paint-order.js +0 -66
- package/dist/lib/css/property-descriptors/__tests__/paint-order.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/text-shadow.js +0 -82
- package/dist/lib/css/property-descriptors/__tests__/text-shadow.js.map +0 -1
- package/dist/lib/css/property-descriptors/__tests__/transform-tests.js +0 -14
- package/dist/lib/css/property-descriptors/__tests__/transform-tests.js.map +0 -1
- package/dist/lib/css/property-descriptors/background-clip.js.map +0 -1
- package/dist/lib/css/property-descriptors/background-color.js.map +0 -1
- package/dist/lib/css/property-descriptors/background-image.js.map +0 -1
- package/dist/lib/css/property-descriptors/background-origin.js.map +0 -1
- package/dist/lib/css/property-descriptors/background-position.js.map +0 -1
- package/dist/lib/css/property-descriptors/background-repeat.js.map +0 -1
- package/dist/lib/css/property-descriptors/background-size.js.map +0 -1
- package/dist/lib/css/property-descriptors/border-color.js.map +0 -1
- package/dist/lib/css/property-descriptors/border-radius.js.map +0 -1
- package/dist/lib/css/property-descriptors/border-style.js.map +0 -1
- package/dist/lib/css/property-descriptors/border-width.js.map +0 -1
- package/dist/lib/css/property-descriptors/box-shadow.js.map +0 -1
- package/dist/lib/css/property-descriptors/clip-path.js.map +0 -1
- package/dist/lib/css/property-descriptors/color.js.map +0 -1
- package/dist/lib/css/property-descriptors/content.js.map +0 -1
- package/dist/lib/css/property-descriptors/counter-increment.js.map +0 -1
- package/dist/lib/css/property-descriptors/counter-reset.js.map +0 -1
- package/dist/lib/css/property-descriptors/direction.js.map +0 -1
- package/dist/lib/css/property-descriptors/display.js.map +0 -1
- package/dist/lib/css/property-descriptors/duration.js.map +0 -1
- package/dist/lib/css/property-descriptors/float.js.map +0 -1
- package/dist/lib/css/property-descriptors/font-family.js.map +0 -1
- package/dist/lib/css/property-descriptors/font-size.js.map +0 -1
- package/dist/lib/css/property-descriptors/font-style.js.map +0 -1
- package/dist/lib/css/property-descriptors/font-variant.js.map +0 -1
- package/dist/lib/css/property-descriptors/font-weight.js.map +0 -1
- package/dist/lib/css/property-descriptors/image-rendering.js.map +0 -1
- package/dist/lib/css/property-descriptors/letter-spacing.js.map +0 -1
- package/dist/lib/css/property-descriptors/line-break.js.map +0 -1
- package/dist/lib/css/property-descriptors/line-height.js.map +0 -1
- package/dist/lib/css/property-descriptors/list-style-image.js.map +0 -1
- package/dist/lib/css/property-descriptors/list-style-position.js.map +0 -1
- package/dist/lib/css/property-descriptors/list-style-type.js.map +0 -1
- package/dist/lib/css/property-descriptors/margin.js.map +0 -1
- package/dist/lib/css/property-descriptors/object-fit.js.map +0 -1
- package/dist/lib/css/property-descriptors/opacity.js.map +0 -1
- package/dist/lib/css/property-descriptors/overflow-wrap.js.map +0 -1
- package/dist/lib/css/property-descriptors/overflow.js.map +0 -1
- package/dist/lib/css/property-descriptors/padding.js.map +0 -1
- package/dist/lib/css/property-descriptors/paint-order.js.map +0 -1
- package/dist/lib/css/property-descriptors/position.js.map +0 -1
- package/dist/lib/css/property-descriptors/quotes.js.map +0 -1
- package/dist/lib/css/property-descriptors/rotate.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-align.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-color.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-line.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-style.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-decoration-thickness.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-overflow.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-shadow.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-transform.js.map +0 -1
- package/dist/lib/css/property-descriptors/text-underline-offset.js.map +0 -1
- package/dist/lib/css/property-descriptors/transform-origin.js.map +0 -1
- package/dist/lib/css/property-descriptors/transform.js.map +0 -1
- package/dist/lib/css/property-descriptors/visibility.js.map +0 -1
- package/dist/lib/css/property-descriptors/webkit-line-clamp.js.map +0 -1
- package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js.map +0 -1
- package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js.map +0 -1
- package/dist/lib/css/property-descriptors/word-break.js.map +0 -1
- package/dist/lib/css/property-descriptors/z-index.js.map +0 -1
- package/dist/lib/css/syntax/__tests__/tokernizer-tests.js +0 -26
- package/dist/lib/css/syntax/__tests__/tokernizer-tests.js.map +0 -1
- package/dist/lib/css/syntax/parser.js.map +0 -1
- package/dist/lib/css/syntax/tokenizer.js.map +0 -1
- package/dist/lib/css/types/__tests__/color-tests.js +0 -111
- package/dist/lib/css/types/__tests__/color-tests.js.map +0 -1
- package/dist/lib/css/types/__tests__/image-tests.js +0 -215
- package/dist/lib/css/types/__tests__/image-tests.js.map +0 -1
- package/dist/lib/css/types/angle.js.map +0 -1
- package/dist/lib/css/types/color-math.js.map +0 -1
- package/dist/lib/css/types/color-spaces/a98.js.map +0 -1
- package/dist/lib/css/types/color-spaces/p3.js.map +0 -1
- package/dist/lib/css/types/color-spaces/pro-photo.js.map +0 -1
- package/dist/lib/css/types/color-spaces/rec2020.js.map +0 -1
- package/dist/lib/css/types/color-spaces/srgb.js.map +0 -1
- package/dist/lib/css/types/color-utilities.js.map +0 -1
- package/dist/lib/css/types/color.js.map +0 -1
- package/dist/lib/css/types/functions/-prefix-linear-gradient.js.map +0 -1
- package/dist/lib/css/types/functions/-prefix-radial-gradient.js.map +0 -1
- package/dist/lib/css/types/functions/-webkit-gradient.js.map +0 -1
- package/dist/lib/css/types/functions/__tests__/radial-gradient.js +0 -63
- package/dist/lib/css/types/functions/__tests__/radial-gradient.js.map +0 -1
- package/dist/lib/css/types/functions/counter.js.map +0 -1
- package/dist/lib/css/types/functions/gradient.js.map +0 -1
- package/dist/lib/css/types/functions/linear-gradient.js.map +0 -1
- package/dist/lib/css/types/functions/radial-gradient.js.map +0 -1
- package/dist/lib/css/types/image.js.map +0 -1
- package/dist/lib/css/types/index.js.map +0 -1
- package/dist/lib/css/types/length-percentage.js.map +0 -1
- package/dist/lib/css/types/length.js.map +0 -1
- package/dist/lib/css/types/time.js.map +0 -1
- package/dist/lib/dom/__mocks__/document-cloner.js +0 -23
- package/dist/lib/dom/__mocks__/document-cloner.js.map +0 -1
- package/dist/lib/dom/__tests__/dom-normalizer.test.js.map +0 -1
- package/dist/lib/dom/__tests__/element-container.test.js +0 -109
- package/dist/lib/dom/__tests__/element-container.test.js.map +0 -1
- package/dist/lib/dom/document-cloner.js.map +0 -1
- package/dist/lib/dom/dom-normalizer.js.map +0 -1
- package/dist/lib/dom/element-container.js.map +0 -1
- package/dist/lib/dom/elements/li-element-container.js.map +0 -1
- package/dist/lib/dom/elements/ol-element-container.js.map +0 -1
- package/dist/lib/dom/elements/select-element-container.js.map +0 -1
- package/dist/lib/dom/elements/textarea-element-container.js.map +0 -1
- package/dist/lib/dom/node-parser.js.map +0 -1
- package/dist/lib/dom/node-type-guards.js.map +0 -1
- package/dist/lib/dom/replaced-elements/canvas-element-container.js.map +0 -1
- package/dist/lib/dom/replaced-elements/iframe-element-container.js.map +0 -1
- package/dist/lib/dom/replaced-elements/image-element-container.js.map +0 -1
- package/dist/lib/dom/replaced-elements/index.js.map +0 -1
- package/dist/lib/dom/replaced-elements/input-element-container.js.map +0 -1
- package/dist/lib/dom/replaced-elements/pseudo-elements.js.map +0 -1
- package/dist/lib/dom/replaced-elements/svg-element-container.js.map +0 -1
- package/dist/lib/dom/text-container.js.map +0 -1
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/invariant.js.map +0 -1
- package/dist/lib/render/background.js.map +0 -1
- package/dist/lib/render/bezier-curve.js.map +0 -1
- package/dist/lib/render/border.js.map +0 -1
- package/dist/lib/render/bound-curves.js.map +0 -1
- package/dist/lib/render/box-sizing.js.map +0 -1
- package/dist/lib/render/canvas/__tests__/background-renderer.test.js.map +0 -1
- package/dist/lib/render/canvas/__tests__/border-renderer.test.js +0 -23
- package/dist/lib/render/canvas/__tests__/border-renderer.test.js.map +0 -1
- package/dist/lib/render/canvas/__tests__/effects-renderer.test.js +0 -30
- package/dist/lib/render/canvas/__tests__/effects-renderer.test.js.map +0 -1
- package/dist/lib/render/canvas/__tests__/text-renderer.test.js +0 -310
- package/dist/lib/render/canvas/__tests__/text-renderer.test.js.map +0 -1
- package/dist/lib/render/canvas/background-renderer.js.map +0 -1
- package/dist/lib/render/canvas/border-renderer.js.map +0 -1
- package/dist/lib/render/canvas/canvas-renderer.js.map +0 -1
- package/dist/lib/render/canvas/effects-renderer.js.map +0 -1
- package/dist/lib/render/canvas/foreignobject-renderer.js.map +0 -1
- package/dist/lib/render/canvas/text-renderer.js.map +0 -1
- package/dist/lib/render/effects.js.map +0 -1
- package/dist/lib/render/font-metrics.js.map +0 -1
- package/dist/lib/render/path.js.map +0 -1
- package/dist/lib/render/renderer-interface.js.map +0 -1
- package/dist/lib/render/renderer.js +0 -11
- package/dist/lib/render/renderer.js.map +0 -1
- package/dist/lib/render/stacking-context.js.map +0 -1
- package/dist/lib/render/vector.js.map +0 -1
- package/dist/types/__tests__/index.d.ts +0 -1
- package/dist/types/core/__mocks__/cache-storage.d.ts +0 -2
- package/dist/types/core/__mocks__/context.d.ts +0 -9
- package/dist/types/core/__mocks__/features.d.ts +0 -8
- package/dist/types/core/__mocks__/logger.d.ts +0 -9
- package/dist/types/core/__tests__/cache-storage.d.ts +0 -1
- package/dist/types/core/__tests__/cache-storage.test.d.ts +0 -1
- package/dist/types/core/__tests__/logger.d.ts +0 -1
- package/dist/types/core/__tests__/validator.d.ts +0 -1
- package/dist/types/css/layout/__mocks__/bounds.d.ts +0 -2
- package/dist/types/css/property-descriptors/__tests__/background-tests.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/clip-path.test.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/font-family.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/image-rendering-integration.test.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/image-rendering-performance.test.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/image-rendering.test.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/paint-order.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/text-shadow.d.ts +0 -1
- package/dist/types/css/property-descriptors/__tests__/transform-tests.d.ts +0 -1
- package/dist/types/css/syntax/__tests__/tokernizer-tests.d.ts +0 -1
- package/dist/types/css/types/__tests__/color-tests.d.ts +0 -1
- package/dist/types/css/types/__tests__/image-tests.d.ts +0 -1
- package/dist/types/css/types/functions/__tests__/radial-gradient.d.ts +0 -1
- package/dist/types/dom/__mocks__/document-cloner.d.ts +0 -6
- package/dist/types/dom/__tests__/dom-normalizer.test.d.ts +0 -1
- package/dist/types/dom/__tests__/element-container.test.d.ts +0 -1
- package/dist/types/render/canvas/__tests__/background-renderer.test.d.ts +0 -1
- package/dist/types/render/canvas/__tests__/border-renderer.test.d.ts +0 -1
- package/dist/types/render/canvas/__tests__/effects-renderer.test.d.ts +0 -1
- package/dist/types/render/canvas/__tests__/text-renderer.test.d.ts +0 -1
- package/dist/types/render/renderer.d.ts +0 -7
- package/eslint.config.js +0 -35
- package/jest.config.cjs +0 -5
- package/karma.conf.cjs +0 -300
- /package/dist/types/css/{IPropertyDescriptor.d.ts → property-descriptor.d.ts} +0 -0
- /package/dist/types/css/{ITypeDescriptor.d.ts → type-descriptor.d.ts} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { IPropertyListDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { CSSValue, isIdentToken } from '../syntax/parser';
|
|
3
|
+
import { Context } from '../../core/context';
|
|
4
|
+
export const enum DISPLAY {
|
|
5
|
+
NONE = 0,
|
|
6
|
+
BLOCK = 1 << 1,
|
|
7
|
+
INLINE = 1 << 2,
|
|
8
|
+
RUN_IN = 1 << 3,
|
|
9
|
+
FLOW = 1 << 4,
|
|
10
|
+
FLOW_ROOT = 1 << 5,
|
|
11
|
+
TABLE = 1 << 6,
|
|
12
|
+
FLEX = 1 << 7,
|
|
13
|
+
GRID = 1 << 8,
|
|
14
|
+
RUBY = 1 << 9,
|
|
15
|
+
SUBGRID = 1 << 10,
|
|
16
|
+
LIST_ITEM = 1 << 11,
|
|
17
|
+
TABLE_ROW_GROUP = 1 << 12,
|
|
18
|
+
TABLE_HEADER_GROUP = 1 << 13,
|
|
19
|
+
TABLE_FOOTER_GROUP = 1 << 14,
|
|
20
|
+
TABLE_ROW = 1 << 15,
|
|
21
|
+
TABLE_CELL = 1 << 16,
|
|
22
|
+
TABLE_COLUMN_GROUP = 1 << 17,
|
|
23
|
+
TABLE_COLUMN = 1 << 18,
|
|
24
|
+
TABLE_CAPTION = 1 << 19,
|
|
25
|
+
RUBY_BASE = 1 << 20,
|
|
26
|
+
RUBY_TEXT = 1 << 21,
|
|
27
|
+
RUBY_BASE_CONTAINER = 1 << 22,
|
|
28
|
+
RUBY_TEXT_CONTAINER = 1 << 23,
|
|
29
|
+
CONTENTS = 1 << 24,
|
|
30
|
+
INLINE_BLOCK = 1 << 25,
|
|
31
|
+
INLINE_LIST_ITEM = 1 << 26,
|
|
32
|
+
INLINE_TABLE = 1 << 27,
|
|
33
|
+
INLINE_FLEX = 1 << 28,
|
|
34
|
+
INLINE_GRID = 1 << 29
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type Display = number;
|
|
38
|
+
|
|
39
|
+
export const display: IPropertyListDescriptor<Display> = {
|
|
40
|
+
name: 'display',
|
|
41
|
+
initialValue: 'inline-block',
|
|
42
|
+
prefix: false,
|
|
43
|
+
type: PropertyDescriptorParsingType.LIST,
|
|
44
|
+
parse: (_context: Context, tokens: CSSValue[]): Display => {
|
|
45
|
+
return tokens.filter(isIdentToken).reduce((bit, token) => {
|
|
46
|
+
return bit | parseDisplayValue(token.value);
|
|
47
|
+
}, DISPLAY.NONE);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const parseDisplayValue = (display: string): Display => {
|
|
52
|
+
switch (display) {
|
|
53
|
+
case 'block':
|
|
54
|
+
case '-webkit-box':
|
|
55
|
+
return DISPLAY.BLOCK;
|
|
56
|
+
case 'inline':
|
|
57
|
+
return DISPLAY.INLINE;
|
|
58
|
+
case 'run-in':
|
|
59
|
+
return DISPLAY.RUN_IN;
|
|
60
|
+
case 'flow':
|
|
61
|
+
return DISPLAY.FLOW;
|
|
62
|
+
case 'flow-root':
|
|
63
|
+
return DISPLAY.FLOW_ROOT;
|
|
64
|
+
case 'table':
|
|
65
|
+
return DISPLAY.TABLE;
|
|
66
|
+
case 'flex':
|
|
67
|
+
case '-webkit-flex':
|
|
68
|
+
return DISPLAY.FLEX;
|
|
69
|
+
case 'grid':
|
|
70
|
+
case '-ms-grid':
|
|
71
|
+
return DISPLAY.GRID;
|
|
72
|
+
case 'ruby':
|
|
73
|
+
return DISPLAY.RUBY;
|
|
74
|
+
case 'subgrid':
|
|
75
|
+
return DISPLAY.SUBGRID;
|
|
76
|
+
case 'list-item':
|
|
77
|
+
return DISPLAY.LIST_ITEM;
|
|
78
|
+
case 'table-row-group':
|
|
79
|
+
return DISPLAY.TABLE_ROW_GROUP;
|
|
80
|
+
case 'table-header-group':
|
|
81
|
+
return DISPLAY.TABLE_HEADER_GROUP;
|
|
82
|
+
case 'table-footer-group':
|
|
83
|
+
return DISPLAY.TABLE_FOOTER_GROUP;
|
|
84
|
+
case 'table-row':
|
|
85
|
+
return DISPLAY.TABLE_ROW;
|
|
86
|
+
case 'table-cell':
|
|
87
|
+
return DISPLAY.TABLE_CELL;
|
|
88
|
+
case 'table-column-group':
|
|
89
|
+
return DISPLAY.TABLE_COLUMN_GROUP;
|
|
90
|
+
case 'table-column':
|
|
91
|
+
return DISPLAY.TABLE_COLUMN;
|
|
92
|
+
case 'table-caption':
|
|
93
|
+
return DISPLAY.TABLE_CAPTION;
|
|
94
|
+
case 'ruby-base':
|
|
95
|
+
return DISPLAY.RUBY_BASE;
|
|
96
|
+
case 'ruby-text':
|
|
97
|
+
return DISPLAY.RUBY_TEXT;
|
|
98
|
+
case 'ruby-base-container':
|
|
99
|
+
return DISPLAY.RUBY_BASE_CONTAINER;
|
|
100
|
+
case 'ruby-text-container':
|
|
101
|
+
return DISPLAY.RUBY_TEXT_CONTAINER;
|
|
102
|
+
case 'contents':
|
|
103
|
+
return DISPLAY.CONTENTS;
|
|
104
|
+
case 'inline-block':
|
|
105
|
+
return DISPLAY.INLINE_BLOCK;
|
|
106
|
+
case 'inline-list-item':
|
|
107
|
+
return DISPLAY.INLINE_LIST_ITEM;
|
|
108
|
+
case 'inline-table':
|
|
109
|
+
return DISPLAY.INLINE_TABLE;
|
|
110
|
+
case 'inline-flex':
|
|
111
|
+
return DISPLAY.INLINE_FLEX;
|
|
112
|
+
case 'inline-grid':
|
|
113
|
+
return DISPLAY.INLINE_GRID;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return DISPLAY.NONE;
|
|
117
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IPropertyListDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { Context } from '../../core/context';
|
|
3
|
+
import { CSSValue, isDimensionToken } from '../syntax/parser';
|
|
4
|
+
import { time } from '../types/time';
|
|
5
|
+
|
|
6
|
+
export const duration: IPropertyListDescriptor<number[]> = {
|
|
7
|
+
name: 'duration',
|
|
8
|
+
initialValue: '0s',
|
|
9
|
+
prefix: false,
|
|
10
|
+
type: PropertyDescriptorParsingType.LIST,
|
|
11
|
+
parse: (context: Context, tokens: CSSValue[]) => {
|
|
12
|
+
return tokens.filter(isDimensionToken).map((token) => time.parse(context, token));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IPropertyIdentValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { Context } from '../../core/context';
|
|
3
|
+
export const enum FLOAT {
|
|
4
|
+
NONE = 0,
|
|
5
|
+
LEFT = 1,
|
|
6
|
+
RIGHT = 2,
|
|
7
|
+
INLINE_START = 3,
|
|
8
|
+
INLINE_END = 4
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const float: IPropertyIdentValueDescriptor<FLOAT> = {
|
|
12
|
+
name: 'float',
|
|
13
|
+
initialValue: 'none',
|
|
14
|
+
prefix: false,
|
|
15
|
+
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
16
|
+
parse: (_context: Context, float: string) => {
|
|
17
|
+
switch (float) {
|
|
18
|
+
case 'left':
|
|
19
|
+
return FLOAT.LEFT;
|
|
20
|
+
case 'right':
|
|
21
|
+
return FLOAT.RIGHT;
|
|
22
|
+
case 'inline-start':
|
|
23
|
+
return FLOAT.INLINE_START;
|
|
24
|
+
case 'inline-end':
|
|
25
|
+
return FLOAT.INLINE_END;
|
|
26
|
+
}
|
|
27
|
+
return FLOAT.NONE;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IPropertyListDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { CSSValue } from '../syntax/parser';
|
|
3
|
+
import { TokenType } from '../syntax/tokenizer';
|
|
4
|
+
import { Context } from '../../core/context';
|
|
5
|
+
|
|
6
|
+
export type FONT_FAMILY = string;
|
|
7
|
+
|
|
8
|
+
export type FontFamily = FONT_FAMILY[];
|
|
9
|
+
|
|
10
|
+
export const fontFamily: IPropertyListDescriptor<FontFamily> = {
|
|
11
|
+
name: `font-family`,
|
|
12
|
+
initialValue: '',
|
|
13
|
+
prefix: false,
|
|
14
|
+
type: PropertyDescriptorParsingType.LIST,
|
|
15
|
+
parse: (_context: Context, tokens: CSSValue[]) => {
|
|
16
|
+
const accumulator: string[] = [];
|
|
17
|
+
const results: string[] = [];
|
|
18
|
+
tokens.forEach((token) => {
|
|
19
|
+
switch (token.type) {
|
|
20
|
+
case TokenType.IDENT_TOKEN:
|
|
21
|
+
case TokenType.STRING_TOKEN:
|
|
22
|
+
accumulator.push(token.value);
|
|
23
|
+
break;
|
|
24
|
+
case TokenType.NUMBER_TOKEN:
|
|
25
|
+
accumulator.push(token.number.toString());
|
|
26
|
+
break;
|
|
27
|
+
case TokenType.COMMA_TOKEN:
|
|
28
|
+
results.push(accumulator.join(' '));
|
|
29
|
+
accumulator.length = 0;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (accumulator.length) {
|
|
34
|
+
results.push(accumulator.join(' '));
|
|
35
|
+
}
|
|
36
|
+
return results.map((result) => (result.indexOf(' ') === -1 ? result : `'${result}'`));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPropertyTypeValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
|
|
3
|
+
export const fontSize: IPropertyTypeValueDescriptor = {
|
|
4
|
+
name: `font-size`,
|
|
5
|
+
initialValue: '0',
|
|
6
|
+
prefix: false,
|
|
7
|
+
type: PropertyDescriptorParsingType.TYPE_VALUE,
|
|
8
|
+
format: 'length'
|
|
9
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IPropertyIdentValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { Context } from '../../core/context';
|
|
3
|
+
export const enum FONT_STYLE {
|
|
4
|
+
NORMAL = 'normal',
|
|
5
|
+
ITALIC = 'italic',
|
|
6
|
+
OBLIQUE = 'oblique'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const fontStyle: IPropertyIdentValueDescriptor<FONT_STYLE> = {
|
|
10
|
+
name: 'font-style',
|
|
11
|
+
initialValue: 'normal',
|
|
12
|
+
prefix: false,
|
|
13
|
+
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
14
|
+
parse: (_context: Context, overflow: string) => {
|
|
15
|
+
switch (overflow) {
|
|
16
|
+
case 'oblique':
|
|
17
|
+
return FONT_STYLE.OBLIQUE;
|
|
18
|
+
case 'italic':
|
|
19
|
+
return FONT_STYLE.ITALIC;
|
|
20
|
+
case 'normal':
|
|
21
|
+
default:
|
|
22
|
+
return FONT_STYLE.NORMAL;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IPropertyListDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { CSSValue, isIdentToken } from '../syntax/parser';
|
|
3
|
+
import { Context } from '../../core/context';
|
|
4
|
+
export const fontVariant: IPropertyListDescriptor<string[]> = {
|
|
5
|
+
name: 'font-variant',
|
|
6
|
+
initialValue: 'none',
|
|
7
|
+
type: PropertyDescriptorParsingType.LIST,
|
|
8
|
+
prefix: false,
|
|
9
|
+
parse: (_context: Context, tokens: CSSValue[]): string[] => {
|
|
10
|
+
return tokens.filter(isIdentToken).map((token) => token.value);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IPropertyValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { CSSValue, isIdentToken, isNumberToken } from '../syntax/parser';
|
|
3
|
+
import { Context } from '../../core/context';
|
|
4
|
+
export const fontWeight: IPropertyValueDescriptor<number> = {
|
|
5
|
+
name: 'font-weight',
|
|
6
|
+
initialValue: 'normal',
|
|
7
|
+
type: PropertyDescriptorParsingType.VALUE,
|
|
8
|
+
prefix: false,
|
|
9
|
+
parse: (_context: Context, token: CSSValue): number => {
|
|
10
|
+
if (isNumberToken(token)) {
|
|
11
|
+
return token.number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (isIdentToken(token)) {
|
|
15
|
+
switch (token.value) {
|
|
16
|
+
case 'bold':
|
|
17
|
+
return 700;
|
|
18
|
+
case 'normal':
|
|
19
|
+
default:
|
|
20
|
+
return 400;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return 400;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IPropertyIdentValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { Context } from '../../core/context';
|
|
3
|
+
|
|
4
|
+
export enum IMAGE_RENDERING {
|
|
5
|
+
AUTO = 0,
|
|
6
|
+
CRISP_EDGES = 1,
|
|
7
|
+
PIXELATED = 2,
|
|
8
|
+
SMOOTH = 3
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const imageRendering: IPropertyIdentValueDescriptor<IMAGE_RENDERING> = {
|
|
12
|
+
name: 'image-rendering',
|
|
13
|
+
initialValue: 'auto',
|
|
14
|
+
prefix: false,
|
|
15
|
+
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
16
|
+
parse: (_context: Context, value: string): IMAGE_RENDERING => {
|
|
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,25 @@
|
|
|
1
|
+
import { IPropertyValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { CSSValue } from '../syntax/parser';
|
|
3
|
+
import { TokenType } from '../syntax/tokenizer';
|
|
4
|
+
import { Context } from '../../core/context';
|
|
5
|
+
export const letterSpacing: IPropertyValueDescriptor<number> = {
|
|
6
|
+
name: 'letter-spacing',
|
|
7
|
+
initialValue: '0',
|
|
8
|
+
prefix: false,
|
|
9
|
+
type: PropertyDescriptorParsingType.VALUE,
|
|
10
|
+
parse: (_context: Context, token: CSSValue) => {
|
|
11
|
+
if (token.type === TokenType.IDENT_TOKEN && token.value === 'normal') {
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (token.type === TokenType.NUMBER_TOKEN) {
|
|
16
|
+
return token.number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (token.type === TokenType.DIMENSION_TOKEN) {
|
|
20
|
+
return token.number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPropertyIdentValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { Context } from '../../core/context';
|
|
3
|
+
export enum LINE_BREAK {
|
|
4
|
+
NORMAL = 'normal',
|
|
5
|
+
STRICT = 'strict'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const lineBreak: IPropertyIdentValueDescriptor<LINE_BREAK> = {
|
|
9
|
+
name: 'line-break',
|
|
10
|
+
initialValue: 'normal',
|
|
11
|
+
prefix: false,
|
|
12
|
+
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
13
|
+
parse: (_context: Context, lineBreak: string): LINE_BREAK => {
|
|
14
|
+
switch (lineBreak) {
|
|
15
|
+
case 'strict':
|
|
16
|
+
return LINE_BREAK.STRICT;
|
|
17
|
+
case 'normal':
|
|
18
|
+
default:
|
|
19
|
+
return LINE_BREAK.NORMAL;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPropertyTokenValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { CSSValue, isIdentToken } from '../syntax/parser';
|
|
3
|
+
import { TokenType } from '../syntax/tokenizer';
|
|
4
|
+
import { getAbsoluteValue, isLengthPercentage } from '../types/length-percentage';
|
|
5
|
+
export const lineHeight: IPropertyTokenValueDescriptor = {
|
|
6
|
+
name: 'line-height',
|
|
7
|
+
initialValue: 'normal',
|
|
8
|
+
prefix: false,
|
|
9
|
+
type: PropertyDescriptorParsingType.TOKEN_VALUE
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const computeLineHeight = (token: CSSValue, fontSize: number): number => {
|
|
13
|
+
if (isIdentToken(token) && token.value === 'normal') {
|
|
14
|
+
return 1.2 * fontSize;
|
|
15
|
+
} else if (token.type === TokenType.NUMBER_TOKEN) {
|
|
16
|
+
return fontSize * token.number;
|
|
17
|
+
} else if (isLengthPercentage(token)) {
|
|
18
|
+
return getAbsoluteValue(token, fontSize);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return fontSize;
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TokenType } from '../syntax/tokenizer';
|
|
2
|
+
import { ICSSImage, image } from '../types/image';
|
|
3
|
+
import { IPropertyValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
4
|
+
import { CSSValue } from '../syntax/parser';
|
|
5
|
+
import { Context } from '../../core/context';
|
|
6
|
+
|
|
7
|
+
export const listStyleImage: IPropertyValueDescriptor<ICSSImage | null> = {
|
|
8
|
+
name: 'list-style-image',
|
|
9
|
+
initialValue: 'none',
|
|
10
|
+
type: PropertyDescriptorParsingType.VALUE,
|
|
11
|
+
prefix: false,
|
|
12
|
+
parse: (context: Context, token: CSSValue) => {
|
|
13
|
+
if (token.type === TokenType.IDENT_TOKEN && token.value === 'none') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return image.parse(context, token);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPropertyIdentValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { Context } from '../../core/context';
|
|
3
|
+
export const enum LIST_STYLE_POSITION {
|
|
4
|
+
INSIDE = 0,
|
|
5
|
+
OUTSIDE = 1
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const listStylePosition: IPropertyIdentValueDescriptor<LIST_STYLE_POSITION> = {
|
|
9
|
+
name: 'list-style-position',
|
|
10
|
+
initialValue: 'outside',
|
|
11
|
+
prefix: false,
|
|
12
|
+
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
13
|
+
parse: (_context: Context, position: string) => {
|
|
14
|
+
switch (position) {
|
|
15
|
+
case 'inside':
|
|
16
|
+
return LIST_STYLE_POSITION.INSIDE;
|
|
17
|
+
case 'outside':
|
|
18
|
+
default:
|
|
19
|
+
return LIST_STYLE_POSITION.OUTSIDE;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Context } from '../../core/context';
|
|
2
|
+
import { IPropertyIdentValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
3
|
+
export const enum LIST_STYLE_TYPE {
|
|
4
|
+
NONE = -1,
|
|
5
|
+
DISC = 0,
|
|
6
|
+
CIRCLE = 1,
|
|
7
|
+
SQUARE = 2,
|
|
8
|
+
DECIMAL = 3,
|
|
9
|
+
CJK_DECIMAL = 4,
|
|
10
|
+
DECIMAL_LEADING_ZERO = 5,
|
|
11
|
+
LOWER_ROMAN = 6,
|
|
12
|
+
UPPER_ROMAN = 7,
|
|
13
|
+
LOWER_GREEK = 8,
|
|
14
|
+
LOWER_ALPHA = 9,
|
|
15
|
+
UPPER_ALPHA = 10,
|
|
16
|
+
ARABIC_INDIC = 11,
|
|
17
|
+
ARMENIAN = 12,
|
|
18
|
+
BENGALI = 13,
|
|
19
|
+
CAMBODIAN = 14,
|
|
20
|
+
CJK_EARTHLY_BRANCH = 15,
|
|
21
|
+
CJK_HEAVENLY_STEM = 16,
|
|
22
|
+
CJK_IDEOGRAPHIC = 17,
|
|
23
|
+
DEVANAGARI = 18,
|
|
24
|
+
ETHIOPIC_NUMERIC = 19,
|
|
25
|
+
GEORGIAN = 20,
|
|
26
|
+
GUJARATI = 21,
|
|
27
|
+
GURMUKHI = 22,
|
|
28
|
+
HIRAGANA = 23,
|
|
29
|
+
HIRAGANA_IROHA = 24,
|
|
30
|
+
JAPANESE_FORMAL = 25,
|
|
31
|
+
JAPANESE_INFORMAL = 26,
|
|
32
|
+
KANNADA = 27,
|
|
33
|
+
KATAKANA = 28,
|
|
34
|
+
KATAKANA_IROHA = 29,
|
|
35
|
+
KHMER = 30,
|
|
36
|
+
KOREAN_HANGUL_FORMAL = 31,
|
|
37
|
+
KOREAN_HANJA_FORMAL = 32,
|
|
38
|
+
KOREAN_HANJA_INFORMAL = 33,
|
|
39
|
+
LAO = 34,
|
|
40
|
+
LOWER_ARMENIAN = 35,
|
|
41
|
+
MALAYALAM = 36,
|
|
42
|
+
MONGOLIAN = 37,
|
|
43
|
+
MYANMAR = 38,
|
|
44
|
+
ORIYA = 39,
|
|
45
|
+
PERSIAN = 40,
|
|
46
|
+
SIMP_CHINESE_FORMAL = 41,
|
|
47
|
+
SIMP_CHINESE_INFORMAL = 42,
|
|
48
|
+
TAMIL = 43,
|
|
49
|
+
TELUGU = 44,
|
|
50
|
+
THAI = 45,
|
|
51
|
+
TIBETAN = 46,
|
|
52
|
+
TRAD_CHINESE_FORMAL = 47,
|
|
53
|
+
TRAD_CHINESE_INFORMAL = 48,
|
|
54
|
+
UPPER_ARMENIAN = 49,
|
|
55
|
+
DISCLOSURE_OPEN = 50,
|
|
56
|
+
DISCLOSURE_CLOSED = 51,
|
|
57
|
+
// This was originally 22, duplicating GURMUKHI.
|
|
58
|
+
HEBREW = 52
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const listStyleType: IPropertyIdentValueDescriptor<LIST_STYLE_TYPE> = {
|
|
62
|
+
name: 'list-style-type',
|
|
63
|
+
initialValue: 'none',
|
|
64
|
+
prefix: false,
|
|
65
|
+
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
66
|
+
parse: (_context: Context, type: string) => {
|
|
67
|
+
switch (type) {
|
|
68
|
+
case 'disc':
|
|
69
|
+
return LIST_STYLE_TYPE.DISC;
|
|
70
|
+
case 'circle':
|
|
71
|
+
return LIST_STYLE_TYPE.CIRCLE;
|
|
72
|
+
case 'square':
|
|
73
|
+
return LIST_STYLE_TYPE.SQUARE;
|
|
74
|
+
case 'decimal':
|
|
75
|
+
return LIST_STYLE_TYPE.DECIMAL;
|
|
76
|
+
case 'cjk-decimal':
|
|
77
|
+
return LIST_STYLE_TYPE.CJK_DECIMAL;
|
|
78
|
+
case 'decimal-leading-zero':
|
|
79
|
+
return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;
|
|
80
|
+
case 'lower-roman':
|
|
81
|
+
return LIST_STYLE_TYPE.LOWER_ROMAN;
|
|
82
|
+
case 'upper-roman':
|
|
83
|
+
return LIST_STYLE_TYPE.UPPER_ROMAN;
|
|
84
|
+
case 'lower-greek':
|
|
85
|
+
return LIST_STYLE_TYPE.LOWER_GREEK;
|
|
86
|
+
case 'lower-alpha':
|
|
87
|
+
return LIST_STYLE_TYPE.LOWER_ALPHA;
|
|
88
|
+
case 'upper-alpha':
|
|
89
|
+
return LIST_STYLE_TYPE.UPPER_ALPHA;
|
|
90
|
+
case 'arabic-indic':
|
|
91
|
+
return LIST_STYLE_TYPE.ARABIC_INDIC;
|
|
92
|
+
case 'armenian':
|
|
93
|
+
return LIST_STYLE_TYPE.ARMENIAN;
|
|
94
|
+
case 'bengali':
|
|
95
|
+
return LIST_STYLE_TYPE.BENGALI;
|
|
96
|
+
case 'cambodian':
|
|
97
|
+
return LIST_STYLE_TYPE.CAMBODIAN;
|
|
98
|
+
case 'cjk-earthly-branch':
|
|
99
|
+
return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH;
|
|
100
|
+
case 'cjk-heavenly-stem':
|
|
101
|
+
return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM;
|
|
102
|
+
case 'cjk-ideographic':
|
|
103
|
+
return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC;
|
|
104
|
+
case 'devanagari':
|
|
105
|
+
return LIST_STYLE_TYPE.DEVANAGARI;
|
|
106
|
+
case 'ethiopic-numeric':
|
|
107
|
+
return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC;
|
|
108
|
+
case 'georgian':
|
|
109
|
+
return LIST_STYLE_TYPE.GEORGIAN;
|
|
110
|
+
case 'gujarati':
|
|
111
|
+
return LIST_STYLE_TYPE.GUJARATI;
|
|
112
|
+
case 'gurmukhi':
|
|
113
|
+
return LIST_STYLE_TYPE.GURMUKHI;
|
|
114
|
+
case 'hebrew':
|
|
115
|
+
return LIST_STYLE_TYPE.HEBREW;
|
|
116
|
+
case 'hiragana':
|
|
117
|
+
return LIST_STYLE_TYPE.HIRAGANA;
|
|
118
|
+
case 'hiragana-iroha':
|
|
119
|
+
return LIST_STYLE_TYPE.HIRAGANA_IROHA;
|
|
120
|
+
case 'japanese-formal':
|
|
121
|
+
return LIST_STYLE_TYPE.JAPANESE_FORMAL;
|
|
122
|
+
case 'japanese-informal':
|
|
123
|
+
return LIST_STYLE_TYPE.JAPANESE_INFORMAL;
|
|
124
|
+
case 'kannada':
|
|
125
|
+
return LIST_STYLE_TYPE.KANNADA;
|
|
126
|
+
case 'katakana':
|
|
127
|
+
return LIST_STYLE_TYPE.KATAKANA;
|
|
128
|
+
case 'katakana-iroha':
|
|
129
|
+
return LIST_STYLE_TYPE.KATAKANA_IROHA;
|
|
130
|
+
case 'khmer':
|
|
131
|
+
return LIST_STYLE_TYPE.KHMER;
|
|
132
|
+
case 'korean-hangul-formal':
|
|
133
|
+
return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL;
|
|
134
|
+
case 'korean-hanja-formal':
|
|
135
|
+
return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL;
|
|
136
|
+
case 'korean-hanja-informal':
|
|
137
|
+
return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL;
|
|
138
|
+
case 'lao':
|
|
139
|
+
return LIST_STYLE_TYPE.LAO;
|
|
140
|
+
case 'lower-armenian':
|
|
141
|
+
return LIST_STYLE_TYPE.LOWER_ARMENIAN;
|
|
142
|
+
case 'malayalam':
|
|
143
|
+
return LIST_STYLE_TYPE.MALAYALAM;
|
|
144
|
+
case 'mongolian':
|
|
145
|
+
return LIST_STYLE_TYPE.MONGOLIAN;
|
|
146
|
+
case 'myanmar':
|
|
147
|
+
return LIST_STYLE_TYPE.MYANMAR;
|
|
148
|
+
case 'oriya':
|
|
149
|
+
return LIST_STYLE_TYPE.ORIYA;
|
|
150
|
+
case 'persian':
|
|
151
|
+
return LIST_STYLE_TYPE.PERSIAN;
|
|
152
|
+
case 'simp-chinese-formal':
|
|
153
|
+
return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL;
|
|
154
|
+
case 'simp-chinese-informal':
|
|
155
|
+
return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL;
|
|
156
|
+
case 'tamil':
|
|
157
|
+
return LIST_STYLE_TYPE.TAMIL;
|
|
158
|
+
case 'telugu':
|
|
159
|
+
return LIST_STYLE_TYPE.TELUGU;
|
|
160
|
+
case 'thai':
|
|
161
|
+
return LIST_STYLE_TYPE.THAI;
|
|
162
|
+
case 'tibetan':
|
|
163
|
+
return LIST_STYLE_TYPE.TIBETAN;
|
|
164
|
+
case 'trad-chinese-formal':
|
|
165
|
+
return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL;
|
|
166
|
+
case 'trad-chinese-informal':
|
|
167
|
+
return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL;
|
|
168
|
+
case 'upper-armenian':
|
|
169
|
+
return LIST_STYLE_TYPE.UPPER_ARMENIAN;
|
|
170
|
+
case 'disclosure-open':
|
|
171
|
+
return LIST_STYLE_TYPE.DISCLOSURE_OPEN;
|
|
172
|
+
case 'disclosure-closed':
|
|
173
|
+
return LIST_STYLE_TYPE.DISCLOSURE_CLOSED;
|
|
174
|
+
case 'none':
|
|
175
|
+
default:
|
|
176
|
+
return LIST_STYLE_TYPE.NONE;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IPropertyTokenValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
|
|
3
|
+
const marginForSide = (side: string): IPropertyTokenValueDescriptor => ({
|
|
4
|
+
name: `margin-${side}`,
|
|
5
|
+
initialValue: '0',
|
|
6
|
+
prefix: false,
|
|
7
|
+
type: PropertyDescriptorParsingType.TOKEN_VALUE
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const marginTop: IPropertyTokenValueDescriptor = marginForSide('top');
|
|
11
|
+
export const marginRight: IPropertyTokenValueDescriptor = marginForSide('right');
|
|
12
|
+
export const marginBottom: IPropertyTokenValueDescriptor = marginForSide('bottom');
|
|
13
|
+
export const marginLeft: IPropertyTokenValueDescriptor = marginForSide('left');
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IPropertyIdentValueDescriptor, PropertyDescriptorParsingType } from '../property-descriptor';
|
|
2
|
+
import { Context } from '../../core/context';
|
|
3
|
+
|
|
4
|
+
export const MIX_BLEND_MODE = {
|
|
5
|
+
NORMAL: 'normal',
|
|
6
|
+
MULTIPLY: 'multiply',
|
|
7
|
+
SCREEN: 'screen',
|
|
8
|
+
OVERLAY: 'overlay',
|
|
9
|
+
DARKEN: 'darken',
|
|
10
|
+
LIGHTEN: 'lighten',
|
|
11
|
+
COLOR_DODGE: 'color-dodge',
|
|
12
|
+
COLOR_BURN: 'color-burn',
|
|
13
|
+
HARD_LIGHT: 'hard-light',
|
|
14
|
+
SOFT_LIGHT: 'soft-light',
|
|
15
|
+
DIFFERENCE: 'difference',
|
|
16
|
+
EXCLUSION: 'exclusion',
|
|
17
|
+
HUE: 'hue',
|
|
18
|
+
SATURATION: 'saturation',
|
|
19
|
+
COLOR: 'color',
|
|
20
|
+
LUMINOSITY: 'luminosity'
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
export type MixBlendMode = (typeof MIX_BLEND_MODE)[keyof typeof MIX_BLEND_MODE];
|
|
24
|
+
|
|
25
|
+
const VALID_VALUES = new Set<string>(Object.values(MIX_BLEND_MODE));
|
|
26
|
+
|
|
27
|
+
export const mixBlendMode: IPropertyIdentValueDescriptor<MixBlendMode> = {
|
|
28
|
+
name: 'mix-blend-mode',
|
|
29
|
+
initialValue: 'normal',
|
|
30
|
+
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
31
|
+
prefix: false,
|
|
32
|
+
parse: (_context: Context, token: string): MixBlendMode => {
|
|
33
|
+
return VALID_VALUES.has(token) ? (token as MixBlendMode) : MIX_BLEND_MODE.NORMAL;
|
|
34
|
+
}
|
|
35
|
+
};
|