@stylexjs/shared 0.1.0-beta.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/.babelrc +16 -0
- package/__tests__/stylex-create-test.js +386 -0
- package/__tests__/stylex-keyframes-test.js +59 -0
- package/lib/common-types.js +1 -0
- package/lib/convert-to-className.js +40 -0
- package/lib/expand-shorthands.js +190 -0
- package/lib/generate-css-rule.js +64 -0
- package/lib/hash.js +61 -0
- package/lib/index.d.ts +90 -0
- package/lib/index.js +40 -0
- package/lib/messages.js +56 -0
- package/lib/physical-rtl/generate-ltr.js +135 -0
- package/lib/physical-rtl/generate-rtl.js +216 -0
- package/lib/stylex-create.js +128 -0
- package/lib/stylex-first-that-works.js +22 -0
- package/lib/stylex-include.js +38 -0
- package/lib/stylex-keyframes.js +63 -0
- package/lib/transform-value.js +58 -0
- package/lib/utils/dashify.js +17 -0
- package/lib/utils/genCSSRule.js +24 -0
- package/lib/utils/normalize-value.js +32 -0
- package/lib/utils/normalizers/detect-unclosed-fns.js +29 -0
- package/lib/utils/normalizers/font-size-px-to-rem.js +34 -0
- package/lib/utils/normalizers/leading-zero.js +36 -0
- package/lib/utils/normalizers/quotes.js +30 -0
- package/lib/utils/normalizers/timings.js +39 -0
- package/lib/utils/normalizers/whitespace.js +59 -0
- package/lib/utils/normalizers/zero-dimensions.js +44 -0
- package/lib/utils/object-utils.js +94 -0
- package/lib/validate.js +30 -0
- package/package.json +24 -0
- package/tsconfig.json +103 -0
| @@ -0,0 +1,64 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 4 | 
            +
              value: true
         | 
| 5 | 
            +
            });
         | 
| 6 | 
            +
            exports.default = generateCSSRule;
         | 
| 7 | 
            +
            var _generateLtr = _interopRequireDefault(require("./physical-rtl/generate-ltr"));
         | 
| 8 | 
            +
            var _generateRtl = _interopRequireDefault(require("./physical-rtl/generate-rtl"));
         | 
| 9 | 
            +
            var _genCSSRule = _interopRequireDefault(require("./utils/genCSSRule"));
         | 
| 10 | 
            +
            function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
         | 
| 11 | 
            +
            /**
         | 
| 12 | 
            +
             * Copyright (c) Meta Platforms, Inc. and affiliates.
         | 
| 13 | 
            +
             *
         | 
| 14 | 
            +
             * This source code is licensed under the MIT license found in the
         | 
| 15 | 
            +
             * LICENSE file in the root directory of this source tree.
         | 
| 16 | 
            +
             *
         | 
| 17 | 
            +
             * 
         | 
| 18 | 
            +
             */
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            function generateCSSRule(className, key, value, pseudo) {
         | 
| 21 | 
            +
              const pairs = Array.isArray(value) ? value.map(eachValue => [key, eachValue]) : [[key, value]];
         | 
| 22 | 
            +
              const ltrPairs = pairs.map(_generateLtr.default);
         | 
| 23 | 
            +
              const ltrDecls = ltrPairs.map(pair => pair.join(':')).join(';');
         | 
| 24 | 
            +
              const rtlDecls = pairs.map(_generateRtl.default).filter(Boolean).map(pair => pair.join(':')).join(';');
         | 
| 25 | 
            +
              const ltrRule = (0, _genCSSRule.default)(className, ltrDecls, pseudo);
         | 
| 26 | 
            +
              const rtlRule = !rtlDecls ? null : (0, _genCSSRule.default)(className, rtlDecls, pseudo);
         | 
| 27 | 
            +
              let priority = 1;
         | 
| 28 | 
            +
              if (pseudo != null) {
         | 
| 29 | 
            +
                if (pseudo[0] === '@') {
         | 
| 30 | 
            +
                  priority = 2;
         | 
| 31 | 
            +
                } else if (pseudo[0] === ':') {
         | 
| 32 | 
            +
                  priority = pseudoPriorities[pseudo] ?? 2;
         | 
| 33 | 
            +
                  if (pseudo.startsWith(':nth-child')) {
         | 
| 34 | 
            +
                    priority = 6;
         | 
| 35 | 
            +
                  }
         | 
| 36 | 
            +
                  if (pseudo.startsWith(':nth-of-type')) {
         | 
| 37 | 
            +
                    priority = 7;
         | 
| 38 | 
            +
                  }
         | 
| 39 | 
            +
                }
         | 
| 40 | 
            +
              }
         | 
| 41 | 
            +
              if (key.toLowerCase().includes('left') || key.toLowerCase().includes('right')) {
         | 
| 42 | 
            +
                // Bump priority for physical left/right values.
         | 
| 43 | 
            +
                priority += 0.1;
         | 
| 44 | 
            +
              }
         | 
| 45 | 
            +
              return {
         | 
| 46 | 
            +
                priority,
         | 
| 47 | 
            +
                ltr: ltrRule,
         | 
| 48 | 
            +
                rtl: rtlRule
         | 
| 49 | 
            +
              };
         | 
| 50 | 
            +
            }
         | 
| 51 | 
            +
            const pseudoPriorities = {
         | 
| 52 | 
            +
              // Might become unsupported:
         | 
| 53 | 
            +
              ':first-child': 3,
         | 
| 54 | 
            +
              ':last-child': 4,
         | 
| 55 | 
            +
              ':only-child': 5,
         | 
| 56 | 
            +
              ':nth-child': 6,
         | 
| 57 | 
            +
              ':nth-of-type': 7,
         | 
| 58 | 
            +
              ':hover': 8,
         | 
| 59 | 
            +
              ':focus': 9,
         | 
| 60 | 
            +
              ':active': 10,
         | 
| 61 | 
            +
              ':disabled': 11,
         | 
| 62 | 
            +
              '::placeholder': 12,
         | 
| 63 | 
            +
              '::thumb': 13
         | 
| 64 | 
            +
            };
         | 
    
        package/lib/hash.js
    ADDED
    
    | @@ -0,0 +1,61 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 4 | 
            +
              value: true
         | 
