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,137 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { versions } from "node:process";
|
|
3
|
+
import { sep } from "node:path";
|
|
4
|
+
|
|
5
|
+
import connect from "connect";
|
|
6
|
+
import type { MetroConfig } from "metro-config";
|
|
7
|
+
|
|
8
|
+
import { compile } from "../compiler/compiler";
|
|
9
|
+
import { setupTypeScript } from "./typescript";
|
|
10
|
+
import { getInjectionCode } from "./injection-code";
|
|
11
|
+
|
|
12
|
+
export interface WithReactNativeCSSOptions {
|
|
13
|
+
browserslist?: string | null;
|
|
14
|
+
browserslistEnv?: string | null;
|
|
15
|
+
libName?: string;
|
|
16
|
+
typescriptEnvPath?: string;
|
|
17
|
+
disableTypeScriptGeneration?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function withReactNativeCSS<
|
|
21
|
+
T extends MetroConfig | (() => Promise<MetroConfig>),
|
|
22
|
+
>(config: T, options?: WithReactNativeCSSOptions): T {
|
|
23
|
+
if (typeof config === "function") {
|
|
24
|
+
return (async () => {
|
|
25
|
+
return withReactNativeCSS(await config(), options);
|
|
26
|
+
}) as T;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (Number(versions.node.split(".")[0]) < 18) {
|
|
30
|
+
throw new Error("react-native-css only supports NodeJS >18");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (options?.disableTypeScriptGeneration !== true) {
|
|
34
|
+
setupTypeScript(options?.typescriptEnvPath, options?.libName);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const originalMiddleware = config.server?.enhanceMiddleware;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
...config,
|
|
41
|
+
transformerPath: require.resolve("./metro-transformer"),
|
|
42
|
+
transformer: {
|
|
43
|
+
...config.transformer,
|
|
44
|
+
browserslist: options?.browserslist,
|
|
45
|
+
browserslistEnv: options?.browserslistEnv,
|
|
46
|
+
},
|
|
47
|
+
server: {
|
|
48
|
+
...config.server,
|
|
49
|
+
enhanceMiddleware(middleware, metroServer) {
|
|
50
|
+
const server = connect();
|
|
51
|
+
const bundler: any = metroServer.getBundler().getBundler();
|
|
52
|
+
|
|
53
|
+
if (!bundler.__react_native_css__patched) {
|
|
54
|
+
bundler.__react_native_css__patched = true;
|
|
55
|
+
|
|
56
|
+
const cssFiles = new Map();
|
|
57
|
+
|
|
58
|
+
const injectionCommonJS = require.resolve("../runtime/native/metro");
|
|
59
|
+
const injectionFilePaths = [
|
|
60
|
+
// CommonJS
|
|
61
|
+
injectionCommonJS,
|
|
62
|
+
// ES Module
|
|
63
|
+
injectionCommonJS.replace(`dist${sep}commonjs`, `dist${sep}module`),
|
|
64
|
+
// TypeScript
|
|
65
|
+
injectionCommonJS
|
|
66
|
+
.replace(`dist${sep}commonjs`, `src`)
|
|
67
|
+
.replace(".js", ".ts"),
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
// Keep the original
|
|
71
|
+
const transformFile = bundler.transformFile.bind(bundler);
|
|
72
|
+
|
|
73
|
+
// Patch with our functionality
|
|
74
|
+
bundler.transformFile = async function (
|
|
75
|
+
filePath: string,
|
|
76
|
+
transformOptions: any,
|
|
77
|
+
fileBuffer?: Buffer,
|
|
78
|
+
) {
|
|
79
|
+
const isCss = /\.(s?css|sass)$/.test(filePath);
|
|
80
|
+
|
|
81
|
+
// Handle CSS files on native platforms
|
|
82
|
+
if (isCss && transformOptions.platform !== "web") {
|
|
83
|
+
const real = await transformFile(
|
|
84
|
+
filePath,
|
|
85
|
+
{
|
|
86
|
+
...transformOptions,
|
|
87
|
+
// Force the platform to web for CSS files
|
|
88
|
+
platform: "web",
|
|
89
|
+
// Let the transformer know that we will handle compilation
|
|
90
|
+
customTransformOptions: {
|
|
91
|
+
...transformOptions.customTransformOptions,
|
|
92
|
+
reactNativeCSSCompile: false,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
fileBuffer,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const lastTransform = cssFiles.get(filePath);
|
|
99
|
+
const last = lastTransform?.[0];
|
|
100
|
+
const next = real.output[0].data.css.code.toString();
|
|
101
|
+
|
|
102
|
+
// The CSS file has changed, we need to recompile the injection file
|
|
103
|
+
if (next !== last) {
|
|
104
|
+
cssFiles.set(filePath, [next, compile(next, {})]);
|
|
105
|
+
|
|
106
|
+
bundler.getWatcher().emit("change", {
|
|
107
|
+
eventsQueue: injectionFilePaths.map((filePath) => ({
|
|
108
|
+
filePath,
|
|
109
|
+
metadata: {
|
|
110
|
+
modifiedTime: Date.now(),
|
|
111
|
+
size: 1, // Can be anything
|
|
112
|
+
type: "virtual", // Can be anything
|
|
113
|
+
},
|
|
114
|
+
type: "change",
|
|
115
|
+
})),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
} else if (injectionFilePaths.includes(filePath)) {
|
|
119
|
+
// If this is the injection file, we to swap its content with the
|
|
120
|
+
// compiled CSS files
|
|
121
|
+
fileBuffer = getInjectionCode(
|
|
122
|
+
"./api",
|
|
123
|
+
Array.from(cssFiles.values()).map(([, value]) => value),
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return transformFile(filePath, transformOptions, fileBuffer);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return originalMiddleware
|
|
132
|
+
? server.use(originalMiddleware(middleware, metroServer))
|
|
133
|
+
: server.use(middleware);
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function getInjectionCode(filePath: string, values: unknown[]) {
|
|
2
|
+
const importPath = `import { StyleCollection } from "${filePath}";`;
|
|
3
|
+
const contents = values
|
|
4
|
+
.map((value) => `StyleCollection.inject(${JSON.stringify(value)});`)
|
|
5
|
+
.join("\n");
|
|
6
|
+
|
|
7
|
+
return Buffer.from(`${importPath}\n${contents}`);
|
|
8
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
JsTransformerConfig,
|
|
3
|
+
JsTransformOptions,
|
|
4
|
+
TransformResponse,
|
|
5
|
+
} from "metro-transform-worker";
|
|
6
|
+
|
|
7
|
+
const worker =
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
9
|
+
require("@expo/metro-config/build/transform-worker/transform-worker.js") as typeof import("metro-transform-worker");
|
|
10
|
+
|
|
11
|
+
export function transform(
|
|
12
|
+
config: JsTransformerConfig,
|
|
13
|
+
projectRoot: string,
|
|
14
|
+
filePath: string,
|
|
15
|
+
data: Buffer,
|
|
16
|
+
options: JsTransformOptions,
|
|
17
|
+
): Promise<TransformResponse> {
|
|
18
|
+
const isCss = options.type !== "asset" && /\.(s?css|sass)$/.test(filePath);
|
|
19
|
+
const skipCompile =
|
|
20
|
+
options.customTransformOptions &&
|
|
21
|
+
"reactNativeCSSCompile" in options.customTransformOptions &&
|
|
22
|
+
options.customTransformOptions.reactNativeCSSCompile === false;
|
|
23
|
+
|
|
24
|
+
if (!isCss || skipCompile) {
|
|
25
|
+
return worker.transform(config, projectRoot, filePath, data, options);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// TODO - compile the CSS file inline
|
|
29
|
+
|
|
30
|
+
return worker.transform(config, projectRoot, filePath, data, options);
|
|
31
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// ISC License
|
|
3
|
+
|
|
4
|
+
// Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
|
|
5
|
+
|
|
6
|
+
// Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
// purpose with or without fee is hereby granted, provided that the above
|
|
8
|
+
// copyright notice and this permission notice appear in all copies.
|
|
9
|
+
|
|
10
|
+
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
11
|
+
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
12
|
+
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
13
|
+
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
14
|
+
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
15
|
+
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
16
|
+
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
+
//
|
|
18
|
+
// https://github.com/alexeyraspopov/picocolors/blob/b6261487e7b81aaab2440e397a356732cad9e342/picocolors.js#L1
|
|
19
|
+
|
|
20
|
+
const { env, stdout } = globalThis?.process ?? {};
|
|
21
|
+
|
|
22
|
+
const enabled =
|
|
23
|
+
env &&
|
|
24
|
+
!env.NO_COLOR &&
|
|
25
|
+
(env.FORCE_COLOR || (stdout?.isTTY && !env.CI && env.TERM !== "dumb"));
|
|
26
|
+
|
|
27
|
+
const replaceClose = (
|
|
28
|
+
str: string,
|
|
29
|
+
close: string,
|
|
30
|
+
replace: string,
|
|
31
|
+
index: number,
|
|
32
|
+
): string => {
|
|
33
|
+
const start = str.substring(0, index) + replace;
|
|
34
|
+
const end = str.substring(index + close.length);
|
|
35
|
+
const nextIndex = end.indexOf(close);
|
|
36
|
+
return ~nextIndex
|
|
37
|
+
? start + replaceClose(end, close, replace, nextIndex)
|
|
38
|
+
: start + end;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const formatter = (open: string, close: string, replace = open) => {
|
|
42
|
+
if (!enabled) return String;
|
|
43
|
+
return (input: string) => {
|
|
44
|
+
const string = "" + input;
|
|
45
|
+
const index = string.indexOf(close, open.length);
|
|
46
|
+
return ~index
|
|
47
|
+
? open + replaceClose(string, close, replace, index) + close
|
|
48
|
+
: open + string + close;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const reset = enabled ? (s: string) => `\x1b[0m${s}\x1b[0m` : String;
|
|
53
|
+
export const bold = formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m");
|
|
54
|
+
export const dim = formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m");
|
|
55
|
+
export const italic = formatter("\x1b[3m", "\x1b[23m");
|
|
56
|
+
export const underline = formatter("\x1b[4m", "\x1b[24m");
|
|
57
|
+
export const inverse = formatter("\x1b[7m", "\x1b[27m");
|
|
58
|
+
export const hidden = formatter("\x1b[8m", "\x1b[28m");
|
|
59
|
+
export const strikethrough = formatter("\x1b[9m", "\x1b[29m");
|
|
60
|
+
export const black = formatter("\x1b[30m", "\x1b[39m");
|
|
61
|
+
export const red = formatter("\x1b[31m", "\x1b[39m");
|
|
62
|
+
export const green = formatter("\x1b[32m", "\x1b[39m");
|
|
63
|
+
export const yellow = formatter("\x1b[33m", "\x1b[39m");
|
|
64
|
+
export const blue = formatter("\x1b[34m", "\x1b[39m");
|
|
65
|
+
export const magenta = formatter("\x1b[35m", "\x1b[39m");
|
|
66
|
+
export const purple = formatter("\x1b[38;2;173;127;168m", "\x1b[39m");
|
|
67
|
+
export const cyan = formatter("\x1b[36m", "\x1b[39m");
|
|
68
|
+
export const white = formatter("\x1b[37m", "\x1b[39m");
|
|
69
|
+
export const gray = formatter("\x1b[90m", "\x1b[39m");
|
|
70
|
+
export const bgBlack = formatter("\x1b[40m", "\x1b[49m");
|
|
71
|
+
export const bgRed = formatter("\x1b[41m", "\x1b[49m");
|
|
72
|
+
export const bgGreen = formatter("\x1b[42m", "\x1b[49m");
|
|
73
|
+
export const bgYellow = formatter("\x1b[43m", "\x1b[49m");
|
|
74
|
+
export const bgBlue = formatter("\x1b[44m", "\x1b[49m");
|
|
75
|
+
export const bgMagenta = formatter("\x1b[45m", "\x1b[49m");
|
|
76
|
+
export const bgCyan = formatter("\x1b[46m", "\x1b[49m");
|
|
77
|
+
export const bgWhite = formatter("\x1b[47m", "\x1b[49m");
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Convert a data structure to JavaScript.
|
|
4
|
+
* The output should be similar to JSON, but without the extra characters.
|
|
5
|
+
* This is simply to reduce file size in production
|
|
6
|
+
*/
|
|
7
|
+
export function stringify(data: unknown): string {
|
|
8
|
+
switch (typeof data) {
|
|
9
|
+
case "bigint":
|
|
10
|
+
case "symbol":
|
|
11
|
+
case "function":
|
|
12
|
+
throw new Error(`Cannot stringify ${typeof data}`);
|
|
13
|
+
case "string":
|
|
14
|
+
return `"${data}"`;
|
|
15
|
+
case "number":
|
|
16
|
+
// Reduce to 3 decimal places
|
|
17
|
+
return `${Math.round(data * 1000) / 1000}`;
|
|
18
|
+
case "boolean":
|
|
19
|
+
return `${data}`;
|
|
20
|
+
case "undefined":
|
|
21
|
+
// null is processed faster than undefined
|
|
22
|
+
// JSON.stringify also converts undefined to null
|
|
23
|
+
return "null";
|
|
24
|
+
case "object": {
|
|
25
|
+
if (data === null) {
|
|
26
|
+
return "null";
|
|
27
|
+
} else if (Array.isArray(data)) {
|
|
28
|
+
return `[${data
|
|
29
|
+
.map((value) => {
|
|
30
|
+
// These values can be omitted to create a holey array
|
|
31
|
+
// This is slightly slower to parse at runtime, but keeps the
|
|
32
|
+
// file size smaller
|
|
33
|
+
return value === null || value === undefined
|
|
34
|
+
? ""
|
|
35
|
+
: stringify(value);
|
|
36
|
+
})
|
|
37
|
+
.join(",")}]`;
|
|
38
|
+
} else {
|
|
39
|
+
return `{${Object.entries(data)
|
|
40
|
+
.flatMap(([key, value]) => {
|
|
41
|
+
// If an object's property is undefined or null we can just skip it
|
|
42
|
+
if (value === null || value === undefined) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Make sure we quote strings that require quotes
|
|
47
|
+
if (key.match(/[^a-zA-Z]/)) {
|
|
48
|
+
key = `"${key}"`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
value = stringify(value);
|
|
52
|
+
|
|
53
|
+
return [`${key}:${value}`];
|
|
54
|
+
})
|
|
55
|
+
.join(",")}}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
+
|
|
4
|
+
import { CommentArray, parse, stringify } from "comment-json";
|
|
5
|
+
|
|
6
|
+
import { bold, cyan } from "./picocolors";
|
|
7
|
+
|
|
8
|
+
export function setupTypeScript(
|
|
9
|
+
envPath = "react-native-css-env.d.ts",
|
|
10
|
+
name = "react-native-css",
|
|
11
|
+
) {
|
|
12
|
+
try {
|
|
13
|
+
const ts = require("typescript");
|
|
14
|
+
if (!ts) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const configFileName = ts.findConfigFile(
|
|
19
|
+
"./",
|
|
20
|
+
ts.sys.fileExists,
|
|
21
|
+
"tsconfig.json",
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const userConfig = parse(
|
|
25
|
+
readFileSync(configFileName, {
|
|
26
|
+
encoding: "utf-8",
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (
|
|
31
|
+
typeof userConfig !== "object" ||
|
|
32
|
+
!userConfig ||
|
|
33
|
+
Array.isArray(userConfig)
|
|
34
|
+
) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const output: string[] = [];
|
|
39
|
+
let updatedConfig = false;
|
|
40
|
+
|
|
41
|
+
if (!existsSync(envPath)) {
|
|
42
|
+
writeFileSync(
|
|
43
|
+
envPath,
|
|
44
|
+
`/// <reference types="react-native-css/react-env" />
|
|
45
|
+
|
|
46
|
+
// NOTE: This file should not be edited and should be committed with your source code. It is generated by ${name}. If you need to move or disable this file, please see the documentation.`,
|
|
47
|
+
);
|
|
48
|
+
output.push(`Created ${cyan(envPath)}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
userConfig.include ??= new CommentArray(envPath);
|
|
52
|
+
if (
|
|
53
|
+
Array.isArray(userConfig.include) &&
|
|
54
|
+
!userConfig.include.includes(envPath)
|
|
55
|
+
) {
|
|
56
|
+
userConfig.include.push(envPath);
|
|
57
|
+
updatedConfig = true;
|
|
58
|
+
output.push(
|
|
59
|
+
`Updated ${configFileName} to include the ${cyan(envPath)} file`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (updatedConfig) {
|
|
64
|
+
writeFileSync(configFileName, stringify(userConfig, null, 2));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (output.length) {
|
|
68
|
+
console.log(
|
|
69
|
+
`${cyan(bold("NativeWind"))} made the following changes to your project to support TypeScript:\n - ${output.join("\n - ")}`,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
} catch {}
|
|
73
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { useContext, useState } from "react";
|
|
3
|
+
import { Appearance } from "react-native";
|
|
4
|
+
|
|
5
|
+
import type { InlineVariable, StyleDescriptor } from "../../compiler";
|
|
6
|
+
import type {
|
|
7
|
+
ColorScheme,
|
|
8
|
+
Props,
|
|
9
|
+
StyledConfiguration,
|
|
10
|
+
StyledOptions,
|
|
11
|
+
} from "../runtime.types";
|
|
12
|
+
import type { ReactComponent } from "../utils";
|
|
13
|
+
import { mappingToConfig, useNativeCss } from "./react/useNativeCss";
|
|
14
|
+
import { usePassthrough } from "./react/usePassthrough";
|
|
15
|
+
import {
|
|
16
|
+
colorScheme as colorSchemeObs,
|
|
17
|
+
VAR_SYMBOL,
|
|
18
|
+
VariableContext,
|
|
19
|
+
type Effect,
|
|
20
|
+
type Getter,
|
|
21
|
+
} from "./reactivity";
|
|
22
|
+
import { resolveValue } from "./styles/resolve";
|
|
23
|
+
|
|
24
|
+
export { StyleCollection } from "./injection";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Generates a new Higher-Order component the wraps the base component and applies the styles.
|
|
28
|
+
* This is added to the `interopComponents` map so that it can be used in the `wrapJSX` function
|
|
29
|
+
* @param baseComponent
|
|
30
|
+
* @param mapping
|
|
31
|
+
*/
|
|
32
|
+
export const styled = <
|
|
33
|
+
const C extends ReactComponent<any>,
|
|
34
|
+
const M extends StyledConfiguration<C>,
|
|
35
|
+
>(
|
|
36
|
+
baseComponent: C,
|
|
37
|
+
mapping: M,
|
|
38
|
+
options?: StyledOptions,
|
|
39
|
+
) => {
|
|
40
|
+
let component: any;
|
|
41
|
+
// const type = getComponentType(baseComponent);
|
|
42
|
+
|
|
43
|
+
const configs = mappingToConfig(mapping);
|
|
44
|
+
|
|
45
|
+
if (options?.passThrough) {
|
|
46
|
+
component = (props: Record<string, any>) => {
|
|
47
|
+
return usePassthrough(baseComponent, props, configs);
|
|
48
|
+
};
|
|
49
|
+
} else {
|
|
50
|
+
component = (props: Record<string, any>) => {
|
|
51
|
+
return useNativeCss(baseComponent, props, configs);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const name = baseComponent.displayName ?? baseComponent.name ?? "unknown";
|
|
56
|
+
component.displayName = `CssInterop.${name}`;
|
|
57
|
+
return component;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const colorScheme: ColorScheme = {
|
|
61
|
+
get() {
|
|
62
|
+
return colorSchemeObs.get() ?? Appearance.getColorScheme() ?? "light";
|
|
63
|
+
},
|
|
64
|
+
set(value) {
|
|
65
|
+
return colorSchemeObs.set(value);
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const useUnstableNativeVariable = useNativeVariable;
|
|
70
|
+
|
|
71
|
+
export const useCssElement = <
|
|
72
|
+
const C extends ReactComponent<any>,
|
|
73
|
+
const M extends StyledConfiguration<C>,
|
|
74
|
+
>(
|
|
75
|
+
component: C,
|
|
76
|
+
incomingProps: Props,
|
|
77
|
+
mapping: M,
|
|
78
|
+
) => {
|
|
79
|
+
const [config] = useState(() => mappingToConfig(mapping));
|
|
80
|
+
return useNativeCss(component, incomingProps, config);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export function useNativeVariable(name: string) {
|
|
84
|
+
if (name.startsWith("--")) {
|
|
85
|
+
name = name.slice(2);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const inheritedVariables = useContext(VariableContext);
|
|
89
|
+
const [effect, setState] = useState(() => {
|
|
90
|
+
const effect: Effect = {
|
|
91
|
+
observers: new Set(),
|
|
92
|
+
run: () => setState((state) => ({ ...state })),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const get: Getter = (observable) => observable.get(effect);
|
|
96
|
+
|
|
97
|
+
return { ...effect, get };
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return resolveValue([{}, "var", [name]], effect.get, { inheritedVariables });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function vars(variables: Record<string, StyleDescriptor>) {
|
|
104
|
+
(variables as InlineVariable)[VAR_SYMBOL] = "inline";
|
|
105
|
+
return variables;
|
|
106
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { MediaFeatureNameFor_ContainerSizeFeatureId } from "lightningcss";
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
ContainerQuery,
|
|
6
|
+
MediaCondition,
|
|
7
|
+
PseudoClassesQuery,
|
|
8
|
+
StyleDescriptor,
|
|
9
|
+
} from "../../../compiler";
|
|
10
|
+
import {
|
|
11
|
+
activeFamily,
|
|
12
|
+
containerHeightFamily,
|
|
13
|
+
containerWidthFamily,
|
|
14
|
+
focusFamily,
|
|
15
|
+
hoverFamily,
|
|
16
|
+
type ContainerContextValue,
|
|
17
|
+
type Effect,
|
|
18
|
+
} from "../reactivity";
|
|
19
|
+
import type { RenderGuard } from "./guards";
|
|
20
|
+
|
|
21
|
+
export const DEFAULT_CONTAINER_NAME = "c:___default___";
|
|
22
|
+
|
|
23
|
+
export function testContainerQueries(
|
|
24
|
+
queries: ContainerQuery[],
|
|
25
|
+
inheritedContainers: ContainerContextValue,
|
|
26
|
+
guards: RenderGuard[],
|
|
27
|
+
effect: Effect,
|
|
28
|
+
) {
|
|
29
|
+
return queries.every((query) => {
|
|
30
|
+
return testContainerQuery(query, inheritedContainers, guards, effect);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function testContainerQuery(
|
|
35
|
+
query: ContainerQuery,
|
|
36
|
+
inheritedContainers: ContainerContextValue,
|
|
37
|
+
guards: RenderGuard[],
|
|
38
|
+
effect?: Effect,
|
|
39
|
+
): boolean {
|
|
40
|
+
const name = query.n ?? DEFAULT_CONTAINER_NAME;
|
|
41
|
+
const container = inheritedContainers[name]!;
|
|
42
|
+
|
|
43
|
+
guards.push(["c", name, container]);
|
|
44
|
+
|
|
45
|
+
if (!container) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (query.m && !testContainerMediaCondition(query.m, container, effect)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (query.p && !testContainerPseudoCondition(query.p, container, effect)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function testContainerPseudoCondition(
|
|
61
|
+
query: PseudoClassesQuery,
|
|
62
|
+
containerKey: WeakKey,
|
|
63
|
+
effect?: Effect,
|
|
64
|
+
): boolean {
|
|
65
|
+
if (query.h && !hoverFamily(containerKey).get(effect)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (query.a && !activeFamily(containerKey).get(effect)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (query.f && !focusFamily(containerKey).get(effect)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function testContainerMediaCondition(
|
|
78
|
+
condition: MediaCondition,
|
|
79
|
+
containerKey: WeakKey,
|
|
80
|
+
effect?: Effect,
|
|
81
|
+
): boolean {
|
|
82
|
+
switch (condition[0]) {
|
|
83
|
+
case "!":
|
|
84
|
+
return !testContainerMediaCondition(condition[1], containerKey, effect);
|
|
85
|
+
case "&":
|
|
86
|
+
return condition[1].every((query) => {
|
|
87
|
+
return testContainerMediaCondition(query, containerKey, effect);
|
|
88
|
+
});
|
|
89
|
+
case "|":
|
|
90
|
+
return condition[1].some((query) => {
|
|
91
|
+
return testContainerMediaCondition(query, containerKey, effect);
|
|
92
|
+
});
|
|
93
|
+
case "!!":
|
|
94
|
+
return false;
|
|
95
|
+
case "[]":
|
|
96
|
+
return false;
|
|
97
|
+
case ">":
|
|
98
|
+
case ">=":
|
|
99
|
+
case "<":
|
|
100
|
+
case "<=":
|
|
101
|
+
case "=": {
|
|
102
|
+
const left = getContainerFeatureValue(condition[1], containerKey, effect);
|
|
103
|
+
const right = condition[2];
|
|
104
|
+
|
|
105
|
+
if (condition[0] === "=") {
|
|
106
|
+
return left === right;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (typeof left !== "number" || typeof right !== "number") {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
switch (condition[0]) {
|
|
114
|
+
case ">":
|
|
115
|
+
return left > right;
|
|
116
|
+
case ">=":
|
|
117
|
+
return left > right;
|
|
118
|
+
case "<":
|
|
119
|
+
return left > right;
|
|
120
|
+
case "<=":
|
|
121
|
+
return left > right;
|
|
122
|
+
default:
|
|
123
|
+
condition[0] satisfies never;
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
default:
|
|
128
|
+
condition satisfies never;
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function getContainerFeatureValue(
|
|
134
|
+
name: MediaFeatureNameFor_ContainerSizeFeatureId,
|
|
135
|
+
containerKey: WeakKey,
|
|
136
|
+
effect?: Effect,
|
|
137
|
+
): StyleDescriptor {
|
|
138
|
+
switch (name) {
|
|
139
|
+
case "width":
|
|
140
|
+
return containerWidthFamily(containerKey).get(effect);
|
|
141
|
+
case "height":
|
|
142
|
+
return containerHeightFamily(containerKey).get(effect);
|
|
143
|
+
case "aspect-ratio": {
|
|
144
|
+
const width = containerWidthFamily(containerKey).get(effect);
|
|
145
|
+
const height = containerWidthFamily(containerKey).get(effect);
|
|
146
|
+
return width / height;
|
|
147
|
+
}
|
|
148
|
+
case "orientation":
|
|
149
|
+
const width = containerWidthFamily(containerKey).get(effect);
|
|
150
|
+
const height = containerWidthFamily(containerKey).get(effect);
|
|
151
|
+
return width > height ? "landscape" : "portrait";
|
|
152
|
+
case "inline-size":
|
|
153
|
+
case "block-size":
|
|
154
|
+
default:
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ComponentState } from "../react/useNativeCss";
|
|
3
|
+
import type {
|
|
4
|
+
ContainerContextValue,
|
|
5
|
+
Effect,
|
|
6
|
+
VariableContextValue,
|
|
7
|
+
} from "../reactivity";
|
|
8
|
+
|
|
9
|
+
export type RenderGuard =
|
|
10
|
+
| ["a", string, any]
|
|
11
|
+
| ["d", string, any]
|
|
12
|
+
| ["v", string, any]
|
|
13
|
+
| ["c", string, Effect];
|
|
14
|
+
|
|
15
|
+
export function testGuards(
|
|
16
|
+
state: ComponentState,
|
|
17
|
+
currentProps: any,
|
|
18
|
+
inheritedVariables: VariableContextValue,
|
|
19
|
+
inheritedContainers: ContainerContextValue,
|
|
20
|
+
) {
|
|
21
|
+
return state.guards?.some((guard) => {
|
|
22
|
+
switch (guard[0]) {
|
|
23
|
+
case "a":
|
|
24
|
+
// Attribute
|
|
25
|
+
return currentProps?.[guard[1]] !== guard[2];
|
|
26
|
+
case "d":
|
|
27
|
+
// DataSet
|
|
28
|
+
return currentProps?.dataSet?.[guard[1]] !== guard[2];
|
|
29
|
+
case "v":
|
|
30
|
+
// Variables
|
|
31
|
+
return inheritedVariables[guard[1]] !== guard[2];
|
|
32
|
+
case "c":
|
|
33
|
+
// Containers
|
|
34
|
+
return inheritedContainers[guard[1]] !== guard[2];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|