@stylexjs/stylex 0.12.0 → 0.13.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/lib/{stylex-inject.d.ts → cjs/inject.d.ts} +1 -5
- package/lib/cjs/inject.js +210 -0
- package/lib/{stylex-inject.js.flow → cjs/inject.js.flow} +2 -3
- package/lib/cjs/stylesheet/createCSSStyleSheet.d.ts +13 -0
- package/lib/cjs/stylesheet/createCSSStyleSheet.js.flow +13 -0
- package/lib/cjs/stylesheet/createOrderedCSSStyleSheet.d.ts +31 -0
- package/lib/cjs/stylesheet/createOrderedCSSStyleSheet.js.flow +32 -0
- package/lib/cjs/stylesheet/createSheet.d.ts +12 -0
- package/lib/cjs/stylesheet/createSheet.js.flow +16 -0
- package/lib/cjs/stylesheet/utils.d.ts +18 -0
- package/lib/cjs/stylesheet/utils.js.flow +19 -0
- package/lib/{stylex.d.ts → cjs/stylex.d.ts} +8 -21
- package/lib/cjs/stylex.js +242 -0
- package/lib/{stylex.js.flow → cjs/stylex.js.flow} +10 -26
- package/lib/{StyleXCSSTypes.d.ts → cjs/types/StyleXCSSTypes.d.ts} +22 -0
- package/lib/{StyleXCSSTypes.js.flow → cjs/types/StyleXCSSTypes.js.flow} +25 -0
- package/lib/{StyleXTypes.d.ts → cjs/types/StyleXTypes.d.ts} +60 -5
- package/lib/{StyleXTypes.js.flow → cjs/types/StyleXTypes.js.flow} +54 -3
- package/lib/{VarTypes.d.ts → cjs/types/VarTypes.d.ts} +19 -18
- package/lib/{VarTypes.js.flow → cjs/types/VarTypes.js.flow} +17 -19
- package/lib/es/inject.d.ts +11 -0
- package/lib/es/inject.js.flow +13 -0
- package/lib/es/inject.mjs +208 -0
- package/lib/es/stylesheet/createCSSStyleSheet.d.ts +13 -0
- package/lib/es/stylesheet/createCSSStyleSheet.js.flow +13 -0
- package/lib/es/stylesheet/createOrderedCSSStyleSheet.d.ts +31 -0
- package/lib/es/stylesheet/createOrderedCSSStyleSheet.js.flow +32 -0
- package/lib/es/stylesheet/createSheet.d.ts +12 -0
- package/lib/es/stylesheet/createSheet.js.flow +16 -0
- package/lib/es/stylesheet/utils.d.ts +18 -0
- package/lib/es/stylesheet/utils.js.flow +19 -0
- package/lib/es/stylex.d.ts +135 -0
- package/lib/es/stylex.js.flow +134 -0
- package/lib/es/stylex.mjs +8 -20
- package/lib/es/types/StyleXCSSTypes.d.ts +1487 -0
- package/lib/es/types/StyleXCSSTypes.js.flow +1580 -0
- package/lib/es/types/StyleXOpaqueTypes.d.ts +11 -0
- package/lib/es/types/StyleXOpaqueTypes.js.flow +16 -0
- package/lib/es/types/StyleXTypes.d.ts +292 -0
- package/lib/es/types/StyleXTypes.js.flow +240 -0
- package/lib/es/types/StyleXUtils.d.ts +15 -0
- package/lib/es/types/StyleXUtils.js.flow +15 -0
- package/lib/es/types/VarTypes.d.ts +104 -0
- package/lib/es/types/VarTypes.js.flow +102 -0
- package/package.json +15 -26
- package/lib/StyleXCSSTypes.js +0 -1
- package/lib/StyleXOpaqueTypes.js +0 -1
- package/lib/StyleXSheet.d.ts +0 -49
- package/lib/StyleXSheet.js +0 -188
- package/lib/StyleXSheet.js.flow +0 -49
- package/lib/StyleXTypes.js +0 -1
- package/lib/VarTypes.js +0 -1
- package/lib/es/StyleXCSSTypes.mjs +0 -1
- package/lib/es/StyleXOpaqueTypes.mjs +0 -0
- package/lib/es/StyleXSheet.mjs +0 -247
- package/lib/es/StyleXTypes.mjs +0 -1
- package/lib/es/VarTypes.mjs +0 -0
- package/lib/es/stylex-inject.mjs +0 -5
- package/lib/es/util-types.mjs +0 -0
- package/lib/stylex-inject.js +0 -11
- package/lib/stylex.js +0 -125
- package/lib/util-types.js +0 -1
- /package/lib/{StyleXOpaqueTypes.d.ts → cjs/types/StyleXOpaqueTypes.d.ts} +0 -0
- /package/lib/{StyleXOpaqueTypes.js.flow → cjs/types/StyleXOpaqueTypes.js.flow} +0 -0
- /package/lib/{util-types.d.ts → cjs/types/StyleXUtils.d.ts} +0 -0
- /package/lib/{util-types.js.flow → cjs/types/StyleXUtils.js.flow} +0 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var styleq = {};
|
|
4
|
+
|
|
5
|
+
var hasRequiredStyleq;
|
|
6
|
+
|
|
7
|
+
function requireStyleq () {
|
|
8
|
+
if (hasRequiredStyleq) return styleq;
|
|
9
|
+
hasRequiredStyleq = 1;
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(styleq, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
styleq.styleq = void 0;
|
|
15
|
+
var cache = new WeakMap();
|
|
16
|
+
var compiledKey = '$$css';
|
|
17
|
+
function createStyleq(options) {
|
|
18
|
+
var disableCache;
|
|
19
|
+
var disableMix;
|
|
20
|
+
var transform;
|
|
21
|
+
if (options != null) {
|
|
22
|
+
disableCache = options.disableCache === true;
|
|
23
|
+
disableMix = options.disableMix === true;
|
|
24
|
+
transform = options.transform;
|
|
25
|
+
}
|
|
26
|
+
return function styleq() {
|
|
27
|
+
var definedProperties = [];
|
|
28
|
+
var className = '';
|
|
29
|
+
var inlineStyle = null;
|
|
30
|
+
var debugString = '';
|
|
31
|
+
var nextCache = disableCache ? null : cache;
|
|
32
|
+
var styles = new Array(arguments.length);
|
|
33
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
34
|
+
styles[i] = arguments[i];
|
|
35
|
+
}
|
|
36
|
+
while (styles.length > 0) {
|
|
37
|
+
var possibleStyle = styles.pop();
|
|
38
|
+
if (possibleStyle == null || possibleStyle === false) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(possibleStyle)) {
|
|
42
|
+
for (var _i = 0; _i < possibleStyle.length; _i++) {
|
|
43
|
+
styles.push(possibleStyle[_i]);
|
|
44
|
+
}
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
var style = transform != null ? transform(possibleStyle) : possibleStyle;
|
|
48
|
+
if (style.$$css != null) {
|
|
49
|
+
var classNameChunk = '';
|
|
50
|
+
if (nextCache != null && nextCache.has(style)) {
|
|
51
|
+
var cacheEntry = nextCache.get(style);
|
|
52
|
+
if (cacheEntry != null) {
|
|
53
|
+
classNameChunk = cacheEntry[0];
|
|
54
|
+
debugString = cacheEntry[2];
|
|
55
|
+
definedProperties.push.apply(definedProperties, cacheEntry[1]);
|
|
56
|
+
nextCache = cacheEntry[3];
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
var definedPropertiesChunk = [];
|
|
60
|
+
for (var prop in style) {
|
|
61
|
+
var value = style[prop];
|
|
62
|
+
if (prop === compiledKey) {
|
|
63
|
+
var compiledKeyValue = style[prop];
|
|
64
|
+
if (compiledKeyValue !== true) {
|
|
65
|
+
debugString = debugString ? compiledKeyValue + '; ' + debugString : compiledKeyValue;
|
|
66
|
+
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (typeof value === 'string' || value === null) {
|
|
70
|
+
if (!definedProperties.includes(prop)) {
|
|
71
|
+
definedProperties.push(prop);
|
|
72
|
+
if (nextCache != null) {
|
|
73
|
+
definedPropertiesChunk.push(prop);
|
|
74
|
+
}
|
|
75
|
+
if (typeof value === 'string') {
|
|
76
|
+
classNameChunk += classNameChunk ? ' ' + value : value;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
console.error("styleq: ".concat(prop, " typeof ").concat(String(value), " is not \"string\" or \"null\"."));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (nextCache != null) {
|
|
84
|
+
var weakMap = new WeakMap();
|
|
85
|
+
nextCache.set(style, [classNameChunk, definedPropertiesChunk, debugString, weakMap]);
|
|
86
|
+
nextCache = weakMap;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (classNameChunk) {
|
|
90
|
+
className = className ? classNameChunk + ' ' + className : classNameChunk;
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (disableMix) {
|
|
94
|
+
if (inlineStyle == null) {
|
|
95
|
+
inlineStyle = {};
|
|
96
|
+
}
|
|
97
|
+
inlineStyle = Object.assign({}, style, inlineStyle);
|
|
98
|
+
} else {
|
|
99
|
+
var subStyle = null;
|
|
100
|
+
for (var _prop in style) {
|
|
101
|
+
var _value = style[_prop];
|
|
102
|
+
if (_value !== undefined) {
|
|
103
|
+
if (!definedProperties.includes(_prop)) {
|
|
104
|
+
if (_value != null) {
|
|
105
|
+
if (inlineStyle == null) {
|
|
106
|
+
inlineStyle = {};
|
|
107
|
+
}
|
|
108
|
+
if (subStyle == null) {
|
|
109
|
+
subStyle = {};
|
|
110
|
+
}
|
|
111
|
+
subStyle[_prop] = _value;
|
|
112
|
+
}
|
|
113
|
+
definedProperties.push(_prop);
|
|
114
|
+
nextCache = null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (subStyle != null) {
|
|
119
|
+
inlineStyle = Object.assign(subStyle, inlineStyle);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
var styleProps = [className, inlineStyle, debugString];
|
|
125
|
+
return styleProps;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
var styleq$1 = styleq.styleq = createStyleq();
|
|
129
|
+
styleq$1.factory = createStyleq;
|
|
130
|
+
return styleq;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var styleqExports = /*@__PURE__*/ requireStyleq();
|
|
134
|
+
|
|
135
|
+
const errorForFn = name => new Error(`Unexpected 'stylex.${name}' call at runtime. Styles must be compiled by '@stylexjs/babel-plugin'.`);
|
|
136
|
+
const errorForType = key => errorForFn(`types.${key}`);
|
|
137
|
+
const create = function stylexCreate(_styles) {
|
|
138
|
+
throw errorForFn('create');
|
|
139
|
+
};
|
|
140
|
+
const createTheme = (_baseTokens, _overrides) => {
|
|
141
|
+
throw errorForFn('createTheme');
|
|
142
|
+
};
|
|
143
|
+
const defineConsts = function stylexDefineConsts(_styles) {
|
|
144
|
+
throw errorForFn('defineConsts');
|
|
145
|
+
};
|
|
146
|
+
const defineVars = function stylexDefineVars(_styles) {
|
|
147
|
+
throw errorForFn('defineVars');
|
|
148
|
+
};
|
|
149
|
+
const firstThatWorks = function () {
|
|
150
|
+
throw errorForFn('firstThatWorks');
|
|
151
|
+
};
|
|
152
|
+
const keyframes = _keyframes => {
|
|
153
|
+
throw errorForFn('keyframes');
|
|
154
|
+
};
|
|
155
|
+
const positionTry = _positionTry => {
|
|
156
|
+
throw errorForFn('positionTry');
|
|
157
|
+
};
|
|
158
|
+
function props() {
|
|
159
|
+
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
160
|
+
styles[_key] = arguments[_key];
|
|
161
|
+
}
|
|
162
|
+
const [className, style, dataStyleSrc] = styleqExports.styleq(styles);
|
|
163
|
+
const result = {};
|
|
164
|
+
if (className != null && className !== '') {
|
|
165
|
+
result.className = className;
|
|
166
|
+
}
|
|
167
|
+
if (style != null && Object.keys(style).length > 0) {
|
|
168
|
+
result.style = style;
|
|
169
|
+
}
|
|
170
|
+
if (dataStyleSrc != null && dataStyleSrc !== '') {
|
|
171
|
+
result['data-style-src'] = dataStyleSrc;
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
const types = {
|
|
176
|
+
angle: _v => {
|
|
177
|
+
throw errorForType('angle');
|
|
178
|
+
},
|
|
179
|
+
color: _v => {
|
|
180
|
+
throw errorForType('color');
|
|
181
|
+
},
|
|
182
|
+
url: _v => {
|
|
183
|
+
throw errorForType('url');
|
|
184
|
+
},
|
|
185
|
+
image: _v => {
|
|
186
|
+
throw errorForType('image');
|
|
187
|
+
},
|
|
188
|
+
integer: _v => {
|
|
189
|
+
throw errorForType('integer');
|
|
190
|
+
},
|
|
191
|
+
lengthPercentage: _v => {
|
|
192
|
+
throw errorForType('lengthPercentage');
|
|
193
|
+
},
|
|
194
|
+
length: _v => {
|
|
195
|
+
throw errorForType('length');
|
|
196
|
+
},
|
|
197
|
+
percentage: _v => {
|
|
198
|
+
throw errorForType('percentage');
|
|
199
|
+
},
|
|
200
|
+
number: _v => {
|
|
201
|
+
throw errorForType('number');
|
|
202
|
+
},
|
|
203
|
+
resolution: _v => {
|
|
204
|
+
throw errorForType('resolution');
|
|
205
|
+
},
|
|
206
|
+
time: _v => {
|
|
207
|
+
throw errorForType('time');
|
|
208
|
+
},
|
|
209
|
+
transformFunction: _v => {
|
|
210
|
+
throw errorForType('transformFunction');
|
|
211
|
+
},
|
|
212
|
+
transformList: _v => {
|
|
213
|
+
throw errorForType('transformList');
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
function _legacyMerge() {
|
|
217
|
+
for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
218
|
+
styles[_key2] = arguments[_key2];
|
|
219
|
+
}
|
|
220
|
+
const [className] = styleqExports.styleq(styles);
|
|
221
|
+
return className;
|
|
222
|
+
}
|
|
223
|
+
_legacyMerge.create = create;
|
|
224
|
+
_legacyMerge.createTheme = createTheme;
|
|
225
|
+
_legacyMerge.defineVars = defineVars;
|
|
226
|
+
_legacyMerge.firstThatWorks = firstThatWorks;
|
|
227
|
+
_legacyMerge.keyframes = keyframes;
|
|
228
|
+
_legacyMerge.positionTry = positionTry;
|
|
229
|
+
_legacyMerge.props = props;
|
|
230
|
+
_legacyMerge.types = types;
|
|
231
|
+
const legacyMerge = _legacyMerge;
|
|
232
|
+
|
|
233
|
+
exports.create = create;
|
|
234
|
+
exports.createTheme = createTheme;
|
|
235
|
+
exports.defineConsts = defineConsts;
|
|
236
|
+
exports.defineVars = defineVars;
|
|
237
|
+
exports.firstThatWorks = firstThatWorks;
|
|
238
|
+
exports.keyframes = keyframes;
|
|
239
|
+
exports.legacyMerge = legacyMerge;
|
|
240
|
+
exports.positionTry = positionTry;
|
|
241
|
+
exports.props = props;
|
|
242
|
+
exports.types = types;
|
|
@@ -16,14 +16,16 @@ import type {
|
|
|
16
16
|
StyleX$Create,
|
|
17
17
|
StyleX$CreateTheme,
|
|
18
18
|
StyleX$DefineVars,
|
|
19
|
+
StyleX$DefineConsts,
|
|
19
20
|
StyleXArray,
|
|
20
21
|
StyleXStyles,
|
|
21
22
|
StyleXStylesWithout,
|
|
22
23
|
Theme,
|
|
23
24
|
VarGroup,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import
|
|
25
|
+
PositionTry,
|
|
26
|
+
} from './types/StyleXTypes';
|
|
27
|
+
import type { ValueWithDefault } from './types/StyleXUtils';
|
|
28
|
+
import * as Types from './types/VarTypes';
|
|
27
29
|
|
|
28
30
|
export type {
|
|
29
31
|
StaticStyles,
|
|
@@ -35,22 +37,12 @@ export type {
|
|
|
35
37
|
VarGroup,
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
declare export function attrs(
|
|
39
|
-
...styles: $ReadOnlyArray<
|
|
40
|
-
StyleXArray<
|
|
41
|
-
?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
|
|
42
|
-
>,
|
|
43
|
-
>
|
|
44
|
-
): $ReadOnly<{
|
|
45
|
-
class?: string,
|
|
46
|
-
'data-style-src'?: string,
|
|
47
|
-
style?: string,
|
|
48
|
-
}>;
|
|
49
|
-
|
|
50
40
|
declare export const create: StyleX$Create;
|
|
51
41
|
|
|
52
42
|
declare export const createTheme: StyleX$CreateTheme;
|
|
53
43
|
|
|
44
|
+
declare export const defineConsts: StyleX$DefineConsts;
|
|
45
|
+
|
|
54
46
|
declare export const defineVars: StyleX$DefineVars;
|
|
55
47
|
|
|
56
48
|
declare export const firstThatWorks: <T: string | number>(
|
|
@@ -59,6 +51,8 @@ declare export const firstThatWorks: <T: string | number>(
|
|
|
59
51
|
|
|
60
52
|
declare export const keyframes: (_keyframes: Keyframes) => string;
|
|
61
53
|
|
|
54
|
+
declare export const positionTry: (_positionTry: PositionTry) => string;
|
|
55
|
+
|
|
62
56
|
declare export function props(
|
|
63
57
|
this: ?mixed,
|
|
64
58
|
...styles: $ReadOnlyArray<
|
|
@@ -112,17 +106,6 @@ declare export const types: {
|
|
|
112
106
|
|
|
113
107
|
type IStyleX = {
|
|
114
108
|
(...styles: $ReadOnlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
|
|
115
|
-
attrs: (
|
|
116
|
-
...styles: $ReadOnlyArray<
|
|
117
|
-
StyleXArray<
|
|
118
|
-
?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
|
|
119
|
-
>,
|
|
120
|
-
>
|
|
121
|
-
) => $ReadOnly<{
|
|
122
|
-
class?: string,
|
|
123
|
-
'data-style-src'?: string,
|
|
124
|
-
style?: string,
|
|
125
|
-
}>,
|
|
126
109
|
create: StyleX$Create,
|
|
127
110
|
createTheme: StyleX$CreateTheme,
|
|
128
111
|
defineVars: StyleX$DefineVars,
|
|
@@ -130,6 +113,7 @@ type IStyleX = {
|
|
|
130
113
|
...v: $ReadOnlyArray<T>
|
|
131
114
|
) => $ReadOnlyArray<T>,
|
|
132
115
|
keyframes: (keyframes: Keyframes) => string,
|
|
116
|
+
positionTry: (positionTry: PositionTry) => string,
|
|
133
117
|
props: (
|
|
134
118
|
this: ?mixed,
|
|
135
119
|
...styles: $ReadOnlyArray<
|
|
@@ -569,6 +569,21 @@ type pointerEvents =
|
|
|
569
569
|
| 'all'
|
|
570
570
|
| 'inherit';
|
|
571
571
|
type position = 'static' | 'relative' | 'absolute' | 'sticky' | 'fixed';
|
|
572
|
+
type positionArea =
|
|
573
|
+
| 'top'
|
|
574
|
+
| 'left'
|
|
575
|
+
| 'bottom'
|
|
576
|
+
| 'right'
|
|
577
|
+
| 'center'
|
|
578
|
+
| 'block-start'
|
|
579
|
+
| 'block-end'
|
|
580
|
+
| 'inline-start'
|
|
581
|
+
| 'inline-end'
|
|
582
|
+
| 'span-inline-start'
|
|
583
|
+
| 'span-inline-end'
|
|
584
|
+
| 'span-block-start'
|
|
585
|
+
| 'span-block-end';
|
|
586
|
+
type positionVisibility = 'always' | 'anchors-visible' | 'no-overflow';
|
|
572
587
|
type quotes = string | 'none';
|
|
573
588
|
type resize = 'none' | 'both' | 'horizontal' | 'vertical';
|
|
574
589
|
type rowGap = number | string;
|
|
@@ -954,6 +969,7 @@ export type CSSProperties = Readonly<{
|
|
|
954
969
|
alignTracks?: all | string;
|
|
955
970
|
justifyTracks?: all | string;
|
|
956
971
|
masonryAutoFlow?: all | string;
|
|
972
|
+
anchorName?: all | string;
|
|
957
973
|
animation?: all | string;
|
|
958
974
|
animationComposition?: all | string;
|
|
959
975
|
animationDelay?: all | OptionalArray<animationDelay>;
|
|
@@ -1324,6 +1340,12 @@ export type CSSProperties = Readonly<{
|
|
|
1324
1340
|
perspectiveOrigin?: all | perspectiveOrigin;
|
|
1325
1341
|
pointerEvents?: all | pointerEvents;
|
|
1326
1342
|
position?: all | position;
|
|
1343
|
+
positionAnchor?: all | string;
|
|
1344
|
+
positionArea?: all | positionArea;
|
|
1345
|
+
positionTry?: all | string;
|
|
1346
|
+
positionTryFallbacks?: all | string;
|
|
1347
|
+
positionTryOptions?: all | string;
|
|
1348
|
+
positionVisibility?: all | positionVisibility;
|
|
1327
1349
|
quotes?: all | quotes;
|
|
1328
1350
|
resize?: all | resize;
|
|
1329
1351
|
rest?: all | rest;
|
|
@@ -575,6 +575,21 @@ type pointerEvents =
|
|
|
575
575
|
| 'all'
|
|
576
576
|
| 'inherit';
|
|
577
577
|
type position = 'static' | 'relative' | 'absolute' | 'sticky' | 'fixed';
|
|
578
|
+
type positionArea =
|
|
579
|
+
| 'top'
|
|
580
|
+
| 'left'
|
|
581
|
+
| 'bottom'
|
|
582
|
+
| 'right'
|
|
583
|
+
| 'center'
|
|
584
|
+
| 'block-start'
|
|
585
|
+
| 'block-end'
|
|
586
|
+
| 'inline-start'
|
|
587
|
+
| 'inline-end'
|
|
588
|
+
| 'span-inline-start'
|
|
589
|
+
| 'span-inline-end'
|
|
590
|
+
| 'span-block-start'
|
|
591
|
+
| 'span-block-end';
|
|
592
|
+
type positionVisibility = 'always' | 'anchors-visible' | 'no-overflow';
|
|
578
593
|
type quotes = string | 'none';
|
|
579
594
|
type resize = 'none' | 'both' | 'horizontal' | 'vertical';
|
|
580
595
|
type rowGap = number | string;
|
|
@@ -982,6 +997,8 @@ export type CSSProperties = $ReadOnly<{
|
|
|
982
997
|
justifyTracks?: all | string,
|
|
983
998
|
masonryAutoFlow?: all | string,
|
|
984
999
|
|
|
1000
|
+
anchorName?: all | string,
|
|
1001
|
+
|
|
985
1002
|
// Not Allowed:
|
|
986
1003
|
// all?: all | all,
|
|
987
1004
|
animation?: all | string,
|
|
@@ -1392,7 +1409,15 @@ export type CSSProperties = $ReadOnly<{
|
|
|
1392
1409
|
perspective?: all | perspective,
|
|
1393
1410
|
perspectiveOrigin?: all | perspectiveOrigin,
|
|
1394
1411
|
pointerEvents?: all | pointerEvents,
|
|
1412
|
+
|
|
1395
1413
|
position?: all | position,
|
|
1414
|
+
positionAnchor?: all | string,
|
|
1415
|
+
positionArea?: all | positionArea,
|
|
1416
|
+
positionTry?: all | string,
|
|
1417
|
+
positionTryFallbacks?: all | string,
|
|
1418
|
+
positionTryOptions?: all | string,
|
|
1419
|
+
positionVisibility?: all | positionVisibility,
|
|
1420
|
+
|
|
1396
1421
|
quotes?: all | quotes,
|
|
1397
1422
|
resize?: all | resize,
|
|
1398
1423
|
rest?: all | rest,
|
|
@@ -91,6 +91,54 @@ export type StyleXSingleStyle = false | (null | undefined | NestedCSSPropTypes);
|
|
|
91
91
|
// NOTE: `XStyle` has been deprecated in favor of `StaticStyles` and `StyleXStyles`.
|
|
92
92
|
|
|
93
93
|
export type Keyframes = Readonly<{ [name: string]: CSSProperties }>;
|
|
94
|
+
|
|
95
|
+
export type PositionTry = Readonly<{
|
|
96
|
+
// Anchor Positioning Properties
|
|
97
|
+
positionAnchor?: CSSProperties['positionAnchor'],
|
|
98
|
+
positionArea?: CSSProperties['positionArea'],
|
|
99
|
+
// inset Properties
|
|
100
|
+
top?: CSSProperties['top'],
|
|
101
|
+
right?: CSSProperties['right'],
|
|
102
|
+
bottom?: CSSProperties['bottom'],
|
|
103
|
+
left?: CSSProperties['left'],
|
|
104
|
+
inset?: CSSProperties['inset'],
|
|
105
|
+
insetBlock?: CSSProperties['insetBlock'],
|
|
106
|
+
insetBlockEnd?: CSSProperties['insetBlockEnd'],
|
|
107
|
+
insetBlockStart?: CSSProperties['insetBlockStart'],
|
|
108
|
+
insetInline?: CSSProperties['insetInline'],
|
|
109
|
+
insetInlineEnd?: CSSProperties['insetInlineEnd'],
|
|
110
|
+
insetInlineStart?: CSSProperties['insetInlineStart'],
|
|
111
|
+
// margin Properties
|
|
112
|
+
margin?: CSSProperties['margin'],
|
|
113
|
+
marginBlock?: CSSProperties['marginBlock'],
|
|
114
|
+
marginBlockEnd?: CSSProperties['marginBlockEnd'],
|
|
115
|
+
marginBlockStart?: CSSProperties['marginBlockStart'],
|
|
116
|
+
marginInline?: CSSProperties['marginInline'],
|
|
117
|
+
marginInlineEnd?: CSSProperties['marginInlineEnd'],
|
|
118
|
+
marginInlineStart?: CSSProperties['marginInlineStart'],
|
|
119
|
+
marginTop?: CSSProperties['marginTop'],
|
|
120
|
+
marginBottom?: CSSProperties['marginBottom'],
|
|
121
|
+
marginLeft?: CSSProperties['marginLeft'],
|
|
122
|
+
marginRight?: CSSProperties['marginRight'],
|
|
123
|
+
// size properties
|
|
124
|
+
width?: CSSProperties['width'],
|
|
125
|
+
height?: CSSProperties['height'],
|
|
126
|
+
minWidth?: CSSProperties['minWidth'],
|
|
127
|
+
minHeight?: CSSProperties['minHeight'],
|
|
128
|
+
maxWidth?: CSSProperties['maxWidth'],
|
|
129
|
+
maxHeight?: CSSProperties['maxHeight'],
|
|
130
|
+
blockSize?: CSSProperties['blockSize'],
|
|
131
|
+
inlineSize?: CSSProperties['inlineSize'],
|
|
132
|
+
minBlockSize?: CSSProperties['minBlockSize'],
|
|
133
|
+
minInlineSize?: CSSProperties['minInlineSize'],
|
|
134
|
+
maxBlockSize?: CSSProperties['maxBlockSize'],
|
|
135
|
+
maxInlineSize?: CSSProperties['maxInlineSize'],
|
|
136
|
+
// self alignment properties
|
|
137
|
+
alignSelf?: CSSProperties['alignSelf'],
|
|
138
|
+
justifySelf?: CSSProperties['justifySelf'],
|
|
139
|
+
placeSelf?: CSSProperties['placeSelf'],
|
|
140
|
+
}>;
|
|
141
|
+
|
|
94
142
|
export type LegacyThemeStyles = Readonly<{ [constantName: string]: string }>;
|
|
95
143
|
|
|
96
144
|
type ComplexStyleValueType<T> =
|
|
@@ -185,11 +233,11 @@ export type VarGroup<
|
|
|
185
233
|
|
|
186
234
|
export type TokensFromVarGroup<T extends VarGroup<{}>> = T['__tokens'];
|
|
187
235
|
|
|
188
|
-
export type IDFromVarGroup<T extends VarGroup<
|
|
236
|
+
export type IDFromVarGroup<T extends VarGroup<{}>> =
|
|
189
237
|
T['__opaqueId'];
|
|
190
238
|
|
|
191
239
|
type TTokens = Readonly<{
|
|
192
|
-
[key: string]: CSSType | string | { [key: string]: string };
|
|
240
|
+
[key: string]: CSSType<null | string | number> | string | { [key: string]: string };
|
|
193
241
|
}>;
|
|
194
242
|
|
|
195
243
|
type UnwrapVars<T> = T extends StyleXVar<infer U> ? U : T;
|
|
@@ -206,6 +254,13 @@ type NestedVarObject<T> =
|
|
|
206
254
|
[key: `@${string}`]: NestedVarObject<T>;
|
|
207
255
|
}>;
|
|
208
256
|
|
|
257
|
+
export type StyleX$DefineConsts = <
|
|
258
|
+
DefaultTokens extends TTokens,
|
|
259
|
+
ID extends symbol = symbol,
|
|
260
|
+
>(
|
|
261
|
+
tokens: DefaultTokens,
|
|
262
|
+
) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
|
|
263
|
+
|
|
209
264
|
export type StyleX$DefineVars = <
|
|
210
265
|
DefaultTokens extends TTokens,
|
|
211
266
|
ID extends symbol = symbol,
|
|
@@ -213,11 +268,11 @@ export type StyleX$DefineVars = <
|
|
|
213
268
|
tokens: DefaultTokens,
|
|
214
269
|
) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
|
|
215
270
|
|
|
216
|
-
declare class ThemeKey<out VG extends VarGroup
|
|
271
|
+
declare class ThemeKey<out VG extends VarGroup<{}>> extends String {
|
|
217
272
|
private varGroup: VG;
|
|
218
273
|
}
|
|
219
274
|
export type Theme<
|
|
220
|
-
T extends VarGroup<
|
|
275
|
+
T extends VarGroup<{}>,
|
|
221
276
|
Tag extends symbol = symbol,
|
|
222
277
|
> = Tag &
|
|
223
278
|
Readonly<{
|
|
@@ -229,7 +284,7 @@ type OverridesForTokenType<Config extends { [key: string]: unknown }> = {
|
|
|
229
284
|
};
|
|
230
285
|
|
|
231
286
|
export type StyleX$CreateTheme = <
|
|
232
|
-
TVars extends VarGroup<
|
|
287
|
+
TVars extends VarGroup<{}>,
|
|
233
288
|
ThemeID extends symbol = symbol,
|
|
234
289
|
>(
|
|
235
290
|
baseTokens: TVars,
|
|
@@ -53,12 +53,59 @@ export type StyleXSingleStyle = false | ?NestedCSSPropTypes;
|
|
|
53
53
|
export type XStyle<+T = NestedCSSPropTypes> = StyleXArray<
|
|
54
54
|
false | ?$ReadOnly<{ ...T, $$css: true }>,
|
|
55
55
|
>;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
|
|
57
|
+
export type XStyleWithout<+T: { +[_K in keyof NestedCSSPropTypes]?: mixed }> =
|
|
58
|
+
XStyle<$ReadOnly<Omit<NestedCSSPropTypes, $Keys<T>>>>;
|
|
59
59
|
|
|
60
60
|
export type Keyframes = $ReadOnly<{ [name: string]: CSSProperties, ... }>;
|
|
61
61
|
|
|
62
|
+
export type PositionTry = $ReadOnly<{
|
|
63
|
+
// Anchor Positioning Properties
|
|
64
|
+
positionAnchor?: CSSProperties['positionAnchor'],
|
|
65
|
+
positionArea?: CSSProperties['positionArea'],
|
|
66
|
+
// inset Properties
|
|
67
|
+
top?: CSSProperties['top'],
|
|
68
|
+
right?: CSSProperties['right'],
|
|
69
|
+
bottom?: CSSProperties['bottom'],
|
|
70
|
+
left?: CSSProperties['left'],
|
|
71
|
+
inset?: CSSProperties['inset'],
|
|
72
|
+
insetBlock?: CSSProperties['insetBlock'],
|
|
73
|
+
insetBlockEnd?: CSSProperties['insetBlockEnd'],
|
|
74
|
+
insetBlockStart?: CSSProperties['insetBlockStart'],
|
|
75
|
+
insetInline?: CSSProperties['insetInline'],
|
|
76
|
+
insetInlineEnd?: CSSProperties['insetInlineEnd'],
|
|
77
|
+
insetInlineStart?: CSSProperties['insetInlineStart'],
|
|
78
|
+
// margin Properties
|
|
79
|
+
margin?: CSSProperties['margin'],
|
|
80
|
+
marginBlock?: CSSProperties['marginBlock'],
|
|
81
|
+
marginBlockEnd?: CSSProperties['marginBlockEnd'],
|
|
82
|
+
marginBlockStart?: CSSProperties['marginBlockStart'],
|
|
83
|
+
marginInline?: CSSProperties['marginInline'],
|
|
84
|
+
marginInlineEnd?: CSSProperties['marginInlineEnd'],
|
|
85
|
+
marginInlineStart?: CSSProperties['marginInlineStart'],
|
|
86
|
+
marginTop?: CSSProperties['marginTop'],
|
|
87
|
+
marginBottom?: CSSProperties['marginBottom'],
|
|
88
|
+
marginLeft?: CSSProperties['marginLeft'],
|
|
89
|
+
marginRight?: CSSProperties['marginRight'],
|
|
90
|
+
// size properties
|
|
91
|
+
width?: CSSProperties['width'],
|
|
92
|
+
height?: CSSProperties['height'],
|
|
93
|
+
minWidth?: CSSProperties['minWidth'],
|
|
94
|
+
minHeight?: CSSProperties['minHeight'],
|
|
95
|
+
maxWidth?: CSSProperties['maxWidth'],
|
|
96
|
+
maxHeight?: CSSProperties['maxHeight'],
|
|
97
|
+
blockSize?: CSSProperties['blockSize'],
|
|
98
|
+
inlineSize?: CSSProperties['inlineSize'],
|
|
99
|
+
minBlockSize?: CSSProperties['minBlockSize'],
|
|
100
|
+
minInlineSize?: CSSProperties['minInlineSize'],
|
|
101
|
+
maxBlockSize?: CSSProperties['maxBlockSize'],
|
|
102
|
+
maxInlineSize?: CSSProperties['maxInlineSize'],
|
|
103
|
+
// self alignment properties
|
|
104
|
+
alignSelf?: CSSProperties['alignSelf'],
|
|
105
|
+
justifySelf?: CSSProperties['justifySelf'],
|
|
106
|
+
placeSelf?: CSSProperties['placeSelf'],
|
|
107
|
+
}>;
|
|
108
|
+
|
|
62
109
|
export type LegacyThemeStyles = $ReadOnly<{
|
|
63
110
|
[constantName: string]: string,
|
|
64
111
|
...
|
|
@@ -167,6 +214,10 @@ export type StyleX$DefineVars = <DefaultTokens: TTokens, ID: string = string>(
|
|
|
167
214
|
tokens: DefaultTokens,
|
|
168
215
|
) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
|
|
169
216
|
|
|
217
|
+
export type StyleX$DefineConsts = <DefaultTokens: TTokens, ID: string = string>(
|
|
218
|
+
tokens: DefaultTokens,
|
|
219
|
+
) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
|
|
220
|
+
|
|
170
221
|
// opaque type ThemeKey<+_VG: VarGroup<{ +[string]: mixed }>>: string = string;
|
|
171
222
|
declare export opaque type Theme<
|
|
172
223
|
+T: VarGroup<{ +[string]: mixed }, string>,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { ValueWithDefault } from './
|
|
10
|
+
import type { ValueWithDefault } from './StyleXUtils';
|
|
11
11
|
export type CSSSyntax =
|
|
12
12
|
| '*'
|
|
13
13
|
| '<length>'
|
|
@@ -25,69 +25,70 @@ export type CSSSyntax =
|
|
|
25
25
|
| '<custom-ident>'
|
|
26
26
|
| '<transform-list>';
|
|
27
27
|
type CSSSyntaxType = CSSSyntax;
|
|
28
|
-
|
|
28
|
+
type InnerValue = null | string | number;
|
|
29
|
+
interface ICSSType<_T extends InnerValue> {
|
|
29
30
|
readonly value: ValueWithDefault<string>;
|
|
30
31
|
readonly syntax: CSSSyntaxType;
|
|
31
32
|
}
|
|
32
|
-
export declare class Angle<T extends
|
|
33
|
+
export declare class Angle<T extends InnerValue> implements ICSSType<T> {
|
|
33
34
|
readonly value: ValueWithDefault<string>;
|
|
34
35
|
readonly syntax: CSSSyntaxType;
|
|
35
36
|
}
|
|
36
|
-
export declare class Color<T extends
|
|
37
|
+
export declare class Color<T extends InnerValue> implements ICSSType<T> {
|
|
37
38
|
readonly value: ValueWithDefault<string>;
|
|
38
39
|
readonly syntax: CSSSyntaxType;
|
|
39
40
|
}
|
|
40
|
-
export declare class Url<T extends
|
|
41
|
+
export declare class Url<T extends InnerValue> implements ICSSType<T> {
|
|
41
42
|
readonly value: ValueWithDefault<string>;
|
|
42
43
|
readonly syntax: CSSSyntaxType;
|
|
43
44
|
}
|
|
44
|
-
export declare class Image<T extends
|
|
45
|
+
export declare class Image<T extends InnerValue> implements ICSSType<T> {
|
|
45
46
|
readonly value: ValueWithDefault<string>;
|
|
46
47
|
readonly syntax: CSSSyntaxType;
|
|
47
48
|
}
|
|
48
|
-
export declare class Integer<T extends
|
|
49
|
+
export declare class Integer<T extends InnerValue> implements ICSSType<T> {
|
|
49
50
|
readonly value: ValueWithDefault<string>;
|
|
50
51
|
readonly syntax: CSSSyntaxType;
|
|
51
52
|
}
|
|
52
|
-
export declare class LengthPercentage<T extends
|
|
53
|
+
export declare class LengthPercentage<T extends InnerValue>
|
|
53
54
|
implements ICSSType<T>
|
|
54
55
|
{
|
|
55
56
|
readonly value: ValueWithDefault<string>;
|
|
56
57
|
readonly syntax: CSSSyntaxType;
|
|
57
58
|
}
|
|
58
|
-
export declare class Length<T extends
|
|
59
|
+
export declare class Length<T extends InnerValue> implements ICSSType<T> {
|
|
59
60
|
readonly value: ValueWithDefault<string>;
|
|
60
61
|
readonly syntax: CSSSyntaxType;
|
|
61
62
|
}
|
|
62
|
-
export declare class Percentage<T extends
|
|
63
|
-
implements ICSSType<T>
|
|
64
|
-
{
|
|
63
|
+
export declare class Percentage<T extends InnerValue> implements ICSSType<T> {
|
|
65
64
|
readonly value: ValueWithDefault<string>;
|
|
66
65
|
readonly syntax: CSSSyntaxType;
|
|
67
66
|
}
|
|
68
|
-
export declare class Num<T extends
|
|
67
|
+
export declare class Num<T extends InnerValue> implements ICSSType<T> {
|
|
69
68
|
readonly value: ValueWithDefault<string>;
|
|
70
69
|
readonly syntax: CSSSyntaxType;
|
|
71
70
|
}
|
|
72
|
-
export declare class Resolution<T extends
|
|
71
|
+
export declare class Resolution<T extends InnerValue> implements ICSSType<T> {
|
|
73
72
|
readonly value: ValueWithDefault<string>;
|
|
74
73
|
readonly syntax: CSSSyntaxType;
|
|
75
74
|
}
|
|
76
|
-
export declare class Time<T extends
|
|
75
|
+
export declare class Time<T extends InnerValue> implements ICSSType<T> {
|
|
77
76
|
readonly value: ValueWithDefault<string>;
|
|
78
77
|
readonly syntax: CSSSyntaxType;
|
|
79
78
|
}
|
|
80
|
-
export declare class TransformFunction<T extends
|
|
79
|
+
export declare class TransformFunction<T extends InnerValue>
|
|
81
80
|
implements ICSSType<T>
|
|
82
81
|
{
|
|
83
82
|
readonly value: ValueWithDefault<string>;
|
|
84
83
|
readonly syntax: CSSSyntaxType;
|
|
85
84
|
}
|
|
86
|
-
export declare class TransformList<T extends
|
|
85
|
+
export declare class TransformList<T extends InnerValue>
|
|
86
|
+
implements ICSSType<T>
|
|
87
|
+
{
|
|
87
88
|
readonly value: ValueWithDefault<string>;
|
|
88
89
|
readonly syntax: CSSSyntaxType;
|
|
89
90
|
}
|
|
90
|
-
export type CSSType<T extends
|
|
91
|
+
export type CSSType<T extends InnerValue> =
|
|
91
92
|
| Angle<T>
|
|
92
93
|
| Color<T>
|
|
93
94
|
| Url<T>
|