| 5 | 
            +
            });
         | 
| 6 | 
            +
            exports.default = void 0;
         | 
| 7 | 
            +
            /**
         | 
| 8 | 
            +
             * Copyright (c) Meta Platforms, Inc. and affiliates.
         | 
| 9 | 
            +
             *
         | 
| 10 | 
            +
             * This source code is licensed under the MIT license found in the
         | 
| 11 | 
            +
             * LICENSE file in the root directory of this source tree.
         | 
| 12 | 
            +
             *
         | 
| 13 | 
            +
             * 
         | 
| 14 | 
            +
             */
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            /* eslint-disable default-case */
         | 
| 17 | 
            +
            /* eslint-disable no-fallthrough */
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            /**
         | 
| 20 | 
            +
             * JS Implementation of MurmurHash2
         | 
| 21 | 
            +
             *
         | 
| 22 | 
            +
             * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
         | 
| 23 | 
            +
             * @see http://github.com/garycourt/murmurhash-js
         | 
| 24 | 
            +
             * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
         | 
| 25 | 
            +
             * @see http://sites.google.com/site/murmurhash/
         | 
| 26 | 
            +
             *
         | 
| 27 | 
            +
             * @param {string} str ASCII only
         | 
| 28 | 
            +
             * @param {number} seed Positive integer only
         | 
| 29 | 
            +
             * @return {number} 32-bit positive integer hash
         | 
| 30 | 
            +
             */
         | 
| 31 | 
            +
            function murmurhash2_32_gc(str, seed) {
         | 
| 32 | 
            +
              let l = str.length,
         | 
| 33 | 
            +
                h = seed ^ l,
         | 
| 34 | 
            +
                i = 0,
         | 
| 35 | 
            +
                k;
         | 
| 36 | 
            +
              while (l >= 4) {
         | 
| 37 | 
            +
                k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
         | 
| 38 | 
            +
                k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
         | 
| 39 | 
            +
                k ^= k >>> 24;
         | 
| 40 | 
            +
                k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
         | 
| 41 | 
            +
                h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
         | 
| 42 | 
            +
                l -= 4;
         | 
| 43 | 
            +
                ++i;
         | 
| 44 | 
            +
              }
         | 
| 45 | 
            +
              switch (l) {
         | 
| 46 | 
            +
                case 3:
         | 
| 47 | 
            +
                  h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
         | 
| 48 | 
            +
                case 2:
         | 
| 49 | 
            +
                  h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
         | 
| 50 | 
            +
                case 1:
         | 
| 51 | 
            +
                  h ^= str.charCodeAt(i) & 0xff;
         | 
| 52 | 
            +
                  h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
         | 
| 53 | 
            +
              }
         | 
| 54 | 
            +
              h ^= h >>> 13;
         | 
| 55 | 
            +
              h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
         | 
| 56 | 
            +
              h ^= h >>> 15;
         | 
| 57 | 
            +
              return h >>> 0;
         | 
| 58 | 
            +
            }
         | 
| 59 | 
            +
            const hash = str => murmurhash2_32_gc(str, 1).toString(36);
         | 
| 60 | 
            +
            var _default = hash;
         | 
| 61 | 
            +
            exports.default = _default;
         | 
    
        package/lib/index.d.ts
    ADDED
    
    | @@ -0,0 +1,90 @@ | |
| 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 | 
            +
            export type TRawValue = number | string | Array<number | string>;
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            export type TStyleValue = number | string | Array<number | string>;
         | 
| 11 | 
            +
            export type TNestableStyleValue =
         | 
| 12 | 
            +
              | TStyleValue
         | 
| 13 | 
            +
              | { readonly [key: string]: TStyleValue };
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            export type RawStyles = $ReadOnly<{
         | 
| 16 | 
            +
              [key: string]: TNestableStyleValue;
         | 
| 17 | 
            +
            }>;
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            export type InjectableStyle = {
         | 
| 20 | 
            +
              readonly priority: number;
         | 
| 21 | 
            +
              readonly ltr: string;
         | 
| 22 | 
            +
              readonly rtl?: string;
         | 
| 23 | 
            +
            };
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            export type StyleRule = readonly [string, string, InjectableStyle];
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            export type CompiledStyles = {
         | 
| 28 | 
            +
              readonly [key: string]: string | { readonly [key: string]: string };
         | 
| 29 | 
            +
            };
         | 
| 30 | 
            +
            export type MutableCompiledStyles = {
         | 
| 31 | 
            +
              [key: string]: string | { [key: string]: string };
         | 
| 32 | 
            +
            };
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            export type CompiledNamespaces = { readonly [key: string]: CompiledStyles };
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            export type MutableCompiledNamespaces = {
         | 
| 37 | 
            +
              [key: string]: MutableCompiledStyles;
         | 
| 38 | 
            +
            };
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            export function create<N extends { readonly [key: string]: RawStyles }>(
         | 
| 41 | 
            +
              namespaces: N,
         | 
| 42 | 
            +
              options?: StyleXOptions
         | 
| 43 | 
            +
            ): readonly [CompiledNamespaces, { readonly [key: string]: InjectableStyle }];
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            export function keyframes<
         | 
| 46 | 
            +
              Obj extends {
         | 
| 47 | 
            +
                readonly [key: string]: { readonly [k: string]: string | number };
         | 
| 48 | 
            +
              }
         | 
