@stylexjs/shared 0.2.0-beta.8 → 0.2.0-beta.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ exports.default = generateCSSRule;
7
7
  var _generateLtr = _interopRequireDefault(require("./physical-rtl/generate-ltr"));
8
8
  var _generateRtl = _interopRequireDefault(require("./physical-rtl/generate-rtl"));
9
9
  var _genCSSRule = _interopRequireDefault(require("./utils/genCSSRule"));
10
+ var _propertyPriorities = _interopRequireDefault(require("./utils/property-priorities"));
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
12
  /**
12
13
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -17,48 +18,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
18
  *
18
19
  */
19
20
 
20
- function generateCSSRule(className, key, value, pseudo) {
21
+ function generateCSSRule(className, key,
22
+ // pre-dashed
23
+ value, pseudo) {
21
24
  const pairs = Array.isArray(value) ? value.map(eachValue => [key, eachValue]) : [[key, value]];
22
25
  const ltrPairs = pairs.map(_generateLtr.default);
23
26
  const ltrDecls = ltrPairs.map(pair => pair.join(':')).join(';');
24
27
  const rtlDecls = pairs.map(_generateRtl.default).filter(Boolean).map(pair => pair.join(':')).join(';');
25
28
  const ltrRule = (0, _genCSSRule.default)(className, ltrDecls, pseudo);
26
29
  const rtlRule = !rtlDecls ? null : (0, _genCSSRule.default)(className, rtlDecls, pseudo);
27
- let priority = 1;
28
- if (pseudo != null) {
29
- if (pseudo[0] === '@') {
30
- priority = 2;
31
- } else if (pseudo[0] === ':') {
32
- priority = pseudoPriorities[pseudo] ?? 2;
33
- if (pseudo.startsWith(':nth-child')) {
34
- priority = 6;
35
- }
36
- if (pseudo.startsWith(':nth-of-type')) {
37
- priority = 7;
38
- }
39
- }
40
- }
41
- if (key.toLowerCase().includes('left') || key.toLowerCase().includes('right')) {
42
- // Bump priority for physical left/right values.
43
- priority += 0.1;
44
- }
30
+ const priority = (0, _propertyPriorities.default)(key) + (pseudo ? (0, _propertyPriorities.default)(pseudo) : 0);
45
31
  return {
46
32
  priority,
47
33
  ltr: ltrRule,
48
34
  rtl: rtlRule
49
35
  };
50
- }
51
- const pseudoPriorities = {
52
- // Might become unsupported:
53
- ':first-child': 3,
54
- ':last-child': 4,
55
- ':only-child': 5,
56
- ':nth-child': 6,
57
- ':nth-of-type': 7,
58
- ':hover': 8,
59
- ':focus': 9,
60
- ':active': 10,
61
- ':disabled': 11,
62
- '::placeholder': 12,
63
- '::thumb': 13
64
- };
36
+ }
package/lib/index.d.ts CHANGED
@@ -64,7 +64,7 @@ export type StyleXOptions = {
64
64
  stylexSheetName?: string | undefined;
65
65
  classNamePrefix: string;
66
66
  definedStylexCSSVariables?: { [key: string]: any };
67
- allowUnsafeProperties: boolean;
67
+ skipShorthandExpansion?: boolean;
68
68
  [key: string]: any;
69
69
  };
70
70
 
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Flowtype definitions for index.js
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ */
package/lib/messages.js CHANGED
@@ -13,7 +13,7 @@
13
13
  Object.defineProperty(exports, "__esModule", {
14
14
  value: true
15
15
  });
