html2canvas-pro 2.4.4 → 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 +3246 -1601
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +3246 -1601
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +3242 -1597
- 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/box-shadow-geometry.d.ts +3 -0
- package/dist/types/render/canvas/box-shadow-painter.d.ts +13 -0
- package/dist/types/render/canvas/box-shadow-transform.d.ts +16 -0
- 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/canvas-path.js +0 -25
- package/dist/lib/render/canvas/canvas-renderer.js +0 -633
- 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,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.textUnderlineOffset = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
exports.textUnderlineOffset = {
|
|
6
|
-
name: 'text-underline-offset',
|
|
7
|
-
initialValue: 'auto',
|
|
8
|
-
prefix: false,
|
|
9
|
-
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
10
|
-
parse: (_context, token) => {
|
|
11
|
-
if ((0, parser_1.isIdentToken)(token)) {
|
|
12
|
-
if (token.value === 'auto') {
|
|
13
|
-
return 'auto';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if ((0, parser_1.isDimensionToken)(token)) {
|
|
17
|
-
// Return pixel value
|
|
18
|
-
return token.number;
|
|
19
|
-
}
|
|
20
|
-
// Default to auto
|
|
21
|
-
return 'auto';
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformOrigin = void 0;
|
|
4
|
-
const length_percentage_1 = require("../types/length-percentage");
|
|
5
|
-
const tokenizer_1 = require("../syntax/tokenizer");
|
|
6
|
-
const DEFAULT_VALUE = {
|
|
7
|
-
type: 16 /* TokenType.PERCENTAGE_TOKEN */,
|
|
8
|
-
number: 50,
|
|
9
|
-
flags: tokenizer_1.FLAG_INTEGER
|
|
10
|
-
};
|
|
11
|
-
const DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE];
|
|
12
|
-
exports.transformOrigin = {
|
|
13
|
-
name: 'transform-origin',
|
|
14
|
-
initialValue: '50% 50%',
|
|
15
|
-
prefix: true,
|
|
16
|
-
type: 1 /* PropertyDescriptorParsingType.LIST */,
|
|
17
|
-
parse: (_context, tokens) => {
|
|
18
|
-
const origins = tokens.filter(length_percentage_1.isLengthPercentage);
|
|
19
|
-
if (origins.length !== 2) {
|
|
20
|
-
return DEFAULT;
|
|
21
|
-
}
|
|
22
|
-
return [origins[0], origins[1]];
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transform = void 0;
|
|
4
|
-
const angle_1 = require("../types/angle");
|
|
5
|
-
exports.transform = {
|
|
6
|
-
name: 'transform',
|
|
7
|
-
initialValue: 'none',
|
|
8
|
-
prefix: true,
|
|
9
|
-
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
10
|
-
parse: (_context, token) => {
|
|
11
|
-
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
if (token.type === 18 /* TokenType.FUNCTION */) {
|
|
15
|
-
const transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
|
|
16
|
-
if (typeof transformFunction === 'undefined') {
|
|
17
|
-
throw new Error(`Attempting to parse an unsupported transform function "${token.name}"`);
|
|
18
|
-
}
|
|
19
|
-
return transformFunction(_context, token.values);
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const matrix = (_context, args) => {
|
|
25
|
-
const values = args.filter((arg) => arg.type === 17 /* TokenType.NUMBER_TOKEN */).map((arg) => arg.number);
|
|
26
|
-
return values.length === 6 ? values : null;
|
|
27
|
-
};
|
|
28
|
-
// doesn't support 3D transforms at the moment
|
|
29
|
-
const matrix3d = (_context, args) => {
|
|
30
|
-
const values = args.filter((arg) => arg.type === 17 /* TokenType.NUMBER_TOKEN */).map((arg) => arg.number);
|
|
31
|
-
const [a1, b1, {}, {}, a2, b2, {}, {}, {}, {}, {}, {}, a4, b4, {}, {}] = values;
|
|
32
|
-
return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
|
|
33
|
-
};
|
|
34
|
-
const rotate = (context, args) => {
|
|
35
|
-
if (args.length !== 1) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const arg = args[0];
|
|
39
|
-
let radians = 0;
|
|
40
|
-
if (arg.type === 17 /* TokenType.NUMBER_TOKEN */ && arg.number === 0) {
|
|
41
|
-
radians = 0;
|
|
42
|
-
}
|
|
43
|
-
else if (arg.type === 15 /* TokenType.DIMENSION_TOKEN */) {
|
|
44
|
-
radians = angle_1.angle.parse(context, arg);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
const cos = Math.cos(radians);
|
|
50
|
-
const sin = Math.sin(radians);
|
|
51
|
-
return [cos, sin, -sin, cos, 0, 0];
|
|
52
|
-
};
|
|
53
|
-
const SUPPORTED_TRANSFORM_FUNCTIONS = {
|
|
54
|
-
matrix: matrix,
|
|
55
|
-
matrix3d: matrix3d,
|
|
56
|
-
rotate: rotate
|
|
57
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.visibility = void 0;
|
|
4
|
-
exports.visibility = {
|
|
5
|
-
name: 'visibility',
|
|
6
|
-
initialValue: 'none',
|
|
7
|
-
prefix: false,
|
|
8
|
-
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
9
|
-
parse: (_context, visibility) => {
|
|
10
|
-
switch (visibility) {
|
|
11
|
-
case 'hidden':
|
|
12
|
-
return 1 /* VISIBILITY.HIDDEN */;
|
|
13
|
-
case 'collapse':
|
|
14
|
-
return 2 /* VISIBILITY.COLLAPSE */;
|
|
15
|
-
case 'visible':
|
|
16
|
-
default:
|
|
17
|
-
return 0 /* VISIBILITY.VISIBLE */;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webkitLineClamp = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* -webkit-line-clamp property descriptor
|
|
6
|
-
* Used with display: -webkit-box and -webkit-box-orient: vertical
|
|
7
|
-
* to limit text to a specific number of lines
|
|
8
|
-
*/
|
|
9
|
-
exports.webkitLineClamp = {
|
|
10
|
-
name: '-webkit-line-clamp',
|
|
11
|
-
initialValue: 'none',
|
|
12
|
-
prefix: true,
|
|
13
|
-
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
14
|
-
parse: (_context, token) => {
|
|
15
|
-
// 'none' means no line clamping
|
|
16
|
-
if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
// Number value specifies the number of lines
|
|
20
|
-
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
21
|
-
return Math.max(0, Math.floor(token.number));
|
|
22
|
-
}
|
|
23
|
-
// Default to 0 (no clamping)
|
|
24
|
-
return 0;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webkitTextStrokeColor = void 0;
|
|
4
|
-
exports.webkitTextStrokeColor = {
|
|
5
|
-
name: `-webkit-text-stroke-color`,
|
|
6
|
-
initialValue: 'currentcolor',
|
|
7
|
-
prefix: false,
|
|
8
|
-
type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
|
|
9
|
-
format: 'color'
|
|
10
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webkitTextStrokeWidth = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
exports.webkitTextStrokeWidth = {
|
|
6
|
-
name: `-webkit-text-stroke-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
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.whiteSpace = exports.WHITE_SPACE = void 0;
|
|
4
|
-
var WHITE_SPACE;
|
|
5
|
-
(function (WHITE_SPACE) {
|
|
6
|
-
WHITE_SPACE["NORMAL"] = "normal";
|
|
7
|
-
WHITE_SPACE["PRE"] = "pre";
|
|
8
|
-
WHITE_SPACE["NOWRAP"] = "nowrap";
|
|
9
|
-
WHITE_SPACE["PRE_WRAP"] = "pre-wrap";
|
|
10
|
-
WHITE_SPACE["PRE_LINE"] = "pre-line";
|
|
11
|
-
})(WHITE_SPACE || (exports.WHITE_SPACE = WHITE_SPACE = {}));
|
|
12
|
-
exports.whiteSpace = {
|
|
13
|
-
name: 'white-space',
|
|
14
|
-
initialValue: 'normal',
|
|
15
|
-
prefix: false,
|
|
16
|
-
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
17
|
-
parse: (_context, value) => {
|
|
18
|
-
switch (value) {
|
|
19
|
-
case 'pre':
|
|
20
|
-
return WHITE_SPACE.PRE;
|
|
21
|
-
case 'nowrap':
|
|
22
|
-
return WHITE_SPACE.NOWRAP;
|
|
23
|
-
case 'pre-wrap':
|
|
24
|
-
return WHITE_SPACE.PRE_WRAP;
|
|
25
|
-
case 'pre-line':
|
|
26
|
-
return WHITE_SPACE.PRE_LINE;
|
|
27
|
-
case 'normal':
|
|
28
|
-
default:
|
|
29
|
-
return WHITE_SPACE.NORMAL;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wordBreak = exports.WORD_BREAK = void 0;
|
|
4
|
-
var WORD_BREAK;
|
|
5
|
-
(function (WORD_BREAK) {
|
|
6
|
-
WORD_BREAK["NORMAL"] = "normal";
|
|
7
|
-
WORD_BREAK["BREAK_ALL"] = "break-all";
|
|
8
|
-
WORD_BREAK["KEEP_ALL"] = "keep-all";
|
|
9
|
-
})(WORD_BREAK || (exports.WORD_BREAK = WORD_BREAK = {}));
|
|
10
|
-
exports.wordBreak = {
|
|
11
|
-
name: 'word-break',
|
|
12
|
-
initialValue: 'normal',
|
|
13
|
-
prefix: false,
|
|
14
|
-
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
15
|
-
parse: (_context, wordBreak) => {
|
|
16
|
-
switch (wordBreak) {
|
|
17
|
-
case 'break-all':
|
|
18
|
-
return WORD_BREAK.BREAK_ALL;
|
|
19
|
-
case 'keep-all':
|
|
20
|
-
return WORD_BREAK.KEEP_ALL;
|
|
21
|
-
case 'normal':
|
|
22
|
-
default:
|
|
23
|
-
return WORD_BREAK.NORMAL;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writingMode = exports.isSidewaysWritingMode = exports.isVerticalWritingMode = void 0;
|
|
4
|
-
const isVerticalWritingMode = (writingMode) => writingMode !== 0 /* WRITING_MODE.HORIZONTAL_TB */;
|
|
5
|
-
exports.isVerticalWritingMode = isVerticalWritingMode;
|
|
6
|
-
const isSidewaysWritingMode = (writingMode) => writingMode === 3 /* WRITING_MODE.SIDEWAYS_RL */ || writingMode === 4 /* WRITING_MODE.SIDEWAYS_LR */;
|
|
7
|
-
exports.isSidewaysWritingMode = isSidewaysWritingMode;
|
|
8
|
-
exports.writingMode = {
|
|
9
|
-
name: 'writing-mode',
|
|
10
|
-
initialValue: 'horizontal-tb',
|
|
11
|
-
prefix: false,
|
|
12
|
-
type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
|
|
13
|
-
parse: (_context, writingMode) => {
|
|
14
|
-
switch (writingMode) {
|
|
15
|
-
case 'vertical-rl':
|
|
16
|
-
return 1 /* WRITING_MODE.VERTICAL_RL */;
|
|
17
|
-
case 'vertical-lr':
|
|
18
|
-
return 2 /* WRITING_MODE.VERTICAL_LR */;
|
|
19
|
-
case 'sideways-rl':
|
|
20
|
-
return 3 /* WRITING_MODE.SIDEWAYS_RL */;
|
|
21
|
-
case 'sideways-lr':
|
|
22
|
-
return 4 /* WRITING_MODE.SIDEWAYS_LR */;
|
|
23
|
-
case 'horizontal-tb':
|
|
24
|
-
default:
|
|
25
|
-
return 0 /* WRITING_MODE.HORIZONTAL_TB */;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zIndex = void 0;
|
|
4
|
-
const parser_1 = require("../syntax/parser");
|
|
5
|
-
exports.zIndex = {
|
|
6
|
-
name: 'z-index',
|
|
7
|
-
initialValue: 'auto',
|
|
8
|
-
prefix: false,
|
|
9
|
-
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
10
|
-
parse: (_context, token) => {
|
|
11
|
-
if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
|
|
12
|
-
return { auto: true, order: 0 };
|
|
13
|
-
}
|
|
14
|
-
if ((0, parser_1.isNumberToken)(token)) {
|
|
15
|
-
return { auto: false, order: token.number };
|
|
16
|
-
}
|
|
17
|
-
throw new Error(`Invalid z-index number parsed`);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zoom = void 0;
|
|
4
|
-
exports.zoom = {
|
|
5
|
-
name: 'zoom',
|
|
6
|
-
initialValue: '1',
|
|
7
|
-
type: 0 /* PropertyDescriptorParsingType.VALUE */,
|
|
8
|
-
prefix: false,
|
|
9
|
-
parse: (_context, token) => {
|
|
10
|
-
if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
|
|
11
|
-
return Math.max(0, token.number / 100);
|
|
12
|
-
}
|
|
13
|
-
if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
|
|
14
|
-
return Math.max(0, token.number);
|
|
15
|
-
}
|
|
16
|
-
return 1;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseFunctionArgs = exports.nonFunctionArgSeparator = exports.nonWhiteSpace = exports.isIdentWithValue = exports.isStringToken = exports.isIdentToken = exports.isNumberToken = exports.isDimensionToken = exports.Parser = void 0;
|
|
4
|
-
const tokenizer_1 = require("./tokenizer");
|
|
5
|
-
class Parser {
|
|
6
|
-
constructor(tokens) {
|
|
7
|
-
this._tokens = tokens;
|
|
8
|
-
}
|
|
9
|
-
static create(value) {
|
|
10
|
-
const tokenizer = new tokenizer_1.Tokenizer();
|
|
11
|
-
tokenizer.write(value);
|
|
12
|
-
return new Parser(tokenizer.read());
|
|
13
|
-
}
|
|
14
|
-
static parseValue(value) {
|
|
15
|
-
return Parser.create(value).parseComponentValue();
|
|
16
|
-
}
|
|
17
|
-
static parseValues(value) {
|
|
18
|
-
return Parser.create(value).parseComponentValues();
|
|
19
|
-
}
|
|
20
|
-
parseComponentValue() {
|
|
21
|
-
let token = this.consumeToken();
|
|
22
|
-
while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
23
|
-
token = this.consumeToken();
|
|
24
|
-
}
|
|
25
|
-
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
26
|
-
throw new SyntaxError(`Error parsing CSS component value, unexpected EOF`);
|
|
27
|
-
}
|
|
28
|
-
this.reconsumeToken(token);
|
|
29
|
-
const value = this.consumeComponentValue();
|
|
30
|
-
do {
|
|
31
|
-
token = this.consumeToken();
|
|
32
|
-
} while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
|
|
33
|
-
if (token.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
throw new SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`);
|
|
37
|
-
}
|
|
38
|
-
parseComponentValues() {
|
|
39
|
-
const values = [];
|
|
40
|
-
while (true) {
|
|
41
|
-
const value = this.consumeComponentValue();
|
|
42
|
-
if (value.type === 32 /* TokenType.EOF_TOKEN */) {
|
|
43
|
-
return values;
|
|
44
|
-
}
|
|
45
|
-
values.push(value);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
consumeComponentValue() {
|
|
49
|
-
const token = this.consumeToken();
|
|
50
|
-
switch (token.type) {
|
|
51
|
-
case 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */:
|
|
52
|
-
case 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */:
|
|
53
|
-
case 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */:
|
|
54
|
-
return this.consumeSimpleBlock(token.type);
|
|
55
|
-
case 19 /* TokenType.FUNCTION_TOKEN */:
|
|
56
|
-
return this.consumeFunction(token);
|
|
57
|
-
}
|
|
58
|
-
return token;
|
|
59
|
-
}
|
|
60
|
-
consumeSimpleBlock(type) {
|
|
61
|
-
const block = { type, values: [] };
|
|
62
|
-
let token = this.consumeToken();
|
|
63
|
-
while (true) {
|
|
64
|
-
if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
|
|
65
|
-
return block;
|
|
66
|
-
}
|
|
67
|
-
this.reconsumeToken(token);
|
|
68
|
-
block.values.push(this.consumeComponentValue());
|
|
69
|
-
token = this.consumeToken();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
consumeFunction(functionToken) {
|
|
73
|
-
const cssFunction = {
|
|
74
|
-
name: functionToken.value,
|
|
75
|
-
values: [],
|
|
76
|
-
type: 18 /* TokenType.FUNCTION */
|
|
77
|
-
};
|
|
78
|
-
while (true) {
|
|
79
|
-
const token = this.consumeToken();
|
|
80
|
-
if (token.type === 32 /* TokenType.EOF_TOKEN */ || token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */) {
|
|
81
|
-
return cssFunction;
|
|
82
|
-
}
|
|
83
|
-
this.reconsumeToken(token);
|
|
84
|
-
cssFunction.values.push(this.consumeComponentValue());
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
consumeToken() {
|
|
88
|
-
const token = this._tokens.shift();
|
|
89
|
-
return typeof token === 'undefined' ? tokenizer_1.EOF_TOKEN : token;
|
|
90
|
-
}
|
|
91
|
-
reconsumeToken(token) {
|
|
92
|
-
this._tokens.unshift(token);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.Parser = Parser;
|
|
96
|
-
const isDimensionToken = (token) => token.type === 15 /* TokenType.DIMENSION_TOKEN */;
|
|
97
|
-
exports.isDimensionToken = isDimensionToken;
|
|
98
|
-
const isNumberToken = (token) => token.type === 17 /* TokenType.NUMBER_TOKEN */;
|
|
99
|
-
exports.isNumberToken = isNumberToken;
|
|
100
|
-
const isIdentToken = (token) => token.type === 20 /* TokenType.IDENT_TOKEN */;
|
|
101
|
-
exports.isIdentToken = isIdentToken;
|
|
102
|
-
const isStringToken = (token) => token.type === 0 /* TokenType.STRING_TOKEN */;
|
|
103
|
-
exports.isStringToken = isStringToken;
|
|
104
|
-
const isIdentWithValue = (token, value) => (0, exports.isIdentToken)(token) && token.value === value;
|
|
105
|
-
exports.isIdentWithValue = isIdentWithValue;
|
|
106
|
-
const nonWhiteSpace = (token) => token.type !== 31 /* TokenType.WHITESPACE_TOKEN */;
|
|
107
|
-
exports.nonWhiteSpace = nonWhiteSpace;
|
|
108
|
-
const nonFunctionArgSeparator = (token) => token.type !== 31 /* TokenType.WHITESPACE_TOKEN */ && token.type !== 4 /* TokenType.COMMA_TOKEN */;
|
|
109
|
-
exports.nonFunctionArgSeparator = nonFunctionArgSeparator;
|
|
110
|
-
const parseFunctionArgs = (tokens) => {
|
|
111
|
-
const args = [];
|
|
112
|
-
let arg = [];
|
|
113
|
-
tokens.forEach((token) => {
|
|
114
|
-
if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
|
|
115
|
-
// Skip empty arguments (e.g. "1px,,2px") instead of throwing —
|
|
116
|
-
// real-world computed styles can produce them.
|
|
117
|
-
if (arg.length) {
|
|
118
|
-
args.push(arg);
|
|
119
|
-
arg = [];
|
|
120
|
-
}
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
|
|
124
|
-
arg.push(token);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
if (arg.length) {
|
|
128
|
-
args.push(arg);
|
|
129
|
-
}
|
|
130
|
-
return args;
|
|
131
|
-
};
|
|
132
|
-
exports.parseFunctionArgs = parseFunctionArgs;
|
|
133
|
-
const isEndingTokenFor = (token, type) => {
|
|
134
|
-
if (type === 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */) {
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
if (type === 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */) {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
return type === 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */;
|
|
141
|
-
};
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// CSS tokenizer code-point constants and character-classification predicates.
|
|
3
|
-
// Pure functions with no runtime dependencies — usable without the Tokenizer class.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.E = exports.A = exports.z = exports.u = exports.f = exports.e = exports.a = exports.ZERO = exports.EOF = exports.DELETE = exports.INFORMATION_SEPARATOR_ONE = exports.SHIFT_OUT = exports.LINE_TABULATION = exports.BACKSPACE = exports.NULL = exports.FULL_STOP = exports.SEMICOLON = exports.COLON = exports.COMMA = exports.PLUS_SIGN = exports.ASTERISK = exports.REPLACEMENT_CHARACTER = exports.CONTROL = exports.TILDE = exports.VERTICAL_LINE = exports.RIGHT_CURLY_BRACKET = exports.QUESTION_MARK = exports.LEFT_CURLY_BRACKET = exports.CIRCUMFLEX_ACCENT = exports.RIGHT_SQUARE_BRACKET = exports.LEFT_SQUARE_BRACKET = exports.COMMERCIAL_AT = exports.GREATER_THAN_SIGN = exports.LESS_THAN_SIGN = exports.EXCLAMATION_MARK = exports.HYPHEN_MINUS = exports.LOW_LINE = exports.RIGHT_PARENTHESIS = exports.LEFT_PARENTHESIS = exports.APOSTROPHE = exports.PERCENTAGE_SIGN = exports.DOLLAR_SIGN = exports.NUMBER_SIGN = exports.EQUALS_SIGN = exports.QUOTATION_MARK = exports.SPACE = exports.CHARACTER_TABULATION = exports.REVERSE_SOLIDUS = exports.SOLIDUS = exports.LINE_FEED = void 0;
|
|
6
|
-
exports.stringToNumber = exports.isNumberStart = exports.isIdentifierStart = exports.isValidEscape = exports.isNonPrintableCodePoint = exports.isNameCodePoint = exports.isNameStartCodePoint = exports.isWhiteSpace = exports.isNonASCIICodePoint = exports.isLetter = exports.isUpperCaseLetter = exports.isLowerCaseLetter = exports.isHex = exports.isSurrogateCodePoint = exports.isDigit = exports.Z = exports.U = exports.F = void 0;
|
|
7
|
-
const LINE_FEED = 0x000a;
|
|
8
|
-
exports.LINE_FEED = LINE_FEED;
|
|
9
|
-
const SOLIDUS = 0x002f;
|
|
10
|
-
exports.SOLIDUS = SOLIDUS;
|
|
11
|
-
const REVERSE_SOLIDUS = 0x005c;
|
|
12
|
-
exports.REVERSE_SOLIDUS = REVERSE_SOLIDUS;
|
|
13
|
-
const CHARACTER_TABULATION = 0x0009;
|
|
14
|
-
exports.CHARACTER_TABULATION = CHARACTER_TABULATION;
|
|
15
|
-
const SPACE = 0x0020;
|
|
16
|
-
exports.SPACE = SPACE;
|
|
17
|
-
const QUOTATION_MARK = 0x0022;
|
|
18
|
-
exports.QUOTATION_MARK = QUOTATION_MARK;
|
|
19
|
-
const EQUALS_SIGN = 0x003d;
|
|
20
|
-
exports.EQUALS_SIGN = EQUALS_SIGN;
|
|
21
|
-
const NUMBER_SIGN = 0x0023;
|
|
22
|
-
exports.NUMBER_SIGN = NUMBER_SIGN;
|
|
23
|
-
const DOLLAR_SIGN = 0x0024;
|
|
24
|
-
exports.DOLLAR_SIGN = DOLLAR_SIGN;
|
|
25
|
-
const PERCENTAGE_SIGN = 0x0025;
|
|
26
|
-
exports.PERCENTAGE_SIGN = PERCENTAGE_SIGN;
|
|
27
|
-
const APOSTROPHE = 0x0027;
|
|
28
|
-
exports.APOSTROPHE = APOSTROPHE;
|
|
29
|
-
const LEFT_PARENTHESIS = 0x0028;
|
|
30
|
-
exports.LEFT_PARENTHESIS = LEFT_PARENTHESIS;
|
|
31
|
-
const RIGHT_PARENTHESIS = 0x0029;
|
|
32
|
-
exports.RIGHT_PARENTHESIS = RIGHT_PARENTHESIS;
|
|
33
|
-
const LOW_LINE = 0x005f;
|
|
34
|
-
exports.LOW_LINE = LOW_LINE;
|
|
35
|
-
const HYPHEN_MINUS = 0x002d;
|
|
36
|
-
exports.HYPHEN_MINUS = HYPHEN_MINUS;
|
|
37
|
-
const EXCLAMATION_MARK = 0x0021;
|
|
38
|
-
exports.EXCLAMATION_MARK = EXCLAMATION_MARK;
|
|
39
|
-
const LESS_THAN_SIGN = 0x003c;
|
|
40
|
-
exports.LESS_THAN_SIGN = LESS_THAN_SIGN;
|
|
41
|
-
const GREATER_THAN_SIGN = 0x003e;
|
|
42
|
-
exports.GREATER_THAN_SIGN = GREATER_THAN_SIGN;
|
|
43
|
-
const COMMERCIAL_AT = 0x0040;
|
|
44
|
-
exports.COMMERCIAL_AT = COMMERCIAL_AT;
|
|
45
|
-
const LEFT_SQUARE_BRACKET = 0x005b;
|
|
46
|
-
exports.LEFT_SQUARE_BRACKET = LEFT_SQUARE_BRACKET;
|
|
47
|
-
const RIGHT_SQUARE_BRACKET = 0x005d;
|
|
48
|
-
exports.RIGHT_SQUARE_BRACKET = RIGHT_SQUARE_BRACKET;
|
|
49
|
-
const CIRCUMFLEX_ACCENT = 0x003d;
|
|
50
|
-
exports.CIRCUMFLEX_ACCENT = CIRCUMFLEX_ACCENT;
|
|
51
|
-
const LEFT_CURLY_BRACKET = 0x007b;
|
|
52
|
-
exports.LEFT_CURLY_BRACKET = LEFT_CURLY_BRACKET;
|
|
53
|
-
const QUESTION_MARK = 0x003f;
|
|
54
|
-
exports.QUESTION_MARK = QUESTION_MARK;
|
|
55
|
-
const RIGHT_CURLY_BRACKET = 0x007d;
|
|
56
|
-
exports.RIGHT_CURLY_BRACKET = RIGHT_CURLY_BRACKET;
|
|
57
|
-
const VERTICAL_LINE = 0x007c;
|
|
58
|
-
exports.VERTICAL_LINE = VERTICAL_LINE;
|
|
59
|
-
const TILDE = 0x007e;
|
|
60
|
-
exports.TILDE = TILDE;
|
|
61
|
-
const CONTROL = 0x0080;
|
|
62
|
-
exports.CONTROL = CONTROL;
|
|
63
|
-
const REPLACEMENT_CHARACTER = 0xfffd;
|
|
64
|
-
exports.REPLACEMENT_CHARACTER = REPLACEMENT_CHARACTER;
|
|
65
|
-
const ASTERISK = 0x002a;
|
|
66
|
-
exports.ASTERISK = ASTERISK;
|
|
67
|
-
const PLUS_SIGN = 0x002b;
|
|
68
|
-
exports.PLUS_SIGN = PLUS_SIGN;
|
|
69
|
-
const COMMA = 0x002c;
|
|
70
|
-
exports.COMMA = COMMA;
|
|
71
|
-
const COLON = 0x003a;
|
|
72
|
-
exports.COLON = COLON;
|
|
73
|
-
const SEMICOLON = 0x003b;
|
|
74
|
-
exports.SEMICOLON = SEMICOLON;
|
|
75
|
-
const FULL_STOP = 0x002e;
|
|
76
|
-
exports.FULL_STOP = FULL_STOP;
|
|
77
|
-
const NULL = 0x0000;
|
|
78
|
-
exports.NULL = NULL;
|
|
79
|
-
const BACKSPACE = 0x0008;
|
|
80
|
-
exports.BACKSPACE = BACKSPACE;
|
|
81
|
-
const LINE_TABULATION = 0x000b;
|
|
82
|
-
exports.LINE_TABULATION = LINE_TABULATION;
|
|
83
|
-
const SHIFT_OUT = 0x000e;
|
|
84
|
-
exports.SHIFT_OUT = SHIFT_OUT;
|
|
85
|
-
const INFORMATION_SEPARATOR_ONE = 0x001f;
|
|
86
|
-
exports.INFORMATION_SEPARATOR_ONE = INFORMATION_SEPARATOR_ONE;
|
|
87
|
-
const DELETE = 0x007f;
|
|
88
|
-
exports.DELETE = DELETE;
|
|
89
|
-
const EOF = -1;
|
|
90
|
-
exports.EOF = EOF;
|
|
91
|
-
const ZERO = 0x0030;
|
|
92
|
-
exports.ZERO = ZERO;
|
|
93
|
-
const a = 0x0061;
|
|
94
|
-
exports.a = a;
|
|
95
|
-
const e = 0x0065;
|
|
96
|
-
exports.e = e;
|
|
97
|
-
const f = 0x0066;
|
|
98
|
-
exports.f = f;
|
|
99
|
-
const u = 0x0075;
|
|
100
|
-
exports.u = u;
|
|
101
|
-
const z = 0x007a;
|
|
102
|
-
exports.z = z;
|
|
103
|
-
const A = 0x0041;
|
|
104
|
-
exports.A = A;
|
|
105
|
-
const E = 0x0045;
|
|
106
|
-
exports.E = E;
|
|
107
|
-
const F = 0x0046;
|
|
108
|
-
exports.F = F;
|
|
109
|
-
const U = 0x0055;
|
|
110
|
-
exports.U = U;
|
|
111
|
-
const Z = 0x005a;
|
|
112
|
-
exports.Z = Z;
|
|
113
|
-
const css_line_break_1 = require("css-line-break");
|
|
114
|
-
const isDigit = (codePoint) => codePoint >= ZERO && codePoint <= 0x0039;
|
|
115
|
-
exports.isDigit = isDigit;
|
|
116
|
-
const isSurrogateCodePoint = (codePoint) => codePoint >= 0xd800 && codePoint <= 0xdfff;
|
|
117
|
-
exports.isSurrogateCodePoint = isSurrogateCodePoint;
|
|
118
|
-
const isHex = (codePoint) => isDigit(codePoint) || (codePoint >= A && codePoint <= F) || (codePoint >= a && codePoint <= f);
|
|
119
|
-
exports.isHex = isHex;
|
|
120
|
-
const isLowerCaseLetter = (codePoint) => codePoint >= a && codePoint <= z;
|
|
121
|
-
exports.isLowerCaseLetter = isLowerCaseLetter;
|
|
122
|
-
const isUpperCaseLetter = (codePoint) => codePoint >= A && codePoint <= Z;
|
|
123
|
-
exports.isUpperCaseLetter = isUpperCaseLetter;
|
|
124
|
-
const isLetter = (codePoint) => isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint);
|
|
125
|
-
exports.isLetter = isLetter;
|
|
126
|
-
const isNonASCIICodePoint = (codePoint) => codePoint >= CONTROL;
|
|
127
|
-
exports.isNonASCIICodePoint = isNonASCIICodePoint;
|
|
128
|
-
const isWhiteSpace = (codePoint) => codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE;
|
|
129
|
-
exports.isWhiteSpace = isWhiteSpace;
|
|
130
|
-
const isNameStartCodePoint = (codePoint) => isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE;
|
|
131
|
-
exports.isNameStartCodePoint = isNameStartCodePoint;
|
|
132
|
-
const isNameCodePoint = (codePoint) => isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS;
|
|
133
|
-
exports.isNameCodePoint = isNameCodePoint;
|
|
134
|
-
const isNonPrintableCodePoint = (codePoint) => {
|
|
135
|
-
return ((codePoint >= NULL && codePoint <= BACKSPACE) ||
|
|
136
|
-
codePoint === LINE_TABULATION ||
|
|
137
|
-
(codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE) ||
|
|
138
|
-
codePoint === DELETE);
|
|
139
|
-
};
|
|
140
|
-
exports.isNonPrintableCodePoint = isNonPrintableCodePoint;
|
|
141
|
-
const isValidEscape = (c1, c2) => {
|
|
142
|
-
if (c1 !== REVERSE_SOLIDUS) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
return c2 !== LINE_FEED;
|
|
146
|
-
};
|
|
147
|
-
exports.isValidEscape = isValidEscape;
|
|
148
|
-
const isIdentifierStart = (c1, c2, c3) => {
|
|
149
|
-
if (c1 === HYPHEN_MINUS) {
|
|
150
|
-
return isNameStartCodePoint(c2) || isValidEscape(c2, c3);
|
|
151
|
-
}
|
|
152
|
-
else if (isNameStartCodePoint(c1)) {
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
return false;
|
|
159
|
-
};
|
|
160
|
-
exports.isIdentifierStart = isIdentifierStart;
|
|
161
|
-
const isNumberStart = (c1, c2, c3) => {
|
|
162
|
-
if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
|
|
163
|
-
if (isDigit(c2)) {
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
return c2 === FULL_STOP && isDigit(c3);
|
|
167
|
-
}
|
|
168
|
-
if (c1 === FULL_STOP) {
|
|
169
|
-
return isDigit(c2);
|
|
170
|
-
}
|
|
171
|
-
return isDigit(c1);
|
|
172
|
-
};
|
|
173
|
-
exports.isNumberStart = isNumberStart;
|
|
174
|
-
const stringToNumber = (codePoints) => {
|
|
175
|
-
let c = 0;
|
|
176
|
-
let sign = 1;
|
|
177
|
-
if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
|
|
178
|
-
if (codePoints[c] === HYPHEN_MINUS) {
|
|
179
|
-
sign = -1;
|
|
180
|
-
}
|
|
181
|
-
c++;
|
|
182
|
-
}
|
|
183
|
-
const integers = [];
|
|
184
|
-
while (isDigit(codePoints[c])) {
|
|
185
|
-
integers.push(codePoints[c++]);
|
|
186
|
-
}
|
|
187
|
-
const int = integers.length ? parseInt((0, css_line_break_1.fromCodePoint)(...integers), 10) : 0;
|
|
188
|
-
if (codePoints[c] === FULL_STOP) {
|
|
189
|
-
c++;
|
|
190
|
-
}
|
|
191
|
-
const fraction = [];
|
|
192
|
-
while (isDigit(codePoints[c])) {
|
|
193
|
-
fraction.push(codePoints[c++]);
|
|
194
|
-
}
|
|
195
|
-
const fracd = fraction.length;
|
|
196
|
-
const frac = fracd ? parseInt((0, css_line_break_1.fromCodePoint)(...fraction), 10) : 0;
|
|
197
|
-
if (codePoints[c] === E || codePoints[c] === e) {
|
|
198
|
-
c++;
|
|
199
|
-
}
|
|
200
|
-
let expsign = 1;
|
|
201
|
-
if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
|
|
202
|
-
if (codePoints[c] === HYPHEN_MINUS) {
|
|
203
|
-
expsign = -1;
|
|
204
|
-
}
|
|
205
|
-
c++;
|
|
206
|
-
}
|
|
207
|
-
const exponent = [];
|
|
208
|
-
while (isDigit(codePoints[c])) {
|
|
209
|
-
exponent.push(codePoints[c++]);
|
|
210
|
-
}
|
|
211
|
-
const exp = exponent.length ? parseInt((0, css_line_break_1.fromCodePoint)(...exponent), 10) : 0;
|
|
212
|
-
return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
|
|
213
|
-
};
|
|
214
|
-
exports.stringToNumber = stringToNumber;
|