| 49 | 
            +
            >(animation: Obj, options?: StyleXOptions): readonly [string, InjectableStyle];
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            export function include(animation: {
         | 
| 52 | 
            +
              readonly [key: string]: string | number;
         | 
| 53 | 
            +
            }): readonly { [key: string]: IncludedStyles };
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            export class IncludedStyles {
         | 
| 56 | 
            +
              astNode: any;
         | 
| 57 | 
            +
            }
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            export type StyleXOptions = {
         | 
| 60 | 
            +
              dev: boolean;
         | 
| 61 | 
            +
              test: boolean;
         | 
| 62 | 
            +
              stylexSheetName?: string | undefined;
         | 
| 63 | 
            +
              classNamePrefix: string;
         | 
| 64 | 
            +
              definedStylexCSSVariables?: { [key: string]: any };
         | 
| 65 | 
            +
              [key: string]: any;
         | 
| 66 | 
            +
            };
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            export function firstThatWorks<T>(...args: T[]): T[];
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            export const messages: {
         | 
| 71 | 
            +
              ILLEGAL_ARGUMENT_LENGTH: string;
         | 
| 72 | 
            +
              NON_STATIC_VALUE: string;
         | 
| 73 | 
            +
              ESCAPED_STYLEX_VALUE: string;
         | 
| 74 | 
            +
              UNBOUND_STYLEX_CALL_VALUE: string;
         | 
| 75 | 
            +
              ONLY_TOP_LEVEL: string;
         | 
| 76 | 
            +
              NON_OBJECT_FOR_STYLEX_CALL: string;
         | 
| 77 | 
            +
              UNKNOWN_PROP_KEY: string;
         | 
| 78 | 
            +
              INVALID_PSEUDO: string;
         | 
| 79 | 
            +
              ILLEGAL_NAMESPACE_TYPE: string;
         | 
| 80 | 
            +
              UNKNOWN_NAMESPACE: string;
         | 
| 81 | 
            +
              ILLEGAL_NESTED_PSEUDO: string;
         | 
| 82 | 
            +
              ILLEGAL_PROP_VALUE: string;
         | 
| 83 | 
            +
              ILLEGAL_PROP_ARRAY_VALUE: string;
         | 
| 84 | 
            +
              ILLEGAL_NAMESPACE_VALUE: string;
         | 
| 85 | 
            +
              INVALID_SPREAD: string;
         | 
| 86 | 
            +
              LINT_UNCLOSED_FUNCTION: string;
         | 
| 87 | 
            +
              LOCAL_ONLY: string;
         | 
| 88 | 
            +
              UNEXPECTED_ARGUMENT: string;
         | 
| 89 | 
            +
              EXPECTED_FUNCTION_CALL: string;
         | 
| 90 | 
            +
            };
         | 
    
        package/lib/index.js
    ADDED
    
    | @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 4 | 
            +
              value: true
         | 
| 5 | 
            +
            });
         | 
| 6 | 
            +
            exports.messages = exports.keyframes = exports.include = exports.firstThatWorks = exports.create = exports.IncludedStyles = void 0;
         | 
| 7 | 
            +
            var _stylexCreate = _interopRequireDefault(require("./stylex-create"));
         | 
| 8 | 
            +
            var _stylexKeyframes = _interopRequireDefault(require("./stylex-keyframes"));
         | 
| 9 | 
            +
            var _stylexInclude = _interopRequireWildcard(require("./stylex-include"));
         | 
| 10 | 
            +
            var _stylexFirstThatWorks = _interopRequireDefault(require("./stylex-first-that-works"));
         | 
| 11 | 
            +
            var m = _interopRequireWildcard(require("./messages"));
         | 
| 12 | 
            +
            function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
         | 
| 13 | 
            +
            function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
         | 
| 14 | 
            +
            function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
         | 
| 15 | 
            +
            /**
         | 
| 16 | 
            +
             * Copyright (c) Meta Platforms, Inc. and affiliates.
         | 
| 17 | 
            +
             *
         | 
| 18 | 
            +
             * This source code is licensed under the MIT license found in the
         | 
| 19 | 
            +
             * LICENSE file in the root directory of this source tree.
         | 
| 20 | 
            +
             *
         | 
| 21 | 
            +
             * 
         | 
| 22 | 
            +
             */
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            // All functions exposed from `stylex` are defined in a way that can be run
         | 
| 25 | 
            +
            // entirely in the browser.
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            // These are the implementations of those functions.
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            const create = _stylexCreate.default;
         | 
| 30 | 
            +
            exports.create = create;
         | 
| 31 | 
            +
            const keyframes = _stylexKeyframes.default;
         | 
| 32 | 
            +
            exports.keyframes = keyframes;
         | 
| 33 | 
            +
            const include = _stylexInclude.default;
         | 
| 34 | 
            +
            exports.include = include;
         | 
| 35 | 
            +
            const messages = m;
         | 
| 36 | 
            +
            exports.messages = messages;
         | 
| 37 | 
            +
            const IncludedStyles = _stylexInclude.IncludedStyles;
         | 
| 38 | 
            +
            exports.IncludedStyles = IncludedStyles;
         | 
| 39 | 
            +
            const firstThatWorks = _stylexFirstThatWorks.default;
         | 
| 40 | 
            +
            exports.firstThatWorks = firstThatWorks;
         | 
    
        package/lib/messages.js
    ADDED
    
    | @@ -0,0 +1,56 @@ | |
| 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 | 
            +
            'use strict';
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            // This file contains constants to be used within Error messages.
         | 
| 12 | 
            +
            // The URLs within will eventually be replaced by links to the documenation website for Stylex.
         | 
| 13 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 14 | 
            +
              value: true
         | 
| 15 | 
            +
            });
         | 
