@stylexjs/shared 0.17.5 → 0.18.1
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/common-types.d.ts +61 -0
- package/lib/common-types.js +1 -0
- package/lib/common-types.js.flow +85 -0
- package/lib/hash.d.ts +15 -0
- package/lib/hash.js +49 -0
- package/lib/hash.js.flow +12 -0
- package/lib/messages.d.ts +70 -0
- package/lib/messages.js +38 -0
- package/lib/messages.js.flow +44 -0
- package/lib/physical-rtl/generate-ltr.d.ts +15 -0
- package/lib/physical-rtl/generate-ltr.js +75 -0
- package/lib/physical-rtl/generate-ltr.js.flow +14 -0
- package/lib/physical-rtl/generate-rtl.d.ts +15 -0
- package/lib/physical-rtl/generate-rtl.js +157 -0
- package/lib/physical-rtl/generate-rtl.js.flow +14 -0
- package/lib/preprocess-rules/PreRule.d.ts +51 -0
- package/lib/preprocess-rules/PreRule.js +79 -0
- package/lib/preprocess-rules/PreRule.js.flow +63 -0
- package/lib/preprocess-rules/__tests__/PreRule-test.js +33 -0
- package/lib/preprocess-rules/__tests__/flatten-raw-style-obj-test.js +196 -0
- package/lib/preprocess-rules/application-order.d.ts +186 -0
- package/lib/preprocess-rules/application-order.js +195 -0
- package/lib/preprocess-rules/application-order.js.flow +141 -0
- package/lib/preprocess-rules/basic-validation.d.ts +13 -0
- package/lib/preprocess-rules/basic-validation.js +70 -0
- package/lib/preprocess-rules/basic-validation.js.flow +13 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +20 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.js +100 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +23 -0
- package/lib/preprocess-rules/index.d.ts +21 -0
- package/lib/preprocess-rules/index.js +45 -0
- package/lib/preprocess-rules/index.js.flow +23 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +170 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.js +222 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +142 -0
- package/lib/preprocess-rules/property-specificity.d.ts +79 -0
- package/lib/preprocess-rules/property-specificity.js +107 -0
- package/lib/preprocess-rules/property-specificity.js.flow +93 -0
- package/lib/stylex-consts-utils.d.ts +11 -0
- package/lib/stylex-consts-utils.js +1 -0
- package/lib/stylex-consts-utils.js.flow +14 -0
- package/lib/stylex-create-theme.d.ts +26 -0
- package/lib/stylex-create-theme.js +53 -0
- package/lib/stylex-create-theme.js.flow +19 -0
- package/lib/stylex-create.d.ts +27 -0
- package/lib/stylex-create.js +60 -0
- package/lib/stylex-create.js.flow +37 -0
- package/lib/stylex-defaultMarker.d.ts +14 -0
- package/lib/stylex-defaultMarker.js +14 -0
- package/lib/stylex-defaultMarker.js.flow +13 -0
- package/lib/stylex-define-consts.d.ts +23 -0
- package/lib/stylex-define-consts.js +40 -0
- package/lib/stylex-define-consts.js.flow +19 -0
- package/lib/stylex-define-vars.d.ts +28 -0
- package/lib/stylex-define-vars.js +90 -0
- package/lib/stylex-define-vars.js.flow +26 -0
- package/lib/stylex-first-that-works.d.ts +13 -0
- package/lib/stylex-first-that-works.js +23 -0
- package/lib/stylex-first-that-works.js.flow +12 -0
- package/lib/stylex-keyframes.d.ts +17 -0
- package/lib/stylex-keyframes.js +46 -0
- package/lib/stylex-keyframes.js.flow +20 -0
- package/lib/stylex-position-try.d.ts +15 -0
- package/lib/stylex-position-try.js +47 -0
- package/lib/stylex-position-try.js.flow +18 -0
- package/lib/stylex-vars-utils.d.ts +27 -0
- package/lib/stylex-vars-utils.js +66 -0
- package/lib/stylex-vars-utils.js.flow +31 -0
- package/lib/stylex-view-transition-class.d.ts +22 -0
- package/lib/stylex-view-transition-class.js +42 -0
- package/lib/stylex-view-transition-class.js.flow +23 -0
- package/lib/types/__tests__/stylex-types-test.js +178 -0
- package/lib/types/index.d.ts +254 -0
- package/lib/types/index.js +147 -0
- package/lib/types/index.js.flow +280 -0
- package/lib/utils/Rule.d.ts +58 -0
- package/lib/utils/Rule.js +50 -0
- package/lib/utils/Rule.js.flow +64 -0
- package/lib/utils/__tests__/convert-to-className-test.js +85 -0
- package/lib/utils/__tests__/property-priorities-test.js +33 -0
- package/lib/utils/__tests__/split-css-value-test.js +26 -0
- package/lib/utils/__tests__/transform-value-test.js +36 -0
- package/lib/utils/convert-to-className.d.ts +21 -0
- package/lib/utils/convert-to-className.js +61 -0
- package/lib/utils/convert-to-className.js.flow +29 -0
- package/lib/utils/css-properties.js.flow +155 -0
- package/lib/utils/dashify.d.ts +11 -0
- package/lib/utils/dashify.js +9 -0
- package/lib/utils/dashify.js.flow +10 -0
- package/lib/utils/default-options.d.ts +12 -0
- package/lib/utils/default-options.js +26 -0
- package/lib/utils/default-options.js.flow +12 -0
- package/lib/utils/file-based-identifier.d.ts +15 -0
- package/lib/utils/file-based-identifier.js +13 -0
- package/lib/utils/file-based-identifier.js.flow +14 -0
- package/lib/utils/generate-css-rule.d.ts +19 -0
- package/lib/utils/generate-css-rule.js +37 -0
- package/lib/utils/generate-css-rule.js.flow +19 -0
- package/lib/utils/normalize-value.d.ts +16 -0
- package/lib/utils/normalize-value.js +27 -0
- package/lib/utils/normalize-value.js.flow +16 -0
- package/lib/utils/normalizers/convert-camel-case-values.d.ts +14 -0
- package/lib/utils/normalizers/convert-camel-case-values.js +23 -0
- package/lib/utils/normalizers/convert-camel-case-values.js.flow +13 -0
- package/lib/utils/normalizers/detect-unclosed-fns.d.ts +17 -0
- package/lib/utils/normalizers/detect-unclosed-fns.js +16 -0
- package/lib/utils/normalizers/detect-unclosed-fns.js.flow +16 -0
- package/lib/utils/normalizers/font-size-px-to-rem.d.ts +19 -0
- package/lib/utils/normalizers/font-size-px-to-rem.js +24 -0
- package/lib/utils/normalizers/font-size-px-to-rem.js.flow +18 -0
- package/lib/utils/normalizers/leading-zero.d.ts +17 -0
- package/lib/utils/normalizers/leading-zero.js +24 -0
- package/lib/utils/normalizers/leading-zero.js.flow +16 -0
- package/lib/utils/normalizers/quotes.d.ts +18 -0
- package/lib/utils/normalizers/quotes.js +17 -0
- package/lib/utils/normalizers/quotes.js.flow +17 -0
- package/lib/utils/normalizers/timings.d.ts +18 -0
- package/lib/utils/normalizers/timings.js +25 -0
- package/lib/utils/normalizers/timings.js.flow +17 -0
- package/lib/utils/normalizers/whitespace.d.ts +19 -0
- package/lib/utils/normalizers/whitespace.js +54 -0
- package/lib/utils/normalizers/whitespace.js.flow +18 -0
- package/lib/utils/normalizers/zero-dimensions.d.ts +19 -0
- package/lib/utils/normalizers/zero-dimensions.js +45 -0
- package/lib/utils/normalizers/zero-dimensions.js.flow +18 -0
- package/lib/utils/object-utils.d.ts +68 -0
- package/lib/utils/object-utils.js +89 -0
- package/lib/utils/object-utils.js.flow +78 -0
- package/lib/utils/property-priorities.js +13 -1
- package/lib/utils/rule-utils.d.ts +17 -0
- package/lib/utils/rule-utils.js +41 -0
- package/lib/utils/rule-utils.js.flow +16 -0
- package/lib/utils/split-css-value.d.ts +14 -0
- package/lib/utils/split-css-value.js +41 -0
- package/lib/utils/split-css-value.js.flow +15 -0
- package/lib/utils/transform-value.d.ts +24 -0
- package/lib/utils/transform-value.js +50 -0
- package/lib/utils/transform-value.js.flow +25 -0
- package/lib/validate.d.ts +12 -0
- package/lib/validate.js +19 -0
- package/lib/validate.js.flow +14 -0
- package/lib/when/when.d.ts +67 -0
- package/lib/when/when.js +71 -0
- package/lib/when/when.js.flow +73 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertStyleToClassName = convertStyleToClassName;
|
|
7
|
+
exports.default = variableFallbacks;
|
|
8
|
+
var _hash = _interopRequireDefault(require("../hash"));
|
|
9
|
+
var _dashify = _interopRequireDefault(require("./dashify"));
|
|
10
|
+
var _transformValue = _interopRequireDefault(require("./transform-value"));
|
|
11
|
+
var _generateCssRule = require("./generate-css-rule");
|
|
12
|
+
var _defaultOptions = require("./default-options");
|
|
13
|
+
var messages = _interopRequireWildcard(require("../messages"));
|
|
14
|
+
var _ruleUtils = require("./rule-utils");
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function convertStyleToClassName(objEntry, pseudos, atRules, constRules, options = _defaultOptions.defaultOptions) {
|
|
18
|
+
const {
|
|
19
|
+
classNamePrefix = 'x',
|
|
20
|
+
debug = false,
|
|
21
|
+
enableDebugClassNames = true
|
|
22
|
+
} = options;
|
|
23
|
+
const [key, rawValue] = objEntry;
|
|
24
|
+
const dashedKey = key.startsWith('--') ? key : (0, _dashify.default)(key);
|
|
25
|
+
let value = Array.isArray(rawValue) ? rawValue.map(eachValue => (0, _transformValue.default)(key, eachValue, options)) : (0, _transformValue.default)(key, rawValue, options);
|
|
26
|
+
if (Array.isArray(value) && value.find(val => val.startsWith('var(') && val.endsWith(')'))) {
|
|
27
|
+
value = variableFallbacks(value);
|
|
28
|
+
}
|
|
29
|
+
const sortedPseudos = (0, _ruleUtils.sortPseudos)(pseudos ?? []);
|
|
30
|
+
const sortedAtRules = (0, _ruleUtils.sortAtRules)([...atRules, ...constRules]);
|
|
31
|
+
const pseudoHashString = sortedPseudos.join('');
|
|
32
|
+
const atRuleHashString = sortedAtRules.join('');
|
|
33
|
+
const modifierHashString = pseudoHashString + atRuleHashString || 'null';
|
|
34
|
+
const valueAsString = Array.isArray(value) ? value.join(', ') : value;
|
|
35
|
+
const stringToHash = dashedKey + valueAsString + modifierHashString;
|
|
36
|
+
const className = debug && enableDebugClassNames ? `${key}-${classNamePrefix}${(0, _hash.default)('<>' + stringToHash)}` : classNamePrefix + (0, _hash.default)('<>' + stringToHash);
|
|
37
|
+
const cssRules = (0, _generateCssRule.generateCSSRule)(className, dashedKey, value, pseudos, atRules, constRules, options);
|
|
38
|
+
return [key, className, cssRules];
|
|
39
|
+
}
|
|
40
|
+
function variableFallbacks(values) {
|
|
41
|
+
const firstVar = values.findIndex(val => val.startsWith('var(') && val.endsWith(')'));
|
|
42
|
+
const lastVar = values.findLastIndex(val => val.startsWith('var(') && val.endsWith(')'));
|
|
43
|
+
const valuesBeforeFirstVar = values.slice(0, firstVar);
|
|
44
|
+
let varValues = values.slice(firstVar, lastVar + 1).reverse();
|
|
45
|
+
const valuesAfterLastVar = values.slice(lastVar + 1);
|
|
46
|
+
if (varValues.find(val => !val.startsWith('var(') || !val.endsWith(')'))) {
|
|
47
|
+
throw new Error(messages.NON_CONTIGUOUS_VARS);
|
|
48
|
+
}
|
|
49
|
+
varValues = varValues.map(val => val.slice(4, -1));
|
|
50
|
+
return [...(valuesBeforeFirstVar.length > 0 ? valuesBeforeFirstVar.map(val => composeVars(...varValues, val)) : [composeVars(...varValues)]), ...valuesAfterLastVar];
|
|
51
|
+
}
|
|
52
|
+
function composeVars(...vars) {
|
|
53
|
+
const [first, ...rest] = vars;
|
|
54
|
+
if (rest.length > 0) {
|
|
55
|
+
return `var(${first},${composeVars(...rest)})`;
|
|
56
|
+
} else if (first.startsWith('--')) {
|
|
57
|
+
return `var(${first})`;
|
|
58
|
+
} else {
|
|
59
|
+
return first;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { TRawValue, StyleRule, StyleXOptions } from '../common-types';
|
|
11
|
+
|
|
12
|
+
// This function takes a single style rule and transforms it into a CSS rule.
|
|
13
|
+
// [color: 'red'] => ['color', 'classname-for-color-red', CSSRULE{ltr, rtl, priority}]
|
|
14
|
+
//
|
|
15
|
+
// It converts the camelCased style key to a dash-separated key.
|
|
16
|
+
// Handles RTL-flipping
|
|
17
|
+
// Hashes to get a className
|
|
18
|
+
// Returns the final key, className a CSS Rule
|
|
19
|
+
declare export function convertStyleToClassName(
|
|
20
|
+
objEntry: $ReadOnly<[string, TRawValue]>,
|
|
21
|
+
pseudos: $ReadOnlyArray<string>,
|
|
22
|
+
atRules: $ReadOnlyArray<string>,
|
|
23
|
+
constRules: $ReadOnlyArray<string>,
|
|
24
|
+
options?: StyleXOptions,
|
|
25
|
+
): StyleRule;
|
|
26
|
+
|
|
27
|
+
declare export default function variableFallbacks(
|
|
28
|
+
values: $ReadOnlyArray<string>,
|
|
29
|
+
): $ReadOnlyArray<string>;
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Canonical set of valid CSS property names in camelCase form.
|
|
12
|
+
* Mirrors the keys of the CSSProperties type in @stylexjs/stylex.
|
|
13
|
+
*
|
|
14
|
+
* This is the single source of truth for CSS property name validation
|
|
15
|
+
* at compile time. If a new CSS property is added to the CSSProperties
|
|
16
|
+
* type, it should also be added here.
|
|
17
|
+
*/
|
|
18
|
+
// prettier-ignore
|
|
19
|
+
const VALID_CSS_PROPERTIES: $ReadOnlySet<string> = new Set([
|
|
20
|
+
'theme',
|
|
21
|
+
'MozOsxFontSmoothing', 'WebkitAppearance', 'WebkitFontSmoothing',
|
|
22
|
+
'WebkitTapHighlightColor', 'WebkitMaskImage', 'WebkitTextFillColor',
|
|
23
|
+
'WebkitTextStrokeWidth', 'WebkitTextStrokeColor', 'WebkitBackgroundClip',
|
|
24
|
+
'WebkitBoxOrient', 'WebkitLineClamp',
|
|
25
|
+
'accentColor', 'aspectRatio', 'placeContent', 'alignContent',
|
|
26
|
+
'justifyContent', 'placeItems', 'placeSelf', 'alignItems', 'justifyItems',
|
|
27
|
+
'alignSelf', 'justifySelf', 'alignmentBaseline', 'alignTracks',
|
|
28
|
+
'justifyTracks', 'masonryAutoFlow', 'anchorName', 'animation',
|
|
29
|
+
'animationComposition', 'animationDelay', 'animationDirection',
|
|
30
|
+
'animationDuration', 'animationFillMode', 'animationIterationCount',
|
|
31
|
+
'animationName', 'animationPlayState', 'animationTimingFunction',
|
|
32
|
+
'animationTimeline', 'animationRange', 'animationRangeStart',
|
|
33
|
+
'animationRangeEnd', 'appearance', 'azimuth', 'backdropFilter',
|
|
34
|
+
'backfaceVisibility', 'background', 'backgroundAttachment',
|
|
35
|
+
'backgroundBlendMode', 'backgroundClip', 'backgroundColor',
|
|
36
|
+
'backgroundImage', 'backgroundOrigin', 'backgroundPosition',
|
|
37
|
+
'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat',
|
|
38
|
+
'backgroundSize', 'baselineShift', 'behavior', 'blockSize', 'border',
|
|
39
|
+
'borderBlock', 'borderBlockColor', 'borderBlockStyle', 'borderBlockWidth',
|
|
40
|
+
'borderBlockEnd', 'borderBlockEndColor', 'borderBlockEndStyle',
|
|
41
|
+
'borderBlockEndWidth', 'borderBlockStart', 'borderBlockStartColor',
|
|
42
|
+
'borderBlockStartStyle', 'borderBlockStartWidth', 'borderBottom',
|
|
43
|
+
'borderBottomColor', 'borderBottomStyle', 'borderBottomWidth',
|
|
44
|
+
'borderCollapse', 'borderColor', 'borderImage', 'borderImageOutset',
|
|
45
|
+
'borderImageRepeat', 'borderImageSlice', 'borderImageSource',
|
|
46
|
+
'borderImageWidth', 'borderInline', 'borderInlineColor',
|
|
47
|
+
'borderInlineStyle', 'borderInlineWidth', 'borderInlineEnd',
|
|
48
|
+
'borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth',
|
|
49
|
+
'borderInlineStart', 'borderInlineStartColor', 'borderInlineStartStyle',
|
|
50
|
+
'borderInlineStartWidth', 'borderLeft', 'borderLeftColor',
|
|
51
|
+
'borderLeftStyle', 'borderLeftWidth', 'borderRadius', 'borderEndStartRadius',
|
|
52
|
+
'borderStartStartRadius', 'borderStartEndRadius', 'borderEndEndRadius',
|
|
53
|
+
'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomLeftRadius',
|
|
54
|
+
'borderBottomRightRadius', 'cornerShape', 'cornerStartStartShape',
|
|
55
|
+
'cornerStartEndShape', 'cornerEndStartShape', 'cornerEndEndShape',
|
|
56
|
+
'cornerTopLeftShape', 'cornerTopRightShape', 'cornerBottomLeftShape',
|
|
57
|
+
'cornerBottomRightShape', 'borderRight', 'borderRightColor',
|
|
58
|
+
'borderRightStyle', 'borderRightWidth', 'borderSpacing', 'borderStyle',
|
|
59
|
+
'borderTop', 'borderTopColor', 'borderTopStyle', 'borderTopWidth',
|
|
60
|
+
'borderWidth', 'bottom', 'boxAlign', 'boxDecorationBreak', 'boxDirection',
|
|
61
|
+
'boxFlex', 'boxFlexGroup', 'boxLines', 'boxOrdinalGroup', 'boxOrient',
|
|
62
|
+
'boxShadow', 'boxSizing', 'boxSuppress', 'breakAfter', 'breakBefore',
|
|
63
|
+
'breakInside', 'captionSide', 'caret', 'caretColor', 'caretShape', 'clear',
|
|
64
|
+
'clip', 'clipPath', 'clipRule', 'color', 'colorScheme', 'forcedColorAdjust',
|
|
65
|
+
'printColorAdjust', 'columns', 'columnCount', 'columnWidth', 'columnRule',
|
|
66
|
+
'columnRuleColor', 'columnRuleStyle', 'columnRuleWidth', 'columnFill',
|
|
67
|
+
'columnGap', 'columnSpan', 'contain', 'containIntrinsicSize',
|
|
68
|
+
'containIntrinsicBlockSize', 'containIntrinsicInlineSize',
|
|
69
|
+
'containIntrinsicHeight', 'containIntrinsicWidth', 'container',
|
|
70
|
+
'containerName', 'containerType', 'contentVisibility', 'content',
|
|
71
|
+
'counterIncrement', 'counterReset', 'counterSet', 'cue', 'cueAfter',
|
|
72
|
+
'cueBefore', 'cursor', 'direction', 'display', 'displayInside',
|
|
73
|
+
'displayList', 'displayOutside', 'dominantBaseline', 'emptyCells', 'end',
|
|
74
|
+
'fill', 'fillOpacity', 'fillRule', 'filter', 'flex', 'flexBasis',
|
|
75
|
+
'flexDirection', 'flexFlow', 'flexGrow', 'flexShrink', 'flexWrap', 'float',
|
|
76
|
+
'font', 'fontFamily', 'fontFeatureSettings', 'fontKerning',
|
|
77
|
+
'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch',
|
|
78
|
+
'fontStyle', 'fontSynthesis', 'fontSynthesisWeight', 'fontSynthesisStyle',
|
|
79
|
+
'fontSynthesisSmallCaps', 'fontSynthesisPosition', 'fontVariant',
|
|
80
|
+
'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian',
|
|
81
|
+
'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition',
|
|
82
|
+
'fontWeight', 'fontOpticalSizing', 'fontPalette', 'fontVariationSettings',
|
|
83
|
+
'gap', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'grid',
|
|
84
|
+
'gridArea', 'gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridColumn',
|
|
85
|
+
'gridColumnEnd', 'gridColumnGap', 'gridColumnStart', 'gridGap', 'gridRow',
|
|
86
|
+
'gridRowEnd', 'gridRowGap', 'gridRowStart', 'gridTemplate',
|
|
87
|
+
'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows',
|
|
88
|
+
'hangingPunctuation', 'hyphenateCharacter', 'hyphenateLimitChars', 'hyphens',
|
|
89
|
+
'height', 'imageOrientation', 'imageRendering', 'imageResolution', 'imeMode',
|
|
90
|
+
'initialLetter', 'initialLetterAlign', 'inlineSize', 'interpolateSize',
|
|
91
|
+
'inset', 'insetBlock', 'insetBlockEnd', 'insetBlockStart', 'insetInline',
|
|
92
|
+
'insetInlineEnd', 'insetInlineStart', 'isolation', 'kerning', 'left',
|
|
93
|
+
'letterSpacing', 'lineBreak', 'lineHeight', 'lineHeightStep', 'listStyle',
|
|
94
|
+
'listStyleImage', 'listStylePosition', 'listStyleType', 'margin',
|
|
95
|
+
'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginBottom',
|
|
96
|
+
'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginLeft',
|
|
97
|
+
'marginRight', 'marginTop', 'marginTrim', 'marker', 'markerEnd',
|
|
98
|
+
'markerMid', 'markerOffset', 'markerStart', 'mask', 'maskClip',
|
|
99
|
+
'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPosition',
|
|
100
|
+
'maskRepeat', 'maskSize', 'maskType', 'maskBorder', 'maskBorderMode',
|
|
101
|
+
'maskBorderOutset', 'maskBorderRepeat', 'maskBorderSlice',
|
|
102
|
+
'maskBorderSource', 'maskBorderWidth', 'maxBlockSize', 'maxHeight',
|
|
103
|
+
'maxInlineSize', 'maxWidth', 'minBlockSize', 'minHeight', 'minInlineSize',
|
|
104
|
+
'minWidth', 'mixBlendMode', 'motion', 'motionOffset', 'motionPath',
|
|
105
|
+
'motionRotation', 'MsOverflowStyle', 'objectFit', 'objectPosition',
|
|
106
|
+
'offset', 'offsetAnchor', 'offsetDistance', 'offsetPath', 'offsetPosition',
|
|
107
|
+
'offsetRotate', 'opacity', 'order', 'orphans', 'outline', 'outlineColor',
|
|
108
|
+
'outlineOffset', 'outlineStyle', 'outlineWidth', 'overflow', 'overflowBlock',
|
|
109
|
+
'overflowBlockX', 'overflowX', 'overflowY', 'overflowAnchor',
|
|
110
|
+
'overflowClipMargin', 'overflowWrap', 'overscrollBehavior',
|
|
111
|
+
'overscrollBehaviorBlock', 'overscrollBehaviorY', 'overscrollBehaviorInline',
|
|
112
|
+
'overscrollBehaviorX', 'padding', 'paddingBlock', 'paddingBlockEnd',
|
|
113
|
+
'paddingBlockStart', 'paddingInline', 'paddingInlineEnd',
|
|
114
|
+
'paddingInlineStart', 'paddingBottom', 'paddingLeft', 'paddingRight',
|
|
115
|
+
'paddingTop', 'page', 'pageBreakAfter', 'pageBreakBefore',
|
|
116
|
+
'pageBreakInside', 'paintOrder', 'pause', 'pauseAfter', 'pauseBefore',
|
|
117
|
+
'perspective', 'perspectiveOrigin', 'pointerEvents', 'position',
|
|
118
|
+
'positionAnchor', 'positionArea', 'positionTry', 'positionTryFallbacks',
|
|
119
|
+
'positionTryOptions', 'positionVisibility', 'quotes', 'resize', 'rest',
|
|
120
|
+
'restAfter', 'restBefore', 'right', 'rowGap', 'rubyAlign', 'rubyMerge',
|
|
121
|
+
'rubyPosition', 'mathDepth', 'mathShift', 'mathStyle', 'scrollBehavior',
|
|
122
|
+
'scrollMargin', 'scrollMarginTop', 'scrollMarginRight',
|
|
123
|
+
'scrollMarginBottom', 'scrollMarginLeft', 'scrollMarginBlock',
|
|
124
|
+
'scrollMarginBlockEnd', 'scrollMarginBlockStart', 'scrollMarginInline',
|
|
125
|
+
'scrollMarginInlineEnd', 'scrollMarginInlineStart', 'scrollPadding',
|
|
126
|
+
'scrollPaddingTop', 'scrollPaddingRight', 'scrollPaddingBottom',
|
|
127
|
+
'scrollPaddingLeft', 'scrollPaddingBlock', 'scrollPaddingBlockEnd',
|
|
128
|
+
'scrollPaddingBlockStart', 'scrollPaddingInline', 'scrollPaddingInlineEnd',
|
|
129
|
+
'scrollPaddingInlineStart', 'scrollSnapAlign', 'scrollSnapStop',
|
|
130
|
+
'scrollSnapType', 'scrollTimeline', 'scrollTimelineAxis',
|
|
131
|
+
'scrollTimelineName', 'scrollbarColor', 'scrollbarGutter', 'scrollbarWidth',
|
|
132
|
+
'shapeImageThreshold', 'shapeMargin', 'shapeOutside', 'shapeRendering',
|
|
133
|
+
'speak', 'speakAs', 'src', 'start', 'stroke', 'strokeDasharray',
|
|
134
|
+
'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit',
|
|
135
|
+
'strokeOpacity', 'strokeWidth', 'tabSize', 'tableLayout', 'textAlign',
|
|
136
|
+
'textAlignLast', 'textAnchor', 'textCombineUpright', 'textDecoration',
|
|
137
|
+
'textDecorationColor', 'textDecorationLine', 'textDecorationSkip',
|
|
138
|
+
'textDecorationSkipInk', 'textDecorationStyle', 'textDecorationThickness',
|
|
139
|
+
'textEmphasis', 'textEmphasisColor', 'textEmphasisPosition',
|
|
140
|
+
'textEmphasisStyle', 'textFillColor', 'textIndent', 'textJustify',
|
|
141
|
+
'textOrientation', 'textOverflow', 'textRendering', 'textShadow',
|
|
142
|
+
'textSizeAdjust', 'textTransform', 'textUnderlineOffset',
|
|
143
|
+
'textUnderlinePosition', 'textWrap', 'timelineScope', 'top', 'touchAction',
|
|
144
|
+
'transform', 'transformBox', 'transformOrigin', 'transformStyle', 'rotate',
|
|
145
|
+
'scale', 'translate', 'transition', 'transitionDelay', 'transitionDuration',
|
|
146
|
+
'transitionProperty', 'transitionTimingFunction', 'unicodeBidi',
|
|
147
|
+
'unicodeRange', 'userSelect', 'verticalAlign', 'viewTimeline',
|
|
148
|
+
'viewTimelineAxis', 'viewTimelineName', 'viewTimelineInset',
|
|
149
|
+
'viewTransitionName', 'visibility', 'voiceBalance', 'voiceDuration',
|
|
150
|
+
'voiceFamily', 'voicePitch', 'voiceRange', 'voiceRate', 'voiceStress',
|
|
151
|
+
'voiceVolume', 'whiteSpace', 'widows', 'width', 'willChange', 'wordBreak',
|
|
152
|
+
'wordSpacing', 'wordWrap', 'writingMode', 'zIndex', 'zoom',
|
|
153
|
+
]);
|
|
154
|
+
|
|
155
|
+
declare export default typeof VALID_CSS_PROPERTIES;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
declare function dashify(str: string): string;
|
|
11
|
+
export default dashify;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare export default function dashify(str: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
import type { StyleXOptions } from '../common-types';
|
|
11
|
+
export declare const defaultOptions: StyleXOptions;
|
|
12
|
+
export declare type defaultOptions = typeof defaultOptions;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultOptions = void 0;
|
|
7
|
+
const defaultOptions = exports.defaultOptions = {
|
|
8
|
+
classNamePrefix: 'x',
|
|
9
|
+
dev: false,
|
|
10
|
+
debug: false,
|
|
11
|
+
propertyValidationMode: 'silent',
|
|
12
|
+
enableDebugClassNames: false,
|
|
13
|
+
enableDevClassNames: false,
|
|
14
|
+
enableDebugDataProp: true,
|
|
15
|
+
enableFontSizePxToRem: false,
|
|
16
|
+
enableInlinedConditionalMerge: true,
|
|
17
|
+
enableMediaQueryOrder: true,
|
|
18
|
+
enableLegacyValueFlipping: false,
|
|
19
|
+
enableLogicalStylesPolyfill: false,
|
|
20
|
+
enableLTRRTLComments: false,
|
|
21
|
+
enableMinifiedKeys: true,
|
|
22
|
+
styleResolution: 'property-specificity',
|
|
23
|
+
importSources: [],
|
|
24
|
+
treeshakeCompensation: false,
|
|
25
|
+
test: false
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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 { StyleXOptions } from '../common-types';
|
|
11
|
+
|
|
12
|
+
declare export const defaultOptions: StyleXOptions;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
declare function genFileBasedIdentifier($$PARAM_0$$: {
|
|
11
|
+
readonly fileName: string;
|
|
12
|
+
readonly exportName: string;
|
|
13
|
+
readonly key?: string;
|
|
14
|
+
}): string;
|
|
15
|
+
export default genFileBasedIdentifier;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = genFileBasedIdentifier;
|
|
7
|
+
function genFileBasedIdentifier({
|
|
8
|
+
fileName,
|
|
9
|
+
exportName,
|
|
10
|
+
key
|
|
11
|
+
}) {
|
|
12
|
+
return `${fileName}//${exportName}${key != null ? `.${key}` : ''}`;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
declare export default function genFileBasedIdentifier($$PARAM_0$$: {
|
|
11
|
+
+fileName: string,
|
|
12
|
+
+exportName: string,
|
|
13
|
+
+key?: string,
|
|
14
|
+
}): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import type { InjectableStyle, StyleXOptions } from '../common-types';
|
|
11
|
+
export declare function generateCSSRule(
|
|
12
|
+
className: string,
|
|
13
|
+
key: string,
|
|
14
|
+
value: string | ReadonlyArray<string>,
|
|
15
|
+
pseudos: ReadonlyArray<string>,
|
|
16
|
+
atRules: ReadonlyArray<string>,
|
|
17
|
+
constRules: ReadonlyArray<string>,
|
|
18
|
+
options?: StyleXOptions,
|
|
19
|
+
): InjectableStyle;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateCSSRule = generateCSSRule;
|
|
7
|
+
var _defaultOptions = require("./default-options");
|
|
8
|
+
var _generateLtr = _interopRequireDefault(require("../physical-rtl/generate-ltr"));
|
|
9
|
+
var _generateRtl = _interopRequireDefault(require("../physical-rtl/generate-rtl"));
|
|
10
|
+
var _propertyPriorities = _interopRequireDefault(require("./property-priorities"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const THUMB_VARIANTS = ['::-webkit-slider-thumb', '::-moz-range-thumb', '::-ms-thumb'];
|
|
13
|
+
function buildNestedCSSRule(className, decls, pseudos, atRules, constRules) {
|
|
14
|
+
const pseudo = pseudos.filter(p => p !== '::thumb').join('');
|
|
15
|
+
const combinedAtRules = atRules.concat(constRules);
|
|
16
|
+
const hasWhere = pseudo.includes(':where(');
|
|
17
|
+
const extraClassForWhere = hasWhere ? `.${className}` : '';
|
|
18
|
+
let selectorForAtRules = `.${className}` + extraClassForWhere + combinedAtRules.map(() => `.${className}`).join('') + pseudo;
|
|
19
|
+
if (pseudos.includes('::thumb')) {
|
|
20
|
+
selectorForAtRules = THUMB_VARIANTS.map(suffix => selectorForAtRules + suffix).join(', ');
|
|
21
|
+
}
|
|
22
|
+
return combinedAtRules.reduce((acc, combinedAtRules) => `${combinedAtRules}{${acc}}`, `${selectorForAtRules}{${decls}}`);
|
|
23
|
+
}
|
|
24
|
+
function generateCSSRule(className, key, value, pseudos, atRules, constRules, options = _defaultOptions.defaultOptions) {
|
|
25
|
+
const pairs = Array.isArray(value) ? value.map(eachValue => [key, eachValue]) : [[key, value]];
|
|
26
|
+
const ltrPairs = pairs.map(pair => (0, _generateLtr.default)(pair, options));
|
|
27
|
+
const ltrDecls = ltrPairs.map(pair => pair.join(':')).join(';');
|
|
28
|
+
const rtlDecls = pairs.map(pair => (0, _generateRtl.default)(pair, options)).filter(Boolean).map(pair => pair.join(':')).join(';');
|
|
29
|
+
const ltrRule = buildNestedCSSRule(className, ltrDecls, pseudos, atRules, constRules);
|
|
30
|
+
const rtlRule = !rtlDecls ? null : buildNestedCSSRule(className, rtlDecls, pseudos, atRules, constRules);
|
|
31
|
+
const priority = (0, _propertyPriorities.default)(key) + pseudos.map(_propertyPriorities.default).reduce((a, b) => a + b, 0) + atRules.map(_propertyPriorities.default).reduce((a, b) => a + b, 0) + constRules.map(_propertyPriorities.default).reduce((a, b) => a + b, 0);
|
|
32
|
+
return {
|
|
33
|
+
priority,
|
|
34
|
+
ltr: ltrRule,
|
|
35
|
+
rtl: rtlRule
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { InjectableStyle, StyleXOptions } from '../common-types';
|
|
11
|
+
declare export function generateCSSRule(
|
|
12
|
+
className: string,
|
|
13
|
+
key: string,
|
|
14
|
+
value: string | $ReadOnlyArray<string>,
|
|
15
|
+
pseudos: $ReadOnlyArray<string>,
|
|
16
|
+
atRules: $ReadOnlyArray<string>,
|
|
17
|
+
constRules: $ReadOnlyArray<string>,
|
|
18
|
+
options?: StyleXOptions,
|
|
19
|
+
): InjectableStyle;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import type { StyleXOptions } from '../common-types';
|
|
11
|
+
declare function normalizeValue(
|
|
12
|
+
value: string,
|
|
13
|
+
key: string,
|
|
14
|
+
$$PARAM_2$$: StyleXOptions,
|
|
15
|
+
): string;
|
|
16
|
+
export default normalizeValue;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = normalizeValue;
|
|
7
|
+
var _fontSizePxToRem = _interopRequireDefault(require("./normalizers/font-size-px-to-rem"));
|
|
8
|
+
var _leadingZero = _interopRequireDefault(require("./normalizers/leading-zero"));
|
|
9
|
+
var _quotes = _interopRequireDefault(require("./normalizers/quotes"));
|
|
10
|
+
var _timings = _interopRequireDefault(require("./normalizers/timings"));
|
|
11
|
+
var _whitespace = _interopRequireDefault(require("./normalizers/whitespace"));
|
|
12
|
+
var _zeroDimensions = _interopRequireDefault(require("./normalizers/zero-dimensions"));
|
|
13
|
+
var _detectUnclosedFns = _interopRequireDefault(require("./normalizers/detect-unclosed-fns"));
|
|
14
|
+
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
15
|
+
var _convertCamelCaseValues = _interopRequireDefault(require("./normalizers/convert-camel-case-values"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const normalizers = [_detectUnclosedFns.default, _whitespace.default, _timings.default, _zeroDimensions.default, _leadingZero.default, _quotes.default, _convertCamelCaseValues.default];
|
|
18
|
+
function normalizeValue(value, key, {
|
|
19
|
+
enableFontSizePxToRem
|
|
20
|
+
}) {
|
|
21
|
+
if (value == null) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
const parsedAST = (0, _postcssValueParser.default)(value);
|
|
25
|
+
const relevantNormalizers = enableFontSizePxToRem ? [...normalizers, _fontSizePxToRem.default] : normalizers;
|
|
26
|
+
return relevantNormalizers.reduce((ast, fn) => fn(ast, key), parsedAST).toString();
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { StyleXOptions } from '../common-types';
|
|
11
|
+
|
|
12
|
+
declare export default function normalizeValue(
|
|
13
|
+
value: string,
|
|
14
|
+
key: string,
|
|
15
|
+
$$PARAM_2$$: StyleXOptions,
|
|
16
|
+
): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
declare function convertCamelCasedValues(
|
|
11
|
+
ast: PostCSSValueAST,
|
|
12
|
+
key: string,
|
|
13
|
+
): PostCSSValueAST;
|
|
14
|
+
export default convertCamelCasedValues;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = convertCamelCasedValues;
|
|
7
|
+
var _dashify = _interopRequireDefault(require("../dashify"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function convertCamelCasedValues(ast, key) {
|
|
10
|
+
if (key !== 'transitionProperty' && key !== 'willChange') {
|
|
11
|
+
return ast;
|
|
12
|
+
}
|
|
13
|
+
const nodes = ast.nodes;
|
|
14
|
+
if (!nodes) {
|
|
15
|
+
return ast;
|
|
16
|
+
}
|
|
17
|
+
nodes.forEach(node => {
|
|
18
|
+
if (node.type === 'word' && !node.value.startsWith('--')) {
|
|
19
|
+
node.value = (0, _dashify.default)(node.value);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return ast;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
declare export default function convertCamelCasedValues(
|
|
11
|
+
ast: PostCSSValueAST,
|
|
12
|
+
key: string,
|
|
13
|
+
): PostCSSValueAST;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Remove leading zeros from numbers
|
|
12
|
+
*/
|
|
13
|
+
declare function detectUnclosedFns(
|
|
14
|
+
ast: PostCSSValueAST,
|
|
15
|
+
_: unknown,
|
|
16
|
+
): PostCSSValueAST;
|
|
17
|
+
export default detectUnclosedFns;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = detectUnclosedFns;
|
|
7
|
+
var messages = _interopRequireWildcard(require("../../messages"));
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
+
function detectUnclosedFns(ast, _) {
|
|
10
|
+
ast.walk(node => {
|
|
11
|
+
if (node.type === 'function' && node.unclosed) {
|
|
12
|
+
throw new Error(messages.LINT_UNCLOSED_FUNCTION);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return ast;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Remove leading zeros from numbers
|
|
12
|
+
*/
|
|
13
|
+
declare export default function detectUnclosedFns(
|
|
14
|
+
ast: PostCSSValueAST,
|
|
15
|
+
_: mixed,
|
|
16
|
+
): PostCSSValueAST;
|