@stylexjs/shared 0.2.0-beta.18 → 0.2.0-beta.20

Sign up to get free protection for your applications and to get access to all the features.
package/lib/index.d.ts CHANGED
@@ -25,6 +25,7 @@ import stylexFirstThatWorks from './stylex-first-that-works';
25
25
  import hash from './hash';
26
26
  import genFileBasedIdentifier from './utils/file-based-identifier';
27
27
  import * as m from './messages';
28
+ export * as types from './types';
28
29
  import type {
29
30
  InjectableStyle as _InjectableStyle,
30
31
  CompiledNamespaces as _CompiledNamespaces,
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.utils = exports.overrideVars = exports.messages = exports.keyframes = exports.include = exports.firstThatWorks = exports.createVars = exports.create = exports.IncludedStyles = void 0;
6
+ exports.utils = exports.types = exports.overrideVars = exports.messages = exports.keyframes = exports.include = exports.firstThatWorks = exports.createVars = exports.create = exports.IncludedStyles = void 0;
7
7
  var _stylexCreate = _interopRequireDefault(require("./stylex-create"));
8
8
  var _stylexCreateVars = _interopRequireDefault(require("./stylex-create-vars"));
9
9
  var _stylexOverrideVars = _interopRequireDefault(require("./stylex-override-vars"));
@@ -13,6 +13,8 @@ var _stylexFirstThatWorks = _interopRequireDefault(require("./stylex-first-that-
13
13
  var _hash = _interopRequireDefault(require("./hash"));
14
14
  var _fileBasedIdentifier = _interopRequireDefault(require("./utils/file-based-identifier"));
15
15
  var m = _interopRequireWildcard(require("./messages"));
16
+ var _types = _interopRequireWildcard(require("./types"));
17
+ exports.types = _types;
16
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/lib/index.js.flow CHANGED
@@ -31,6 +31,7 @@ import stylexFirstThatWorks from './stylex-first-that-works';
31
31
  import hash from './hash';
32
32
  import genFileBasedIdentifier from './utils/file-based-identifier';
33
33
  import * as m from './messages';
34
+ export * as types from './types';
34
35
 
35
36
  import type {
36
37
  InjectableStyle as _InjectableStyle,
@@ -209,6 +209,12 @@ declare const aliases: {
209
209
  borderEnd: any;
210
210
  borderBlockEnd: any;
211
211
  borderStart: any;
212
+ blockSize: (val: TStyleValue) => TReturn;
213
+ inlineSize: (val: TStyleValue) => TReturn;
214
+ minBlockSize: (val: TStyleValue) => TReturn;
215
+ minInlineSize: (val: TStyleValue) => TReturn;
216
+ maxBlockSize: (val: TStyleValue) => TReturn;
217
+ maxInlineSize: (val: TStyleValue) => TReturn;
212
218
  borderHorizontalWidth: any;
213
219
  borderHorizontalStyle: any;
214
220
  borderHorizontalColor: any;
@@ -249,7 +255,7 @@ declare const aliases: {
249
255
  end: any;
250
256
  };
251
257
  declare const $$EXPORT_DEFAULT_DECLARATION$$: Readonly</**
252
- * > 205 | ...typeof shorthands,
258
+ * > 211 | ...typeof shorthands,
253
259
  * | ^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with complex spreads" is currently not supported.
254
260
  **/
255
261
  any>;
@@ -173,6 +173,12 @@ const aliases = {
173
173
  borderEnd: shorthands.borderInlineEnd,
174
174
  borderBlockEnd: shorthands.borderBottom,
175
175
  borderStart: shorthands.borderInlineStart,
176
+ blockSize: val => [["height", val]],
177
+ inlineSize: val => [["width", val]],
178
+ minBlockSize: val => [["minHeight", val]],
179
+ minInlineSize: val => [["minWidth", val]],
180
+ maxBlockSize: val => [["maxHeight", val]],
181
+ maxInlineSize: val => [["maxWidth", val]],
176
182
  borderHorizontalWidth: shorthands.borderInlineWidth,
177
183
  borderHorizontalStyle: shorthands.borderInlineStyle,
178
184
  borderHorizontalColor: shorthands.borderInlineColor,
@@ -161,6 +161,12 @@ declare const aliases: {
161
161
  borderEnd: $FlowFixMe,
162
162
  borderBlockEnd: $FlowFixMe,
163
163
  borderStart: $FlowFixMe,
164
+ blockSize: (val: TStyleValue) => TReturn,
165
+ inlineSize: (val: TStyleValue) => TReturn,
166
+ minBlockSize: (val: TStyleValue) => TReturn,
167
+ minInlineSize: (val: TStyleValue) => TReturn,
168
+ maxBlockSize: (val: TStyleValue) => TReturn,
169
+ maxInlineSize: (val: TStyleValue) => TReturn,
164
170
  borderHorizontalWidth: $FlowFixMe,
165
171
  borderHorizontalStyle: $FlowFixMe,
166
172
  borderHorizontalColor: $FlowFixMe,
@@ -103,21 +103,78 @@ import type { TStyleValue } from '../common-types';
103
103
  */
104
104
 
105
105
  type TReturn = ReadonlyArray<[string, TStyleValue]>;
106
- declare const expansions: {
106
+ declare const shorthands: {
107
107
  border: (rawValue: TStyleValue) => TReturn;
108
108
  borderColor: (rawValue: TStyleValue) => TReturn;
109
109
  borderHorizontal: (rawValue: TStyleValue) => TReturn;
110
110
  borderStyle: (rawValue: TStyleValue) => TReturn;
111
111
  borderVertical: (rawValue: TStyleValue) => TReturn;
112
112
  borderWidth: (rawValue: TStyleValue) => TReturn;
113
+ borderHorizontalColor: (rawValue: TStyleValue) => TReturn;
114
+ borderHorizontalStyle: (rawValue: TStyleValue) => TReturn;
115
+ borderHorizontalWidth: (rawValue: TStyleValue) => TReturn;
116
+ borderVerticalColor: (rawValue: TStyleValue) => TReturn;
117
+ borderVerticalStyle: (rawValue: TStyleValue) => TReturn;
118
+ borderVerticalWidth: (rawValue: TStyleValue) => TReturn;
113
119
  borderRadius: (rawValue: TStyleValue) => TReturn;
120
+ inset: (rawValue: TStyleValue) => TReturn;
121
+ insetInline: (rawValue: TStyleValue) => TReturn;
122
+ insetBlock: (rawValue: TStyleValue) => TReturn;
114
123
  margin: (rawValue: TStyleValue) => TReturn;
115
124
  marginHorizontal: (rawValue: TStyleValue) => TReturn;
116
125
  marginVertical: (rawValue: TStyleValue) => TReturn;
117
126
  overflow: (rawValue: TStyleValue) => TReturn;
118
127
  padding: (rawValue: TStyleValue) => TReturn;
119
- paddingHorizontal: (rawValue: TStyleValue) => TReturn;
120
- paddingVertical: (rawValue: TStyleValue) => TReturn;
128
+ paddingHorizontal: (val: TStyleValue) => TReturn;
129
+ paddingVertical: (val: TStyleValue) => TReturn;
121
130
  };
131
+ declare const aliases: {
132
+ insetBlockStart: (val: TStyleValue) => TReturn;
133
+ insetBlockEnd: (val: TStyleValue) => TReturn;
134
+ insetInlineStart: (val: TStyleValue) => TReturn;
135
+ insetInlineEnd: (val: TStyleValue) => TReturn;
136
+ blockSize: (val: TStyleValue) => TReturn;
137
+ inlineSize: (val: TStyleValue) => TReturn;
138
+ minBlockSize: (val: TStyleValue) => TReturn;
139
+ minInlineSize: (val: TStyleValue) => TReturn;
140
+ maxBlockSize: (val: TStyleValue) => TReturn;
141
+ maxInlineSize: (val: TStyleValue) => TReturn;
142
+ borderBlockWidth: any;
143
+ borderBlockStyle: any;
144
+ borderBlockColor: any;
145
+ borderBlockStartWidth: (val: TStyleValue) => TReturn;
146
+ borderBlockStartStyle: (val: TStyleValue) => TReturn;
147
+ borderBlockStartColor: (val: TStyleValue) => TReturn;
148
+ borderBlockEndWidth: (val: TStyleValue) => TReturn;
149
+ borderBlockEndStyle: (val: TStyleValue) => TReturn;
150
+ borderBlockEndColor: (val: TStyleValue) => TReturn;
151
+ borderInlineWidth: any;
152
+ borderInlineStyle: any;
153
+ borderInlineColor: any;
154
+ borderInlineStartWidth: (val: TStyleValue) => TReturn;
155
+ borderInlineStartStyle: (val: TStyleValue) => TReturn;
156
+ borderInlineStartColor: (val: TStyleValue) => TReturn;
157
+ borderInlineEndWidth: (val: TStyleValue) => TReturn;
158
+ borderInlineEndStyle: (val: TStyleValue) => TReturn;
159
+ borderInlineEndColor: (val: TStyleValue) => TReturn;
160
+ borderStartStartRadius: (val: TStyleValue) => TReturn;
161
+ borderStartEndRadius: (val: TStyleValue) => TReturn;
162
+ borderEndStartRadius: (val: TStyleValue) => TReturn;
163
+ borderEndEndRadius: (val: TStyleValue) => TReturn;
164
+ marginBlock: any;
165
+ marginBlockStart: (val: TStyleValue) => TReturn;
166
+ marginBlockEnd: (val: TStyleValue) => TReturn;
167
+ marginInline: any;
168
+ marginInlineStart: (val: TStyleValue) => TReturn;
169
+ marginInlineEnd: (val: TStyleValue) => TReturn;
170
+ paddingBlock: any;
171
+ paddingBlockStart: (val: TStyleValue) => TReturn;
172
+ paddingBlockEnd: (val: TStyleValue) => TReturn;
173
+ paddingInline: any;
174
+ paddingInlineStart: (val: TStyleValue) => TReturn;
175
+ paddingInlineEnd: (val: TStyleValue) => TReturn;
176
+ };
177
+ declare const expansions: Omit<shorthands, keyof (aliases | {})> &
178
+ Omit<aliases, keyof ({})> & {};
122
179
  declare const $$EXPORT_DEFAULT_DECLARATION$$: typeof expansions;
123
180
  export default $$EXPORT_DEFAULT_DECLARATION$$;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _splitCssValue = _interopRequireDefault(require("../utils/split-css-value"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- const expansions = {
9
+ const shorthands = {
10
10
  border: rawValue => {
11
11
  return [["borderTop", rawValue], ["borderEnd", rawValue], ["borderBottom", rawValue], ["borderStart", rawValue]];
12
12
  },
@@ -28,10 +28,19 @@ const expansions = {
28
28
  const [top, right = top, bottom = top, left = right] = (0, _splitCssValue.default)(rawValue);
29
29
  return [["borderTopWidth", top], ["borderEndWidth", right], ["borderBottomWidth", bottom], ["borderStartWidth", left]];
30
30
  },
31
+ borderHorizontalColor: rawValue => [["borderStartColor", rawValue], ["borderEndColor", rawValue]],
32
+ borderHorizontalStyle: rawValue => [["borderStartStyle", rawValue], ["borderEndStyle", rawValue]],
33
+ borderHorizontalWidth: rawValue => [["borderStartWidth", rawValue], ["borderEndWidth", rawValue]],
34
+ borderVerticalColor: rawValue => [["borderTopColor", rawValue], ["borderBottomColor", rawValue]],
35
+ borderVerticalStyle: rawValue => [["borderTopStyle", rawValue], ["borderBottomStyle", rawValue]],
36
+ borderVerticalWidth: rawValue => [["borderTopWidth", rawValue], ["borderBottomWidth", rawValue]],
31
37
  borderRadius: rawValue => {
32
38
  const [top, right = top, bottom = top, left = right] = (0, _splitCssValue.default)(rawValue);
33
39
  return [["borderTopStartRadius", top], ["borderTopEndRadius", right], ["borderBottomEndRadius", bottom], ["borderBottomStartRadius", left]];
34
40
  },
41
+ inset: rawValue => [["top", rawValue], ["end", rawValue], ["bottom", rawValue], ["start", rawValue]],
42
+ insetInline: rawValue => [["start", rawValue], ["end", rawValue]],
43
+ insetBlock: rawValue => [["top", rawValue], ["bottom", rawValue]],
35
44
  margin: rawValue => {
36
45
  const [top, right = top, bottom = top, left = right] = (0, _splitCssValue.default)(rawValue);
37
46
  return [["marginTop", top], ["marginEnd", right], ["marginBottom", bottom], ["marginStart", left]];
@@ -50,12 +59,62 @@ const expansions = {
50
59
  const [top, right = top, bottom = top, left = right] = (0, _splitCssValue.default)(rawValue);
51
60
  return [["paddingTop", top], ["paddingEnd", right], ["paddingBottom", bottom], ["paddingStart", left]];
52
61
  },
53
- paddingHorizontal: rawValue => {
54
- return [["paddingStart", rawValue], ["paddingEnd", rawValue]];
62
+ paddingHorizontal: val => {
63
+ return [["paddingStart", val], ["paddingEnd", val]];
55
64
  },
56
- paddingVertical: rawValue => {
57
- return [["paddingTop", rawValue], ["paddingBottom", rawValue]];
65
+ paddingVertical: val => {
66
+ return [["paddingTop", val], ["paddingBottom", val]];
58
67
  }
59
68
  };
69
+ const aliases = {
70
+ insetBlockStart: val => [["top", val]],
71
+ insetBlockEnd: val => [["bottom", val]],
72
+ insetInlineStart: val => [["start", val]],
73
+ insetInlineEnd: val => [["end", val]],
74
+ blockSize: val => [["height", val]],
75
+ inlineSize: val => [["width", val]],
76
+ minBlockSize: val => [["minHeight", val]],
77
+ minInlineSize: val => [["minWidth", val]],
78
+ maxBlockSize: val => [["maxHeight", val]],
79
+ maxInlineSize: val => [["maxWidth", val]],
80
+ borderBlockWidth: shorthands.borderVerticalWidth,
81
+ borderBlockStyle: shorthands.borderVerticalStyle,
82
+ borderBlockColor: shorthands.borderVerticalColor,
83
+ borderBlockStartWidth: val => [["borderTopWidth", val]],
84
+ borderBlockStartStyle: val => [["borderTopStyle", val]],
85
+ borderBlockStartColor: val => [["borderTopColor", val]],
86
+ borderBlockEndWidth: val => [["borderBottomWidth", val]],
87
+ borderBlockEndStyle: val => [["borderBottomStyle", val]],
88
+ borderBlockEndColor: val => [["borderBottomColor", val]],
89
+ borderInlineWidth: shorthands.borderHorizontalWidth,
90
+ borderInlineStyle: shorthands.borderHorizontalStyle,
91
+ borderInlineColor: shorthands.borderHorizontalColor,
92
+ borderInlineStartWidth: val => [["borderStartWidth", val]],
93
+ borderInlineStartStyle: val => [["borderStartStyle", val]],
94
+ borderInlineStartColor: val => [["borderStartColor", val]],
95
+ borderInlineEndWidth: val => [["borderEndWidth", val]],
96
+ borderInlineEndStyle: val => [["borderEndStyle", val]],
97
+ borderInlineEndColor: val => [["borderEndColor", val]],
98
+ borderStartStartRadius: val => [["borderTopStartRadius", val]],
99
+ borderStartEndRadius: val => [["borderTopEndRadius", val]],
100
+ borderEndStartRadius: val => [["borderBottomStartRadius", val]],
101
+ borderEndEndRadius: val => [["borderBottomEndRadius", val]],
102
+ marginBlock: shorthands.marginVertical,
103
+ marginBlockStart: val => [["marginTop", val]],
104
+ marginBlockEnd: val => [["marginBottom", val]],
105
+ marginInline: shorthands.marginHorizontal,
106
+ marginInlineStart: val => [["marginStart", val]],
107
+ marginInlineEnd: val => [["marginEnd", val]],
108
+ paddingBlock: shorthands.paddingVertical,
109
+ paddingBlockStart: val => [["paddingTop", val]],
110
+ paddingBlockEnd: val => [["paddingBottom", val]],
111
+ paddingInline: shorthands.paddingHorizontal,
112
+ paddingInlineStart: val => [["paddingStart", val]],
113
+ paddingInlineEnd: val => [["paddingEnd", val]]
114
+ };
115
+ const expansions = {
116
+ ...shorthands,
117
+ ...aliases
118
+ };
60
119
  var _default = expansions;
61
120
  exports.default = _default;
@@ -81,21 +81,79 @@ import type { TStyleValue } from '../common-types';
81
81
 
82
82
  type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
83
83
 
84
- declare const expansions: {
84
+ declare const shorthands: {
85
85
  border: (rawValue: TStyleValue) => TReturn,
86
86
  borderColor: (rawValue: TStyleValue) => TReturn,
87
87
  borderHorizontal: (rawValue: TStyleValue) => TReturn,
88
88
  borderStyle: (rawValue: TStyleValue) => TReturn,
89
89
  borderVertical: (rawValue: TStyleValue) => TReturn,
90
90
  borderWidth: (rawValue: TStyleValue) => TReturn,
91
+ borderHorizontalColor: (rawValue: TStyleValue) => TReturn,
92
+ borderHorizontalStyle: (rawValue: TStyleValue) => TReturn,
93
+ borderHorizontalWidth: (rawValue: TStyleValue) => TReturn,
94
+ borderVerticalColor: (rawValue: TStyleValue) => TReturn,
95
+ borderVerticalStyle: (rawValue: TStyleValue) => TReturn,
96
+ borderVerticalWidth: (rawValue: TStyleValue) => TReturn,
91
97
  borderRadius: (rawValue: TStyleValue) => TReturn,
98
+ inset: (rawValue: TStyleValue) => TReturn,
99
+ insetInline: (rawValue: TStyleValue) => TReturn,
100
+ insetBlock: (rawValue: TStyleValue) => TReturn,
92
101
  margin: (rawValue: TStyleValue) => TReturn,
93
102
  marginHorizontal: (rawValue: TStyleValue) => TReturn,
94
103
  marginVertical: (rawValue: TStyleValue) => TReturn,
95
104
  overflow: (rawValue: TStyleValue) => TReturn,
96
105
  padding: (rawValue: TStyleValue) => TReturn,
97
- paddingHorizontal: (rawValue: TStyleValue) => TReturn,
98
- paddingVertical: (rawValue: TStyleValue) => TReturn,
106
+ paddingHorizontal: (val: TStyleValue) => TReturn,
107
+ paddingVertical: (val: TStyleValue) => TReturn,
99
108
  };
100
109
 
110
+ declare const aliases: {
111
+ insetBlockStart: (val: TStyleValue) => TReturn,
112
+ insetBlockEnd: (val: TStyleValue) => TReturn,
113
+ insetInlineStart: (val: TStyleValue) => TReturn,
114
+ insetInlineEnd: (val: TStyleValue) => TReturn,
115
+ blockSize: (val: TStyleValue) => TReturn,
116
+ inlineSize: (val: TStyleValue) => TReturn,
117
+ minBlockSize: (val: TStyleValue) => TReturn,
118
+ minInlineSize: (val: TStyleValue) => TReturn,
119
+ maxBlockSize: (val: TStyleValue) => TReturn,
120
+ maxInlineSize: (val: TStyleValue) => TReturn,
121
+ borderBlockWidth: $FlowFixMe,
122
+ borderBlockStyle: $FlowFixMe,
123
+ borderBlockColor: $FlowFixMe,
124
+ borderBlockStartWidth: (val: TStyleValue) => TReturn,
125
+ borderBlockStartStyle: (val: TStyleValue) => TReturn,
126
+ borderBlockStartColor: (val: TStyleValue) => TReturn,
127
+ borderBlockEndWidth: (val: TStyleValue) => TReturn,
128
+ borderBlockEndStyle: (val: TStyleValue) => TReturn,
129
+ borderBlockEndColor: (val: TStyleValue) => TReturn,
130
+ borderInlineWidth: $FlowFixMe,
131
+ borderInlineStyle: $FlowFixMe,
132
+ borderInlineColor: $FlowFixMe,
133
+ borderInlineStartWidth: (val: TStyleValue) => TReturn,
134
+ borderInlineStartStyle: (val: TStyleValue) => TReturn,
135
+ borderInlineStartColor: (val: TStyleValue) => TReturn,
136
+ borderInlineEndWidth: (val: TStyleValue) => TReturn,
137
+ borderInlineEndStyle: (val: TStyleValue) => TReturn,
138
+ borderInlineEndColor: (val: TStyleValue) => TReturn,
139
+ borderStartStartRadius: (val: TStyleValue) => TReturn,
140
+ borderStartEndRadius: (val: TStyleValue) => TReturn,
141
+ borderEndStartRadius: (val: TStyleValue) => TReturn,
142
+ borderEndEndRadius: (val: TStyleValue) => TReturn,
143
+ marginBlock: $FlowFixMe,
144
+ marginBlockStart: (val: TStyleValue) => TReturn,
145
+ marginBlockEnd: (val: TStyleValue) => TReturn,
146
+ marginInline: $FlowFixMe,
147
+ marginInlineStart: (val: TStyleValue) => TReturn,
148
+ marginInlineEnd: (val: TStyleValue) => TReturn,
149
+ paddingBlock: $FlowFixMe,
150
+ paddingBlockStart: (val: TStyleValue) => TReturn,
151
+ paddingBlockEnd: (val: TStyleValue) => TReturn,
152
+ paddingInline: $FlowFixMe,
153
+ paddingInlineStart: (val: TStyleValue) => TReturn,
154
+ paddingInlineEnd: (val: TStyleValue) => TReturn,
155
+ };
156
+
157
+ declare const expansions: { ...shorthands, ...aliases };
158
+
101
159
  declare export default typeof expansions;
@@ -32,6 +32,12 @@ declare const aliases: {
32
32
  borderEnd: any;
33
33
  borderBlockEnd: any;
34
34
  borderStart: any;
35
+ blockSize: (val: TStyleValue) => TReturn;
36
+ inlineSize: (val: TStyleValue) => TReturn;
37
+ minBlockSize: (val: TStyleValue) => TReturn;
38
+ minInlineSize: (val: TStyleValue) => TReturn;
39
+ maxBlockSize: (val: TStyleValue) => TReturn;
40
+ maxInlineSize: (val: TStyleValue) => TReturn;
35
41
  borderHorizontalWidth: (value: TStyleValue) => TReturn;
36
42
  borderHorizontalStyle: (value: TStyleValue) => TReturn;
37
43
  borderHorizontalColor: (value: TStyleValue) => TReturn;
@@ -72,7 +78,7 @@ declare const aliases: {
72
78
  end: (value: TStyleValue) => TReturn;
73
79
  };
74
80
  declare const $$EXPORT_DEFAULT_DECLARATION$$: Readonly</**
75
- * > 86 | ...typeof shorthands,
81
+ * > 92 | ...typeof shorthands,
76
82
  * | ^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with complex spreads" is currently not supported.
77
83
  **/
78
84
  any>;
@@ -66,6 +66,12 @@ const aliases = {
66
66
  borderEnd: shorthands.borderInlineEnd,
67
67
  borderBlockEnd: shorthands.borderBottom,
68
68
  borderStart: shorthands.borderInlineStart,
69
+ blockSize: val => [["height", val]],
70
+ inlineSize: val => [["width", val]],
71
+ minBlockSize: val => [["minHeight", val]],
72
+ minInlineSize: val => [["minWidth", val]],
73
+ maxBlockSize: val => [["maxHeight", val]],
74
+ maxInlineSize: val => [["maxWidth", val]],
69
75
  borderHorizontalWidth: value => [["borderInlineWidth", value]],
70
76
  borderHorizontalStyle: value => [["borderInlineStyle", value]],
71
77
  borderHorizontalColor: value => [["borderInlineColor", value]],
@@ -42,6 +42,12 @@ declare const aliases: {
42
42
  borderEnd: $FlowFixMe,
43
43
  borderBlockEnd: $FlowFixMe,
44
44
  borderStart: $FlowFixMe,
45
+ blockSize: (val: TStyleValue) => TReturn,
46
+ inlineSize: (val: TStyleValue) => TReturn,
47
+ minBlockSize: (val: TStyleValue) => TReturn,
48
+ minInlineSize: (val: TStyleValue) => TReturn,
49
+ maxBlockSize: (val: TStyleValue) => TReturn,
50
+ maxInlineSize: (val: TStyleValue) => TReturn,
45
51
  borderHorizontalWidth: (value: TStyleValue) => TReturn,
46
52
  borderHorizontalStyle: (value: TStyleValue) => TReturn,
47
53
  borderHorizontalColor: (value: TStyleValue) => TReturn,
@@ -54,7 +54,7 @@ function styleXOverrideVars(themeVars, variables, options) {
54
54
  [themeVars.__themeName__]: overrideClassName
55
55
  }, {
56
56
  [overrideClassName]: {
57
- ltr: `.${overrideClassName}{${cssVariablesOverrideString}${atRulesCss}}`,
57
+ ltr: `.${overrideClassName}{${cssVariablesOverrideString}}${atRulesCss}`,
58
58
  priority: 0.99,
59
59
  rtl: undefined
60
60
  }
@@ -11,3 +11,6 @@
11
11
  */
12
12
  declare function transformValue(key: string, rawValue: string | number): string;
13
13
  export default transformValue;
14
+ export declare function getNumberSuffix(key: string): string;
15
+ export declare const timeUnits: Set<string>;
16
+ export declare const lengthUnits: Set<string>;
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = transformValue;
7
+ exports.getNumberSuffix = getNumberSuffix;
8
+ exports.timeUnits = exports.lengthUnits = void 0;
7
9
  var _normalizeValue = _interopRequireDefault(require("./utils/normalize-value"));
8
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
11
  function transformValue(key, rawValue) {
@@ -30,11 +32,15 @@ function getNumberSuffix(key) {
30
32
  return suffix;
31
33
  }
32
34
  }
33
- const unitlessNumberProperties = new Set(["animationIterationCount", "borderImageOutset", "borderImageSlice", "borderImageWidth", "columnCount", "flex", "flexGrow", "flexPositive", "flexShrink", "flexOrder", "gridRow", "gridColumn", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "tabSize", "widows", "zIndex", "fillOpacity", "floodOpacity", "stopOpacity", "strokeDasharray", "strokeDashoffset", "strokeMiterlimit", "strokeOpacity", "strokeWidth"]);
35
+ const unitlessNumberProperties = new Set(["animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "columnCount", "flex", "flexGrow", "flexPositive", "flexShrink", "flexOrder", "gridRow", "gridColumn", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "tabSize", "widows", "zIndex", "fillOpacity", "floodOpacity", "stopOpacity", "strokeDasharray", "strokeDashoffset", "strokeMiterlimit", "strokeOpacity", "strokeWidth"]);
34
36
  const numberPropertySuffixes = {
35
37
  animationDelay: "ms",
36
38
  animationDuration: "ms",
37
39
  transitionDelay: "ms",
38
40
  transitionDuration: "ms",
39
41
  voiceDuration: "ms"
40
- };
42
+ };
43
+ const timeUnits = new Set(Object.keys(numberPropertySuffixes));
44
+ exports.timeUnits = timeUnits;
45
+ const lengthUnits = new Set(["backgroundPositionX", "backgroundPositionY", "blockSize", "borderBlockEndWidth", "borderBlockStartWidth", "borderBlockWidth", "borderVerticalWidth", "borderVerticalWidth", "borderBottomLeftRadius", "borderBottomRightRadius", "borderBottomWidth", "borderEndEndRadius", "borderEndStartRadius", "borderImageWidth", "borderInlineEndWidth", "borderEndWidth", "borderInlineStartWidth", "borderStartWidth", "borderInlineWidth", "borderHorizontalWidth", "borderLeftWidth", "borderRightWidth", "borderSpacing", "borderStartEndRadius", "borderStartStartRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderTopWidth", "bottom", "columnGap", "columnRuleWidth", "columnWidth", "containIntrinsicBlockSize", "containIntrinsicHeight", "containIntrinsicInlineSize", "containIntrinsicWidth", "flexBasis", "fontSize", "fontSmooth", "height", "inlineSize", "insetBlockEnd", "insetBlockStart", "insetInlineEnd", "insetInlineStart", "left", "letterSpacing", "marginBlockEnd", "marginBlockStart", "marginBottom", "marginInlineEnd", "marginEnd", "marginInlineStart", "marginStart", "marginLeft", "marginRight", "marginTop", "maskBorderOutset", "maskBorderWidth", "maxBlockSize", "maxHeight", "maxInlineSize", "maxWidth", "minBlockSize", "minHeight", "minInlineSize", "minWidth", "offsetDistance", "outlineOffset", "outlineWidth", "overflowClipMargin", "paddingBlockEnd", "paddingBlockStart", "paddingBottom", "paddingInlineEnd", "paddingEnd", "paddingInlineStart", "paddingStart", "paddingLeft", "paddingRight", "paddingTop", "perspective", "right", "rowGap", "scrollMarginBlockEnd", "scrollMarginBlockStart", "scrollMarginBottom", "scrollMarginInlineEnd", "scrollMarginInlineStart", "scrollMarginLeft", "scrollMarginRight", "scrollMarginTop", "scrollPaddingBlockEnd", "scrollPaddingBlockStart", "scrollPaddingBottom", "scrollPaddingInlineEnd", "scrollPaddingInlineStart", "scrollPaddingLeft", "scrollPaddingRight", "scrollPaddingTop", "scrollSnapMarginBottom", "scrollSnapMarginLeft", "scrollSnapMarginRight", "scrollSnapMarginTop", "shapeMargin", "tabSize", "textDecorationThickness", "textIndent", "textUnderlineOffset", "top", "transformOrigin", "translate", "verticalAlign", "width", "wordSpacing", "border", "borderBlock", "borderBlockEnd", "borderBlockStart", "borderBottom", "borderLeft", "borderRadius", "borderRight", "borderTop", "borderWidth", "columnRule", "containIntrinsicSize", "gap", "inset", "insetBlock", "insetInline", "margin", "marginBlock", "marginVertical", "marginInline", "marginHorizontal", "offset", "outline", "padding", "paddingBlock", "paddingVertical", "paddingInline", "paddingHorizontal", "scrollMargin", "scrollMarginBlock", "scrollMarginInline", "scrollPadding", "scrollPaddingBlock", "scrollPaddingInline", "scrollSnapMargin"]);
46
+ exports.lengthUnits = lengthUnits;
@@ -13,3 +13,9 @@ declare export default function transformValue(
13
13
  key: string,
14
14
  rawValue: string | number,
15
15
  ): string;
16
+
17
+ declare export function getNumberSuffix(key: string): string;
18
+
19
+ declare export const timeUnits: Set<string>;
20
+
21
+ declare export const lengthUnits: Set<string>;
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ type ValueWithDefault<T> =
11
+ | T
12
+ | Readonly<{
13
+ readonly default: T;
14
+ readonly [$$Key$$: string]: ValueWithDefault<T>;
15
+ }>;
16
+ type CSSSyntax =
17
+ | '*'
18
+ | '<length>'
19
+ | '<number>'
20
+ | '<percentage>'
21
+ | '<length-percentage>'
22
+ | '<color>'
23
+ | '<image>'
24
+ | '<url>'
25
+ | '<integer>'
26
+ | '<angle>'
27
+ | '<time>'
28
+ | '<resolution>'
29
+ | '<transform-function>'
30
+ | '<custom-ident>'
31
+ | '<transform-list>';
32
+ type CSSSyntaxType = CSSSyntax | ReadonlyArray<CSSSyntax>;
33
+ export declare class CSSType {}
34
+ export interface ICSSType<T extends string | number> {
35
+ readonly value: ValueWithDefault<T>;
36
+ readonly syntax: CSSSyntaxType;
37
+ }
38
+ type AnguleValue = string;
39
+ export declare class Angle<T extends AnguleValue>
40
+ extends CSSType
41
+ implements ICSSType<T>
42
+ {
43
+ readonly value: ValueWithDefault<T>;
44
+ readonly syntax: CSSSyntaxType;
45
+ static readonly syntax: CSSSyntaxType;
46
+ constructor(value: ValueWithDefault<T>);
47
+ static create<T extends AnguleValue = AnguleValue>(
48
+ value: ValueWithDefault<T>,
49
+ ): Angle<T>;
50
+ }
51
+ export declare const angle: any;
52
+ type ColorValue = string;
53
+ export declare class Color<T extends ColorValue>
54
+ extends CSSType
55
+ implements ICSSType<T>
56
+ {
57
+ readonly value: ValueWithDefault<T>;
58
+ readonly syntax: CSSSyntaxType;
59
+ constructor(value: ValueWithDefault<T>);
60
+ static create<T extends ColorValue = ColorValue>(
61
+ value: ValueWithDefault<T>,
62
+ ): Color<T>;
63
+ }
64
+ export declare const color: any;
65
+ type URLValue = string;
66
+ export declare class Url<T extends URLValue>
67
+ extends CSSType
68
+ implements ICSSType<T>
69
+ {
70
+ readonly value: ValueWithDefault<T>;
71
+ readonly syntax: CSSSyntaxType;
72
+ constructor(value: ValueWithDefault<T>);
73
+ static create<T extends URLValue = URLValue>(
74
+ value: ValueWithDefault<T>,
75
+ ): Url<T>;
76
+ }
77
+ export declare const url: any;
78
+ type ImageValue = string;
79
+ export declare class Image<T extends ImageValue>
80
+ extends Url<T>
81
+ implements ICSSType<T>
82
+ {
83
+ readonly value: ValueWithDefault<T>;
84
+ readonly syntax: CSSSyntaxType;
85
+ constructor(value: ValueWithDefault<T>);
86
+ static create<T extends ImageValue = ImageValue>(
87
+ value: ValueWithDefault<T>,
88
+ ): Image<T>;
89
+ }
90
+ export declare const image: any;
91
+ type IntegerValue = number;
92
+ export declare class Integer<T extends IntegerValue>
93
+ extends CSSType
94
+ implements ICSSType<T>
95
+ {
96
+ readonly value: ValueWithDefault<T>;
97
+ readonly syntax: CSSSyntaxType;
98
+ constructor(value: ValueWithDefault<T>);
99
+ static create<T extends IntegerValue = IntegerValue>(value: T): Integer<T>;
100
+ }
101
+ export declare const integer: any;
102
+ type LengthPercentageValue = string;
103
+ export declare class LengthPercentage<T extends LengthPercentageValue>
104
+ extends CSSType
105
+ implements ICSSType<string>
106
+ {
107
+ readonly value: ValueWithDefault<T>;
108
+ readonly syntax: CSSSyntaxType;
109
+ constructor(value: ValueWithDefault<T>);
110
+ static createLength<T extends LengthPercentageValue | number>(
111
+ value: ValueWithDefault<T>,
112
+ ): LengthPercentage<string>;
113
+ static createPercentage<T extends LengthPercentageValue | number>(
114
+ value: ValueWithDefault<T>,
115
+ ): LengthPercentage<string>;
116
+ }
117
+ export declare const lengthPercentage: any;
118
+ type LengthValue = number | string;
119
+ export declare class Length<T extends LengthValue>
120
+ extends LengthPercentage<string>
121
+ implements ICSSType<string>
122
+ {
123
+ readonly value: ValueWithDefault<string>;
124
+ readonly syntax: CSSSyntaxType;
125
+ constructor(value: ValueWithDefault<T>);
126
+ static create<T extends LengthValue = LengthValue>(
127
+ value: ValueWithDefault<T>,
128
+ ): Length<T>;
129
+ }
130
+ export declare const length: any;
131
+ type PercentageValue = string | number;
132
+ export declare class Percentage<T extends PercentageValue>
133
+ extends LengthPercentage<string>
134
+ implements ICSSType<string>
135
+ {
136
+ readonly value: ValueWithDefault<string>;
137
+ readonly syntax: CSSSyntaxType;
138
+ constructor(value: ValueWithDefault<T>);
139
+ static create<T extends PercentageValue = PercentageValue>(
140
+ value: ValueWithDefault<T>,
141
+ ): Percentage<T>;
142
+ }
143
+ export declare const percentage: any;
144
+ type NumberValue = number;
145
+ export declare class Num<T extends NumberValue>
146
+ extends CSSType
147
+ implements ICSSType<T>
148
+ {
149
+ readonly value: ValueWithDefault<T>;
150
+ readonly syntax: CSSSyntaxType;
151
+ constructor(value: ValueWithDefault<T>);
152
+ static create<T extends NumberValue = NumberValue>(
153
+ value: ValueWithDefault<T>,
154
+ ): Num<T>;
155
+ }
156
+ export declare const number: any;
157
+ type ResolutionValue = string | 0;
158
+ export declare class Resolution<T extends ResolutionValue>
159
+ extends CSSType
160
+ implements ICSSType<T>
161
+ {
162
+ readonly value: ValueWithDefault<T>;
163
+ readonly syntax: CSSSyntaxType;
164
+ constructor(value: ValueWithDefault<T>);
165
+ static create<T extends ResolutionValue = ResolutionValue>(
166
+ value: ValueWithDefault<T>,
167
+ ): Resolution<T>;
168
+ }
169
+ export declare const resolution: any;
170
+ type TimeValue = string | 0;
171
+ export declare class Time<T extends TimeValue>
172
+ extends CSSType
173
+ implements ICSSType<T>
174
+ {
175
+ readonly value: ValueWithDefault<T>;
176
+ readonly syntax: CSSSyntaxType;
177
+ constructor(value: ValueWithDefault<T>);
178
+ static create<T extends TimeValue = TimeValue>(
179
+ value: ValueWithDefault<T>,
180
+ ): Time<T>;
181
+ }
182
+ export declare const time: any;
183
+ type TransformFunctionValue = string;
184
+ export declare class TransformFunction<T extends TransformFunctionValue>
185
+ extends CSSType
186
+ implements ICSSType<T>
187
+ {
188
+ readonly value: ValueWithDefault<T>;
189
+ readonly syntax: CSSSyntaxType;
190
+ constructor(value: ValueWithDefault<T>);
191
+ static create<T extends TransformFunctionValue = TransformFunctionValue>(
192
+ value: ValueWithDefault<T>,
193
+ ): TransformFunction<T>;
194
+ }
195
+ export declare const transformFunction: any;
196
+ type TransformListValue = string;
197
+ export declare class TransformList<T extends TransformListValue>
198
+ extends CSSType
199
+ implements ICSSType<T>
200
+ {
201
+ readonly value: ValueWithDefault<T>;
202
+ readonly syntax: CSSSyntaxType;
203
+ constructor(value: ValueWithDefault<T>);
204
+ static create<T extends TransformListValue = TransformListValue>(
205
+ value: ValueWithDefault<T>,
206
+ ): TransformList<T>;
207
+ }
208
+ export declare const transformList: any;
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.url = exports.transformList = exports.transformFunction = exports.time = exports.resolution = exports.percentage = exports.number = exports.lengthPercentage = exports.length = exports.integer = exports.image = exports.color = exports.angle = exports.Url = exports.TransformList = exports.TransformFunction = exports.Time = exports.Resolution = exports.Percentage = exports.Num = exports.LengthPercentage = exports.Length = exports.Integer = exports.Image = exports.Color = exports.CSSType = exports.Angle = void 0;
7
+ class CSSType {}
8
+ exports.CSSType = CSSType;
9
+ class Angle extends CSSType {
10
+ syntax = "<angle>";
11
+ static syntax = "<angle>";
12
+ constructor(value) {
13
+ super();
14
+ this.value = value;
15
+ }
16
+ static create(value) {
17
+ return new Angle(value);
18
+ }
19
+ }
20
+ exports.Angle = Angle;
21
+ const angle = Angle.create;
22
+ exports.angle = angle;
23
+ class Color extends CSSType {
24
+ syntax = "<color>";
25
+ constructor(value) {
26
+ super();
27
+ this.value = value;
28
+ }
29
+ static create(value) {
30
+ return new Color(value);
31
+ }
32
+ }
33
+ exports.Color = Color;
34
+ const color = Color.create;
35
+ exports.color = color;
36
+ class Url extends CSSType {
37
+ syntax = "<url>";
38
+ constructor(value) {
39
+ super();
40
+ this.value = value;
41
+ }
42
+ static create(value) {
43
+ return new Url(value);
44
+ }
45
+ }
46
+ exports.Url = Url;
47
+ const url = Url.create;
48
+ exports.url = url;
49
+ class Image extends Url {
50
+ syntax = "<image>";
51
+ constructor(value) {
52
+ super(value);
53
+ this.value = value;
54
+ }
55
+ static create(value) {
56
+ return new Image(value);
57
+ }
58
+ }
59
+ exports.Image = Image;
60
+ const image = Image.create;
61
+ exports.image = image;
62
+ class Integer extends CSSType {
63
+ syntax = "<integer>";
64
+ constructor(value) {
65
+ super();
66
+ this.value = value;
67
+ }
68
+ static create(value) {
69
+ return new Integer(value);
70
+ }
71
+ }
72
+ exports.Integer = Integer;
73
+ const integer = Integer.create;
74
+ exports.integer = integer;
75
+ class LengthPercentage extends CSSType {
76
+ syntax = "<length-percentage>";
77
+ constructor(value) {
78
+ super();
79
+ this.value = value;
80
+ }
81
+ static createLength(value) {
82
+ return new LengthPercentage(convertNumberToLength(value));
83
+ }
84
+ static createPercentage(value) {
85
+ return new LengthPercentage(convertNumberToPercentage(value));
86
+ }
87
+ }
88
+ exports.LengthPercentage = LengthPercentage;
89
+ const lengthPercentage = LengthPercentage.createLength;
90
+ exports.lengthPercentage = lengthPercentage;
91
+ class Length extends LengthPercentage {
92
+ syntax = "<length>";
93
+ constructor(value) {
94
+ super(convertNumberToLength(value));
95
+ }
96
+ static create(value) {
97
+ return new Length(value);
98
+ }
99
+ }
100
+ exports.Length = Length;
101
+ const length = Length.create;
102
+ exports.length = length;
103
+ class Percentage extends LengthPercentage {
104
+ syntax = "<percentage>";
105
+ constructor(value) {
106
+ super(convertNumberToPercentage(value));
107
+ }
108
+ static create(value) {
109
+ return new Percentage(value);
110
+ }
111
+ }
112
+ exports.Percentage = Percentage;
113
+ const percentage = Percentage.create;
114
+ exports.percentage = percentage;
115
+ class Num extends CSSType {
116
+ syntax = "<number>";
117
+ constructor(value) {
118
+ super();
119
+ this.value = value;
120
+ }
121
+ static create(value) {
122
+ return new Num(value);
123
+ }
124
+ }
125
+ exports.Num = Num;
126
+ const number = Num.create;
127
+ exports.number = number;
128
+ class Resolution extends CSSType {
129
+ syntax = "<resolution>";
130
+ constructor(value) {
131
+ super();
132
+ this.value = value;
133
+ }
134
+ static create(value) {
135
+ return new Resolution(value);
136
+ }
137
+ }
138
+ exports.Resolution = Resolution;
139
+ const resolution = Resolution.create;
140
+ exports.resolution = resolution;
141
+ class Time extends CSSType {
142
+ syntax = "<time>";
143
+ constructor(value) {
144
+ super();
145
+ this.value = value;
146
+ }
147
+ static create(value) {
148
+ return new Time(value);
149
+ }
150
+ }
151
+ exports.Time = Time;
152
+ const time = Time.create;
153
+ exports.time = time;
154
+ class TransformFunction extends CSSType {
155
+ syntax = "<transform-function>";
156
+ constructor(value) {
157
+ super();
158
+ this.value = value;
159
+ }
160
+ static create(value) {
161
+ return new TransformFunction(value);
162
+ }
163
+ }
164
+ exports.TransformFunction = TransformFunction;
165
+ const transformFunction = TransformFunction.create;
166
+ exports.transformFunction = transformFunction;
167
+ class TransformList extends CSSType {
168
+ syntax = "<transform-list>";
169
+ constructor(value) {
170
+ super();
171
+ this.value = value;
172
+ }
173
+ static create(value) {
174
+ return new TransformList(value);
175
+ }
176
+ }
177
+ exports.TransformList = TransformList;
178
+ const transformList = TransformList.create;
179
+ exports.transformList = transformList;
180
+ const convertNumberToStringUsing = (transformNumber, defaultStr) => value => {
181
+ if (typeof value === "number") {
182
+ return transformNumber(value);
183
+ }
184
+ if (typeof value === "string") {
185
+ return value;
186
+ }
187
+ if (typeof value === "object") {
188
+ const {
189
+ default: defaultValue,
190
+ ...rest
191
+ } = value;
192
+ const defaultResult = convertNumberToLength(defaultValue);
193
+ const result = {
194
+ default: typeof defaultResult === "string" ? defaultResult : defaultStr
195
+ };
196
+ for (const [key, value] of Object.entries(rest)) {
197
+ result[key] = convertNumberToLength(value);
198
+ }
199
+ return result;
200
+ }
201
+ return value;
202
+ };
203
+ const convertNumberToLength = convertNumberToStringUsing(value => value === 0 ? "0" : `${value}px`, "0px");
204
+ const convertNumberToPercentage = convertNumberToStringUsing(value => value === 0 ? "0" : `${value * 100}%`, "0");
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ // import type { Color as ColorType } from './stylex-types-color';
11
+
12
+ // We want all in one file?
13
+ // option 1, creat interface an implement it in the class
14
+ // why? All the types have a single base definition of props
15
+ // We want on type that defines CSS Types
16
+ // Option 2: Do a union type and make
17
+
18
+ // interface ICSSType {
19
+ // toString(): string;
20
+ // }
21
+
22
+ type ValueWithDefault<+T> =
23
+ | T
24
+ | $ReadOnly<{
25
+ +default: T,
26
+ +[string]: ValueWithDefault<T>,
27
+ }>;
28
+
29
+ type CSSSyntax =
30
+ | '*'
31
+ | '<length>'
32
+ | '<number>'
33
+ | '<percentage>'
34
+ | '<length-percentage>'
35
+ | '<color>'
36
+ | '<image>'
37
+ | '<url>'
38
+ | '<integer>'
39
+ | '<angle>'
40
+ | '<time>'
41
+ | '<resolution>'
42
+ | '<transform-function>'
43
+ | '<custom-ident>'
44
+ | '<transform-list>';
45
+
46
+ type CSSSyntaxType = CSSSyntax | $ReadOnlyArray<CSSSyntax>;
47
+
48
+ declare export class CSSType {}
49
+
50
+ export interface ICSSType<+T: string | number> {
51
+ +value: ValueWithDefault<T>;
52
+ +syntax: CSSSyntaxType;
53
+ }
54
+
55
+ type AnguleValue = string;
56
+ declare export class Angle<+T: AnguleValue>
57
+ extends CSSType
58
+ implements ICSSType<T>
59
+ {
60
+ +value: ValueWithDefault<T>;
61
+ +syntax: CSSSyntaxType;
62
+ static +syntax: CSSSyntaxType;
63
+ constructor(value: ValueWithDefault<T>): void;
64
+ static create<T: AnguleValue = AnguleValue>(
65
+ value: ValueWithDefault<T>,
66
+ ): Angle<T>;
67
+ }
68
+ declare export const angle: $FlowFixMe;
69
+
70
+ type ColorValue = string;
71
+ declare export class Color<+T: ColorValue>
72
+ extends CSSType
73
+ implements ICSSType<T>
74
+ {
75
+ +value: ValueWithDefault<T>;
76
+ +syntax: CSSSyntaxType;
77
+ constructor(value: ValueWithDefault<T>): void;
78
+ static create<T: ColorValue = ColorValue>(
79
+ value: ValueWithDefault<T>,
80
+ ): Color<T>;
81
+ }
82
+ declare export const color: $FlowFixMe;
83
+
84
+ type URLValue = string;
85
+
86
+ declare export class Url<+T: URLValue> extends CSSType implements ICSSType<T> {
87
+ +value: ValueWithDefault<T>;
88
+ +syntax: CSSSyntaxType;
89
+ constructor(value: ValueWithDefault<T>): void;
90
+ static create<T: URLValue = URLValue>(value: ValueWithDefault<T>): Url<T>;
91
+ }
92
+ declare export const url: $FlowFixMe;
93
+
94
+ type ImageValue = string;
95
+
96
+ declare export class Image<+T: ImageValue>
97
+ extends Url<T>
98
+ implements ICSSType<T>
99
+ {
100
+ +value: ValueWithDefault<T>;
101
+ +syntax: CSSSyntaxType;
102
+ constructor(value: ValueWithDefault<T>): void;
103
+ static create<T: ImageValue = ImageValue>(
104
+ value: ValueWithDefault<T>,
105
+ ): Image<T>;
106
+ }
107
+ declare export const image: $FlowFixMe;
108
+
109
+ type IntegerValue = number;
110
+
111
+ declare export class Integer<+T: IntegerValue>
112
+ extends CSSType
113
+ implements ICSSType<T>
114
+ {
115
+ +value: ValueWithDefault<T>;
116
+ +syntax: CSSSyntaxType;
117
+ constructor(value: ValueWithDefault<T>): void;
118
+ static create<T: IntegerValue = IntegerValue>(value: T): Integer<T>;
119
+ }
120
+ declare export const integer: $FlowFixMe;
121
+
122
+ type LengthPercentageValue = string;
123
+
124
+ declare export class LengthPercentage<+T: LengthPercentageValue>
125
+ extends CSSType
126
+ implements ICSSType<string>
127
+ {
128
+ +value: ValueWithDefault<T>;
129
+ +syntax: CSSSyntaxType;
130
+ constructor(value: ValueWithDefault<T>): void;
131
+ static createLength<T: LengthPercentageValue | number>(
132
+ value: ValueWithDefault<T>,
133
+ ): LengthPercentage<string>;
134
+ static createPercentage<T: LengthPercentageValue | number>(
135
+ value: ValueWithDefault<T>,
136
+ ): LengthPercentage<string>;
137
+ }
138
+ declare export const lengthPercentage: $FlowFixMe;
139
+
140
+ type LengthValue = number | string;
141
+
142
+ declare export class Length<+T: LengthValue>
143
+ extends LengthPercentage<string>
144
+ implements ICSSType<string>
145
+ {
146
+ +value: ValueWithDefault<string>;
147
+ +syntax: CSSSyntaxType;
148
+ constructor(value: ValueWithDefault<T>): void;
149
+ static create<T: LengthValue = LengthValue>(
150
+ value: ValueWithDefault<T>,
151
+ ): Length<T>;
152
+ }
153
+ declare export const length: $FlowFixMe;
154
+
155
+ type PercentageValue = string | number;
156
+
157
+ declare export class Percentage<+T: PercentageValue>
158
+ extends LengthPercentage<string>
159
+ implements ICSSType<string>
160
+ {
161
+ +value: ValueWithDefault<string>;
162
+ +syntax: CSSSyntaxType;
163
+ constructor(value: ValueWithDefault<T>): void;
164
+ static create<T: PercentageValue = PercentageValue>(
165
+ value: ValueWithDefault<T>,
166
+ ): Percentage<T>;
167
+ }
168
+ declare export const percentage: $FlowFixMe;
169
+
170
+ type NumberValue = number;
171
+
172
+ declare export class Num<+T: NumberValue>
173
+ extends CSSType
174
+ implements ICSSType<T>
175
+ {
176
+ +value: ValueWithDefault<T>;
177
+ +syntax: CSSSyntaxType;
178
+ constructor(value: ValueWithDefault<T>): void;
179
+ static create<T: NumberValue = NumberValue>(
180
+ value: ValueWithDefault<T>,
181
+ ): Num<T>;
182
+ }
183
+ declare export const number: $FlowFixMe;
184
+
185
+ type ResolutionValue = string | 0;
186
+
187
+ declare export class Resolution<+T: ResolutionValue>
188
+ extends CSSType
189
+ implements ICSSType<T>
190
+ {
191
+ +value: ValueWithDefault<T>;
192
+ +syntax: CSSSyntaxType;
193
+ constructor(value: ValueWithDefault<T>): void;
194
+ static create<T: ResolutionValue = ResolutionValue>(
195
+ value: ValueWithDefault<T>,
196
+ ): Resolution<T>;
197
+ }
198
+ declare export const resolution: $FlowFixMe;
199
+
200
+ type TimeValue = string | 0;
201
+
202
+ declare export class Time<+T: TimeValue>
203
+ extends CSSType
204
+ implements ICSSType<T>
205
+ {
206
+ +value: ValueWithDefault<T>;
207
+ +syntax: CSSSyntaxType;
208
+ constructor(value: ValueWithDefault<T>): void;
209
+ static create<T: TimeValue = TimeValue>(value: ValueWithDefault<T>): Time<T>;
210
+ }
211
+ declare export const time: $FlowFixMe;
212
+
213
+ type TransformFunctionValue = string;
214
+
215
+ declare export class TransformFunction<+T: TransformFunctionValue>
216
+ extends CSSType
217
+ implements ICSSType<T>
218
+ {
219
+ +value: ValueWithDefault<T>;
220
+ +syntax: CSSSyntaxType;
221
+ constructor(value: ValueWithDefault<T>): void;
222
+ static create<T: TransformFunctionValue = TransformFunctionValue>(
223
+ value: ValueWithDefault<T>,
224
+ ): TransformFunction<T>;
225
+ }
226
+ declare export const transformFunction: $FlowFixMe;
227
+
228
+ type TransformListValue = string;
229
+
230
+ declare export class TransformList<T: TransformListValue>
231
+ extends CSSType
232
+ implements ICSSType<T>
233
+ {
234
+ +value: ValueWithDefault<T>;
235
+ +syntax: CSSSyntaxType;
236
+ constructor(value: ValueWithDefault<T>): void;
237
+ static create<T: TransformListValue = TransformListValue>(
238
+ value: ValueWithDefault<T>,
239
+ ): TransformList<T>;
240
+ }
241
+ declare export const transformList: $FlowFixMe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/shared",
3
- "version": "0.2.0-beta.18",
3
+ "version": "0.2.0-beta.20",
4
4
  "main": "lib/index.js",
5
5
  "repository": "https://www.github.com/facebook/stylex",
6
6
  "license": "MIT",
@@ -13,12 +13,13 @@
13
13
  "postcss-value-parser": "^4.1.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@stylexjs/scripts": "0.2.0-beta.18"
16
+ "@stylexjs/scripts": "0.2.0-beta.20"
17
17
  },
18
18
  "jest": {
19
19
  "snapshotFormat": {
20
20
  "printBasicPrototype": false
21
- }
21
+ },
22
+ "prettierPath": null
22
23
  },
23
24
  "files": [
24
25
  "lib/*"