| 16 | 
            +
            exports.UNKNOWN_PROP_KEY = exports.UNKNOWN_NAMESPACE = exports.UNEXPECTED_ARGUMENT = exports.UNBOUND_STYLEX_CALL_VALUE = exports.ONLY_TOP_LEVEL = exports.NO_PARENT_PATH = exports.NON_STATIC_VALUE = exports.NON_OBJECT_FOR_STYLEX_CALL = exports.LOCAL_ONLY = exports.LINT_UNCLOSED_FUNCTION = exports.INVALID_SPREAD = exports.INVALID_PSEUDO = exports.ILLEGAL_PROP_VALUE = exports.ILLEGAL_PROP_ARRAY_VALUE = exports.ILLEGAL_NESTED_PSEUDO = exports.ILLEGAL_NAMESPACE_VALUE = exports.ILLEGAL_NAMESPACE_TYPE = exports.ILLEGAL_ARGUMENT_LENGTH = exports.EXPECTED_FUNCTION_CALL = exports.ESCAPED_STYLEX_VALUE = void 0;
         | 
| 17 | 
            +
            const ILLEGAL_ARGUMENT_LENGTH = 'stylex() should have 1 argument.';
         | 
| 18 | 
            +
            exports.ILLEGAL_ARGUMENT_LENGTH = ILLEGAL_ARGUMENT_LENGTH;
         | 
| 19 | 
            +
            const NON_STATIC_VALUE = 'Only static values are allowed inside of a stylex.create() call.';
         | 
| 20 | 
            +
            exports.NON_STATIC_VALUE = NON_STATIC_VALUE;
         | 
| 21 | 
            +
            const ESCAPED_STYLEX_VALUE = 'Escaping a stylex.create() value is not allowed.';
         | 
| 22 | 
            +
            exports.ESCAPED_STYLEX_VALUE = ESCAPED_STYLEX_VALUE;
         | 
| 23 | 
            +
            const UNBOUND_STYLEX_CALL_VALUE = 'stylex.create calls must be bound to a bare variable.';
         | 
| 24 | 
            +
            exports.UNBOUND_STYLEX_CALL_VALUE = UNBOUND_STYLEX_CALL_VALUE;
         | 
| 25 | 
            +
            const ONLY_TOP_LEVEL = 'stylex.create() is only allowed at the root of a program.';
         | 
| 26 | 
            +
            exports.ONLY_TOP_LEVEL = ONLY_TOP_LEVEL;
         | 
| 27 | 
            +
            const NON_OBJECT_FOR_STYLEX_CALL = 'stylex.create() can only accept a style object.';
         | 
| 28 | 
            +
            exports.NON_OBJECT_FOR_STYLEX_CALL = NON_OBJECT_FOR_STYLEX_CALL;
         | 
| 29 | 
            +
            const UNKNOWN_PROP_KEY = 'Unknown property key';
         | 
| 30 | 
            +
            exports.UNKNOWN_PROP_KEY = UNKNOWN_PROP_KEY;
         | 
| 31 | 
            +
            const INVALID_PSEUDO = 'Invalid pseudo selector, not on the whitelist.';
         | 
| 32 | 
            +
            exports.INVALID_PSEUDO = INVALID_PSEUDO;
         | 
| 33 | 
            +
            const ILLEGAL_NAMESPACE_TYPE = 'Only a string literal namespace is allowed here.';
         | 
| 34 | 
            +
            exports.ILLEGAL_NAMESPACE_TYPE = ILLEGAL_NAMESPACE_TYPE;
         | 
| 35 | 
            +
            const UNKNOWN_NAMESPACE = 'Unknown namespace';
         | 
| 36 | 
            +
            exports.UNKNOWN_NAMESPACE = UNKNOWN_NAMESPACE;
         | 
| 37 | 
            +
            const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested.";
         | 
| 38 | 
            +
            exports.ILLEGAL_NESTED_PSEUDO = ILLEGAL_NESTED_PSEUDO;
         | 
| 39 | 
            +
            const ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
         | 
| 40 | 
            +
            exports.ILLEGAL_PROP_VALUE = ILLEGAL_PROP_VALUE;
         | 
| 41 | 
            +
            const ILLEGAL_PROP_ARRAY_VALUE = 'A style array value can only contain strings or numbers.';
         | 
| 42 | 
            +
            exports.ILLEGAL_PROP_ARRAY_VALUE = ILLEGAL_PROP_ARRAY_VALUE;
         | 
| 43 | 
            +
            const ILLEGAL_NAMESPACE_VALUE = 'A stylex namespace must be an object.';
         | 
| 44 | 
            +
            exports.ILLEGAL_NAMESPACE_VALUE = ILLEGAL_NAMESPACE_VALUE;
         | 
| 45 | 
            +
            const INVALID_SPREAD = 'Imported styles spread with a stylex.create call must be type cast as `XStyle<>` to verify their type.';
         | 
| 46 | 
            +
            exports.INVALID_SPREAD = INVALID_SPREAD;
         | 
| 47 | 
            +
            const LINT_UNCLOSED_FUNCTION = 'Rule contains an unclosed function';
         | 
| 48 | 
            +
            exports.LINT_UNCLOSED_FUNCTION = LINT_UNCLOSED_FUNCTION;
         | 
| 49 | 
            +
            const LOCAL_ONLY = 'The return value of stylex.create() should not be exported.';
         | 
| 50 | 
            +
            exports.LOCAL_ONLY = LOCAL_ONLY;
         | 
| 51 | 
            +
            const UNEXPECTED_ARGUMENT = 'Unexpected argument passed to the stylex() function.';
         | 
| 52 | 
            +
            exports.UNEXPECTED_ARGUMENT = UNEXPECTED_ARGUMENT;
         | 
| 53 | 
            +
            const EXPECTED_FUNCTION_CALL = 'Expected a simple function call but found something else.';
         | 
| 54 | 
            +
            exports.EXPECTED_FUNCTION_CALL = EXPECTED_FUNCTION_CALL;
         | 
| 55 | 
            +
            const NO_PARENT_PATH = 'Unexpected AST node without a parent path.';
         | 
| 56 | 
            +
            exports.NO_PARENT_PATH = NO_PARENT_PATH;
         | 
| @@ -0,0 +1,135 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 4 | 
            +
              value: true
         | 
| 5 | 
            +
            });
         | 
| 6 | 
            +
            exports.default = generateLTR;
         | 