16
- exports.UNKNOWN_PROP_KEY = exports.UNKNOWN_NAMESPACE = exports.UNEXPECTED_ARGUMENT = exports.UNBOUND_STYLEX_CALL_VALUE = exports.ONLY_TOP_LEVEL = exports.NO_PARENT_PATH = exports.NO_CONDITIONAL_SHORTHAND = exports.NON_STATIC_VALUE = exports.NON_OBJECT_FOR_STYLEX_CALL = exports.MULTIPLE_DIRECTIONS_IN_SHORTHAND = exports.LOCAL_ONLY = exports.LINT_UNCLOSED_FUNCTION = exports.INVALID_SPREAD = exports.INVALID_PSEUDO = exports.ILLEGAL_PROP_VALUE = exports.ILLEGAL_PROP_ARRAY_VALUE = exports.ILLEGAL_NESTED_PSEUDO = exports.ILLEGAL_NAMESPACE_VALUE = exports.ILLEGAL_NAMESPACE_TYPE = exports.ILLEGAL_ARGUMENT_LENGTH = exports.EXPECTED_FUNCTION_CALL = exports.ESCAPED_STYLEX_VALUE = void 0;
16
+ exports.UNKNOWN_PROP_KEY = exports.UNKNOWN_NAMESPACE = exports.UNEXPECTED_ARGUMENT = exports.UNBOUND_STYLEX_CALL_VALUE = exports.ONLY_TOP_LEVEL = exports.NO_PARENT_PATH = exports.NO_CONDITIONAL_SHORTHAND = exports.NON_STATIC_VALUE = exports.NON_OBJECT_FOR_STYLEX_CALL = exports.LOCAL_ONLY = exports.LINT_UNCLOSED_FUNCTION = exports.INVALID_SPREAD = exports.INVALID_PSEUDO = exports.ILLEGAL_PROP_VALUE = exports.ILLEGAL_PROP_ARRAY_VALUE = exports.ILLEGAL_NESTED_PSEUDO = exports.ILLEGAL_NAMESPACE_VALUE = exports.ILLEGAL_NAMESPACE_TYPE = exports.ILLEGAL_ARGUMENT_LENGTH = exports.EXPECTED_FUNCTION_CALL = exports.ESCAPED_STYLEX_VALUE = void 0;
17
17
  const ILLEGAL_ARGUMENT_LENGTH = 'stylex() should have 1 argument.';
18
18
  exports.ILLEGAL_ARGUMENT_LENGTH = ILLEGAL_ARGUMENT_LENGTH;
19
19
  const NON_STATIC_VALUE = 'Only static values are allowed inside of a stylex.create() call.';
@@ -36,7 +36,7 @@ const ILLEGAL_NAMESPACE_TYPE = 'Only a string literal namespace is allowed here.
36
36
  exports.ILLEGAL_NAMESPACE_TYPE = ILLEGAL_NAMESPACE_TYPE;
37
37
  const UNKNOWN_NAMESPACE = 'Unknown namespace';
38
38
  exports.UNKNOWN_NAMESPACE = UNKNOWN_NAMESPACE;
39
- const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested.";
39
+ const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one level deep.";
40
40
  exports.ILLEGAL_NESTED_PSEUDO = ILLEGAL_NESTED_PSEUDO;
41
41
  const ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
42
42
  exports.ILLEGAL_PROP_VALUE = ILLEGAL_PROP_VALUE;
@@ -55,6 +55,4 @@ exports.UNEXPECTED_ARGUMENT = UNEXPECTED_ARGUMENT;
55
55
  const EXPECTED_FUNCTION_CALL = 'Expected a simple function call but found something else.';
56
56
  exports.EXPECTED_FUNCTION_CALL = EXPECTED_FUNCTION_CALL;
57
57
  const NO_PARENT_PATH = 'Unexpected AST node without a parent path.';
