html2canvas-pro 2.4.5 → 2.5.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 +115 -13
- package/dist/html2canvas-pro.cjs +3058 -1607
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +3058 -1607
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +3055 -1604
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +5 -5
- package/dist/types/core/cache-storage.d.ts +4 -1
- package/dist/types/core/context.d.ts +10 -1
- package/dist/types/core/render-element.d.ts +11 -0
- package/dist/types/core/util.d.ts +6 -0
- package/dist/types/css/index.d.ts +77 -46
- package/dist/types/css/parse.d.ts +15 -0
- package/dist/types/css/property-descriptors/accent-color.d.ts +5 -0
- package/dist/types/css/property-descriptors/backdrop-filter.d.ts +9 -0
- package/dist/types/css/property-descriptors/background-blend-mode.d.ts +16 -16
- package/dist/types/css/property-descriptors/border-image-width.d.ts +36 -0
- package/dist/types/css/property-descriptors/clip-path.d.ts +16 -2
- package/dist/types/css/property-descriptors/isolation.d.ts +6 -0
- package/dist/types/css/property-descriptors/mask.d.ts +25 -0
- package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +16 -16
- package/dist/types/css/property-descriptors/outline.d.ts +15 -0
- package/dist/types/css/property-descriptors/text-emphasis.d.ts +22 -0
- package/dist/types/css/property-descriptors/text-shadow.d.ts +1 -1
- package/dist/types/css/property-descriptors/webkit-box-reflect.d.ts +19 -0
- package/dist/types/css/property-descriptors/webkit-text-fill-color.d.ts +9 -0
- package/dist/types/css/syntax/token-constants.d.ts +1 -1
- package/dist/types/css/types/color-math.d.ts +7 -1
- package/dist/types/css/types/color-spaces/a98.d.ts +2 -1
- package/dist/types/css/types/color-spaces/p3.d.ts +5 -4
- package/dist/types/css/types/color-spaces/pro-photo.d.ts +5 -4
- package/dist/types/css/types/color-spaces/rec2020.d.ts +5 -4
- package/dist/types/css/types/color-spaces/srgb.d.ts +5 -4
- package/dist/types/css/types/color-utilities.d.ts +11 -11
- package/dist/types/css/types/color.d.ts +1 -0
- package/dist/types/css/types/functions/conic-gradient.d.ts +11 -0
- package/dist/types/css/types/functions/image-set.d.ts +11 -0
- package/dist/types/css/types/functions/repeating-radial-gradient.d.ts +8 -0
- package/dist/types/css/types/image.d.ts +15 -2
- package/dist/types/css/types/safe-eval.d.ts +0 -6
- package/dist/types/dom/copy-css-styles.d.ts +8 -0
- package/dist/types/dom/document-cloner.d.ts +3 -13
- package/dist/types/dom/iframe-mount.d.ts +37 -0
- package/dist/types/dom/pseudo-content.d.ts +33 -0
- package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +2 -2
- package/dist/types/options.d.ts +8 -2
- package/dist/types/render/canvas/background-renderer.d.ts +19 -0
- package/dist/types/render/canvas/border-image-renderer.d.ts +50 -1
- package/dist/types/render/canvas/canvas-renderer.d.ts +21 -15
- package/dist/types/render/canvas/mask-renderer.d.ts +36 -0
- package/dist/types/render/canvas/text-clip-renderer.d.ts +36 -0
- package/dist/types/render/canvas/text-renderer.d.ts +22 -0
- package/dist/types/render/stacking-context.d.ts +4 -1
- package/package.json +39 -40
- package/dist/lib/config.js +0 -49
- package/dist/lib/core/abort-helper.js +0 -20
- package/dist/lib/core/background-parser.js +0 -41
- package/dist/lib/core/bitwise.js +0 -5
- package/dist/lib/core/cache-storage.js +0 -283
- package/dist/lib/core/config-assembler.js +0 -88
- package/dist/lib/core/constants.js +0 -25
- package/dist/lib/core/context.js +0 -19
- package/dist/lib/core/debugger.js +0 -27
- package/dist/lib/core/features.js +0 -190
- package/dist/lib/core/logger.js +0 -56
- package/dist/lib/core/lru-map.js +0 -66
- package/dist/lib/core/origin-checker.js +0 -53
- package/dist/lib/core/performance-monitor.js +0 -185
- package/dist/lib/core/render-element.js +0 -131
- package/dist/lib/core/util.js +0 -4
- package/dist/lib/core/validator.js +0 -500
- package/dist/lib/css/grouped/background-styles.js +0 -36
- package/dist/lib/css/grouped/border-styles.js +0 -75
- package/dist/lib/css/grouped/font-styles.js +0 -93
- package/dist/lib/css/grouped/layout-styles.js +0 -127
- package/dist/lib/css/index.js +0 -339
- package/dist/lib/css/layout/bounds.js +0 -52
- package/dist/lib/css/layout/text.js +0 -133
- package/dist/lib/css/property-descriptor.js +0 -2
- package/dist/lib/css/property-descriptors/background-blend-mode.js +0 -41
- package/dist/lib/css/property-descriptors/background-clip.js +0 -25
- package/dist/lib/css/property-descriptors/background-color.js +0 -10
- package/dist/lib/css/property-descriptors/background-image.js +0 -24
- package/dist/lib/css/property-descriptors/background-origin.js +0 -23
- package/dist/lib/css/property-descriptors/background-position.js +0 -19
- package/dist/lib/css/property-descriptors/background-repeat.js +0 -33
- package/dist/lib/css/property-descriptors/background-size.js +0 -23
- package/dist/lib/css/property-descriptors/border-color.js +0 -14
- package/dist/lib/css/property-descriptors/border-image-repeat.js +0 -42
- package/dist/lib/css/property-descriptors/border-image-slice.js +0 -45
- package/dist/lib/css/property-descriptors/border-image-source.js +0 -22
- package/dist/lib/css/property-descriptors/border-radius.js +0 -15
- package/dist/lib/css/property-descriptors/border-style.js +0 -26
- package/dist/lib/css/property-descriptors/border-width.js +0 -20
- package/dist/lib/css/property-descriptors/box-decoration-break.js +0 -18
- package/dist/lib/css/property-descriptors/box-shadow.js +0 -54
- package/dist/lib/css/property-descriptors/clip-path.js +0 -189
- package/dist/lib/css/property-descriptors/color.js +0 -10
- package/dist/lib/css/property-descriptors/content.js +0 -19
- package/dist/lib/css/property-descriptors/counter-increment.js +0 -35
- package/dist/lib/css/property-descriptors/counter-reset.js +0 -18
- package/dist/lib/css/property-descriptors/direction.js +0 -18
- package/dist/lib/css/property-descriptors/display.js +0 -81
- package/dist/lib/css/property-descriptors/duration.js +0 -14
- package/dist/lib/css/property-descriptors/filter.js +0 -86
- package/dist/lib/css/property-descriptors/float.js +0 -22
- package/dist/lib/css/property-descriptors/font-family.js +0 -47
- package/dist/lib/css/property-descriptors/font-size.js +0 -10
- package/dist/lib/css/property-descriptors/font-style.js +0 -20
- package/dist/lib/css/property-descriptors/font-variant-ligatures.js +0 -34
- package/dist/lib/css/property-descriptors/font-variant.js +0 -13
- package/dist/lib/css/property-descriptors/font-weight.js +0 -25
- package/dist/lib/css/property-descriptors/image-rendering.js +0 -33
- package/dist/lib/css/property-descriptors/letter-spacing.js +0 -21
- package/dist/lib/css/property-descriptors/line-break.js +0 -23
- package/dist/lib/css/property-descriptors/line-height.js +0 -24
- package/dist/lib/css/property-descriptors/list-style-image.js +0 -17
- package/dist/lib/css/property-descriptors/list-style-position.js +0 -18
- package/dist/lib/css/property-descriptors/list-style-type.js +0 -122
- package/dist/lib/css/property-descriptors/margin.js +0 -13
- package/dist/lib/css/property-descriptors/mix-blend-mode.js +0 -31
- package/dist/lib/css/property-descriptors/object-fit.js +0 -28
- package/dist/lib/css/property-descriptors/object-position.js +0 -42
- package/dist/lib/css/property-descriptors/opacity.js +0 -16
- package/dist/lib/css/property-descriptors/overflow-wrap.js +0 -18
- package/dist/lib/css/property-descriptors/overflow.js +0 -27
- package/dist/lib/css/property-descriptors/padding.js +0 -14
- package/dist/lib/css/property-descriptors/paint-order.js +0 -33
- package/dist/lib/css/property-descriptors/position.js +0 -22
- package/dist/lib/css/property-descriptors/quotes.js +0 -41
- package/dist/lib/css/property-descriptors/rotate.js +0 -27
- package/dist/lib/css/property-descriptors/text-align.js +0 -21
- package/dist/lib/css/property-descriptors/text-decoration-color.js +0 -10
- package/dist/lib/css/property-descriptors/text-decoration-line.js +0 -28
- package/dist/lib/css/property-descriptors/text-decoration-style.js +0 -24
- package/dist/lib/css/property-descriptors/text-decoration-thickness.js +0 -26
- package/dist/lib/css/property-descriptors/text-overflow.js +0 -18
- package/dist/lib/css/property-descriptors/text-shadow.js +0 -46
- package/dist/lib/css/property-descriptors/text-transform.js +0 -20
- package/dist/lib/css/property-descriptors/text-underline-offset.js +0 -23
- package/dist/lib/css/property-descriptors/transform-origin.js +0 -24
- package/dist/lib/css/property-descriptors/transform.js +0 -57
- package/dist/lib/css/property-descriptors/visibility.js +0 -20
- package/dist/lib/css/property-descriptors/webkit-line-clamp.js +0 -26
- package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +0 -10
- package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +0 -16
- package/dist/lib/css/property-descriptors/white-space.js +0 -32
- package/dist/lib/css/property-descriptors/word-break.js +0 -26
- package/dist/lib/css/property-descriptors/writing-mode.js +0 -28
- package/dist/lib/css/property-descriptors/z-index.js +0 -19
- package/dist/lib/css/property-descriptors/zoom.js +0 -18
- package/dist/lib/css/syntax/parser.js +0 -141
- package/dist/lib/css/syntax/token-constants.js +0 -214
- package/dist/lib/css/syntax/token-singletons.js +0 -36
- package/dist/lib/css/syntax/token-types.js +0 -10
- package/dist/lib/css/syntax/tokenizer.js +0 -502
- package/dist/lib/css/type-descriptor.js +0 -2
- package/dist/lib/css/types/angle.js +0 -80
- package/dist/lib/css/types/color-math.js +0 -25
- package/dist/lib/css/types/color-spaces/a98.js +0 -78
- package/dist/lib/css/types/color-spaces/p3.js +0 -86
- package/dist/lib/css/types/color-spaces/pro-photo.js +0 -83
- package/dist/lib/css/types/color-spaces/rec2020.js +0 -85
- package/dist/lib/css/types/color-spaces/srgb.js +0 -79
- package/dist/lib/css/types/color-utilities.js +0 -342
- package/dist/lib/css/types/color.js +0 -400
- package/dist/lib/css/types/functions/-prefix-linear-gradient.js +0 -32
- package/dist/lib/css/types/functions/-prefix-radial-gradient.js +0 -83
- package/dist/lib/css/types/functions/-webkit-gradient.js +0 -59
- package/dist/lib/css/types/functions/counter.js +0 -367
- package/dist/lib/css/types/functions/gradient.js +0 -163
- package/dist/lib/css/types/functions/linear-gradient.js +0 -27
- package/dist/lib/css/types/functions/radial-gradient.js +0 -90
- package/dist/lib/css/types/functions/repeating-linear-gradient.js +0 -9
- package/dist/lib/css/types/image.js +0 -62
- package/dist/lib/css/types/index.js +0 -2
- package/dist/lib/css/types/length-percentage.js +0 -197
- package/dist/lib/css/types/length.js +0 -5
- package/dist/lib/css/types/safe-eval.js +0 -80
- package/dist/lib/css/types/time.js +0 -17
- package/dist/lib/dom/document-cloner.js +0 -618
- package/dist/lib/dom/dom-normalizer.js +0 -115
- package/dist/lib/dom/element-container.js +0 -71
- package/dist/lib/dom/elements/li-element-container.js +0 -11
- package/dist/lib/dom/elements/ol-element-container.js +0 -12
- package/dist/lib/dom/elements/select-element-container.js +0 -12
- package/dist/lib/dom/elements/textarea-element-container.js +0 -11
- package/dist/lib/dom/node-parser.js +0 -125
- package/dist/lib/dom/node-type-guards.js +0 -81
- package/dist/lib/dom/replaced-elements/canvas-element-container.js +0 -13
- package/dist/lib/dom/replaced-elements/iframe-element-container.js +0 -38
- package/dist/lib/dom/replaced-elements/image-element-container.js +0 -14
- package/dist/lib/dom/replaced-elements/index.js +0 -2
- package/dist/lib/dom/replaced-elements/input-element-container.js +0 -89
- package/dist/lib/dom/replaced-elements/svg-element-container.js +0 -57
- package/dist/lib/dom/slot-cloner.js +0 -176
- package/dist/lib/dom/text-container.js +0 -35
- package/dist/lib/index.js +0 -49
- package/dist/lib/options.js +0 -2
- package/dist/lib/render/background.js +0 -188
- package/dist/lib/render/bezier-curve.js +0 -34
- package/dist/lib/render/border.js +0 -104
- package/dist/lib/render/bound-curves.js +0 -188
- package/dist/lib/render/box-sizing.js +0 -20
- package/dist/lib/render/canvas/background-renderer.js +0 -338
- package/dist/lib/render/canvas/border-image-renderer.js +0 -153
- package/dist/lib/render/canvas/border-renderer.js +0 -184
- package/dist/lib/render/canvas/box-shadow-geometry.js +0 -52
- package/dist/lib/render/canvas/box-shadow-painter.js +0 -194
- package/dist/lib/render/canvas/box-shadow-transform.js +0 -42
- package/dist/lib/render/canvas/canvas-path.js +0 -25
- package/dist/lib/render/canvas/canvas-renderer.js +0 -610
- package/dist/lib/render/canvas/content-renderer.js +0 -270
- package/dist/lib/render/canvas/effects-renderer.js +0 -171
- package/dist/lib/render/canvas/filter-surface.js +0 -270
- package/dist/lib/render/canvas/font-utils.js +0 -46
- package/dist/lib/render/canvas/foreignobject-renderer.js +0 -38
- package/dist/lib/render/canvas/surface-bounds.js +0 -64
- package/dist/lib/render/canvas/text/text-decoration-renderer.js +0 -99
- package/dist/lib/render/canvas/text-renderer.js +0 -486
- package/dist/lib/render/effects.js +0 -231
- package/dist/lib/render/font-metrics.js +0 -53
- package/dist/lib/render/object-fit.js +0 -91
- package/dist/lib/render/path.js +0 -26
- package/dist/lib/render/renderer-interface.js +0 -2
- package/dist/lib/render/stacking-context.js +0 -341
- package/dist/lib/render/vector.js +0 -16
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseDocumentSize = exports.parseBounds = exports.Bounds = void 0;
|
|
4
|
-
class Bounds {
|
|
5
|
-
constructor(left, top, width, height) {
|
|
6
|
-
this.left = left;
|
|
7
|
-
this.top = top;
|
|
8
|
-
this.width = width;
|
|
9
|
-
this.height = height;
|
|
10
|
-
}
|
|
11
|
-
add(x, y, w, h) {
|
|
12
|
-
return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h);
|
|
13
|
-
}
|
|
14
|
-
static fromClientRect(context, clientRect) {
|
|
15
|
-
return new Bounds(clientRect.left + context.windowBounds.left, clientRect.top + context.windowBounds.top, clientRect.width, clientRect.height);
|
|
16
|
-
}
|
|
17
|
-
static fromDOMRectList(context, domRectList) {
|
|
18
|
-
const rects = Array.from(domRectList);
|
|
19
|
-
// First try to find a rect with non-zero width
|
|
20
|
-
let domRect = rects.find((rect) => rect.width !== 0);
|
|
21
|
-
// If not found, try to find a rect with non-zero height
|
|
22
|
-
// This handles cases like inline-flex with single child where width might be 0
|
|
23
|
-
if (!domRect) {
|
|
24
|
-
domRect = rects.find((rect) => rect.height !== 0);
|
|
25
|
-
}
|
|
26
|
-
// If still not found but rects exist, use the first rect
|
|
27
|
-
// Position info (left, top) might still be valid even if dimensions are 0
|
|
28
|
-
if (!domRect && rects.length > 0) {
|
|
29
|
-
domRect = rects[0];
|
|
30
|
-
}
|
|
31
|
-
return domRect
|
|
32
|
-
? new Bounds(domRect.left + context.windowBounds.left, domRect.top + context.windowBounds.top, domRect.width, domRect.height)
|
|
33
|
-
: Bounds.EMPTY;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.Bounds = Bounds;
|
|
37
|
-
Bounds.EMPTY = new Bounds(0, 0, 0, 0);
|
|
38
|
-
const parseBounds = (context, node) => {
|
|
39
|
-
return Bounds.fromClientRect(context, node.getBoundingClientRect());
|
|
40
|
-
};
|
|
41
|
-
exports.parseBounds = parseBounds;
|
|
42
|
-
const parseDocumentSize = (document) => {
|
|
43
|
-
const body = document.body;
|
|
44
|
-
const documentElement = document.documentElement;
|
|
45
|
-
if (!body || !documentElement) {
|
|
46
|
-
throw new Error(`Unable to get document size`);
|
|
47
|
-
}
|
|
48
|
-
const width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
|
|
49
|
-
const height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
|
|
50
|
-
return new Bounds(0, 0, width, height);
|
|
51
|
-
};
|
|
52
|
-
exports.parseDocumentSize = parseDocumentSize;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.segmentGraphemes = exports.parseTextBounds = exports.TextBounds = void 0;
|
|
4
|
-
const css_line_break_1 = require("css-line-break");
|
|
5
|
-
const text_segmentation_1 = require("text-segmentation");
|
|
6
|
-
const bounds_1 = require("./bounds");
|
|
7
|
-
const features_1 = require("../../core/features");
|
|
8
|
-
const writing_mode_1 = require("../property-descriptors/writing-mode");
|
|
9
|
-
class TextBounds {
|
|
10
|
-
constructor(text, bounds) {
|
|
11
|
-
this.text = text;
|
|
12
|
-
this.bounds = bounds;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.TextBounds = TextBounds;
|
|
16
|
-
const parseTextBounds = (context, value, styles, node) => {
|
|
17
|
-
const textList = breakText(value, styles);
|
|
18
|
-
const textBounds = [];
|
|
19
|
-
let offset = 0;
|
|
20
|
-
textList.forEach((text) => {
|
|
21
|
-
if (styles.textDecorationLine.length || text.trim().length > 0) {
|
|
22
|
-
if (features_1.FEATURES.SUPPORT_RANGE_BOUNDS) {
|
|
23
|
-
const clientRects = createRange(node, offset, text.length).getClientRects();
|
|
24
|
-
if (clientRects.length > 1) {
|
|
25
|
-
const subSegments = (0, exports.segmentGraphemes)(text);
|
|
26
|
-
let subOffset = 0;
|
|
27
|
-
subSegments.forEach((subSegment) => {
|
|
28
|
-
textBounds.push(new TextBounds(subSegment, bounds_1.Bounds.fromDOMRectList(context, createRange(node, subOffset + offset, subSegment.length).getClientRects())));
|
|
29
|
-
subOffset += subSegment.length;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
textBounds.push(new TextBounds(text, bounds_1.Bounds.fromDOMRectList(context, clientRects)));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
const replacementNode = node.splitText(text.length);
|
|
38
|
-
textBounds.push(new TextBounds(text, getWrapperBounds(context, node)));
|
|
39
|
-
node = replacementNode;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else if (!features_1.FEATURES.SUPPORT_RANGE_BOUNDS) {
|
|
43
|
-
node = node.splitText(text.length);
|
|
44
|
-
}
|
|
45
|
-
offset += text.length;
|
|
46
|
-
});
|
|
47
|
-
return textBounds;
|
|
48
|
-
};
|
|
49
|
-
exports.parseTextBounds = parseTextBounds;
|
|
50
|
-
const getWrapperBounds = (context, node) => {
|
|
51
|
-
const ownerDocument = node.ownerDocument;
|
|
52
|
-
if (ownerDocument) {
|
|
53
|
-
const wrapper = ownerDocument.createElement('html2canvaswrapper');
|
|
54
|
-
wrapper.appendChild(node.cloneNode(true));
|
|
55
|
-
const parentNode = node.parentNode;
|
|
56
|
-
if (parentNode) {
|
|
57
|
-
parentNode.replaceChild(wrapper, node);
|
|
58
|
-
const bounds = (0, bounds_1.parseBounds)(context, wrapper);
|
|
59
|
-
if (wrapper.firstChild) {
|
|
60
|
-
parentNode.replaceChild(wrapper.firstChild, wrapper);
|
|
61
|
-
}
|
|
62
|
-
return bounds;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return bounds_1.Bounds.EMPTY;
|
|
66
|
-
};
|
|
67
|
-
const createRange = (node, offset, length) => {
|
|
68
|
-
const ownerDocument = node.ownerDocument;
|
|
69
|
-
if (!ownerDocument) {
|
|
70
|
-
throw new Error('Node has no owner document');
|
|
71
|
-
}
|
|
72
|
-
const range = ownerDocument.createRange();
|
|
73
|
-
range.setStart(node, offset);
|
|
74
|
-
range.setEnd(node, offset + length);
|
|
75
|
-
return range;
|
|
76
|
-
};
|
|
77
|
-
const segmentGraphemes = (value) => {
|
|
78
|
-
if (features_1.FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
|
|
79
|
-
// Intl.Segmenter is TC39 Stage 4 but not yet in TS lib types
|
|
80
|
-
const Segmenter = Intl;
|
|
81
|
-
const seg = new Segmenter.Segmenter(void 0, { granularity: 'grapheme' });
|
|
82
|
-
return Array.from(seg.segment(value)).map((s) => s.segment);
|
|
83
|
-
}
|
|
84
|
-
return (0, text_segmentation_1.splitGraphemes)(value);
|
|
85
|
-
};
|
|
86
|
-
exports.segmentGraphemes = segmentGraphemes;
|
|
87
|
-
const segmentWords = (value, styles) => {
|
|
88
|
-
if (features_1.FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
|
|
89
|
-
const Segmenter = Intl;
|
|
90
|
-
const seg = new Segmenter.Segmenter(void 0, { granularity: 'word' });
|
|
91
|
-
return Array.from(seg.segment(value)).map((s) => s.segment);
|
|
92
|
-
}
|
|
93
|
-
return breakWords(value, styles);
|
|
94
|
-
};
|
|
95
|
-
const breakText = (value, styles) => {
|
|
96
|
-
if ((0, writing_mode_1.isVerticalWritingMode)(styles.writingMode)) {
|
|
97
|
-
return (0, exports.segmentGraphemes)(value);
|
|
98
|
-
}
|
|
99
|
-
return styles.letterSpacing !== 0 ? (0, exports.segmentGraphemes)(value) : segmentWords(value, styles);
|
|
100
|
-
};
|
|
101
|
-
// https://drafts.csswg.org/css-text/#word-separator
|
|
102
|
-
const wordSeparators = [0x0020, 0x00a0, 0x1361, 0x10100, 0x10101, 0x1039, 0x1091];
|
|
103
|
-
const breakWords = (str, styles) => {
|
|
104
|
-
const breaker = (0, css_line_break_1.LineBreaker)(str, {
|
|
105
|
-
lineBreak: styles.lineBreak,
|
|
106
|
-
wordBreak: styles.overflowWrap === "break-word" /* OVERFLOW_WRAP.BREAK_WORD */ ? 'break-word' : styles.wordBreak
|
|
107
|
-
});
|
|
108
|
-
const words = [];
|
|
109
|
-
let bk;
|
|
110
|
-
while (!(bk = breaker.next()).done) {
|
|
111
|
-
if (bk.value) {
|
|
112
|
-
const value = bk.value.slice();
|
|
113
|
-
const codePoints = (0, css_line_break_1.toCodePoints)(value);
|
|
114
|
-
let word = '';
|
|
115
|
-
codePoints.forEach((codePoint) => {
|
|
116
|
-
if (wordSeparators.indexOf(codePoint) === -1) {
|
|
117
|
-
word += (0, css_line_break_1.fromCodePoint)(codePoint);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
if (word.length) {
|
|
121
|
-
words.push(word);
|
|
122
|
-
}
|
|
123
|
-
words.push((0, css_line_break_1.fromCodePoint)(codePoint));
|
|
124
|
-
word = '';
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
if (word.length) {
|
|
128
|
-
words.push(word);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return words;
|
|
133
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundBlendMode = exports.MIX_BLEND_MODE = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
exports.MIX_BLEND_MODE = {
|
|
6
|
-
NORMAL: 'normal',
|
|
7
|
-
MULTIPLY: 'multiply',
|
|
8
|
-
SCREEN: 'screen',
|
|
9
|
-
OVERLAY: 'overlay',
|
|
10
|
-
DARKEN: 'darken',
|
|
11
|
-
LIGHTEN: 'lighten',
|
|
12
|
-
COLOR_DODGE: 'color-dodge',
|
|
13
|
-
COLOR_BURN: 'color-burn',
|
|
14
|
-
HARD_LIGHT: 'hard-light',
|
|
15
|
-
SOFT_LIGHT: 'soft-light',
|
|
16
|
-
DIFFERENCE: 'difference',
|
|
17
|
-
EXCLUSION: 'exclusion',
|
|
18
|
-
HUE: 'hue',
|
|
19
|
-
SATURATION: 'saturation',
|
|
20
|
-
COLOR: 'color',
|
|
21
|
-
LUMINOSITY: 'luminosity'
|
|
22
|
-
};
|
|
23
|
-
const VALID_VALUES = new Set(Object.values(exports.MIX_BLEND_MODE));
|
|
24
|
-
exports.backgroundBlendMode = {
|
|
25
|
-
name: 'background-blend-mode',
|
|
26
|
-
initialValue: 'normal',
|
|
27
|
-
prefix: false,
|
|
28
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
29
|
-
parse: (_context, tokens) => {
|
|
30
|
-
const modes = [];
|
|
31
|
-
const filtered = tokens.filter(parser_1.nonFunctionArgSeparator);
|
|
32
|
-
for (const token of filtered) {
|
|
33
|
-
if ((0, parser_1.isIdentToken)(token)) {
|
|
34
|
-
if (VALID_VALUES.has(token.value)) {
|
|
35
|
-
modes.push(token.value);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return modes.length > 0 ? modes : ['normal'];
|
|
40
|
-
}
|
|
41
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundClip = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
exports.backgroundClip = {
|
|
6
|
-
name: 'background-clip',
|
|
7
|
-
initialValue: 'border-box',
|
|
8
|
-
prefix: false,
|
|
9
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
-
parse: (_context, tokens) => {
|
|
11
|
-
return tokens.map((token) => {
|
|
12
|
-
if ((0, parser_1.isIdentToken)(token)) {
|
|
13
|
-
switch (token.value) {
|
|
14
|
-
case 'padding-box':
|
|
15
|
-
return 1 /* BACKGROUND_CLIP.PADDING_BOX */;
|
|
16
|
-
case 'content-box':
|
|
17
|
-
return 2 /* BACKGROUND_CLIP.CONTENT_BOX */;
|
|
18
|
-
case 'text':
|
|
19
|
-
return 3 /* BACKGROUND_CLIP.TEXT */;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return 0 /* BACKGROUND_CLIP.BORDER_BOX */;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundColor = void 0;
|
|
4
|
-
exports.backgroundColor = {
|
|
5
|
-
name: `background-color`,
|
|
6
|
-
initialValue: 'transparent',
|
|
7
|
-
prefix: false,
|
|
8
|
-
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
9
|
-
format: 'color'
|
|
10
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundImage = void 0;
|
|
4
|
-
const image_1 = require("../types/image");
|
|
5
|
-
const parser_1 = require("../syntax/parser");
|
|
6
|
-
exports.backgroundImage = {
|
|
7
|
-
name: 'background-image',
|
|
8
|
-
initialValue: 'none',
|
|
9
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
-
prefix: false,
|
|
11
|
-
skipCache: true,
|
|
12
|
-
parse: (context, tokens) => {
|
|
13
|
-
if (tokens.length === 0) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
const first = tokens[0];
|
|
17
|
-
if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
return tokens
|
|
21
|
-
.filter((value) => (0, parser_1.nonFunctionArgSeparator)(value) && (0, image_1.isSupportedImage)(value))
|
|
22
|
-
.map((value) => image_1.image.parse(context, value));
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundOrigin = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
exports.backgroundOrigin = {
|
|
6
|
-
name: 'background-origin',
|
|
7
|
-
initialValue: 'border-box',
|
|
8
|
-
prefix: false,
|
|
9
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
-
parse: (_context, tokens) => {
|
|
11
|
-
return tokens.map((token) => {
|
|
12
|
-
if ((0, parser_1.isIdentToken)(token)) {
|
|
13
|
-
switch (token.value) {
|
|
14
|
-
case 'padding-box':
|
|
15
|
-
return 1 /* BACKGROUND_ORIGIN.PADDING_BOX */;
|
|
16
|
-
case 'content-box':
|
|
17
|
-
return 2 /* BACKGROUND_ORIGIN.CONTENT_BOX */;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return 0 /* BACKGROUND_ORIGIN.BORDER_BOX */;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundPosition = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
-
exports.backgroundPosition = {
|
|
7
|
-
name: 'background-position',
|
|
8
|
-
initialValue: '0% 0%',
|
|
9
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
-
prefix: false,
|
|
11
|
-
parse: (_context, tokens) => {
|
|
12
|
-
return (0, parser_1.parseFunctionArgs)(tokens)
|
|
13
|
-
.map((values) => {
|
|
14
|
-
// Convert calc() to length-percentage tokens, keep other length-percentage as is
|
|
15
|
-
return values.map(length_percentage_1.parseOptionalCalcOrLength).filter((v) => v !== null);
|
|
16
|
-
})
|
|
17
|
-
.map(length_percentage_1.parseLengthPercentageTuple);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundRepeat = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
exports.backgroundRepeat = {
|
|
6
|
-
name: 'background-repeat',
|
|
7
|
-
initialValue: 'repeat',
|
|
8
|
-
prefix: false,
|
|
9
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
-
parse: (_context, tokens) => {
|
|
11
|
-
return (0, parser_1.parseFunctionArgs)(tokens)
|
|
12
|
-
.map((values) => values
|
|
13
|
-
.filter(parser_1.isIdentToken)
|
|
14
|
-
.map((token) => token.value)
|
|
15
|
-
.join(' '))
|
|
16
|
-
.map(parseBackgroundRepeat);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const parseBackgroundRepeat = (value) => {
|
|
20
|
-
switch (value) {
|
|
21
|
-
case 'no-repeat':
|
|
22
|
-
return 1 /* BACKGROUND_REPEAT.NO_REPEAT */;
|
|
23
|
-
case 'repeat-x':
|
|
24
|
-
case 'repeat no-repeat':
|
|
25
|
-
return 2 /* BACKGROUND_REPEAT.REPEAT_X */;
|
|
26
|
-
case 'repeat-y':
|
|
27
|
-
case 'no-repeat repeat':
|
|
28
|
-
return 3 /* BACKGROUND_REPEAT.REPEAT_Y */;
|
|
29
|
-
case 'repeat':
|
|
30
|
-
default:
|
|
31
|
-
return 0 /* BACKGROUND_REPEAT.REPEAT */;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.backgroundSize = exports.BACKGROUND_SIZE = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
-
var BACKGROUND_SIZE;
|
|
7
|
-
(function (BACKGROUND_SIZE) {
|
|
8
|
-
BACKGROUND_SIZE["AUTO"] = "auto";
|
|
9
|
-
BACKGROUND_SIZE["CONTAIN"] = "contain";
|
|
10
|
-
BACKGROUND_SIZE["COVER"] = "cover";
|
|
11
|
-
})(BACKGROUND_SIZE || (exports.BACKGROUND_SIZE = BACKGROUND_SIZE = {}));
|
|
12
|
-
exports.backgroundSize = {
|
|
13
|
-
name: 'background-size',
|
|
14
|
-
initialValue: '0',
|
|
15
|
-
prefix: false,
|
|
16
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
17
|
-
parse: (_context, tokens) => {
|
|
18
|
-
return (0, parser_1.parseFunctionArgs)(tokens).map((values) => values
|
|
19
|
-
.map((value) => (isBackgroundSizeInfoToken(value) ? value : (0, length_percentage_1.parseOptionalCalcOrLength)(value)))
|
|
20
|
-
.filter((v) => v !== null));
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const isBackgroundSizeInfoToken = (value) => (0, parser_1.isIdentToken)(value) || (0, length_percentage_1.isLengthPercentage)(value);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderLeftColor = exports.borderBottomColor = exports.borderRightColor = exports.borderTopColor = void 0;
|
|
4
|
-
const borderColorForSide = (side) => ({
|
|
5
|
-
name: `border-${side}-color`,
|
|
6
|
-
initialValue: 'transparent',
|
|
7
|
-
prefix: false,
|
|
8
|
-
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
9
|
-
format: 'color'
|
|
10
|
-
});
|
|
11
|
-
exports.borderTopColor = borderColorForSide('top');
|
|
12
|
-
exports.borderRightColor = borderColorForSide('right');
|
|
13
|
-
exports.borderBottomColor = borderColorForSide('bottom');
|
|
14
|
-
exports.borderLeftColor = borderColorForSide('left');
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderImageRepeat = exports.BORDER_IMAGE_REPEAT = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
var BORDER_IMAGE_REPEAT;
|
|
6
|
-
(function (BORDER_IMAGE_REPEAT) {
|
|
7
|
-
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["STRETCH"] = 0] = "STRETCH";
|
|
8
|
-
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["REPEAT"] = 1] = "REPEAT";
|
|
9
|
-
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["ROUND"] = 2] = "ROUND";
|
|
10
|
-
BORDER_IMAGE_REPEAT[BORDER_IMAGE_REPEAT["SPACE"] = 3] = "SPACE";
|
|
11
|
-
})(BORDER_IMAGE_REPEAT || (exports.BORDER_IMAGE_REPEAT = BORDER_IMAGE_REPEAT = {}));
|
|
12
|
-
const parseRepeatValue = (value) => {
|
|
13
|
-
switch (value) {
|
|
14
|
-
case 'repeat':
|
|
15
|
-
return BORDER_IMAGE_REPEAT.REPEAT;
|
|
16
|
-
case 'round':
|
|
17
|
-
return BORDER_IMAGE_REPEAT.ROUND;
|
|
18
|
-
case 'space':
|
|
19
|
-
return BORDER_IMAGE_REPEAT.SPACE;
|
|
20
|
-
case 'stretch':
|
|
21
|
-
default:
|
|
22
|
-
return BORDER_IMAGE_REPEAT.STRETCH;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
exports.borderImageRepeat = {
|
|
26
|
-
name: 'border-image-repeat',
|
|
27
|
-
initialValue: 'stretch',
|
|
28
|
-
prefix: false,
|
|
29
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
30
|
-
parse: (_context, tokens) => {
|
|
31
|
-
const filtered = tokens.filter(parser_1.nonWhiteSpace);
|
|
32
|
-
const values = [];
|
|
33
|
-
for (const token of filtered) {
|
|
34
|
-
if ((0, parser_1.isIdentToken)(token)) {
|
|
35
|
-
values.push(parseRepeatValue(token.value));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const horizontal = values[0] ?? BORDER_IMAGE_REPEAT.STRETCH;
|
|
39
|
-
const vertical = values[1] ?? horizontal;
|
|
40
|
-
return { horizontal, vertical };
|
|
41
|
-
}
|
|
42
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderImageSlice = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
const fillSides = (sides) => {
|
|
6
|
-
const result = [...sides];
|
|
7
|
-
if (result.length === 1) {
|
|
8
|
-
result.push(result[0], result[0], result[0]);
|
|
9
|
-
}
|
|
10
|
-
else if (result.length === 2) {
|
|
11
|
-
result.push(result[0], result[1]);
|
|
12
|
-
}
|
|
13
|
-
else if (result.length === 3) {
|
|
14
|
-
result.push(result[1]);
|
|
15
|
-
}
|
|
16
|
-
return result.slice(0, 4);
|
|
17
|
-
};
|
|
18
|
-
exports.borderImageSlice = {
|
|
19
|
-
name: 'border-image-slice',
|
|
20
|
-
initialValue: '100%',
|
|
21
|
-
prefix: false,
|
|
22
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
23
|
-
parse: (_context, tokens) => {
|
|
24
|
-
const filtered = tokens.filter(parser_1.nonWhiteSpace);
|
|
25
|
-
const values = [];
|
|
26
|
-
let fill = false;
|
|
27
|
-
let unit = 'percent';
|
|
28
|
-
for (const token of filtered) {
|
|
29
|
-
if ((0, parser_1.isIdentToken)(token) && token.value === 'fill') {
|
|
30
|
-
fill = true;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
34
|
-
values.push(token.number);
|
|
35
|
-
unit = 'number';
|
|
36
|
-
}
|
|
37
|
-
else if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
38
|
-
values.push(token.number);
|
|
39
|
-
unit = 'percent';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const [top, right, bottom, left] = fillSides(values.length > 0 ? values : [100]);
|
|
43
|
-
return { top, right, bottom, left, fill, unit };
|
|
44
|
-
}
|
|
45
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderImageSource = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
const image_1 = require("../types/image");
|
|
6
|
-
exports.borderImageSource = {
|
|
7
|
-
name: 'border-image-source',
|
|
8
|
-
initialValue: 'none',
|
|
9
|
-
prefix: false,
|
|
10
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
11
|
-
skipCache: true,
|
|
12
|
-
parse: (context, tokens) => {
|
|
13
|
-
if (tokens.length === 0) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
const filtered = tokens.filter((t) => (0, parser_1.nonFunctionArgSeparator)(t) && (0, image_1.isSupportedImage)(t));
|
|
17
|
-
if (filtered.length === 0) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return image_1.image.parse(context, filtered[0]);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderBottomLeftRadius = exports.borderBottomRightRadius = exports.borderTopRightRadius = exports.borderTopLeftRadius = void 0;
|
|
4
|
-
const length_percentage_1 = require("../types/length-percentage");
|
|
5
|
-
const borderRadiusForSide = (side) => ({
|
|
6
|
-
name: `border-${side}-radius`,
|
|
7
|
-
initialValue: '0 0',
|
|
8
|
-
prefix: false,
|
|
9
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
10
|
-
parse: (_context, tokens) => (0, length_percentage_1.parseLengthPercentageTuple)(tokens.filter(length_percentage_1.isLengthPercentage))
|
|
11
|
-
});
|
|
12
|
-
exports.borderTopLeftRadius = borderRadiusForSide('top-left');
|
|
13
|
-
exports.borderTopRightRadius = borderRadiusForSide('top-right');
|
|
14
|
-
exports.borderBottomRightRadius = borderRadiusForSide('bottom-right');
|
|
15
|
-
exports.borderBottomLeftRadius = borderRadiusForSide('bottom-left');
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderLeftStyle = exports.borderBottomStyle = exports.borderRightStyle = exports.borderTopStyle = void 0;
|
|
4
|
-
const borderStyleForSide = (side) => ({
|
|
5
|
-
name: `border-${side}-style`,
|
|
6
|
-
initialValue: 'solid',
|
|
7
|
-
prefix: false,
|
|
8
|
-
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
-
parse: (_context, style) => {
|
|
10
|
-
switch (style) {
|
|
11
|
-
case 'none':
|
|
12
|
-
return 0 /* BORDER_STYLE.NONE */;
|
|
13
|
-
case 'dashed':
|
|
14
|
-
return 2 /* BORDER_STYLE.DASHED */;
|
|
15
|
-
case 'dotted':
|
|
16
|
-
return 3 /* BORDER_STYLE.DOTTED */;
|
|
17
|
-
case 'double':
|
|
18
|
-
return 4 /* BORDER_STYLE.DOUBLE */;
|
|
19
|
-
}
|
|
20
|
-
return 1 /* BORDER_STYLE.SOLID */;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
exports.borderTopStyle = borderStyleForSide('top');
|
|
24
|
-
exports.borderRightStyle = borderStyleForSide('right');
|
|
25
|
-
exports.borderBottomStyle = borderStyleForSide('bottom');
|
|
26
|
-
exports.borderLeftStyle = borderStyleForSide('left');
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.borderLeftWidth = exports.borderBottomWidth = exports.borderRightWidth = exports.borderTopWidth = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
const borderWidthForSide = (side) => ({
|
|
6
|
-
name: `border-${side}-width`,
|
|
7
|
-
initialValue: '0',
|
|
8
|
-
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
9
|
-
prefix: false,
|
|
10
|
-
parse: (_context, token) => {
|
|
11
|
-
if ((0, parser_1.isDimensionToken)(token)) {
|
|
12
|
-
return token.number;
|
|
13
|
-
}
|
|
14
|
-
return 0;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
exports.borderTopWidth = borderWidthForSide('top');
|
|
18
|
-
exports.borderRightWidth = borderWidthForSide('right');
|
|
19
|
-
exports.borderBottomWidth = borderWidthForSide('bottom');
|
|
20
|
-
exports.borderLeftWidth = borderWidthForSide('left');
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.boxDecorationBreak = void 0;
|
|
4
|
-
exports.boxDecorationBreak = {
|
|
5
|
-
name: 'box-decoration-break',
|
|
6
|
-
initialValue: 'slice',
|
|
7
|
-
prefix: false,
|
|
8
|
-
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
-
parse: (_context, token) => {
|
|
10
|
-
switch (token) {
|
|
11
|
-
case 'clone':
|
|
12
|
-
return 1 /* BOX_DECORATION_BREAK.CLONE */;
|
|
13
|
-
case 'slice':
|
|
14
|
-
default:
|
|
15
|
-
return 0 /* BOX_DECORATION_BREAK.SLICE */;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.boxShadow = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
const length_percentage_1 = require("../types/length-percentage");
|
|
6
|
-
const color_1 = require("../types/color");
|
|
7
|
-
const length_1 = require("../types/length");
|
|
8
|
-
exports.boxShadow = {
|
|
9
|
-
name: 'box-shadow',
|
|
10
|
-
initialValue: 'none',
|
|
11
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
12
|
-
prefix: false,
|
|
13
|
-
parse: (context, tokens) => {
|
|
14
|
-
if (tokens.length === 1 && (0, parser_1.isIdentWithValue)(tokens[0], 'none')) {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
return (0, parser_1.parseFunctionArgs)(tokens).map((values) => {
|
|
18
|
-
const shadow = {
|
|
19
|
-
color: 0x000000ff,
|
|
20
|
-
offsetX: length_percentage_1.ZERO_LENGTH,
|
|
21
|
-
offsetY: length_percentage_1.ZERO_LENGTH,
|
|
22
|
-
blur: length_percentage_1.ZERO_LENGTH,
|
|
23
|
-
spread: length_percentage_1.ZERO_LENGTH,
|
|
24
|
-
inset: false
|
|
25
|
-
};
|
|
26
|
-
let c = 0;
|
|
27
|
-
for (let i = 0; i < values.length; i++) {
|
|
28
|
-
const token = values[i];
|
|
29
|
-
if ((0, parser_1.isIdentWithValue)(token, 'inset')) {
|
|
30
|
-
shadow.inset = true;
|
|
31
|
-
}
|
|
32
|
-
else if ((0, length_1.isLength)(token)) {
|
|
33
|
-
if (c === 0) {
|
|
34
|
-
shadow.offsetX = token;
|
|
35
|
-
}
|
|
36
|
-
else if (c === 1) {
|
|
37
|
-
shadow.offsetY = token;
|
|
38
|
-
}
|
|
39
|
-
else if (c === 2) {
|
|
40
|
-
shadow.blur = token;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
shadow.spread = token;
|
|
44
|
-
}
|
|
45
|
-
c++;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
shadow.color = color_1.color.parse(context, token);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return shadow;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
};
|