| 7 | 
            +
            /**
         | 
| 8 | 
            +
             * Copyright (c) Meta Platforms, Inc. and affiliates.
         | 
| 9 | 
            +
             *
         | 
| 10 | 
            +
             * This source code is licensed under the MIT license found in the
         | 
| 11 | 
            +
             * LICENSE file in the root directory of this source tree.
         | 
| 12 | 
            +
             *
         | 
| 13 | 
            +
             * 
         | 
| 14 | 
            +
             *
         | 
| 15 | 
            +
             */
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            const logicalToPhysical = {
         | 
| 18 | 
            +
              start: 'left',
         | 
| 19 | 
            +
              end: 'right'
         | 
| 20 | 
            +
            };
         | 
| 21 | 
            +
            const propertyToLTR = {
         | 
| 22 | 
            +
              'margin-start': _ref => {
         | 
| 23 | 
            +
                let [key, val] = _ref;
         | 
| 24 | 
            +
                return ['margin-left', val];
         | 
| 25 | 
            +
              },
         | 
| 26 | 
            +
              // 'margin-inline-start': ([key, val]) => ['margin-left', val],
         | 
| 27 | 
            +
              'margin-end': _ref2 => {
         | 
| 28 | 
            +
                let [key, val] = _ref2;
         | 
| 29 | 
            +
                return ['margin-right', val];
         | 
| 30 | 
            +
              },
         | 
| 31 | 
            +
              // 'margin-inline-end': ([key, val]: [string, string]) => ['margin-right', val],
         | 
| 32 | 
            +
              'padding-start': _ref3 => {
         | 
| 33 | 
            +
                let [key, val] = _ref3;
         | 
| 34 | 
            +
                return ['padding-left', val];
         | 
| 35 | 
            +
              },
         | 
| 36 | 
            +
              // 'padding-inline-start': ([key, val]: [string, string]) => ['padding-left', val],
         | 
| 37 | 
            +
              'padding-end': _ref4 => {
         | 
| 38 | 
            +
                let [key, val] = _ref4;
         | 
| 39 | 
            +
                return ['padding-right', val];
         | 
| 40 | 
            +
              },
         | 
| 41 | 
            +
              // 'padding-inline-end': ([key, val]: [string, string]) => ['padding-right', val],
         | 
| 42 | 
            +
              'border-start': _ref5 => {
         | 
| 43 | 
            +
                let [key, val] = _ref5;
         | 
| 44 | 
            +
                return ['border-left', val];
         | 
| 45 | 
            +
              },
         | 
| 46 | 
            +
              // 'border-inline-start': ([key, val]: [string, string]) => ['border-left', val],
         | 
| 47 | 
            +
              'border-end': _ref6 => {
         | 
| 48 | 
            +
                let [key, val] = _ref6;
         | 
| 49 | 
            +
                return ['border-right', val];
         | 
| 50 | 
            +
              },
         | 
| 51 | 
            +
              // 'border-inline-end': ([key, val]: [string, string]) => ['border-right', val],
         | 
| 52 | 
            +
              'border-start-width': _ref7 => {
         | 
| 53 | 
            +
                let [key, val] = _ref7;
         | 
| 54 | 
            +
                return ['border-left-width', val];
         | 
| 55 | 
            +
              },
         | 
| 56 | 
            +
              // 'border-inline-start-width': ([key, val]: [string, string]) => ['border-left-width', val],
         | 
| 57 | 
            +
              'border-end-width': _ref8 => {
         | 
| 58 | 
            +
                let [key, val] = _ref8;
         | 
| 59 | 
            +
                return ['border-right-width', val];
         | 
| 60 | 
            +
              },
         | 
| 61 | 
            +
              // 'border-inline-end-width': ([key, val]: [string, string]) => ['border-right-width', val],
         | 
| 62 | 
            +
              'border-start-color': _ref9 => {
         | 
| 63 | 
            +
                let [key, val] = _ref9;
         | 
| 64 | 
            +
                return ['border-left-color', val];
         | 
| 65 | 
            +
              },
         | 
| 66 | 
            +
              // 'border-inline-start-color': ([key, val]: [string, string]) => ['border-left-color', val],
         | 
| 67 | 
            +
              'border-end-color': _ref10 => {
         | 
| 68 | 
            +
                let [key, val] = _ref10;
         | 
| 69 | 
            +
                return ['border-right-color', val];
         | 
| 70 | 
            +
              },
         | 
| 71 | 
            +
              // 'border-inline-end-color': ([key, val]: [string, string]) => ['border-right-color', val],
         | 
| 72 | 
            +
              'border-start-style': _ref11 => {
         | 
| 73 | 
            +
                let [key, val] = _ref11;
         | 
| 74 | 
            +
                return ['border-left-style', val];
         | 
| 75 | 
            +
              },
         | 
| 76 | 
            +
              // 'border-inline-start-style': ([key, val]: [string, string]) => ['border-left-style', val],
         | 
| 77 | 
            +
              'border-end-style': _ref12 => {
         | 
| 78 | 
            +
                let [key, val] = _ref12;
         | 
| 79 | 
            +
                return ['border-right-style', val];
         | 
| 80 | 
            +
              },
         | 
| 81 | 
            +
              // 'border-inline-end-style': ([key, val]: [string, string]) => ['border-right-style', val],
         | 
| 82 | 
            +
              'border-top-start-radius': _ref13 => {
         | 
| 83 | 
            +
                let [key, val] = _ref13;
         | 
| 84 | 
            +
                return ['border-top-left-radius', val];
         | 
| 85 | 
            +
              },
         | 
| 86 | 
            +
              // 'border-start-start-radius': ([key, val]: [string, string]) => ['border-top-left-radius', val],
         | 
| 87 | 
            +
              'border-bottom-start-radius': _ref14 => {
         | 
| 88 | 
            +
                let [key, val] = _ref14;
         | 
| 89 | 
            +
                return ['border-bottom-left-radius', val];
         | 
| 90 | 
            +
              },
         | 
| 91 | 
            +
              // 'border-end-start-radius': ([key, val]: [string, string]) => ['border-bottom-left-radius', val],
         | 
| 92 | 
            +
              'border-top-end-radius': _ref15 => {
         | 
| 93 | 
            +
                let [key, val] = _ref15;
         | 
| 94 | 
            +
                return ['border-top-right-radius', val];
         | 
| 95 | 
            +
              },
         | 
| 96 | 
            +
              // 'border-start-end-radius': ([key, val]: [string, string]) => ['border-top-right-radius', val],
         | 
| 97 | 
            +
              'border-bottom-end-radius': _ref16 => {
         | 
| 98 | 
            +
                let [key, val] = _ref16;
         | 
| 99 | 
            +
                return ['border-bottom-right-radius', val];
         | 
| 100 | 
            +
              },
         | 
| 101 | 
            +
              // 'border-end-end-radius': ([key, val]: [string, string]) => ['border-bottom-right-radius', val],
         | 
| 102 | 
            +
              'text-align': _ref17 => {
         | 
| 103 | 
            +
                let [key, val] = _ref17;
         | 
| 104 | 
            +
                return [key, logicalToPhysical[val] ?? val];
         | 
| 105 | 
            +
              },
         | 
| 106 | 
            +
              float: _ref18 => {
         | 
| 107 | 
            +
                let [key, val] = _ref18;
         | 
| 108 | 
            +
                return [key, logicalToPhysical[val] ?? val];
         | 
| 109 | 
            +
              },
         | 
| 110 | 
            +
              clear: _ref19 => {
         | 
| 111 | 
            +
                let [key, val] = _ref19;
         | 
| 112 | 
            +
                return [key, logicalToPhysical[val] ?? val];
         | 
| 113 | 
            +
              },
         | 
| 114 | 
            +
              start: _ref20 => {
         | 
| 115 | 
            +
                let [key, val] = _ref20;
         | 
| 116 | 
            +
                return ['left', val];
         | 
| 117 | 
            +
              },
         | 
| 118 | 
            +
              // 'inset-inline-start': ([key, val]: [string, string]) => ['left', val],
         | 
| 119 | 
            +
              end: _ref21 => {
         | 
| 120 | 
            +
                let [key, val] = _ref21;
         | 
| 121 | 
            +
                return ['right', val];
         | 
| 122 | 
            +
              },
         | 
| 123 | 
            +
              // 'inset-inline-end': ([key, val]) => ['right', val],
         | 
| 124 | 
            +
              'background-position': _ref22 => {
         | 
| 125 | 
            +
                let [key, val] = _ref22;
         | 
| 126 | 
            +
                return [key, val.split(' ').map(word => word === 'start' ? 'left' : word === 'end' ? 'right' : word).join(' ')];
         | 
| 127 | 
            +
              }
         | 
| 128 | 
            +
            };
         | 
