1 | "use strict";
|
---|
2 |
|
---|
3 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
---|
4 |
|
---|
5 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
---|
6 |
|
---|
7 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
---|
8 |
|
---|
9 | var Declaration = require('../declaration');
|
---|
10 |
|
---|
11 | var BreakProps = /*#__PURE__*/function (_Declaration) {
|
---|
12 | _inheritsLoose(BreakProps, _Declaration);
|
---|
13 |
|
---|
14 | function BreakProps() {
|
---|
15 | return _Declaration.apply(this, arguments) || this;
|
---|
16 | }
|
---|
17 |
|
---|
18 | var _proto = BreakProps.prototype;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Change name for -webkit- and -moz- prefix
|
---|
22 | */
|
---|
23 | _proto.prefixed = function prefixed(prop, prefix) {
|
---|
24 | return prefix + "column-" + prop;
|
---|
25 | }
|
---|
26 | /**
|
---|
27 | * Return property name by final spec
|
---|
28 | */
|
---|
29 | ;
|
---|
30 |
|
---|
31 | _proto.normalize = function normalize(prop) {
|
---|
32 | if (prop.includes('inside')) {
|
---|
33 | return 'break-inside';
|
---|
34 | }
|
---|
35 |
|
---|
36 | if (prop.includes('before')) {
|
---|
37 | return 'break-before';
|
---|
38 | }
|
---|
39 |
|
---|
40 | return 'break-after';
|
---|
41 | }
|
---|
42 | /**
|
---|
43 | * Change prefixed value for avoid-column and avoid-page
|
---|
44 | */
|
---|
45 | ;
|
---|
46 |
|
---|
47 | _proto.set = function set(decl, prefix) {
|
---|
48 | if (decl.prop === 'break-inside' && decl.value === 'avoid-column' || decl.value === 'avoid-page') {
|
---|
49 | decl.value = 'avoid';
|
---|
50 | }
|
---|
51 |
|
---|
52 | return _Declaration.prototype.set.call(this, decl, prefix);
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Don’t prefix some values
|
---|
56 | */
|
---|
57 | ;
|
---|
58 |
|
---|
59 | _proto.insert = function insert(decl, prefix, prefixes) {
|
---|
60 | if (decl.prop !== 'break-inside') {
|
---|
61 | return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
---|
62 | }
|
---|
63 |
|
---|
64 | if (/region/i.test(decl.value) || /page/i.test(decl.value)) {
|
---|
65 | return undefined;
|
---|
66 | }
|
---|
67 |
|
---|
68 | return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
---|
69 | };
|
---|
70 |
|
---|
71 | return BreakProps;
|
---|
72 | }(Declaration);
|
---|
73 |
|
---|
74 | _defineProperty(BreakProps, "names", ['break-inside', 'page-break-inside', 'column-break-inside', 'break-before', 'page-break-before', 'column-break-before', 'break-after', 'page-break-after', 'column-break-after']);
|
---|
75 |
|
---|
76 | module.exports = BreakProps; |
---|