react-native-css 2.1.1 → 3.0.0-nightly.4723140
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/{LICENSE.md → LICENSE} +6 -8
- package/README.md +10 -86
- package/dist/commonjs/babel/helpers.js +129 -0
- package/dist/commonjs/babel/helpers.js.map +1 -0
- package/dist/commonjs/babel/import-plugin.js +97 -0
- package/dist/commonjs/babel/import-plugin.js.map +1 -0
- package/dist/commonjs/babel/index.js +9 -0
- package/dist/commonjs/babel/index.js.map +1 -0
- package/dist/commonjs/compiler/add.js +175 -0
- package/dist/commonjs/compiler/add.js.map +1 -0
- package/dist/commonjs/compiler/compiler.js +466 -0
- package/dist/commonjs/compiler/compiler.js.map +1 -0
- package/dist/commonjs/compiler/compiler.types.js +4 -0
- package/dist/commonjs/compiler/compiler.types.js.map +1 -0
- package/dist/commonjs/compiler/container-query.js +63 -0
- package/dist/commonjs/compiler/container-query.js.map +1 -0
- package/dist/commonjs/compiler/declarations.js +1843 -0
- package/dist/commonjs/compiler/declarations.js.map +1 -0
- package/dist/commonjs/compiler/functions-web.js +44 -0
- package/dist/commonjs/compiler/functions-web.js.map +1 -0
- package/dist/commonjs/compiler/functions.js +59 -0
- package/dist/commonjs/compiler/functions.js.map +1 -0
- package/dist/commonjs/compiler/index.js +17 -0
- package/dist/commonjs/compiler/index.js.map +1 -0
- package/dist/commonjs/compiler/keyframes.js +69 -0
- package/dist/commonjs/compiler/keyframes.js.map +1 -0
- package/dist/commonjs/compiler/media-query.js +172 -0
- package/dist/commonjs/compiler/media-query.js.map +1 -0
- package/dist/commonjs/compiler/selectors.js +330 -0
- package/dist/commonjs/compiler/selectors.js.map +1 -0
- package/dist/commonjs/components/ActivityIndicator.js +20 -0
- package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
- package/dist/commonjs/components/SafeAreaProvider/index.js +41 -0
- package/dist/commonjs/components/SafeAreaProvider/index.js.map +1 -0
- package/dist/commonjs/components/SafeAreaProvider/index.web.js +13 -0
- package/dist/commonjs/components/SafeAreaProvider/index.web.js.map +1 -0
- package/dist/commonjs/components/Text.js +15 -0
- package/dist/commonjs/components/Text.js.map +1 -0
- package/dist/commonjs/components/TextInput.js +20 -0
- package/dist/commonjs/components/TextInput.js.map +1 -0
- package/dist/commonjs/components/View.js +15 -0
- package/dist/commonjs/components/View.js.map +1 -0
- package/dist/commonjs/components/index.js +36 -0
- package/dist/commonjs/components/index.js.map +1 -0
- package/dist/commonjs/doctor/index.js +6 -0
- package/dist/commonjs/doctor/index.js.map +1 -0
- package/dist/commonjs/index.js +17 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/jest/expect.d.js +2 -0
- package/dist/commonjs/jest/expect.d.js.map +1 -0
- package/dist/commonjs/jest/index.js +49 -0
- package/dist/commonjs/jest/index.js.map +1 -0
- package/dist/commonjs/jest/setup.js +3 -0
- package/dist/commonjs/jest/setup.js.map +1 -0
- package/dist/commonjs/jest/setupAfterEnv.js +15 -0
- package/dist/commonjs/jest/setupAfterEnv.js.map +1 -0
- package/dist/commonjs/metro/index.js +106 -0
- package/dist/commonjs/metro/index.js.map +1 -0
- package/dist/commonjs/metro/injection-code.js +12 -0
- package/dist/commonjs/metro/injection-code.js.map +1 -0
- package/dist/commonjs/metro/metro-transformer.js +21 -0
- package/dist/commonjs/metro/metro-transformer.js.map +1 -0
- package/dist/commonjs/metro/picocolors.js +71 -0
- package/dist/commonjs/metro/picocolors.js.map +1 -0
- package/dist/commonjs/metro/stringify.js +59 -0
- package/dist/commonjs/metro/stringify.js.map +1 -0
- package/dist/commonjs/metro/typescript.js +47 -0
- package/dist/commonjs/metro/typescript.js.map +1 -0
- package/dist/commonjs/package.json +1 -0
- package/dist/commonjs/runtime/index.js +17 -0
- package/dist/commonjs/runtime/index.js.map +1 -0
- package/dist/commonjs/runtime/native/api.js +90 -0
- package/dist/commonjs/runtime/native/api.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js +116 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/guards.js +27 -0
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/index.js +74 -0
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/media-query.js +91 -0
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -0
- package/dist/commonjs/runtime/native/index.js +18 -0
- package/dist/commonjs/runtime/native/index.js.map +1 -0
- package/dist/commonjs/runtime/native/injection.js +80 -0
- package/dist/commonjs/runtime/native/injection.js.map +1 -0
- package/dist/commonjs/runtime/native/metro.js +6 -0
- package/dist/commonjs/runtime/native/metro.js.map +1 -0
- package/dist/commonjs/runtime/native/react/interaction.js +63 -0
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -0
- package/dist/commonjs/runtime/native/react/rules.js +257 -0
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -0
- package/dist/commonjs/runtime/native/react/useNativeCss.js +158 -0
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -0
- package/dist/commonjs/runtime/native/react/usePassthrough.js +50 -0
- package/dist/commonjs/runtime/native/react/usePassthrough.js.map +1 -0
- package/dist/commonjs/runtime/native/reactivity.js +193 -0
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/animation.js +90 -0
- package/dist/commonjs/runtime/native/styles/animation.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calc.js +113 -0
- package/dist/commonjs/runtime/native/styles/calc.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/constants.js +8 -0
- package/dist/commonjs/runtime/native/styles/constants.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/defaults.js +69 -0
- package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +223 -0
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/resolve.js +96 -0
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthand.js +62 -0
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/text-shadow.js +13 -0
- package/dist/commonjs/runtime/native/styles/text-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/transform.js +17 -0
- package/dist/commonjs/runtime/native/styles/transform.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/units.js +46 -0
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/variables.js +57 -0
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -0
- package/dist/commonjs/runtime/runtime.js +17 -0
- package/dist/commonjs/runtime/runtime.js.map +1 -0
- package/dist/commonjs/runtime/runtime.native.js +17 -0
- package/dist/commonjs/runtime/runtime.native.js.map +1 -0
- package/dist/commonjs/runtime/runtime.types.js +6 -0
- package/dist/commonjs/runtime/runtime.types.js.map +1 -0
- package/dist/commonjs/runtime/utils/components.js +18 -0
- package/dist/commonjs/runtime/utils/components.js.map +1 -0
- package/dist/commonjs/runtime/utils/dot-notation.types.js +2 -0
- package/dist/commonjs/runtime/utils/dot-notation.types.js.map +1 -0
- package/dist/commonjs/runtime/utils/index.js +61 -0
- package/dist/commonjs/runtime/utils/index.js.map +1 -0
- package/dist/commonjs/runtime/utils/objects.js +71 -0
- package/dist/commonjs/runtime/utils/objects.js.map +1 -0
- package/dist/commonjs/runtime/utils/specificity.js +43 -0
- package/dist/commonjs/runtime/utils/specificity.js.map +1 -0
- package/dist/commonjs/runtime/utils/style-value.js +14 -0
- package/dist/commonjs/runtime/utils/style-value.js.map +1 -0
- package/dist/commonjs/runtime/utils/utils.types.js +6 -0
- package/dist/commonjs/runtime/utils/utils.types.js.map +1 -0
- package/dist/commonjs/runtime/web/api.js +68 -0
- package/dist/commonjs/runtime/web/api.js.map +1 -0
- package/dist/commonjs/runtime/web/assign-style.js +27 -0
- package/dist/commonjs/runtime/web/assign-style.js.map +1 -0
- package/dist/commonjs/runtime/web/index.js +17 -0
- package/dist/commonjs/runtime/web/index.js.map +1 -0
- package/dist/module/babel/helpers.js +120 -0
- package/dist/module/babel/helpers.js.map +1 -0
- package/dist/module/babel/import-plugin.js +93 -0
- package/dist/module/babel/import-plugin.js.map +1 -0
- package/dist/module/babel/index.js +9 -0
- package/dist/module/babel/index.js.map +1 -0
- package/dist/module/compiler/add.js +168 -0
- package/dist/module/compiler/add.js.map +1 -0
- package/dist/module/compiler/compiler.js +461 -0
- package/dist/module/compiler/compiler.js.map +1 -0
- package/dist/module/compiler/compiler.types.js +72 -0
- package/dist/module/compiler/compiler.types.js.map +1 -0
- package/dist/module/compiler/container-query.js +59 -0
- package/dist/module/compiler/container-query.js.map +1 -0
- package/dist/module/compiler/declarations.js +1834 -0
- package/dist/module/compiler/declarations.js.map +1 -0
- package/dist/module/compiler/functions-web.js +32 -0
- package/dist/module/compiler/functions-web.js.map +1 -0
- package/dist/module/compiler/functions.js +47 -0
- package/dist/module/compiler/functions.js.map +1 -0
- package/dist/module/compiler/index.js +9 -0
- package/dist/module/compiler/index.js.map +1 -0
- package/dist/module/compiler/keyframes.js +63 -0
- package/dist/module/compiler/keyframes.js.map +1 -0
- package/dist/module/compiler/media-query.js +166 -0
- package/dist/module/compiler/media-query.js.map +1 -0
- package/dist/module/compiler/selectors.js +325 -0
- package/dist/module/compiler/selectors.js.map +1 -0
- package/dist/module/components/ActivityIndicator.js +16 -0
- package/dist/module/components/ActivityIndicator.js.map +1 -0
- package/dist/module/components/SafeAreaProvider/index.js +36 -0
- package/dist/module/components/SafeAreaProvider/index.js.map +1 -0
- package/dist/module/components/SafeAreaProvider/index.web.js +4 -0
- package/dist/module/components/SafeAreaProvider/index.web.js.map +1 -0
- package/dist/module/components/Text.js +11 -0
- package/dist/module/components/Text.js.map +1 -0
- package/dist/module/components/TextInput.js +16 -0
- package/dist/module/components/TextInput.js.map +1 -0
- package/dist/module/components/View.js +11 -0
- package/dist/module/components/View.js.map +1 -0
- package/dist/module/components/index.js +6 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/doctor/index.js +4 -0
- package/dist/module/doctor/index.js.map +1 -0
- package/dist/module/index.js +4 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/jest/expect.d.js +2 -0
- package/dist/module/jest/expect.d.js.map +1 -0
- package/dist/module/jest/index.js +28 -0
- package/dist/module/jest/index.js.map +1 -0
- package/dist/module/jest/setup.js +3 -0
- package/dist/module/jest/setup.js.map +1 -0
- package/dist/module/jest/setupAfterEnv.js +15 -0
- package/dist/module/jest/setupAfterEnv.js.map +1 -0
- package/dist/module/metro/index.js +100 -0
- package/dist/module/metro/index.js.map +1 -0
- package/dist/module/metro/injection-code.js +8 -0
- package/dist/module/metro/injection-code.js.map +1 -0
- package/dist/module/metro/metro-transformer.js +17 -0
- package/dist/module/metro/metro-transformer.js.map +1 -0
- package/dist/module/metro/picocolors.js +67 -0
- package/dist/module/metro/picocolors.js.map +1 -0
- package/dist/module/metro/stringify.js +55 -0
- package/dist/module/metro/stringify.js.map +1 -0
- package/dist/module/metro/typescript.js +42 -0
- package/dist/module/metro/typescript.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/runtime/index.js +9 -0
- package/dist/module/runtime/index.js.map +1 -0
- package/dist/module/runtime/native/api.js +75 -0
- package/dist/module/runtime/native/api.js.map +1 -0
- package/dist/module/runtime/native/conditions/container-query.js +110 -0
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -0
- package/dist/module/runtime/native/conditions/guards.js +23 -0
- package/dist/module/runtime/native/conditions/guards.js.map +1 -0
- package/dist/module/runtime/native/conditions/index.js +70 -0
- package/dist/module/runtime/native/conditions/index.js.map +1 -0
- package/dist/module/runtime/native/conditions/media-query.js +86 -0
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -0
- package/dist/module/runtime/native/index.js +6 -0
- package/dist/module/runtime/native/index.js.map +1 -0
- package/dist/module/runtime/native/injection.js +75 -0
- package/dist/module/runtime/native/injection.js.map +1 -0
- package/dist/module/runtime/native/metro.js +5 -0
- package/dist/module/runtime/native/metro.js.map +1 -0
- package/dist/module/runtime/native/react/interaction.js +59 -0
- package/dist/module/runtime/native/react/interaction.js.map +1 -0
- package/dist/module/runtime/native/react/rules.js +251 -0
- package/dist/module/runtime/native/react/rules.js.map +1 -0
- package/dist/module/runtime/native/react/useNativeCss.js +152 -0
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -0
- package/dist/module/runtime/native/react/usePassthrough.js +45 -0
- package/dist/module/runtime/native/react/usePassthrough.js.map +1 -0
- package/dist/module/runtime/native/reactivity.js +181 -0
- package/dist/module/runtime/native/reactivity.js.map +1 -0
- package/dist/module/runtime/native/styles/animation.js +85 -0
- package/dist/module/runtime/native/styles/animation.js.map +1 -0
- package/dist/module/runtime/native/styles/calc.js +108 -0
- package/dist/module/runtime/native/styles/calc.js.map +1 -0
- package/dist/module/runtime/native/styles/constants.js +4 -0
- package/dist/module/runtime/native/styles/constants.js.map +1 -0
- package/dist/module/runtime/native/styles/defaults.js +65 -0
- package/dist/module/runtime/native/styles/defaults.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +218 -0
- package/dist/module/runtime/native/styles/index.js.map +1 -0
- package/dist/module/runtime/native/styles/resolve.js +92 -0
- package/dist/module/runtime/native/styles/resolve.js.map +1 -0
- package/dist/module/runtime/native/styles/shorthand.js +57 -0
- package/dist/module/runtime/native/styles/shorthand.js.map +1 -0
- package/dist/module/runtime/native/styles/text-shadow.js +9 -0
- package/dist/module/runtime/native/styles/text-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/transform.js +12 -0
- package/dist/module/runtime/native/styles/transform.js.map +1 -0
- package/dist/module/runtime/native/styles/units.js +37 -0
- package/dist/module/runtime/native/styles/units.js.map +1 -0
- package/dist/module/runtime/native/styles/variables.js +53 -0
- package/dist/module/runtime/native/styles/variables.js.map +1 -0
- package/dist/module/runtime/runtime.js +4 -0
- package/dist/module/runtime/runtime.js.map +1 -0
- package/dist/module/runtime/runtime.native.js +4 -0
- package/dist/module/runtime/runtime.native.js.map +1 -0
- package/dist/module/runtime/runtime.types.js +4 -0
- package/dist/module/runtime/runtime.types.js.map +1 -0
- package/dist/module/runtime/utils/components.js +14 -0
- package/dist/module/runtime/utils/components.js.map +1 -0
- package/dist/module/runtime/utils/dot-notation.types.js +2 -0
- package/dist/module/runtime/utils/dot-notation.types.js.map +1 -0
- package/dist/module/runtime/utils/index.js +8 -0
- package/dist/module/runtime/utils/index.js.map +1 -0
- package/dist/module/runtime/utils/objects.js +64 -0
- package/dist/module/runtime/utils/objects.js.map +1 -0
- package/dist/module/runtime/utils/specificity.js +38 -0
- package/dist/module/runtime/utils/specificity.js.map +1 -0
- package/dist/module/runtime/utils/style-value.js +10 -0
- package/dist/module/runtime/utils/style-value.js.map +1 -0
- package/dist/module/runtime/utils/utils.types.js +4 -0
- package/dist/module/runtime/utils/utils.types.js.map +1 -0
- package/dist/module/runtime/web/api.js +59 -0
- package/dist/module/runtime/web/api.js.map +1 -0
- package/dist/module/runtime/web/assign-style.js +23 -0
- package/dist/module/runtime/web/assign-style.js.map +1 -0
- package/dist/module/runtime/web/index.js +4 -0
- package/dist/module/runtime/web/index.js.map +1 -0
- package/dist/typescript/commonjs/example/src/App.d.ts +3 -0
- package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/commonjs/src/babel/helpers.d.ts +18 -0
- package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts +6 -0
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/babel/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/add.d.ts +10 -0
- package/dist/typescript/commonjs/src/compiler/add.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +10 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +279 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts +5 -0
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +28 -0
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/functions-web.d.ts +11 -0
- package/dist/typescript/commonjs/src/compiler/functions-web.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/functions.d.ts +11 -0
- package/dist/typescript/commonjs/src/compiler/functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/index.d.ts +7 -0
- package/dist/typescript/commonjs/src/compiler/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts +6 -0
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +7 -0
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +18 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +3 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts +2 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Text.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +13 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/View.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/doctor/index.d.ts +2 -0
- package/dist/typescript/commonjs/src/doctor/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/index.d.ts +2 -0
- package/dist/typescript/commonjs/src/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/index.d.ts +14 -0
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/setup.d.ts +1 -0
- package/dist/typescript/commonjs/src/jest/setup.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/setupAfterEnv.d.ts +1 -0
- package/dist/typescript/commonjs/src/jest/setupAfterEnv.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts +10 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +2 -0
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +3 -0
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/picocolors.d.ts +27 -0
- package/dist/typescript/commonjs/src/metro/picocolors.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/stringify.d.ts +7 -0
- package/dist/typescript/commonjs/src/metro/stringify.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/typescript.d.ts +2 -0
- package/dist/typescript/commonjs/src/metro/typescript.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/index.d.ts +7 -0
- package/dist/typescript/commonjs/src/runtime/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +17 -0
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +7 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts +16 -0
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/metro.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/metro.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +37 -0
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/usePassthrough.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/react/usePassthrough.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +63 -0
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts +20 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts +14 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts +12 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts +7 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/runtime.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/runtime.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/runtime.native.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/runtime.native.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts +62 -0
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/components.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/utils/components.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/dot-notation.types.d.ts +23 -0
- package/dist/typescript/commonjs/src/runtime/utils/dot-notation.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/utils/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +12 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/utils.types.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/utils/utils.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts +10 -0
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/web/assign-style.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/web/assign-style.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts.map +1 -0
- package/dist/typescript/module/example/src/App.d.ts +3 -0
- package/dist/typescript/module/example/src/App.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/dist/typescript/module/src/babel/helpers.d.ts +18 -0
- package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/import-plugin.d.ts +6 -0
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/index.d.ts +1 -0
- package/dist/typescript/module/src/babel/index.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/add.d.ts +10 -0
- package/dist/typescript/module/src/compiler/add.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts +10 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +279 -0
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/container-query.d.ts +5 -0
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/declarations.d.ts +28 -0
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/functions-web.d.ts +11 -0
- package/dist/typescript/module/src/compiler/functions-web.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/functions.d.ts +11 -0
- package/dist/typescript/module/src/compiler/functions.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/index.d.ts +7 -0
- package/dist/typescript/module/src/compiler/index.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/keyframes.d.ts +6 -0
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/media-query.d.ts +7 -0
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts +18 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +3 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts +4 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts.map +1 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts +2 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Text.d.ts +8 -0
- package/dist/typescript/module/src/components/Text.d.ts.map +1 -0
- package/dist/typescript/module/src/components/TextInput.d.ts +13 -0
- package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/module/src/components/View.d.ts +8 -0
- package/dist/typescript/module/src/components/View.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts +4 -0
- package/dist/typescript/module/src/components/index.d.ts.map +1 -0
- package/dist/typescript/module/src/doctor/index.d.ts +2 -0
- package/dist/typescript/module/src/doctor/index.d.ts.map +1 -0
- package/dist/typescript/module/src/index.d.ts +2 -0
- package/dist/typescript/module/src/index.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/index.d.ts +14 -0
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/setup.d.ts +1 -0
- package/dist/typescript/module/src/jest/setup.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/setupAfterEnv.d.ts +1 -0
- package/dist/typescript/module/src/jest/setupAfterEnv.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/index.d.ts +10 -0
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/injection-code.d.ts +2 -0
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +3 -0
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/picocolors.d.ts +27 -0
- package/dist/typescript/module/src/metro/picocolors.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/stringify.d.ts +7 -0
- package/dist/typescript/module/src/metro/stringify.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/typescript.d.ts +2 -0
- package/dist/typescript/module/src/metro/typescript.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/index.d.ts +7 -0
- package/dist/typescript/module/src/runtime/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/api.d.ts +17 -0
- package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +7 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/index.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/injection.d.ts +16 -0
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/metro.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/metro.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +37 -0
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/usePassthrough.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/react/usePassthrough.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +63 -0
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts +20 -0
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts +14 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts +12 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts +7 -0
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/runtime.d.ts +2 -0
- package/dist/typescript/module/src/runtime/runtime.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/runtime.native.d.ts +2 -0
- package/dist/typescript/module/src/runtime/runtime.native.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/runtime.types.d.ts +62 -0
- package/dist/typescript/module/src/runtime/runtime.types.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/components.d.ts +2 -0
- package/dist/typescript/module/src/runtime/utils/components.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/dot-notation.types.d.ts +23 -0
- package/dist/typescript/module/src/runtime/utils/dot-notation.types.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/index.d.ts +6 -0
- package/dist/typescript/module/src/runtime/utils/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/objects.d.ts +4 -0
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts +12 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts +3 -0
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/utils.types.d.ts +5 -0
- package/dist/typescript/module/src/runtime/utils/utils.types.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/web/api.d.ts +10 -0
- package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/web/assign-style.d.ts +2 -0
- package/dist/typescript/module/src/runtime/web/assign-style.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/web/index.d.ts +3 -0
- package/dist/typescript/module/src/runtime/web/index.d.ts.map +1 -0
- package/package.json +191 -45
- package/src/babel/helpers.ts +182 -0
- package/src/babel/import-plugin.ts +183 -0
- package/src/babel/index.ts +9 -0
- package/src/compiler/add.ts +257 -0
- package/src/compiler/compiler.ts +627 -0
- package/src/compiler/compiler.types.ts +372 -0
- package/src/compiler/container-query.ts +97 -0
- package/src/compiler/declarations.ts +3146 -0
- package/src/compiler/functions-web.ts +44 -0
- package/src/compiler/functions.ts +64 -0
- package/src/compiler/index.ts +7 -0
- package/src/compiler/keyframes.ts +100 -0
- package/src/compiler/media-query.ts +250 -0
- package/src/compiler/selectors.ts +473 -0
- package/src/components/ActivityIndicator.tsx +19 -0
- package/src/components/SafeAreaProvider/index.tsx +50 -0
- package/src/components/SafeAreaProvider/index.web.tsx +1 -0
- package/src/components/Text.tsx +15 -0
- package/src/components/TextInput.tsx +20 -0
- package/src/components/View.tsx +15 -0
- package/src/components/index.tsx +4 -0
- package/src/doctor/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/jest/expect.d.ts +1 -0
- package/src/jest/index.ts +40 -0
- package/src/jest/setup.ts +1 -0
- package/src/jest/setupAfterEnv.ts +13 -0
- package/src/metro/index.ts +137 -0
- package/src/metro/injection-code.ts +8 -0
- package/src/metro/metro-transformer.ts +31 -0
- package/src/metro/picocolors.ts +77 -0
- package/src/metro/stringify.ts +59 -0
- package/src/metro/typescript.ts +73 -0
- package/src/runtime/index.ts +7 -0
- package/src/runtime/native/api.ts +106 -0
- package/src/runtime/native/conditions/container-query.ts +157 -0
- package/src/runtime/native/conditions/guards.ts +37 -0
- package/src/runtime/native/conditions/index.ts +106 -0
- package/src/runtime/native/conditions/media-query.ts +92 -0
- package/src/runtime/native/index.ts +5 -0
- package/src/runtime/native/injection.ts +101 -0
- package/src/runtime/native/metro.ts +2 -0
- package/src/runtime/native/react/interaction.ts +90 -0
- package/src/runtime/native/react/rules.ts +333 -0
- package/src/runtime/native/react/useNativeCss.ts +200 -0
- package/src/runtime/native/react/usePassthrough.ts +51 -0
- package/src/runtime/native/reactivity.ts +266 -0
- package/src/runtime/native/styles/animation.ts +142 -0
- package/src/runtime/native/styles/calc.ts +120 -0
- package/src/runtime/native/styles/constants.ts +1 -0
- package/src/runtime/native/styles/defaults.ts +78 -0
- package/src/runtime/native/styles/index.ts +333 -0
- package/src/runtime/native/styles/resolve.ts +131 -0
- package/src/runtime/native/styles/shorthand.ts +101 -0
- package/src/runtime/native/styles/text-shadow.ts +17 -0
- package/src/runtime/native/styles/transform.ts +15 -0
- package/src/runtime/native/styles/units.ts +48 -0
- package/src/runtime/native/styles/variables.ts +72 -0
- package/src/runtime/runtime.native.ts +1 -0
- package/src/runtime/runtime.ts +1 -0
- package/src/runtime/runtime.types.ts +155 -0
- package/src/runtime/utils/components.ts +15 -0
- package/src/runtime/utils/dot-notation.types.ts +118 -0
- package/src/runtime/utils/index.ts +5 -0
- package/src/runtime/utils/objects.ts +82 -0
- package/src/runtime/utils/specificity.ts +44 -0
- package/src/runtime/utils/style-value.ts +12 -0
- package/src/runtime/utils/utils.types.ts +19 -0
- package/src/runtime/web/api.ts +88 -0
- package/src/runtime/web/assign-style.ts +26 -0
- package/src/runtime/web/index.ts +2 -0
- package/.babelrc +0 -8
- package/.editorconfig +0 -17
- package/.eslintignore +0 -3
- package/.eslintrc +0 -39
- package/.npmignore +0 -7
- package/build/index.js +0 -294
- package/build/utils.js +0 -54
- package/circle.yml +0 -31
- package/jsconfig.json +0 -9
- package/login.sh +0 -11
- package/src/index.js +0 -184
- package/src/utils.js +0 -32
- package/test/rnc.test.js +0 -258
- package/yarn.lock +0 -3333
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { debug } from "debug";
|
|
3
|
+
import {
|
|
4
|
+
transform as lightningcss,
|
|
5
|
+
type ContainerRule,
|
|
6
|
+
type MediaQuery as CSSMediaQuery,
|
|
7
|
+
type Declaration,
|
|
8
|
+
type DeclarationBlock,
|
|
9
|
+
type MediaRule,
|
|
10
|
+
type ParsedComponent,
|
|
11
|
+
type Rule,
|
|
12
|
+
type SelectorList,
|
|
13
|
+
type TokenOrValue,
|
|
14
|
+
} from "lightningcss";
|
|
15
|
+
|
|
16
|
+
import { Specificity } from "../runtime/utils/specificity";
|
|
17
|
+
import { buildAddFn } from "./add";
|
|
18
|
+
import type {
|
|
19
|
+
AnimationKeyframes_V2,
|
|
20
|
+
CompilerCollection,
|
|
21
|
+
CompilerOptions,
|
|
22
|
+
ContainerQuery,
|
|
23
|
+
MediaCondition,
|
|
24
|
+
ReactNativeCssStyleSheet,
|
|
25
|
+
SpecificityArray,
|
|
26
|
+
StyleRule,
|
|
27
|
+
StyleRuleMapping,
|
|
28
|
+
StyleRuleSet,
|
|
29
|
+
} from "./compiler.types";
|
|
30
|
+
import { parseContainerCondition } from "./container-query";
|
|
31
|
+
import {
|
|
32
|
+
parseDeclaration,
|
|
33
|
+
type AddWarningFn,
|
|
34
|
+
type ParseDeclarationOptions,
|
|
35
|
+
type ParserOptions,
|
|
36
|
+
} from "./declarations";
|
|
37
|
+
import { extractKeyFrames } from "./keyframes";
|
|
38
|
+
import { parseMediaQuery } from "./media-query";
|
|
39
|
+
import { getSelectors, toRNProperty } from "./selectors";
|
|
40
|
+
|
|
41
|
+
type ReactNativeAtRule = {
|
|
42
|
+
type: "custom";
|
|
43
|
+
value: {
|
|
44
|
+
name: "react-native";
|
|
45
|
+
prelude: null | Extract<ParsedComponent, { type: "repeated" }>;
|
|
46
|
+
body: {
|
|
47
|
+
type: "declaration-list";
|
|
48
|
+
value: DeclarationBlock & {
|
|
49
|
+
importantDeclarations: never;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Converts a CSS file to a collection of style declarations that can be used with the StyleSheet API
|
|
57
|
+
*
|
|
58
|
+
* @param code - The CSS file contents
|
|
59
|
+
* @param options - Compiler options
|
|
60
|
+
* @returns A `ReactNativeCssStyleSheet` that can be passed to `StyleSheet.register` or used with a custom runtime
|
|
61
|
+
*/
|
|
62
|
+
export function compile(
|
|
63
|
+
code: Buffer | string,
|
|
64
|
+
{ logger = debug("react-native-css"), ...options }: CompilerOptions = {},
|
|
65
|
+
): ReactNativeCssStyleSheet {
|
|
66
|
+
const features = Object.assign({}, options.features);
|
|
67
|
+
|
|
68
|
+
logger(`Features ${JSON.stringify(features)}`);
|
|
69
|
+
|
|
70
|
+
// These will by mutated by `extractRule`
|
|
71
|
+
const collection: CompilerCollection = {
|
|
72
|
+
darkMode: "dark",
|
|
73
|
+
rules: new Map(),
|
|
74
|
+
keyframes: new Map(),
|
|
75
|
+
rootVariables: {},
|
|
76
|
+
universalVariables: {},
|
|
77
|
+
appearanceOrder: 1,
|
|
78
|
+
...options,
|
|
79
|
+
features,
|
|
80
|
+
varUsageCount: new Map(),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
logger(`Start lightningcss`);
|
|
84
|
+
|
|
85
|
+
const onVarUsage = (token: TokenOrValue) => {
|
|
86
|
+
if (token.type === "function") {
|
|
87
|
+
token.value.arguments.forEach((token) => onVarUsage(token));
|
|
88
|
+
} else if (token.type === "var") {
|
|
89
|
+
const variable = token.value;
|
|
90
|
+
const varName = variable.name.ident;
|
|
91
|
+
collection.varUsageCount.set(
|
|
92
|
+
varName,
|
|
93
|
+
(collection.varUsageCount.get(varName) || 0) + 1,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
if (variable.fallback) {
|
|
97
|
+
const fallbackValues = variable.fallback;
|
|
98
|
+
fallbackValues.forEach((varObj) => onVarUsage(varObj));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Use the lightningcss library to traverse the CSS AST and extract style declarations and animations
|
|
104
|
+
lightningcss({
|
|
105
|
+
filename: "style.css", // This is ignored, but required
|
|
106
|
+
code: typeof code === "string" ? new TextEncoder().encode(code) : code,
|
|
107
|
+
visitor: {
|
|
108
|
+
Declaration(decl) {
|
|
109
|
+
// Track variable usage, we remove any unused variables
|
|
110
|
+
if (decl.property !== "unparsed" && decl.property !== "custom") return;
|
|
111
|
+
decl.value.value.forEach((varObj) => onVarUsage(varObj));
|
|
112
|
+
return decl;
|
|
113
|
+
},
|
|
114
|
+
StyleSheetExit(sheet) {
|
|
115
|
+
logger(`Found ${sheet.rules.length} rules to process`);
|
|
116
|
+
|
|
117
|
+
for (const rule of sheet.rules) {
|
|
118
|
+
// Extract the style declarations and animations from the current rule
|
|
119
|
+
extractRule(rule, collection);
|
|
120
|
+
// We have processed this rule, so now delete it from the AST
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
logger(`Exiting lightningcss`);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
customAtRules: {
|
|
127
|
+
"react-native": {
|
|
128
|
+
prelude: "<custom-ident>+",
|
|
129
|
+
body: "declaration-list",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
logger(`Found ${collection.rules.size} valid rules`);
|
|
135
|
+
|
|
136
|
+
const ruleSets = new Map<string, StyleRuleSet>();
|
|
137
|
+
for (const [name, styles] of collection.rules) {
|
|
138
|
+
if (styles.length === 0) continue;
|
|
139
|
+
|
|
140
|
+
const normal: StyleRule[] = [];
|
|
141
|
+
const important: StyleRule[] = [];
|
|
142
|
+
|
|
143
|
+
for (const style of styles) {
|
|
144
|
+
if (style.s[Specificity.Important]) {
|
|
145
|
+
important.push(style);
|
|
146
|
+
} else {
|
|
147
|
+
normal.push(style);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
ruleSets.set(name, [...normal, ...important]);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const stylesheetOptions: ReactNativeCssStyleSheet = {};
|
|
155
|
+
|
|
156
|
+
if (ruleSets.size) {
|
|
157
|
+
stylesheetOptions.s = Array.from(ruleSets);
|
|
158
|
+
}
|
|
159
|
+
if (collection.keyframes.size) {
|
|
160
|
+
stylesheetOptions.k = Array.from(
|
|
161
|
+
collection.keyframes as Map<string, AnimationKeyframes_V2[]>,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (Object.keys(collection.rootVariables).length) {
|
|
165
|
+
stylesheetOptions.vr = Object.entries(collection.rootVariables);
|
|
166
|
+
}
|
|
167
|
+
if (Object.keys(collection.universalVariables).length) {
|
|
168
|
+
stylesheetOptions.vu = Object.entries(collection.universalVariables);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return stylesheetOptions;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type ExtractableRules = Rule | ReactNativeAtRule;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Extracts style declarations and animations from a given CSS rule, based on its type.
|
|
178
|
+
*
|
|
179
|
+
* @param {Rule} rule - The CSS rule to extract style declarations and animations from.
|
|
180
|
+
* @param {CompilerCollection} collection - Options for the extraction process, including maps for storing extracted data.
|
|
181
|
+
* @param {CssToReactNativeRuntimeOptions} parseOptions - Options for parsing the CSS code, such as grouping related rules together.
|
|
182
|
+
*/
|
|
183
|
+
function extractRule(
|
|
184
|
+
rule: ExtractableRules,
|
|
185
|
+
collection: CompilerCollection,
|
|
186
|
+
partialStyle: Partial<StyleRule> = {},
|
|
187
|
+
) {
|
|
188
|
+
// Check the rule's type to determine which extraction function to call
|
|
189
|
+
switch (rule.type) {
|
|
190
|
+
case "keyframes": {
|
|
191
|
+
// If the rule is a keyframe animation, extract it with the `extractKeyFrames` function
|
|
192
|
+
extractKeyFrames(rule.value, collection);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
case "container": {
|
|
196
|
+
// If the rule is a container, extract it with the `extractedContainer` function
|
|
197
|
+
extractedContainer(rule.value, collection);
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
case "media": {
|
|
201
|
+
// If the rule is a media query, extract it with the `extractMedia` function
|
|
202
|
+
extractMedia(rule.value, collection);
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
case "style": {
|
|
206
|
+
// If the rule is a style declaration, extract it with the `getExtractedStyle` function and store it in the `declarations` map
|
|
207
|
+
if (rule.value.declarations) {
|
|
208
|
+
for (const style of getExtractedStyles(
|
|
209
|
+
rule.value.declarations,
|
|
210
|
+
collection,
|
|
211
|
+
parseReactNativeStyleAtRule(rule.value.rules),
|
|
212
|
+
)) {
|
|
213
|
+
setStyleForSelectorList(
|
|
214
|
+
{ ...partialStyle, ...style },
|
|
215
|
+
rule.value.selectors,
|
|
216
|
+
collection,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
collection.appearanceOrder++;
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case "custom": {
|
|
224
|
+
if (isReactNativeAtRule(rule)) {
|
|
225
|
+
extractReactNativeOptions(rule, collection);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function isReactNativeAtRule(
|
|
232
|
+
rule: ExtractableRules,
|
|
233
|
+
): rule is ReactNativeAtRule {
|
|
234
|
+
return rule.type === "custom" && rule.value?.name === "react-native";
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function extractReactNativeOptions(
|
|
238
|
+
rule: ReactNativeAtRule,
|
|
239
|
+
collection: CompilerCollection,
|
|
240
|
+
) {
|
|
241
|
+
const { declarations } = rule.value.body.value;
|
|
242
|
+
if (!declarations) return;
|
|
243
|
+
|
|
244
|
+
for (const declaration of declarations) {
|
|
245
|
+
if (declaration.property !== "custom") continue;
|
|
246
|
+
|
|
247
|
+
switch (declaration.value.name) {
|
|
248
|
+
case "preserve-variables": {
|
|
249
|
+
declaration.value.value.forEach((token) => {
|
|
250
|
+
if (token.type !== "dashed-ident") {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
collection.varUsageCount.set(token.value, 1);
|
|
254
|
+
});
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
default:
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @rn-move is a custom at-rule that allows you to move a style property to a different prop/location
|
|
265
|
+
* Its a placeholder concept until we improve the LightningCSS parsing
|
|
266
|
+
*/
|
|
267
|
+
function parseReactNativeStyleAtRule(rules?: (Rule | ReactNativeAtRule)[]) {
|
|
268
|
+
const mapping: StyleRuleMapping = {};
|
|
269
|
+
|
|
270
|
+
if (!rules) return mapping;
|
|
271
|
+
|
|
272
|
+
for (const rule of rules) {
|
|
273
|
+
if (!isReactNativeAtRule(rule)) continue;
|
|
274
|
+
if (!rule.value.prelude) continue;
|
|
275
|
+
|
|
276
|
+
if (rule.value.prelude.value.components[0]?.value !== "rename") {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const { declarations } = rule.value.body.value;
|
|
281
|
+
|
|
282
|
+
if (!declarations) continue;
|
|
283
|
+
|
|
284
|
+
for (const declaration of declarations) {
|
|
285
|
+
if (declaration.property !== "custom") continue;
|
|
286
|
+
|
|
287
|
+
let values: string[] = [];
|
|
288
|
+
|
|
289
|
+
for (const [index, value] of declaration.value.value.entries()) {
|
|
290
|
+
if (value.type !== "token") {
|
|
291
|
+
values = [];
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const token = value.value;
|
|
296
|
+
|
|
297
|
+
if (token.type === "delim") {
|
|
298
|
+
// Ignore the dot
|
|
299
|
+
if (token.value === ".") {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (token.value === "^" && index === 0) {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Any other delim is invalid
|
|
308
|
+
values = [];
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (token.type !== "ident") {
|
|
313
|
+
// Only ident is allowed
|
|
314
|
+
values = [];
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (index === 0) {
|
|
319
|
+
values.push("style");
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
values.push(toRNProperty(token.value));
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (values.length > 0) {
|
|
326
|
+
mapping[toRNProperty(declaration.value.name)] = values;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return mapping;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* This function takes in a MediaRule object, an CompilerCollection object and a CssToReactNativeRuntimeOptions object,
|
|
336
|
+
* and returns an array of MediaQuery objects representing styles extracted from screen media queries.
|
|
337
|
+
*
|
|
338
|
+
* @param mediaRule - The MediaRule object containing the media query and its rules.
|
|
339
|
+
* @param collection - The CompilerCollection object to use when extracting styles.
|
|
340
|
+
* @param parseOptions - The CssToReactNativeRuntimeOptions object to use when parsing styles.
|
|
341
|
+
*
|
|
342
|
+
* @returns undefined if no screen media queries are found in the mediaRule, else it returns the extracted styles.
|
|
343
|
+
*/
|
|
344
|
+
function extractMedia(mediaRule: MediaRule, collection: CompilerCollection) {
|
|
345
|
+
// Initialize an empty array to store screen media queries
|
|
346
|
+
const media: CSSMediaQuery[] = [];
|
|
347
|
+
|
|
348
|
+
// Iterate over all media queries in the mediaRule
|
|
349
|
+
for (const mediaQuery of mediaRule.query.mediaQueries) {
|
|
350
|
+
if (
|
|
351
|
+
// If this is only a media query
|
|
352
|
+
(mediaQuery.mediaType === "print" && mediaQuery.qualifier !== "not") ||
|
|
353
|
+
// If this is a @media not print {}
|
|
354
|
+
// We can only do this if there are no conditions, as @media not print and (min-width: 100px) could be valid
|
|
355
|
+
(mediaQuery.mediaType !== "print" &&
|
|
356
|
+
mediaQuery.qualifier === "not" &&
|
|
357
|
+
mediaQuery.condition === null)
|
|
358
|
+
) {
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
media.push(mediaQuery);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (media.length === 0) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const options: ParserOptions = {
|
|
370
|
+
add: () => {},
|
|
371
|
+
addWarning: () => {},
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const m = media
|
|
375
|
+
.map((m) => parseMediaQuery(m, options))
|
|
376
|
+
.filter((m): m is MediaCondition => m !== undefined);
|
|
377
|
+
|
|
378
|
+
// Iterate over all rules in the mediaRule and extract their styles using the updated CompilerCollection
|
|
379
|
+
for (const rule of mediaRule.rules) {
|
|
380
|
+
extractRule(rule, collection, { m });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* @param containerRule - The ContainerRule object containing the container query and its rules.
|
|
386
|
+
* @param collection - The CompilerCollection object to use when extracting styles.
|
|
387
|
+
* @param parseOptions - The CssToReactNativeRuntimeOptions object to use when parsing styles.
|
|
388
|
+
*/
|
|
389
|
+
function extractedContainer(
|
|
390
|
+
containerRule: ContainerRule,
|
|
391
|
+
collection: CompilerCollection,
|
|
392
|
+
) {
|
|
393
|
+
const options: ParserOptions = {
|
|
394
|
+
add: () => {},
|
|
395
|
+
addWarning: () => {},
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// Iterate over all rules inside the containerRule and extract their styles using the updated CompilerCollection
|
|
399
|
+
for (const rule of containerRule.rules) {
|
|
400
|
+
const query: ContainerQuery = {
|
|
401
|
+
m: parseContainerCondition(containerRule.condition, options),
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
if (containerRule.name) {
|
|
405
|
+
query.n = containerRule.name;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
extractRule(rule, collection, { cq: [query] });
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* @param style - The ExtractedStyle object to use when setting styles.
|
|
414
|
+
* @param selectorList - The SelectorList object containing the selectors to use when setting styles.
|
|
415
|
+
* @param declarations - The declarations object to use when adding declarations.
|
|
416
|
+
*/
|
|
417
|
+
function setStyleForSelectorList(
|
|
418
|
+
extractedStyle: StyleRule,
|
|
419
|
+
selectorList: SelectorList,
|
|
420
|
+
collection: CompilerCollection,
|
|
421
|
+
) {
|
|
422
|
+
const { rules: declarations } = collection;
|
|
423
|
+
|
|
424
|
+
const selectors = getSelectors(extractedStyle, selectorList, collection);
|
|
425
|
+
|
|
426
|
+
if (!(extractedStyle.d || extractedStyle.v)) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
for (const selector of selectors) {
|
|
431
|
+
const style: StyleRule = { ...extractedStyle };
|
|
432
|
+
|
|
433
|
+
if (
|
|
434
|
+
selector.type === "rootVariables" || // :root
|
|
435
|
+
selector.type === "universalVariables" // *
|
|
436
|
+
) {
|
|
437
|
+
const fontSizeValue = style.d?.reverse().find((value) => {
|
|
438
|
+
return typeof value === "object" && "fontSize" in value;
|
|
439
|
+
})?.[0];
|
|
440
|
+
|
|
441
|
+
if (
|
|
442
|
+
typeof collection.inlineRem !== "number" &&
|
|
443
|
+
fontSizeValue &&
|
|
444
|
+
typeof fontSizeValue === "object" &&
|
|
445
|
+
"fontSize" in fontSizeValue &&
|
|
446
|
+
typeof fontSizeValue["fontSize"] === "number"
|
|
447
|
+
) {
|
|
448
|
+
collection.rem = fontSizeValue["fontSize"];
|
|
449
|
+
if (collection.inlineRem === undefined) {
|
|
450
|
+
collection.inlineRem = collection.rem;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (!style.v) {
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const { type, subtype } = selector;
|
|
459
|
+
collection[type] ??= {};
|
|
460
|
+
for (const [name, value] of style.v) {
|
|
461
|
+
collection[type] ??= {};
|
|
462
|
+
collection[type][name] ??= [undefined];
|
|
463
|
+
if (subtype === "light") {
|
|
464
|
+
collection[type][name][0] = value;
|
|
465
|
+
} else {
|
|
466
|
+
collection[type][name][1] = value;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
continue;
|
|
470
|
+
} else if (selector.type === "className") {
|
|
471
|
+
const specificity: SpecificityArray = [];
|
|
472
|
+
|
|
473
|
+
if (selector.classNames.length === 0) {
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
for (let index = 0; index < 5; index++) {
|
|
478
|
+
const value =
|
|
479
|
+
(extractedStyle.s[index] ?? 0) + (selector.specificity[index] ?? 0);
|
|
480
|
+
if (value) {
|
|
481
|
+
specificity[index] = value;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const primarySelector = selector.classNames.pop()!;
|
|
486
|
+
|
|
487
|
+
for (const [group, conditions] of selector.classNames) {
|
|
488
|
+
// Add the conditions to the declarations object
|
|
489
|
+
addDeclaration(declarations, group, {
|
|
490
|
+
s: specificity,
|
|
491
|
+
c: [`g:${group}`],
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
primarySelector[1] ??= {};
|
|
495
|
+
primarySelector[1].cq ??= [];
|
|
496
|
+
|
|
497
|
+
const containerQuery: ContainerQuery = {
|
|
498
|
+
n: `g:${group}`,
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
if (conditions) {
|
|
502
|
+
if (conditions.m?.length) {
|
|
503
|
+
containerQuery.m = conditions.m[0];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
if (conditions.aq) {
|
|
507
|
+
containerQuery.a = conditions.aq;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (conditions.p) {
|
|
511
|
+
containerQuery.p = conditions.p;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
primarySelector[1].cq.push(containerQuery);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const rule: StyleRule = {
|
|
519
|
+
...style,
|
|
520
|
+
s: specificity,
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
const conditions = primarySelector[1];
|
|
524
|
+
|
|
525
|
+
if (conditions) {
|
|
526
|
+
if (conditions.cq) {
|
|
527
|
+
rule.cq ??= [];
|
|
528
|
+
rule.cq.push(...conditions.cq);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (conditions.m) {
|
|
532
|
+
rule.m = conditions.m;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (conditions.p) {
|
|
536
|
+
rule.p = Object.assign({}, rule.p, conditions.p);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (conditions.aq) {
|
|
540
|
+
rule.aq ??= [];
|
|
541
|
+
rule.aq.push(...conditions.aq);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
addDeclaration(declarations, primarySelector[0], rule);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function addDeclaration(
|
|
551
|
+
declarations: CompilerCollection["rules"],
|
|
552
|
+
className: string,
|
|
553
|
+
style: StyleRule,
|
|
554
|
+
) {
|
|
555
|
+
const existing = declarations.get(className);
|
|
556
|
+
if (existing) {
|
|
557
|
+
existing.push(style);
|
|
558
|
+
} else {
|
|
559
|
+
declarations.set(className, [style]);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function getExtractedStyles(
|
|
564
|
+
declarationBlock: DeclarationBlock<Declaration>,
|
|
565
|
+
collection: CompilerCollection,
|
|
566
|
+
mapping: StyleRuleMapping = {},
|
|
567
|
+
): StyleRule[] {
|
|
568
|
+
const extractedStyles = [];
|
|
569
|
+
|
|
570
|
+
const specificity: SpecificityArray = [];
|
|
571
|
+
specificity[Specificity.Order] = collection.appearanceOrder;
|
|
572
|
+
|
|
573
|
+
if (declarationBlock.declarations && declarationBlock.declarations.length) {
|
|
574
|
+
extractedStyles.push(
|
|
575
|
+
declarationsToStyle(
|
|
576
|
+
declarationBlock.declarations,
|
|
577
|
+
collection,
|
|
578
|
+
specificity,
|
|
579
|
+
mapping,
|
|
580
|
+
),
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (
|
|
585
|
+
declarationBlock.importantDeclarations &&
|
|
586
|
+
declarationBlock.importantDeclarations.length
|
|
587
|
+
) {
|
|
588
|
+
specificity[Specificity.Important] = 1;
|
|
589
|
+
extractedStyles.push(
|
|
590
|
+
declarationsToStyle(
|
|
591
|
+
declarationBlock.importantDeclarations,
|
|
592
|
+
collection,
|
|
593
|
+
specificity,
|
|
594
|
+
mapping,
|
|
595
|
+
),
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return extractedStyles;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function declarationsToStyle(
|
|
603
|
+
declarations: Declaration[],
|
|
604
|
+
collection: CompilerCollection,
|
|
605
|
+
specificity: SpecificityArray,
|
|
606
|
+
mapping: StyleRuleMapping,
|
|
607
|
+
): StyleRule {
|
|
608
|
+
const extractedStyle: StyleRule = {
|
|
609
|
+
s: [...specificity],
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
const parseDeclarationOptions: ParseDeclarationOptions = {
|
|
613
|
+
...collection,
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
const addWarning: AddWarningFn = () => {
|
|
617
|
+
// TODO
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
const addFn = buildAddFn(extractedStyle, collection, mapping);
|
|
621
|
+
|
|
622
|
+
for (const declaration of declarations) {
|
|
623
|
+
parseDeclaration(declaration, parseDeclarationOptions, addFn, addWarning);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
return extractedStyle;
|
|
627
|
+
}
|