| 129 | 
            +
            function generateLTR(pair) {
         | 
| 130 | 
            +
              const [key] = pair;
         | 
| 131 | 
            +
              if (propertyToLTR[key]) {
         | 
| 132 | 
            +
                return propertyToLTR[key](pair);
         | 
| 133 | 
            +
              }
         | 
| 134 | 
            +
              return pair;
         | 
| 135 | 
            +
            }
         | 
| @@ -0,0 +1,216 @@ | |
| 1 | 
            +
            "use strict";
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 4 | 
            +
              value: true
         | 
| 5 | 
            +
            });
         | 
| 6 | 
            +
            exports.default = generateRTL;
         | 
| 7 | 
            +
            var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
         | 
| 8 | 
            +
            function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
         | 
| 9 | 
            +
            /**
         | 
| 10 | 
            +
             * Copyright (c) Meta Platforms, Inc. and affiliates.
         | 
| 11 | 
            +
             *
         | 
| 12 | 
            +
             * This source code is licensed under the MIT license found in the
         | 
| 13 | 
            +
             * LICENSE file in the root directory of this source tree.
         | 
| 14 | 
            +
             *
         | 
| 15 | 
            +
             * 
         | 
| 16 | 
            +
             *
         | 
| 17 | 
            +
             */
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            const cursorFlip = {
         | 
| 20 | 
            +
              'e-resize': 'w-resize',
         | 
| 21 | 
            +
              'w-resize': 'e-resize',
         | 
| 22 | 
            +
              'ne-resize': 'nw-resize',
         | 
| 23 | 
            +
              'nesw-resize': 'nwse-resize',
         | 
| 24 | 
            +
              'nw-resize': 'ne-resize',
         | 
| 25 | 
            +
              'nwse-resize': 'nesw-resize',
         | 
| 26 | 
            +
              'se-resize': 'sw-resize',
         | 
| 27 | 
            +
              'sw-resize': 'se-resize'
         | 
| 28 | 
            +
            };
         | 
| 29 | 
            +
            function splitByDivisor(value) {
         | 
| 30 | 
            +
              const ast = (0, _postcssValueParser.default)(value);
         | 
| 31 | 
            +
              const groups = [];
         | 
| 32 | 
            +
              let currGroup = [];
         | 
| 33 | 
            +
              function push() {
         | 
| 34 | 
            +
                if (currGroup.length === 0) {
         | 
| 35 | 
            +
                  return;
         | 
| 36 | 
            +
                }
         | 
| 37 | 
            +
                groups.push(_postcssValueParser.default.stringify(currGroup));
         | 
| 38 | 
            +
                currGroup = [];
         | 
| 39 | 
            +
              }
         | 
| 40 | 
            +
              for (const node of ast.nodes) {
         | 
| 41 | 
            +
                if (node.type === 'div') {
         | 
| 42 | 
            +
                  push();
         | 
| 43 | 
            +
                } else {
         | 
| 44 | 
            +
                  currGroup.push(node);
         | 
| 45 | 
            +
                }
         | 
| 46 | 
            +
              }
         | 
| 47 | 
            +
              push();
         | 
| 48 | 
            +
              return groups;
         | 
| 49 | 
            +
            }
         | 
