@stylexjs/shared 0.7.5 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/convert-to-className.js +2 -2
- package/lib/generate-css-rule.js +1 -1
- package/lib/index.js +2 -2
- package/lib/physical-rtl/generate-ltr.d.ts +3 -1
- package/lib/physical-rtl/generate-ltr.js +8 -12
- package/lib/physical-rtl/generate-ltr.js.flow +2 -2
- package/lib/physical-rtl/generate-rtl.d.ts +2 -2
- package/lib/physical-rtl/generate-rtl.js +57 -64
- package/lib/physical-rtl/generate-rtl.js.flow +2 -2
- package/lib/preprocess-rules/application-order.d.ts +4 -111
- package/lib/preprocess-rules/application-order.js.flow +3 -110
- package/lib/preprocess-rules/basic-validation.js +1 -1
- package/lib/preprocess-rules/flatten-raw-style-obj.js +1 -1
- package/lib/preprocess-rules/index.js +1 -1
- package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +3 -38
- package/lib/preprocess-rules/legacy-expand-shorthands.js +1 -1
- package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +3 -38
- package/lib/preprocess-rules/property-specificity.d.ts +4 -15
- package/lib/preprocess-rules/property-specificity.js.flow +3 -14
- package/lib/stylex-create-theme.js +2 -2
- package/lib/stylex-define-vars.d.ts +8 -5
- package/lib/stylex-define-vars.js +2 -2
- package/lib/stylex-define-vars.js.flow +5 -1
- package/lib/stylex-include.js +1 -1
- package/lib/stylex-keyframes.js +1 -1
- package/lib/transform-value.js +7 -4
- package/lib/types/index.js.flow +1 -1
- package/lib/utils/normalize-value.js +1 -1
- package/lib/utils/normalizers/convert-camel-case-values.js +1 -1
- package/lib/utils/normalizers/detect-unclosed-fns.js +1 -1
- package/lib/utils/normalizers/font-size-px-to-rem.js +1 -1
- package/lib/utils/normalizers/leading-zero.js +1 -1
- package/lib/utils/normalizers/timings.js +1 -1
- package/lib/utils/normalizers/zero-dimensions.js +1 -1
- package/lib/utils/object-utils.d.ts +3 -2
- package/lib/utils/object-utils.js.flow +5 -2
- package/lib/utils/property-priorities.d.ts +3 -56
- package/lib/utils/property-priorities.js.flow +56 -56
- package/lib/utils/split-css-value.js +1 -1
- package/package.json +2 -2
@@ -81,44 +81,9 @@ import type { TStyleValue } from '../common-types';
|
|
81
81
|
|
82
82
|
type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
|
83
83
|
|
84
|
-
declare const shorthands: {
|
85
|
-
|
86
|
-
|
87
|
-
borderHorizontal: (rawValue: TStyleValue) => TReturn,
|
88
|
-
borderStyle: (rawValue: TStyleValue) => TReturn,
|
89
|
-
borderVertical: (rawValue: TStyleValue) => TReturn,
|
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,
|
97
|
-
borderRadius: (rawValue: TStyleValue) => TReturn,
|
98
|
-
inset: (rawValue: TStyleValue) => TReturn,
|
99
|
-
insetInline: (rawValue: TStyleValue) => TReturn,
|
100
|
-
insetBlock: (rawValue: TStyleValue) => TReturn,
|
101
|
-
start: (rawValue: TStyleValue) => TReturn,
|
102
|
-
end: (rawValue: TStyleValue) => TReturn,
|
103
|
-
left: (rawValue: TStyleValue) => TReturn,
|
104
|
-
right: (rawValue: TStyleValue) => TReturn,
|
105
|
-
gap: (rawValue: TStyleValue) => TReturn,
|
106
|
-
margin: (rawValue: TStyleValue) => TReturn,
|
107
|
-
marginHorizontal: (rawValue: TStyleValue) => TReturn,
|
108
|
-
marginStart: (rawValue: TStyleValue) => TReturn,
|
109
|
-
marginEnd: (rawValue: TStyleValue) => TReturn,
|
110
|
-
marginLeft: (rawValue: TStyleValue) => TReturn,
|
111
|
-
marginRight: (rawValue: TStyleValue) => TReturn,
|
112
|
-
marginVertical: (rawValue: TStyleValue) => TReturn,
|
113
|
-
overflow: (rawValue: TStyleValue) => TReturn,
|
114
|
-
padding: (rawValue: TStyleValue) => TReturn,
|
115
|
-
paddingHorizontal: (val: TStyleValue) => TReturn,
|
116
|
-
paddingStart: (val: TStyleValue) => TReturn,
|
117
|
-
paddingEnd: (val: TStyleValue) => TReturn,
|
118
|
-
paddingLeft: (val: TStyleValue) => TReturn,
|
119
|
-
paddingRight: (val: TStyleValue) => TReturn,
|
120
|
-
paddingVertical: (val: TStyleValue) => TReturn,
|
121
|
-
};
|
84
|
+
declare const shorthands: $ReadOnly<{
|
85
|
+
[key: string]: (TStyleValue) => TReturn,
|
86
|
+
}>;
|
122
87
|
|
123
88
|
declare const aliases: {
|
124
89
|
insetBlockStart: (val: TStyleValue) => TReturn,
|
@@ -9,20 +9,9 @@
|
|
9
9
|
|
10
10
|
import type { TStyleValue } from '../common-types';
|
11
11
|
type TReturn = ReadonlyArray<[string, TStyleValue]>;
|
12
|
-
declare const shorthands: {
|
13
|
-
|
14
|
-
|
15
|
-
background: (_value: TStyleValue) => TReturn;
|
16
|
-
border: (_rawValue: TStyleValue) => TReturn;
|
17
|
-
borderInline: (_rawValue: TStyleValue) => TReturn;
|
18
|
-
borderBlock: (_rawValue: TStyleValue) => TReturn;
|
19
|
-
borderTop: (_rawValue: TStyleValue) => TReturn;
|
20
|
-
borderInlineEnd: (_rawValue: TStyleValue) => TReturn;
|
21
|
-
borderRight: (_rawValue: TStyleValue) => TReturn;
|
22
|
-
borderBottom: (_rawValue: TStyleValue) => TReturn;
|
23
|
-
borderInlineStart: (_rawValue: TStyleValue) => TReturn;
|
24
|
-
borderLeft: (_rawValue: TStyleValue) => TReturn;
|
25
|
-
};
|
12
|
+
declare const shorthands: Readonly<{
|
13
|
+
[key: string]: ($$PARAM_0$$: TStyleValue) => TReturn;
|
14
|
+
}>;
|
26
15
|
declare const aliases: {
|
27
16
|
borderHorizontal: any;
|
28
17
|
borderVertical: any;
|
@@ -82,7 +71,7 @@ declare const aliases: {
|
|
82
71
|
end: (val: TStyleValue) => TReturn;
|
83
72
|
};
|
84
73
|
declare const $$EXPORT_DEFAULT_DECLARATION$$: Readonly</**
|
85
|
-
* >
|
74
|
+
* > 85 | ...typeof shorthands,
|
86
75
|
* | ^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with complex spreads" is currently not supported.
|
87
76
|
**/
|
88
77
|
any>;
|
@@ -18,20 +18,9 @@ import type { TStyleValue } from '../common-types';
|
|
18
18
|
|
19
19
|
type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
|
20
20
|
|
21
|
-
declare const shorthands: {
|
22
|
-
|
23
|
-
|
24
|
-
background: (_value: TStyleValue) => TReturn,
|
25
|
-
border: (_rawValue: TStyleValue) => TReturn,
|
26
|
-
borderInline: (_rawValue: TStyleValue) => TReturn,
|
27
|
-
borderBlock: (_rawValue: TStyleValue) => TReturn,
|
28
|
-
borderTop: (_rawValue: TStyleValue) => TReturn,
|
29
|
-
borderInlineEnd: (_rawValue: TStyleValue) => TReturn,
|
30
|
-
borderRight: (_rawValue: TStyleValue) => TReturn,
|
31
|
-
borderBottom: (_rawValue: TStyleValue) => TReturn,
|
32
|
-
borderInlineStart: (_rawValue: TStyleValue) => TReturn,
|
33
|
-
borderLeft: (_rawValue: TStyleValue) => TReturn,
|
34
|
-
};
|
21
|
+
declare const shorthands: $ReadOnly<{
|
22
|
+
[key: string]: (TStyleValue) => TReturn,
|
23
|
+
}>;
|
35
24
|
|
36
25
|
declare const aliases: {
|
37
26
|
borderHorizontal: $FlowFixMe,
|
@@ -8,7 +8,7 @@ var _hash = _interopRequireDefault(require("./hash"));
|
|
8
8
|
var _stylexVarsUtils = require("./stylex-vars-utils");
|
9
9
|
var _types = require("./types");
|
10
10
|
var _defaultOptions = require("./utils/default-options");
|
11
|
-
function _interopRequireDefault(
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
12
12
|
function styleXCreateTheme(themeVars, variables, options) {
|
13
13
|
if (typeof themeVars.__themeName__ !== 'string') {
|
14
14
|
throw new Error('Can only override variables theme created with stylex.defineVars().');
|
@@ -35,7 +35,7 @@ function styleXCreateTheme(themeVars, variables, options) {
|
|
35
35
|
const stylesToInject = {};
|
36
36
|
for (const atRule of sortedAtRules) {
|
37
37
|
const decls = rulesByAtRule[atRule].join('');
|
38
|
-
const rule = `.${overrideClassName}{${decls}}`;
|
38
|
+
const rule = `.${overrideClassName}, .${overrideClassName}:root{${decls}}`;
|
39
39
|
if (atRule === 'default') {
|
40
40
|
stylesToInject[overrideClassName] = {
|
41
41
|
ltr: rule,
|
@@ -9,11 +9,14 @@
|
|
9
9
|
|
10
10
|
import type { InjectableStyle, StyleXOptions } from './common-types';
|
11
11
|
import type { VarsConfig } from './stylex-vars-utils';
|
12
|
-
type
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
type VarsKeysWithStringValues<Vars extends VarsConfig> = Readonly<{
|
13
|
+
[$$Key$$: keyof Vars]: string;
|
14
|
+
}>;
|
15
|
+
type VarsObject<Vars extends VarsConfig> = Readonly<
|
16
|
+
Omit<VarsKeysWithStringValues<Vars>, keyof ({ __themeName__: string })> & {
|
17
|
+
__themeName__: string;
|
18
|
+
}
|
19
|
+
>;
|
17
20
|
declare function styleXDefineVars<Vars extends VarsConfig>(
|
18
21
|
variables: Vars,
|
19
22
|
options: Readonly<
|
@@ -9,7 +9,7 @@ var _objectUtils = require("./utils/object-utils");
|
|
9
9
|
var _defaultOptions = require("./utils/default-options");
|
10
10
|
var _stylexVarsUtils = require("./stylex-vars-utils");
|
11
11
|
var _types = require("./types");
|
12
|
-
function _interopRequireDefault(
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
13
13
|
function styleXDefineVars(variables, options) {
|
14
14
|
const {
|
15
15
|
classNamePrefix,
|
@@ -35,7 +35,7 @@ function styleXDefineVars(variables, options) {
|
|
35
35
|
}
|
36
36
|
return {
|
37
37
|
nameHash,
|
38
|
-
value
|
38
|
+
value: value
|
39
39
|
};
|
40
40
|
});
|
41
41
|
const themeVariablesObject = (0, _objectUtils.objMap)(variablesMap, _ref => {
|
@@ -10,8 +10,12 @@
|
|
10
10
|
import type { InjectableStyle, StyleXOptions } from './common-types';
|
11
11
|
import type { VarsConfig } from './stylex-vars-utils';
|
12
12
|
|
13
|
+
type VarsKeysWithStringValues<Vars: VarsConfig> = $ReadOnly<{
|
14
|
+
[$Keys<Vars>]: string,
|
15
|
+
}>;
|
16
|
+
|
13
17
|
type VarsObject<Vars: VarsConfig> = $ReadOnly<{
|
14
|
-
|
18
|
+
...VarsKeysWithStringValues<Vars>,
|
15
19
|
__themeName__: string,
|
16
20
|
}>;
|
17
21
|
|
package/lib/stylex-include.js
CHANGED
@@ -7,7 +7,7 @@ exports.IncludedStyles = void 0;
|
|
7
7
|
exports.default = stylexInclude;
|
8
8
|
var messages = _interopRequireWildcard(require("./messages"));
|
9
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
11
11
|
let number = 0;
|
12
12
|
function uuid() {
|
13
13
|
return `__included_${++number}__`;
|
package/lib/stylex-keyframes.js
CHANGED
@@ -12,7 +12,7 @@ var _transformValue = _interopRequireDefault(require("./transform-value"));
|
|
12
12
|
var _dashify = _interopRequireDefault(require("./utils/dashify"));
|
13
13
|
var _objectUtils = require("./utils/object-utils");
|
14
14
|
var _defaultOptions = require("./utils/default-options");
|
15
|
-
function _interopRequireDefault(
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
16
16
|
function styleXKeyframes(frames) {
|
17
17
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _defaultOptions.defaultOptions;
|
18
18
|
const {
|
package/lib/transform-value.js
CHANGED
@@ -7,7 +7,7 @@ exports.default = transformValue;
|
|
7
7
|
exports.getNumberSuffix = getNumberSuffix;
|
8
8
|
exports.timeUnits = exports.lengthUnits = void 0;
|
9
9
|
var _normalizeValue = _interopRequireDefault(require("./utils/normalize-value"));
|
10
|
-
function _interopRequireDefault(
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
11
|
function transformValue(key, rawValue, options) {
|
12
12
|
const value = typeof rawValue === 'number' ? String(Math.round(rawValue * 10000) / 10000) + getNumberSuffix(key) : rawValue;
|
13
13
|
if ((key === 'content' || key === 'hyphenateCharacter' || key === 'hyphenate-character') && typeof value === 'string') {
|
@@ -22,9 +22,12 @@ function transformValue(key, rawValue, options) {
|
|
22
22
|
return (0, _normalizeValue.default)(value, key, options);
|
23
23
|
}
|
24
24
|
function getNumberSuffix(key) {
|
25
|
-
if (unitlessNumberProperties.has(key)) {
|
25
|
+
if (unitlessNumberProperties.has(key) || key.startsWith('--')) {
|
26
26
|
return '';
|
27
27
|
}
|
28
|
+
if (!(key in numberPropertySuffixes)) {
|
29
|
+
return 'px';
|
30
|
+
}
|
28
31
|
const suffix = numberPropertySuffixes[key];
|
29
32
|
if (suffix == null) {
|
30
33
|
return 'px';
|
@@ -32,7 +35,7 @@ function getNumberSuffix(key) {
|
|
32
35
|
return suffix;
|
33
36
|
}
|
34
37
|
}
|
35
|
-
const unitlessNumberProperties = new Set(['WebkitLineClamp', 'animationIterationCount', 'aspectRatio', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'counterSet', '
|
38
|
+
const unitlessNumberProperties = new Set(['WebkitLineClamp', 'animationIterationCount', 'aspectRatio', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'counterSet', 'counterReset', 'columnCount', 'flex', 'flexGrow', 'flexShrink', 'flexOrder', 'gridRow', 'gridRowStart', 'gridRowEnd', 'gridColumn', 'gridColumnStart', 'gridColumnEnd', 'gridArea', 'fontWeight', 'hyphenateLimitChars', 'lineClamp', 'lineHeight', 'maskBorderOutset', 'maskBorderSlice', 'maskBorderWidth', 'opacity', 'order', 'orphans', 'tabSize', 'widows', 'zIndex', 'fillOpacity', 'floodOpacity', 'rotate', 'scale', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'scale', 'mathDepth']);
|
36
39
|
const numberPropertySuffixes = {
|
37
40
|
animationDelay: 'ms',
|
38
41
|
animationDuration: 'ms',
|
@@ -41,4 +44,4 @@ const numberPropertySuffixes = {
|
|
41
44
|
voiceDuration: 'ms'
|
42
45
|
};
|
43
46
|
const timeUnits = exports.timeUnits = new Set(Object.keys(numberPropertySuffixes));
|
44
|
-
const lengthUnits = exports.lengthUnits = new Set(['backgroundPositionX', 'backgroundPositionY', 'blockSize', 'borderBlockEndWidth', 'borderBlockStartWidth', 'borderBlockWidth', 'borderVerticalWidth', 'borderVerticalWidth', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomWidth', 'borderEndEndRadius', 'borderEndStartRadius', '
|
47
|
+
const lengthUnits = exports.lengthUnits = new Set(['backgroundPositionX', 'backgroundPositionY', 'blockSize', 'borderBlockEndWidth', 'borderBlockStartWidth', 'borderBlockWidth', 'borderVerticalWidth', 'borderVerticalWidth', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomWidth', 'borderEndEndRadius', 'borderEndStartRadius', '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']);
|
package/lib/types/index.js.flow
CHANGED
@@ -65,7 +65,7 @@ export interface CSSType<+_T: string | number = string | number> {
|
|
65
65
|
|
66
66
|
declare export const isCSSType: (
|
67
67
|
value: mixed,
|
68
|
-
) => value is CSSType<string | number>;
|
68
|
+
) => implies value is CSSType<string | number>;
|
69
69
|
|
70
70
|
type AngleValue = string;
|
71
71
|
declare export class Angle<+T: AngleValue>
|
@@ -13,7 +13,7 @@ var _zeroDimensions = _interopRequireDefault(require("./normalizers/zero-dimensi
|
|
13
13
|
var _detectUnclosedFns = _interopRequireDefault(require("./normalizers/detect-unclosed-fns"));
|
14
14
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
15
15
|
var _convertCamelCaseValues = _interopRequireDefault(require("./normalizers/convert-camel-case-values"));
|
16
|
-
function _interopRequireDefault(
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
17
17
|
const normalizers = [_detectUnclosedFns.default, _whitespace.default, _timings.default, _zeroDimensions.default, _leadingZero.default, _quotes.default, _convertCamelCaseValues.default];
|
18
18
|
function normalizeValue(value, key, _ref) {
|
19
19
|
let {
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = convertCamelCasedValues;
|
7
7
|
var _dashify = _interopRequireDefault(require("../dashify"));
|
8
|
-
function _interopRequireDefault(
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
9
|
function convertCamelCasedValues(ast, key) {
|
10
10
|
if (key !== 'transitionProperty' && key !== 'willChange') {
|
11
11
|
return ast;
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = detectUnclosedFns;
|
7
7
|
var messages = _interopRequireWildcard(require("../../messages"));
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
10
10
|
function detectUnclosedFns(ast, _) {
|
11
11
|
ast.walk(node => {
|
12
12
|
if (node.type === 'function' && node.unclosed) {
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = convertFontSizeToRem;
|
7
7
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
8
|
-
function _interopRequireDefault(
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
9
|
const ROOT_FONT_SIZE = 16;
|
10
10
|
function convertFontSizeToRem(ast, key) {
|
11
11
|
if (key !== 'fontSize') {
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = normalizeLeadingZero;
|
7
7
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
8
|
-
function _interopRequireDefault(
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
9
|
function normalizeLeadingZero(ast, _) {
|
10
10
|
ast.walk(node => {
|
11
11
|
if (node.type !== 'word') {
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = normalizeTimings;
|
7
7
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
8
|
-
function _interopRequireDefault(
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
9
|
function normalizeTimings(ast, _) {
|
10
10
|
ast.walk(node => {
|
11
11
|
if (node.type !== 'word') {
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = normalizeZeroDimensions;
|
7
7
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
8
|
-
function _interopRequireDefault(
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
9
|
const angles = ['deg', 'grad', 'turn', 'rad'];
|
10
10
|
const timings = ['ms', 's'];
|
11
11
|
const fraction = 'fr';
|
@@ -9,7 +9,8 @@
|
|
9
9
|
|
10
10
|
import type { CompiledStyles } from '../common-types';
|
11
11
|
import { IncludedStyles } from '../stylex-include';
|
12
|
-
|
12
|
+
type AnyObject = { readonly [$$Key$$: string]: unknown };
|
13
|
+
export declare function isPlainObject(obj: unknown): obj is AnyObject;
|
13
14
|
export declare function flattenObject(obj: CompiledStyles): {
|
14
15
|
readonly [$$Key$$: string]: null | string | IncludedStyles;
|
15
16
|
};
|
@@ -42,7 +43,7 @@ export declare function objMapEntry<
|
|
42
43
|
K2 extends string = string,
|
43
44
|
>(
|
44
45
|
obj: { readonly [$$Key$$: K1]: V },
|
45
|
-
mapper: ($$PARAM_0$$: [K1, V]) => [K2, V2]
|
46
|
+
mapper: ($$PARAM_0$$: Readonly<[K1, V]>) => Readonly<[K2, V2]>,
|
46
47
|
): { readonly [$$Key$$: K2]: V2 };
|
47
48
|
export declare function objMap<V, V2, K extends string = string>(
|
48
49
|
obj: { readonly [$$Key$$: K]: V },
|
@@ -13,7 +13,10 @@ import type { CompiledStyles } from '../common-types';
|
|
13
13
|
|
14
14
|
import { IncludedStyles } from '../stylex-include';
|
15
15
|
|
16
|
-
|
16
|
+
// eslint-disable-next-line no-unused-vars
|
17
|
+
type AnyObject = { +[string]: mixed };
|
18
|
+
|
19
|
+
declare export function isPlainObject(obj: mixed): implies obj is AnyObject;
|
17
20
|
|
18
21
|
declare export function flattenObject(obj: CompiledStyles): {
|
19
22
|
+[string]: null | string | IncludedStyles,
|
@@ -48,7 +51,7 @@ declare export function objMapEntry<
|
|
48
51
|
K2: string = string,
|
49
52
|
>(
|
50
53
|
obj: { +[K1]: V },
|
51
|
-
mapper: ([K1, V]) => [K2, V2]
|
54
|
+
mapper: ($ReadOnly<[K1, V]>) => $ReadOnly<[K2, V2]>,
|
52
55
|
): { +[K2]: V2 };
|
53
56
|
|
54
57
|
declare export function objMap<V, V2, K: string = string>(
|
@@ -7,62 +7,9 @@
|
|
7
7
|
*
|
8
8
|
*/
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
':not': 40;
|
14
|
-
':has': 45;
|
15
|
-
':dir': 50;
|
16
|
-
':lang': 51;
|
17
|
-
':first-child': 52;
|
18
|
-
':first-of-type': 53;
|
19
|
-
':last-child': 54;
|
20
|
-
':last-of-type': 55;
|
21
|
-
':only-child': 56;
|
22
|
-
':only-of-type': 57;
|
23
|
-
':nth-child': 60;
|
24
|
-
':nth-last-child': 61;
|
25
|
-
':nth-of-type': 62;
|
26
|
-
':nth-last-of-type': 63;
|
27
|
-
':empty': 70;
|
28
|
-
':link': 80;
|
29
|
-
':any-link': 81;
|
30
|
-
':local-link': 82;
|
31
|
-
':target-within': 83;
|
32
|
-
':target': 84;
|
33
|
-
':visited': 85;
|
34
|
-
':enabled': 91;
|
35
|
-
':disabled': 92;
|
36
|
-
':required': 93;
|
37
|
-
':optional': 94;
|
38
|
-
':read-only': 95;
|
39
|
-
':read-write': 96;
|
40
|
-
':placeholder-shown': 97;
|
41
|
-
':in-range': 98;
|
42
|
-
':out-of-range': 99;
|
43
|
-
':default': 100;
|
44
|
-
':checked': 101;
|
45
|
-
':indeterminate': 101;
|
46
|
-
':blank': 102;
|
47
|
-
':valid': 103;
|
48
|
-
':invalid': 104;
|
49
|
-
':user-invalid': 105;
|
50
|
-
':autofill': 110;
|
51
|
-
':picture-in-picture': 120;
|
52
|
-
':modal': 121;
|
53
|
-
':fullscreen': 122;
|
54
|
-
':paused': 123;
|
55
|
-
':playing': 124;
|
56
|
-
':current': 125;
|
57
|
-
':past': 126;
|
58
|
-
':future': 127;
|
59
|
-
':hover': 130;
|
60
|
-
':focusWithin': 140;
|
61
|
-
':focus': 150;
|
62
|
-
':focusVisible': 160;
|
63
|
-
':active': 170;
|
64
|
-
};
|
65
|
-
export declare const PSEUDO_CLASS_PRIORITIES: Readonly<PseudoClassPriorities>;
|
10
|
+
export declare const PSEUDO_CLASS_PRIORITIES: Readonly<{
|
11
|
+
[$$Key$$: string]: number;
|
12
|
+
}>;
|
66
13
|
type AtRulePriorities = { '@supports': 30; '@media': 200; '@container': 300 };
|
67
14
|
export declare const AT_RULE_PRIORITIES: Readonly<AtRulePriorities>;
|
68
15
|
export declare const PSEUDO_ELEMENT_PRIORITY: number;
|
@@ -7,63 +7,63 @@
|
|
7
7
|
* @flow strict
|
8
8
|
*/
|
9
9
|
|
10
|
-
type PseudoClassPriorities = {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
};
|
10
|
+
// type PseudoClassPriorities = {
|
11
|
+
// ':is': 40,
|
12
|
+
// ':where': 40,
|
13
|
+
// ':not': 40,
|
14
|
+
// ':has': 45,
|
15
|
+
// ':dir': 50,
|
16
|
+
// ':lang': 51,
|
17
|
+
// ':first-child': 52,
|
18
|
+
// ':first-of-type': 53,
|
19
|
+
// ':last-child': 54,
|
20
|
+
// ':last-of-type': 55,
|
21
|
+
// ':only-child': 56,
|
22
|
+
// ':only-of-type': 57,
|
23
|
+
// ':nth-child': 60,
|
24
|
+
// ':nth-last-child': 61,
|
25
|
+
// ':nth-of-type': 62,
|
26
|
+
// ':nth-last-of-type': 63, // 'nth-last-of-type' is the same priority as 'nth-of-type
|
27
|
+
// ':empty': 70,
|
28
|
+
// ':link': 80,
|
29
|
+
// ':any-link': 81,
|
30
|
+
// ':local-link': 82,
|
31
|
+
// ':target-within': 83,
|
32
|
+
// ':target': 84,
|
33
|
+
// ':visited': 85,
|
34
|
+
// ':enabled': 91,
|
35
|
+
// ':disabled': 92,
|
36
|
+
// ':required': 93,
|
37
|
+
// ':optional': 94,
|
38
|
+
// ':read-only': 95,
|
39
|
+
// ':read-write': 96,
|
40
|
+
// ':placeholder-shown': 97,
|
41
|
+
// ':in-range': 98,
|
42
|
+
// ':out-of-range': 99,
|
43
|
+
// ':default': 100,
|
44
|
+
// ':checked': 101,
|
45
|
+
// ':indeterminate': 101,
|
46
|
+
// ':blank': 102,
|
47
|
+
// ':valid': 103,
|
48
|
+
// ':invalid': 104,
|
49
|
+
// ':user-invalid': 105,
|
50
|
+
// ':autofill': 110,
|
51
|
+
// ':picture-in-picture': 120,
|
52
|
+
// ':modal': 121,
|
53
|
+
// ':fullscreen': 122,
|
54
|
+
// ':paused': 123,
|
55
|
+
// ':playing': 124,
|
56
|
+
// ':current': 125,
|
57
|
+
// ':past': 126,
|
58
|
+
// ':future': 127,
|
59
|
+
// ':hover': 130,
|
60
|
+
// ':focusWithin': 140,
|
61
|
+
// ':focus': 150,
|
62
|
+
// ':focusVisible': 160,
|
63
|
+
// ':active': 170,
|
64
|
+
// };
|
65
65
|
|
66
|
-
declare export const PSEUDO_CLASS_PRIORITIES: $ReadOnly<
|
66
|
+
declare export const PSEUDO_CLASS_PRIORITIES: $ReadOnly<{ [string]: number }>;
|
67
67
|
|
68
68
|
type AtRulePriorities = {
|
69
69
|
'@supports': 30,
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = splitValue;
|
7
7
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
8
|
-
function _interopRequireDefault(
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
9
|
function printNode(node) {
|
10
10
|
switch (node.type) {
|
11
11
|
case 'word':
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@stylexjs/shared",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.8.0",
|
4
4
|
"main": "lib/index.js",
|
5
5
|
"repository": "https://www.github.com/facebook/stylex",
|
6
6
|
"license": "MIT",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"postcss-value-parser": "^4.1.0"
|
14
14
|
},
|
15
15
|
"devDependencies": {
|
16
|
-
"@stylexjs/scripts": "0.
|
16
|
+
"@stylexjs/scripts": "0.8.0"
|
17
17
|
},
|
18
18
|
"jest": {
|
19
19
|
"snapshotFormat": {
|