58
- exports.NO_PARENT_PATH = NO_PARENT_PATH;
59
- const MULTIPLE_DIRECTIONS_IN_SHORTHAND = 'Shorthand properties cannot contain different values for different directions.';
60
- exports.MULTIPLE_DIRECTIONS_IN_SHORTHAND = MULTIPLE_DIRECTIONS_IN_SHORTHAND;
58
+ exports.NO_PARENT_PATH = NO_PARENT_PATH;
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ var _preflatten = _interopRequireDefault(require("../preflatten"));
4
+ var _Rule = require("../../utils/Rule");
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+ /**
7
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ *
12
+ *
13
+ *
14
+ */
15
+
16
+ describe('preflatten', () => {
17
+ test('flattens a simple style object', () => {
18
+ const input = {
19
+ color: 'red',
20
+ backgroundColor: 'blue'
21
+ };
22
+ const output = {
23
+ color: new _Rule.RawRule('color', 'red', [], []),
24
+ backgroundColor: new _Rule.RawRule('backgroundColor', 'blue', [], [])
25
+ };
26
+ expect((0, _preflatten.default)(input)).toEqual(output);
27
+ });
28
+ test('flattens styles with fallback styles', () => {
29
+ const input = {
30
+ color: ['red', 'blue'],
31
+ backgroundColor: 'blue'
32
+ };
33
+ const output = {
34
+ color: new _Rule.RawRuleList([new _Rule.RawRule('color', 'red', [], []), new _Rule.RawRule('color', 'blue', [], [])]),
35
+ backgroundColor: new _Rule.RawRule('backgroundColor', 'blue', [], [])
36
+ };
37
+ expect((0, _preflatten.default)(input)).toEqual(output);
38
+ });
39
+ test('flattens a simple style object with a nested pseudo styles', () => {
40
+ const input = {
41
+ color: 'red',
42
+ backgroundColor: 'blue',
43
+ ':hover': {
44
+ color: 'green'
45
+ }
46
+ };
47
+ const output = {
48
+ color: new _Rule.RawRule('color', 'red', [], []),
49
+ backgroundColor: new _Rule.RawRule('backgroundColor', 'blue', [], []),
50
+ ':hover_color': new _Rule.RawRule('color', 'green', [':hover'], [])
51
+ };
52
+ expect((0, _preflatten.default)(input)).toEqual(output);
53
+ });
54
+ test('flattens a simple style object with a nested at-rule styles', () => {
55
+ const input = {
56
+ color: 'red',
57
+ backgroundColor: 'blue',
58
+ '@media (min-width: 600px)': {
59
+ color: 'green'
60
+ }
61
+ };
62
+ const output = {
63
+ color: new _Rule.RawRule('color', 'red', [], []),
64
+ backgroundColor: new _Rule.RawRule('backgroundColor', 'blue', [], []),
65
+ '@media (min-width: 600px)_color': new _Rule.RawRule('color', 'green', [], ['@media (min-width: 600px)'])
66
+ };
67
+ expect((0, _preflatten.default)(input)).toEqual(output);
68
+ });
69
+ test('flattens style object with nested pseudo in property', () => {
70
+ const input = {
71
+ color: {
72
+ default: 'red',
73
+ ':hover': 'green',
74
+ ':active': 'blue'
75
+ },
76
+ backgroundColor: 'blue'
77
+ };
78
+ const output = {
79
+ color: new _Rule.RawRuleList([new _Rule.RawRule('color', 'red', [], []), new _Rule.RawRule('color', 'green', [':hover'], []), new _Rule.RawRule('color', 'blue', [':active'], [])]),
80
+ backgroundColor: new _Rule.RawRule('backgroundColor', 'blue', [], [])
81
+ };
82
+ expect((0, _preflatten.default)(input)).toEqual(output);
83
+ });
84
+ test('flattens style object with nested media queries', () => {
85
+ const input = {
86
+ color: {
87
+ default: 'red',
88
+ '@media (max-width: 600px)': 'green',
89
+ '@media (min-width: 600px and max-width: 900px)': 'blue'
90
+ },
91
+ backgroundColor: 'blue'
92
+ };
93
+ const output = {
94
+ color: new _Rule.RawRuleList([new _Rule.RawRule('color', 'red', [], []), new _Rule.RawRule('color', 'green', [], ['@media (max-width: 600px)']), new _Rule.RawRule('color', 'blue', [], ['@media (min-width: 600px and max-width: 900px)'])]),
95
+ backgroundColor: new _Rule.RawRule('backgroundColor', 'blue', [], [])
96
+ };
97
+ expect((0, _preflatten.default)(input)).toEqual(output);
98
+ });
99
+ test('flattens style object with nested media queries and pseudo', () => {
100
+ const input = {
101
+ color: {
102
+ default: 'red',
103
+ '@media (max-width: 600px)': {
104
+ default: 'green',
105
+ ':hover': 'blue'
106
+ },
107
+ '@media (min-width: 600px and max-width: 900px)': {
108
+ default: 'blue',
109
+ ':hover': 'green'
110
+ }
111
+ },
112
+ backgroundColor: 'blue'
113
+ };
114
+ const output = {
115
+ color: new _Rule.RawRuleList([new _Rule.RawRule('color', 'red', [], []), new _Rule.RawRule('color', 'green', [], ['@media (max-width: 600px)']), new _Rule.RawRule('color', 'blue', [':hover'], ['@media (max-width: 600px)']), new _Rule.RawRule('color', 'blue', [], ['@media (min-width: 600px and max-width: 900px)']), new _Rule.RawRule('color', 'green', [':hover'], ['@media (min-width: 600px and max-width: 900px)'])]),
116
+ backgroundColor: new _Rule.RawRule('backgroundColor', 'blue', [], [])
117
+ };
118
+ expect((0, _preflatten.default)(input)).toEqual(output);
119
+ });
120
+ });
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = preflatten;
7
+ var _Rule = require("../utils/Rule");
8
+ /**
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ *
15
+ */
16
+
17
+ /// This function takes a Raw Style Object and converts into a flat object of rules.
18
+ ///
19
+ /// 1. The object is "flat": There will be no nested objects after this function.
20
+ /// 2. The values are "rules": Each value is the representation of a CSS Rule.
21
+ function preflatten(namespace) {
22
+ const result = {};
23
+ for (const key of Object.keys(namespace)) {
24
+ const value = namespace[key];
25
+ if (value === null) {
26
+ result[key] = null;
27
+ } else if (Array.isArray(value)) {
28
+ const allRules = getNestedRules(key, value);
29
+ if (allRules.length > 1) {
30
+ result[key] = new _Rule.RawRuleList(allRules);
31
+ } else if (allRules.length === 1) {
32
+ result[key] = allRules[0];
33
+ } else if (allRules.length === 0) {
34
+ result[key] = null;
35
+ }
36
+ } else if (typeof value === 'object' && !Array.isArray(value)) {
37
+ if (key.startsWith('@') || key.startsWith(':')) {
38
+ for (const [nestedKey, nestedValue] of Object.entries(value)) {
39
+ if (nestedValue != null && typeof nestedValue === 'object') {
40
+ throw new Error('Pseudo and At-Rules cannot be nested.');
41
+ }
42
+ result[`${key}_${nestedKey}`] = new _Rule.RawRule(nestedKey, nestedValue, key.startsWith(':') ? [key] : [], key.startsWith('@') ? [key] : []);
43
+ }
44
+ } else {
45
+ /*:: (value: RawStyles); */
46
+ const allRules = getNestedRules(key, value);
47
+ if (allRules.length > 1) {
48
+ result[key] = new _Rule.RawRuleList(allRules);
49
+ } else if (allRules.length === 1) {
50
+ result[key] = allRules[0];
51
+ } else if (allRules.length === 0) {
52
+ result[key] = null;
53
+ }
54
+ }
55
+ } else {
56
+ result[key] = new _Rule.RawRule(key, value, [], []);
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ function getNestedRules(key, value) {
62
+ let pseudos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
63
+ let atRules = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
64
+ const result = [];
65
+ if (value === null) {
66
+ return result;
67
+ } else if (Array.isArray(value)) {
68
+ result.push(new _Rule.RawRuleList(value.map(val => new _Rule.RawRule(key, val, pseudos, atRules))));
69
+ } else if (typeof value === 'object') {
70
+ for (const nestedKey of Object.keys(value)) {
71
+ const nestedValue = value[nestedKey];
72
+ if (nestedKey.startsWith('@')) {
73
+ result.push(...getNestedRules(key, nestedValue, pseudos, [...atRules, nestedKey]));
74
+ } else if (nestedKey.startsWith(':')) {
75
+ result.push(...getNestedRules(key, nestedValue, [...pseudos, nestedKey], atRules));
76
+ } else if (nestedKey === 'default') {
77
+ result.push(...getNestedRules(key, nestedValue, pseudos, atRules));
78
+ } else {
79
+ // This can be updated when we support more complex styles, such
80
+ // as applying a style conditionally when a parent is hovered.
81
+ throw new Error('Complex Selectors (combinators) are not supported yet.');
82
+ }
83
+ }
84
+ } else {
85
+ // primitive value
86
+ result.push(new _Rule.RawRule(key, value, pseudos, atRules));
87
+ }
88
+ return result;
89
+ }
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _splitCssValue = _interopRequireDefault(require("../utils/split-css-value"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /**
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *
15
+ *
16
+ */
17
+
18
+ const shorthands = {
19
+ all: _ => {
20
+ throw new Error('all is not supported');
21
+ },
22
+ animation: value => [['animation', value], ['animationName', null], ['animationDuration', null], ['animationTimingFunction', null], ['animationDelay', null], ['animationIterationCount', null], ['animationDirection', null], ['animationFillMode', null], ['animationPlayState', null]],
23
+ background: value => [['background', value], ['backgroundAttachment', null], ['backgroundClip', null], ['backgroundColor', null], ['backgroundImage', null], ['backgroundOrigin', null], ['backgroundPosition', null], ['backgroundRepeat', null], ['backgroundSize', null]],
24
+ // These will be removed later, matching the properties with React Native.
25
+ // For now, we're compiling them to the React Native properties.
26
+ // @Deprecated
27
+ border: rawValue => {
28
+ if (typeof rawValue === 'number') {
29
+ return shorthands.borderWidth(rawValue);
30
+ }
31
+ const [width, style, color] = (0, _splitCssValue.default)(rawValue);
32
+ return [...shorthands.borderWidth(width), ...shorthands.borderStyle(style), ...shorthands.borderColor(color)];
33
+ },
34
+ // @Deprecated
35
+ borderInline: rawValue => {
36
+ if (typeof rawValue === 'number') {
37
+ return [['borderInlineWidth', rawValue], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]];
38
+ }
39
+ const [width, style, color] = (0, _splitCssValue.default)(rawValue);
40
+ return [...shorthands.borderInlineWidth(width), ...shorthands.borderInlineStyle(style), ...shorthands.borderInlineColor(color)];
41
+ },
42
+ // @Deprecated
43
+ borderBlock: rawValue => {
44
+ if (typeof rawValue === 'number') {
45
+ return [['borderBlockWidth', rawValue], ['borderTopWidth', null], ['borderBottomWidth', null]];
46
+ }
47
+ const [width, style, color] = (0, _splitCssValue.default)(rawValue);
48
+ return [...shorthands.borderBlockWidth(width), ...shorthands.borderBlockStyle(style), ...shorthands.borderBlockColor(color)];
49
+ },
50
+ // @Deprecated
51
+ borderTop: rawValue => {
52
+ if (typeof rawValue === 'number') {
53
+ return [['borderTopWidth', rawValue]];
54
+ }
55
+ const [width, style, color] = (0, _splitCssValue.default)(rawValue);
56
+ return [['borderTopWidth', width], ['borderTopStyle', style], ['borderTopColor', color]];
57
+ },
58
+ // @Deprecated
59
+ borderInlineEnd: rawValue => {
60
+ if (typeof rawValue === 'number') {
61
+ return [['borderInlineEndWidth', rawValue]];
62
+ }
63
+ const [width, style, color] = (0, _splitCssValue.default)(rawValue);
64
+ return [['borderInlineEndWidth', width], ['borderInlineEndStyle', style], ['borderInlineEndColor', color]];
65
+ },
66
+ // @Deprecated
67
+ borderRight: rawValue => {
68
+ throw new Error(['`borderRight` is not supported.', 'You could use `borderRightWidth`, `borderRightStyle` and `borderRightColor`,', 'but it is preferable to use `borderInlineEndWidth`, `borderInlineEndStyle` and `borderInlineEndColor`.'].join(' '));
69
+ },
70
+ // @Deprecated
71
+ borderBottom: rawValue => {
72
+ if (typeof rawValue === 'number') {
73
+ return [['borderBottomWidth', rawValue]];
74
+ }
75
+ const [width, style, color] = (0, _splitCssValue.default)(rawValue);
76
+ return [['borderBottomWidth', width], ['borderBottomStyle', style], ['borderBottomColor', color]];
77
+ },
78
+ // @Deprecated
79
+ borderInlineStart: rawValue => {
80
+ if (typeof rawValue === 'number') {
81
+ return [['borderInlineStartWidth', rawValue]];
82
+ }
83
+ const [width, style, color] = (0, _splitCssValue.default)(rawValue);
84
+ return [['borderInlineStartWidth', width], ['borderInlineStartStyle', style], ['borderInlineStartColor', color]];
85
+ },
86
+ // @Deprecated
87
+ borderLeft: rawValue => {
88
+ throw new Error(['`borderLeft` is not supported.', 'You could use `borderLeftWidth`, `borderLeftStyle` and `borderLeftColor`,', 'but it is preferable to use `borderInlineStartWidth`, `borderInlineStartStyle` and `borderInlineStartColor`.'].join(' '));
89
+ },
90
+ borderInlineWidth: rawValue => [['borderInlineWidth', rawValue], ['borderInlineStartWidth', null], ['borderLeftWidth', null], ['borderInlineEndWidth', null], ['borderRightWidth', null]],
91
+ borderInlineStyle: rawValue => [['borderInlineStyle', rawValue], ['borderInlineStartStyle', null], ['borderLeftStyle', null], ['borderInlineEndStyle', null], ['borderRightStyle', null]],
92
+ borderInlineColor: rawValue => [['borderInlineColor', rawValue], ['borderInlineStartColor', null], ['borderLeftColor', null], ['borderInlineEndColor', null], ['borderRightColor', null]],
93
+ borderBlockWidth: rawValue => [['borderBlockWidth', rawValue], ['borderTopWidth', null], ['borderBottomWidth', null]],
94
+ borderBlockStyle: rawValue => [['borderBlockStyle', rawValue], ['borderTopStyle', null], ['borderBottomStyle', null]],
95
+ borderBlockColor: rawValue => [['borderBlockColor', rawValue], ['borderTopColor', null], ['borderBottomColor', null]],
96
+ borderColor: value => [['borderColor', value], ['borderTopColor', null], ['borderInlineEndColor', null], ['borderRightColor', null], ['borderBottomColor', null], ['borderInlineStartColor', null], ['borderLeftColor', null]],
97
+ borderStyle: value => [['borderStyle', value], ['borderTopStyle', null], ['borderInlineEndStyle', null], ['borderRightStyle', null], ['borderBottomStyle', null], ['borderInlineStartStyle', null], ['borderLeftStyle', null]],
98
+ borderWidth: value => [['borderWidth', value], ['borderTopWidth', null], ['borderInlineEndWidth', null], ['borderRightWidth', null], ['borderBottomWidth', null], ['borderInlineStartWidth', null], ['borderLeftWidth', null]],
99
+ borderInlineStartColor: value => [['borderInlineStartColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
100
+ borderInlineEndColor: value => [['borderInlineEndColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
101
+ borderInlineStartStyle: value => [['borderInlineStartStyle', value], ['borderLeftStyle', null], ['borderRightStyle', null]],
102
+ borderInlineEndStyle: value => [['borderInlineEndStyle', value], ['borderLeftStyle', null], ['borderRightStyle', null]],
103
+ borderInlineStartWidth: value => [['borderInlineStartWidth', value], ['borderLeftWidth', null], ['borderRightWidth', null]],
104
+ borderInlineEndWidth: value => [['borderInlineEndWidth', value], ['borderLeftWidth', null], ['borderRightWidth', null]],
105
+ borderLeftColor: value => [['borderLeftColor', value], ['borderInlineStartColor', null], ['borderInlineEndColor', null]],
106
+ borderRightColor: value => [['borderRightColor', value], ['borderInlineStartColor', null], ['borderInlineEndColor', null]],
107
+ borderLeftStyle: value => [['borderLeftStyle', value], ['borderInlineStartStyle', null], ['borderInlineEndStyle', null]],
108
+ borderRightStyle: value => [['borderRightStyle', value], ['borderInlineStartStyle', null], ['borderInlineEndStyle', null]],
109
+ borderLeftWidth: value => [['borderLeftWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
110
+ borderRightWidth: value => [['borderRightWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
111
+ borderRadius: value => {
112
+ const values = typeof value === 'number' ? [value] : (0, _splitCssValue.default)(value);
113
+ if (values.length === 1) {
114
+ return [['borderRadius', value],
115
+ // // logical constituents
116
+ ['borderStartStartRadius', null], ['borderStartEndRadius', null], ['borderEndStartRadius', null], ['borderEndEndRadius', null],
117
+ // physical constituents
118
+ ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]];
119
+ }
120
+
121
+ // @Deprecated
122
+ const [startStart, startEnd = startStart, endEnd = startStart, endStart = startEnd] = values;
123
+ return [
124
+ // split into logical consituents
125
+ ['borderStartStartRadius', startStart], ['borderStartEndRadius', startEnd], ['borderEndEndRadius', endEnd], ['borderEndStartRadius', endStart],
126
+ // unset physical consituents
127
+ ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]];
128
+ },
129
+ borderStartStartRadius: value => [['borderStartStartRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
130
+ borderStartEndRadius: value => [['borderStartEndRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
131
+ borderEndStartRadius: value => [['borderEndStartRadius', value], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
132
+ borderEndEndRadius: value => [['borderEndEndRadius', value], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
133
+ borderTopLeftRadius: value => [['borderTopLeftRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
134
+ borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
135
+ borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
136
+ borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
137
+ columnRule: value => [['columnRule', value], ['columnRuleWidth', null], ['columnRuleStyle', null], ['columnRuleColor', null]],
138
+ columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
139
+ container: value => [['container', value], ['containerName', null], ['containerType', null]],
140
+ flex: value => [['flex', value], ['flexGrow', null], ['flexShrink', null], ['flexBasis', null]],
141
+ flexFlow: value => [['flexFlow', value], ['flexDirection', null], ['flexWrap', null]],
142
+ // @Deprecated ?
143
+ font: value => [['font', value], ['fontFamily', null], ['fontSize', null], ['fontStretch', null], ['fontStyle', null], ['fontVariant', null], ['fontWeight', null], ['lineHeight', null]],
144
+ gap: value => [['gap', value], ['rowGap', null], ['columnGap', null]],
145
+ grid: value => [['grid', value], ['gridTemplate', null], ['gridTemplateAreas', null], ['gridTemplateColumns', null], ['gridTemplateRows', null], ['gridAutoRows', null], ['gridAutoColumns', null], ['gridAutoFlow', null]],
146
+ gridArea: value => [['gridArea', value], ['gridRow', null], ['gridRowStart', null], ['gridRowEnd', null], ['gridColumn', null], ['gridColumnStart', null], ['gridColumnEnd', null]],
147
+ gridRow: value => [['gridRow', value], ['gridRowStart', null], ['gridRowEnd', null]],
148
+ gridColumn: value => [['gridColumn', value], ['gridColumnStart', null], ['gridColumnEnd', null]],
149
+ gridTemplate: value => [['gridTemplate', value], ['gridTemplateAreas', null], ['gridTemplateColumns', null], ['gridTemplateRows', null]],
150
+ inset: value => [['inset', value], ['insetInline', null], ['insetBlock', null], ['insetInlineStart', null], ['insetInlineEnd', null], ['top', null], ['right', null], ['bottom', null], ['left', null]],
151
+ insetInline: value => [['insetInline', value], ['insetInlineStart', null], ['insetInlineEnd', null], ['left', null], ['right', null]],
152
+ insetBlock: value => [['insetBlock', value], ['top', null], ['bottom', null]],
153
+ insetInlineStart: value => [['insetInlineStart', value], ['left', null], ['right', null]],
154
+ insetInlineEnd: value => [['insetInlineEnd', value], ['left', null], ['right', null]],
155
+ left: value => [['left', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
156
+ right: value => [['right', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
157
+ listStyle: value => [['listStyle', value], ['listStyleImage', null], ['listStylePosition', null], ['listStyleType', null]],
158
+ margin: value => {
159
+ const values = typeof value === 'number' ? [value] : (0, _splitCssValue.default)(value);
160
+ if (values.length === 1) {
161
+ return [['margin', values[0]], ['marginInlineStart', null], ['marginLeft', null], ['marginInlineEnd', null], ['marginRight', null], ['marginTop', null], ['marginBottom', null]];
162
+ }
163
+ // @Deprecated
164
+ const [top, right = top, bottom = top, left = right] = values;
165
+ return [['marginTop', top], ['marginInlineEnd', right], ['marginBottom', bottom], ['marginInlineStart', left], ['marginLeft', null], ['marginRight', null]];
166
+ },
167
+ marginInline: value => [['marginInline', value], ['marginInlineStart', null], ['marginLeft', null], ['marginInlineEnd', null], ['marginRight', null]],
168
+ marginBlock: value => [['marginBlock', value], ['marginTop', null], ['marginBottom', null]],
169
+ marginInlineStart: value => [['marginInlineStart', value], ['marginLeft', null], ['marginRight', null]],
170
+ marginInlineEnd: value => [['marginInlineEnd', value], ['marginLeft', null], ['marginRight', null]],
171
+ marginLeft: value => [['marginLeft', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
172
+ marginRight: value => [['marginRight', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
173
+ mask: value => [['mask', value], ['maskClip', null], ['maskComposite', null], ['maskImage', null], ['maskMode', null], ['maskOrigin', null], ['maskPosition', null], ['maskRepeat', null], ['maskSize', null]],
174
+ offset: value => [['offset', value], ['offsetAnchor', null], ['offsetDistance', null], ['offsetPath', null], ['offsetPosition', null], ['offsetRotate', null]],
175
+ outline: value => [['outline', value], ['outlineColor', null], ['outlineStyle', null], ['outlineWidth', null]],
176
+ overflow: value => [['overflow', value], ['overflowX', null], ['overflowY', null]],
177
+ padding: rawValue => {
178
+ const values = typeof rawValue === 'number' ? [rawValue] : (0, _splitCssValue.default)(rawValue);
179
+ if (values.length === 1) {
180
+ return [['padding', values[0]], ['paddingStart', null], ['paddingLeft', null], ['paddingEnd', null], ['paddingRight', null], ['paddingTop', null], ['paddingBottom', null]];
181
+ }
182
+ // @Deprecated
183
+ const [top, right = top, bottom = top, left = right] = values;
184
+ return [['paddingTop', top], ['paddingEnd', right], ['paddingBottom', bottom], ['paddingStart', left]];
185
+ },
186
+ paddingInline: rawValue => [['paddingInline', rawValue], ['paddingStart', null], ['paddingLeft', null], ['paddingEnd', null], ['paddingRight', null]],
187
+ paddingBlock: rawValue => [['paddingBlock', rawValue], ['paddingTop', null], ['paddingBottom', null]],
188
+ paddingInlineStart: value => [['paddingInlineStart', value], ['paddingLeft', null], ['paddingRight', null]],
189
+ paddingInlineEnd: value => [['paddingInlineEnd', value], ['paddingLeft', null], ['paddingRight', null]],
190
+ paddingLeft: value => [['paddingLeft', value], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
191
+ paddingRight: value => [['paddingRight', value], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
192
+ placeContent: value => [['placeContent', value], ['alignContent', null], ['justifyContent', null]],
193
+ placeItems: value => [['placeItems', value], ['alignItems', null], ['justifyItems', null]],
194
+ placeSelf: value => [['placeSelf', value], ['alignSelf', null], ['justifySelf', null]],
195
+ scrollMargin: value => [['scrollMargin', value], ['scrollMarginBottom', null], ['scrollMarginLeft', null], ['scrollMarginStart', null], ['scrollMarginRight', null], ['scrollMarginEnd', null], ['scrollMarginTop', null]],
196
+ scrollPadding: value => [['scrollPadding', value], ['scrollPaddingBottom', null], ['scrollPaddingLeft', null], ['scrollPaddingStart', null], ['scrollPaddingRight', null], ['scrollPaddingEnd', null], ['scrollPaddingTop', null]],
197
+ scrollTimeline: value => [['scrollTimeline', value], ['scrollTimelineName', null], ['scrollTimelineAxis', null]],
198
+ textDecoration: value => [['textDecoration', value], ['textDecorationColor', null], ['textDecorationLine', null], ['textDecorationStyle', null], ['textDecorationThickness', null]],
199
+ textEmphasis: value => [['textEmphasis', value], ['textEmphasisColor', null], ['textEmphasisStyle', null]],
200
+ transition: value => [['transition', value], ['transitionDelay', null], ['transitionDuration', null], ['transitionProperty', null], ['transitionTimingFunction', null]]
201
+ };
202
+ const aliases = {
203
+ // @Deprecated
204
+ borderHorizontal: shorthands.borderInline,
205
+ // @Deprecated
206
+ borderVertical: shorthands.borderBlock,
207
+ // @Deprecated
208
+ borderBlockStart: shorthands.borderTop,
209
+ // @Deprecated
210
+ borderEnd: shorthands.borderInlineEnd,
211
+ // @Deprecated
212
+ borderBlockEnd: shorthands.borderBottom,
213
+ // @Deprecated
214
+ borderStart: shorthands.borderInlineStart,
215
+ borderHorizontalWidth: shorthands.borderInlineWidth,
216
+ borderHorizontalStyle: shorthands.borderInlineStyle,
217
+ borderHorizontalColor: shorthands.borderInlineColor,
218
+ borderVerticalWidth: shorthands.borderBlockWidth,
219
+ borderVerticalStyle: shorthands.borderBlockStyle,
220
+ borderVerticalColor: shorthands.borderBlockColor,
221
+ borderBlockStartColor: value => [['borderTopColor', value]],
222
+ borderBlockEndColor: value => [['borderBottomColor', value]],
223
+ borderBlockStartStyle: value => [['borderTopStyle', value]],
224
+ borderBlockEndStyle: value => [['borderBottomStyle', value]],
225
+ borderBlockStartWidth: value => [['borderTopWidth', value]],
226
+ borderBlockEndWidth: value => [['borderBottomWidth', value]],
227
+ borderStartColor: shorthands.borderInlineStartColor,
228
+ borderEndColor: shorthands.borderInlineEndColor,
229
+ borderStartStyle: shorthands.borderInlineStartStyle,
230
+ borderEndStyle: shorthands.borderInlineEndStyle,
231
+ borderStartWidth: shorthands.borderInlineStartWidth,
232
+ borderEndWidth: shorthands.borderInlineEndWidth,
233
+ borderTopStartRadius: value => [['borderStartStartRadius', value]],
234
+ borderTopEndRadius: value => [['borderStartEndRadius', value]],
235
+ borderBottomStartRadius: value => [['borderEndStartRadius', value]],
236
+ borderBottomEndRadius: value => [['borderEndEndRadius', value]],
237
+ marginBlockStart: value => [['marginTop', value]],
238
+ marginBlockEnd: value => [['marginBottom', value]],
239
+ marginStart: shorthands.marginInlineStart,
240
+ marginEnd: shorthands.marginInlineEnd,
241
+ marginHorizontal: shorthands.marginInline,
242
+ marginVertical: shorthands.marginBlock,
243
+ paddingBlockStart: rawValue => [['paddingTop', rawValue]],
244
+ paddingBlockEnd: rawValue => [['paddingBottom', rawValue]],
245
+ paddingStart: shorthands.paddingInlineStart,
246
+ paddingEnd: shorthands.paddingInlineEnd,
247
+ paddingHorizontal: shorthands.paddingInline,
248
+ paddingVertical: shorthands.paddingBlock,
249
+ insetBlockStart: value => [['top', value]],
250
+ insetBlockEnd: value => [['bottom', value]],
251
+ start: shorthands.insetInlineStart,
252
+ end: shorthands.insetInlineEnd
253
+ };
254
+ const expansions = {
255
+ ...shorthands,
256
+ ...aliases
257
+ };
258
+ var _default = expansions;
259
+ exports.default = _default;