| 50 | 
            +
            function flipSign(value) {
         | 
| 51 | 
            +
              if (value === '0') {
         | 
| 52 | 
            +
                return value;
         | 
| 53 | 
            +
              } else {
         | 
| 54 | 
            +
                return value[0] === '-' ? value.slice(1) : '-' + value;
         | 
| 55 | 
            +
              }
         | 
| 56 | 
            +
            }
         | 
| 57 | 
            +
            function flipShadow(value) {
         | 
| 58 | 
            +
              const defs = splitByDivisor(value);
         | 
| 59 | 
            +
              const builtDefs = [];
         | 
| 60 | 
            +
              for (const def of defs) {
         | 
| 61 | 
            +
                const parts = def.split(' ');
         | 
| 62 | 
            +
                const index = _postcssValueParser.default.unit(parts[0]) === false ? 1 : 0;
         | 
| 63 | 
            +
                if (index < parts.length) {
         | 
| 64 | 
            +
                  parts[index] = flipSign(parts[index]);
         | 
| 65 | 
            +
                }
         | 
| 66 | 
            +
                builtDefs.push(parts.join(' '));
         | 
| 67 | 
            +
              }
         | 
| 68 | 
            +
              const rtl = builtDefs.join(', ');
         | 
| 69 | 
            +
              if (rtl !== value) {
         | 
| 70 | 
            +
                return rtl;
         | 
| 71 | 
            +
              }
         | 
| 72 | 
            +
            }
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            // Should we be flipping shadows at all?
         | 
| 75 | 
            +
            // I think the better approach would be to let engineers use
         | 
| 76 | 
            +
            // CSS-vars directly.
         | 
| 77 | 
            +
            const shadowsFlip = {
         | 
| 78 | 
            +
              'box-shadow': _ref => {
         | 
| 79 | 
            +
                let [key, val] = _ref;
         | 
| 80 | 
            +
                const rtlVal = flipShadow(val);
         | 
| 81 | 
            +
                return rtlVal ? [key, rtlVal] : null;
         | 
| 82 | 
            +
              },
         | 
| 83 | 
            +
              'text-shadow': _ref2 => {
         | 
| 84 | 
            +
                let [key, val] = _ref2;
         | 
| 85 | 
            +
                const rtlVal = flipShadow(val);
         | 
| 86 | 
            +
                return rtlVal ? [key, rtlVal] : null;
         | 
| 87 | 
            +
              }
         | 
| 88 | 
            +
            };
         | 
| 89 | 
            +
            const logicalToPhysical = {
         | 
| 90 | 
            +
              start: 'right',
         | 
| 91 | 
            +
              end: 'left'
         | 
| 92 | 
            +
            };
         | 
