react-native-css 0.0.0-nightly.2c68396 → 0.0.0-nightly.2e152c9
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/README.md +35 -5
- package/dist/commonjs/babel/helpers.js +7 -0
- package/dist/commonjs/babel/helpers.js.map +1 -1
- package/dist/commonjs/babel/import-plugin.js +20 -8
- package/dist/commonjs/babel/import-plugin.js.map +1 -1
- package/dist/commonjs/babel/react-native-web.js +17 -4
- package/dist/commonjs/babel/react-native-web.js.map +1 -1
- package/dist/commonjs/babel/react-native.js +9 -4
- package/dist/commonjs/babel/react-native.js.map +1 -1
- package/dist/commonjs/compiler/atRules.js +35 -0
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +198 -39
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/container-query.js +6 -1
- package/dist/commonjs/compiler/container-query.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +190 -101
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/individual-transforms.js +129 -0
- package/dist/commonjs/compiler/individual-transforms.js.map +1 -0
- package/dist/commonjs/compiler/inline-variables.js +47 -1
- package/dist/commonjs/compiler/inline-variables.js.map +1 -1
- package/dist/commonjs/compiler/lightningcss-loader.js +11 -8
- package/dist/commonjs/compiler/lightningcss-loader.js.map +1 -1
- package/dist/commonjs/compiler/media-query.js +16 -6
- package/dist/commonjs/compiler/media-query.js.map +1 -1
- package/dist/commonjs/compiler/selector-builder.js +16 -4
- package/dist/commonjs/compiler/selector-builder.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +33 -9
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/compiler/supports.js +1 -3
- package/dist/commonjs/compiler/supports.js.map +1 -1
- package/dist/commonjs/components/FlatList.js +1 -0
- package/dist/commonjs/components/FlatList.js.map +1 -1
- package/dist/commonjs/components/ImageBackground.js +2 -6
- package/dist/commonjs/components/ImageBackground.js.map +1 -1
- package/dist/commonjs/components/KeyboardAvoidingView.js +2 -3
- package/dist/commonjs/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/commonjs/components/SafeAreaProvider.js +13 -0
- package/dist/commonjs/components/SafeAreaProvider.js.map +1 -0
- package/dist/commonjs/components/index.cjs +49 -1
- package/dist/commonjs/components/index.cjs.map +1 -1
- package/dist/commonjs/components/react-native-safe-area-context.native.js +10 -0
- package/dist/commonjs/components/react-native-safe-area-context.native.js.map +1 -1
- package/dist/commonjs/jest/index.js +3 -1
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/cache-version.js +43 -0
- package/dist/commonjs/metro/cache-version.js.map +1 -0
- package/dist/commonjs/metro/index.js +2 -0
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/metro-transformer.js +16 -3
- package/dist/commonjs/metro/metro-transformer.js.map +1 -1
- package/dist/commonjs/metro/typescript.js +26 -6
- package/dist/commonjs/metro/typescript.js.map +1 -1
- package/dist/commonjs/metro/warnings.js +135 -0
- package/dist/commonjs/metro/warnings.js.map +1 -0
- package/dist/commonjs/native/api.js +16 -11
- package/dist/commonjs/native/api.js.map +1 -1
- package/dist/commonjs/native/conditions/attributes.js +16 -9
- package/dist/commonjs/native/conditions/attributes.js.map +1 -1
- package/dist/commonjs/native/conditions/container-query.js +11 -11
- package/dist/commonjs/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/native/conditions/guards.js +7 -0
- package/dist/commonjs/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/native/conditions/media-query.js +1 -1
- package/dist/commonjs/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/native/objects.js +11 -18
- package/dist/commonjs/native/objects.js.map +1 -1
- package/dist/commonjs/native/react/interaction.js +10 -5
- package/dist/commonjs/native/react/interaction.js.map +1 -1
- package/dist/commonjs/native/react/rules.js +45 -38
- package/dist/commonjs/native/react/rules.js.map +1 -1
- package/dist/commonjs/native/react/useNativeCss.js +70 -15
- package/dist/commonjs/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/native/react/usePassthrough.js +5 -2
- package/dist/commonjs/native/react/usePassthrough.js.map +1 -1
- package/dist/commonjs/native/reactivity.js +64 -24
- package/dist/commonjs/native/reactivity.js.map +1 -1
- package/dist/commonjs/native/reanimated.js +15 -3
- package/dist/commonjs/native/reanimated.js.map +1 -1
- package/dist/commonjs/native/styles/calculate-props.js +139 -26
- package/dist/commonjs/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/native/styles/functions/animation-timing.js +2 -1
- package/dist/commonjs/native/styles/functions/animation-timing.js.map +1 -1
- package/dist/commonjs/native/styles/functions/color-mix.js +43 -29
- package/dist/commonjs/native/styles/functions/color-mix.js.map +1 -1
- package/dist/commonjs/native/styles/functions/filters.js +19 -5
- package/dist/commonjs/native/styles/functions/filters.js.map +1 -1
- package/dist/commonjs/native/styles/functions/numeric-functions.js +4 -3
- package/dist/commonjs/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/platform-functions.js +2 -1
- package/dist/commonjs/native/styles/functions/platform-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/string-functions.js +22 -6
- package/dist/commonjs/native/styles/functions/string-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/transform-functions.js +95 -105
- package/dist/commonjs/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/commonjs/native/styles/index.js +303 -49
- package/dist/commonjs/native/styles/index.js.map +1 -1
- package/dist/commonjs/native/styles/resolve.js +136 -19
- package/dist/commonjs/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/native/styles/scale-factor.js +12 -0
- package/dist/commonjs/native/styles/scale-factor.js.map +1 -0
- package/dist/commonjs/native/styles/shorthands/_handler.js +10 -0
- package/dist/commonjs/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/animation.js +6 -3
- package/dist/commonjs/native/styles/shorthands/animation.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/box-shadow.js +41 -20
- package/dist/commonjs/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/index.js +11 -0
- package/dist/commonjs/native/styles/shorthands/index.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/logical-border-width.js +22 -0
- package/dist/commonjs/native/styles/shorthands/logical-border-width.js.map +1 -0
- package/dist/commonjs/native/styles/shorthands/transform.js +31 -8
- package/dist/commonjs/native/styles/shorthands/transform.js.map +1 -1
- package/dist/commonjs/native/styles/variables.js +165 -48
- package/dist/commonjs/native/styles/variables.js.map +1 -1
- package/dist/commonjs/native-internal/root.js +46 -7
- package/dist/commonjs/native-internal/root.js.map +1 -1
- package/dist/commonjs/native-internal/style-collection.js +22 -37
- package/dist/commonjs/native-internal/style-collection.js.map +1 -1
- package/dist/commonjs/native-internal/variables.js +1 -1
- package/dist/commonjs/native-internal/variables.js.map +1 -1
- package/dist/commonjs/utilities/dot-notation.types.js +4 -0
- package/dist/commonjs/utilities/equality.js +41 -0
- package/dist/commonjs/utilities/equality.js.map +1 -0
- package/dist/commonjs/utilities/index.js +11 -0
- package/dist/commonjs/utilities/index.js.map +1 -1
- package/dist/commonjs/utilities/style-descriptor.js +32 -8
- package/dist/commonjs/utilities/style-descriptor.js.map +1 -1
- package/dist/commonjs/web/api.js +2 -2
- package/dist/commonjs/web/api.js.map +1 -1
- package/dist/commonjs/web/assign-style.js +4 -1
- package/dist/commonjs/web/assign-style.js.map +1 -1
- package/dist/module/babel/helpers.js +6 -0
- package/dist/module/babel/helpers.js.map +1 -1
- package/dist/module/babel/import-plugin.js +22 -10
- package/dist/module/babel/import-plugin.js.map +1 -1
- package/dist/module/babel/react-native-web.js +16 -4
- package/dist/module/babel/react-native-web.js.map +1 -1
- package/dist/module/babel/react-native.js +9 -4
- package/dist/module/babel/react-native.js.map +1 -1
- package/dist/module/compiler/atRules.js +33 -0
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/compiler.js +200 -41
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js +2 -0
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/container-query.js +6 -1
- package/dist/module/compiler/container-query.js.map +1 -1
- package/dist/module/compiler/declarations.js +190 -100
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/individual-transforms.js +125 -0
- package/dist/module/compiler/individual-transforms.js.map +1 -0
- package/dist/module/compiler/inline-variables.js +47 -1
- package/dist/module/compiler/inline-variables.js.map +1 -1
- package/dist/module/compiler/lightningcss-loader.js +10 -8
- package/dist/module/compiler/lightningcss-loader.js.map +1 -1
- package/dist/module/compiler/media-query.js +16 -6
- package/dist/module/compiler/media-query.js.map +1 -1
- package/dist/module/compiler/selector-builder.js +16 -5
- package/dist/module/compiler/selector-builder.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +33 -9
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/compiler/supports.js +1 -3
- package/dist/module/compiler/supports.js.map +1 -1
- package/dist/module/components/FlatList.js +1 -0
- package/dist/module/components/FlatList.js.map +1 -1
- package/dist/module/components/ImageBackground.js +2 -6
- package/dist/module/components/ImageBackground.js.map +1 -1
- package/dist/module/components/KeyboardAvoidingView.js +2 -3
- package/dist/module/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/module/components/SafeAreaProvider.js +4 -0
- package/dist/module/components/SafeAreaProvider.js.map +1 -0
- package/dist/module/components/index.cjs +49 -1
- package/dist/module/components/index.cjs.map +1 -1
- package/dist/module/components/react-native-safe-area-context.native.js +9 -1
- package/dist/module/components/react-native-safe-area-context.native.js.map +1 -1
- package/dist/module/jest/index.js +3 -1
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/cache-version.js +39 -0
- package/dist/module/metro/cache-version.js.map +1 -0
- package/dist/module/metro/index.js +2 -0
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/metro-transformer.js +16 -3
- package/dist/module/metro/metro-transformer.js.map +1 -1
- package/dist/module/metro/typescript.js +26 -6
- package/dist/module/metro/typescript.js.map +1 -1
- package/dist/module/metro/warnings.js +131 -0
- package/dist/module/metro/warnings.js.map +1 -0
- package/dist/module/native/api.js +18 -13
- package/dist/module/native/api.js.map +1 -1
- package/dist/module/native/conditions/attributes.js +16 -9
- package/dist/module/native/conditions/attributes.js.map +1 -1
- package/dist/module/native/conditions/container-query.js +11 -11
- package/dist/module/native/conditions/container-query.js.map +1 -1
- package/dist/module/native/conditions/guards.js +7 -0
- package/dist/module/native/conditions/guards.js.map +1 -1
- package/dist/module/native/conditions/media-query.js +1 -1
- package/dist/module/native/conditions/media-query.js.map +1 -1
- package/dist/module/native/objects.js +11 -18
- package/dist/module/native/objects.js.map +1 -1
- package/dist/module/native/react/interaction.js +10 -5
- package/dist/module/native/react/interaction.js.map +1 -1
- package/dist/module/native/react/rules.js +46 -39
- package/dist/module/native/react/rules.js.map +1 -1
- package/dist/module/native/react/useNativeCss.js +73 -18
- package/dist/module/native/react/useNativeCss.js.map +1 -1
- package/dist/module/native/react/usePassthrough.js +5 -2
- package/dist/module/native/react/usePassthrough.js.map +1 -1
- package/dist/module/native/reactivity.js +58 -22
- package/dist/module/native/reactivity.js.map +1 -1
- package/dist/module/native/reanimated.js +15 -3
- package/dist/module/native/reanimated.js.map +1 -1
- package/dist/module/native/styles/calculate-props.js +139 -26
- package/dist/module/native/styles/calculate-props.js.map +1 -1
- package/dist/module/native/styles/functions/animation-timing.js +2 -1
- package/dist/module/native/styles/functions/animation-timing.js.map +1 -1
- package/dist/module/native/styles/functions/color-mix.js +43 -29
- package/dist/module/native/styles/functions/color-mix.js.map +1 -1
- package/dist/module/native/styles/functions/filters.js +17 -4
- package/dist/module/native/styles/functions/filters.js.map +1 -1
- package/dist/module/native/styles/functions/numeric-functions.js +4 -3
- package/dist/module/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/module/native/styles/functions/platform-functions.js +2 -1
- package/dist/module/native/styles/functions/platform-functions.js.map +1 -1
- package/dist/module/native/styles/functions/string-functions.js +19 -5
- package/dist/module/native/styles/functions/string-functions.js.map +1 -1
- package/dist/module/native/styles/functions/transform-functions.js +93 -104
- package/dist/module/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/module/native/styles/index.js +304 -49
- package/dist/module/native/styles/index.js.map +1 -1
- package/dist/module/native/styles/resolve.js +136 -19
- package/dist/module/native/styles/resolve.js.map +1 -1
- package/dist/module/native/styles/scale-factor.js +8 -0
- package/dist/module/native/styles/scale-factor.js.map +1 -0
- package/dist/module/native/styles/shorthands/_handler.js +11 -1
- package/dist/module/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/module/native/styles/shorthands/animation.js +6 -3
- package/dist/module/native/styles/shorthands/animation.js.map +1 -1
- package/dist/module/native/styles/shorthands/box-shadow.js +43 -21
- package/dist/module/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/module/native/styles/shorthands/index.js +1 -0
- package/dist/module/native/styles/shorthands/index.js.map +1 -1
- package/dist/module/native/styles/shorthands/logical-border-width.js +18 -0
- package/dist/module/native/styles/shorthands/logical-border-width.js.map +1 -0
- package/dist/module/native/styles/shorthands/transform.js +31 -8
- package/dist/module/native/styles/shorthands/transform.js.map +1 -1
- package/dist/module/native/styles/variables.js +166 -50
- package/dist/module/native/styles/variables.js.map +1 -1
- package/dist/module/native-internal/root.js +44 -7
- package/dist/module/native-internal/root.js.map +1 -1
- package/dist/module/native-internal/style-collection.js +10 -37
- package/dist/module/native-internal/style-collection.js.map +1 -1
- package/dist/module/native-internal/variables.js +2 -2
- package/dist/module/native-internal/variables.js.map +1 -1
- package/dist/module/utilities/dot-notation.types.js +2 -0
- package/dist/module/utilities/equality.js +37 -0
- package/dist/module/utilities/equality.js.map +1 -0
- package/dist/module/utilities/index.js +1 -0
- package/dist/module/utilities/index.js.map +1 -1
- package/dist/module/utilities/style-descriptor.js +30 -8
- package/dist/module/utilities/style-descriptor.js.map +1 -1
- package/dist/module/web/api.js +2 -2
- package/dist/module/web/api.js.map +1 -1
- package/dist/module/web/assign-style.js +4 -1
- package/dist/module/web/assign-style.js.map +1 -1
- package/dist/typescript/commonjs/src/babel/helpers.d.ts +2 -1
- package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts +2 -1
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/react-native.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts +4 -1
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -5
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +13 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +2 -3
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/individual-transforms.d.ts +10 -0
- package/dist/typescript/commonjs/src/compiler/individual-transforms.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/inline-variables.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/inline-variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/lightningcss-loader.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +2 -1
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +10 -10
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts +2 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +2 -1
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +2 -10
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/cache-version.d.ts +8 -0
- package/dist/typescript/commonjs/src/metro/cache-version.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +9 -4
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/typescript.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/warnings.d.ts +13 -0
- package/dist/typescript/commonjs/src/metro/warnings.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/api.d.ts +5 -9
- package/dist/typescript/commonjs/src/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/conditions/guards.d.ts +2 -1
- package/dist/typescript/commonjs/src/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/objects.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/interaction.d.ts +1 -1
- package/dist/typescript/commonjs/src/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/rules.d.ts +7 -2
- package/dist/typescript/commonjs/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts +0 -3
- package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/usePassthrough.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/reactivity.d.ts +15 -3
- package/dist/typescript/commonjs/src/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/reanimated.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/calculate-props.d.ts +11 -2
- package/dist/typescript/commonjs/src/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/animation-timing.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/filters.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/functions/filters.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/numeric-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/platform-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/transform-functions.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/functions/transform-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/index.d.ts +5 -4
- package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts +4 -1
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/_handler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/transform.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/variables.d.ts +3 -2
- package/dist/typescript/commonjs/src/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/root.d.ts +38 -0
- package/dist/typescript/commonjs/src/native-internal/root.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/style-collection.d.ts +2 -2
- package/dist/typescript/commonjs/src/native-internal/style-collection.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/variables.d.ts +1 -1
- package/dist/typescript/commonjs/src/native-internal/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime.types.d.ts +11 -6
- package/dist/typescript/commonjs/src/runtime.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts +2 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/equality.d.ts +2 -0
- package/dist/typescript/commonjs/src/utilities/equality.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/utilities/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/utilities/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts +14 -1
- package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/web/api.d.ts +5 -5
- package/dist/typescript/commonjs/src/web/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/web/assign-style.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/helpers.d.ts +2 -1
- package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts +2 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/atRules.d.ts +6 -3
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +3 -7
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +14 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +4 -5
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/index.d.ts +2 -2
- package/dist/typescript/module/src/compiler/index.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/individual-transforms.d.ts +10 -0
- package/dist/typescript/module/src/compiler/individual-transforms.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/inline-variables.d.ts +2 -2
- package/dist/typescript/module/src/compiler/inline-variables.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/keyframes.d.ts +2 -2
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/lightningcss-loader.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/media-query.d.ts +3 -3
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +3 -2
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selectors.d.ts +2 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +10 -10
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/module/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/module/src/components/SafeAreaProvider.d.ts +2 -0
- package/dist/typescript/module/src/components/SafeAreaProvider.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts +16 -16
- package/dist/typescript/module/src/components/index.d.ts.map +1 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +2 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +2 -10
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/cache-version.d.ts +8 -0
- package/dist/typescript/module/src/metro/cache-version.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/index.d.ts +5 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +10 -5
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/typescript.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/warnings.d.ts +13 -0
- package/dist/typescript/module/src/metro/warnings.d.ts.map +1 -0
- package/dist/typescript/module/src/native/api.d.ts +6 -10
- package/dist/typescript/module/src/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/attributes.d.ts +1 -1
- package/dist/typescript/module/src/native/conditions/attributes.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/container-query.d.ts +2 -2
- package/dist/typescript/module/src/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/guards.d.ts +4 -3
- package/dist/typescript/module/src/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/index.d.ts +3 -3
- package/dist/typescript/module/src/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/media-query.d.ts +1 -1
- package/dist/typescript/module/src/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/native/index.d.ts +3 -3
- package/dist/typescript/module/src/native/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/objects.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/rules.d.ts +9 -4
- package/dist/typescript/module/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts +4 -7
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/usePassthrough.d.ts +1 -1
- package/dist/typescript/module/src/native/react/usePassthrough.d.ts.map +1 -1
- package/dist/typescript/module/src/native/reactivity.d.ts +15 -3
- package/dist/typescript/module/src/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/native/reanimated.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/calculate-props.d.ts +13 -4
- package/dist/typescript/module/src/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/calc.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/calc.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/filters.d.ts +3 -1
- package/dist/typescript/module/src/native/styles/functions/filters.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/index.d.ts +8 -8
- package/dist/typescript/module/src/native/styles/functions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts +3 -1
- package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts +3 -1
- package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/index.d.ts +9 -8
- package/dist/typescript/module/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/line-height.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/line-height.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/resolve.d.ts +7 -4
- package/dist/typescript/module/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/scale-factor.d.ts +2 -0
- package/dist/typescript/module/src/native/styles/scale-factor.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts +2 -2
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/border.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/border.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/index.d.ts +6 -5
- package/dist/typescript/module/src/native/styles/shorthands/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
- package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/units.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/variables.d.ts +4 -3
- package/dist/typescript/module/src/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/index.d.ts +3 -3
- package/dist/typescript/module/src/native-internal/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/root.d.ts +39 -1
- package/dist/typescript/module/src/native-internal/root.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/style-collection.d.ts +3 -3
- package/dist/typescript/module/src/native-internal/style-collection.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/variables.d.ts +2 -2
- package/dist/typescript/module/src/native-internal/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.d.ts +1 -1
- package/dist/typescript/module/src/runtime.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.native.d.ts +1 -1
- package/dist/typescript/module/src/runtime.native.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.types.d.ts +11 -6
- package/dist/typescript/module/src/runtime.types.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts +2 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/equality.d.ts +2 -0
- package/dist/typescript/module/src/utilities/equality.d.ts.map +1 -0
- package/dist/typescript/module/src/utilities/index.d.ts +4 -3
- package/dist/typescript/module/src/utilities/index.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/specificity.d.ts +2 -2
- package/dist/typescript/module/src/utilities/specificity.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/style-descriptor.d.ts +14 -1
- package/dist/typescript/module/src/utilities/style-descriptor.d.ts.map +1 -1
- package/dist/typescript/module/src/web/api.d.ts +5 -5
- package/dist/typescript/module/src/web/api.d.ts.map +1 -1
- package/dist/typescript/module/src/web/assign-style.d.ts.map +1 -1
- package/dist/typescript/module/src/web/index.d.ts +3 -3
- package/dist/typescript/module/src/web/index.d.ts.map +1 -1
- package/node/babel.mjs +4 -0
- package/node/compiler.mjs +2 -0
- package/node/metro.mjs +2 -0
- package/package.json +78 -31
- package/src/babel/helpers.ts +8 -1
- package/src/babel/import-plugin.ts +31 -16
- package/src/babel/react-native-web.ts +32 -4
- package/src/babel/react-native.ts +9 -4
- package/src/compiler/atRules.ts +44 -0
- package/src/compiler/compiler.ts +282 -50
- package/src/compiler/compiler.types.ts +17 -0
- package/src/compiler/container-query.ts +8 -3
- package/src/compiler/declarations.ts +385 -247
- package/src/compiler/individual-transforms.ts +129 -0
- package/src/compiler/inline-variables.ts +67 -0
- package/src/compiler/lightningcss-loader.ts +16 -15
- package/src/compiler/media-query.ts +20 -9
- package/src/compiler/selector-builder.ts +32 -5
- package/src/compiler/stylesheet.ts +51 -15
- package/src/compiler/supports.ts +1 -3
- package/src/components/FlatList.tsx +1 -0
- package/src/components/ImageBackground.tsx +2 -6
- package/src/components/KeyboardAvoidingView.tsx +2 -3
- package/src/components/SafeAreaProvider.tsx +1 -0
- package/src/components/index.cts +49 -1
- package/src/components/react-native-safe-area-context.native.tsx +20 -0
- package/src/jest/index.ts +3 -1
- package/src/metro/cache-version.ts +48 -0
- package/src/metro/index.ts +7 -0
- package/src/metro/metro-transformer.ts +26 -8
- package/src/metro/typescript.ts +53 -6
- package/src/metro/warnings.ts +187 -0
- package/src/native/api.tsx +26 -18
- package/src/native/conditions/attributes.ts +26 -9
- package/src/native/conditions/container-query.ts +11 -9
- package/src/native/conditions/guards.ts +13 -1
- package/src/native/conditions/media-query.ts +1 -1
- package/src/native/objects.ts +12 -22
- package/src/native/react/interaction.ts +11 -6
- package/src/native/react/rules.ts +58 -45
- package/src/native/react/useNativeCss.ts +85 -18
- package/src/native/react/usePassthrough.ts +3 -2
- package/src/native/reactivity.ts +79 -24
- package/src/native/reanimated.ts +24 -5
- package/src/native/styles/calculate-props.ts +179 -28
- package/src/native/styles/functions/animation-timing.ts +3 -1
- package/src/native/styles/functions/color-mix.ts +45 -39
- package/src/native/styles/functions/filters.ts +21 -6
- package/src/native/styles/functions/numeric-functions.ts +7 -6
- package/src/native/styles/functions/platform-functions.ts +3 -1
- package/src/native/styles/functions/string-functions.ts +25 -5
- package/src/native/styles/functions/transform-functions.ts +111 -64
- package/src/native/styles/index.ts +340 -53
- package/src/native/styles/resolve.ts +188 -29
- package/src/native/styles/scale-factor.ts +9 -0
- package/src/native/styles/shorthands/_handler.ts +14 -1
- package/src/native/styles/shorthands/animation.ts +8 -2
- package/src/native/styles/shorthands/box-shadow.ts +46 -25
- package/src/native/styles/shorthands/index.ts +1 -0
- package/src/native/styles/shorthands/logical-border-width.ts +32 -0
- package/src/native/styles/shorthands/transform.ts +36 -11
- package/src/native/styles/variables.ts +242 -45
- package/src/native-internal/root.ts +83 -13
- package/src/native-internal/style-collection.ts +21 -46
- package/src/native-internal/variables.tsx +6 -4
- package/src/runtime.types.ts +17 -15
- package/src/utilities/dot-notation.types.ts +4 -3
- package/src/utilities/equality.ts +41 -0
- package/src/utilities/index.ts +1 -0
- package/src/utilities/style-descriptor.ts +36 -14
- package/src/web/api.tsx +7 -12
- package/src/web/assign-style.ts +2 -1
- package/types.d.ts +0 -20
- package/dist/commonjs/compiler/inheritance.test.js +0 -78
- package/dist/commonjs/compiler/inheritance.test.js.map +0 -1
- package/dist/module/compiler/inheritance.test.js +0 -78
- package/dist/module/compiler/inheritance.test.js.map +0 -1
- package/dist/typescript/commonjs/.config/eslint.config.d.mts +0 -3
- package/dist/typescript/commonjs/.config/eslint.config.d.mts.map +0 -1
- package/dist/typescript/commonjs/eslint.config.d.mts +0 -2
- package/dist/typescript/commonjs/eslint.config.d.mts.map +0 -1
- package/dist/typescript/commonjs/example/app.config.d.ts +0 -4
- package/dist/typescript/commonjs/example/app.config.d.ts.map +0 -1
- package/dist/typescript/commonjs/example/index.d.ts +0 -2
- package/dist/typescript/commonjs/example/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/example/metro.config.d.ts +0 -3
- package/dist/typescript/commonjs/example/metro.config.d.ts.map +0 -1
- package/dist/typescript/commonjs/example/postcss.config.d.mts +0 -7
- package/dist/typescript/commonjs/example/postcss.config.d.mts.map +0 -1
- package/dist/typescript/commonjs/example/src/App.d.ts +0 -3
- package/dist/typescript/commonjs/example/src/App.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts +0 -2
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts.map +0 -1
- package/dist/typescript/module/.config/eslint.config.d.mts +0 -3
- package/dist/typescript/module/.config/eslint.config.d.mts.map +0 -1
- package/dist/typescript/module/eslint.config.d.mts +0 -2
- package/dist/typescript/module/eslint.config.d.mts.map +0 -1
- package/dist/typescript/module/example/app.config.d.ts +0 -4
- package/dist/typescript/module/example/app.config.d.ts.map +0 -1
- package/dist/typescript/module/example/index.d.ts +0 -2
- package/dist/typescript/module/example/index.d.ts.map +0 -1
- package/dist/typescript/module/example/metro.config.d.ts +0 -3
- package/dist/typescript/module/example/metro.config.d.ts.map +0 -1
- package/dist/typescript/module/example/postcss.config.d.mts +0 -7
- package/dist/typescript/module/example/postcss.config.d.mts.map +0 -1
- package/dist/typescript/module/example/src/App.d.ts +0 -3
- package/dist/typescript/module/example/src/App.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts +0 -2
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts.map +0 -1
- package/src/compiler/inheritance.test.ts +0 -121
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { rootVariables, universalVariables } from "react-native-css/native-internal";
|
|
4
|
-
import { isStyleDescriptorArray } from "react-native-css/utilities";
|
|
3
|
+
import { registeredInheritance, registeredInitialValues, rootVariables, universalVariables } from "react-native-css/native-internal";
|
|
4
|
+
import { isDeepEqual, isStyleDescriptorArray, isStyleFunction } from "react-native-css/utilities";
|
|
5
5
|
import { VAR_SYMBOL } from "../reactivity.js";
|
|
6
6
|
export function varResolver(resolve, fn, get, options) {
|
|
7
7
|
const {
|
|
@@ -10,66 +10,182 @@ export function varResolver(resolve, fn, get, options) {
|
|
|
10
10
|
[VAR_SYMBOL]: true
|
|
11
11
|
},
|
|
12
12
|
inlineVariables,
|
|
13
|
-
variableHistory = new Set()
|
|
13
|
+
variableHistory = options.variableHistory ??= new Set(),
|
|
14
|
+
variableCycles = options.variableCycles ??= new Set()
|
|
14
15
|
} = options;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
let fallback;
|
|
18
|
-
if (typeof args === "string") {
|
|
19
|
-
name = args;
|
|
20
|
-
} else {
|
|
21
|
-
const result = resolve(args);
|
|
22
|
-
if (isStyleDescriptorArray(result)) {
|
|
23
|
-
name = result[0];
|
|
24
|
-
fallback = result[1];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (typeof name !== "string") {
|
|
16
|
+
const name = variableName(fn[2]);
|
|
17
|
+
if (name === undefined) {
|
|
28
18
|
return;
|
|
29
19
|
}
|
|
30
20
|
|
|
31
|
-
//
|
|
21
|
+
// Fallbacks are substituted only when needed, after reading the variable.
|
|
22
|
+
const fallback = variableFallback(fn[2]);
|
|
23
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
24
|
+
|
|
25
|
+
// Share the active resolution path with recursive calls.
|
|
32
26
|
if (variableHistory.has(name)) {
|
|
27
|
+
markCycle(variableHistory, name, variableCycles);
|
|
33
28
|
return;
|
|
34
29
|
}
|
|
35
|
-
if (name in variables) {
|
|
36
|
-
renderGuards?.push(["v", name, variables[name]]);
|
|
37
|
-
return resolve(variables[name]);
|
|
38
|
-
}
|
|
39
30
|
variableHistory.add(name);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
try {
|
|
32
|
+
let value = resolve(inlineVariables?.[name]);
|
|
33
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
34
|
+
if (value !== undefined) {
|
|
35
|
+
options.inlineVariables ??= {
|
|
36
|
+
[VAR_SYMBOL]: "inline"
|
|
37
|
+
};
|
|
38
|
+
options.inlineVariables[name] = value;
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// A universal selector declares the variable on this element. It has lower
|
|
43
|
+
// specificity than the element's class declarations, but beats inheritance.
|
|
44
|
+
value = resolve(get(universalVariables(name)));
|
|
45
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
46
|
+
if (value !== undefined) {
|
|
47
|
+
options.inlineVariables ??= {
|
|
48
|
+
[VAR_SYMBOL]: "inline"
|
|
49
|
+
};
|
|
50
|
+
options.inlineVariables[name] = value;
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// An ancestor's variables and :root reach an element only by inheritance, which a non-inheriting registration switches off
|
|
55
|
+
// Guards retain the ancestor's raw descriptor, matching the context value.
|
|
56
|
+
if (name in variables) {
|
|
57
|
+
if (inherits(name, get)) {
|
|
58
|
+
renderGuards?.push(["v", name, variables[name]]);
|
|
59
|
+
value = resolve(variables[name]);
|
|
60
|
+
// An ancestor's guaranteed-invalid value inherits as such, so the reader takes its own fallback
|
|
61
|
+
return value === undefined || variableCycles.has(name) ? resolve(fallback) : value;
|
|
62
|
+
}
|
|
63
|
+
renderGuards?.push(["n", name, variables[name]]);
|
|
64
|
+
}
|
|
65
|
+
const rootValue = get(rootVariables(name));
|
|
66
|
+
if (rootValue !== undefined && inherits(name, get)) {
|
|
67
|
+
value = resolve(Array.isArray(rootValue) ? substituteOwnValues(rootValue, reference => get(rootVariables(reference)), get) : rootValue);
|
|
68
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
69
|
+
if (value !== undefined) {
|
|
70
|
+
options.inlineVariables ??= {
|
|
71
|
+
[VAR_SYMBOL]: "inline"
|
|
72
|
+
};
|
|
73
|
+
options.inlineVariables[name] = value;
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// A registered initial value applies only where no declaration reaches the element
|
|
79
|
+
value = resolve(get(registeredInitialValues(name)));
|
|
80
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
81
|
+
if (value !== undefined) {
|
|
82
|
+
options.inlineVariables ??= {
|
|
83
|
+
[VAR_SYMBOL]: "inline"
|
|
84
|
+
};
|
|
85
|
+
options.inlineVariables[name] = value;
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
return resolve(fallback);
|
|
89
|
+
} finally {
|
|
90
|
+
variableHistory.delete(name);
|
|
47
91
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
92
|
+
}
|
|
93
|
+
function inherits(name, get) {
|
|
94
|
+
return get(registeredInheritance(name));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// A value that inherits is computed where it is declared, so its references to non-inheriting properties take that scope's own values
|
|
98
|
+
function substituteOwnValues(value, ownValue, get, history = new Set(), cycles = new Set()) {
|
|
99
|
+
if (!Array.isArray(value)) {
|
|
55
100
|
return value;
|
|
56
101
|
}
|
|
57
|
-
|
|
58
|
-
if (value
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
102
|
+
const substitute = descriptor => substituteOwnValues(descriptor, ownValue, get, history, cycles);
|
|
103
|
+
if (!isStyleFunction(value)) {
|
|
104
|
+
let substituted;
|
|
105
|
+
value.forEach((item, index) => {
|
|
106
|
+
const substitutedItem = substitute(item);
|
|
107
|
+
if (substitutedItem !== item) {
|
|
108
|
+
substituted ??= [...value];
|
|
109
|
+
substituted[index] = substitutedItem;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return substituted ?? value;
|
|
64
113
|
}
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
114
|
+
const name = value[1] === "var" ? variableName(value[2]) : undefined;
|
|
115
|
+
if (name === undefined) {
|
|
116
|
+
const substitutedArguments = substitute(value[2]);
|
|
117
|
+
return substitutedArguments === value[2] ? value : withArguments(value, substitutedArguments);
|
|
118
|
+
}
|
|
119
|
+
const fallback = variableFallback(value[2]);
|
|
120
|
+
if (inherits(name, get)) {
|
|
121
|
+
const substitutedFallback = substitute(fallback);
|
|
122
|
+
return substitutedFallback === fallback ? value : withArguments(value, [name, substitutedFallback]);
|
|
123
|
+
}
|
|
124
|
+
if (cycles.has(name)) {
|
|
125
|
+
return substitute(fallback);
|
|
126
|
+
}
|
|
127
|
+
if (history.has(name)) {
|
|
128
|
+
markCycle(history, name, cycles);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
history.add(name);
|
|
132
|
+
try {
|
|
133
|
+
const own = substitute(ownValue(name) ?? get(universalVariables(name)) ?? get(registeredInitialValues(name)));
|
|
134
|
+
return own === undefined || cycles.has(name) ? substitute(fallback) : own;
|
|
135
|
+
} finally {
|
|
136
|
+
history.delete(name);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Returns whether a value the element publishes differs from the one it published last
|
|
141
|
+
export function substituteOwnReferences(variables, ruleVariableNames, inlineVariables, previous, get) {
|
|
142
|
+
// Only inheriting values are rewritten, so a non-inheriting one still reads as declared
|
|
143
|
+
const ownValue = name => ruleVariableNames.has(name) || declaresInline(inlineVariables, name) ? variables[name] : undefined;
|
|
144
|
+
let changed = false;
|
|
145
|
+
|
|
146
|
+
// An inline vars() value is a value, never a reference, so only the rules' variables need rewriting
|
|
147
|
+
for (const name of ruleVariableNames) {
|
|
148
|
+
// Read without subscribing: if a later stylesheet flips `inherits` on a name this element publishes, the change is
|
|
149
|
+
// picked up only when the element next updates for another reason. In practice that matters only during Fast Refresh.
|
|
150
|
+
if (registeredInheritance(name).get()) {
|
|
151
|
+
const declared = variables[name];
|
|
152
|
+
const value = substituteOwnValues(declared, ownValue, get);
|
|
153
|
+
if (value !== declared) {
|
|
154
|
+
// The previous descriptor keeps descendants' guards holding while nothing changed
|
|
155
|
+
variables[name] = previous && isDeepEqual(previous[name], value) ? previous[name] : value;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
changed ||= previous?.[name] !== variables[name];
|
|
159
|
+
}
|
|
160
|
+
return changed;
|
|
161
|
+
}
|
|
162
|
+
function declaresInline(inlineVariables, name) {
|
|
163
|
+
for (const inlineVariable of inlineVariables) {
|
|
164
|
+
if (name in inlineVariable) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
function withArguments(styleFunction, functionArguments) {
|
|
171
|
+
return styleFunction.length === 4 ? [styleFunction[0], styleFunction[1], functionArguments, styleFunction[3]] : [styleFunction[0], styleFunction[1], functionArguments];
|
|
172
|
+
}
|
|
173
|
+
function variableName(variableArguments) {
|
|
174
|
+
if (typeof variableArguments === "string") {
|
|
175
|
+
return variableArguments;
|
|
176
|
+
}
|
|
177
|
+
return isStyleDescriptorArray(variableArguments) && typeof variableArguments[0] === "string" ? variableArguments[0] : undefined;
|
|
178
|
+
}
|
|
179
|
+
function variableFallback(variableArguments) {
|
|
180
|
+
return isStyleDescriptorArray(variableArguments) ? variableArguments[1] : undefined;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Marks only the actual cycle, so a variable that depends on it can still use its own fallback
|
|
184
|
+
function markCycle(history, name, cycles) {
|
|
185
|
+
let inCycle = false;
|
|
186
|
+
for (const dependency of history) {
|
|
187
|
+
if (dependency === name) inCycle = true;
|
|
188
|
+
if (inCycle) cycles.add(dependency);
|
|
72
189
|
}
|
|
73
|
-
return resolve(fallback);
|
|
74
190
|
}
|
|
75
191
|
//# sourceMappingURL=variables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["rootVariables","universalVariables","isStyleDescriptorArray","VAR_SYMBOL","varResolver","resolve","fn","get","options","renderGuards","inheritedVariables","variables","inlineVariables","variableHistory","Set","
|
|
1
|
+
{"version":3,"names":["registeredInheritance","registeredInitialValues","rootVariables","universalVariables","isDeepEqual","isStyleDescriptorArray","isStyleFunction","VAR_SYMBOL","varResolver","resolve","fn","get","options","renderGuards","inheritedVariables","variables","inlineVariables","variableHistory","Set","variableCycles","name","variableName","undefined","fallback","variableFallback","has","markCycle","add","value","inherits","push","rootValue","Array","isArray","substituteOwnValues","reference","delete","ownValue","history","cycles","substitute","descriptor","substituted","forEach","item","index","substitutedItem","substitutedArguments","withArguments","substitutedFallback","own","substituteOwnReferences","ruleVariableNames","previous","declaresInline","changed","declared","inlineVariable","styleFunction","functionArguments","length","variableArguments","inCycle","dependency"],"sourceRoot":"../../../../src","sources":["native/styles/variables.ts"],"mappings":";;AAKA,SACEA,qBAAqB,EACrBC,uBAAuB,EACvBC,aAAa,EACbC,kBAAkB,QACb,kCAAkC;AACzC,SACEC,WAAW,EACXC,sBAAsB,EACtBC,eAAe,QACV,4BAA4B;AAEnC,SACEC,UAAU,QAGL,kBAAe;AAGtB,OAAO,SAASC,WAAWA,CACzBC,OAA2B,EAC3BC,EAAiB,EACjBC,GAAW,EACXC,OAA4B,EAC5B;EACA,MAAM;IACJC,YAAY;IACZC,kBAAkB,EAAEC,SAAS,GAAG;MAAE,CAACR,UAAU,GAAG;IAA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F","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Platform, PlatformColor } from "react-native";
|
|
4
|
+
import { isDeepEqual } from "react-native-css/utilities";
|
|
4
5
|
import { testMediaQuery } from "../native/conditions/media-query.js";
|
|
5
6
|
import { family, observable } from "../native/reactivity.js";
|
|
6
7
|
const rootVariableFamily = () => {
|
|
@@ -20,11 +21,47 @@ const rootVariableFamily = () => {
|
|
|
20
21
|
return obs;
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
|
|
25
|
+
// Static, since the compiler records only the @property rules no condition wraps
|
|
26
|
+
const registeredInitialValueFamily = () => {
|
|
27
|
+
return family(() => observable(undefined, isDeepEqual));
|
|
28
|
+
};
|
|
29
|
+
const registeredInheritanceFamily = () => {
|
|
30
|
+
return family(() => observable(true));
|
|
31
|
+
};
|
|
32
|
+
function seedRootRegistry(root) {
|
|
33
|
+
root("__rn-css-rem").set([[14]]);
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
35
|
+
root("__rn-css-color").set([[Platform.OS === "ios" ? PlatformColor("label", "labelColor") : PlatformColor("?attr/textColorPrimary", "SystemBaseHighColor")]
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Seeded with the registries, so a copy that loads after the stylesheet inject keeps the project's rem
|
|
41
|
+
function createRootVariableRegistries() {
|
|
42
|
+
const registries = {
|
|
43
|
+
root: rootVariableFamily(),
|
|
44
|
+
universal: rootVariableFamily()
|
|
45
|
+
};
|
|
46
|
+
seedRootRegistry(registries.root);
|
|
47
|
+
return registries;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// The exports map gives import and require different builds, and Metro resolves each per requesting module
|
|
51
|
+
globalThis.__react_native_css_root_variable_registries ??= createRootVariableRegistries();
|
|
52
|
+
export const rootVariables = globalThis.__react_native_css_root_variable_registries.root;
|
|
53
|
+
export const universalVariables = globalThis.__react_native_css_root_variable_registries.universal;
|
|
54
|
+
globalThis.__react_native_css_registered_initial_values ??= registeredInitialValueFamily();
|
|
55
|
+
globalThis.__react_native_css_registered_inheritance ??= registeredInheritanceFamily();
|
|
56
|
+
export const registeredInitialValues = globalThis.__react_native_css_registered_initial_values;
|
|
57
|
+
export const registeredInheritance = globalThis.__react_native_css_registered_inheritance;
|
|
58
|
+
|
|
59
|
+
// Clearing suffices between tests, where nothing stays mounted to strand
|
|
60
|
+
export function resetVariableRegistries() {
|
|
61
|
+
rootVariables.clear();
|
|
62
|
+
universalVariables.clear();
|
|
63
|
+
registeredInitialValues.clear();
|
|
64
|
+
registeredInheritance.clear();
|
|
65
|
+
seedRootRegistry(rootVariables);
|
|
66
|
+
}
|
|
30
67
|
//# sourceMappingURL=root.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","PlatformColor","testMediaQuery","family","observable","rootVariableFamily","obs","read","variableValue","undefined","value","mediaQuery","
|
|
1
|
+
{"version":3,"names":["Platform","PlatformColor","isDeepEqual","testMediaQuery","family","observable","rootVariableFamily","obs","read","variableValue","undefined","value","mediaQuery","registeredInitialValueFamily","registeredInheritanceFamily","seedRootRegistry","root","set","OS","createRootVariableRegistries","registries","universal","globalThis","__react_native_css_root_variable_registries","rootVariables","universalVariables","__react_native_css_registered_initial_values","__react_native_css_registered_inheritance","registeredInitialValues","registeredInheritance","resetVariableRegistries","clear"],"sourceRoot":"../../../src","sources":["native-internal/root.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAGtD,SAASC,WAAW,QAAQ,4BAA4B;AAExD,SAASC,cAAc,QAAQ,qCAAkC;AACjE,SAASC,MAAM,EAAEC,UAAU,QAAyB,yBAAsB;AAE1E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,CAAC;EAEDS,gBAAgB,CAACK,UAAU,CAACJ,IAAI,CAAC;EAEjC,OAAOI,UAAU;AACnB;;AAEA;AACAE,UAAU,CAACC,2CAA2C,KACpDJ,4BAA4B,CAAC,CAAC;AAEhC,OAAO,MAAMK,aAAa,GACxBF,UAAU,CAACC,2CAA2C,CAACP,IAAI;AAC7D,OAAO,MAAMS,kBAAkB,GAC7BH,UAAU,CAACC,2CAA2C,CAACF,SAAS;AAElEC,UAAU,CAACI,4CAA4C,KACrDb,4BAA4B,CAAC,CAAC;AAChCS,UAAU,CAACK,yCAAyC,KAClDb,2BAA2B,CAAC,CAAC;AAE/B,OAAO,MAAMc,uBAAuB,GAClCN,UAAU,CAACI,4CAA4C;AAEzD,OAAO,MAAMG,qBAAqB,GAChCP,UAAU,CAACK,yCAAyC;;AAEtD;AACA,OAAO,SAASG,uBAAuBA,CAAA,EAAG;EACxCN,aAAa,CAACO,KAAK,CAAC,CAAC;EACrBN,kBAAkB,CAACM,KAAK,CAAC,CAAC;EAC1BH,uBAAuB,CAACG,KAAK,CAAC,CAAC;EAC/BF,qBAAqB,CAACE,KAAK,CAAC,CAAC;EAE7BhB,gBAAgB,CAACS,aAAa,CAAC;AACjC","ignoreList":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { isDeepEqual } from "react-native-css/utilities";
|
|
3
4
|
import { DEFAULT_CONTAINER_NAME } from "../native/conditions/container-query.js";
|
|
4
5
|
import { family, observable, observableBatch } from "../native/reactivity.js";
|
|
5
|
-
import { rootVariables, universalVariables } from "./root.js";
|
|
6
|
-
export { rootVariables, universalVariables };
|
|
6
|
+
import { registeredInheritance, registeredInitialValues, rootVariables, universalVariables } from "./root.js";
|
|
7
|
+
export { registeredInheritance, registeredInitialValues, rootVariables, universalVariables };
|
|
7
8
|
globalThis.__react_native_css_style_collection ??= {
|
|
8
9
|
styles: family(() => {
|
|
9
10
|
return observable([], isDeepEqual);
|
|
@@ -48,9 +49,15 @@ globalThis.__react_native_css_style_collection ??= {
|
|
|
48
49
|
}
|
|
49
50
|
if (options.vu) {
|
|
50
51
|
for (const entry of options.vu) {
|
|
51
|
-
|
|
52
|
+
universalVariables(entry[0]).set(entry[1]);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
55
|
+
|
|
56
|
+
// Added by name like vr and vu, since Metro injects each CSS file apart and a registration holds across them
|
|
57
|
+
for (const [name, inherits, initialValue] of options.vp ?? []) {
|
|
58
|
+
registeredInheritance(name).set(inherits);
|
|
59
|
+
registeredInitialValues(name).set(initialValue);
|
|
60
|
+
}
|
|
54
61
|
for (const effect of observableBatch.current) {
|
|
55
62
|
effect.run();
|
|
56
63
|
}
|
|
@@ -58,38 +65,4 @@ globalThis.__react_native_css_style_collection ??= {
|
|
|
58
65
|
}
|
|
59
66
|
};
|
|
60
67
|
export const StyleCollection = globalThis.__react_native_css_style_collection;
|
|
61
|
-
function isDeepEqual(a, b) {
|
|
62
|
-
const aArray = Array.isArray(a);
|
|
63
|
-
const bArray = Array.isArray(b);
|
|
64
|
-
const requiresKeyComparison = typeof a === "object" && typeof b === "object" && aArray === bArray;
|
|
65
|
-
|
|
66
|
-
// Only compare keys when both are an object or array
|
|
67
|
-
// This does not account for complex types like Date/Regex, because we don't use them
|
|
68
|
-
if (!requiresKeyComparison) return a === b;
|
|
69
|
-
|
|
70
|
-
// Make either are not null
|
|
71
|
-
if (!a || !b) {
|
|
72
|
-
return a === b;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Shortcut for arrays
|
|
76
|
-
if (aArray && bArray && a.length !== b.length) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Compare a to b
|
|
81
|
-
for (const key in a) {
|
|
82
|
-
if (!isDeepEqual(a[key], b[key])) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Compare b to a
|
|
88
|
-
for (const key in b) {
|
|
89
|
-
if (!(key in a)) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
68
|
//# sourceMappingURL=style-collection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_CONTAINER_NAME","family","observable","observableBatch","rootVariables","universalVariables","globalThis","__react_native_css_style_collection","styles","
|
|
1
|
+
{"version":3,"names":["isDeepEqual","DEFAULT_CONTAINER_NAME","family","observable","observableBatch","registeredInheritance","registeredInitialValues","rootVariables","universalVariables","globalThis","__react_native_css_style_collection","styles","keyframes","inject","options","current","Set","StyleCollection","set","s","v","c","a","p","h","style","k","vr","entry","vu","name","inherits","initialValue","vp","effect","run","undefined"],"sourceRoot":"../../../src","sources":["native-internal/style-collection.ts"],"mappings":";;AAOA,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,sBAAsB,QAAQ,yCAAsC;AAC7E,SACEC,MAAM,EACNC,UAAU,EACVC,eAAe,QAGV,yBAAsB;AAC7B,SACEC,qBAAqB,EACrBC,uBAAuB,EACvBC,aAAa,EACbC,kBAAkB,QACb,WAAQ;AAEf,SACEH,qBAAqB,EACrBC,uBAAuB,EACvBC,aAAa,EACbC,kBAAkB;AAgBpBC,UAAU,CAACC,mCAAmC,KAAK;EACjDC,MAAM,EAAET,MAAM,CAAmC,MAAM;IACrD,OAAOC,UAAU,CAAC,EAAE,EAAEH,WAAW,CAAC;EACpC,CAAC,CAAC;EACFY,SAAS,EAAEV,MAAM,CAAmC,MAAM;IACxD,OAAOC,UAAU,CAAC,EAAE,EAAEH,WAAW,CAAC;EACpC,CAAC,CAAC;EACFa,MAAM,EAAE,SAAAA,CAAUC,OAAiC,EAAE;IACnDV,eAAe,CAACW,OAAO,GAAG,IAAIC,GAAG,CAAC,CAAC;IAEnCC,eAAe,CAACN,MAAM,CAAC,sBAAsB,CAAC,CAACO,GAAG,CAAC,CACjD;MACEC,CAAC,EAAE,CA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OAAO,CAACe,EAAE,EAAE;QAC9BrB,kBAAkB,CAACoB,KAAK,CAAC,CAAC,CAAC,CAAC,CAACV,GAAG,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC;MAC5C;IACF;;IAEA;IACA,KAAK,MAAM,CAACE,IAAI,EAAEC,QAAQ,EAAEC,YAAY,CAAC,IAAIlB,OAAO,CAACmB,EAAE,IAAI,EAAE,EAAE;MAC7D5B,qBAAqB,CAACyB,IAAI,CAAC,CAACZ,GAAG,CAACa,QAAQ,CAAC;MACzCzB,uBAAuB,CAACwB,IAAI,CAAC,CAACZ,GAAG,CAACc,YAAY,CAAC;IACjD;IAEA,KAAK,MAAME,MAAM,IAAI9B,eAAe,CAACW,OAAO,EAAE;MAC5CmB,MAAM,CAACC,GAAG,CAAC,CAAC;IACd;IAEA/B,eAAe,CAACW,OAAO,GAAGqB,SAAS;EACrC;AACF,CAAC;AAED,OAAO,MAAMnB,eAAe,GAAGR,UAAU,CAACC,mCAAmC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { createContext, useContext, useMemo } from "react";
|
|
4
|
-
import { VAR_SYMBOL } from "../native/reactivity.js";
|
|
4
|
+
import { toVariableRecord, VAR_SYMBOL } from "../native/reactivity.js";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
globalThis.__react_native_css_variable_context ??= /*#__PURE__*/createContext({
|
|
7
7
|
[VAR_SYMBOL]: true
|
|
@@ -11,7 +11,7 @@ export function VariableContextProvider(props) {
|
|
|
11
11
|
const inheritedVariables = useContext(VariableContext);
|
|
12
12
|
const value = useMemo(() => ({
|
|
13
13
|
...inheritedVariables,
|
|
14
|
-
...
|
|
14
|
+
...toVariableRecord(props.value),
|
|
15
15
|
[VAR_SYMBOL]: true
|
|
16
16
|
}), [inheritedVariables, props.value]);
|
|
17
17
|
return /*#__PURE__*/_jsx(VariableContext, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","useMemo","VAR_SYMBOL","jsx","_jsx","globalThis","__react_native_css_variable_context","VariableContext","VariableContextProvider","props","inheritedVariables","value","
|
|
1
|
+
{"version":3,"names":["createContext","useContext","useMemo","toVariableRecord","VAR_SYMBOL","jsx","_jsx","globalThis","__react_native_css_variable_context","VariableContext","VariableContextProvider","props","inheritedVariables","value","children"],"sourceRoot":"../../../src","sources":["native-internal/variables.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,UAAU,EACVC,OAAO,QAEF,OAAO;AAId,SACEC,gBAAgB,EAChBC,UAAU,QAEL,yBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9BC,UAAU,CAACC,mCAAmC,kBAC5CR,aAAa,CAAuB;EAClC,CAACI,UAAU,GAAG;AAChB,CAAC,CAAC;AAEJ,OAAO,MAAMK,eAAe,GAAGF,UAAU,CAACC,mCAAmC;AAE7E,OAAO,SAASE,uBAAuBA,CACrCC,KAA2E,EAC3E;EACA,MAAMC,kBAAkB,GAAGX,UAAU,CAACQ,eAAe,CAAC;EAEtD,MAAMI,KAA2B,GAAGX,OAAO,CACzC,OAAO;IACL,GAAGU,kBAAkB;IACrB,GAAGT,gBAAgB,CAACQ,KAAK,CAACE,KAAK,CAAC;IAChC,CAACT,UAAU,GAAG;EAChB,CAAC,CAAC,EACF,CAACQ,kBAAkB,EAAED,KAAK,CAACE,KAAK,CAClC,CAAC;EAED,oBAAOP,IAAA,CAACG,eAAe;IAACI,KAAK,EAAEA,KAAM;IAAAC,QAAA,EAAEH,KAAK,CAACG;EAAQ,CAAkB,CAAC;AAC1E","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function isDeepEqual(a, b) {
|
|
4
|
+
const aArray = Array.isArray(a);
|
|
5
|
+
const bArray = Array.isArray(b);
|
|
6
|
+
const requiresKeyComparison = typeof a === "object" && typeof b === "object" && aArray === bArray;
|
|
7
|
+
|
|
8
|
+
// Only compare keys when both are an object or array
|
|
9
|
+
// This does not account for complex types like Date/Regex, because we don't use them
|
|
10
|
+
if (!requiresKeyComparison) return a === b;
|
|
11
|
+
|
|
12
|
+
// Make either are not null
|
|
13
|
+
if (!a || !b) {
|
|
14
|
+
return a === b;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Shortcut for arrays
|
|
18
|
+
if (aArray && bArray && a.length !== b.length) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Compare a to b
|
|
23
|
+
for (const key in a) {
|
|
24
|
+
if (!isDeepEqual(a[key], b[key])) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Compare b to a
|
|
30
|
+
for (const key in b) {
|
|
31
|
+
if (!(key in a)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=equality.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isDeepEqual","a","b","aArray","Array","isArray","bArray","requiresKeyComparison","length","key"],"sourceRoot":"../../../src","sources":["utilities/equality.ts"],"mappings":";;AAAA,OAAO,SAASA,WAAWA,CAACC,CAAU,EAAEC,CAAU,EAAW;EAC3D,MAAMC,MAAM,GAAGC,KAAK,CAACC,OAAO,CAACJ,CAAC,CAAC;EAC/B,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,CAAC,CAAC;EAC/B,MAAMK,qBAAqB,GACzB,OAAON,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,IAAIC,MAAM,KAAKG,MAAM;;EAErE;EACA;EACA,IAAI,CAACC,qBAAqB,EAAE,OAAON,CAAC,KAAKC,CAAC;;EAE1C;EACA,IAAI,CAACD,CAAC,IAAI,CAACC,CAAC,EAAE;IACZ,OAAOD,CAAC,KAAKC,CAAC;EAChB;;EAEA;EACA,IAAIC,MAAM,IAAIG,MAAM,IAAIL,CAAC,CAACO,MAAM,KAAKN,CAAC,CAACM,MAAM,EAAE;IAC7C,OAAO,KAAK;EACd;;EAEA;EACA,KAAK,MAAMC,GAAG,IAAIR,CAAC,EAAE;IACnB,IACE,CAACD,WAAW,CACTC,CAAC,CAA6BQ,GAAG,CAAC,EAClCP,CAAC,CAA6BO,GAAG,CACpC,CAAC,EACD;MACA,OAAO,KAAK;IACd;EACF;;EAEA;EACA,KAAK,MAAMA,GAAG,IAAIP,CAAC,EAAE;IACnB,IAAI,EAAEO,GAAG,IAAIR,CAAC,CAAC,EAAE;MACf,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utilities/index.ts"],"mappings":";;AAAA,cAAc,kBAAe;AAC7B,cAAc,uBAAoB;AAClC,cAAc,yBAAsB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utilities/index.ts"],"mappings":";;AAAA,cAAc,eAAY;AAC1B,cAAc,kBAAe;AAC7B,cAAc,uBAAoB;AAClC,cAAc,yBAAsB","ignoreList":[]}
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
export function isStyleDescriptorArray(value) {
|
|
4
|
-
|
|
5
|
-
// If its an array and the first item is an object, the only allowed value is an array
|
|
6
|
-
return typeof value[0] === "object" ? Array.isArray(value[0]) : true;
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
4
|
+
return Array.isArray(value) && !isStyleFunction(value);
|
|
9
5
|
}
|
|
10
6
|
export function isStyleFunction(value) {
|
|
11
|
-
if (Array.isArray(value))
|
|
12
|
-
|
|
7
|
+
if (!Array.isArray(value)) return false;
|
|
8
|
+
const marker = value[0];
|
|
9
|
+
return marker !== null && typeof marker === "object" && !Array.isArray(marker) && Object.keys(marker).length === 0 && typeof value[1] === "string";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Whether a resolved value is a comma-separated list: an array of items, each
|
|
14
|
+
* the array of its tokens. A resolved value holds no style functions, so an
|
|
15
|
+
* array led by an array is one. For a descriptor, which can be led by a
|
|
16
|
+
* function, test its first entry with isStyleDescriptorArray instead.
|
|
17
|
+
*/
|
|
18
|
+
export function isCommaList(value) {
|
|
19
|
+
return Array.isArray(value) && Array.isArray(value[0]);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A resolved comma-separated list with each one-token item unwrapped, the
|
|
24
|
+
* form function arguments and React Native's list props take. Anything else
|
|
25
|
+
* is returned as it is.
|
|
26
|
+
*/
|
|
27
|
+
export function commaListItems(value) {
|
|
28
|
+
if (!isCommaList(value)) return value;
|
|
29
|
+
|
|
30
|
+
// push, not map() or new Array(n), which Hermes runs slower: React
|
|
31
|
+
// Native's list props pass through here on every render
|
|
32
|
+
const items = [];
|
|
33
|
+
for (const item of value) {
|
|
34
|
+
items.push(item.length === 1 ? item[0] : item);
|
|
13
35
|
}
|
|
14
|
-
return
|
|
36
|
+
return items;
|
|
15
37
|
}
|
|
16
38
|
//# sourceMappingURL=style-descriptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isStyleDescriptorArray","value","Array","isArray","isStyleFunction","Object","keys","length"],"sourceRoot":"../../../src","sources":["utilities/style-descriptor.ts"],"mappings":";;AAEA,OAAO,SAASA,sBAAsBA,CACpCC,KAAc,EACc;EAC5B,
|
|
1
|
+
{"version":3,"names":["isStyleDescriptorArray","value","Array","isArray","isStyleFunction","marker","Object","keys","length","isCommaList","commaListItems","items","item","push"],"sourceRoot":"../../../src","sources":["utilities/style-descriptor.ts"],"mappings":";;AAEA,OAAO,SAASA,sBAAsBA,CACpCC,KAAc,EACc;EAC5B,OAAOC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAI,CAACG,eAAe,CAACH,KAAK,CAAC;AACxD;AAEA,OAAO,SAASG,eAAeA,CAACH,KAAc,EAA0B;EACtE,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE,OAAO,KAAK;EACvC,MAAMI,MAAe,GAAGJ,KAAK,CAAC,CAAC,CAAC;EAChC,OACEI,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ,IAC1B,CAACH,KAAK,CAACC,OAAO,CAACE,MAAM,CAAC,IACtBC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,KAAK,CAAC,IAChC,OAAOP,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;AAEhC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,WAAWA,CAACR,KAAc,EAAwB;EAChE,OAAOC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,cAAcA,CAACT,KAAc,EAAW;EACtD,IAAI,CAACQ,WAAW,CAACR,KAAK,CAAC,EAAE,OAAOA,KAAK;;EAErC;EACA;EACA,MAAMU,KAAgB,GAAG,EAAE;EAC3B,KAAK,MAAMC,IAAI,IAAIX,KAAK,EAAE;IACxBU,KAAK,CAACE,IAAI,CAACD,IAAI,CAACJ,MAAM,KAAK,CAAC,GAAGI,IAAI,CAAC,CAAC,CAAC,GAAGA,IAAI,CAAC;EAChD;EACA,OAAOD,KAAK;AACd","ignoreList":[]}
|
package/dist/module/web/api.js
CHANGED
|
@@ -9,7 +9,7 @@ const defaultMapping = {
|
|
|
9
9
|
};
|
|
10
10
|
export const styled = (baseComponent, mapping = defaultMapping, _options) => {
|
|
11
11
|
return props => {
|
|
12
|
-
return useCssElement(baseComponent,
|
|
12
|
+
return useCssElement(baseComponent, props, mapping);
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
export const useCssElement = (component, incomingProps, mapping) => {
|
|
@@ -40,7 +40,7 @@ export const colorScheme = {
|
|
|
40
40
|
return Appearance.getColorScheme();
|
|
41
41
|
},
|
|
42
42
|
set(name) {
|
|
43
|
-
Appearance.setColorScheme(name);
|
|
43
|
+
Appearance.setColorScheme(name ?? "unspecified");
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createElement","useMemo","Appearance","assignStyle","jsx","_jsx","defaultMapping","className","styled","baseComponent","mapping","_options","props","useCssElement","component","incomingProps","key","value","Object","entries","source","target","$$css","split","colorScheme","get","getColorScheme","set","name","setColorScheme","vars","variables","$variables","startsWith","toString","VariableContextProvider","style","display","fromEntries","map","children","useNativeVariable","Error","useUnstableNativeVariable"],"sourceRoot":"../../../src","sources":["web/api.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,OAAO,
|
|
1
|
+
{"version":3,"names":["createElement","useMemo","Appearance","assignStyle","jsx","_jsx","defaultMapping","className","styled","baseComponent","mapping","_options","props","useCssElement","component","incomingProps","key","value","Object","entries","source","target","$$css","split","colorScheme","get","getColorScheme","set","name","setColorScheme","vars","variables","$variables","startsWith","toString","VariableContextProvider","style","display","fromEntries","map","children","useNativeVariable","Error","useUnstableNativeVariable"],"sourceRoot":"../../../src","sources":["web/api.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,OAAO,QAGF,OAAO;AACd,SAASC,UAAU,QAAQ,cAAc;AAUzC,SAASC,WAAW,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7C,MAAMC,cAAsE,GAAG;EAC7EC,SAAS,EAAE;AACb,CAAC;AAED,OAAO,MAAMC,MAAc,GAAGA,CAC5BC,aAA6B,EAC7BC,OAA4C,GAAGJ,cAAc,EAC7DK,QAAwB,KACrB;EACH,OAAQC,KAAY,IAAK;IAC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