| 93 | 
            +
            const propertyToRTL = {
         | 
| 94 | 
            +
              'margin-start': _ref3 => {
         | 
| 95 | 
            +
                let [key, val] = _ref3;
         | 
| 96 | 
            +
                return ['margin-right', val];
         | 
| 97 | 
            +
              },
         | 
| 98 | 
            +
              // 'margin-inline-start': ([key, val]: [string, string]) => ['margin-right', val],
         | 
| 99 | 
            +
              'margin-end': _ref4 => {
         | 
| 100 | 
            +
                let [key, val] = _ref4;
         | 
| 101 | 
            +
                return ['margin-left', val];
         | 
| 102 | 
            +
              },
         | 
| 103 | 
            +
              // 'margin-inline-end': ([key, val]: [string, string]) => ['margin-left', val],
         | 
| 104 | 
            +
              'padding-start': _ref5 => {
         | 
| 105 | 
            +
                let [key, val] = _ref5;
         | 
| 106 | 
            +
                return ['padding-right', val];
         | 
| 107 | 
            +
              },
         | 
| 108 | 
            +
              // 'padding-inline-start': ([key, val]: [string, string]) => ['padding-right', val],
         | 
| 109 | 
            +
              'padding-end': _ref6 => {
         | 
| 110 | 
            +
                let [key, val] = _ref6;
         | 
| 111 | 
            +
                return ['padding-left', val];
         | 
| 112 | 
            +
              },
         | 
| 113 | 
            +
              // 'padding-inline-end': ([key, val]: [string, string]) => ['padding-left', val],
         | 
| 114 | 
            +
              'border-start': _ref7 => {
         | 
| 115 | 
            +
                let [key, val] = _ref7;
         | 
| 116 | 
            +
                return ['border-right', val];
         | 
| 117 | 
            +
              },
         | 
| 118 | 
            +
              // 'border-inline-start': ([key, val]: [string, string]) => ['border-right', val],
         | 
| 119 | 
            +
              'border-end': _ref8 => {
         | 
| 120 | 
            +
                let [key, val] = _ref8;
         | 
| 121 | 
            +
                return ['border-left', val];
         | 
| 122 | 
            +
              },
         | 
| 123 | 
            +
              // 'border-inline-end': ([key, val]: [string, string]) => ['border-left', val],
         | 
| 124 | 
            +
              'border-start-width': _ref9 => {
         | 
| 125 | 
            +
                let [key, val] = _ref9;
         | 
| 126 | 
            +
                return ['border-right-width', val];
         | 
| 127 | 
            +
              },
         | 
| 128 | 
            +
              // 'border-inline-start-width': ([key, val]: [string, string]) => ['border-right-width', val],
         | 
| 129 | 
            +
              'border-end-width': _ref10 => {
         | 
| 130 | 
            +
                let [key, val] = _ref10;
         | 
| 131 | 
            +
                return ['border-left-width', val];
         | 
| 132 | 
            +
              },
         | 
| 133 | 
            +
              // 'border-inline-end-width': ([key, val]: [string, string]) => ['border-left-width', val],
         | 
| 134 | 
            +
              'border-start-color': _ref11 => {
         | 
| 135 | 
            +
                let [key, val] = _ref11;
         | 
| 136 | 
            +
                return ['border-right-color', val];
         | 
| 137 | 
            +
              },
         | 
| 138 | 
            +
              // 'border-inline-start-color': ([key, val]: [string, string]) => ['border-right-color', val],
         | 
| 139 | 
            +
              'border-end-color': _ref12 => {
         | 
| 140 | 
            +
                let [key, val] = _ref12;
         | 
| 141 | 
            +
                return ['border-left-color', val];
         | 
| 142 | 
            +
              },
         | 
| 143 | 
            +
              // 'border-inline-end-color': ([key, val]: [string, string]) => ['border-left-color', val],
         | 
| 144 | 
            +
              'border-start-style': _ref13 => {
         | 
| 145 | 
            +
                let [key, val] = _ref13;
         | 
| 146 | 
            +
                return ['border-right-style', val];
         | 
| 147 | 
            +
              },
         | 
| 148 | 
            +
              // 'border-inline-start-style': ([key, val]: [string, string]) => ['border-right-style', val],
         | 
| 149 | 
            +
              'border-end-style': _ref14 => {
         | 
| 150 | 
            +
                let [key, val] = _ref14;
         | 
| 151 | 
            +
                return ['border-left-style', val];
         | 
| 152 | 
            +
              },
         | 
| 153 | 
            +
              // 'border-inline-end-style': ([key, val]: [string, string]) => ['border-left-style', val],
         | 
| 154 | 
            +
              'border-top-start-radius': _ref15 => {
         | 
| 155 | 
            +
                let [key, val] = _ref15;
         | 
| 156 | 
            +
                return ['border-top-right-radius', val];
         | 
| 157 | 
            +
              },
         | 
| 158 | 
            +
              // 'border-start-start-radius': ([key, val]: [string, string]) => ['border-top-right-radius', val],
         | 
| 159 | 
            +
              'border-bottom-start-radius': _ref16 => {
         | 
| 160 | 
            +
                let [key, val] = _ref16;
         | 
| 161 | 
            +
                return ['border-bottom-right-radius', val];
         | 
| 162 | 
            +
              },
         | 
| 163 | 
            +
              // 'border-end-start-radius': ([key, val]: [string, string]) => ['border-bottom-right-radius', val],
         | 
| 164 | 
            +
              'border-top-end-radius': _ref17 => {
         | 
| 165 | 
            +
                let [key, val] = _ref17;
         | 
| 166 | 
            +
                return ['border-top-left-radius', val];
         | 
| 167 | 
            +
              },
         | 
| 168 | 
            +
              // 'border-start-end-radius': ([key, val]: [string, string]) => ['border-top-left-radius', val],
         | 
| 169 | 
            +
              'border-bottom-end-radius': _ref18 => {
         | 
| 170 | 
            +
                let [key, val] = _ref18;
         | 
| 171 | 
            +
                return ['border-bottom-left-radius', val];
         | 
| 172 | 
            +
              },
         | 
| 173 | 
            +
              // 'border-end-end-radius': ([key, val]: [string, string]) => ['border-bottom-left-radius', val],
         | 
| 174 | 
            +
              'text-align': _ref19 => {
         | 
| 175 | 
            +
                let [key, val] = _ref19;
         | 
| 176 | 
            +
                return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
         | 
| 177 | 
            +
              },
         | 
| 178 | 
            +
              float: _ref20 => {
         | 
| 179 | 
            +
                let [key, val] = _ref20;
         | 
| 180 | 
            +
                return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
         | 
| 181 | 
            +
              },
         | 
| 182 | 
            +
              clear: _ref21 => {
         | 
| 183 | 
            +
                let [key, val] = _ref21;
         | 
| 184 | 
            +
                return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
         | 
| 185 | 
            +
              },
         | 
| 186 | 
            +
              start: _ref22 => {
         | 
| 187 | 
            +
                let [key, val] = _ref22;
         | 
| 188 | 
            +
                return ['right', val];
         | 
| 189 | 
            +
              },
         | 
| 190 | 
            +
              // 'inset-inline-start': ([key, val]: [string, string]) => ['right', val],
         | 
| 191 | 
            +
              end: _ref23 => {
         | 
| 192 | 
            +
                let [key, val] = _ref23;
         | 
| 193 | 
            +
                return ['left', val];
         | 
| 194 | 
            +
              },
         | 
| 195 | 
            +
              // 'inset-inline-end': ([key, val]: [string, string]) => ['left', val],
         | 
| 196 | 
            +
              'background-position': _ref24 => {
         | 
| 197 | 
            +
                let [key, val] = _ref24;
         | 
| 198 | 
            +
                const words = val.split(' ');
         | 
| 199 | 
            +
                if (!words.includes('start') && !words.includes('end')) {
         | 
| 200 | 
            +
                  return null;
         | 
| 201 | 
            +
                }
         | 
| 202 | 
            +
                return [key, words.map(word => word === 'start' ? 'right' : word === 'end' ? 'left' : word).join(' ')];
         | 
| 203 | 
            +
              },
         | 
| 204 | 
            +
              cursor: _ref25 => {
         | 
| 205 | 
            +
                let [key, val] = _ref25;
         | 
| 206 | 
            +
                return cursorFlip[val] != null ? [key, cursorFlip[val]] : null;
         | 
| 207 | 
            +
              },
         | 
| 208 | 
            +
              ...shadowsFlip
         | 
| 209 | 
            +
            };
         | 
| 210 | 
            +
            function generateRTL(_ref26) {
         | 
| 211 | 
            +
              let [key, value] = _ref26;
         | 
| 212 | 
            +
              if (propertyToRTL[key]) {
         | 
| 213 | 
            +
                return propertyToRTL[key]([key, value]);
         | 
| 214 | 
            +
              }
         | 
| 215 | 
            +
              return null;
         | 
| 216 | 
            +
            }
         |